c7x10b 2.0.0.0
c7x10b.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
23#ifndef C7X10B_H
24#define C7X10B_H
25
26#include "drv_digital_out.h"
27#include "drv_digital_in.h"
28#include "drv_spi_master.h"
29
30// -------------------------------------------------------------- PUBLIC MACROS
31
42#define C7X10B_MAP_MIKROBUS( cfg, mikrobus ) \
43 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
44 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
45 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
46 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
47 cfg.rc = MIKROBUS( mikrobus, MIKROBUS_AN ); \
48 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
49 cfg.rr = MIKROBUS( mikrobus, MIKROBUS_PWM )
56#define C7X10B_DISPLAY_DELAY_5MS 5
57#define C7X10B_DISPLAY_DELAY_10MS 10
58#define C7X10B_DISPLAY_DELAY_20MS 20
59#define C7X10B_DISPLAY_DELAY_35MS 35
60#define C7X10B_DISPLAY_DELAY_50MS 50
61#define C7X10B_DISPLAY_DELAY_100MS 100
62#define C7X10B_DISPLAY_DELAY_150MS 150
69#define C7X10B_DISPLAY_LEFT 0x00
70#define C7X10B_DISPLAY_RIGHT 0x01
71#define C7X10B_DISPLAY_REFRESH 0x10
78#define C7X10B_DISPLAY_PIXEL_REFRESH 0x01
79#define C7X10B_DISPLAY_PIXEL_STORAGE 0x00 // End group macro
83
84// --------------------------------------------------------------- PUBLIC TYPES
85
94typedef struct
95{
96 digital_out_t cs;
97
98 // Output pins
99
100 digital_out_t rc;
101 digital_out_t rst;
102 digital_out_t rr;
103
104 // Modules
105
106 spi_master_t spi;
107 pin_name_t chip_select;
108
109} c7x10b_t;
110
114typedef struct
115{
116 // Communication gpio pins
117
118 pin_name_t miso;
119 pin_name_t mosi;
120 pin_name_t sck;
121 pin_name_t cs;
122
123 // Additional gpio pins
124
125 pin_name_t rc;
126 pin_name_t rst;
127 pin_name_t rr;
128
129 // static variable
130
131 uint32_t spi_speed;
132 spi_master_mode_t spi_mode;
133 spi_master_chip_select_polarity_t cs_polarity;
134
136
140typedef struct
141{
142 uint8_t cord_x;
143 uint8_t cord_y;
144
146
147typedef enum
148{
150 C7X10B_ERROR = -1
152 // End types group
154
155// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
156
161#ifdef __cplusplus
162extern "C"{
163#endif
164
174
184
194void c7x10b_display_process ( c7x10b_t *ctx, uint8_t *frame, uint16_t disp_delay );
195
205void c7x10b_draw_pixel ( c7x10b_t *ctx, c7x10b_pixel_t *pixel, uint8_t mode, uint8_t px_delay );
206
217void c7x10b_draw_char ( c7x10b_t *ctx, char ch, uint8_t pos, uint8_t ch_delay );
218
228void c7x10b_draw_number ( c7x10b_t *ctx, uint8_t num, uint16_t num_delay );
229
230#ifdef __cplusplus
231}
232#endif
233#endif // _C7X10B_H_
234 // End public_function group
237
238// ------------------------------------------------------------------------- END
c7x10b_return_value_t c7x10b_init(c7x10b_t *ctx, c7x10b_cfg_t *cfg)
Initialization function.
void c7x10b_draw_char(c7x10b_t *ctx, char ch, uint8_t pos, uint8_t ch_delay)
Draw char (function).
void c7x10b_cfg_setup(c7x10b_cfg_t *cfg)
Config Object Initialization function.
void c7x10b_display_process(c7x10b_t *ctx, uint8_t *frame, uint16_t disp_delay)
Display process (function).
void c7x10b_draw_number(c7x10b_t *ctx, uint8_t num, uint16_t num_delay)
Draw number (function).
void c7x10b_draw_pixel(c7x10b_t *ctx, c7x10b_pixel_t *pixel, uint8_t mode, uint8_t px_delay)
Draw pixel (function).
c7x10b_return_value_t
Definition: c7x10b.h:148
@ C7X10B_OK
Definition: c7x10b.h:149
@ C7X10B_ERROR
Definition: c7x10b.h:150
Click configuration structure definition.
Definition: c7x10b.h:115
pin_name_t rr
Definition: c7x10b.h:127
spi_master_chip_select_polarity_t cs_polarity
Definition: c7x10b.h:133
pin_name_t sck
Definition: c7x10b.h:120
spi_master_mode_t spi_mode
Definition: c7x10b.h:132
pin_name_t mosi
Definition: c7x10b.h:119
uint32_t spi_speed
Definition: c7x10b.h:131
pin_name_t rc
Definition: c7x10b.h:125
pin_name_t miso
Definition: c7x10b.h:118
pin_name_t rst
Definition: c7x10b.h:126
pin_name_t cs
Definition: c7x10b.h:121
pixel structure definition.
Definition: c7x10b.h:141
uint8_t cord_x
Definition: c7x10b.h:142
uint8_t cord_y
Definition: c7x10b.h:143
Click ctx object definition.
Definition: c7x10b.h:95
digital_out_t cs
Definition: c7x10b.h:96
spi_master_t spi
Definition: c7x10b.h:106
digital_out_t rc
Definition: c7x10b.h:100
digital_out_t rst
Definition: c7x10b.h:101
pin_name_t chip_select
Definition: c7x10b.h:107
digital_out_t rr
Definition: c7x10b.h:102