15 changed files with 1362 additions and 334 deletions
			
			
		@ -0,0 +1,10 @@ | 
				
			|||||||
 | 
					cmake_minimum_required(VERSION 3.13) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(CMAKE_C_STANDARD 11) | 
				
			||||||
 | 
					set(CMAKE_CXX_STANDARD 17) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					project(epd C CXX ASM) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					file(GLOB FILES *.c *.h) | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_library(${PROJECT_NAME} ${FILES}) | 
				
			||||||
@ -0,0 +1,11 @@ | 
				
			|||||||
 | 
					/* epd.c - E-Paper Display library API */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes */ | 
				
			||||||
 | 
					#include "epd.h" | 
				
			||||||
 | 
					#include "string.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Definitions */ | 
				
			||||||
 | 
					void epd_init(epd_t *epd, epd_config_t *cfg) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    memcpy(&(epd->cfg), cfg, sizeof(epd_config_t)); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,34 @@ | 
				
			|||||||
 | 
					/* epd.h - E-Paper Display library API */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef EPD_H_ | 
				
			||||||
 | 
					#define EPD_H_ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes */ | 
				
			||||||
 | 
					#include "stddef.h" | 
				
			||||||
 | 
					#include "stdint.h" | 
				
			||||||
 | 
					#include "stdbool.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Data Structures */ | 
				
			||||||
 | 
					typedef int (*epd_spi_write)(const uint8_t *, size_t, void *); | 
				
			||||||
 | 
					typedef void (*epd_spi_cs)(bool, void *); | 
				
			||||||
 | 
					typedef void (*epd_gpo_dc)(bool, void *); | 
				
			||||||
 | 
					typedef void (*epd_gpo_rst)(bool, void *); | 
				
			||||||
 | 
					typedef bool (*epd_gpi_busy)(void *); | 
				
			||||||
 | 
					typedef void (*epd_sleep_ms)(uint32_t, void *); | 
				
			||||||
 | 
					typedef struct epd_config_s { | 
				
			||||||
 | 
					    epd_spi_write spi_write; | 
				
			||||||
 | 
					    epd_spi_cs spi_cs; | 
				
			||||||
 | 
					    epd_gpo_dc dc; | 
				
			||||||
 | 
					    epd_gpo_rst rst; | 
				
			||||||
 | 
					    epd_gpi_busy busy; | 
				
			||||||
 | 
					    epd_sleep_ms sleep_ms; | 
				
			||||||
 | 
					    void *udata; | 
				
			||||||
 | 
					} epd_config_t; | 
				
			||||||
 | 
					typedef struct epd_s { | 
				
			||||||
 | 
					    epd_config_t cfg; | 
				
			||||||
 | 
					} epd_t; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Prototypes */ | 
				
			||||||
 | 
					void epd_init(epd_t *epd, epd_config_t *cfg); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* EPD_H_ */ | 
				
			||||||
@ -0,0 +1,15 @@ | 
				
			|||||||
 | 
					/* epd.h - E-Paper Display library API */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef EPD_4P2MONO_H_ | 
				
			||||||
 | 
					#define EPD_4P2MONO_H_ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes */ | 
				
			||||||
 | 
					#include "epd.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Prototypes */ | 
				
			||||||
 | 
					void epd_4p2mono_init(epd_t *epd); | 
				
			||||||
 | 
					void epd_4p2mono_clear(epd_t *epd); | 
				
			||||||
 | 
					void epd_4p2mono_testpattern(epd_t *epd); | 
				
			||||||
 | 
					void epd_4p2mono_testimg(epd_t *epd); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* EPD_4P2MONO_H_ */ | 
				
			||||||
