buckboost  2.0.0.0
buckboost.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 BUCKBOOST_H
36 #define BUCKBOOST_H
37 
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 
41 // -------------------------------------------------------------- PUBLIC MACROS
51 #define BUCKBOOST_MAP_MIKROBUS( cfg, mikrobus ) \
52  cfg.vs2= MIKROBUS( mikrobus, MIKROBUS_AN ); \
53  cfg.run= MIKROBUS( mikrobus, MIKROBUS_CS ); \
54  cfg.vs3= MIKROBUS( mikrobus, MIKROBUS_RST ); \
55  cfg.pwm= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
56  cfg.vs1= MIKROBUS( mikrobus, MIKROBUS_INT )
57 
63 #define BUCKBOOST_RETVAL uint8_t
64 
65 #define BUCKBOOST_OK 0x00
66 #define BUCKBOOST_INIT_ERROR 0xFF
67  // End group macro
70 // --------------------------------------------------------------- PUBLIC TYPES
79 typedef struct
80 {
81  // Output pins
82 
83  digital_out_t vs2;
84  digital_out_t run;
85  digital_out_t vs3;
86  digital_out_t pwm;
87  digital_out_t vs1;
88 
89 } buckboost_t;
90 
94 typedef struct
95 {
96  // Additional gpio pins
97 
98  pin_name_t vs2;
99  pin_name_t run;
100  pin_name_t vs3;
101  pin_name_t pwm;
102  pin_name_t vs1;
103 
105  // End types group
107 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
108 
114 #ifdef __cplusplus
115 extern "C"{
116 #endif
117 
127 
136 
144 void buckboost_default_cfg ( buckboost_t *ctx );
145 
154 void buckboost_enable ( buckboost_t *ctx );
155 
164 void buckboost_disable ( buckboost_t *ctx );
165 
176 
187 
200 void buckboost_set_2500mv ( buckboost_t *ctx );
201 
214 void buckboost_set_3300mv ( buckboost_t *ctx );
215 
228 void buckboost_set_4100mv ( buckboost_t *ctx );
229 
242 void buckboost_set_5000mv ( buckboost_t *ctx );
243 
256 void buckboost_set_6900mv ( buckboost_t *ctx );
257 
270 void buckboost_set_8200mv ( buckboost_t *ctx );
271 
284 void buckboost_set_12000mv ( buckboost_t *ctx );
285 
298 void buckboost_set_15000mv ( buckboost_t *ctx );
299 
300 #ifdef __cplusplus
301 }
302 #endif
303 #endif // _BUCKBOOST_H_
304  // End public_function group
307 
308 // ------------------------------------------------------------------------- END
buckboost_set_12000mv
void buckboost_set_12000mv(buckboost_t *ctx)
Set the output voltage of 12000 mV function.
buckboost_cfg_t::pwm
pin_name_t pwm
Definition: buckboost.h:101
buckboost_set_6900mv
void buckboost_set_6900mv(buckboost_t *ctx)
Set the output voltage of 6900 mV function.
buckboost_cfg_t::vs3
pin_name_t vs3
Definition: buckboost.h:100
buckboost_t::vs2
digital_out_t vs2
Definition: buckboost.h:83
buckboost_cfg_t::vs2
pin_name_t vs2
Definition: buckboost.h:98
buckboost_init
BUCKBOOST_RETVAL buckboost_init(buckboost_t *ctx, buckboost_cfg_t *cfg)
Initialization function.
buckboost_set_2500mv
void buckboost_set_2500mv(buckboost_t *ctx)
Set the output voltage of 2500 mV function.
buckboost_t
Click ctx object definition.
Definition: buckboost.h:79
buckboost_cfg_t::run
pin_name_t run
Definition: buckboost.h:99
BUCKBOOST_RETVAL
#define BUCKBOOST_RETVAL
Definition: buckboost.h:63
buckboost_set_4100mv
void buckboost_set_4100mv(buckboost_t *ctx)
Set the output voltage of 4100 mV function.
buckboost_enable
void buckboost_enable(buckboost_t *ctx)
Enable the converter function.
buckboost_t::vs1
digital_out_t vs1
Definition: buckboost.h:87
buckboost_t::vs3
digital_out_t vs3
Definition: buckboost.h:85
buckboost_set_15000mv
void buckboost_set_15000mv(buckboost_t *ctx)
Set the output voltage of 15000 mV function.
buckboost_set_3300mv
void buckboost_set_3300mv(buckboost_t *ctx)
Set the output voltage of 3000 mV function.
buckboost_set_5000mv
void buckboost_set_5000mv(buckboost_t *ctx)
Set the output voltage of 5000 mV function.
buckboost_disable
void buckboost_disable(buckboost_t *ctx)
Disable the converter function.
buckboost_set_mode_fixed_freq
void buckboost_set_mode_fixed_freq(buckboost_t *ctx)
Set fixed frequency PWM operation function.
buckboost_t::run
digital_out_t run
Definition: buckboost.h:84
buckboost_default_cfg
void buckboost_default_cfg(buckboost_t *ctx)
Click Default Configuration function.
buckboost_cfg_t::vs1
pin_name_t vs1
Definition: buckboost.h:102
buckboost_enables_auto_burst_mode
void buckboost_enables_auto_burst_mode(buckboost_t *ctx)
Enables automatic burst mode operation.
buckboost_cfg_t
Click configuration structure definition.
Definition: buckboost.h:94
buckboost_cfg_setup
void buckboost_cfg_setup(buckboost_cfg_t *cfg)
Config Object Initialization function.
buckboost_set_8200mv
void buckboost_set_8200mv(buckboost_t *ctx)
Set the output voltage of 8200 mV function.
buckboost_t::pwm
digital_out_t pwm
Definition: buckboost.h:86