charger27 2.1.0.0
charger27.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 CHARGER27_H
29#define CHARGER27_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 CHARGER27_MODE_CHARGE 0
68#define CHARGER27_MODE_DISCHARGE 1
69
74#define CHARGER27_AOK_ERROR 0
75#define CHARGER27_AOK_GOOD_SOURCE 1
76
81#define CHARGER27_CHG_CHARGE 0
82#define CHARGER27_CHG_COMPL_OR_SUS 1
83
84 // charger27_set
85
100#define CHARGER27_MAP_MIKROBUS( cfg, mikrobus ) \
101 cfg.aok = MIKROBUS( mikrobus, MIKROBUS_AN ); \
102 cfg.md = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
103 cfg.chg = MIKROBUS( mikrobus, MIKROBUS_INT )
104
105 // charger27_map
106 // charger27
107
112typedef struct
113{
114 digital_out_t md;
116 digital_in_t aok;
117 digital_in_t chg;
120
125typedef struct
126{
127 pin_name_t aok;
128 pin_name_t md;
129 pin_name_t chg;
132
143
160
175
190
205err_t charger27_set_mode ( charger27_t *ctx, uint8_t mode );
206
221
222#ifdef __cplusplus
223}
224#endif
225#endif // CHARGER27_H
226
227 // charger27
228
229// ------------------------------------------------------------------------ END
charger27_return_value_t
Charger 27 Click return value data.
Definition charger27.h:138
@ CHARGER27_ERROR
Definition charger27.h:140
@ CHARGER27_OK
Definition charger27.h:139
err_t charger27_set_mode(charger27_t *ctx, uint8_t mode)
Charger 27 sets the operating mode function.
void charger27_cfg_setup(charger27_cfg_t *cfg)
Charger 27 configuration object setup function.
err_t charger27_init(charger27_t *ctx, charger27_cfg_t *cfg)
Charger 27 initialization function.
uint8_t charger27_check_input_supply(charger27_t *ctx)
Charger 27 checks valid input supply indicator function.
uint8_t charger27_check_chg_completion(charger27_t *ctx)
Charger 27 checks charging completion indicator function.
Charger 27 Click configuration object.
Definition charger27.h:126
pin_name_t md
Definition charger27.h:128
pin_name_t aok
Definition charger27.h:127
pin_name_t chg
Definition charger27.h:129
Charger 27 Click context object.
Definition charger27.h:113
digital_in_t chg
Definition charger27.h:117
digital_out_t md
Definition charger27.h:114
digital_in_t aok
Definition charger27.h:116