mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-10 10:21:48 +00:00
47 lines
1.4 KiB
Diff
47 lines
1.4 KiB
Diff
diff --git a/samples/bluetooth/hci_uart/src/main.c b/samples/bluetooth/hci_uart/src/main.c
|
|
index b103f05..80a82d3 100644
|
|
--- a/samples/bluetooth/hci_uart/src/main.c
|
|
+++ b/samples/bluetooth/hci_uart/src/main.c
|
|
@@ -36,6 +36,9 @@
|
|
#include <bluetooth/buf.h>
|
|
#include <bluetooth/hci_raw.h>
|
|
|
|
+#include "ll.h"
|
|
+#include "nrf.h"
|
|
+
|
|
static struct device *hci_uart_dev;
|
|
|
|
#define STACK_SIZE 1024
|
|
@@ -301,6 +304,18 @@ static int hci_uart_init(struct device *unused)
|
|
DEVICE_INIT(hci_uart, "hci_uart", &hci_uart_init, NULL, NULL,
|
|
APPLICATION, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
|
|
|
+void little_endian_store_16(uint8_t *buffer, uint16_t pos, uint16_t value){
|
|
+ buffer[pos++] = value;
|
|
+ buffer[pos++] = value >> 8;
|
|
+}
|
|
+
|
|
+void little_endian_store_32(uint8_t *buffer, uint16_t pos, uint32_t value){
|
|
+ buffer[pos++] = value;
|
|
+ buffer[pos++] = value >> 8;
|
|
+ buffer[pos++] = value >> 16;
|
|
+ buffer[pos++] = value >> 24;
|
|
+}
|
|
+
|
|
void main(void)
|
|
{
|
|
/* incoming events and data from the controller */
|
|
@@ -320,6 +335,12 @@ void main(void)
|
|
(nano_fiber_entry_t)tx_fiber, 0, 0, 7, 0);
|
|
|
|
bt_enable_raw(&rx_queue);
|
|
+
|
|
+ // make Random Static Address available via HCI Read BD ADDR as fake public address
|
|
+ uint8_t addr[6];
|
|
+ little_endian_store_16(addr, 4, NRF_FICR->DEVICEADDR[1] | 0xc000);
|
|
+ little_endian_store_32(addr, 0, NRF_FICR->DEVICEADDR[0]);
|
|
+ ll_address_set(0, addr);
|
|
|
|
while (1) {
|
|
struct net_buf *buf;
|