diff --git a/port/raspi/btstack_control_raspi.c b/port/raspi/btstack_control_raspi.c index 5ef11c7d3..2da32b47d 100644 --- a/port/raspi/btstack_control_raspi.c +++ b/port/raspi/btstack_control_raspi.c @@ -20,9 +20,11 @@ #define RPI_FIRMWARE_STATUS_SUCCESS (0x80000000) #define RPI_FIRMWARE_STATUS_ERROR (0x80000001) -// BCM4343 power management pins on main CPU -#define BT_REG_ON (128) -#define WL_REG_ON (129) +static uint8_t bt_reg_en; + +void btstack_control_raspi_set_bt_reg_en_pin(uint8_t bt_reg_en_pin){ + bt_reg_en = bt_reg_en_pin; +} // fd for firmware interface static int fd = -1; @@ -62,13 +64,13 @@ static void raspi_init (const void *config) { static int raspi_on (){ log_info("raspi_on"); - raspi_gpio_set( BT_REG_ON, 1 ); + raspi_gpio_set( bt_reg_en, 1 ); return 0; } static int raspi_off(void){ log_info("raspi_off"); - raspi_gpio_set( BT_REG_ON, 0 ); + raspi_gpio_set( bt_reg_en, 0 ); return 0; } diff --git a/port/raspi/btstack_control_raspi.h b/port/raspi/btstack_control_raspi.h index c15df0115..0b520994f 100644 --- a/port/raspi/btstack_control_raspi.h +++ b/port/raspi/btstack_control_raspi.h @@ -1,3 +1,6 @@ #include "btstack_control.h" btstack_control_t *btstack_control_raspi_get_instance(); + +// set GPIO for power cycle +void btstack_control_raspi_set_bt_reg_en_pin(uint8_t bt_reg_en_pin); diff --git a/port/raspi/main.c b/port/raspi/main.c index fc3ce713e..85b51d71f 100644 --- a/port/raspi/main.c +++ b/port/raspi/main.c @@ -224,19 +224,25 @@ int main(int argc, const char * argv[]){ fprintf(stderr, "can't verify HW uart, %s\n", strerror( errno ) ); return -1; case UART_SOFTWARE_NO_FLOW: - printf("Software UART without flowcontrol\n"); + // ?? + printf("Software UART without flowcontro, BT_REG_EN at GPIO 128l\n"); transport_config.baudrate_main = 460800; transport_config.flowcontrol = 0; + btstack_control_raspi_set_bt_reg_en_pin(128); break; case UART_HARDWARE_NO_FLOW: - printf("Hardware UART without flowcontrol\n"); + // Raspberry Pi 3 B + printf("Hardware UART without flowcontrol, BT_REG_EN at GPIOO 128\n"); transport_config.baudrate_main = 921600; transport_config.flowcontrol = 0; + btstack_control_raspi_set_bt_reg_en_pin(128); break; case UART_HARDWARE_FLOW: - printf("Hardware UART with flowcontrol\n"); + // Raspberry Pi Zero W + printf("Hardware UART with flowcontrol, BT_REG_EN at GPIO 45\n"); transport_config.baudrate_main = 3000000; transport_config.flowcontrol = 1; + btstack_control_raspi_set_bt_reg_en_pin(45); break; }