@ -0,0 +1,85 @@ | 
				
			|||||||
 | 
					/* epd0.c - Instantiate E-Paper Display 0 */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes */ | 
				
			||||||
 | 
					#include <stdio.h> | 
				
			||||||
 | 
					#include "pico/stdlib.h" | 
				
			||||||
 | 
					#include "hardware/spi.h" | 
				
			||||||
 | 
					#include "epd/epd.h" | 
				
			||||||
 | 
					#include "epd0.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Definitions */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Data Structures */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Global Variables */ | 
				
			||||||
 | 
					epd_t epd0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Prototypes */ | 
				
			||||||
 | 
					static int epd0_spi_write(const uint8_t *buf, size_t len, void *udata); | 
				
			||||||
 | 
					static void epd0_spi_cs(bool state, void *udata); | 
				
			||||||
 | 
					static void epd0_gpo_rst(bool state, void *udata); | 
				
			||||||
 | 
					static void epd0_gpo_dc(bool state, void *udata); | 
				
			||||||
 | 
					static bool epd0_gpo_busy(void *udata); | 
				
			||||||
 | 
					static void epd0_sleep_ms(uint32_t ms, void *udata); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Definitions */ | 
				
			||||||
 | 
					void epd0_init() | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    epd_config_t epd0_cfg = { | 
				
			||||||
 | 
					        .spi_write = epd0_spi_write, | 
				
			||||||
 | 
					        .spi_cs    = epd0_spi_cs, | 
				
			||||||
 | 
					        .rst       = epd0_gpo_rst, | 
				
			||||||
 | 
					        .dc        = epd0_gpo_dc, | 
				
			||||||
 | 
					        .busy      = epd0_gpo_busy, | 
				
			||||||
 | 
					        .sleep_ms  = epd0_sleep_ms, | 
				
			||||||
 | 
					        .udata     = NULL | 
				
			||||||
 | 
					    }; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* SPI initialisation. This example will use SPI at 1MHz. */ | 
				
			||||||
 | 
					    spi_init(EPD0_SPI_PORT, 1000*1000); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_MISO, GPIO_FUNC_SPI); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_CS,   GPIO_FUNC_SIO); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_SCK,  GPIO_FUNC_SPI); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_MOSI, GPIO_FUNC_SPI); | 
				
			||||||
 | 
					    /* initialize other display pins */ | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_RST, GPIO_FUNC_SIO); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_BUSY, GPIO_FUNC_SIO); | 
				
			||||||
 | 
					    gpio_set_function(EPD0_PIN_DC, GPIO_FUNC_SIO); | 
				
			||||||
 | 
					    gpio_set_dir(EPD0_PIN_CS, GPIO_OUT); | 
				
			||||||
 | 
					    gpio_set_dir(EPD0_PIN_RST, GPIO_OUT); | 
				
			||||||
 | 
					    gpio_set_dir(EPD0_PIN_BUSY, GPIO_IN); | 
				
			||||||
 | 
					    gpio_set_dir(EPD0_PIN_DC, GPIO_OUT); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* initialize epd0 */ | 
				
			||||||
 | 
					    epd_init(&epd0, &epd0_cfg); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int epd0_spi_write(const uint8_t *buf, size_t len, void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    return spi_write_blocking(EPD0_SPI_PORT, buf, len); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void epd0_spi_cs(bool state, void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    gpio_put(EPD0_PIN_CS, state ? 0 : 1); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void epd0_gpo_rst(bool state, void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    gpio_put(EPD0_PIN_RST, state ? 0 : 1); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void epd0_gpo_dc(bool state, void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    gpio_put(EPD0_PIN_DC, state ? 1 : 0); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool epd0_gpo_busy(void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    return gpio_get(EPD0_PIN_BUSY); | 
				
			||||||
 | 
					} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void epd0_sleep_ms(uint32_t ms, void *udata) | 
				
			||||||
 | 
					{ | 
				
			||||||
 | 
					    sleep_ms(ms); | 
				
			||||||
 | 
					} | 
				
			||||||
@ -0,0 +1,30 @@ | 
				
			|||||||
 | 
					/* epd0.h - Instantiate E-Paper Display 0 */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef EPD0_H_ | 
				
			||||||
 | 
					#define EPD0_H_ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Includes */ | 
				
			||||||
 | 
					#include <stdio.h> | 
				
			||||||
 | 
					#include "pico/stdlib.h" | 
				
			||||||
 | 
					#include "hardware/spi.h" | 
				
			||||||
 | 
					#include "epd/epd.h" | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Definitions */ | 
				
			||||||
 | 
					#define EPD0_SPI_PORT spi0 | 
				
			||||||
 | 
					#define EPD0_PIN_SCK  2 | 
				
			||||||
 | 
					#define EPD0_PIN_MOSI 3 | 
				
			||||||
 | 
					#define EPD0_PIN_MISO 4 | 
				
			||||||
 | 
					#define EPD0_PIN_CS   5 | 
				
			||||||
 | 
					#define EPD0_PIN_DC   6 | 
				
			||||||
 | 
					#define EPD0_PIN_RST  7 | 
				
			||||||
 | 
					#define EPD0_PIN_BUSY 8 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Data Structures */ | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Global Variables */ | 
				
			||||||
 | 
					extern epd_t epd0; | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Function Prototypes */ | 
				
			||||||
 | 
					void epd0_init(); | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif /* EPD0_H_ */ | 
				
			||||||
@ -1,241 +0,0 @@ | 
				
			|||||||
#include "stdint.h" | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Definitions */ | 
					 | 
				
			||||||
#define CMD_PSR   (0x00) /* panel settings */ | 
					 | 
				
			||||||
#define CMD_PWR   (0x01) /* power settings */ | 
					 | 
				
			||||||
#define CMD_POF   (0x02) /* power off */ | 
					 | 
				
			||||||
#define CMD_PFS   (0x03) /* power off sequence settings */ | 
					 | 
				
			||||||
#define CMD_PON   (0x04) /* power on */ | 
					 | 
				
			||||||
#define CMD_PMES  (0x05) /* power on measure */ | 
					 | 
				
			||||||
#define CMD_BTST  (0x06) /* booster soft-start */ | 
					 | 
				
			||||||
#define CMD_DSLP  (0x07) /* deep sleep */ | 
					 | 
				
			||||||
#define CMD_DTM1  (0x10) /* display start transmission 1 (white/black data) */ | 
					 | 
				
			||||||
#define CMD_DSP   (0x11) /* data stop */ | 
					 | 
				
			||||||
#define CMD_DRF   (0x12) /* display refresh */ | 
					 | 
				
			||||||
#define CMD_DTM2  (0x13) /* display start transmission 2 (red data) */ | 
					 | 
				
			||||||
#define CMD_PLL   (0x30) /* PLL control */ | 
					 | 
				
			||||||
#define CMD_TSC   (0x40) /* temperature sensor calibration */ | 
					 | 
				
			||||||
#define CMD_TSE   (0x41) /* temperature sensor selection */ | 
					 | 
				
			||||||
#define CMD_TSW   (0x42) /* temperature sensor write */ | 
					 | 
				
			||||||
#define CMD_TSR   (0x43) /* temperature sensor read */ | 
					 | 
				
			||||||
#define CMD_CDI   (0x50) /* VCOM and data interval settings */ | 
					 | 
				
			||||||
#define CMD_LPD   (0x51) /* low power detection */ | 
					 | 
				
			||||||
#define CMD_TCON  (0x60) /* TCON settings */ | 
					 | 
				
			||||||
#define CMD_TRES  (0x61) /* resolution settings */ | 
					 | 
				
			||||||
#define CMD_GSST  (0x65) /* GSST settings */ | 
					 | 
				
			||||||
#define CMD_REV   (0x70) /* revision */ | 
					 | 
				
			||||||
#define CMD_FLG   (0x71) /* get status */ | 
					 | 
				
			||||||
#define CMD_VCOM  (0x80) /* auto-measurement */ | 
					 | 
				
			||||||
#define CMD_VV    (0x81) /* read VCOM value */ | 
					 | 
				
			||||||
#define CMD_VDCS  (0x82) /* VCOM_DC settings */ | 
					 | 
				
			||||||
#define CMD_PTL   (0x90) /* partial window */ | 
					 | 
				
			||||||
#define CMD_PTIN  (0x91) /* partial in */ | 
					 | 
				
			||||||
#define CMD_PTOUT (0x92) /* partial out */ | 
					 | 
				
			||||||
#define CMD_PGM   (0xa0) /* program mode */ | 
					 | 
				
			||||||
#define CMD_APG   (0xa1) /* active programming */ | 
					 | 
				
			||||||
#define CMD_ROTP  (0xa2) /* read OTP */ | 
					 | 
				
			||||||
#define CMD_CCSET (0xe0) /* cascade settings */ | 
					 | 
				
			||||||
#define CMD_PWS   (0xe3) /* power saving */ | 
					 | 
				
			||||||
#define CMD_LPSEL (0xe4) /* LPD selection */ | 
					 | 
				
			||||||
#define CMD_TSSET (0xe5) /* force temperature */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Data Structures */ | 
					 | 
				
			||||||
typedef union psr_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) psr_s = { | 
					 | 
				
			||||||
		uint8_t rst_n : 1, /* soft reset */ | 
					 | 
				
			||||||
		uint8_t shd_n : 1, /* booster switch */ | 
					 | 
				
			||||||
		uint8_t shl   : 1, /* horizontal scan direction */ | 
					 | 
				
			||||||
		uint8_t ud    : 1, /* vertical scan direction */ | 
					 | 
				
			||||||
		uint8_t _na0  : 1, /* don't care */ | 
					 | 
				
			||||||
		uint8_t reg   : 1, /* B/W/R or B/W */ | 
					 | 
				
			||||||
		uint8_t res   : 2  /* display resolution */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} psr_t; | 
					 | 
				
			||||||
typedef union pwr_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) pwr_s = { | 
					 | 
				
			||||||
		uint8_t vdhr    : 6, /* internal VDHR power selection for red pixel */ | 
					 | 
				
			||||||
		uint8_t _na4    : 2, /* don't care */ | 
					 | 
				
			||||||
		uint8_t vdl     : 6, /* internal VDL power selectrion for B/W pixel */ | 
					 | 
				
			||||||
		uint8_t _na3    : 2, /* don't care */ | 
					 | 
				
			||||||
		uint8_t vdh     : 6, /* internal VDH power selection for B/W pixel */ | 
					 | 
				
			||||||
		uint8_t _na2    : 2, /* don't care */ | 
					 | 
				
			||||||
		uint8_t vghl_lv : 2, /* VGH/VGL voltage level selection */ | 
					 | 
				
			||||||
		uint8_t vcom_hv : 1, /* VCOM voltage level */ | 
					 | 
				
			||||||
		uint8_t _na1    : 5, /* don't care */ | 
					 | 
				
			||||||
		uint8_t vdg_en  : 1, /* gate power selection */ | 
					 | 
				
			||||||
		uint8_t vds_en  : 1, /* source power selection */ | 
					 | 
				
			||||||
		uint8_t _na0    : 6 , /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[5]; | 
					 | 
				
			||||||
} pwr_t; | 
					 | 
				
			||||||
typedef union pfs_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) pfs_s = { | 
					 | 
				
			||||||
		uint8_t _na1      : 4, /* don't care */ | 
					 | 
				
			||||||
		uint8_t t_vds_off : 2, /* power off sequence of VDH and VDL */ | 
					 | 
				
			||||||
		uint8_t _na0      : 2 /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} pfs_t; | 
					 | 
				
			||||||
typedef union btst_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) btst_s = { | 
					 | 
				
			||||||
		uint8_t bt_phc : 6, /* phase C: drive strength / minimum GDR off time */ | 
					 | 
				
			||||||
		uint8_t _na0   : 2, /* display resolution */ | 
					 | 
				
			||||||
		uint8_t bt_phb : 8, /* phase B: soft-start period / drive strength / minimum GDR off time */ | 
					 | 
				
			||||||
		uint8_t bt_pha : 8  /* phase A: soft-start period / drive strength / minimum GDR off time */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[3] | 
					 | 
				
			||||||
} btst_t; | 
					 | 
				
			||||||
typedef union pll_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) pll_s = { | 
					 | 
				
			||||||
		uint8_t n    : 3, /* N: 1-7 */ | 
					 | 
				
			||||||
		uint8_t m    : 3, /* M: 1-7 */ | 
					 | 
				
			||||||
		uint8_t _na0 : 2  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} pll_t; | 
					 | 
				
			||||||
typedef uint16_t tsc_t; | 
					 | 
				
			||||||
typedef union tse_u = { | 
					 | 
				
			||||||
	struct tse_t = { | 
					 | 
				
			||||||
		uint8_t to   : 4, /* temperature offset */ | 
					 | 
				
			||||||
		uint8_t _na0 : 3, /* don't care */ | 
					 | 
				
			||||||
		uint8_t tse  : 1  /* internal temperature sensor switch */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} tse_t; | 
					 | 
				
			||||||
typedef union tsw_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) tsw_s = { | 
					 | 
				
			||||||
		uint8_t wlsb  : 8, /* LSB of data to write to external temperature sensor */ | 
					 | 
				
			||||||
		uint8_t wmsb  : 8, /* MSB of data to write to external temperature sensor */ | 
					 | 
				
			||||||
		uint8_t wattr : 8  /* I2C write byte number */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[3] | 
					 | 
				
			||||||
} tsw_t; | 
					 | 
				
			||||||
typedef union tsr_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) tsr_s = { | 
					 | 
				
			||||||
		uint8_t rlsb  : 8, /* LSB of data to read from external temperature sensor */ | 
					 | 
				
			||||||
		uint8_t rmsb  : 8  /* MSB of data to read from external temperature sensor */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[2] | 
					 | 
				
			||||||
} tsr_t; | 
					 | 
				
			||||||
typedef union cdi_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) cdi_s = { | 
					 | 
				
			||||||
		uint8_t cdi : 4, /* VCOM and data interval */ | 
					 | 
				
			||||||
		uint8_t ddx : 2, /* data polarity */ | 
					 | 
				
			||||||
		uint8_t vbd : 2  /* border data selection */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} cdi_t; | 
					 | 
				
			||||||
typedef union lpd_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) lpd_s = { | 
					 | 
				
			||||||
		uint8_t lpd  : 1, /* low power detection flag */ | 
					 | 
				
			||||||
		uint8_t _na0 : 7  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} lpd_t; | 
					 | 
				
			||||||
typedef union tcon_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) tcon_s = { | 
					 | 
				
			||||||
		uint8_t g2s  : 8, /* gate to source dead time */ | 
					 | 
				
			||||||
		uint8_t s2g  : 8  /* source to gate dead time */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[2] | 
					 | 
				
			||||||
} tcon_t; | 
					 | 
				
			||||||
