peltier 2.0.0.0
peltier.h
Go to the documentation of this file.
1/*
2 * MikroSDK - MikroE Software Development Kit
3 * Copyright© 2020 MikroElektronika d.o.o.
4 *
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without restriction,
8 * including without limitation the rights to use, copy, modify, merge,
9 * publish, distribute, sublicense, and/or sell copies of the Software,
10 * and to permit persons to whom the Software is furnished to do so,
11 * subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22 * OR OTHER DEALINGS IN THE SOFTWARE.
23 */
32// ----------------------------------------------------------------------------
33
34#ifndef PELTIER_H
35#define PELTIER_H
36
41#ifdef PREINIT_SUPPORTED
42#include "preinit.h"
43#endif
44
45#ifdef MikroCCoreVersion
46 #if MikroCCoreVersion >= 1
47 #include "delays.h"
48 #endif
49#endif
50
51#include "drv_digital_out.h"
52#include "drv_digital_in.h"
53
54// -------------------------------------------------------------- PUBLIC MACROS
64#define PELTIER_MAP_MIKROBUS( cfg, mikrobus ) \
65 cfg.en2= MIKROBUS( mikrobus, MIKROBUS_RST ); \
66 cfg.en1= MIKROBUS( mikrobus, MIKROBUS_CS ); \
67 cfg.chg= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
68 cfg.con= MIKROBUS( mikrobus, MIKROBUS_INT )
75#define PELTIER_RETVAL uint8_t
76
77#define PELTIER_OK 0x00
78#define PELTIER_INIT_ERROR 0xFF
81 // End group macro
82// --------------------------------------------------------------- PUBLIC TYPES
91typedef struct
92{
93 // Output pins
94
95 digital_out_t en2;
96 digital_out_t en1;
97
98 // Input pins
99
100 digital_in_t chg;
101 digital_in_t con;
102
103} peltier_t;
104
108typedef struct
109{
110 // Additional gpio pins
111
112 pin_name_t en2;
113 pin_name_t en1;
114 pin_name_t chg;
115 pin_name_t con;
116
118
119 // End types group
120
121// ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122
128#ifdef __cplusplus
129extern "C"{
130#endif
131
141
150
159
168
177
186
195
204
205#ifdef __cplusplus
206}
207#endif
208#endif // _PELTIER_H_
209
210 // End public_function group
212
213// ------------------------------------------------------------------------- END
#define PELTIER_RETVAL
Definition peltier.h:75
uint8_t peltier_battery_charge(peltier_t *ctx)
Check ongoing battery charge flag pin function.
PELTIER_RETVAL peltier_init(peltier_t *ctx, peltier_cfg_t *cfg)
Initialization function.
void peltier_disable_ldo1(peltier_t *ctx)
Disables LDO1 function.
void peltier_disable_ldo2(peltier_t *ctx)
Disables LDO2 function.
uint8_t peltier_vin_good_flag(peltier_t *ctx)
Check input voltage good flag pin function.
void peltier_cfg_setup(peltier_cfg_t *cfg)
Config Object Initialization function.
void peltier_enable_ldo2(peltier_t *ctx)
Enables LDO2 function.
void peltier_enable_ldo1(peltier_t *ctx)
Enables LDO1 function.
Click configuration structure definition.
Definition peltier.h:109
pin_name_t en2
Definition peltier.h:112
pin_name_t en1
Definition peltier.h:113
pin_name_t con
Definition peltier.h:115
pin_name_t chg
Definition peltier.h:114
Click ctx object definition.
Definition peltier.h:92
digital_out_t en2
Definition peltier.h:95
digital_out_t en1
Definition peltier.h:96
digital_in_t chg
Definition peltier.h:100
digital_in_t con
Definition peltier.h:101