diff --git a/epicardium/ble/ble.c b/epicardium/ble/ble.c index 2ef81b930a4aee639ee888ea654415da43ce929a..0b066379664dd565edf62cf4b16b2b93796a744d 100644 --- a/epicardium/ble/ble.c +++ b/epicardium/ble/ble.c @@ -30,6 +30,9 @@ struct log_packet_header { uint32_t timestamp_us_h; uint32_t timestamp_us_l; }; + +static uint8_t bdAddr[6] = { 0xCA, 0x4D, 0x10, 0x00, 0x00, 0x00 }; + static const uint8_t log_header[] = { 'b', 't', 's', 'n', 'o', 'o', 'p', 0, 0, 0, 0, 1, 0, 0, 0x03, 0xea }; @@ -178,7 +181,6 @@ static void WsfInit(void) /* TODO: We need a source of MACs */ static void setAddress(void) { - uint8_t bdAddr[6] = { 0xCA, 0x4D, 0x10, 0x00, 0x00, 0x00 }; char buf[32]; int result = epic_config_get_string("ble_mac", buf, sizeof(buf)); @@ -222,6 +224,11 @@ static void setAddress(void) HciVsSetBdAddr(bdAddr); } /*************************************************************************************************/ +void epic_ble_get_address(uint8_t *addr) +{ + memcpy(addr, bdAddr, sizeof(bdAddr)); +} +/*************************************************************************************************/ static void vTimerCallback(xTimerHandle pxTimer) { //printf("wake\n"); diff --git a/epicardium/epicardium.h b/epicardium/epicardium.h index 50632e5bf7e1961ee74f7c317e1506df09441606..78c1de9f86e2a5fe0fe560c368b98ebc4a7cab69 100644 --- a/epicardium/epicardium.h +++ b/epicardium/epicardium.h @@ -177,6 +177,7 @@ typedef _Bool bool; #define API_BLE_GET_ATT_WRITE 0x1BD #define API_BLE_FREE_ATT_WRITE 0x1BE #define API_BLE_ATTS_DYN_ADD_CHARACTERISTIC 0x1BF +#define API_BLE_GET_ADDRESS 0x174 /* clang-format on */ @@ -2605,6 +2606,7 @@ API(API_BLE_ATTS_SET_BUFFER, int epic_ble_atts_set_buffer(uint16_t value_handle, API(API_BLE_FREE_EVENT, int epic_ble_free_event(struct epic_ble_event *e)); +API(API_BLE_GET_ADDRESS, void epic_ble_get_address(uint8_t *addr)); #endif /* _EPICARDIUM_H */ diff --git a/pycardium/modules/modbluetooth_card10.c b/pycardium/modules/modbluetooth_card10.c index c5dc5eaa231ec288d8f1e40838f04a1c4645e1c4..cbebefcecedf94d75208c93918d3847418031ae9 100644 --- a/pycardium/modules/modbluetooth_card10.c +++ b/pycardium/modules/modbluetooth_card10.c @@ -327,7 +327,7 @@ bool mp_bluetooth_is_active(void) // Gets the MAC addr of this device in big-endian format. void mp_bluetooth_get_device_addr(uint8_t *addr) { - raise(); + epic_ble_get_address(addr); } size_t mp_bluetooth_gap_get_device_name(const uint8_t **buf)