ESP32-WROVER-KIT-LCD-DRIVER
|
write the Framebuffer More...
#include "Driver.h"
Functions | |
uint32_t | vDriver_GetId (void) |
get LCD driver chip id More... | |
static esp_err_t | iDriver_sendLineFinish (void) |
send finish after line More... | |
void | vDriver_spiPreTransferCallback (spi_transaction_t *t) |
Pre Transfer Callback. More... | |
esp_err_t | iDriver_sendCmd (const uint8_t u8Cmd) |
Send a command to the LCD. More... | |
static esp_err_t | iDriver_sendLines (uint16_t u16Ypos, uint16_t *pu16Linedata) |
send line to lcd chip More... | |
esp_err_t | iDriver_SendData (const uint8_t *pu8Data, uint16_t u16Len) |
Send data to the LCD. More... | |
void | vDriver_getFramenufferPerLine (uint16_t *pu16Dest, uint16_t u16Line, uint16_t u16Linect, uint16_t ***pu16Framebuffer) |
Get the pixel data for a set of lines (with implied line size of 320) More... | |
esp_err_t | vDriver_init (void) |
Initialize the driver. More... | |
esp_err_t | iDriver_writeFramebuffer (uint16_t ***pu16Framebuffer) |
write framebuffer to LCD via SPI More... | |
Variables | |
spi_device_handle_t | spi |
uint16_t * | lines [2] |
int16_t | sending_line =-1 |
int16_t | calc_line =0 |
static DRAM_ATTR const lcd_init_cmd_t | st_init_cmds [] |
static DRAM_ATTR const lcd_init_cmd_t | ili_init_cmds [] |
write the Framebuffer
This code used SPI to write data to the LCD driver like ILI9341 or ST7789V.
esp_err_t iDriver_sendCmd | ( | const uint8_t | u8Cmd | ) |
Send a command to the LCD.
const | uint8_t u8Cmd |
Send a command to the LCD. Uses spi_device_polling_transmit, which waits until the transfer is complete.
Since command transactions are usually small, they are handled in polling mode for higher speed. The overhead of interrupt transactions is more than just waiting for the transaction to complete.
esp_err_t iDriver_SendData | ( | const uint8_t * | pu8Data, |
uint16_t | u16Len | ||
) |
Send data to the LCD.
const | uint8_t *pu8Data |
uint16_t | u16Len |
Send data to the LCD. Uses spi_device_polling_transmit, which waits until the transfer is complete.
Since data transactions are usually small, they are handled in polling mode for higher speed. The overhead of interrupt transactions is more than just waiting for the transaction to complete.
|
static |
send finish after line
void |
|
static |
send line to lcd chip
uint16_t | u16Ypos |
uint16_t | *pu16Linedata |
To send a set of lines we have to send a command, 2 data bytes, another command, 2 more data bytes and another command before sending the line data itself; a total of 6 transactions. (We can't put all of this in just one transaction because the D/C line needs to be toggled in the middle.) This routine queues these commands up as interrupt transactions so they get sent faster (compared to calling spi_device_transmit several times), and at the mean while the lines for next transactions can get calculated.
esp_err_t iDriver_writeFramebuffer | ( | uint16_t *** | pu16Framebuffer | ) |
write framebuffer to LCD via SPI
uint16_t | ***pu16Framebuffer |
void vDriver_getFramenufferPerLine | ( | uint16_t * | pu16Dest, |
uint16_t | u16Line, | ||
uint16_t | u16Linect, | ||
uint16_t *** | pu16Framebuffer | ||
) |
Get the pixel data for a set of lines (with implied line size of 320)
uint16_t | *pu16Dest |
uint16_t | u16Line |
uint16_t | u16Linect |
uint16_t | ***pu16Framebuffer |
uint32_t vDriver_GetId | ( | void | ) |
get LCD driver chip id
void |
esp_err_t vDriver_init | ( | void | ) |
Initialize the driver.
void |
Enable backlight
void vDriver_spiPreTransferCallback | ( | spi_transaction_t * | t | ) |
Pre Transfer Callback.
spi_transaction_t | *t |
This function is called (in irq context!) just before a transmission starts. It will set the D/C line to the value indicated in the user field.
int16_t calc_line =0 |
|
static |
uint16_t* lines[2] |
int16_t sending_line =-1 |
spi_device_handle_t spi |
|
static |