17#ifndef __VSF_DISP_SSD1306_H__
18#define __VSF_DISP_SSD1306_H__
24#if VSF_USE_UI == ENABLED && VSF_DISP_USE_SSD1306 == ENABLED
26#include "../common/vsf_disp_solomon_systech_common.h"
28#if defined(__VSF_DISP_SSD1306_CLASS_IMPLEMENT)
29# undef __VSF_DISP_SSD1306_CLASS_IMPLEMENT
30# define __VSF_CLASS_IMPLEMENT__
41#define VSF_SSD1306_PORT_IIC 0
42#define VSF_SSD1306_PORT_SPI 1
43#define VSF_SSD1306_PORT_EBI 2
45#ifndef VSF_SSD1306_CFG_PORT
46# define VSF_SSD1306_CFG_PORT VSF_SSD1306_PORT_IIC
49#define SSD1306_SET_DISPLAY_ON(__ON) (0xAE | ((__ON) ? 1 : 0))
50#define SSD1306_SET_DISPLAY_START_LINE(__LINE) (0x40 | ((__LINE) & 0x3F))
51#define SSD1306_SET_POAGE_START_ADDRESS(__PAGE) (0xB0 | ((__PAGE) & 0x07))
52#define SSD1306_SET_COM_OUTPUT_SCAN_DIRECTION(__DIR) (0xC0 | ((__DIR) ? 0x08 : 0x00))
53#define SSD1306_SET_CONTRAST_CONTROL (0x81)
54#define SSD1306_SET_SEGMENT_REMAP(__REMAP) (0xA0 | ((__REMAP) ? 1 : 0))
55#define SSD1306_SET_INVERSE_DISPLAY(__INVERSE) (0xA6 | ((__INVERSE) ? 1 : 0))
56#define SSD1306_SET_MULTIPLEX_RATIO (0xA8)
57#define SSD1306_SET_DISPLAY_OFFSET (0xD3)
58#define SSD1306_SET_OSC_DIV (0xD5)
59#define SSD1306_SET_PRECHARGE_PERIOD (0xD9)
60#define SSD1306_SET_COM_PIN (0xDA)
61#define SSD1306_SET_VCOMH (0xDB)
62#define SSD1306_CHARGE_PUMP (0x8D)
64#define SSD1306_SET_ADDRESS_MODE (0x20)
65# define SSD1306_ADDRESS_MODE_HORIZONTAL (0x00)
66# define SSD1306_ADDRESS_MODE_VERTICAL (0x01)
67# define SSD1306_ADDRESS_MODE_PAGE (0x02)
68#define SSD1306_SET_COLUMN_ADDRESS (0x21)
69#define SSD1306_SET_PAGE_ADDRESS (0x22)
74#if VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_IIC
75# define VSF_DISP_SSD1306_IIC_INIT_SEQ(__LINE, __CONTRAST, __INVERSE, __DIRECTION)\
76 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_DISPLAY_ON(0)), \
77 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_DISPLAY_START_LINE(0)),\
78 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_COM_OUTPUT_SCAN_DIRECTION(__DIRECTION)),\
80 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_CONTRAST_CONTROL), \
81 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(__CONTRAST), \
83 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_SEGMENT_REMAP(1)), \
84 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_INVERSE_DISPLAY(__INVERSE)),\
86 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_MULTIPLEX_RATIO), \
87 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I((__LINE) - 1), \
89 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_DISPLAY_OFFSET), \
90 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0), \
92 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_OSC_DIV), \
93 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0xF0), \
95 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_PRECHARGE_PERIOD), \
96 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0x22), \
98 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_COM_PIN), \
99 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0x02), \
101 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_VCOMH), \
102 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0x20), \
104 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_CHARGE_PUMP), \
105 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(0x15), \
107 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_DISPLAY_ON(1)), \
109 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_SET_ADDRESS_MODE), \
110 VSF_DISP_SOLOMON_SYSTECH_IIC_WRITE_I(SSD1306_ADDRESS_MODE_HORIZONTAL)
111#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_SPI
112#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_EBI
125#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_SPI
127#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_EBI
143#if VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_IIC
144 uint8_t set_area_cmd_buffer[6 * 2];
145#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_SPI
146#elif VSF_SSD1306_CFG_PORT == VSF_SSD1306_PORT_EBI
Definition vsf_disp.h:149
Definition vsf_disp_ssd1306.h:117
Definition vsf_disp.h:173
unsigned short uint16_t
Definition lvgl.h:41
unsigned char uint8_t
Definition lvgl.h:40
#define vsf_class(__name)
Definition ooc_class.h:48
Definition vsf_disp.h:144
Definition vsf_disp_solomon_systech_common.h:61
Definition vsf_disp_solomon_systech_common.h:45
Definition vsf_disp_solomon_systech_common.h:49
#define VSF_SSD1306_CFG_PORT
Definition vsf_disp_ssd1306.h:46
const vk_disp_drv_t vk_disp_drv_ssd1306
Definition vsf_disp_ssd1306.c:48
#define VSF_SSD1306_PORT_IIC
Definition vsf_disp_ssd1306.h:41