Remove hal

This commit is contained in:
Thomas Klaehn 2020-04-09 09:43:12 +02:00
parent 76af8665b2
commit a1c89c96d5
4 changed files with 36 additions and 27 deletions

View File

@ -1,7 +1,12 @@
#include <array> #include <array>
#include "delay.h" #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 { enum {
PIN_NUMBER_LED_1 = 17, PIN_NUMBER_LED_1 = 17,
@ -10,18 +15,20 @@ enum {
PIN_NUMBER_LED_4 = 20 PIN_NUMBER_LED_4 = 20
}; };
hal::Gpio led_1(PIN_NUMBER_LED_1); Gpio led_1(PIN_NUMBER_LED_1);
hal::Gpio led_2(PIN_NUMBER_LED_2); Gpio led_2(PIN_NUMBER_LED_2);
hal::Gpio led_3(PIN_NUMBER_LED_3); Gpio led_3(PIN_NUMBER_LED_3);
hal::Gpio led_4(PIN_NUMBER_LED_4); Gpio led_4(PIN_NUMBER_LED_4);
std::array<hal::Gpio *, 4> leds = {&led_1, &led_2, &led_3, &led_4}; std::array<Gpio *, 4> leds = {&led_1, &led_2, &led_3, &led_4};
InterruptGuardian InterruptGuardian::instance;
int main(void) int main(void)
{ {
while(true) { while(true) {
for(auto it = std::begin(leds); it != std::end(leds); ++it) { for(auto it = std::begin(leds); it != std::end(leds); ++it) {
hal::Gpio * tmp = *it; Gpio * tmp = *it;
tmp->toggle(); tmp->toggle();
delay_ms(500); delay_ms(500);
} }

View File

@ -1,11 +1,17 @@
#include "delay.h" #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"; const uint8_t buf[] = "Test";
InterruptGuardian InterruptGuardian::instance;
int main(void) int main(void)
{ {
Gpio led_1(17); Gpio led_1(17);

View File

@ -1,18 +1,25 @@
#include "delay.h" #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" #include "st7789.h"
hal::Gpio led_1(17); using namespace pinetime::platform::nrf52;
hal::Gpio lcd_reset(26); Gpio led_1(17);
hal::Gpio lcd_data_command(18);
hal::Gpio lcd_backlight(23); Gpio lcd_reset(26);
hal::Gpio lcd_chip_select(25); Gpio lcd_data_command(18);
hal::Spi lcd_spi(0, 2, 3, 4, lcd_chip_select); 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); St7789 lcd(lcd_spi, lcd_reset, lcd_data_command, lcd_backlight);
InterruptGuardian InterruptGuardian::instance;
int main(void) int main(void)
{ {
lcd.init(); lcd.init();

View File

@ -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