2020-01-29 17:30:50 +00:00
|
|
|
/*
|
|
|
|
* Author: LoBo (loboris@gmail.com, loboris.github)
|
|
|
|
*
|
|
|
|
* Module supporting SPI ePaper displays
|
|
|
|
*
|
|
|
|
* HIGH SPEED LOW LEVEL DISPLAY FUNCTIONS
|
|
|
|
* USING DIRECT or DMA SPI TRANSFER MODEs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _EPDSPI_H_
|
|
|
|
#define _EPDSPI_H_
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-02-02 21:13:42 +00:00
|
|
|
#include "spidriver/spi_master_lobo.h"
|
2020-01-29 17:30:50 +00:00
|
|
|
|
2020-01-29 20:51:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-01-29 17:30:50 +00:00
|
|
|
#define EPD_DISPLAY_WIDTH 296
|
|
|
|
#define EPD_DISPLAY_HEIGHT 128
|
|
|
|
|
2020-01-29 20:51:49 +00:00
|
|
|
#define SCK_Pin ((gpio_num_t)18)
|
|
|
|
#define MOSI_Pin ((gpio_num_t)23)
|
2020-01-29 17:30:50 +00:00
|
|
|
//#define MISO_Pin 19
|
2020-01-29 20:51:49 +00:00
|
|
|
#define DC_Pin ((gpio_num_t)17)//26
|
|
|
|
#define BUSY_Pin ((gpio_num_t)4)//32
|
|
|
|
#define RST_Pin ((gpio_num_t)16)//27
|
|
|
|
#define CS_Pin ((gpio_num_t)5)
|
2020-01-29 17:30:50 +00:00
|
|
|
// ePaper display can be powered from GPIO
|
|
|
|
// if powered directly from Vcc, set this to 0
|
2020-01-29 20:51:49 +00:00
|
|
|
#define POWER_Pin ((gpio_num_t)22)
|
2020-01-29 17:30:50 +00:00
|
|
|
|
|
|
|
#define DC_VAL (1 << DC_Pin)
|
|
|
|
|
|
|
|
#define EPD_CS_0 gpio_set_level(CS_Pin, 0)
|
|
|
|
#define EPD_CS_1 gpio_set_level(CS_Pin, 1)
|
|
|
|
#define isEPD_CS gpio_get_level(CS_Pin)
|
|
|
|
|
|
|
|
#define EPD_RST_0 gpio_set_level(RST_Pin, 0)
|
|
|
|
#define EPD_RST_1 gpio_set_level(RST_Pin, 1)
|
|
|
|
#define isEPD_RST gpio_get_level(RST_Pin)
|
|
|
|
|
|
|
|
#define EPD_DC_0 gpio_set_level(DC_Pin, 0)
|
|
|
|
#define EPD_DC_1 gpio_set_level(DC_Pin, 1)
|
|
|
|
|
|
|
|
#define isEPD_BUSY gpio_get_level(BUSY_Pin)
|
|
|
|
|
|
|
|
#define EPD_BUSY_LEVEL 0
|
|
|
|
|
|
|
|
// ==================================================
|
|
|
|
// Define which spi bus to use VSPI_HOST or HSPI_HOST
|
|
|
|
#define SPI_BUS VSPI_HOST
|
|
|
|
// ==================================================
|
|
|
|
|
2020-01-29 20:51:49 +00:00
|
|
|
extern spi_lobo_device_handle_t disp_spi;
|
|
|
|
extern uint8_t *gs_disp_buffer;
|
|
|
|
extern uint8_t *disp_buffer;
|
|
|
|
extern uint8_t *gs_drawBuff;
|
|
|
|
extern uint8_t *drawBuff;
|
|
|
|
extern int _width;
|
|
|
|
extern int _height;
|
|
|
|
extern uint16_t gs_used_shades;
|
|
|
|
extern uint8_t _gs;
|
|
|
|
extern uint8_t *LUT_part;
|
|
|
|
extern uint8_t LUTDefault_fastest[31];
|
|
|
|
extern uint8_t LUTDefault_part[31];
|
|
|
|
extern uint8_t LUT_gs[31];
|
|
|
|
extern uint8_t LUTDefault_full[31];
|
|
|
|
extern uint8_t lvl_buf[16];
|
|
|
|
extern uint8_t lvl_buf_jpg[16];
|
2020-01-29 17:30:50 +00:00
|
|
|
|
|
|
|
void EPD_wait(uint32_t ms);
|
|
|
|
void EPD_DisplaySetFull(uint8_t val);
|
|
|
|
void EPD_DisplaySetPart(int xStart, int xEnd, uint8_t yStart, uint8_t yEnd, uint8_t val);
|
|
|
|
void EPD_DisplayClearFull();
|
|
|
|
void EPD_DisplayClearPart();
|
|
|
|
void EPD_DisplayFull(uint8_t *DisBuffer);
|
|
|
|
void EPD_DisplayPart(int xStart, int xEnd, uint8_t yStart, uint8_t yEnd, uint8_t *DisBuffer);
|
|
|
|
void EPD_gsUpdate(int xStart, int xEnd, uint8_t yStart, uint8_t yEnd, uint8_t gs);
|
|
|
|
void EPD_Update(int xStart, int xEnd, uint8_t yStart, uint8_t yEnd);
|
|
|
|
void EPD_UpdateScreen();
|
|
|
|
void EPD_Cls();
|
|
|
|
void EPD_PowerOn();
|
|
|
|
void EPD_PowerOff();
|
|
|
|
|
2020-01-29 20:51:49 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2020-01-29 17:30:50 +00:00
|
|
|
|
|
|
|
#endif
|