added lcd component
This commit is contained in:
58
components/lcd/include/Driver.h
Normal file
58
components/lcd/include/Driver.h
Normal file
@ -0,0 +1,58 @@
|
||||
/*! @file Driver.h
|
||||
|
||||
@brief
|
||||
@author Hendrik Schutter
|
||||
@version V1.0
|
||||
@date 03.11.2020
|
||||
*/
|
||||
|
||||
#ifndef __DRIVER_H
|
||||
#define __DRIVER_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "driver/spi_master.h"
|
||||
#include "esp_system.h"
|
||||
#include "driver/gpio.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#define LCD_HOST HSPI_HOST
|
||||
#define DMA_CHAN 2
|
||||
|
||||
#define PIN_NUM_MISO 25
|
||||
#define PIN_NUM_MOSI 23
|
||||
#define PIN_NUM_CLK 19
|
||||
#define PIN_NUM_CS 22
|
||||
|
||||
#define PIN_NUM_DC 21
|
||||
#define PIN_NUM_RST 18
|
||||
#define PIN_NUM_BCKL 5
|
||||
|
||||
#define LCD_WIDTH 320
|
||||
#define LCD_HIGH 240
|
||||
|
||||
//To speed up transfers, every SPI transfer sends a bunch of lines. This define specifies how many. More means more memory use,
|
||||
//but less overhead for setting up / finishing transfers. Make sure 240 is dividable by this.
|
||||
#define PARALLEL_LINES 16
|
||||
|
||||
/*
|
||||
The LCD needs a bunch of command/argument values to be initialized. They are stored in this struct.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t cmd;
|
||||
uint8_t data[16];
|
||||
uint8_t databytes; //No of data in data; bit 7 = delay after set; 0xFF = end of cmds.
|
||||
} lcd_init_cmd_t;
|
||||
|
||||
typedef enum {
|
||||
LCD_TYPE_ILI = 1,
|
||||
LCD_TYPE_ST,
|
||||
LCD_TYPE_MAX,
|
||||
} type_lcd_t;
|
||||
|
||||
esp_err_t vDriver_init(void);
|
||||
esp_err_t iDriver_writeFramebuffer(uint16_t ***pu16Framebuffer);
|
||||
|
||||
#endif /* __DRIVER_H */
|
29
components/lcd/include/LCD.h
Normal file
29
components/lcd/include/LCD.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*! @file LCD.h
|
||||
|
||||
@brief
|
||||
@author Hendrik Schutter
|
||||
@version V1.0
|
||||
@date 03.11.2020
|
||||
*/
|
||||
|
||||
#ifndef __LCD_H
|
||||
#define __LCD_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "driver/spi_master.h"
|
||||
#include "driver/gpio.h"
|
||||
#include <string.h>
|
||||
#include "esp_system.h"
|
||||
|
||||
#define COLOR_RED 0xF800
|
||||
#define COLOR_GREEN 0x07E0
|
||||
#define COLOR_BLUE 0x001F
|
||||
#define COLOR_WHITE 0xFFFF
|
||||
#define COLOR_BLACK 0x0000
|
||||
|
||||
esp_err_t iLCD_init(void);
|
||||
esp_err_t iLCD_clearFramebuffer(uint16_t u16Color);
|
||||
esp_err_t iLCD_writeString(uint16_t u16xPos, uint16_t u16yPos, char *pcText, uint16_t u16ColorFont, uint16_t u16ColorBackground);
|
||||
|
||||
#endif /* __LCD_H */
|
Reference in New Issue
Block a user