charger26 2.1.0.0
charger26.h
Go to the documentation of this file.
1/****************************************************************************
2** Copyright (C) 2020 MikroElektronika d.o.o.
3** Contact: https://www.mikroe.com/contact
4**
5** Permission is hereby granted, free of charge, to any person obtaining a copy
6** of this software and associated documentation files (the "Software"), to deal
7** in the Software without restriction, including without limitation the rights
8** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9** copies of the Software, and to permit persons to whom the Software is
10** furnished to do so, subject to the following conditions:
11** The above copyright notice and this permission notice shall be
12** included in all copies or substantial portions of the Software.
13**
14** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20** USE OR OTHER DEALINGS IN THE SOFTWARE.
21****************************************************************************/
22
28#ifndef CHARGER26_H
29#define CHARGER26_H
30
31#ifdef __cplusplus
32extern "C"{
33#endif
34
39#ifdef PREINIT_SUPPORTED
40#include "preinit.h"
41#endif
42
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
45 #include "delays.h"
46 #endif
47#endif
48
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
51
67#define CHARGER26_PIN_STATE_HIGH 0x01
68#define CHARGER26_PIN_STATE_LOW 0x00
69
74#define CHARGER26_SELV_4V1_REG_POINT 0x00
75#define CHARGER26_SELV_4V2_REG_POINT 0x01
76
81#define CHARGER26_SELI_100_MA_MAX_REG 0x00
82#define CHARGER26_SELI_500_MA_MAX_REG 0x01
83
88#define CHARGER26_ENABLE_OUTPUT 0x01
89#define CHARGER26_DISABLE_OUTPUT 0x00
90
91
92 // charger26_set
93
108#define CHARGER26_MAP_MIKROBUS( cfg, mikrobus ) \
109 cfg.vsel = MIKROBUS( mikrobus, MIKROBUS_AN ); \
110 cfg.en = MIKROBUS( mikrobus, MIKROBUS_CS ); \
111 cfg.isel = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
112 cfg.chg = MIKROBUS( mikrobus, MIKROBUS_INT )
113
114 // charger26_map
115 // charger26
116
121typedef struct
122{
123 digital_out_t vsel;
124 digital_out_t en;
125 digital_out_t isel;
127 digital_in_t chg;
130
135typedef struct
136{
137 pin_name_t vsel;
138 pin_name_t en;
139 pin_name_t isel;
140 pin_name_t chg;
143
154
171
186
198
209void charger26_set_vsel ( charger26_t *ctx, uint8_t vout_sel );
210
221void charger26_set_isel ( charger26_t *ctx, uint8_t iout_sel );
222
233void charger26_enable_output ( charger26_t *ctx, uint8_t output_state );
234
246
247#ifdef __cplusplus
248}
249#endif
250#endif // CHARGER26_H
251
252 // charger26
253
254// ------------------------------------------------------------------------ END
charger26_return_value_t
Charger 26 Click return value data.
Definition charger26.h:149
@ CHARGER26_ERROR
Definition charger26.h:151
@ CHARGER26_OK
Definition charger26.h:150
void charger26_enable_output(charger26_t *ctx, uint8_t output_state)
Charger 26 enable charger output function.
uint8_t charger26_get_chg_state(charger26_t *ctx)
Charger 26 chg pin reading function.
void charger26_set_vsel(charger26_t *ctx, uint8_t vout_sel)
Charger 26 select charger voltage function.
err_t charger26_init(charger26_t *ctx, charger26_cfg_t *cfg)
Charger 26 initialization function.
void charger26_cfg_setup(charger26_cfg_t *cfg)
Charger 26 configuration object setup function.
void charger26_default_cfg(charger26_t *ctx)
Charger 26 default configuration function.
void charger26_set_isel(charger26_t *ctx, uint8_t iout_sel)
Charger 26 select charger current function.
Charger 26 Click configuration object.
Definition charger26.h:136
pin_name_t vsel
Definition charger26.h:137
pin_name_t en
Definition charger26.h:138
pin_name_t isel
Definition charger26.h:139
pin_name_t chg
Definition charger26.h:140
Charger 26 Click context object.
Definition charger26.h:122
digital_out_t vsel
Definition charger26.h:123
digital_out_t isel
Definition charger26.h:125
digital_in_t chg
Definition charger26.h:127
digital_out_t en
Definition charger26.h:124