mbed support for STM32F103C8T6 (Blue Pill) boards
Diff: peripherals/pkt_leds.cpp
- Revision:
- 15:e694fb54a079
- Parent:
- 14:900adc64ed43
--- a/peripherals/pkt_leds.cpp Fri Sep 28 13:28:09 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -// Toggle a LED -#include "mbed.h" - -DigitalOut rx_led(PB_12); -DigitalOut tx_led(PB_13); -DigitalOut hop0_led(PB_11); -DigitalOut hop1_led(PB_10); -DigitalOut hop2_led(PB_1); -DigitalOut hop3_led(PB_0); - -DigitalOut main_led(PC_13); - -void testLEDs(void) { - for(int i = 0; i < 4; i++) { - rx_led = !rx_led; - wait(0.2); - tx_led = !tx_led; - wait(0.2); - hop0_led = !hop0_led; - wait(0.2); - hop1_led = !hop1_led; - wait(0.2); - hop2_led = !hop2_led; - wait(0.2); - hop3_led = !hop3_led; - wait(0.2); - } - rx_led = 0; - tx_led = 0; - hop0_led = 0; - hop1_led = 0; - hop2_led = 0; - hop3_led = 0; -} - - -void blinkMainLED(void) { - main_led = !main_led; -} - - -static Timeout main_led_timeout; -static bool blink_main_led = false; -void mainLEDTimeout(void) { - blink_main_led = true; - main_led_timeout.attach(&mainLEDTimeout, 0.5); -} - - -void initEventLEDs(void) { - main_led_timeout.attach(&mainLEDTimeout, 0.5); -} - - -// Event loop function for the LEDs -void eventLEDs(void) { - if(blink_main_led) { - blinkMainLED(); - blink_main_led = false; - } -}