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"
74#define LEDDRIVER14_RSET_1 0
75#define LEDDRIVER14_RSET_2 1
76#define LEDDRIVER14_RSET_3 2
77#define LEDDRIVER14_RSET_4 3
83#define LEDDRIVER14_DIGIPOT_MAX_VALUE 50000
84#define LEDDRIVER14_DIGIPOT_RESOLUTION 257
85#define LEDDRIVER14_ROUND_TO_NEAREST_INT 0.5
86#define LEDDRIVER14_RSET_RES_MAX 24000
87#define LEDDRIVER14_RSET_RES_DEFAULT 12000
88#define LEDDRIVER14_RSET1_AND_RSET3_ADDRESS 0x10
94#define LEDDRIVER14_WRITE_PROTECT_ENABLE 0
95#define LEDDRIVER14_WRITE_PROTECT_DISABLE 1
102#define LEDDRIVER14_U2_ADDR_A2_GND 0x28
103#define LEDDRIVER14_U2_ADDR_A2_VCC 0x2C
104#define LEDDRIVER14_U3_ADDR_A2_GND 0x29
105#define LEDDRIVER14_U3_ADDR_A2_VCC 0x2D
111#define LEDDRIVER14_DEF_FREQ 500
129#define LEDDRIVER14_MAP_MIKROBUS( cfg, mikrobus ) \
130 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
131 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
132 cfg.wp = MIKROBUS( mikrobus, MIKROBUS_RST ); \
133 cfg.pwm = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
134 cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
err_t leddriver14_init(leddriver14_t *ctx, leddriver14_cfg_t *cfg)
LED Driver 14 initialization function.
void leddriver14_rset_write_protect(leddriver14_t *ctx, uint8_t state)
LED Driver 14 rset write protect function.
err_t leddriver14_pwm_start(leddriver14_t *ctx)
LED Driver 14 start PWM module.
err_t leddriver14_default_cfg(leddriver14_t *ctx)
LED Driver 14 default configuration function.
uint8_t leddriver14_get_int_pin(leddriver14_t *ctx)
LED Driver 14 get int pin function.
err_t leddriver14_set_duty_cycle(leddriver14_t *ctx, float duty_cycle)
LED Driver 14 sets PWM duty cycle.
err_t leddriver14_pwm_stop(leddriver14_t *ctx)
LED Driver 14 stop PWM module.
err_t leddriver14_set_rset(leddriver14_t *ctx, uint8_t rset, uint16_t res_ohm)
LED Driver 14 set rset function.
void leddriver14_cfg_setup(leddriver14_cfg_t *cfg)
LED Driver 14 configuration object setup function.
leddriver14_return_value_t
LED Driver 14 Click return value data.
Definition leddriver14.h:187
@ LEDDRIVER14_OK
Definition leddriver14.h:188
@ LEDDRIVER14_ERROR
Definition leddriver14.h:189
LED Driver 14 Click configuration object.
Definition leddriver14.h:167
uint8_t i2c_address_u3
Definition leddriver14.h:177
uint32_t i2c_speed
Definition leddriver14.h:175
uint8_t i2c_address_u2
Definition leddriver14.h:176
pin_name_t wp
Definition leddriver14.h:171
uint32_t dev_pwm_freq
Definition leddriver14.h:178
pin_name_t scl
Definition leddriver14.h:168
pin_name_t int_pin
Definition leddriver14.h:173
pin_name_t pwm
Definition leddriver14.h:172
pin_name_t sda
Definition leddriver14.h:169
LED Driver 14 Click context object.
Definition leddriver14.h:144
uint8_t slave_address_u2
Definition leddriver14.h:156
uint32_t pwm_freq
Definition leddriver14.h:158
digital_in_t int_pin
Definition leddriver14.h:149
i2c_master_t i2c
Definition leddriver14.h:152
uint8_t slave_address_u3
Definition leddriver14.h:157
pwm_t pwm
Definition leddriver14.h:153
digital_out_t wp
Definition leddriver14.h:146