Skip to content

Commit 8b36965

Browse files
committed
portentaH7: Change BLE public address
1 parent c63bee6 commit 8b36965

File tree

1 file changed

+11
-0
lines changed
  • features/FEATURE_BLE/targets/TARGET_STM/TARGET_CYW4343X

1 file changed

+11
-0
lines changed

features/FEATURE_BLE/targets/TARGET_STM/TARGET_CYW4343X/HCIDriver.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,24 @@ class HCIDriver : public cordio::CordioHCIDriver {
383383
#endif /* BT_UART_NO_3M_SUPPORT */
384384
}
385385

386+
void inject_bdaddr(uint8_t* pBuf)
387+
{
388+
if (service_pack_ptr + service_pack_index == brcm_patchram_buf) {
389+
uint8_t bdAddr[6] = { 0xFF, 0xFF, 0xFF, 0x0A, 0x61, 0xA8 };
390+
uint32_t uniqueId = HAL_GetUIDw0() ^ HAL_GetUIDw1() ^ HAL_GetUIDw2();
391+
memcpy(bdAddr, &uniqueId, 3);
392+
memcpy(&pBuf[33], bdAddr, sizeof(bdAddr));
393+
}
394+
}
395+
386396
void send_service_pack_command(void)
387397
{
388398
uint16_t cmd_len = service_pack_ptr[service_pack_index + 2];
389399
uint16_t cmd_opcode = (service_pack_ptr[service_pack_index + 1] << 8) | service_pack_ptr[service_pack_index + 0];
390400
uint8_t *pBuf = hciCmdAlloc(cmd_opcode, cmd_len);
391401
if (pBuf) {
392402
memcpy(pBuf + HCI_CMD_HDR_LEN, service_pack_ptr + service_pack_index + HCI_CMD_HDR_LEN, cmd_len);
403+
inject_bdaddr(pBuf);
393404
hciCmdSend(pBuf);
394405
} else {
395406
}

0 commit comments

Comments
 (0)