|
@@ -173,14 +173,21 @@ void bt_stack_main(void *param)
|
|
|
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
|
|
btstack_run_loop_init(btstack_run_loop_posix_get_instance());
|
|
|
|
|
|
|
|
// pick serial port and configure uart block driver
|
|
// pick serial port and configure uart block driver
|
|
|
|
|
+#ifdef BTSTACK_BT_UART_PORT_DEV_NAME
|
|
|
|
|
+ transport_config.device_name = BTSTACK_BT_UART_PORT_DEV_NAME; //"/dev/uart2"; // RedBear IoT pHAT breakout board
|
|
|
|
|
+#else
|
|
|
transport_config.device_name = "/dev/uart3"; // RedBear IoT pHAT breakout board
|
|
transport_config.device_name = "/dev/uart3"; // RedBear IoT pHAT breakout board
|
|
|
-
|
|
|
|
|
|
|
+#endif
|
|
|
// get BCM chipset driver
|
|
// get BCM chipset driver
|
|
|
const btstack_chipset_t *chipset = btstack_chipset_bcm_instance();
|
|
const btstack_chipset_t *chipset = btstack_chipset_bcm_instance();
|
|
|
chipset->init(&transport_config);
|
|
chipset->init(&transport_config);
|
|
|
|
|
|
|
|
// set chipset name
|
|
// set chipset name
|
|
|
|
|
+#ifdef BTSTACK_BT_PATCH_NAME
|
|
|
|
|
+ btstack_chipset_bcm_set_device_name(BTSTACK_BT_PATCH_NAME);
|
|
|
|
|
+#else
|
|
|
btstack_chipset_bcm_set_device_name("/dev/bt_image");
|
|
btstack_chipset_bcm_set_device_name("/dev/bt_image");
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
// setup UART driver
|
|
// setup UART driver
|
|
|
const btstack_uart_block_t *uart_driver = btstack_uart_block_posix_instance();
|
|
const btstack_uart_block_t *uart_driver = btstack_uart_block_posix_instance();
|
|
@@ -190,6 +197,14 @@ void bt_stack_main(void *param)
|
|
|
uart_config.flowcontrol = transport_config.flowcontrol;
|
|
uart_config.flowcontrol = transport_config.flowcontrol;
|
|
|
uart_config.device_name = transport_config.device_name;
|
|
uart_config.device_name = transport_config.device_name;
|
|
|
uart_driver->init(&uart_config);
|
|
uart_driver->init(&uart_config);
|
|
|
|
|
+#ifdef BTSTACK_BT_RESET_PIN
|
|
|
|
|
+ rt_pin_mode(BTSTACK_BT_RESET_PIN, PIN_MODE_OUTPUT);
|
|
|
|
|
+
|
|
|
|
|
+ rt_pin_write(BTSTACK_BT_RESET_PIN, PIN_LOW);
|
|
|
|
|
+ HAL_Delay(1000);
|
|
|
|
|
+ rt_pin_write(BTSTACK_BT_RESET_PIN, PIN_HIGH);
|
|
|
|
|
+ HAL_Delay(1000);
|
|
|
|
|
+#else
|
|
|
#ifdef SOC_FAMILY_STM32
|
|
#ifdef SOC_FAMILY_STM32
|
|
|
#define BT_AP6212_PIN GET_PIN(I, 11)
|
|
#define BT_AP6212_PIN GET_PIN(I, 11)
|
|
|
rt_pin_mode(BT_AP6212_PIN, PIN_MODE_OUTPUT);
|
|
rt_pin_mode(BT_AP6212_PIN, PIN_MODE_OUTPUT);
|
|
@@ -198,8 +213,10 @@ void bt_stack_main(void *param)
|
|
|
HAL_Delay(1000);
|
|
HAL_Delay(1000);
|
|
|
rt_pin_write(BT_AP6212_PIN, PIN_HIGH);
|
|
rt_pin_write(BT_AP6212_PIN, PIN_HIGH);
|
|
|
HAL_Delay(1000);
|
|
HAL_Delay(1000);
|
|
|
|
|
+#else
|
|
|
|
|
+#error "Please set the reset pin
|
|
|
|
|
+#endif
|
|
|
#endif
|
|
#endif
|
|
|
-
|
|
|
|
|
// setup HCI (to be able to use bcm chipset driver)
|
|
// setup HCI (to be able to use bcm chipset driver)
|
|
|
// init HCI
|
|
// init HCI
|
|
|
const hci_transport_t *transport = hci_transport_h4_instance(uart_driver);
|
|
const hci_transport_t *transport = hci_transport_h4_instance(uart_driver);
|