raspi: BT_REG_EN on GPIO 45 on Pi Zero W

This commit is contained in:
Matthias Ringwald 2018-07-29 22:18:19 +02:00
parent 6d6471dc9e
commit 55250ca236
3 changed files with 19 additions and 8 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}