Go to the documentation of this file.
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_i2c_master.h"
69 #define C7SEG2_REG_DEVICE_ID 0x00
70 #define C7SEG2_REG_DEVICE_EN 0x01
71 #define C7SEG2_REG_CH_EN_LOW 0x02
72 #define C7SEG2_REG_CH_EN_HIGH 0x03
73 #define C7SEG2_REG_CONFIG 0x04
74 #define C7SEG2_REG_FAULT_MASK 0x05
75 #define C7SEG2_REG_FAULT_INT 0x06
76 #define C7SEG2_REG_OPEN_LED_LOW 0x07
77 #define C7SEG2_REG_OPEN_LED_HIGH 0x08
78 #define C7SEG2_REG_CUR_LED_CS0 0x09
79 #define C7SEG2_REG_CUR_LED_CS1 0x0A
80 #define C7SEG2_REG_CUR_LED_CS2 0x0B
81 #define C7SEG2_REG_CUR_LED_CS3 0x0C
82 #define C7SEG2_REG_CUR_LED_CS4 0x0D
83 #define C7SEG2_REG_CUR_LED_CS5 0x0E
84 #define C7SEG2_REG_CUR_LED_CS6 0x0F
85 #define C7SEG2_REG_CUR_LED_CS7 0x10
86 #define C7SEG2_REG_CUR_LED_CS8 0x11
87 #define C7SEG2_REG_CUR_LED_CS9 0x12
88 #define C7SEG2_REG_CUR_LED_CS10 0x13
89 #define C7SEG2_REG_CUR_LED_CS11 0x14
90 #define C7SEG2_REG_PATTERN_SEQ_REP 0x15
91 #define C7SEG2_REG_PATTERN_0_DUR 0x16
92 #define C7SEG2_REG_PATTERN_1_DUR 0x17
93 #define C7SEG2_REG_PATTERN_2_DUR 0x18
94 #define C7SEG2_REG_PATTERN_3_DUR 0x19
95 #define C7SEG2_REG_PATTERN_4_DUR 0x1A
96 #define C7SEG2_REG_PATTERN_5_DUR 0x1B
97 #define C7SEG2_REG_PATTERN_6_DUR 0x1C
98 #define C7SEG2_REG_PATTERN_7_DUR 0x1D
99 #define C7SEG2_REG_PWMREG_OFFSET 0x1E
100 #define C7SEG2_REG_CLOCK_CONFIG 0xE0
118 #define C7SEG2_SEGMENT_0 0
119 #define C7SEG2_SEGMENT_1 1
120 #define C7SEG2_SEGMENT_2 2
121 #define C7SEG2_SEGMENTS_NUMBER 3
122 #define C7SEG2_SEGMENTS_DISABLED 0x0000u
128 #define C7SEG2_DP_NONE 0
129 #define C7SEG2_DP_AT_SEGMENT_0 1
130 #define C7SEG2_DP_AT_SEGMENT_1 2
131 #define C7SEG2_DP_AT_SEGMENT_2 3
132 #define C7SEG2_DP_MASK 0x03
133 #define C7SEG2_DP_PIN_MASK 0x0010u
139 #define C7SEG2_REFRESH_RATE_US 7500
140 #define C7SEG2_REFRESH_RATE_DELAY ( C7SEG2_REFRESH_RATE_US / 50 )
146 #define C7SEG2_DIGIT_0 0
147 #define C7SEG2_DIGIT_1 1
148 #define C7SEG2_DIGIT_2 2
149 #define C7SEG2_DIGIT_3 3
150 #define C7SEG2_DIGIT_4 4
151 #define C7SEG2_DIGIT_5 5
152 #define C7SEG2_DIGIT_6 6
153 #define C7SEG2_DIGIT_7 7
154 #define C7SEG2_DIGIT_8 8
155 #define C7SEG2_DIGIT_9 9
156 #define C7SEG2_DIGITS_NUMBER 10
157 #define C7SEG2_MAX_NUMBER 999
163 #define C7SEG2_DEVICE_ID 0x12
170 #define C7SEG2_SW_RESET 0x80
171 #define C7SEG2_ENABLE 0x01
178 #define C7SEG2_CURRENT_DEFAULT 15.0f
179 #define C7SEG2_CURRENT_STEP_TO_HEX 12.75f
186 #define C7SEG2_DEVICE_ADDRESS 0x58
204 #define C7SEG2_MAP_MIKROBUS( cfg, mikrobus ) \
205 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
206 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
207 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t c7seg2_write_reg(c7seg2_t *ctx, uint8_t reg, uint8_t data_in)
7-SEG 2 I2C register writing function.
uint8_t slave_address
Definition: c7seg2.h:225
pin_name_t scl
Definition: c7seg2.h:235
err_t c7seg2_default_cfg(c7seg2_t *ctx)
7-SEG 2 default configuration function.
digital_in_t int_pin
Definition: c7seg2.h:219
uint32_t i2c_speed
Definition: c7seg2.h:240
err_t c7seg2_sw_reset(c7seg2_t *ctx)
7-SEG 2 software reset function.
float current
Definition: c7seg2.h:243
err_t c7seg2_generic_read(c7seg2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
7-SEG 2 I2C reading function.
c7seg2_return_value_t
7-SEG 2 Click return value data.
Definition: c7seg2.h:252
err_t c7seg2_generic_write(c7seg2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
7-SEG 2 I2C writing function.
i2c_master_t i2c
Definition: c7seg2.h:222
7-SEG 2 Click context object.
Definition: c7seg2.h:217
err_t c7seg2_disable_segments(c7seg2_t *ctx)
7-SEG 2 disable segments function.
err_t c7seg2_init(c7seg2_t *ctx, c7seg2_cfg_t *cfg)
7-SEG 2 initialization function.
uint8_t i2c_address
Definition: c7seg2.h:241
pin_name_t int_pin
Definition: c7seg2.h:238
err_t c7seg2_write_number(c7seg2_t *ctx, uint16_t number, uint8_t dpt)
7-SEG 2 number writing function.
@ C7SEG2_ERROR
Definition: c7seg2.h:254
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_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.
@ C7SEG2_OK
Definition: c7seg2.h:253
void c7seg2_cfg_setup(c7seg2_cfg_t *cfg)
7-SEG 2 configuration object setup 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.
7-SEG 2 Click configuration object.
Definition: c7seg2.h:234
pin_name_t sda
Definition: c7seg2.h:236