Transfer st7789 into c++
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
19
src/application/st7789_lcd/main.cc
Normal file
19
src/application/st7789_lcd/main.cc
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user