charger18 2.0.0.0
charger18.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 CHARGER18_H
29#define CHARGER18_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
72#define CHARGER18_CONTROL_DISABLE 0
73#define CHARGER18_CONTROL_ENABLE 1
74
75 // charger18_set
76
91#define CHARGER18_MAP_MIKROBUS( cfg, mikrobus ) \
92 cfg.bon = MIKROBUS( mikrobus, MIKROBUS_AN ); \
93 cfg.on = MIKROBUS( mikrobus, MIKROBUS_RST ); \
94 cfg.ien = MIKROBUS( mikrobus, MIKROBUS_CS ); \
95 cfg.ldo = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
96 cfg.sta = MIKROBUS( mikrobus, MIKROBUS_INT )
97
98 // charger18_map
99 // charger18
100
105typedef struct
106{
107 digital_out_t bon;
108 digital_out_t on;
109 digital_out_t ien;
110 digital_out_t ldo;
112 digital_in_t sta;
115
120typedef struct
121{
122 pin_name_t bon;
123 pin_name_t on;
124 pin_name_t ien;
125 pin_name_t ldo;
126 pin_name_t sta;
129
140
157
173
185void charger18_buck_control ( charger18_t *ctx, uint8_t state );
186
198void charger18_ldo_control ( charger18_t *ctx, uint8_t state );
199
211void charger18_suspend_control ( charger18_t *ctx, uint8_t state );
212
224void charger18_power_control ( charger18_t *ctx, uint8_t state );
225
235
236#ifdef __cplusplus
237}
238#endif
239#endif // CHARGER18_H
240
241 // charger18
242
243// ------------------------------------------------------------------------ END
charger18_return_value_t
Charger 18 Click return value data.
Definition charger18.h:135
@ CHARGER18_OK
Definition charger18.h:136
@ CHARGER18_ERROR
Definition charger18.h:137
void charger18_cfg_setup(charger18_cfg_t *cfg)
Charger 18 configuration object setup function.
void charger18_suspend_control(charger18_t *ctx, uint8_t state)
Charger 18 suspend control function.
uint8_t charger18_get_sta_pin(charger18_t *ctx)
Charger 18 get STA pin function.
err_t charger18_init(charger18_t *ctx, charger18_cfg_t *cfg)
Charger 18 initialization function.
void charger18_power_control(charger18_t *ctx, uint8_t state)
Charger 18 power control function.
void charger18_ldo_control(charger18_t *ctx, uint8_t state)
Charger 18 ldo control function.
void charger18_buck_control(charger18_t *ctx, uint8_t state)
Charger 18 buck control function.
Charger 18 Click configuration object.
Definition charger18.h:121
pin_name_t sta
Definition charger18.h:126
pin_name_t ldo
Definition charger18.h:125
pin_name_t on
Definition charger18.h:123
pin_name_t bon
Definition charger18.h:122
pin_name_t ien
Definition charger18.h:124
Charger 18 Click context object.
Definition charger18.h:106
digital_in_t sta
Definition charger18.h:112
digital_out_t ldo
Definition charger18.h:110
digital_out_t ien
Definition charger18.h:109
digital_out_t on
Definition charger18.h:108
digital_out_t bon
Definition charger18.h:107