mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
posix: cleanup fast FTDI hack
This commit is contained in:
parent
015519a73d
commit
615ae44436
@ -137,7 +137,7 @@ static uint32_t btstack_run_loop_posix_get_time_ms(void){
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
uint32_t time_ms = ((tv.tv_sec - init_tv.tv_sec) * 1000) + (tv.tv_usec / 1000);
|
||||
log_info("btstack_run_loop_posix_get_time_ms: %u <- %u / %u", time_ms, (int) tv.tv_sec, (int) tv.tv_usec);
|
||||
log_debug("btstack_run_loop_posix_get_time_ms: %u <- %u / %u", time_ms, (int) tv.tv_sec, (int) tv.tv_usec);
|
||||
return time_ms;
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ static void btstack_run_loop_posix_execute(void) {
|
||||
static void btstack_run_loop_posix_set_timer(btstack_timer_source_t *a, uint32_t timeout_in_ms){
|
||||
uint32_t time_ms = btstack_run_loop_posix_get_time_ms();
|
||||
a->timeout = time_ms + timeout_in_ms;
|
||||
log_info("btstack_run_loop_posix_set_timer to %u ms (now %u, timeout %u)", a->timeout, time_ms, timeout_in_ms);
|
||||
log_debug("btstack_run_loop_posix_set_timer to %u ms (now %u, timeout %u)", a->timeout, time_ms, timeout_in_ms);
|
||||
}
|
||||
|
||||
static void btstack_run_loop_posix_init(void){
|
||||
|
@ -130,20 +130,27 @@ static int h4_set_baudrate(uint32_t baudrate){
|
||||
#ifdef B921600
|
||||
case 921600: brate=B921600; break;
|
||||
#endif
|
||||
|
||||
// Hacks to switch to 2/3 mbps on FTDI FT232 chipsets
|
||||
// requires special config in Info.plist or Registry
|
||||
#ifdef HAVE_POSIX_B300_MAPPED_TO_2000000
|
||||
case 2000000: brate=B300; break;
|
||||
case 2000000:
|
||||
#if defined(HAVE_POSIX_B300_MAPPED_TO_2000000)
|
||||
log_info("hci_transport_posix: using B300 for 2 mbps");
|
||||
brate=B300;
|
||||
#elif defined(HAVE_POSIX_B1200_MAPPED_TO_2000000)
|
||||
log_info("hci_transport_posix: using B1200 for 2 mbps");
|
||||
brate=B1200;
|
||||
#endif
|
||||
#ifdef HAVE_POSIX_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;
|
||||
break;
|
||||
case 3000000:
|
||||
#if defined(HAVE_POSIX_B600_MAPPED_TO_3000000)
|
||||
log_info("hci_transport_posix: using B600 for 3 mbps");
|
||||
brate=B600;
|
||||
#elif defined(HAVE_POSIX_B2400_MAPPED_TO_3000000)
|
||||
log_info("hci_transport_posix: using B2400 for 3 mbps");
|
||||
brate=B2400;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ void hal_led_toggle(void){
|
||||
printf("LED State %u\n", led_state);
|
||||
}
|
||||
static void use_fast_uart(void){
|
||||
#if defined(HAVE_B1200_MAPPED_TO_3000000) || defined(HAVE_B300_MAPPED_TO_3000000)
|
||||
#if defined(HAVE_POSIX_B240000_MAPPED_TO_3000000) || defined(HAVE_POSIX_B600_MAPPED_TO_3000000)
|
||||
printf("Using 3000000 baud.\n");
|
||||
config.baudrate_main = 3000000;
|
||||
#elif defined(HAVE_B1200_MAPPED_TO_2000000) || defined(HAVE_POSIX_B300_MAPPED_TO_2000000)
|
||||
#elif defined(HAVE_POSIX_B1200_MAPPED_TO_2000000) || defined(HAVE_POSIX_B300_MAPPED_TO_2000000)
|
||||
printf("Using 2000000 baud.\n");
|
||||
config.baudrate_main = 2000000;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user