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 "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 BUCKBOOST_MAP_MIKROBUS( cfg, mikrobus ) \
62  cfg.vs2= MIKROBUS( mikrobus, MIKROBUS_AN ); \
63  cfg.run= MIKROBUS( mikrobus, MIKROBUS_CS ); \
64  cfg.vs3= MIKROBUS( mikrobus, MIKROBUS_RST ); \
65  cfg.pwm= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
66  cfg.vs1= MIKROBUS( mikrobus, MIKROBUS_INT )
67 
73 #define BUCKBOOST_RETVAL uint8_t
74 
75 #define BUCKBOOST_OK 0x00
76 #define BUCKBOOST_INIT_ERROR 0xFF
77  // End group macro
80 // --------------------------------------------------------------- PUBLIC TYPES
89 typedef struct
90 {
91  // Output pins
92 
93  digital_out_t vs2;
94  digital_out_t run;
95  digital_out_t vs3;
96  digital_out_t pwm;
97  digital_out_t vs1;
98 
99 } buckboost_t;
100 
104 typedef struct
105 {
106  // Additional gpio pins
107 
108  pin_name_t vs2;
109  pin_name_t run;
110  pin_name_t vs3;
111  pin_name_t pwm;
112  pin_name_t vs1;
113 
115  // End types group
117 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
118 
124 #ifdef __cplusplus
125 extern "C"{
126 #endif
127 
137 
146 
155 
165 
175 
186 
197 
211 
225 
239 
253 
267 
281 
295 
309 
310 #ifdef __cplusplus
311 }
312 #endif
313 #endif // _BUCKBOOST_H_
314  // End public_function group
317 
318 // ------------------------------------------------------------------------- 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:111
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:110
buckboost_t::vs2
digital_out_t vs2
Definition: buckboost.h:93
buckboost_cfg_t::vs2
pin_name_t vs2
Definition: buckboost.h:108
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:90
buckboost_cfg_t::run
pin_name_t run
Definition: buckboost.h:109
BUCKBOOST_RETVAL
#define BUCKBOOST_RETVAL
Definition: buckboost.h:73
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:97
buckboost_t::vs3
digital_out_t vs3
Definition: buckboost.h:95
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:94
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:112
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:105
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:96