Go to the documentation of this file.
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 #include "drv_i2c_master.h"
59 #define LEDDRIVER12_REG_INPUT0 0x00
60 #define LEDDRIVER12_REG_INPUT1 0x01
61 #define LEDDRIVER12_REG_PSC0 0x02
62 #define LEDDRIVER12_REG_PWM0 0x03
63 #define LEDDRIVER12_REG_PSC1 0x04
64 #define LEDDRIVER12_REG_PWM1 0x05
65 #define LEDDRIVER12_REG_LS0 0x06
66 #define LEDDRIVER12_REG_LS1 0x07
67 #define LEDDRIVER12_REG_LS2 0x08
68 #define LEDDRIVER12_REG_LS3 0x09
86 #define LEDDRIVER12_AUTO_INCREMENT_BIT 0x10
92 #define LEDDRIVER12_LED_OFF 0x00
93 #define LEDDRIVER12_LED_ON 0x01
94 #define LEDDRIVER12_LED_PWM0 0x02
95 #define LEDDRIVER12_LED_PWM1 0x03
96 #define LEDDRIVER12_LED0 0x00
97 #define LEDDRIVER12_LED1 0x01
98 #define LEDDRIVER12_LED2 0x02
99 #define LEDDRIVER12_LED3 0x03
100 #define LEDDRIVER12_LED4 0x04
101 #define LEDDRIVER12_LED5 0x05
102 #define LEDDRIVER12_LED6 0x06
103 #define LEDDRIVER12_LED7 0x07
104 #define LEDDRIVER12_LED8 0x08
105 #define LEDDRIVER12_LED9 0x09
106 #define LEDDRIVER12_LED10 0x0A
107 #define LEDDRIVER12_LED11 0x0B
108 #define LEDDRIVER12_LED12 0x0C
109 #define LEDDRIVER12_LED13 0x0D
110 #define LEDDRIVER12_LED14 0x0E
111 #define LEDDRIVER12_LED15 0x0F
112 #define LEDDRIVER12_LED0_TO_3 0x00
113 #define LEDDRIVER12_LED4_TO_7 0x01
114 #define LEDDRIVER12_LED8_TO_11 0x02
115 #define LEDDRIVER12_LED12_TO_15 0x03
116 #define LEDDRIVER12_ALL_LEDS 0xFF
122 #define LEDDRIVER12_BLINK_PERIOD_MAX 1.68421
123 #define LEDDRIVER12_BLINK_PERIOD_MIN 0.00657
124 #define LEDDRIVER12_BLINK_PERIOD_ONE_SECOND 1.0
125 #define LEDDRIVER12_BLINK_PERIOD_HALF_SECOND 0.5
126 #define LEDDRIVER12_DUTY_CYCLE_MAX 0xFF
127 #define LEDDRIVER12_DUTY_CYCLE_HALF 0x80
128 #define LEDDRIVER12_DUTY_CYCLE_QUARTER 0x40
129 #define LEDDRIVER12_DUTY_CYCLE_MIN 0x00
136 #define LEDDRIVER12_DEV_ADDR_A2A1A0_000 0x60
137 #define LEDDRIVER12_DEV_ADDR_A2A1A0_001 0x61
138 #define LEDDRIVER12_DEV_ADDR_A2A1A0_010 0x62
139 #define LEDDRIVER12_DEV_ADDR_A2A1A0_011 0x63
140 #define LEDDRIVER12_DEV_ADDR_A2A1A0_100 0x64
141 #define LEDDRIVER12_DEV_ADDR_A2A1A0_101 0x65
142 #define LEDDRIVER12_DEV_ADDR_A2A1A0_110 0x66
143 #define LEDDRIVER12_DEV_ADDR_A2A1A0_111 0x67
161 #define LEDDRIVER12_MAP_MIKROBUS( cfg, mikrobus ) \
162 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
163 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
164 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
462 #endif // LEDDRIVER12_H
err_t leddriver12_set_blink_period_pwm_1(leddriver12_t *ctx, float blink_period)
LED Driver 12 set blink period pwm 1 function.
err_t leddriver12_init(leddriver12_t *ctx, leddriver12_cfg_t *cfg)
LED Driver 12 initialization function.
LED Driver 12 Click context object.
Definition: leddriver12.h:174
err_t leddriver12_read_register(leddriver12_t *ctx, uint8_t reg, uint8_t *data_out)
LED Driver 12 read register function.
err_t leddriver12_set_led_port_config(leddriver12_t *ctx, uint8_t led_port_number, uint8_t led_cfg)
LED Driver 12 set led port config function.
err_t leddriver12_write_register(leddriver12_t *ctx, uint8_t reg, uint8_t data_in)
LED Driver 12 write register function.
err_t leddriver12_generic_write(leddriver12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
LED Driver 12 I2C writing function.
err_t leddriver12_read_input_0(leddriver12_t *ctx, uint8_t *data_out)
LED Driver 12 read input 0 function.
err_t leddriver12_set_duty_cycle_pwm_1(leddriver12_t *ctx, uint8_t duty_cycle)
LED Driver 12 set duty cycle pwm 1 function.
uint8_t slave_address
Definition: leddriver12.h:182
pin_name_t scl
Definition: leddriver12.h:192
err_t leddriver12_set_led_config(leddriver12_t *ctx, uint8_t led_number, uint8_t led_cfg)
LED Driver 12 set led config function.
i2c_master_t i2c
Definition: leddriver12.h:179
pin_name_t rst
Definition: leddriver12.h:195
pin_name_t sda
Definition: leddriver12.h:193
err_t leddriver12_read_input_1(leddriver12_t *ctx, uint8_t *data_out)
LED Driver 12 read input 1 function.
uint8_t i2c_address
Definition: leddriver12.h:198
leddriver12_return_value_t
LED Driver 12 Click return value data.
Definition: leddriver12.h:207
err_t leddriver12_default_cfg(leddriver12_t *ctx)
LED Driver 12 default configuration function.
@ LEDDRIVER12_OK
Definition: leddriver12.h:208
err_t leddriver12_generic_read(leddriver12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
LED Driver 12 I2C reading function.
digital_out_t rst
Definition: leddriver12.h:176
@ LEDDRIVER12_ERROR
Definition: leddriver12.h:209
err_t leddriver12_set_blink_period_pwm_0(leddriver12_t *ctx, float blink_period)
LED Driver 12 set blink period pwm 0 function.
uint32_t i2c_speed
Definition: leddriver12.h:197
err_t leddriver12_set_duty_cycle_pwm_0(leddriver12_t *ctx, uint8_t duty_cycle)
LED Driver 12 set duty cycle pwm 0 function.
void leddriver12_set_rst_pin(leddriver12_t *ctx, uint8_t state)
LED Driver 12 set rst pin function.
LED Driver 12 Click configuration object.
Definition: leddriver12.h:191
void leddriver12_cfg_setup(leddriver12_cfg_t *cfg)
LED Driver 12 configuration object setup function.