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 
42 #ifdef PREINIT_SUPPORTED
43 #include "preinit.h"
44 #endif
45 
46 #ifdef MikroCCoreVersion
47  #if MikroCCoreVersion >= 1
48  #include "delays.h"
49  #endif
50 #endif
51 
52 #include "drv_digital_out.h"
53 #include "drv_digital_in.h"
54 
55 // -------------------------------------------------------------- PUBLIC MACROS
65 #define BUCKBOOST_MAP_MIKROBUS( cfg, mikrobus ) \
66  cfg.vs2= MIKROBUS( mikrobus, MIKROBUS_AN ); \
67  cfg.run= MIKROBUS( mikrobus, MIKROBUS_CS ); \
68  cfg.vs3= MIKROBUS( mikrobus, MIKROBUS_RST ); \
69  cfg.pwm= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
70  cfg.vs1= MIKROBUS( mikrobus, MIKROBUS_INT )
71 
77 #define BUCKBOOST_RETVAL uint8_t
78 
79 #define BUCKBOOST_OK 0x00
80 #define BUCKBOOST_INIT_ERROR 0xFF
81  // End group macro
84 // --------------------------------------------------------------- PUBLIC TYPES
93 typedef struct
94 {
95  // Output pins
96 
97  digital_out_t vs2;
98  digital_out_t run;
99  digital_out_t vs3;
100  digital_out_t pwm;
101  digital_out_t vs1;
102 
103 } buckboost_t;
104 
108 typedef struct
109 {
110  // Additional gpio pins
111 
112  pin_name_t vs2;
113  pin_name_t run;
114  pin_name_t vs3;
115  pin_name_t pwm;
116  pin_name_t vs1;
117 
119  // End types group
121 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
122 
128 #ifdef __cplusplus
129 extern "C"{
130 #endif
131 
141 
150 
159 
169 
179 
190 
201 
215 
229 
243 
257 
271 
285 
299 
313 
314 #ifdef __cplusplus
315 }
316 #endif
317 #endif // _BUCKBOOST_H_
318  // End public_function group
321 
322 // ------------------------------------------------------------------------- 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:115
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:114
buckboost_t::vs2
digital_out_t vs2
Definition: buckboost.h:97
buckboost_cfg_t::vs2
pin_name_t vs2
Definition: buckboost.h:112
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:94
buckboost_cfg_t::run
pin_name_t run
Definition: buckboost.h:113
BUCKBOOST_RETVAL
#define BUCKBOOST_RETVAL
Definition: buckboost.h:77
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:101
buckboost_t::vs3
digital_out_t vs3
Definition: buckboost.h:99
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:98
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:116
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:109
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:100