Updated part7 docs

This commit is contained in:
Adam Greenwood-Byrne 2021-02-15 09:53:20 +00:00
parent 88b45b66ab
commit 7d36b81242

View file

@ -70,7 +70,8 @@ Now the device is waiting. We need to send it the firmware bytes we included in
```c ```c
void bt_loadfirmware() void bt_loadfirmware()
{ {
if (!hciCommand(OGF_VENDOR, COMMAND_LOAD_FIRMWARE, empty, 0)) uart_writeText("loadFirmware() failed\n"); volatile unsigned char empty[] = {};
if (hciCommand(OGF_VENDOR, COMMAND_LOAD_FIRMWARE, empty, 0)) uart_writeText("loadFirmware() failed\n");
extern unsigned char _binary_BCM4345C0_hcd_start[]; extern unsigned char _binary_BCM4345C0_hcd_start[];
extern unsigned char _binary_BCM4345C0_hcd_size[]; extern unsigned char _binary_BCM4345C0_hcd_size[];
@ -78,16 +79,23 @@ void bt_loadfirmware()
unsigned int c=0; unsigned int c=0;
unsigned int size = (long)&_binary_BCM4345C0_hcd_size; unsigned int size = (long)&_binary_BCM4345C0_hcd_size;
while (c < size) { unsigned char opcodebytes[2];
unsigned char opcodebytes[] = { _binary_BCM4345C0_hcd_start[c], _binary_BCM4345C0_hcd_start[c+1] }; unsigned char length;
unsigned char length = _binary_BCM4345C0_hcd_start[c+2]; unsigned char *data = &(_binary_BCM4345C0_hcd_start[0]);
unsigned char *data = &(_binary_BCM4345C0_hcd_start[c+3]);
if (!hciCommandBytes(opcodebytes, data, length)) { while (c < size) {
uart_writeText("Firmware data load failed\n"); opcodebytes[0] = *data;
break; opcodebytes[1] = *(data+1);
} length = *(data+2);
c += 3 + length; data += 3;
if (hciCommandBytes(opcodebytes, data, length)) {
uart_writeText("Firmware data load failed\n");
break;
}
data += length;
c += 3 + length;
} }
wait_msec(0x100000); wait_msec(0x100000);