Go to the documentation of this file.
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 LEDDRIVER12_REG_INPUT0 0x00
74 #define LEDDRIVER12_REG_INPUT1 0x01
75 #define LEDDRIVER12_REG_PSC0 0x02
76 #define LEDDRIVER12_REG_PWM0 0x03
77 #define LEDDRIVER12_REG_PSC1 0x04
78 #define LEDDRIVER12_REG_PWM1 0x05
79 #define LEDDRIVER12_REG_LS0 0x06
80 #define LEDDRIVER12_REG_LS1 0x07
81 #define LEDDRIVER12_REG_LS2 0x08
82 #define LEDDRIVER12_REG_LS3 0x09
100 #define LEDDRIVER12_AUTO_INCREMENT_BIT 0x10
106 #define LEDDRIVER12_LED_OFF 0x00
107 #define LEDDRIVER12_LED_ON 0x01
108 #define LEDDRIVER12_LED_PWM0 0x02
109 #define LEDDRIVER12_LED_PWM1 0x03
110 #define LEDDRIVER12_LED0 0x00
111 #define LEDDRIVER12_LED1 0x01
112 #define LEDDRIVER12_LED2 0x02
113 #define LEDDRIVER12_LED3 0x03
114 #define LEDDRIVER12_LED4 0x04
115 #define LEDDRIVER12_LED5 0x05
116 #define LEDDRIVER12_LED6 0x06
117 #define LEDDRIVER12_LED7 0x07
118 #define LEDDRIVER12_LED8 0x08
119 #define LEDDRIVER12_LED9 0x09
120 #define LEDDRIVER12_LED10 0x0A
121 #define LEDDRIVER12_LED11 0x0B
122 #define LEDDRIVER12_LED12 0x0C
123 #define LEDDRIVER12_LED13 0x0D
124 #define LEDDRIVER12_LED14 0x0E
125 #define LEDDRIVER12_LED15 0x0F
126 #define LEDDRIVER12_LED0_TO_3 0x00
127 #define LEDDRIVER12_LED4_TO_7 0x01
128 #define LEDDRIVER12_LED8_TO_11 0x02
129 #define LEDDRIVER12_LED12_TO_15 0x03
130 #define LEDDRIVER12_ALL_LEDS 0xFF
136 #define LEDDRIVER12_BLINK_PERIOD_MAX 1.68421
137 #define LEDDRIVER12_BLINK_PERIOD_MIN 0.00657
138 #define LEDDRIVER12_BLINK_PERIOD_ONE_SECOND 1.0
139 #define LEDDRIVER12_BLINK_PERIOD_HALF_SECOND 0.5
140 #define LEDDRIVER12_DUTY_CYCLE_MAX 0xFF
141 #define LEDDRIVER12_DUTY_CYCLE_HALF 0x80
142 #define LEDDRIVER12_DUTY_CYCLE_QUARTER 0x40
143 #define LEDDRIVER12_DUTY_CYCLE_MIN 0x00
150 #define LEDDRIVER12_DEV_ADDR_A2A1A0_000 0x60
151 #define LEDDRIVER12_DEV_ADDR_A2A1A0_001 0x61
152 #define LEDDRIVER12_DEV_ADDR_A2A1A0_010 0x62
153 #define LEDDRIVER12_DEV_ADDR_A2A1A0_011 0x63
154 #define LEDDRIVER12_DEV_ADDR_A2A1A0_100 0x64
155 #define LEDDRIVER12_DEV_ADDR_A2A1A0_101 0x65
156 #define LEDDRIVER12_DEV_ADDR_A2A1A0_110 0x66
157 #define LEDDRIVER12_DEV_ADDR_A2A1A0_111 0x67
175 #define LEDDRIVER12_MAP_MIKROBUS( cfg, mikrobus ) \
176 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
177 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
178 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST );
476 #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:188
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:196
pin_name_t scl
Definition: leddriver12.h:206
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:193
pin_name_t rst
Definition: leddriver12.h:209
pin_name_t sda
Definition: leddriver12.h:207
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:212
leddriver12_return_value_t
LED Driver 12 Click return value data.
Definition: leddriver12.h:221
err_t leddriver12_default_cfg(leddriver12_t *ctx)
LED Driver 12 default configuration function.
@ LEDDRIVER12_OK
Definition: leddriver12.h:222
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:190
@ LEDDRIVER12_ERROR
Definition: leddriver12.h:223
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:211
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:205
void leddriver12_cfg_setup(leddriver12_cfg_t *cfg)
LED Driver 12 configuration object setup function.