Skip to content

Commit f0565c5

Browse files
committed
pbio/platform/ev3: Bluetooth platform_data defs.
Adds the definitions for the platform data necessary to hook btstack up to the ev3's bluetooth module.
1 parent db6e51c commit f0565c5

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/pbio/platform/ev3/platform.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@
6767
#include "exceptionhandler.h"
6868

6969
#include "../../drv/block_device/block_device_ev3.h"
70+
#include "../../drv/bluetooth/bluetooth_btstack_control_gpio.h"
71+
#include "../../drv/bluetooth/bluetooth_btstack_uart_block_ev3.h"
7072
#include "../../drv/button/button_gpio.h"
7173
#include "../../drv/display/display_ev3.h"
7274
#include "../../drv/gpio/gpio_ev3.h"
@@ -757,6 +759,15 @@ enum {
757759
};
758760
uint8_t pbdrv_ev3_bluetooth_mac_address[6];
759761

762+
static const pbdrv_gpio_t bluetooth_enable = PBDRV_GPIO_EV3_PIN(9, 27, 24, 4, 9);
763+
const pbdrv_bluetooth_btstack_control_gpio_platform_data_t pbdrv_bluetooth_btstack_control_gpio_platform_data = {
764+
.enable_gpio = bluetooth_enable,
765+
};
766+
767+
const pbdrv_bluetooth_btstack_uart_block_ev3_platform_data_t pbdrv_bluetooth_btstack_uart_block_ev3_platform_data = {
768+
.uart_id = UART2,
769+
};
770+
760771
// Called from assembly code in startup.s. After this, the "main" function in
761772
// lib/pbio/sys/main.c is called. That contains all calls to the driver
762773
// initialization (low level in pbdrv, high level in pbio), and system level
@@ -800,7 +811,7 @@ void SystemInit(void) {
800811
const pbdrv_gpio_t bluetooth_uart_tx = PBDRV_GPIO_EV3_PIN(4, 23, 20, 1, 2);
801812
const pbdrv_gpio_t bluetooth_uart_cts = PBDRV_GPIO_EV3_PIN(0, 31, 28, 0, 8);
802813
const pbdrv_gpio_t bluetooth_uart_rts = PBDRV_GPIO_EV3_PIN(0, 27, 24, 0, 9);
803-
const pbdrv_gpio_t bluetooth_enable = PBDRV_GPIO_EV3_PIN(9, 27, 24, 4, 9);
814+
804815
pbdrv_gpio_alt(&bluetooth_uart_rx, SYSCFG_PINMUX4_PINMUX4_19_16_UART2_RXD);
805816
pbdrv_gpio_alt(&bluetooth_uart_tx, SYSCFG_PINMUX4_PINMUX4_23_20_UART2_TXD);
806817
pbdrv_gpio_alt(&bluetooth_uart_cts, SYSCFG_PINMUX0_PINMUX0_31_28_UART2_CTS);

0 commit comments

Comments
 (0)