VSF Documented
vsf_disp_ch1115.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 ****************************************************************************/
16#ifndef __VSF_DISP_CH1115_H__
17#define __VSF_DISP_CH1115_H__
18
19/*============================ INCLUDES ======================================*/
20
22
23#if VSF_USE_UI == ENABLED && VSF_DISP_USE_CH1115 == ENABLED
24
25#include "hal/vsf_hal.h"
26
27#if defined(__VSF_DISP_CH1115_CLASS_IMPLEMENT)
28# undef __VSF_DISP_CH1115_CLASS_IMPLEMENT
29# define __VSF_CLASS_IMPLEMENT__
30#endif
31
32#include "utilities/ooc_class.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38/*============================ MACROS ========================================*/
39
40// CH1115 (Chip Wealth) supports PAGE addressing ONLY — there is no 0x20/0x21/
41// 0x22 memory-addressing-mode/window command set (CH1115 datasheet V0.3,
42// command table). The refresh path below therefore walks the area page by
43// page: [B0|page][column low][column high] then a 0x40 data block, relying on
44// the column address auto-increment within a page.
45#define CH1115_I2C_ADDR 0x3C
46
47#define CH1115_SET_COLUMN_LOW(__COL) (0x00 | ((__COL) & 0x0F))
48#define CH1115_SET_COLUMN_HIGH(__COL) (0x10 | (((__COL) >> 4) & 0x0F))
49#define CH1115_SET_PAGE_ADDRESS(__PAGE) (0xB0 | ((__PAGE) & 0x07))
50
51// init_seq byte-stream control bytes (Co/D#C), same protocol as SSD1306:
52// 0x80 = command, more control bytes follow; 0x40 = data bytes follow.
53#define VSF_DISP_CH1115_IIC_WRITE_I(__INSTR) \
54 0x80, (__INSTR)
55#define VSF_DISP_CH1115_IIC_WRITE_D(__DATA) \
56 0x40, (__DATA)
57
58/*============================ MACROFIED FUNCTIONS ===========================*/
59/*============================ TYPES =========================================*/
60
64
66 public_member(
67 implement(vk_disp_t)
68
70 const uint8_t *init_seq;
71 const uint16_t init_seq_len;
72 uint32_t clock_hz;
73 )
74
75 private_member(
76 struct {
77 struct {
78 // pos.y / size.y are in PAGES (refresh() shifts them down)
79 vk_disp_area_t area;
80 uint8_t *buffer;
81 uint8_t cur_page;
82 uint8_t end_page;
83 } refresh;
84 } ctx;
85
86 bool is_inited;
87 bool is_refreshing;
88 bool is_header_sent;
89 // [0x80, B0|page, 0x80, col low, 0x80, col high, 0x40]
90 uint8_t page_cmd_buffer[7];
91 )
92};
93
94/*============================ GLOBAL VARIABLES ==============================*/
95
97
98/*============================ PROTOTYPES ====================================*/
99
100#ifdef __cplusplus
101}
102#endif
103
104#endif // VSF_USE_UI == ENABLED && VSF_DISP_USE_CH1115 == ENABLED
105#endif // __VSF_DISP_CH1115_H__
Definition vsf_disp_ch1115.h:65
Definition vsf_disp.h:154
Definition vsf_disp.h:184
bool is_inited
Definition driver_gptimer_port.c:88
#define vsf_class(__name)
Definition ooc_class.h:52
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_disp.h:149
Definition vsf_disp_ch1115.h:61
vsf_i2c_t * port
Definition vsf_disp_ch1115.h:62
I2C instance structure for multi-class support.
Definition vsf_template_i2c.h:1056
struct vsf_disp_ch1115_hw_iic_t vsf_disp_ch1115_hw_iic_t
const vk_disp_drv_t vk_disp_drv_ch1115
Definition vsf_disp_ch1115.c:51
vsf_tgui_label_t vsf_tgui_v_button_t implement_ex(struct { uint8_t bIsCheckButton :1;uint8_t bIsChecked :1;uint8_t bIsAllowEmphasize :1;uint8_t bIsEmphasized :1;}, _)) end_def_class(vsf_tgui_button_t) extern fsm_rt_t vk_tgui_button_init(vsf_tgui_button_t *ptButton)
Generated from commit: vsfteam/vsf@a5104db