Skip to content

Commit c8cc9b4

Browse files
committed
pbio/drv/bluetooth_stm32_cc2640: Explain how the process ticks along.
1 parent a7379f7 commit c8cc9b4

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/pbio/drv/bluetooth/bluetooth_stm32_cc2640.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2350,6 +2350,13 @@ PROCESS_THREAD(pbdrv_bluetooth_spi_process, ev, data) {
23502350
break;
23512351
}
23522352

2353+
// - spi_srdy is set by the interrupt handler when there is new
2354+
// data to be processed, which also polls this process in order
2355+
// to push PROCESS_WAIT_UNTIL to evaluate this condition again.
2356+
// - write_xfer_size is set by HCI_sendHCICommand when the current
2357+
// task driven by pbio_task_run_once above wants to send
2358+
// something. This doesn't poll the process because we
2359+
// are already here.
23532360
spi_srdy || write_xfer_size;
23542361
});
23552362

@@ -2421,7 +2428,10 @@ PROCESS_THREAD(pbdrv_bluetooth_spi_process, ev, data) {
24212428
PROCESS_END();
24222429
}
24232430

2424-
// implements function for bt5stack library
2431+
// Implements function for bt5stack library. Doesn't send right away, but gets
2432+
// data ready and sets write_xfer_size so that bluetooth driver process can
2433+
// send it. It is only ever called from within the bluetooth process, so this
2434+
// doesn't need to poll the process to push it along.
24252435
HCI_StatusCodes_t HCI_sendHCICommand(uint16_t opcode, uint8_t *pData, uint8_t dataLength) {
24262436
assert(write_xfer_size == 0);
24272437

0 commit comments

Comments
 (0)