typedef union tres_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) tres_s = { | 
					 | 
				
			||||||
		uint16_t _na1 : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t hres : 9, /* horizontal resolution */ | 
					 | 
				
			||||||
		uint16_t _na0 : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t vres : 9  /* vertical resolution */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[4], | 
					 | 
				
			||||||
	uint16_t u16[2], | 
					 | 
				
			||||||
	uint32_t u32 | 
					 | 
				
			||||||
} tres_t; | 
					 | 
				
			||||||
typedef union gsst_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) gsst_s = { | 
					 | 
				
			||||||
		uint16_t _na1 : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t hst  : 9, /* first active source */ | 
					 | 
				
			||||||
		uint16_t _na0 : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t vst  : 9  /* first active gate */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[4], | 
					 | 
				
			||||||
	uint16_t u16[2], | 
					 | 
				
			||||||
	uint32_t u32 | 
					 | 
				
			||||||
} gsst_t; | 
					 | 
				
			||||||
typedef uint8_t rev_t; | 
					 | 
				
			||||||
typedef union flg_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) flg_s = { | 
					 | 
				
			||||||
		uint8_t busy_n    : 1, /* driver busy status */ | 
					 | 
				
			||||||
		uint8_t pof       : 1, /* power off status */ | 
					 | 
				
			||||||
		uint8_t pon       : 1, /* power on status */ | 
					 | 
				
			||||||
		uint8_t date_flag : 1, /* driver has received one frame of data */ | 
					 | 
				
			||||||
		uint8_t i2c_busyn : 1, /* I2C master busy */ | 
					 | 
				
			||||||
		uint8_t i2c_err   : 1, /* I2C master error */ | 
					 | 
				
			||||||
		uint8_t ptl_flag  : 1, /* partial display status */ | 
					 | 
				
			||||||
		uint8_t _na0      : 1  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} flg_t; | 
					 | 
				
			||||||
typedef union amv_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) amv_s = { | 
					 | 
				
			||||||
		uint8_t amve : 1, /* auto measure VCOM (AMV) enable */ | 
					 | 
				
			||||||
		uint8_t amv  : 1, /* analog signal */ | 
					 | 
				
			||||||
		uint8_t amvs : 1, /* source output of AMV */ | 
					 | 
				
			||||||
		uint8_t xon  : 1, /* status of gates during AMV */ | 
					 | 
				
			||||||
		uint8_t amvt : 2, /* AMV time */ | 
					 | 
				
			||||||
		uint8_t _na0 : 2  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} amv_t; | 
					 | 
				
			||||||
