![](/media/cache/profiles/01e5405ccd7d3efa1fd033aa7b7489e9.jpg.50x50_q85.jpg)
Blinky for MAX32630FTHR
Dependencies: max32630fthr mbed
main.cpp@1:b8fe3f7c11e4, 2017-08-19 (annotated)
- Committer:
- j3
- Date:
- Sat Aug 19 13:47:00 2017 +0000
- Revision:
- 1:b8fe3f7c11e4
- Parent:
- 0:06c0d19792d3
updated libs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
j3 | 0:06c0d19792d3 | 1 | |
j3 | 0:06c0d19792d3 | 2 | |
j3 | 0:06c0d19792d3 | 3 | #include "mbed.h" |
j3 | 0:06c0d19792d3 | 4 | #include "max32630fthr.h" |
j3 | 0:06c0d19792d3 | 5 | |
j3 | 1:b8fe3f7c11e4 | 6 | const uint32_t BLINK_DELAY = 250; |
j3 | 1:b8fe3f7c11e4 | 7 | |
j3 | 1:b8fe3f7c11e4 | 8 | void blink_led(DigitalOut &led, const uint32_t delay); |
j3 | 0:06c0d19792d3 | 9 | |
j3 | 0:06c0d19792d3 | 10 | int main() |
j3 | 0:06c0d19792d3 | 11 | { |
j3 | 1:b8fe3f7c11e4 | 12 | MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); |
j3 | 0:06c0d19792d3 | 13 | |
j3 | 1:b8fe3f7c11e4 | 14 | DigitalOut rLed(LED_RED, 1); |
j3 | 1:b8fe3f7c11e4 | 15 | DigitalOut gLed(LED_GREEN, 1); |
j3 | 1:b8fe3f7c11e4 | 16 | DigitalOut bLed(LED_BLUE, 1); |
j3 | 1:b8fe3f7c11e4 | 17 | |
j3 | 1:b8fe3f7c11e4 | 18 | DigitalOut led_array[] = {rLed, gLed, bLed}; |
j3 | 0:06c0d19792d3 | 19 | |
j3 | 0:06c0d19792d3 | 20 | while(1) |
j3 | 0:06c0d19792d3 | 21 | { |
j3 | 1:b8fe3f7c11e4 | 22 | for(int8_t idx = 2; idx >= 0; idx--) |
j3 | 1:b8fe3f7c11e4 | 23 | { |
j3 | 1:b8fe3f7c11e4 | 24 | blink_led(led_array[idx], BLINK_DELAY); |
j3 | 1:b8fe3f7c11e4 | 25 | } |
j3 | 0:06c0d19792d3 | 26 | } |
j3 | 0:06c0d19792d3 | 27 | } |
j3 | 1:b8fe3f7c11e4 | 28 | |
j3 | 1:b8fe3f7c11e4 | 29 | void blink_led(DigitalOut &led, const uint32_t delay) |
j3 | 1:b8fe3f7c11e4 | 30 | { |
j3 | 1:b8fe3f7c11e4 | 31 | led = !led; |
j3 | 1:b8fe3f7c11e4 | 32 | wait_ms(delay); |
j3 | 1:b8fe3f7c11e4 | 33 | led = !led; |
j3 | 1:b8fe3f7c11e4 | 34 | } |