42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_i2c_master.h"
66#define C16X9_MAP_MIKROBUS( cfg, mikrobus ) \
67 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
68 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
69 cfg.sdb = MIKROBUS( mikrobus, MIKROBUS_CS ); \
70 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT );
77#define C16X9_RETVAL uint8_t
80#define C16X9_INIT_ERROR 0xFF
87#define C16X9_SLAVE_ADDRESS 0x74
94#define C16X9_POINT_TO_PAGE_ONE 0x00
95#define C16X9_POINT_TO_PAGE_TWO 0x01
96#define C16X9_POINT_TO_PAGE_THREE 0x02
97#define C16X9_POINT_TO_PAGE_FOUR 0x03
98#define C16X9_POINT_TO_PAGE_FIVE 0x04
99#define C16X9_POINT_TO_PAGE_SIX 0x05
100#define C16X9_POINT_TO_PAGE_SEVEN 0x06
101#define C16X9_POINT_TO_PAGE_EIGHT 0x07
102#define C16X9_POINT_TO_PAGE_NINE 0x0B
109#define C16X9_REG_CONFIG 0x00
110#define C16X9_REG_PICTURE_DISPLAY 0x01
111#define C16X9_REG_AUTO_PLAY_CTRL1 0x02
112#define C16X9_REG_AUTO_PLAY_CTRL2 0x03
113#define C16X9_REG_DISPLAY_OPTION 0x05
114#define C16X9_REG_AUDIO_SYNC 0x06
115#define C16X9_REG_FRAME_STATE 0x07
116#define C16X9_REG_BREATH_CTRL1 0x08
117#define C16X9_REG_BREATH_CTRL2 0x09
118#define C16X9_REG_SHUTDOWN 0x0A
119#define C16X9_REG_AGC_CTRL 0x0B
120#define C16X9_REG_AUDIO_ADC_RATE 0x0C
121#define C16X9_REG_COMMAND 0xFD
128#define C16X9_CFG_PICTURE_MODE 0x00
129#define C16X9_CFG_AUTO_FRAME_PLAY_MODE 0x08
136#define C16X9_AP_CTRL1_PLAY_ENDLESS 0x00
137#define C16X9_AP_CTRL1_LOOP_1 0x10
138#define C16X9_AP_CTRL1_LOOP_2 0x20
139#define C16X9_AP_CTRL1_LOOP_3 0x30
140#define C16X9_AP_CTRL1_LOOP_4 0x40
141#define C16X9_AP_CTRL1_LOOP_5 0x50
142#define C16X9_AP_CTRL1_LOOP_6 0x60
143#define C16X9_AP_CTRL1_LOOP_7 0x70
144#define C16X9_AP_CTRL1_ALL_FRAME 0x00
145#define C16X9_AP_CTRL1_FRAME_1 0x01
146#define C16X9_AP_CTRL1_FRAME_2 0x02
147#define C16X9_AP_CTRL1_FRAME_3 0x03
148#define C16X9_AP_CTRL1_FRAME_4 0x04
149#define C16X9_AP_CTRL1_FRAME_5 0x05
150#define C16X9_AP_CTRL1_FRAME_6 0x06
151#define C16X9_AP_CTRL1_FRAME_7 0x07
158#define C16X9_SET_ONE_FRAME_INTENSITY 0x00
159#define C16X9_SET_ALL_FRAME_INTENSITY 0x20
160#define C16X9_BLINK_DISABLE 0x00
161#define C16X9_BLINK_ENABLE 0x08
168#define C16X9_AUDIO_SYNCHRONIZATION_DISABLE 0x00
169#define C16X9_AUDIO_SYNCHRONIZATION_ENABLE 0x01
176#define C16X9_SHUTDOWN_MODE 0x00
177#define C16X9_NORMAL_OPERATION 0x01
184#define C16X9_AGC_SLOW_MODE 0x00
185#define C16X9_AGC_FAST_MODE 0x10
186#define C16X9_AGC_DISABLE 0x00
187#define C16X9_AGC_ENABLE 0x08
188#define C16X9_AGC_GAIN_0dB 0x00
189#define C16X9_AGC_GAIN_3dB 0x01
190#define C16X9_AGC_GAIN_6dB 0x02
191#define C16X9_AGC_GAIN_9dB 0x03
192#define C16X9_AGC_GAIN_12dB 0x04
193#define C16X9_AGC_GAIN_15dB 0x05
194#define C16X9_AGC_GAIN_18dB 0x06
195#define C16X9_AGC_GAIN_21dB 0x07
202#define C16X9_FRAME_1 0x00
203#define C16X9_FRAME_2 0x01
204#define C16X9_FRAME_3 0x02
205#define C16X9_FRAME_4 0x03
206#define C16X9_FRAME_5 0x04
207#define C16X9_FRAME_6 0x05
208#define C16X9_FRAME_7 0x06
209#define C16X9_FRAME_8 0x07
216#define C16X9_CTRL_LED 0x01
217#define C16X9_CTRL_LED_BLINK 0x02
#define C16X9_RETVAL
Definition c16x9.h:77
void c16x9_cfg_setup(c16x9_cfg_t *cfg)
Config Object Initialization function.
void c16x9_generic_write(c16x9_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
void c16x9_control_all(c16x9_t *ctx, uint8_t ctrl, uint8_t state)
Functions for control all leds.
uint8_t c16x9_get_interrupt_state(c16x9_t *ctx)
Interrupt pin state.
void c16x9_display_refresh(c16x9_t *ctx)
Function for refresh display.
void c16x9_fill_screen(c16x9_t *ctx, uint8_t pwm)
Functions for fill screen.
void c16x9_draw_point(c16x9_t *ctx, c16x9_point_t *point)
Functions for draw point .
void c16x9_draw_rectangle(c16x9_t *ctx, c16x9_rectangle_t *rectangle)
Draw rectangle.
C16X9_RETVAL c16x9_init(c16x9_t *ctx, c16x9_cfg_t *cfg)
Initialization function.
void c16x9_display_byte(c16x9_t *ctx, c16x9_char_t *data_char)
Function for displaying one character.
void c16x9_display_image(c16x9_t *ctx, c16x9_image_t *image)
Image display function.
c16x9_rectangle_t rectangle
Definition main.c:34
c16x9_char_t data_char
Definition main.c:33
Click configuration structure definition.
Definition c16x9.h:254
pin_name_t sdb
Definition c16x9.h:262
uint32_t i2c_speed
Definition c16x9.h:267
pin_name_t scl
Definition c16x9.h:257
pin_name_t int_pin
Definition c16x9.h:263
pin_name_t sda
Definition c16x9.h:258
uint8_t i2c_address
Definition c16x9.h:268
Character structure definition.
Definition c16x9.h:298
uint8_t frame
Definition c16x9.h:300
uint8_t pwm
Definition c16x9.h:301
char character
Definition c16x9.h:299
Image structure definition.
Definition c16x9.h:287
uint8_t frame
Definition c16x9.h:289
uint8_t pwm
Definition c16x9.h:290
Point structure definition.
Definition c16x9.h:276
uint8_t x
Definition c16x9.h:277
uint8_t y
Definition c16x9.h:278
uint8_t pwm
Definition c16x9.h:279
Rectangle structure definition.
Definition c16x9.h:309
uint8_t width
Definition c16x9.h:312
uint8_t x
Definition c16x9.h:310
uint8_t y
Definition c16x9.h:311
uint8_t frame
Definition c16x9.h:314
uint8_t pwm
Definition c16x9.h:315
uint8_t height
Definition c16x9.h:313
Click ctx object definition.
Definition c16x9.h:231
digital_in_t int_pin
Definition c16x9.h:238
i2c_master_t i2c
Definition c16x9.h:242
digital_out_t sdb
Definition c16x9.h:234
uint8_t slave_address
Definition c16x9.h:246