|
10 | 10 |
|
11 | 11 | namespace io = core::io; |
12 | 12 | namespace dev = core::dev; |
13 | | -namespace log = core::log; |
14 | 13 |
|
15 | 14 | io::GPIO* ledGPIO; |
16 | 15 | io::GPIO* interruptGPIO2Hz; |
17 | 16 | io::GPIO* interruptGPIOStopStart; |
18 | 17 | io::GPIO* reloadGPIO; |
19 | 18 |
|
20 | 19 | void timer2IRQHandler(void* context, void* htim) { |
21 | | - // io::GPIO::State state = ledGPIO->readPin(); |
22 | | - // io::GPIO::State toggleState = state == io::GPIO::State::HIGH ? io::GPIO::State::LOW : io::GPIO::State::HIGH; |
23 | | - // ledGPIO->writePin(toggleState); |
24 | | - // interruptGPIO2Hz->writePin(toggleState); |
25 | | - io::UART* uart = (io::UART*) context; |
26 | | - |
27 | | - uart->printf("Starting log test\n\r"); |
| 20 | + io::GPIO::State state = ledGPIO->readPin(); |
| 21 | + io::GPIO::State toggleState = state == io::GPIO::State::HIGH ? io::GPIO::State::LOW : io::GPIO::State::HIGH; |
| 22 | + ledGPIO->writePin(toggleState); |
| 23 | + interruptGPIO2Hz->writePin(toggleState); |
28 | 24 | } |
29 | 25 |
|
30 | | -void timer15IRQHandler(void* htim) { |
| 26 | +void timer15IRQHandler(void* context, void* htim) { |
31 | 27 | io::GPIO::State state = interruptGPIOStopStart->readPin(); |
32 | 28 | io::GPIO::State toggleState = state == io::GPIO::State::HIGH ? io::GPIO::State::LOW : io::GPIO::State::HIGH; |
33 | 29 | interruptGPIOStopStart->writePin(toggleState); |
34 | 30 | } |
35 | 31 |
|
36 | | -void timer16IRQHandler(void* htim) { |
| 32 | +void timer16IRQHandler(void* context, void* htim) { |
37 | 33 | io::GPIO::State state = reloadGPIO->readPin(); |
38 | 34 | io::GPIO::State toggleState = state == io::GPIO::State::HIGH ? io::GPIO::State::LOW : io::GPIO::State::HIGH; |
39 | 35 | reloadGPIO->writePin(toggleState); |
@@ -68,19 +64,19 @@ int main() { |
68 | 64 | dev::Timer& sampleTimer2 = dev::getTimer<dev::MCUTimer::Timer11>(200); |
69 | 65 | dev::Timer& sampleTimer3 = dev::getTimer<dev::MCUTimer::Timer12>(200); |
70 | 66 | #else |
71 | | - // dev::Timer& sampleTimer2 = dev::getTimer<dev::MCUTimer::Timer15>(1000); |
72 | | - // dev::Timer& sampleTimer3 = dev::getTimer<dev::MCUTimer::Timer16>(1000); |
| 67 | + dev::Timer& sampleTimer2 = dev::getTimer<dev::MCUTimer::Timer15>(1000); |
| 68 | + dev::Timer& sampleTimer3 = dev::getTimer<dev::MCUTimer::Timer16>(1000); |
73 | 69 | #endif |
74 | 70 |
|
75 | | - sampleTimer1.startTimer(timer2IRQHandler, &uart); |
76 | | - // sampleTimer2.startTimer(timer15IRQHandler); |
77 | | - // sampleTimer3.startTimer(timer16IRQHandler); |
| 71 | + sampleTimer1.startTimer(timer2IRQHandler, nullptr); |
| 72 | + sampleTimer2.startTimer(timer15IRQHandler, nullptr); |
| 73 | + sampleTimer3.startTimer(timer16IRQHandler, nullptr); |
78 | 74 |
|
79 | 75 | while (1) { |
80 | | - // core::time::wait(500); |
81 | | - // sampleTimer2.stopTimer(); |
82 | | - // sampleTimer3.reloadTimer(); |
83 | | - // core::time::wait(500); |
84 | | - // sampleTimer2.startTimer(); |
| 76 | + core::time::wait(500); |
| 77 | + sampleTimer2.stopTimer(); |
| 78 | + sampleTimer3.reloadTimer(); |
| 79 | + core::time::wait(500); |
| 80 | + sampleTimer2.startTimer(); |
85 | 81 | } |
86 | 82 | } |
0 commit comments