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 "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 
51 // -------------------------------------------------------------- PUBLIC MACROS
61 #define BUCKBOOST2_MAP_MIKROBUS( cfg, mikrobus ) \
62  cfg.an= MIKROBUS( mikrobus, MIKROBUS_AN ); \
63  cfg.en= MIKROBUS( mikrobus, MIKROBUS_RST ); \
64  cfg.mod= MIKROBUS( mikrobus, MIKROBUS_PWM )
65 
71 #define BUCKBOOST2_RETVAL uint8_t
72 
73 #define BUCKBOOST2_OK 0x00
74 #define BUCKBOOST2_INIT_ERROR 0xFF
75 
81 #define BUCKBOOST2_WITH_IMPROVEMENT 0x01
82 #define BUCKBOOST2_WITHOUT_IMPROVEMENT 0x00
83  // End group macro
86 // --------------------------------------------------------------- PUBLIC TYPES
95 typedef struct
96 {
97  // Output pins
98 
99  digital_out_t en;
100  digital_out_t mod;
101 
102  // Input pins
103 
104  digital_in_t an;
105 
106 } buckboost2_t;
107 
111 typedef struct
112 {
113  // Additional gpio pins
114 
115  pin_name_t an;
116  pin_name_t en;
117  pin_name_t mod;
118 
120  // End types group
122 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
123 
129 #ifdef __cplusplus
130 extern "C"{
131 #endif
132 
142 
152 
161 
170 
184 void buckboost2_set_mode ( buckboost2_t *ctx , uint8_t mode );
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 #endif // _BUCKBOOST2_H_
190  // End public_function group
193 
194 // ------------------------------------------------------------------------- END
buckboost2_cfg_t::mod
pin_name_t mod
Definition: buckboost2.h:117
buckboost2_cfg_t::an
pin_name_t an
Definition: buckboost2.h:115
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:100
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:104
buckboost2_cfg_t::en
pin_name_t en
Definition: buckboost2.h:116
BUCKBOOST2_RETVAL
#define BUCKBOOST2_RETVAL
Definition: buckboost2.h:71
buckboost2_cfg_t
Click configuration structure definition.
Definition: buckboost2.h:112
buckboost2_t
Click ctx object definition.
Definition: buckboost2.h:96
buckboost2_power_off
void buckboost2_power_off(buckboost2_t *ctx)
Power off function.
buckboost2_t::en
digital_out_t en
Definition: buckboost2.h:99