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 "mikrosdk_version.h"
36 
37 #ifdef __GNUC__
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
40 #else
41 #include "delays.h"
42 #endif
43 #endif
44 
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 
68 #define STEPDOWN3_OUT_VOLTAGE_1V6 0x00
69 #define STEPDOWN3_OUT_VOLTAGE_1V8 0x01
70 #define STEPDOWN3_OUT_VOLTAGE_2V1 0x02
71 #define STEPDOWN3_OUT_VOLTAGE_2V5 0x03
72 #define STEPDOWN3_OUT_VOLTAGE_2V7 0x04
73 #define STEPDOWN3_OUT_VOLTAGE_2V8 0x05
74 #define STEPDOWN3_OUT_VOLTAGE_3V0 0x06
75 #define STEPDOWN3_OUT_VOLTAGE_3V3 0x07
76  // stepdown3_set
78 
93 #define STEPDOWN3_MAP_MIKROBUS( cfg, mikrobus ) \
94  cfg.d2 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
95  cfg.en = MIKROBUS( mikrobus, MIKROBUS_RST ); \
96  cfg.aux = MIKROBUS( mikrobus, MIKROBUS_CS ); \
97  cfg.d1 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
98  cfg.d0 = MIKROBUS( mikrobus, MIKROBUS_INT )
99  // stepdown3_map // stepdown3
102 
107 typedef struct
108 {
109  digital_out_t d2;
110  digital_out_t en;
111  digital_out_t aux;
112  digital_out_t d1;
113  digital_out_t d0;
115 } stepdown3_t;
116 
121 typedef struct
122 {
123  pin_name_t d2;
124  pin_name_t en;
125  pin_name_t aux;
126  pin_name_t d1;
127  pin_name_t d0;
130 
135 typedef enum
136 {
138  STEPDOWN3_ERROR = -1
139 
141 
158 
173 
183 
193 
203 
213 
230 void stepdown3_set_output_voltage ( stepdown3_t *ctx, uint8_t vout );
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 #endif // STEPDOWN3_H
236  // stepdown3
238 
239 // ------------------------------------------------------------------------ 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:108
stepdown3_return_value_t
stepdown3_return_value_t
Step Down 3 Click return value data.
Definition: stepdown3.h:136
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:137
stepdown3_t::d2
digital_out_t d2
Definition: stepdown3.h:109
stepdown3_t::d1
digital_out_t d1
Definition: stepdown3.h:112
stepdown3_cfg_t::d2
pin_name_t d2
Definition: stepdown3.h:123
stepdown3_t::aux
digital_out_t aux
Definition: stepdown3.h:111
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:122
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:126
stepdown3_cfg_t::aux
pin_name_t aux
Definition: stepdown3.h:125
stepdown3_cfg_t::en
pin_name_t en
Definition: stepdown3.h:124
stepdown3_t::en
digital_out_t en
Definition: stepdown3.h:110
STEPDOWN3_ERROR
@ STEPDOWN3_ERROR
Definition: stepdown3.h:138
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:127
stepdown3_t::d0
digital_out_t d0
Definition: stepdown3.h:113