42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_spi_master.h"
64#define CHARGER5_RETVAL uint8_t
66#define CHARGER5_OK 0x00
67#define CHARGER5_INIT_ERROR 0xFF
74#define CHARGER5_REG_WIPER0_VOL 0x00
75#define CHARGER5_REG_WIPER1_VOL 0x01
76#define CHARGER5_REG_WIPER0_NONVOL 0x02
77#define CHARGER5_REG_WIPER1_NONVOL 0x03
78#define CHARGER5_REG_TCONTROL_VOL 0x04
79#define CHARGER5_REG_STATUS_VOL 0x05
80#define CHARGER5_REG_DATA_EEPROM0 0x06
81#define CHARGER5_REG_DATA_EEPROM1 0x07
82#define CHARGER5_REG_DATA_EEPROM2 0x08
83#define CHARGER5_REG_DATA_EEPROM3 0x09
84#define CHARGER5_REG_DATA_EEPROM4 0x0A
85#define CHARGER5_REG_DATA_EEPROM5 0x0B
86#define CHARGER5_REG_DATA_EEPROM6 0x0C
87#define CHARGER5_REG_DATA_EEPROM7 0x0D
88#define CHARGER5_REG_DATA_EEPROM8 0x0E
89#define CHARGER5_REG_DATA_EEPROM9 0x0F
96#define CHARGER5_CURRENT_100MA_MIN 0x00
97#define CHARGER5_CURRENT_200MA 0x88
98#define CHARGER5_CURRENT_300MA 0xBD
99#define CHARGER5_CURRENT_400MA 0xD6
100#define CHARGER5_CURRENT_500MA 0xE4
101#define CHARGER5_CURRENT_600MA 0xEE
102#define CHARGER5_CURRENT_700MA 0xF5
103#define CHARGER5_CURRENT_800MA 0xFB
104#define CHARGER5_CURRENT_900MA 0xFE
105#define CHARGER5_CURRENT_950MA_MAX 0x0100
112#define CHARGER5_STEPS_1_MIN 0x01
113#define CHARGER5_STEPS_2 0x02
114#define CHARGER5_STEPS_5 0x05
115#define CHARGER5_STEPS_10 0x0A
116#define CHARGER5_STEPS_50 0x32
117#define CHARGER5_STEPS_100 0x64
118#define CHARGER5_STEPS_150 0x96
119#define CHARGER5_STEPS_200 0xC8
120#define CHARGER5_STEPS_255_MAX 0xFF
127#define CHARGER5_MAP_MIKROBUS( cfg, mikrobus ) \
128 cfg.sdo = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
129 cfg.sdi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
130 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
131 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS )
249 uint16_t transfer_data );
void charger5_cfg_setup(charger5_cfg_t *cfg)
Configuration Object Setup function.
charger5_err_t charger5_init(charger5_t *ctx, charger5_cfg_t *cfg)
Click Initialization function.
void charger5_default_cfg(charger5_t *ctx)
Click Default Configuration function.
charger5_err_t charger5_decrement_wiper(charger5_t *ctx, uint8_t reg_addr, uint8_t n_steps)
Decrement Wiper function.
charger5_err_t charger5_increment_wiper(charger5_t *ctx, uint8_t reg_addr, uint8_t n_steps)
Increment Wiper function.
charger5_err_t charger5_generic_write(charger5_t *ctx, uint8_t reg_addr, uint16_t transfer_data)
Generic Write function.
uint16_t charger5_generic_read(charger5_t *ctx, uint8_t reg_addr)
Generic Read function.
charger5_err_t
Click error code definition.
Definition charger5.h:145
@ CHARGER5_MODULE_INIT_ERROR
Definition charger5.h:148
@ CHARGER5_STATUS_ERROR
Definition charger5.h:147
@ CHARGER5_STATUS_OK
Definition charger5.h:146
@ CHARGER5_NSTEPS_RANGE_ERROR
Definition charger5.h:149
Click configuration structure definition.
Definition charger5.h:170
pin_name_t sdi
Definition charger5.h:173
spi_master_chip_select_polarity_t cs_polarity
Definition charger5.h:180
pin_name_t sck
Definition charger5.h:174
spi_master_mode_t spi_mode
Definition charger5.h:179
uint32_t spi_speed
Definition charger5.h:178
pin_name_t sdo
Definition charger5.h:172
pin_name_t cs
Definition charger5.h:175
Click context object definition.
Definition charger5.h:157
digital_out_t cs
Definition charger5.h:158
spi_master_t spi
Definition charger5.h:161
pin_name_t chip_select
Definition charger5.h:162