42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
54#include "drv_spi_master.h"
68#define CHARGER12_MAP_MIKROBUS( cfg, mikrobus ) \
69 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
70 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
71 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
72 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
73 cfg.che = MIKROBUS( mikrobus, MIKROBUS_RST ); \
74 cfg.mod = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
75 cfg.vok = MIKROBUS( mikrobus, MIKROBUS_INT )
82#define CHARGER12_RETVAL uint8_t
84#define CHARGER12_OK 0x00
85#define CHARGER12_INIT_ERROR 0xFF
92#define CHARGER12_SPI_VOLATILE_WIPER_0 0x00
93#define CHARGER12_SPI_VOLATILE_WIPER_1 0x01
94#define CHARGER12_SPI_NON_VOLATILE_WIPER_0 0x02
95#define CHARGER12_SPI_NON_VOLATILE_WIPER_1 0x03
96#define CHARGER12_SPI_VOLATILE_TCON 0x04
97#define CHARGER12_SPI_STATUS_REGISTER 0x05
98#define CHARGER12_SPI_DATA_EEPROM_0 0x06
99#define CHARGER12_SPI_DATA_EEPROM_1 0x07
100#define CHARGER12_SPI_DATA_EEPROM_2 0x08
101#define CHARGER12_SPI_DATA_EEPROM_3 0x09
102#define CHARGER12_SPI_DATA_EEPROM_4 0x0A
103#define CHARGER12_SPI_DATA_EEPROM_5 0x0B
104#define CHARGER12_SPI_DATA_EEPROM_6 0x0C
105#define CHARGER12_SPI_DATA_EEPROM_7 0x0D
106#define CHARGER12_SPI_DATA_EEPROM_8 0x0E
107#define CHARGER12_SPI_DATA_EEPROM_9 0x0F
114#define CHARGER12_MODE_Li 0
115#define CHARGER12_MODE_NiMh_NiCd 1
116#define CHARGER12_MODE_DISABLE 2
117#define CHARGER12_MODE_NO_BATTERY 3
#define CHARGER12_RETVAL
Definition charger12.h:82
void charger12_generic_transfer(charger12_t *ctx, uint8_t *data_in, uint8_t *data_out, uint8_t tx_len, uint8_t rx_len)
Generic transfer function.
void charger12_rst_set(charger12_t *ctx, uint8_t pin_state)
Setting RST pin state.
void charger12_spi_decrement_wiper(charger12_t *ctx)
Decrementing wiper position.
void charger12_spi_increment_wiper(charger12_t *ctx)
Incrementing wiper position.
void charger12_spi_set_register(charger12_t *ctx, uint8_t register_address, uint16_t register_value)
Setting register.
uint8_t charger12_mode_select(charger12_t *ctx, uint8_t mode_select)
Selecting device operation mode.
void charger12_cs_set(charger12_t *ctx, uint8_t pin_state)
Setting CS pin state.
uint8_t charger12_int_get(charger12_t *ctx)
Getting INT pin state.
void charger12_pwm_set(charger12_t *ctx, uint8_t pin_state)
Setting PWM pin state.
CHARGER12_RETVAL charger12_init(charger12_t *ctx, charger12_cfg_t *cfg)
Initialization function.
void charger12_cfg_setup(charger12_cfg_t *cfg)
Config Object Initialization function.
Click configuration structure definition.
Definition charger12.h:153
spi_master_chip_select_polarity_t cs_polarity
Definition charger12.h:171
pin_name_t vok
Definition charger12.h:165
pin_name_t sck
Definition charger12.h:158
spi_master_mode_t spi_mode
Definition charger12.h:170
pin_name_t mod
Definition charger12.h:164
pin_name_t mosi
Definition charger12.h:157
uint32_t spi_speed
Definition charger12.h:169
pin_name_t che
Definition charger12.h:163
pin_name_t miso
Definition charger12.h:156
pin_name_t cs
Definition charger12.h:159
Click ctx object definition.
Definition charger12.h:131
digital_out_t cs
Definition charger12.h:134
digital_out_t mod
Definition charger12.h:136
spi_master_t spi
Definition charger12.h:144
digital_in_t vok
Definition charger12.h:140
pin_name_t chip_select
Definition charger12.h:145
digital_out_t che
Definition charger12.h:135