39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51#include "drv_i2c_master.h"
73#define C7SEG2_REG_DEVICE_ID 0x00
74#define C7SEG2_REG_DEVICE_EN 0x01
75#define C7SEG2_REG_CH_EN_LOW 0x02
76#define C7SEG2_REG_CH_EN_HIGH 0x03
77#define C7SEG2_REG_CONFIG 0x04
78#define C7SEG2_REG_FAULT_MASK 0x05
79#define C7SEG2_REG_FAULT_INT 0x06
80#define C7SEG2_REG_OPEN_LED_LOW 0x07
81#define C7SEG2_REG_OPEN_LED_HIGH 0x08
82#define C7SEG2_REG_CUR_LED_CS0 0x09
83#define C7SEG2_REG_CUR_LED_CS1 0x0A
84#define C7SEG2_REG_CUR_LED_CS2 0x0B
85#define C7SEG2_REG_CUR_LED_CS3 0x0C
86#define C7SEG2_REG_CUR_LED_CS4 0x0D
87#define C7SEG2_REG_CUR_LED_CS5 0x0E
88#define C7SEG2_REG_CUR_LED_CS6 0x0F
89#define C7SEG2_REG_CUR_LED_CS7 0x10
90#define C7SEG2_REG_CUR_LED_CS8 0x11
91#define C7SEG2_REG_CUR_LED_CS9 0x12
92#define C7SEG2_REG_CUR_LED_CS10 0x13
93#define C7SEG2_REG_CUR_LED_CS11 0x14
94#define C7SEG2_REG_PATTERN_SEQ_REP 0x15
95#define C7SEG2_REG_PATTERN_0_DUR 0x16
96#define C7SEG2_REG_PATTERN_1_DUR 0x17
97#define C7SEG2_REG_PATTERN_2_DUR 0x18
98#define C7SEG2_REG_PATTERN_3_DUR 0x19
99#define C7SEG2_REG_PATTERN_4_DUR 0x1A
100#define C7SEG2_REG_PATTERN_5_DUR 0x1B
101#define C7SEG2_REG_PATTERN_6_DUR 0x1C
102#define C7SEG2_REG_PATTERN_7_DUR 0x1D
103#define C7SEG2_REG_PWMREG_OFFSET 0x1E
104#define C7SEG2_REG_CLOCK_CONFIG 0xE0
122#define C7SEG2_SEGMENT_0 0
123#define C7SEG2_SEGMENT_1 1
124#define C7SEG2_SEGMENT_2 2
125#define C7SEG2_SEGMENTS_NUMBER 3
126#define C7SEG2_SEGMENTS_DISABLED 0x0000u
132#define C7SEG2_DP_NONE 0
133#define C7SEG2_DP_AT_SEGMENT_0 1
134#define C7SEG2_DP_AT_SEGMENT_1 2
135#define C7SEG2_DP_AT_SEGMENT_2 3
136#define C7SEG2_DP_MASK 0x03
137#define C7SEG2_DP_PIN_MASK 0x0010u
143#define C7SEG2_REFRESH_RATE_US 7500
144#define C7SEG2_REFRESH_RATE_DELAY ( C7SEG2_REFRESH_RATE_US / 50 )
150#define C7SEG2_DIGIT_0 0
151#define C7SEG2_DIGIT_1 1
152#define C7SEG2_DIGIT_2 2
153#define C7SEG2_DIGIT_3 3
154#define C7SEG2_DIGIT_4 4
155#define C7SEG2_DIGIT_5 5
156#define C7SEG2_DIGIT_6 6
157#define C7SEG2_DIGIT_7 7
158#define C7SEG2_DIGIT_8 8
159#define C7SEG2_DIGIT_9 9
160#define C7SEG2_DIGITS_NUMBER 10
161#define C7SEG2_MAX_NUMBER 999
167#define C7SEG2_DEVICE_ID 0x12
174#define C7SEG2_SW_RESET 0x80
175#define C7SEG2_ENABLE 0x01
182#define C7SEG2_CURRENT_DEFAULT 15.0f
183#define C7SEG2_CURRENT_STEP_TO_HEX 12.75f
190#define C7SEG2_DEVICE_ADDRESS 0x58
208#define C7SEG2_MAP_MIKROBUS( cfg, mikrobus ) \
209 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
210 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
211 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
c7seg2_return_value_t
7-SEG 2 Click return value data.
Definition c7seg2.h:256
@ C7SEG2_ERROR
Definition c7seg2.h:258
@ C7SEG2_OK
Definition c7seg2.h:257
err_t c7seg2_sw_reset(c7seg2_t *ctx)
7-SEG 2 software reset function.
err_t c7seg2_generic_write(c7seg2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
7-SEG 2 I2C writing function.
err_t c7seg2_write_segment(c7seg2_t *ctx, uint8_t segment, uint8_t number, uint8_t dpt)
7-SEG 2 single segment writing function.
err_t c7seg2_write_reg(c7seg2_t *ctx, uint8_t reg, uint8_t data_in)
7-SEG 2 I2C register writing function.
err_t c7seg2_read_reg(c7seg2_t *ctx, uint8_t reg, uint8_t *data_out)
7-SEG 2 I2C register reading function.
err_t c7seg2_init(c7seg2_t *ctx, c7seg2_cfg_t *cfg)
7-SEG 2 initialization function.
err_t c7seg2_write_number(c7seg2_t *ctx, uint16_t number, uint8_t dpt)
7-SEG 2 number writing function.
err_t c7seg2_generic_read(c7seg2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
7-SEG 2 I2C reading function.
void c7seg2_cfg_setup(c7seg2_cfg_t *cfg)
7-SEG 2 configuration object setup function.
err_t c7seg2_default_cfg(c7seg2_t *ctx)
7-SEG 2 default configuration function.
err_t c7seg2_set_segments_current(c7seg2_t *ctx, float current_val)
7-SEG 2 set segments current value function.
uint8_t c7seg2_get_int_pin(c7seg2_t *ctx)
7-SEG 2 get interrupt pin state function.
err_t c7seg2_disable_segments(c7seg2_t *ctx)
7-SEG 2 disable segments function.
7-SEG 2 Click configuration object.
Definition c7seg2.h:238
uint32_t i2c_speed
Definition c7seg2.h:244
pin_name_t scl
Definition c7seg2.h:239
pin_name_t int_pin
Definition c7seg2.h:242
pin_name_t sda
Definition c7seg2.h:240
float current
Definition c7seg2.h:247
uint8_t i2c_address
Definition c7seg2.h:245
7-SEG 2 Click context object.
Definition c7seg2.h:221
digital_in_t int_pin
Definition c7seg2.h:223
i2c_master_t i2c
Definition c7seg2.h:226
uint8_t slave_address
Definition c7seg2.h:229