stepdown3  2.0.0.0
stepdown3.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2020 MikroElektronika d.o.o.
3 ** Contact: https://www.mikroe.com/contact
4 **
5 ** Permission is hereby granted, free of charge, to any person obtaining a copy
6 ** of this software and associated documentation files (the "Software"), to deal
7 ** in the Software without restriction, including without limitation the rights
8 ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 ** copies of the Software, and to permit persons to whom the Software is
10 ** furnished to do so, subject to the following conditions:
11 ** The above copyright notice and this permission notice shall be
12 ** included in all copies or substantial portions of the Software.
13 **
14 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
16 ** OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
19 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 ** USE OR OTHER DEALINGS IN THE SOFTWARE.
21 ****************************************************************************/
22 
28 #ifndef STEPDOWN3_H
29 #define STEPDOWN3_H
30 
31 #ifdef __cplusplus
32 extern "C"{
33 #endif
34 
39 #ifdef PREINIT_SUPPORTED
40 #include "preinit.h"
41 #endif
42 
43 #ifdef MikroCCoreVersion
44  #if MikroCCoreVersion >= 1
45  #include "delays.h"
46  #endif
47 #endif
48 
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 
72 #define STEPDOWN3_OUT_VOLTAGE_1V6 0x00
73 #define STEPDOWN3_OUT_VOLTAGE_1V8 0x01
74 #define STEPDOWN3_OUT_VOLTAGE_2V1 0x02
75 #define STEPDOWN3_OUT_VOLTAGE_2V5 0x03
76 #define STEPDOWN3_OUT_VOLTAGE_2V7 0x04
77 #define STEPDOWN3_OUT_VOLTAGE_2V8 0x05
78 #define STEPDOWN3_OUT_VOLTAGE_3V0 0x06
79 #define STEPDOWN3_OUT_VOLTAGE_3V3 0x07
80  // stepdown3_set
82 
97 #define STEPDOWN3_MAP_MIKROBUS( cfg, mikrobus ) \
98  cfg.d2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
99  cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
100  cfg.aux = MIKROBUS( mikrobus, MIKROBUS_CS ); \
101  cfg.d1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
102  cfg.d0 = MIKROBUS( mikrobus, MIKROBUS_INT )
103  // stepdown3_map // stepdown3
106 
111 typedef struct
112 {
113  digital_out_t d2;
114  digital_out_t en;
115  digital_out_t aux;
116  digital_out_t d1;
117  digital_out_t d0;
119 } stepdown3_t;
120 
125 typedef struct
126 {
127  pin_name_t d2;
128  pin_name_t en;
129  pin_name_t aux;
130  pin_name_t d1;
131  pin_name_t d0;
134 
139 typedef enum
140 {
142  STEPDOWN3_ERROR = -1
143 
145 
162 
177 
187 
197 
207 
217 
234 void stepdown3_set_output_voltage ( stepdown3_t *ctx, uint8_t vout );
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 #endif // STEPDOWN3_H
240  // stepdown3
242 
243 // ------------------------------------------------------------------------ END
stepdown3_cfg_setup
void stepdown3_cfg_setup(stepdown3_cfg_t *cfg)
Step Down 3 configuration object setup function.
stepdown3_enable_aux_output
void stepdown3_enable_aux_output(stepdown3_t *ctx)
Step Down 3 enable aux output function.
stepdown3_t
Step Down 3 Click context object.
Definition: stepdown3.h:112
stepdown3_return_value_t
stepdown3_return_value_t
Step Down 3 Click return value data.
Definition: stepdown3.h:140
stepdown3_set_output_voltage
void stepdown3_set_output_voltage(stepdown3_t *ctx, uint8_t vout)
Step Down 3 set output voltage function.
STEPDOWN3_OK
@ STEPDOWN3_OK
Definition: stepdown3.h:141
stepdown3_t::d2
digital_out_t d2
Definition: stepdown3.h:113
stepdown3_t::d1
digital_out_t d1
Definition: stepdown3.h:116
stepdown3_cfg_t::d2
pin_name_t d2
Definition: stepdown3.h:127
stepdown3_t::aux
digital_out_t aux
Definition: stepdown3.h:115
stepdown3_enable_device
void stepdown3_enable_device(stepdown3_t *ctx)
Step Down 3 enable device function.
stepdown3_disable_aux_output
void stepdown3_disable_aux_output(stepdown3_t *ctx)
Step Down 3 disable aux output function.
stepdown3_cfg_t
Step Down 3 Click configuration object.
Definition: stepdown3.h:126
stepdown3_disable_device
void stepdown3_disable_device(stepdown3_t *ctx)
Step Down 3 disable device function.
stepdown3_cfg_t::d1
pin_name_t d1
Definition: stepdown3.h:130
stepdown3_cfg_t::aux
pin_name_t aux
Definition: stepdown3.h:129
stepdown3_cfg_t::en
pin_name_t en
Definition: stepdown3.h:128
stepdown3_t::en
digital_out_t en
Definition: stepdown3.h:114
STEPDOWN3_ERROR
@ STEPDOWN3_ERROR
Definition: stepdown3.h:142
stepdown3_init
err_t stepdown3_init(stepdown3_t *ctx, stepdown3_cfg_t *cfg)
Step Down 3 initialization function.
stepdown3_cfg_t::d0
pin_name_t d0
Definition: stepdown3.h:131
stepdown3_t::d0
digital_out_t d0
Definition: stepdown3.h:117