53 lines
1.3 KiB
C++
53 lines
1.3 KiB
C++
#include <array>
|
|
|
|
#include "virtual_timer/VirtualTimerDistributor.h"
|
|
|
|
#include "platform/cm4/InterruptHandler.h"
|
|
#include "platform/cm4/InterruptGuardian.h"
|
|
#include "platform/cm4/SystemTick.h"
|
|
|
|
#include "platform/nrf52/gpio.h"
|
|
#include "platform/nrf52/InterruptHandler.h"
|
|
#include "platform/nrf52/InterruptGuardian.h"
|
|
|
|
#include "delay.h"
|
|
|
|
using namespace pinetime::platform;
|
|
using namespace pinetime::virtual_timer;
|
|
|
|
enum {
|
|
PIN_NUMBER_LED_1 = 17,
|
|
PIN_NUMBER_LED_2 = 18,
|
|
PIN_NUMBER_LED_3 = 19,
|
|
PIN_NUMBER_LED_4 = 20
|
|
};
|
|
|
|
// LEDs
|
|
nrf52::Gpio led_1(PIN_NUMBER_LED_1);
|
|
nrf52::Gpio led_2(PIN_NUMBER_LED_2);
|
|
nrf52::Gpio led_3(PIN_NUMBER_LED_3);
|
|
nrf52::Gpio led_4(PIN_NUMBER_LED_4);
|
|
std::array<nrf52::Gpio *, 4> leds = {&led_1, &led_2, &led_3, &led_4};
|
|
|
|
// IRQs
|
|
nrf52::InterruptGuardian nrf52::InterruptGuardian::instance;
|
|
cm4::InterruptGuardian cm4::InterruptGuardian::instance;
|
|
|
|
// Timer
|
|
cm4::SystemTick system_tick;
|
|
VirtualTimerDistributor virtual_timer_distributor(system_tick.instance());
|
|
pinetime::Delay delay;
|
|
|
|
int main(void)
|
|
{
|
|
cm4::InterruptGuardian::enable_interrupts();
|
|
while(true) {
|
|
for(auto it = leds.begin(); it != leds.end(); ++it) {
|
|
nrf52::Gpio * led = *it;
|
|
led->toggle();
|
|
delay.ms(200);
|
|
}
|
|
}
|
|
return 0;
|
|
}
|