mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
posix: support B300/B1200 mapped to 2mbps hack
This commit is contained in:
parent
4ced4e8cb8
commit
3250103aa0
@ -125,6 +125,22 @@ static int h4_set_baudrate(uint32_t baudrate){
|
|||||||
#ifdef B921600
|
#ifdef B921600
|
||||||
case 921600: brate=B921600; break;
|
case 921600: brate=B921600; break;
|
||||||
#endif
|
#endif
|
||||||
|
// Hacks to switch to 2/3 mbps on FTDI FT232 chipsets
|
||||||
|
// requires special config in Info.plist or Registry
|
||||||
|
#ifdef HAVE_B300_MAPPED_TO_2000000
|
||||||
|
case 2000000: brate=B300; break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_B600_MAPPED_TO_3000000
|
||||||
|
case 3000000: brate=B600; break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_B1200_MAPPED_TO_2000000
|
||||||
|
case 2000000: brate=B1200; break;
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_B2400_MAPPED_TO_3000000
|
||||||
|
case 3000000: brate=B2400; break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
cfsetospeed(&toptions, brate);
|
cfsetospeed(&toptions, brate);
|
||||||
cfsetispeed(&toptions, brate);
|
cfsetispeed(&toptions, brate);
|
||||||
|
@ -94,9 +94,17 @@ void hal_led_toggle(void){
|
|||||||
led_state = 1 - led_state;
|
led_state = 1 - led_state;
|
||||||
printf("LED State %u\n", led_state);
|
printf("LED State %u\n", led_state);
|
||||||
}
|
}
|
||||||
static void using_921600_baud(void){
|
static void use_fast_uart(void){
|
||||||
|
#if defined(HAVE_B1200_MAPPED_TO_3000000) || defined(HAVE_B300_MAPPED_TO_3000000)
|
||||||
|
printf("Using 3000000 baud.\n");
|
||||||
|
config.baudrate_main = 3000000;
|
||||||
|
#elif defined(HAVE_B1200_MAPPED_TO_2000000) || defined(HAVE_B300_MAPPED_TO_2000000)
|
||||||
|
printf("Using 2000000 baud.\n");
|
||||||
|
config.baudrate_main = 2000000;
|
||||||
|
#else
|
||||||
printf("Using 921600 baud.\n");
|
printf("Using 921600 baud.\n");
|
||||||
config.baudrate_main = 921600;
|
config.baudrate_main = 921600;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void local_version_information_callback(uint8_t * packet){
|
static void local_version_information_callback(uint8_t * packet){
|
||||||
@ -114,12 +122,12 @@ static void local_version_information_callback(uint8_t * packet){
|
|||||||
switch (manufacturer){
|
switch (manufacturer){
|
||||||
case COMPANY_ID_CAMBRIDGE_SILICON_RADIO:
|
case COMPANY_ID_CAMBRIDGE_SILICON_RADIO:
|
||||||
printf("Cambridge Silicon Radio CSR chipset.\n");
|
printf("Cambridge Silicon Radio CSR chipset.\n");
|
||||||
using_921600_baud();
|
use_fast_uart();
|
||||||
hci_set_chipset(btstack_chipset_csr_instance());
|
hci_set_chipset(btstack_chipset_csr_instance());
|
||||||
break;
|
break;
|
||||||
case COMPANY_ID_TEXAS_INSTRUMENTS_INC:
|
case COMPANY_ID_TEXAS_INSTRUMENTS_INC:
|
||||||
printf("Texas Instruments - CC256x compatible chipset.\n");
|
printf("Texas Instruments - CC256x compatible chipset.\n");
|
||||||
using_921600_baud();
|
use_fast_uart();
|
||||||
hci_set_chipset(btstack_chipset_cc256x_instance());
|
hci_set_chipset(btstack_chipset_cc256x_instance());
|
||||||
break;
|
break;
|
||||||
case COMPANY_ID_BROADCOM_CORPORATION:
|
case COMPANY_ID_BROADCOM_CORPORATION:
|
||||||
@ -128,7 +136,7 @@ static void local_version_information_callback(uint8_t * packet){
|
|||||||
break;
|
break;
|
||||||
case COMPANY_ID_ST_MICROELECTRONICS:
|
case COMPANY_ID_ST_MICROELECTRONICS:
|
||||||
printf("ST Microelectronics - using STLC2500d driver.\n");
|
printf("ST Microelectronics - using STLC2500d driver.\n");
|
||||||
using_921600_baud();
|
use_fast_uart();
|
||||||
hci_set_chipset(btstack_chipset_stlc2500d_instance());
|
hci_set_chipset(btstack_chipset_stlc2500d_instance());
|
||||||
break;
|
break;
|
||||||
case COMPANY_ID_EM_MICROELECTRONICS_MARIN:
|
case COMPANY_ID_EM_MICROELECTRONICS_MARIN:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user