typedef union vv_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) vv_s = { | 
					 | 
				
			||||||
		uint8_t vv   : 6, /* VCOM value */ | 
					 | 
				
			||||||
		uint8_t _na0 : 2  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} vv_t; | 
					 | 
				
			||||||
typedef union vcds_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) vcds_s = { | 
					 | 
				
			||||||
		uint8_t vcds : 6, /* VCOM_DC value */ | 
					 | 
				
			||||||
		uint8_t _na0 : 2  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} vcds_t; | 
					 | 
				
			||||||
typedef union ptl_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) ptl_s = { | 
					 | 
				
			||||||
		uint8_t  pt_scan : 1, /* limit scan inside partial window */ | 
					 | 
				
			||||||
		uint8_t  _na4    : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t vred    : 9, /* vertical end line */ | 
					 | 
				
			||||||
		uint16_t _na3    : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t vrst    : 9, /* vertical start line */ | 
					 | 
				
			||||||
		uint16_t _na2    : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t hred    : 9, /* horizontal end line */ | 
					 | 
				
			||||||
		uint16_t _na1    : 7, /* don't care */ | 
					 | 
				
			||||||
		uint16_t hrst    : 9, /* horizontal start line */ | 
					 | 
				
			||||||
		uint16_t _na0    : 7  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8[5] | 
					 | 
				
			||||||
} ptl_t; | 
					 | 
				
			||||||
typedef union ccset_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) ccset_s = { | 
					 | 
				
			||||||
		uint8_t ccen  : 1, /* output clock enable */ | 
					 | 
				
			||||||
		uint8_t tsfix : 1, /* set the slave temperature equal to the master */ | 
					 | 
				
			||||||
		uint8_t _na0  : 6  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} ccset_t; | 
					 | 
				
			||||||
typedef union pws_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) pws_s = { | 
					 | 
				
			||||||
		uint8_t sd_w   : 4, /* source power saving width */ | 
					 | 
				
			||||||
		uint8_t vcom_w : 4  /* VCOM power saving width */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} pws_t; | 
					 | 
				
			||||||
typedef union lpsel_u = { | 
					 | 
				
			||||||
	struct __attribute__((packed)) lpsel_s = { | 
					 | 
				
			||||||
		uint8_t lp_sel : 2, /* LPD level setting */ | 
					 | 
				
			||||||
		uint8_t lpmd   : 1, /* low power / panel break detection */ | 
					 | 
				
			||||||
		uint8_t _na0   : 5  /* don't care */ | 
					 | 
				
			||||||
	} field, | 
					 | 
				
			||||||
	uint8_t u8 | 
					 | 
				
			||||||
} lpsel_t; | 
					 | 
				
			||||||
@ -1,19 +0,0 @@ | 
				
			|||||||
/* epd.h - E-Paper Display library API */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef EPD_H_ | 
					 | 
				
			||||||
#define EPD_H_ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Includes */ | 
					 | 
				
			||||||
#include "stdint.h" | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Definitions */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Data Structures */ | 
					 | 
				
			||||||
typedef struct epd_s epd_t; | 
					 | 
				
			||||||
typedef void (*epd_spi_write)(const uint8_t *, size_t, void *); | 
					 | 
				
			||||||
typedef void (*epd_spi_cs)(const uint8_t, void *); | 
					 | 
				
			||||||
typedef void (*epd_dc)(const uint8_t, void *); | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Function Prototypes */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* EPD_H_ */ | 
					 | 
				
			||||||
@ -1,21 +0,0 @@ | 
				
			|||||||
/* priv_epd.h - private definitions for libepd */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifndef PRIV_EPD_H_ | 
					 | 
				
			||||||
#define PRIV_EPD_H_ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Includes */ | 
					 | 
				
			||||||
#include "epd.h" | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Definitions */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Data Structures */ | 
					 | 
				
			||||||
struct epd_s { | 
					 | 
				
			||||||
    epd_spi_write spi_write, | 
					 | 
				
			||||||
    epd_spi_cs spi_cs, | 
					 | 
				
			||||||
    epd_dc dc, | 
					 | 
				
			||||||
    void *udata | 
					 | 
				
			||||||
}; | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* Function Prototypes */ | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#endif /* PRIV_EPD_H_ */ | 
					 | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue