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 
35 #include "drv_digital_out.h"
36 #include "drv_digital_in.h"
37 
58 #define STEPDOWN3_OUT_VOLTAGE_1V6 0x00
59 #define STEPDOWN3_OUT_VOLTAGE_1V8 0x01
60 #define STEPDOWN3_OUT_VOLTAGE_2V1 0x02
61 #define STEPDOWN3_OUT_VOLTAGE_2V5 0x03
62 #define STEPDOWN3_OUT_VOLTAGE_2V7 0x04
63 #define STEPDOWN3_OUT_VOLTAGE_2V8 0x05
64 #define STEPDOWN3_OUT_VOLTAGE_3V0 0x06
65 #define STEPDOWN3_OUT_VOLTAGE_3V3 0x07
66  // stepdown3_set
68 
83 #define STEPDOWN3_MAP_MIKROBUS( cfg, mikrobus ) \
84  cfg.d2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
85  cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
86  cfg.aux = MIKROBUS( mikrobus, MIKROBUS_CS ); \
87  cfg.d1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
88  cfg.d0 = MIKROBUS( mikrobus, MIKROBUS_INT )
89  // stepdown3_map // stepdown3
92 
97 typedef struct
98 {
99  digital_out_t d2;
100  digital_out_t en;
101  digital_out_t aux;
102  digital_out_t d1;
103  digital_out_t d0;
105 } stepdown3_t;
106 
111 typedef struct
112 {
113  pin_name_t d2;
114  pin_name_t en;
115  pin_name_t aux;
116  pin_name_t d1;
117  pin_name_t d0;
120 
125 typedef enum
126 {
128  STEPDOWN3_ERROR = -1
129 
131 
148 
163 
173 
183 
193 
203 
220 void stepdown3_set_output_voltage ( stepdown3_t *ctx, uint8_t vout );
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 #endif // STEPDOWN3_H
226  // stepdown3
228 
229 // ------------------------------------------------------------------------ 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:98
stepdown3_return_value_t
stepdown3_return_value_t
Step Down 3 Click return value data.
Definition: stepdown3.h:126
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:127
stepdown3_t::d2
digital_out_t d2
Definition: stepdown3.h:99
stepdown3_t::d1
digital_out_t d1
Definition: stepdown3.h:102
stepdown3_cfg_t::d2
pin_name_t d2
Definition: stepdown3.h:113
stepdown3_t::aux
digital_out_t aux
Definition: stepdown3.h:101
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:112
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:116
stepdown3_cfg_t::aux
pin_name_t aux
Definition: stepdown3.h:115
stepdown3_cfg_t::en
pin_name_t en
Definition: stepdown3.h:114
stepdown3_t::en
digital_out_t en
Definition: stepdown3.h:100
STEPDOWN3_ERROR
@ STEPDOWN3_ERROR
Definition: stepdown3.h:128
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:117
stepdown3_t::d0
digital_out_t d0
Definition: stepdown3.h:103