118 lines
1.9 KiB
C
118 lines
1.9 KiB
C
#ifndef __NRF52_DK_H__
|
|
#define __NRF52_DK_H__
|
|
|
|
#include "driver.h"
|
|
|
|
#include "gpio.h"
|
|
#include "spi.h"
|
|
#include "st7789.h"
|
|
|
|
// LED 1
|
|
const struct gpio nrf_led_1 = {
|
|
.pin = 17,
|
|
.dir = OUT
|
|
};
|
|
const struct driver led_1 = {
|
|
.name = "LED1",
|
|
.fp = &gpio_fp,
|
|
.dev = &nrf_led_1
|
|
};
|
|
|
|
// LED 2
|
|
const struct gpio nrf_led_2 = {
|
|
.pin = 18,
|
|
.dir = OUT
|
|
};
|
|
const struct driver led_2 = {
|
|
.name = "LED2",
|
|
.fp = &gpio_fp,
|
|
.dev = &nrf_led_2
|
|
};
|
|
|
|
// LED 3
|
|
const struct gpio nrf_led_3 = {
|
|
.pin = 19,
|
|
.dir = OUT
|
|
};
|
|
const struct driver led_3 = {
|
|
.name = "LED3",
|
|
.fp = &gpio_fp,
|
|
.dev = &nrf_led_3
|
|
};
|
|
|
|
// LED 4
|
|
const struct gpio nrf_led_4 = {
|
|
.pin = 20,
|
|
.dir = OUT
|
|
};
|
|
const struct driver led_4 = {
|
|
.name = "LED4",
|
|
.fp = &gpio_fp,
|
|
.dev = &nrf_led_4
|
|
};
|
|
|
|
// LCD
|
|
// SPI 0
|
|
const struct spi nrf_spi_0 = {
|
|
.sck_pin = 2,
|
|
.mosi_pin = 3,
|
|
.miso_pin = 4
|
|
};
|
|
const struct driver spi_0 = {
|
|
.name = "SPI0",
|
|
.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
|