Gabriel Smakaj
/
Test
Smakaj
Diff: main.cpp
- Revision:
- 1:3edc991805bd
- Parent:
- 0:cc2bde387551
diff -r cc2bde387551 -r 3edc991805bd main.cpp --- a/main.cpp Thu Nov 29 17:19:32 2018 +0000 +++ b/main.cpp Thu Nov 29 18:39:24 2018 +0000 @@ -1,9 +1,54 @@ #include "mbed.h" +#include "C12832.h" + + +// Led +BusOut LEDS(LED1,LED2,LED3,LED4); + +// Joystick +InterruptIn center(p14); + +class IsA : public BusOut +{ +void LedOff(); +void LedOn(); +void LedOn(int HexOut); +void Ein(); +void Aus(); +}; + + +void LedOn() +{ + LEDS = 1; +} + +void LedOff() +{ + LEDS = 0; +} + +void Ein() +{ + while(1) + { + LEDS = 3; + { + return; + } + } +} + +void Aus() +{ + +} + class IsAnEvent : public InterruptIn { volatile int16_t _pressed; void _RisingISR(); public: - IsAnEvent() : InterruptIn(p15) {}; + IsAnEvent() : InterruptIn(p14) {}; IsAnEvent(PinName pin) : InterruptIn(pin) { rise(callback(this, &IsAnEvent::_RisingISR)); _pressed=0; @@ -17,7 +62,7 @@ } void IsAnEvent::_RisingISR() { - wait_ms(50); + wait_ms(500); if( read() ) _pressed = true; } @@ -27,4 +72,13 @@ return 1; } return 0; + +} + +int main() +{ + LedOn(); + wait_ms(500); + LedOff(); + Ein(); } \ No newline at end of file