Skip to content
Snippets Groups Projects
Verified Commit b3eec4e7 authored by schneider's avatar schneider Committed by rahix
Browse files

fix(ble): Remove app callback to set BT MAC

parent f5f2d972
No related branches found
No related tags found
No related merge requests found
...@@ -91,37 +91,25 @@ static void WsfInit(void) ...@@ -91,37 +91,25 @@ static void WsfInit(void)
WsfTraceEnable(TRUE); WsfTraceEnable(TRUE);
} }
/* TODO: We need a source of MACs */ /* TODO: We need a source of MACs */
/* static void setAddress(void)
* In two-chip solutions, setting the address must wait until the HCI interface is initialized.
* This handler can also catch other Application events, but none are currently implemented.
* See ble-profiles/sources/apps/app/common/app_ui.c for further details.
*
*/
void SetAddress(uint8_t event)
{ {
uint8_t bdAddr[6] = {0x02, 0x02, 0x44, 0x8B, 0x05, 0x00}; uint8_t bdAddr[6] = {0x02, 0x02, 0x44, 0x8B, 0x05, 0x00};
char buf[32]; char buf[32];
switch (event) { fs_read_text_file("mac.txt", buf, sizeof(buf));
case APP_UI_RESET_CMPL: printf("mac file: %s\n", buf);
fs_read_text_file("mac.txt", buf, sizeof(buf)); int a, b, c, d, e, f;
printf("mac file: %s\n", buf); if(sscanf(buf, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f) == 6) {
int a, b, c, d, e, f; bdAddr[0] = f;
if(sscanf(buf, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f) == 6) { bdAddr[1] = e;
bdAddr[0] = f; bdAddr[2] = d;
bdAddr[1] = e; bdAddr[3] = c;
bdAddr[2] = d; bdAddr[4] = b;
bdAddr[3] = c; bdAddr[5] = a;
bdAddr[4] = b;
bdAddr[5] = a;
}
printf("Setting address -- MAC %02X:%02X:%02X:%02X:%02X:%02X\n", bdAddr[5], bdAddr[4], bdAddr[3], bdAddr[2], bdAddr[1], bdAddr[0]);
HciVsSetBdAddr(bdAddr);
break;
default:
break;
} }
printf("Setting address -- MAC %02X:%02X:%02X:%02X:%02X:%02X\n", bdAddr[5], bdAddr[4], bdAddr[3], bdAddr[2], bdAddr[1], bdAddr[0]);
HciVsSetBdAddr(bdAddr);
} }
static StaticTimer_t x; static StaticTimer_t x;
...@@ -329,6 +317,7 @@ static void ble_init(void) ...@@ -329,6 +317,7 @@ static void ble_init(void)
{ {
WsfInit(); WsfInit();
StackInitFit(); StackInitFit();
setAddress();
NVIC_SetPriority(BTLE_SFD_TO_IRQn, 2); NVIC_SetPriority(BTLE_SFD_TO_IRQn, 2);
NVIC_SetPriority(BTLE_TX_DONE_IRQn, 2); NVIC_SetPriority(BTLE_TX_DONE_IRQn, 2);
NVIC_SetPriority(BTLE_RX_RCVD_IRQn, 2); NVIC_SetPriority(BTLE_RX_RCVD_IRQn, 2);
...@@ -341,10 +330,6 @@ static void ble_init(void) ...@@ -341,10 +330,6 @@ static void ble_init(void)
AttsDynRegister(pSHdl, UARTReadCback, UARTWriteCback); AttsDynRegister(pSHdl, UARTReadCback, UARTWriteCback);
//AttsDynRegister(pSHdl, NULL, UARTWriteCback); //AttsDynRegister(pSHdl, NULL, UARTWriteCback);
/* Register a handler for Application events */
AppUiActionRegister(SetAddress);
lasttick = xTaskGetTickCount(); lasttick = xTaskGetTickCount();
timerWakeup = xTimerCreateStatic( timerWakeup = xTimerCreateStatic(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment