rp2: Add Bluetooth support via cyw43.

Using BTstack with CYW43 for Pico W.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Peter Harper
2022-07-13 13:08:09 +01:00
committed by Damien George
parent 35182a8688
commit 888a15cda3
9 changed files with 238 additions and 17 deletions

View File

@@ -50,11 +50,6 @@ void mp_bluetooth_hci_init(void) {
events_task_is_scheduled = false;
}
STATIC void mp_bluetooth_hci_start_polling(void) {
events_task_is_scheduled = false;
mp_bluetooth_hci_poll_now();
}
static int64_t mp_bluetooth_hci_timer_callback(alarm_id_t id, void *user_data) {
poll_timer_id = 0;
mp_bluetooth_hci_poll_now();
@@ -70,7 +65,7 @@ void mp_bluetooth_hci_poll_in_ms(uint32_t ms) {
STATIC mp_obj_t run_events_scheduled_task(mp_obj_t none_in) {
(void)none_in;
events_task_is_scheduled = false;
// This will process all buffered HCI UART data, and run any callouts or events.
// This will process all HCI data, and run any callouts or events.
mp_bluetooth_hci_poll();
return mp_const_none;
}
@@ -88,8 +83,15 @@ void mp_bluetooth_hci_poll_now(void) {
}
}
#if defined(MICROPY_HW_BLE_UART_ID)
mp_obj_t mp_bthci_uart;
STATIC void mp_bluetooth_hci_start_polling(void) {
events_task_is_scheduled = false;
mp_bluetooth_hci_poll_now();
}
int mp_bluetooth_hci_uart_init(uint32_t port, uint32_t baudrate) {
debug_printf("mp_bluetooth_hci_uart_init\n");
@@ -121,11 +123,6 @@ int mp_bluetooth_hci_uart_deinit(void) {
return 0;
}
int mp_bluetooth_hci_uart_set_baudrate(uint32_t baudrate) {
debug_printf("mp_bluetooth_hci_uart_set_baudrate(%lu)\n", baudrate);
return 0;
}
int mp_bluetooth_hci_uart_any(void) {
int errcode = 0;
const mp_stream_p_t *proto = (mp_stream_p_t *)MP_OBJ_TYPE_GET_SLOT(&machine_uart_type, protocol);
@@ -171,6 +168,13 @@ int mp_bluetooth_hci_uart_readchar(void) {
}
}
int mp_bluetooth_hci_uart_set_baudrate(uint32_t baudrate) {
debug_printf("mp_bluetooth_hci_uart_set_baudrate(%lu)\n", baudrate);
return 0;
}
#endif // defined(MICROPY_HW_BLE_UART_ID)
// Default (weak) implementation of the HCI controller interface.
// A driver (e.g. cywbt43.c) can override these for controller-specific
// functionality (i.e. power management).