From 810505c0668633eccc1019eeb13da8e878f92f41 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Sun, 5 Oct 2014 18:18:10 +0000 Subject: [PATCH] use wfe instruction to enter sleep mode only if no event had occured prior. spp_and_le_counter working on STM32 --- platforms/stm32-f103rb-nucleo/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platforms/stm32-f103rb-nucleo/main.c b/platforms/stm32-f103rb-nucleo/main.c index fe71dddb7..55d2f31e6 100644 --- a/platforms/stm32-f103rb-nucleo/main.c +++ b/platforms/stm32-f103rb-nucleo/main.c @@ -93,7 +93,8 @@ void hal_cpu_enable_irqs(){ void hal_cpu_enable_irqs_and_sleep(){ hal_led_off(); __enable_irq(); - __WFI(); + __asm__("wfe"); // go to sleep if event flag isn't set. if set, just clear it. IRQs set event flag + // note: hal_uart_needed_during_sleep can be used to disable peripheral clock if it's not needed for a timer // todo: the transition from disabled IRQs into sleep mode should be atomic hal_led_on(); @@ -358,7 +359,7 @@ int main(void) hci_init(transport, (void*) &hci_uart_config_cc256x, control, remote_db); // enable eHCILL - bt_control_cc256x_enable_ehcill(1); + // bt_control_cc256x_enable_ehcill(1); // hand over to btstack embedded code btstack_main();