Add st7789 lcd driver

This commit is contained in:
Thomas Klaehn
2020-03-29 10:25:17 +02:00
parent 7a5a5930aa
commit 67a28afd24
9 changed files with 4815 additions and 16 deletions

View File

@@ -5,6 +5,7 @@
#include "gpio.h"
#include "spi.h"
#include "st7789.h"
// LED 1
const struct gpio nrf_led_1 = {
@@ -50,6 +51,8 @@ const struct driver led_4 = {
.dev = &nrf_led_4
};
// LCD
// SPI 0
const struct spi nrf_spi_0 = {
.sck_pin = 2,
.mosi_pin = 3,
@@ -60,5 +63,55 @@ const struct driver spi_0 = {
.fp = &spi_fp,
.dev = &nrf_spi_0
};
const struct gpio nrf_dc_pin = {
.pin = 18,
.dir = OUT
};
const struct driver dc_pin = {
.name = "DC",
.fp = &gpio_fp,
.dev = &nrf_dc_pin
};
const struct gpio nrf_bl_pin = {
.pin = 23,
.dir = OUT
};
const struct driver bl_pin = {
.name = "BACKLIGHT",
.fp = &gpio_fp,
.dev = &nrf_bl_pin
};
const struct gpio nrf_rst_pin = {
.pin = 26,
.dir = OUT
};
const struct driver rst_pin = {
.name = "RESET",
.fp = &gpio_fp,
.dev = &nrf_rst_pin
};
const struct gpio nrf_select_pin = {
.pin = 25,
.dir = OUT
};
const struct driver select_pin = {
.name = "SELECT",
.fp = &gpio_fp,
.dev = &nrf_select_pin
};
struct st7789 nrf_lcd = {
.spi = &spi_0,
.dc = &dc_pin,
.bl = &bl_pin,
.rst = &rst_pin,
.select = &select_pin,
.height = 240,
.width = 240,
};
const struct driver lcd = {
.name = "LCD",
.fp = &st7789_fp,
.dev = &nrf_lcd
};
#endif