#include "platform/cm4/InterruptHandler.h"
#include "platform/cm4/InterruptGuardian.h"

#include "platform/nrf52/gpio.h"
#include "platform/nrf52/spi.h"
#include "platform/nrf52/InterruptHandler.h"
#include "platform/nrf52/InterruptGuardian.h"
#include "st7789.h"

using namespace pinetime::platform;

nrf52::Gpio led_1(17);

nrf52::Gpio lcd_reset(26);
nrf52::Gpio lcd_data_command(18);
nrf52::Gpio lcd_backlight(23);
nrf52::Gpio lcd_chip_select(25);
nrf52::Spi lcd_spi(0, 2, 3, 4, lcd_chip_select);

St7789 lcd(lcd_spi, lcd_reset, lcd_data_command, lcd_backlight);

cm4::InterruptGuardian cm4::InterruptGuardian::instance;
nrf52::InterruptGuardian nrf52::InterruptGuardian::instance;

int main(void)
{
    cm4::InterruptGuardian::enable_interrupts();
    lcd.init();
    lcd.clear(0);
    while(true) {
        led_1.toggle();
    }
}
