Transfer st7789 into c++

This commit is contained in:
Thomas Klaehn
2020-03-29 23:26:03 +02:00
parent 53aa3ceda6
commit f975a37bf3
6 changed files with 202 additions and 255 deletions

View File

@@ -1,33 +0,0 @@
#include "app_util_platform.h"
#include "nrf_gpio.h"
#include "nrf_delay.h"
#include "boards.h"
#include "app_error.h"
#include <string.h>
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "board.h"
#include "driver.h"
int main(void)
{
unsigned int cnt = 0;
APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
NRF_LOG_DEFAULT_BACKENDS_INIT();
drv_open(&led_1);
drv_open(&lcd);
NRF_LOG_INFO("SPI example started.");
while(1) {
char c = (cnt++ % 2) + 0x30;
drv_write(&led_1, &c, 1);
NRF_LOG_FLUSH();
nrf_delay_ms(200);
}
}

View File

@@ -0,0 +1,19 @@
#include "delay.h"
#include "platform/hal.h"
#include "st7789.h"
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, 25);
St7789 lcd(lcd_spi, lcd_reset, lcd_data_command, lcd_backlight, lcd_chip_select);
int main(void)
{
while(true) {
delay_ms(200);
}
}