From 605c422c395c7de7004bdf03aefd91e5d62a01ca Mon Sep 17 00:00:00 2001 From: Thomas Klaehn Date: Thu, 9 Apr 2020 09:43:12 +0200 Subject: [PATCH] Remove hal --- src/application/blinky/main.cc | 21 ++++++++++++++------- src/application/spi/main.cc | 10 ++++++++-- src/application/st7789_lcd/main.cc | 21 ++++++++++++++------- src/platform/hal.h | 11 ----------- 4 files changed, 36 insertions(+), 27 deletions(-) delete mode 100644 src/platform/hal.h diff --git a/src/application/blinky/main.cc b/src/application/blinky/main.cc index 9b7fb05..7e3aafc 100644 --- a/src/application/blinky/main.cc +++ b/src/application/blinky/main.cc @@ -1,7 +1,12 @@ #include #include "delay.h" -#include "platform/hal.h" + +#include "platform/nrf52/gpio.h" +#include "platform/nrf52/InterruptHandler.h" +#include "platform/nrf52/InterruptGuardian.h" + +using namespace pinetime::platform::nrf52; enum { PIN_NUMBER_LED_1 = 17, @@ -10,18 +15,20 @@ enum { PIN_NUMBER_LED_4 = 20 }; -hal::Gpio led_1(PIN_NUMBER_LED_1); -hal::Gpio led_2(PIN_NUMBER_LED_2); -hal::Gpio led_3(PIN_NUMBER_LED_3); -hal::Gpio led_4(PIN_NUMBER_LED_4); +Gpio led_1(PIN_NUMBER_LED_1); +Gpio led_2(PIN_NUMBER_LED_2); +Gpio led_3(PIN_NUMBER_LED_3); +Gpio led_4(PIN_NUMBER_LED_4); -std::array leds = {&led_1, &led_2, &led_3, &led_4}; +std::array leds = {&led_1, &led_2, &led_3, &led_4}; + +InterruptGuardian InterruptGuardian::instance; int main(void) { while(true) { for(auto it = std::begin(leds); it != std::end(leds); ++it) { - hal::Gpio * tmp = *it; + Gpio * tmp = *it; tmp->toggle(); delay_ms(500); } diff --git a/src/application/spi/main.cc b/src/application/spi/main.cc index 952e271..31eb0c9 100644 --- a/src/application/spi/main.cc +++ b/src/application/spi/main.cc @@ -1,11 +1,17 @@ #include "delay.h" -#include "platform/hal.h" -using namespace hal; +#include "platform/nrf52/gpio.h" +#include "platform/nrf52/spi.h" +#include "platform/nrf52/InterruptHandler.h" +#include "platform/nrf52/InterruptGuardian.h" + +using namespace pinetime::platform::nrf52; const uint8_t buf[] = "Test"; +InterruptGuardian InterruptGuardian::instance; + int main(void) { Gpio led_1(17); diff --git a/src/application/st7789_lcd/main.cc b/src/application/st7789_lcd/main.cc index 9afbbab..819d395 100644 --- a/src/application/st7789_lcd/main.cc +++ b/src/application/st7789_lcd/main.cc @@ -1,18 +1,25 @@ #include "delay.h" -#include "platform/hal.h" +#include "platform/nrf52/gpio.h" +#include "platform/nrf52/spi.h" +#include "platform/nrf52/InterruptHandler.h" +#include "platform/nrf52/InterruptGuardian.h" #include "st7789.h" -hal::Gpio led_1(17); +using namespace pinetime::platform::nrf52; -hal::Gpio lcd_reset(26); -hal::Gpio lcd_data_command(18); -hal::Gpio lcd_backlight(23); -hal::Gpio lcd_chip_select(25); -hal::Spi lcd_spi(0, 2, 3, 4, lcd_chip_select); +Gpio led_1(17); + +Gpio lcd_reset(26); +Gpio lcd_data_command(18); +Gpio lcd_backlight(23); +Gpio lcd_chip_select(25); +Spi lcd_spi(0, 2, 3, 4, lcd_chip_select); St7789 lcd(lcd_spi, lcd_reset, lcd_data_command, lcd_backlight); +InterruptGuardian InterruptGuardian::instance; + int main(void) { lcd.init(); diff --git a/src/platform/hal.h b/src/platform/hal.h deleted file mode 100644 index 85c1bc1..0000000 --- a/src/platform/hal.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef __PLATFORM_GPIO_H__ -#define __PLATFORM_GPIO_H__ - -#if defined(PLATFORM_nrf52) - #include "platform/nrf52/gpio.h" - #include "platform/nrf52/spi.h" - - namespace hal = pinetime::platform::nrf52; -#endif - -#endif