Nuvoton
/
NuMaker-mbed-GPIO_Interrupt
NuMaker GPIO Interrupt with Debounce Setting
main.cpp@5:b9b7cd06aaf0, 2016-12-22 (annotated)
- Committer:
- shliu1
- Date:
- Thu Dec 22 14:57:43 2016 +0800
- Revision:
- 5:b9b7cd06aaf0
- Parent:
- 2:15b06747ce59
- Child:
- 6:b3369ce1a600
Support M453, target is numaker_pfm_m453
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
rkuo2000 | 0:29e056412215 | 1 | // NuMaker-PFM-NUC472 : GPIO interrupt to set led on/off |
rkuo2000 | 0:29e056412215 | 2 | #include "mbed.h" |
shliu1 |
5:b9b7cd06aaf0 | 3 | #if defined(TARGET_NUMAKER_PFM_NUC472) |
ccli8 |
2:15b06747ce59 | 4 | InterruptIn button(SW1); // Button SW1 |
ccli8 |
2:15b06747ce59 | 5 | DigitalOut led(LED1); // flashing LED1(rgbled1) |
shliu1 |
5:b9b7cd06aaf0 | 6 | #elif defined(TARGET_NUMAKER_PFM_M453) |
shliu1 |
5:b9b7cd06aaf0 | 7 | InterruptIn button(SW1); // Button SW1 |
shliu1 |
5:b9b7cd06aaf0 | 8 | DigitalOut led(LED1); // flashing LED1(rgbled1) |
shliu1 |
5:b9b7cd06aaf0 | 9 | #endif |
rkuo2000 | 0:29e056412215 | 10 | |
rkuo2000 | 0:29e056412215 | 11 | void flip() { |
rkuo2000 | 0:29e056412215 | 12 | led = !led; |
rkuo2000 | 0:29e056412215 | 13 | } |
rkuo2000 | 0:29e056412215 | 14 | |
rkuo2000 | 0:29e056412215 | 15 | int main() { |
ccli8 |
2:15b06747ce59 | 16 | button.rise(&flip); |
rkuo2000 | 0:29e056412215 | 17 | } |