mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-09 20:45:41 +08:00
[Renesas]Remove lcd_ili9341 and update spi driver
This commit is contained in:
1 parent
b0c247fb59
commit
1cf26a8ea7
15 files changed
+96
-922
No files matched your search
@@ -33,12 +33,10 @@ if GetDepend(['BSP_USING_I2C', 'BSP_USING_HW_I2C']):
|
||||
src += ['drv_i2c.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SPI']):
|
||||
if GetDepend('BSP_USING_SCI_SPI0') or GetDepend('BSP_USING_SCI_SPI1') \
|
||||
or GetDepend('BSP_USING_SCI_SPI2') or GetDepend('BSP_USING_SCI_SPI3') \
|
||||
or GetDepend('BSP_USING_SCI_SPI4') or GetDepend('BSP_USING_SCI_SPI9'): \
|
||||
src += ['drv_sci_spi.c']
|
||||
else:
|
||||
src += ['drv_spi.c']
|
||||
src += ['drv_spi.c']
|
||||
|
||||
if GetDepend(['BSP_USING_SCI_SPI']):
|
||||
src += ['drv_sci_spi.c']
|
||||
|
||||
if GetDepend(['BSP_USING_ADC']):
|
||||
src += ['drv_adc.c']
|
||||
|
||||
@@ -113,7 +113,7 @@ static rt_err_t ra_wait_complete(rt_event_t event, const char bus_name[RT_NAME_M
|
||||
{
|
||||
rt_uint32_t recved = 0x00;
|
||||
|
||||
switch (bus_name[6])
|
||||
switch (bus_name[4])
|
||||
{
|
||||
case '0':
|
||||
return SCI_SPIx_EVENT_RECV(0);
|
||||
@@ -155,7 +155,6 @@ static spi_bit_width_t ra_width_shift(rt_uint8_t data_width)
|
||||
static rt_err_t ra_write_message(struct rt_spi_device *device, const void *send_buf, const rt_size_t len)
|
||||
{
|
||||
RT_ASSERT(device != NULL);
|
||||
RT_ASSERT(device->parent.user_data != NULL);
|
||||
RT_ASSERT(send_buf != NULL);
|
||||
RT_ASSERT(len > 0);
|
||||
rt_err_t err = RT_EOK;
|
||||
@@ -177,7 +176,6 @@ static rt_err_t ra_write_message(struct rt_spi_device *device, const void *send_
|
||||
static rt_err_t ra_read_message(struct rt_spi_device *device, void *recv_buf, const rt_size_t len)
|
||||
{
|
||||
RT_ASSERT(device != NULL);
|
||||
RT_ASSERT(device->parent.user_data != NULL);
|
||||
RT_ASSERT(recv_buf != NULL);
|
||||
RT_ASSERT(len > 0);
|
||||
rt_err_t err = RT_EOK;
|
||||
@@ -226,7 +224,6 @@ static rt_err_t ra_hw_spi_configure(struct rt_spi_device *device,
|
||||
rt_err_t err = RT_EOK;
|
||||
|
||||
struct ra_sci_spi *spi_dev = rt_container_of(device->bus, struct ra_sci_spi, bus);
|
||||
spi_dev->cs_pin = (rt_uint32_t)device->parent.user_data;
|
||||
|
||||
/**< data_width : 1 -> 8 bits , 2 -> 16 bits, 4 -> 32 bits, default 32 bits*/
|
||||
rt_uint8_t data_width = configuration->data_width / 8;
|
||||
@@ -237,7 +234,7 @@ static rt_err_t ra_hw_spi_configure(struct rt_spi_device *device,
|
||||
sci_spi_extended_cfg_t *spi_cfg = (sci_spi_extended_cfg_t *)spi_dev->ra_spi_handle_t->spi_cfg_t->p_extend;
|
||||
|
||||
/**< Configure Select Line */
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_HIGH);
|
||||
rt_pin_write(device->cs_pin, PIN_HIGH);
|
||||
|
||||
/**< config bitrate */
|
||||
R_SCI_SPI_CalculateBitrate(spi_dev->rt_spi_cfg_t->max_hz, &spi_cfg->clk_div, false);
|
||||
@@ -257,22 +254,20 @@ static rt_err_t ra_hw_spi_configure(struct rt_spi_device *device,
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
static rt_uint32_t ra_spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
|
||||
static rt_ssize_t ra_spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
|
||||
{
|
||||
RT_ASSERT(device != RT_NULL);
|
||||
RT_ASSERT(device->bus != RT_NULL);
|
||||
RT_ASSERT(message != RT_NULL);
|
||||
|
||||
rt_err_t err = RT_EOK;
|
||||
struct ra_sci_spi *spi_dev = rt_container_of(device->bus, struct ra_sci_spi, bus);
|
||||
spi_dev->cs_pin = (rt_uint32_t)device->parent.user_data;
|
||||
|
||||
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS))
|
||||
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
|
||||
{
|
||||
if (device->config.mode & RT_SPI_CS_HIGH)
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_HIGH);
|
||||
rt_pin_write(device->cs_pin, PIN_HIGH);
|
||||
else
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_LOW);
|
||||
rt_pin_write(device->cs_pin, PIN_LOW);
|
||||
}
|
||||
|
||||
if (message->length > 0)
|
||||
@@ -294,12 +289,12 @@ static rt_uint32_t ra_spixfer(struct rt_spi_device *device, struct rt_spi_messag
|
||||
}
|
||||
}
|
||||
|
||||
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS))
|
||||
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
|
||||
{
|
||||
if (device->config.mode & RT_SPI_CS_HIGH)
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_LOW);
|
||||
rt_pin_write(device->cs_pin, PIN_LOW);
|
||||
else
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_HIGH);
|
||||
rt_pin_write(device->cs_pin, PIN_HIGH);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -333,4 +328,30 @@ int ra_hw_sci_spi_init(void)
|
||||
return RT_EOK;
|
||||
}
|
||||
INIT_BOARD_EXPORT(ra_hw_sci_spi_init);
|
||||
|
||||
/**
|
||||
* Attach the spi device to SPI bus, this function must be used after initialization.
|
||||
*/
|
||||
rt_err_t rt_hw_sci_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin)
|
||||
{
|
||||
RT_ASSERT(bus_name != RT_NULL);
|
||||
RT_ASSERT(device_name != RT_NULL);
|
||||
|
||||
rt_err_t result;
|
||||
struct rt_spi_device *spi_device;
|
||||
|
||||
/* attach the device to spi bus*/
|
||||
spi_device = (struct rt_spi_device *)rt_malloc(sizeof(struct rt_spi_device));
|
||||
RT_ASSERT(spi_device != RT_NULL);
|
||||
|
||||
result = rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, cs_pin, RT_NULL);
|
||||
if (result != RT_EOK)
|
||||
{
|
||||
LOG_E("%s attach to %s faild, %d\n", device_name, bus_name, result);
|
||||
}
|
||||
|
||||
LOG_D("%s attach to %s done", device_name, bus_name);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* RT_USING_SPI */
|
||||
@@ -41,6 +41,8 @@ struct ra_sci_spi
|
||||
};
|
||||
#endif
|
||||
|
||||
rt_err_t rt_hw_sci_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -122,7 +122,6 @@ static rt_err_t ra_write_message(struct rt_spi_device *device, const void *send_
|
||||
static rt_err_t ra_read_message(struct rt_spi_device *device, void *recv_buf, const rt_size_t len)
|
||||
{
|
||||
RT_ASSERT(device != NULL);
|
||||
RT_ASSERT(device->parent.user_data != NULL);
|
||||
RT_ASSERT(recv_buf != NULL);
|
||||
RT_ASSERT(len > 0);
|
||||
rt_err_t err = RT_EOK;
|
||||
@@ -204,7 +203,6 @@ static rt_ssize_t ra_spixfer(struct rt_spi_device *device, struct rt_spi_message
|
||||
RT_ASSERT(message != RT_NULL);
|
||||
|
||||
rt_err_t err = RT_EOK;
|
||||
struct ra_spi *spi_dev = rt_container_of(device->bus, struct ra_spi, bus);
|
||||
|
||||
if (message->cs_take && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
|
||||
{
|
||||
@@ -236,9 +234,9 @@ static rt_ssize_t ra_spixfer(struct rt_spi_device *device, struct rt_spi_message
|
||||
if (message->cs_release && !(device->config.mode & RT_SPI_NO_CS) && (device->cs_pin != PIN_NONE))
|
||||
{
|
||||
if (device->config.mode & RT_SPI_CS_HIGH)
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_LOW);
|
||||
rt_pin_write(device->cs_pin, PIN_LOW);
|
||||
else
|
||||
rt_pin_write(spi_dev->cs_pin, PIN_HIGH);
|
||||
rt_pin_write(device->cs_pin, PIN_HIGH);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@@ -276,7 +274,7 @@ INIT_BOARD_EXPORT(ra_hw_spi_init);
|
||||
/**
|
||||
* Attach the spi device to SPI bus, this function must be used after initialization.
|
||||
*/
|
||||
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin, void *user_data)
|
||||
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin)
|
||||
{
|
||||
RT_ASSERT(bus_name != RT_NULL);
|
||||
RT_ASSERT(device_name != RT_NULL);
|
||||
@@ -288,7 +286,7 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
|
||||
spi_device = (struct rt_spi_device *)rt_malloc(sizeof(struct rt_spi_device));
|
||||
RT_ASSERT(spi_device != RT_NULL);
|
||||
|
||||
result = rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, cs_pin, user_data);
|
||||
result = rt_spi_bus_attach_device_cspin(spi_device, device_name, bus_name, cs_pin, RT_NULL);
|
||||
if (result != RT_EOK)
|
||||
{
|
||||
LOG_E("%s attach to %s faild, %d\n", device_name, bus_name, result);
|
||||
|
||||
@@ -40,7 +40,7 @@ struct ra_spi
|
||||
};
|
||||
#endif
|
||||
|
||||
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin, void *user_data);
|
||||
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_base_t cs_pin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -94,6 +94,35 @@ menu "Hardware Drivers Config"
|
||||
select BSP_USING_GPIO
|
||||
default n
|
||||
|
||||
menuconfig BSP_USING_SCI_SPI
|
||||
bool "Enable SCI SPI BUS"
|
||||
default n
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SCI_SPI
|
||||
config BSP_USING_SCI_SPI0
|
||||
bool "Enable SCI SPI0 BUS"
|
||||
default n
|
||||
config BSP_USING_SCI_SPI3
|
||||
bool "Enable SCI SPI3 BUS"
|
||||
default n
|
||||
config BSP_USING_SCI_SPI6
|
||||
bool "Enable SCI SPI6 BUS"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI BUS"
|
||||
default n
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SPI
|
||||
config BSP_USING_SPI0
|
||||
bool "Enable SPI0 BUS"
|
||||
default n
|
||||
config BSP_USING_SPI1
|
||||
bool "Enable SPI1 BUS"
|
||||
default n
|
||||
endif
|
||||
|
||||
config BSP_USING_SPI_LCD
|
||||
bool "Enable SPI LCD"
|
||||
select BSP_USING_GPIO
|
||||
@@ -108,6 +137,7 @@ menu "Hardware Drivers Config"
|
||||
if BSP_USING_LVGL
|
||||
config BSP_USING_LCD_ILI9431
|
||||
bool "Enable LVGL for LCD_ILI9431"
|
||||
select PKG_USING_ILI9341
|
||||
select BSP_USING_SPI_LCD
|
||||
default n
|
||||
config BSP_USING_LCD_RGB
|
||||
|
||||
@@ -34,17 +34,6 @@ static struct rt_device_graphic_info info;
|
||||
__attribute__((section(".ARM.__at_0x1FFE0000"))) lv_color_t buf_1[COLOR_BUFFER];
|
||||
|
||||
#if !DLG_LVGL_USE_GPU_RA6M3
|
||||
void _ra_port_display_callback(display_callback_args_t * p_args)
|
||||
{
|
||||
/* enter interrupt */
|
||||
rt_interrupt_enter();
|
||||
|
||||
/* TODO */
|
||||
|
||||
/* leave interrupt */
|
||||
rt_interrupt_leave();
|
||||
}
|
||||
|
||||
static void color_to16_maybe(lv_color16_t *dst, lv_color_t *src)
|
||||
{
|
||||
#if (LV_COLOR_DEPTH == 16)
|
||||
@@ -112,7 +101,7 @@ static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_
|
||||
void lv_port_disp_init(void)
|
||||
{
|
||||
#ifdef BSP_USING_SPI_LCD
|
||||
spi_lcd_init();
|
||||
spi_lcd_init(20);
|
||||
#else
|
||||
static rt_device_t device;
|
||||
/* LCD Device Init */
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
from building import *
|
||||
import rtconfig
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = []
|
||||
|
||||
if GetDepend(['BSP_USING_SPI_LCD']):
|
||||
src += Glob('lcd_ili9341.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
LOCAL_CFLAGS = ''
|
||||
|
||||
if rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
LOCAL_CFLAGS += ' -std=c99'
|
||||
elif rtconfig.PLATFORM in ['armcc']:
|
||||
LOCAL_CFLAGS += ' --c99'
|
||||
|
||||
group = DefineGroup('ili9341', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
|
||||
|
||||
Return('group')
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,85 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-02-23 Rbb666 First version
|
||||
*/
|
||||
#ifndef __LCD_ILI9341_H__
|
||||
#define __LCD_ILI9341_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "hal_data.h"
|
||||
#include <stdint.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t width; /* LCD width */
|
||||
uint16_t height; /* LCD high */
|
||||
uint32_t id; /* LCD ID */
|
||||
uint8_t dir; /* 0:Vertical | 1:Vertical */
|
||||
uint16_t wramcmd; /* gram cmd */
|
||||
uint16_t setxcmd; /* set x cmd */
|
||||
uint16_t setycmd; /* set y cmd */
|
||||
} _lcd_dev;
|
||||
|
||||
/* LCD param */
|
||||
extern _lcd_dev lcddev;
|
||||
|
||||
#define USE_HORIZONTAL 0 /* 0-0째|1-90째|2-180째|-270째 */
|
||||
|
||||
/* lcd size */
|
||||
#define LCD_W 240
|
||||
#define LCD_H 320
|
||||
|
||||
#define WHITE 0xFFFF
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define BRED 0XF81F
|
||||
#define GRED 0XFFE0
|
||||
#define GBLUE 0X07FF
|
||||
#define RED 0xF800
|
||||
#define MAGENTA 0xF81F
|
||||
#define GREEN 0x07E0
|
||||
#define CYAN 0x7FFF
|
||||
#define YELLOW 0xFFE0
|
||||
#define BROWN 0XBC40
|
||||
#define BRRED 0XFC07
|
||||
#define GRAY 0X8430
|
||||
|
||||
#define LCD_DC_PIN BSP_IO_PORT_04_PIN_13
|
||||
#define LCD_RES_PIN BSP_IO_PORT_04_PIN_14
|
||||
#define LCD_CS_PIN BSP_IO_PORT_04_PIN_05
|
||||
|
||||
#define LCD_DC_CLR rt_pin_write(LCD_DC_PIN, PIN_LOW)
|
||||
#define LCD_DC_SET rt_pin_write(LCD_DC_PIN, PIN_HIGH)
|
||||
#define LCD_RES_CLR rt_pin_write(LCD_RES_PIN, PIN_LOW)
|
||||
#define LCD_RES_SET rt_pin_write(LCD_RES_PIN, PIN_HIGH)
|
||||
#define DELAY rt_thread_mdelay
|
||||
|
||||
void LCD_RESET(void);
|
||||
void LCD_WR_REG(uint8_t reg);
|
||||
void LCD_WR_DATA(uint8_t data);
|
||||
void LCD_WriteReg(uint8_t reg, uint16_t regdata);
|
||||
void LCD_WriteRAM_Prepare(void);
|
||||
void LCD_WriteData_16Bit(uint16_t Data);
|
||||
void LCD_direction(uint8_t direction);
|
||||
void LCD_SetWindows(uint16_t xStar, uint16_t yStar, uint16_t xEnd, uint16_t yEnd);
|
||||
void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
void LCD_Clear(uint16_t Color);
|
||||
void LCD_Fill(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color);
|
||||
void lcd_fill_array_spi(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, void *pcolor);
|
||||
|
||||
void LCD_Init(void);
|
||||
rt_err_t spi_lcd_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -329,19 +329,30 @@ menu "Hardware Drivers Config"
|
||||
endif
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SCI_SPI
|
||||
bool "Enable SCI SPI BUS"
|
||||
default n
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SCI_SPI
|
||||
config BSP_USING_SCI_SPI0
|
||||
bool "Enable SCI SPI0 BUS"
|
||||
default n
|
||||
config BSP_USING_SCI_SPI3
|
||||
bool "Enable SCI SPI3 BUS"
|
||||
default n
|
||||
config BSP_USING_SCI_SPI6
|
||||
bool "Enable SCI SPI6 BUS"
|
||||
default n
|
||||
endif
|
||||
|
||||
menuconfig BSP_USING_SPI
|
||||
bool "Enable SPI BUS"
|
||||
default n
|
||||
select RT_USING_SPI
|
||||
if BSP_USING_SPI
|
||||
config BSP_SPI_USING_DTC_DMA
|
||||
bool "Enable SPI DTC transfers data without using the CPU."
|
||||
default n
|
||||
|
||||
if BSP_USING_SPI
|
||||
config BSP_USING_SPI0
|
||||
bool "Enable SPI0 BUS"
|
||||
default n
|
||||
|
||||
config BSP_USING_SPI1
|
||||
bool "Enable SPI1 BUS"
|
||||
default n
|
||||
@@ -462,6 +473,7 @@ menu "Hardware Drivers Config"
|
||||
if BSP_USING_LVGL
|
||||
config BSP_USING_LCD_ILI9431
|
||||
bool "Enable LVGL for LCD_ILI9431"
|
||||
select PKG_USING_ILI9341
|
||||
select BSP_USING_SPI_LCD
|
||||
default n
|
||||
endif
|
||||
|
||||
@@ -38,7 +38,7 @@ static void disp_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_
|
||||
void lv_port_disp_init(void)
|
||||
{
|
||||
#ifdef BSP_USING_SPI_LCD
|
||||
spi_lcd_init();
|
||||
spi_lcd_init(20);
|
||||
#endif
|
||||
/*Initialize `disp_buf` with the buffer(s). With only one buffer use NULL instead buf_2 */
|
||||
lv_disp_draw_buf_init(&disp_buf, buf_1, buf_2, COLOR_BUFFER);
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
|
||||
from building import *
|
||||
import rtconfig
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
|
||||
src = []
|
||||
|
||||
if GetDepend(['BSP_USING_SPI_LCD']):
|
||||
src += Glob('lcd_ili9341.c')
|
||||
|
||||
CPPPATH = [cwd]
|
||||
LOCAL_CFLAGS = ''
|
||||
|
||||
if rtconfig.PLATFORM in ['gcc', 'armclang']:
|
||||
LOCAL_CFLAGS += ' -std=c99'
|
||||
elif rtconfig.PLATFORM in ['armcc']:
|
||||
LOCAL_CFLAGS += ' --c99'
|
||||
|
||||
group = DefineGroup('ili9341', src, depend = [], CPPPATH = CPPPATH, LOCAL_CFLAGS = LOCAL_CFLAGS)
|
||||
|
||||
Return('group')
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2023, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2023-02-23 Rbb666 First version
|
||||
*/
|
||||
#ifndef __LCD_ILI9341_H__
|
||||
#define __LCD_ILI9341_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#include "hal_data.h"
|
||||
#include <stdint.h>
|
||||
#include <rtthread.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16_t width; /* LCD width */
|
||||
uint16_t height; /* LCD high */
|
||||
uint32_t id; /* LCD ID */
|
||||
uint8_t dir; /* 0:Vertical | 1:Vertical */
|
||||
uint16_t wramcmd; /* gram cmd */
|
||||
uint16_t setxcmd; /* set x cmd */
|
||||
uint16_t setycmd; /* set y cmd */
|
||||
} _lcd_dev;
|
||||
|
||||
/* LCD param */
|
||||
extern _lcd_dev lcddev;
|
||||
|
||||
#define USE_HORIZONTAL 0 /* 0-0째|1-90째|2-180째|-270째 */
|
||||
|
||||
/* lcd size */
|
||||
#define LCD_W 240
|
||||
#define LCD_H 320
|
||||
|
||||
#define WHITE 0xFFFF
|
||||
#define BLACK 0x0000
|
||||
#define BLUE 0x001F
|
||||
#define BRED 0XF81F
|
||||
#define GRED 0XFFE0
|
||||
#define GBLUE 0X07FF
|
||||
#define RED 0xF800
|
||||
#define MAGENTA 0xF81F
|
||||
#define GREEN 0x07E0
|
||||
#define CYAN 0x7FFF
|
||||
#define YELLOW 0xFFE0
|
||||
#define BROWN 0XBC40
|
||||
#define BRRED 0XFC07
|
||||
#define GRAY 0X8430
|
||||
|
||||
#define LCD_DC_PIN BSP_IO_PORT_04_PIN_15
|
||||
#define LCD_RES_PIN BSP_IO_PORT_06_PIN_11
|
||||
#define LCD_CS_PIN BSP_IO_PORT_04_PIN_13
|
||||
|
||||
#define LCD_DC_CLR rt_pin_write(LCD_DC_PIN, PIN_LOW)
|
||||
#define LCD_DC_SET rt_pin_write(LCD_DC_PIN, PIN_HIGH)
|
||||
#define LCD_RES_CLR rt_pin_write(LCD_RES_PIN, PIN_LOW)
|
||||
#define LCD_RES_SET rt_pin_write(LCD_RES_PIN, PIN_HIGH)
|
||||
#define DELAY rt_thread_mdelay
|
||||
|
||||
/* res pin -> P6_11 */
|
||||
/* d/c pin -> P4_15 */
|
||||
/* cs pin -> P4_13 */
|
||||
|
||||
void LCD_RESET(void);
|
||||
void LCD_WR_REG(uint8_t reg);
|
||||
void LCD_WR_DATA(uint8_t data);
|
||||
void LCD_WriteReg(uint8_t reg, uint16_t regdata);
|
||||
void LCD_WriteRAM_Prepare(void);
|
||||
void LCD_WriteData_16Bit(uint16_t Data);
|
||||
void LCD_direction(uint8_t direction);
|
||||
void LCD_SetWindows(uint16_t xStar, uint16_t yStar, uint16_t xEnd, uint16_t yEnd);
|
||||
void LCD_SetCursor(uint16_t Xpos, uint16_t Ypos);
|
||||
void LCD_Clear(uint16_t Color);
|
||||
void LCD_Fill(uint16_t xsta, uint16_t ysta, uint16_t xend, uint16_t yend, uint16_t color);
|
||||
void lcd_fill_array_spi(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, void *pcolor);
|
||||
|
||||
void LCD_Init(void);
|
||||
rt_err_t spi_lcd_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
Reference in new issue
Block a user