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 LEDDRIVER18_WRITE_TO_RDAC 0x00
74#define LEDDRIVER18_ONE_TIME_PROG 0x80
92#define LEDDRIVER18_PWM_MAX_VALUE 0x0FFF
93#define LEDDRIVER18_MAX_OUTPUT_NUM 24
94#define LEDDRIVER18_MAX_RES_BITS 12
95#define LEDDRIVER18_CC_MASK 0x3F
96#define LEDDRIVER18_CC_ERROR 0x80
102#define LEDDRIVER18_CURRENT_30_mA 0x00
103#define LEDDRIVER18_CURRENT_20_mA 0x01
104#define LEDDRIVER18_CURRENT_15_mA 0x02
105#define LEDDRIVER18_CURRENT_10_mA 0x04
106#define LEDDRIVER18_CURRENT_5_mA 0x0B
107#define LEDDRIVER18_CURRENT_2_mA 0x1E
114#define LEDDRIVER18_DEVICE_ADDRESS 0x2C
132#define LEDDRIVER18_MAP_MIKROBUS( cfg, mikrobus ) \
133 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
134 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
135 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
136 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
137 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
138 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
139 cfg.en = MIKROBUS( mikrobus, MIKROBUS_PWM )
err_t leddriver18_generic_read(leddriver18_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
LED Driver 18 I2C reading function.
err_t leddriver18_default_cfg(leddriver18_t *ctx)
LED Driver 18 default configuration function.
void leddriver18_disable_output(leddriver18_t *ctx)
LED Driver 18 disable output function.
err_t leddriver18_set_output_pwm(uint8_t out_num, float pwm_val)
LED Driver 18 set output channel PWM value function.
err_t leddriver18_init(leddriver18_t *ctx, leddriver18_cfg_t *cfg)
LED Driver 18 initialization function.
void leddriver18_enable_output(leddriver18_t *ctx)
LED Driver 18 enable output function.
err_t leddriver18_set_cc_output(leddriver18_t *ctx, uint8_t current_limit)
LED Driver 18 set constant current output function.
void leddriver18_cfg_setup(leddriver18_cfg_t *cfg)
LED Driver 18 configuration object setup function.
void leddriver18_write_config(leddriver18_t *ctx)
LED Driver 18 write config function.
err_t leddriver18_get_cc_output(leddriver18_t *ctx, uint8_t *current_limit)
LED Driver 18 get constant current output function.
err_t leddriver18_generic_write(leddriver18_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
LED Driver 18 I2C writing function.
float leddriver18_get_output_pwm(uint8_t out_num)
LED Driver 18 get output channel PWM value function.
leddriver18_return_value_t
LED Driver 18 Click return value data.
Definition leddriver18.h:190
@ LEDDRIVER18_OK
Definition leddriver18.h:191
@ LEDDRIVER18_ERROR
Definition leddriver18.h:192
LED Driver 18 Click configuration object.
Definition leddriver18.h:170
uint32_t i2c_speed
Definition leddriver18.h:180
pin_name_t sck
Definition leddriver18.h:175
pin_name_t mosi
Definition leddriver18.h:176
pin_name_t scl
Definition leddriver18.h:171
pin_name_t en
Definition leddriver18.h:178
pin_name_t sda
Definition leddriver18.h:172
pin_name_t rst
Definition leddriver18.h:177
pin_name_t cs
Definition leddriver18.h:174
uint8_t i2c_address
Definition leddriver18.h:181
LED Driver 18 Click context object.
Definition leddriver18.h:149
digital_out_t cs
Definition leddriver18.h:151
digital_out_t sck
Definition leddriver18.h:152
digital_out_t mosi
Definition leddriver18.h:153
i2c_master_t i2c
Definition leddriver18.h:158
digital_out_t en
Definition leddriver18.h:155
digital_out_t rst
Definition leddriver18.h:154
uint8_t slave_address
Definition leddriver18.h:161