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
......@@ -91,37 +91,25 @@ static void WsfInit(void)
WsfTraceEnable(TRUE);
}
/* TODO: We need a source of MACs */
/*
* 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)
static void setAddress(void)
{
uint8_t bdAddr[6] = {0x02, 0x02, 0x44, 0x8B, 0x05, 0x00};
char buf[32];
switch (event) {
case APP_UI_RESET_CMPL:
fs_read_text_file("mac.txt", buf, sizeof(buf));
printf("mac file: %s\n", buf);
int a, b, c, d, e, f;
if(sscanf(buf, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f) == 6) {
bdAddr[0] = f;
bdAddr[1] = e;
bdAddr[2] = d;
bdAddr[3] = c;
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;
fs_read_text_file("mac.txt", buf, sizeof(buf));
printf("mac file: %s\n", buf);
int a, b, c, d, e, f;
if(sscanf(buf, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e, &f) == 6) {
bdAddr[0] = f;
bdAddr[1] = e;
bdAddr[2] = d;
bdAddr[3] = c;
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);
}
static StaticTimer_t x;
......@@ -329,6 +317,7 @@ static void ble_init(void)
{
WsfInit();
StackInitFit();
setAddress();
NVIC_SetPriority(BTLE_SFD_TO_IRQn, 2);
NVIC_SetPriority(BTLE_TX_DONE_IRQn, 2);
NVIC_SetPriority(BTLE_RX_RCVD_IRQn, 2);
......@@ -341,10 +330,6 @@ static void ble_init(void)
AttsDynRegister(pSHdl, UARTReadCback, UARTWriteCback);
//AttsDynRegister(pSHdl, NULL, UARTWriteCback);
/* Register a handler for Application events */
AppUiActionRegister(SetAddress);
lasttick = xTaskGetTickCount();
timerWakeup = xTimerCreateStatic(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment