buckboost2  2.0.0.0
buckboost2.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  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef BUCKBOOST2_H
36 #define BUCKBOOST2_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define BUCKBOOST2_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.an= MIKROBUS( mikrobus, MIKROBUS_AN ); \
53  cfg.en= MIKROBUS( mikrobus, MIKROBUS_RST ); \
54  cfg.mod= MIKROBUS( mikrobus, MIKROBUS_PWM )
55 
61 #define BUCKBOOST2_RETVAL uint8_t
62 
63 #define BUCKBOOST2_OK 0x00
64 #define BUCKBOOST2_INIT_ERROR 0xFF
65 
71 #define BUCKBOOST2_WITH_IMPROVEMENT 0x01
72 #define BUCKBOOST2_WITHOUT_IMPROVEMENT 0x00
73  // End group macro
76 // --------------------------------------------------------------- PUBLIC TYPES
85 typedef struct
86 {
87  // Output pins
88 
89  digital_out_t en;
90  digital_out_t mod;
91 
92  // Input pins
93 
94  digital_in_t an;
95 
96 } buckboost2_t;
97 
101 typedef struct
102 {
103  // Additional gpio pins
104 
105  pin_name_t an;
106  pin_name_t en;
107  pin_name_t mod;
108 
110  // End types group
112 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
113 
119 #ifdef __cplusplus
120 extern "C"{
121 #endif
122 
132 
142 
151 
160 
174 void buckboost2_set_mode ( buckboost2_t *ctx , uint8_t mode );
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 #endif // _BUCKBOOST2_H_
180  // End public_function group
183 
184 // ------------------------------------------------------------------------- END
buckboost2_cfg_t::mod
pin_name_t mod
Definition: buckboost2.h:107
buckboost2_cfg_t::an
pin_name_t an
Definition: buckboost2.h:105
buckboost2_cfg_setup
void buckboost2_cfg_setup(buckboost2_cfg_t *cfg)
Config Object Initialization function.
buckboost2_t::mod
digital_out_t mod
Definition: buckboost2.h:90
buckboost2_power_on
void buckboost2_power_on(buckboost2_t *ctx)
Power on function.
buckboost2_init
BUCKBOOST2_RETVAL buckboost2_init(buckboost2_t *ctx, buckboost2_cfg_t *cfg)
Initialization function.
buckboost2_set_mode
void buckboost2_set_mode(buckboost2_t *ctx, uint8_t mode)
Mode setting functon.
buckboost2_t::an
digital_in_t an
Definition: buckboost2.h:94
buckboost2_cfg_t::en
pin_name_t en
Definition: buckboost2.h:106
BUCKBOOST2_RETVAL
#define BUCKBOOST2_RETVAL
Definition: buckboost2.h:61
buckboost2_cfg_t
Click configuration structure definition.
Definition: buckboost2.h:102
buckboost2_t
Click ctx object definition.
Definition: buckboost2.h:86
buckboost2_power_off
void buckboost2_power_off(buckboost2_t *ctx)
Power off function.
buckboost2_t::en
digital_out_t en
Definition: buckboost2.h:89