Adjusted for C++. Removed EPD testing code.

This commit is contained in:
dejvino
2020-01-29 21:51:49 +01:00
parent a286a6a791
commit 6edb8a56d9
14 changed files with 241 additions and 1723 deletions
+22
View File
@@ -35,6 +35,28 @@
#define min(A,B) ( (A) < (B) ? (A):(B))
#endif
//==========================================================================================
// ==== Global variables ===================================================================
//==========================================================================================
uint8_t orientation; // current screen orientation
uint16_t font_rotate; // current font font_rotate angle (0~395)
uint8_t font_transparent; // if not 0 draw fonts transparent
uint8_t font_forceFixed; // if not zero force drawing proportional fonts with fixed width
uint8_t font_buffered_char;
uint8_t font_line_space; // additional spacing between text lines; added to font height
uint8_t text_wrap; // if not 0 wrap long text to the new line, else clip
color_t _fg; // current foreground color for fonts
color_t _bg; // current background for non transparent fonts
dispWin_t dispWin; // display clip window
float _angleOffset; // angle offset for arc, polygon and line by angle functions
Font_t cfont; // Current font structure
uint8_t image_debug;
int EPD_X; // X position of the next character after EPD_print() function
int EPD_Y; // Y position of the next character after EPD_print() function
// =========================================================================================
// Embedded fonts
extern uint8_t tft_SmallFont[];
extern uint8_t tft_DefaultFont[];
+21 -16
View File
@@ -9,6 +9,9 @@
#include <stdlib.h>
#include "EPDspi.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t color_t;
@@ -36,23 +39,23 @@ typedef struct {
//==========================================================================================
// ==== Global variables ===================================================================
//==========================================================================================
uint8_t orientation; // current screen orientation
uint16_t font_rotate; // current font font_rotate angle (0~395)
uint8_t font_transparent; // if not 0 draw fonts transparent
uint8_t font_forceFixed; // if not zero force drawing proportional fonts with fixed width
uint8_t font_buffered_char;
uint8_t font_line_space; // additional spacing between text lines; added to font height
uint8_t text_wrap; // if not 0 wrap long text to the new line, else clip
color_t _fg; // current foreground color for fonts
color_t _bg; // current background for non transparent fonts
dispWin_t dispWin; // display clip window
float _angleOffset; // angle offset for arc, polygon and line by angle functions
extern uint8_t orientation; // current screen orientation
extern uint16_t font_rotate; // current font font_rotate angle (0~395)
extern uint8_t font_transparent; // if not 0 draw fonts transparent
extern uint8_t font_forceFixed; // if not zero force drawing proportional fonts with fixed width
extern uint8_t font_buffered_char;
extern uint8_t font_line_space; // additional spacing between text lines; added to font height
extern uint8_t text_wrap; // if not 0 wrap long text to the new line, else clip
extern color_t _fg; // current foreground color for fonts
extern color_t _bg; // current background for non transparent fonts
extern dispWin_t dispWin; // display clip window
extern float _angleOffset; // angle offset for arc, polygon and line by angle functions
Font_t cfont; // Current font structure
uint8_t image_debug;
extern Font_t cfont; // Current font structure
extern uint8_t image_debug;
int EPD_X; // X position of the next character after EPD_print() function
int EPD_Y; // Y position of the next character after EPD_print() function
extern int EPD_X; // X position of the next character after EPD_print() function
extern int EPD_Y; // Y position of the next character after EPD_print() function
// =========================================================================================
@@ -567,5 +570,7 @@ void getFontCharacters(uint8_t *buf);
*
*/
int EPD_jpg_image(int x, int y, uint8_t scale, char *fname, uint8_t *buf, int size);
#ifdef __cplusplus
}
#endif
#endif
+21 -2
View File
@@ -29,6 +29,25 @@
#define yDot 296
#define DELAYTIME 1500
// ===== Global ======
spi_lobo_device_handle_t disp_spi;
uint8_t *gs_disp_buffer;
uint8_t *disp_buffer;
uint8_t *gs_drawBuff;
uint8_t *drawBuff;
int _width;
int _height;
uint16_t gs_used_shades;
uint8_t _gs;
uint8_t *LUT_part;
uint8_t LUTDefault_fastest[31];
uint8_t LUTDefault_part[31];
uint8_t LUT_gs[31];
uint8_t LUTDefault_full[31];
uint8_t lvl_buf[16];
uint8_t lvl_buf_jpg[16];
// =====
static uint8_t GDOControl[] = {0x01, (yDot-1)%256, (yDot-1)/256, 0x00};
static uint8_t softstart[4] = {0x0c, 0xd7, 0xd6, 0x9d};
static uint8_t VCOMVol[2] = {0x2c, 0xa8}; // VCOM 7c
@@ -255,7 +274,7 @@ void EPD_PowerOff()
WaitBusy();
ReadBusy();
#endif
#if POWER_Pin
#ifdef POWER_Pin
gpio_set_level(DC_Pin, 0);
gpio_set_level(MOSI_Pin, 0);
gpio_set_level(SCK_Pin, 0);
@@ -396,7 +415,7 @@ static void part_display(uint8_t RAM_XST, uint8_t RAM_XEND ,uint16_t RAM_YST, ui
//--------------------
static void EPD_Init()
{
#if POWER_Pin
#ifdef POWER_Pin
gpio_set_level(POWER_Pin, 1);
vTaskDelay(100 / portTICK_RATE_MS);
#else
+30 -23
View File
@@ -15,19 +15,23 @@
#include <stdint.h>
#include "spi_master_lobo.h"
#ifdef __cplusplus
extern "C" {
#endif
#define EPD_DISPLAY_WIDTH 296
#define EPD_DISPLAY_HEIGHT 128
#define SCK_Pin 18
#define MOSI_Pin 23
#define SCK_Pin ((gpio_num_t)18)
#define MOSI_Pin ((gpio_num_t)23)
//#define MISO_Pin 19
#define DC_Pin 17//26
#define BUSY_Pin 4//32
#define RST_Pin 16//27
#define CS_Pin 5
#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)
// ePaper display can be powered from GPIO
// if powered directly from Vcc, set this to 0
#define POWER_Pin 22
#define POWER_Pin ((gpio_num_t)22)
#define DC_VAL (1 << DC_Pin)
@@ -51,22 +55,22 @@
#define SPI_BUS VSPI_HOST
// ==================================================
spi_lobo_device_handle_t disp_spi;
uint8_t *gs_disp_buffer;
uint8_t *disp_buffer;
uint8_t *gs_drawBuff;
uint8_t *drawBuff;
int _width;
int _height;
uint16_t gs_used_shades;
uint8_t _gs;
uint8_t *LUT_part;
uint8_t LUTDefault_fastest[31];
uint8_t LUTDefault_part[31];
uint8_t LUT_gs[31];
uint8_t LUTDefault_full[31];
uint8_t lvl_buf[16];
uint8_t lvl_buf_jpg[16];
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];
void EPD_wait(uint32_t ms);
void EPD_DisplaySetFull(uint8_t val);
@@ -82,5 +86,8 @@ void EPD_Cls();
void EPD_PowerOn();
void EPD_PowerOff();
#ifdef __cplusplus
}
#endif
#endif
+9 -2
View File
@@ -13,11 +13,18 @@
#define SPIFFS_BASE_PATH "/spiffs"
#ifdef __cplusplus
extern "C" {
#endif
int spiffs_is_registered;
int spiffs_is_mounted;
extern int spiffs_is_registered;
extern int spiffs_is_mounted;
void vfs_spiffs_register();
int spiffs_mount();
int spiffs_unmount(int unreg);
void spiffs_fs_stat(uint32_t *total, uint32_t *used);
#ifdef __cplusplus
}
#endif