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"
52#include "drv_spi_master.h"
75#define CHARGER11_SPI_VOLATILE_WIPER_0 0x00
76#define CHARGER11_SPI_VOLATILE_WIPER_1 0x01
77#define CHARGER11_SPI_NON_VOLATILE_WIPER_0 0x02
78#define CHARGER11_SPI_NON_VOLATILE_WIPER_1 0x03
79#define CHARGER11_SPI_VOLATILE_TCON 0x04
80#define CHARGER11_SPI_STATUS_REGISTER 0x05
81#define CHARGER11_SPI_DATA_EEPROM_0 0x06
82#define CHARGER11_SPI_DATA_EEPROM_1 0x07
83#define CHARGER11_SPI_DATA_EEPROM_2 0x08
84#define CHARGER11_SPI_DATA_EEPROM_3 0x09
85#define CHARGER11_SPI_DATA_EEPROM_4 0x0A
86#define CHARGER11_SPI_DATA_EEPROM_5 0x0B
87#define CHARGER11_SPI_DATA_EEPROM_6 0x0C
88#define CHARGER11_SPI_DATA_EEPROM_7 0x0D
89#define CHARGER11_SPI_DATA_EEPROM_8 0x0E
90#define CHARGER11_SPI_DATA_EEPROM_9 0x0F
108#define CHARGER11_PIN_ENABE 0x01
109#define CHARGER11_PIN_DISABLE 0x00
116#define CHARGER11_SET_DEV_ADDR 0x4D
126#define CHARGER11_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
127#define CHARGER11_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
145#define CHARGER11_MAP_MIKROBUS( cfg, mikrobus ) \
146 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
147 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
148 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
149 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
150 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
151 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
152 cfg.lr = MIKROBUS( mikrobus, MIKROBUS_AN ); \
153 cfg.lg = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
154 cfg.st = MIKROBUS( mikrobus, MIKROBUS_INT )
362 uint16_t register_value );
374 uint16_t * register_value );
struct charger11_s charger11_t
Charger 11 Click context object.
charger11_return_value_t
Charger 11 Click return value data.
Definition charger11.h:208
@ CHARGER11_ERROR
Definition charger11.h:210
@ CHARGER11_OK
Definition charger11.h:209
uint8_t charger11_spi_get_wiper_position(charger11_t *ctx)
Charger 11 getting wiper position.
void charger11_lr_set(charger11_t *ctx, uint8_t pin_state)
Charger 11 setting AN pin state.
err_t charger11_i2c_read(charger11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Charger 11 I2C reading function.
void charger11_cfg_setup(charger11_cfg_t *cfg)
Charger 11 configuration object setup function.
void charger11_lg_set(charger11_t *ctx, uint8_t pin_state)
Charger 11 Setting PWM pin state.
void charger11_spi_decrement_wiper(charger11_t *ctx)
Charger 11 decrementing wiper position.
uint16_t charger11_i2c_get_raw_data(charger11_t *ctx)
Charger 11 getting raw ADC data.
void charger11_spi_increment_wiper(charger11_t *ctx)
Charger 11 incrementing wiper position.
err_t charger11_spi_write(charger11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Charger 11 SPI writing function.
float charger11_i2c_get_volt(charger11_t *ctx, float reference_voltage)
Charger 11 getting output voltage.
err_t charger11_init(charger11_t *ctx, charger11_cfg_t *cfg)
Charger 11 initialization function.
uint8_t charger11_get_int(charger11_t *ctx)
Charger 11 getting INT pin state.
void charger11_spi_set_register(charger11_t *ctx, uint8_t register_address, uint16_t register_value)
Charger 11 setting register.
err_t charger11_spi_read(charger11_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
Charger 11 SPI reading function.
void charger11_spi_transfer(charger11_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t len)
Charger 11 transfering bytes via SPI.
err_t charger11_i2c_write(charger11_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
Charger 11 I2C writing function.
void charger11_spi_get_register(charger11_t *ctx, uint8_t register_address, uint16_t *register_value)
Charger 11 getting register value.
This file contains SPI specific macros, functions, etc.
Charger 11 Click configuration object.
Definition charger11.h:183
pin_name_t st
Definition charger11.h:192
uint32_t i2c_speed
Definition charger11.h:194
pin_name_t lg
Definition charger11.h:191
spi_master_chip_select_polarity_t cs_polarity
Definition charger11.h:199
pin_name_t sck
Definition charger11.h:188
spi_master_mode_t spi_mode
Definition charger11.h:198
pin_name_t lr
Definition charger11.h:190
pin_name_t mosi
Definition charger11.h:187
uint32_t spi_speed
Definition charger11.h:197
pin_name_t scl
Definition charger11.h:184
pin_name_t miso
Definition charger11.h:186
pin_name_t sda
Definition charger11.h:185
pin_name_t cs
Definition charger11.h:189
uint8_t i2c_address
Definition charger11.h:195
Charger 11 Click context object.
Definition charger11.h:164
spi_master_t spi
Definition charger11.h:171
digital_in_t st
Definition charger11.h:168
digital_out_t lg
Definition charger11.h:166
i2c_master_t i2c
Definition charger11.h:170
digital_out_t lr
Definition charger11.h:165
uint8_t slave_address
Definition charger11.h:173
pin_name_t chip_select
Definition charger11.h:174