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_spi_master.h"
67#define DOTMATRIXR_MAP_MIKROBUS( cfg, mikrobus ) \
68 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
69 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
70 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
71 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
72 cfg.rs = MIKROBUS( mikrobus, MIKROBUS_AN ); \
73 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
74 cfg.bl = MIKROBUS( mikrobus, MIKROBUS_PWM )
81#define DOTMATRIXR_RETVAL uint8_t
83#define DOTMATRIXR_OK 0x00
84#define DOTMATRIXR_INIT_ERROR 0xFF
91#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_0 0x00
92#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_1p7 0x01
93#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_3p3 0x02
94#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_5 0x03
95#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_6p7 0x04
96#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_8p3 0x05
97#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_11p7 0x06
98#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_15 0x07
99#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_18 0x08
100#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_23 0x09
101#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_30 0x0A
102#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_37 0x0B
103#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_47 0x0C
104#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_60 0x0D
105#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_80 0x0E
106#define DOTMATRIXR_CTRL_BYTE_0_BRIGHTNESS_100 0x0F
107#define DOTMATRIXR_CTRL_BYTE_0_PIXEL_PEAK_CURRENT_4mA 0x20
108#define DOTMATRIXR_CTRL_BYTE_0_PIXEL_PEAK_CURRENT_6p4mA 0x10
109#define DOTMATRIXR_CTRL_BYTE_0_PIXEL_PEAK_CURRENT_9p3mA 0x00
110#define DOTMATRIXR_CTRL_BYTE_0_PIXEL_PEAK_CURRENT_12p8mA 0x30
111#define DOTMATRIXR_CTRL_BYTE_0_MODE_SLEEP 0x00
112#define DOTMATRIXR_CTRL_BYTE_0_MODE_NORMAL 0x40
119#define DOTMATRIXR_CTRL_BYTE_1_OSC_PRESCALER_1 0x80
120#define DOTMATRIXR_CTRL_BYTE_1_OSC_PRESCALER_8 0x82
121#define DOTMATRIXR_CTRL_BYTE_1_DOUT_D7 0x80
122#define DOTMATRIXR_CTRL_BYTE_1_DOUT_DIN 0x81
#define DOTMATRIXR_RETVAL
Definition dotmatrixr.h:81
void dotmatrixr_generic_transfer(dotmatrixr_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
Generic transfer function.
DOTMATRIXR_RETVAL dotmatrixr_init(dotmatrixr_t *ctx, dotmatrixr_cfg_t *cfg)
Initialization function.
void dotmatrixr_ctrl_1(dotmatrixr_t *ctx, uint8_t ctrl_byte)
Function for writing control word 1.
void dotmatrixr_ctrl_0(dotmatrixr_t *ctx, uint8_t ctrl_byte)
Function for writing control word 0.
void dotmatrixr_set_rs_pin_state(dotmatrixr_t *ctx, uint8_t state)
Sets RS pin to high or low state.
void dotmatrixr_write_ascii(dotmatrixr_t *ctx, char *ascii_data)
Sets display to written value.
void dotmatrixr_cfg_setup(dotmatrixr_cfg_t *cfg)
Config Object Initialization function.
void dotmatrixr_set_rst_pin_state(dotmatrixr_t *ctx, uint8_t state)
Sets RST pin to high or low state.
void dotmatrixr_restart(dotmatrixr_t *ctx)
Restart device.
void dotmatrixr_set_bl_pin_state(dotmatrixr_t *ctx, uint8_t state)
Sets BL pin to high or low state.
Click configuration structure definition.
Definition dotmatrixr.h:155
pin_name_t rs
Definition dotmatrixr.h:165
spi_master_chip_select_polarity_t cs_polarity
Definition dotmatrixr.h:173
pin_name_t sck
Definition dotmatrixr.h:160
pin_name_t bl
Definition dotmatrixr.h:167
spi_master_mode_t spi_mode
Definition dotmatrixr.h:172
pin_name_t mosi
Definition dotmatrixr.h:159
uint32_t spi_speed
Definition dotmatrixr.h:171
pin_name_t miso
Definition dotmatrixr.h:158
pin_name_t rst
Definition dotmatrixr.h:166
pin_name_t cs
Definition dotmatrixr.h:161
Click ctx object definition.
Definition dotmatrixr.h:136
digital_out_t cs
Definition dotmatrixr.h:139
spi_master_t spi
Definition dotmatrixr.h:146
digital_out_t bl
Definition dotmatrixr.h:142
digital_out_t rst
Definition dotmatrixr.h:141
pin_name_t chip_select
Definition dotmatrixr.h:147
digital_out_t rs
Definition dotmatrixr.h:140