Go to the documentation of this file.
38 #include "drv_digital_out.h"
39 #include "drv_digital_in.h"
40 #include "drv_i2c_master.h"
53 #define C3XBUCK_MAP_MIKROBUS( cfg, mikrobus ) \
54 cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
55 cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
56 cfg.en1 = MIKROBUS( mikrobus, MIKROBUS_AN ); \
57 cfg.en2 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
58 cfg.en3 = MIKROBUS( mikrobus, MIKROBUS_INT );
65 #define C3XBUCK_RETVAL uint8_t
67 #define C3XBUCK_OK 0x00
68 #define C3XBUCK_INIT_ERROR 0xFF
75 #define C3XBUCK_SELECT_BUCK_1 0x00
76 #define C3XBUCK_SELECT_BUCK_2 0x01
77 #define C3XBUCK_SELECT_BUCK_3 0x02
84 #define C3XBUCK_BUCK_DEFAULT_OUTPUT_VOLTAGE 0x80
85 #define C3XBUCK_REG_VOUT1_SEL 0x00
86 #define C3XBUCK_REG_VOUT2_SEL 0x01
87 #define C3XBUCK_REG_VOUT3_SEL 0x02
88 #define C3XBUCK_REG_VOUT1_COM 0x03
89 #define C3XBUCK_REG_VOUT2_COM 0x04
90 #define C3XBUCK_REG_VOUT3_COM 0x05
91 #define C3XBUCK_REG_SYS_STATUS 0x06
98 #define C3XBUCK_CFG_RATE_10mV_0cycles 0x00
99 #define C3XBUCK_CFG_RATE_10mV_2cycles 0x10
100 #define C3XBUCK_CFG_RATE_10mV_4cycles 0x20
101 #define C3XBUCK_CFG_RATE_10mV_8cycles 0x30
102 #define C3XBUCK_CFG_RATE_10mV_16cycles 0x40
103 #define C3XBUCK_CFG_RATE_10mV_32cycles 0x50
104 #define C3XBUCK_CFG_RATE_10mV_64cycles 0x60
105 #define C3XBUCK_CFG_RATE_10mV_128cycles 0x70
106 #define C3XBUCK_CFG_MODE_PSM_OPERATION 0x00
107 #define C3XBUCK_CFG_MODE_PWM_OPERATION 0x02
108 #define C3XBUCK_CFG_SW_ENABLE_BUCK 0x00
109 #define C3XBUCK_CFG_SW_DISABLE_BUCK 0x01
117 #define C3XBUCK_OUTPUT_VOLTAGE_680mV 0x00
118 #define C3XBUCK_OUTPUT_VOLTAGE_690mV 0x01
119 #define C3XBUCK_OUTPUT_VOLTAGE_700mV 0x02
120 #define C3XBUCK_OUTPUT_VOLTAGE_710mV 0x03
121 #define C3XBUCK_OUTPUT_VOLTAGE_720mV 0x04
122 #define C3XBUCK_OUTPUT_VOLTAGE_730mV 0x05
123 #define C3XBUCK_OUTPUT_VOLTAGE_740mV 0x06
124 #define C3XBUCK_OUTPUT_VOLTAGE_750mV 0x07
125 #define C3XBUCK_OUTPUT_VOLTAGE_760mV 0x08
126 #define C3XBUCK_OUTPUT_VOLTAGE_770mV 0x09
127 #define C3XBUCK_OUTPUT_VOLTAGE_780mV 0x0A
128 #define C3XBUCK_OUTPUT_VOLTAGE_790mV 0x0B
129 #define C3XBUCK_OUTPUT_VOLTAGE_800mV 0x0C
130 #define C3XBUCK_OUTPUT_VOLTAGE_810mV 0x0D
131 #define C3XBUCK_OUTPUT_VOLTAGE_820mV 0x0E
132 #define C3XBUCK_OUTPUT_VOLTAGE_830mV 0x0F
133 #define C3XBUCK_OUTPUT_VOLTAGE_840mV 0x10
134 #define C3XBUCK_OUTPUT_VOLTAGE_850mV 0x11
135 #define C3XBUCK_OUTPUT_VOLTAGE_860mV 0x12
136 #define C3XBUCK_OUTPUT_VOLTAGE_870mV 0x13
137 #define C3XBUCK_OUTPUT_VOLTAGE_880mV 0x14
138 #define C3XBUCK_OUTPUT_VOLTAGE_890mV 0x15
139 #define C3XBUCK_OUTPUT_VOLTAGE_900mV 0x16
140 #define C3XBUCK_OUTPUT_VOLTAGE_910mV 0x17
141 #define C3XBUCK_OUTPUT_VOLTAGE_920mV 0x18
142 #define C3XBUCK_OUTPUT_VOLTAGE_930mV 0x19
143 #define C3XBUCK_OUTPUT_VOLTAGE_940mV 0x1A
144 #define C3XBUCK_OUTPUT_VOLTAGE_950mV 0x1B
145 #define C3XBUCK_OUTPUT_VOLTAGE_960mV 0x1C
146 #define C3XBUCK_OUTPUT_VOLTAGE_970mV 0x1D
147 #define C3XBUCK_OUTPUT_VOLTAGE_980mV 0x1E
148 #define C3XBUCK_OUTPUT_VOLTAGE_990mV 0x1F
149 #define C3XBUCK_OUTPUT_VOLTAGE_1000mV 0x20
150 #define C3XBUCK_OUTPUT_VOLTAGE_1010mV 0x21
151 #define C3XBUCK_OUTPUT_VOLTAGE_1020mV 0x22
152 #define C3XBUCK_OUTPUT_VOLTAGE_1030mV 0x23
153 #define C3XBUCK_OUTPUT_VOLTAGE_1040mV 0x24
154 #define C3XBUCK_OUTPUT_VOLTAGE_1050mV 0x25
155 #define C3XBUCK_OUTPUT_VOLTAGE_1060mV 0x26
156 #define C3XBUCK_OUTPUT_VOLTAGE_1070mV 0x27
157 #define C3XBUCK_OUTPUT_VOLTAGE_1080mV 0x28
158 #define C3XBUCK_OUTPUT_VOLTAGE_1090mV 0x29
159 #define C3XBUCK_OUTPUT_VOLTAGE_1100mV 0x2A
160 #define C3XBUCK_OUTPUT_VOLTAGE_1110mV 0x2B
161 #define C3XBUCK_OUTPUT_VOLTAGE_1120mV 0x2C
162 #define C3XBUCK_OUTPUT_VOLTAGE_1130mV 0x2D
163 #define C3XBUCK_OUTPUT_VOLTAGE_1140mV 0x2E
164 #define C3XBUCK_OUTPUT_VOLTAGE_1150mV 0x2F
165 #define C3XBUCK_OUTPUT_VOLTAGE_1160mV 0x30
166 #define C3XBUCK_OUTPUT_VOLTAGE_1170mV 0x31
167 #define C3XBUCK_OUTPUT_VOLTAGE_1180mV 0x32
168 #define C3XBUCK_OUTPUT_VOLTAGE_1190mV 0x33
169 #define C3XBUCK_OUTPUT_VOLTAGE_1200mV 0x34
170 #define C3XBUCK_OUTPUT_VOLTAGE_1210mV 0x35
171 #define C3XBUCK_OUTPUT_VOLTAGE_1220mV 0x36
172 #define C3XBUCK_OUTPUT_VOLTAGE_1230mV 0x37
173 #define C3XBUCK_OUTPUT_VOLTAGE_1240mV 0x38
174 #define C3XBUCK_OUTPUT_VOLTAGE_1250mV 0x39
175 #define C3XBUCK_OUTPUT_VOLTAGE_1260mV 0x3A
176 #define C3XBUCK_OUTPUT_VOLTAGE_1270mV 0x3B
177 #define C3XBUCK_OUTPUT_VOLTAGE_1280mV 0x3C
178 #define C3XBUCK_OUTPUT_VOLTAGE_1290mV 0x3D
179 #define C3XBUCK_OUTPUT_VOLTAGE_1300mV 0x3E
180 #define C3XBUCK_OUTPUT_VOLTAGE_1310mV 0x3F
181 #define C3XBUCK_OUTPUT_VOLTAGE_1320mV 0x40
182 #define C3XBUCK_OUTPUT_VOLTAGE_1330mV 0x41
183 #define C3XBUCK_OUTPUT_VOLTAGE_1340mV 0x42
184 #define C3XBUCK_OUTPUT_VOLTAGE_1350mV 0x43
185 #define C3XBUCK_OUTPUT_VOLTAGE_1360mV 0x44
186 #define C3XBUCK_OUTPUT_VOLTAGE_1370mV 0x45
187 #define C3XBUCK_OUTPUT_VOLTAGE_1380mV 0x46
188 #define C3XBUCK_OUTPUT_VOLTAGE_1390mV 0x47
189 #define C3XBUCK_OUTPUT_VOLTAGE_1400mV 0x48
190 #define C3XBUCK_OUTPUT_VOLTAGE_1410mV 0x49
191 #define C3XBUCK_OUTPUT_VOLTAGE_1420mV 0x4A
192 #define C3XBUCK_OUTPUT_VOLTAGE_1430mV 0x4B
193 #define C3XBUCK_OUTPUT_VOLTAGE_1440mV 0x4C
194 #define C3XBUCK_OUTPUT_VOLTAGE_1450mV 0x4D
195 #define C3XBUCK_OUTPUT_VOLTAGE_1460mV 0x4E
196 #define C3XBUCK_OUTPUT_VOLTAGE_1470mV 0x4F
197 #define C3XBUCK_OUTPUT_VOLTAGE_1480mV 0x50
198 #define C3XBUCK_OUTPUT_VOLTAGE_1490mV 0x51
199 #define C3XBUCK_OUTPUT_VOLTAGE_1500mV 0x52
200 #define C3XBUCK_OUTPUT_VOLTAGE_1510mV 0x53
201 #define C3XBUCK_OUTPUT_VOLTAGE_1520mV 0x54
202 #define C3XBUCK_OUTPUT_VOLTAGE_1530mV 0x55
203 #define C3XBUCK_OUTPUT_VOLTAGE_1540mV 0x56
204 #define C3XBUCK_OUTPUT_VOLTAGE_1550mV 0x57
205 #define C3XBUCK_OUTPUT_VOLTAGE_1560mV 0x58
206 #define C3XBUCK_OUTPUT_VOLTAGE_1570mV 0x59
207 #define C3XBUCK_OUTPUT_VOLTAGE_1580mV 0x5A
208 #define C3XBUCK_OUTPUT_VOLTAGE_1590mV 0x5B
209 #define C3XBUCK_OUTPUT_VOLTAGE_1600mV 0x5C
210 #define C3XBUCK_OUTPUT_VOLTAGE_1610mV 0x5D
211 #define C3XBUCK_OUTPUT_VOLTAGE_1620mV 0x5E
212 #define C3XBUCK_OUTPUT_VOLTAGE_1630mV 0x5F
213 #define C3XBUCK_OUTPUT_VOLTAGE_1640mV 0x60
214 #define C3XBUCK_OUTPUT_VOLTAGE_1650mV 0x61
215 #define C3XBUCK_OUTPUT_VOLTAGE_1660mV 0x62
216 #define C3XBUCK_OUTPUT_VOLTAGE_1670mV 0x63
217 #define C3XBUCK_OUTPUT_VOLTAGE_1680mV 0x64
218 #define C3XBUCK_OUTPUT_VOLTAGE_1690mV 0x65
219 #define C3XBUCK_OUTPUT_VOLTAGE_1700mV 0x66
220 #define C3XBUCK_OUTPUT_VOLTAGE_1710mV 0x67
221 #define C3XBUCK_OUTPUT_VOLTAGE_1720mV 0x68
222 #define C3XBUCK_OUTPUT_VOLTAGE_1730mV 0x69
223 #define C3XBUCK_OUTPUT_VOLTAGE_1740mV 0x6A
224 #define C3XBUCK_OUTPUT_VOLTAGE_1750mV 0x6B
225 #define C3XBUCK_OUTPUT_VOLTAGE_1760mV 0x6C
226 #define C3XBUCK_OUTPUT_VOLTAGE_1770mV 0x6D
227 #define C3XBUCK_OUTPUT_VOLTAGE_1780mV 0x6E
228 #define C3XBUCK_OUTPUT_VOLTAGE_1790mV 0x6F
229 #define C3XBUCK_OUTPUT_VOLTAGE_1800mV 0x70
230 #define C3XBUCK_OUTPUT_VOLTAGE_1810mV 0x71
231 #define C3XBUCK_OUTPUT_VOLTAGE_1820mV 0x72
232 #define C3XBUCK_OUTPUT_VOLTAGE_1830mV 0x73
233 #define C3XBUCK_OUTPUT_VOLTAGE_1840mV 0x74
234 #define C3XBUCK_OUTPUT_VOLTAGE_1850mV 0x75
235 #define C3XBUCK_OUTPUT_VOLTAGE_1860mV 0x76
236 #define C3XBUCK_OUTPUT_VOLTAGE_1870mV 0x77
237 #define C3XBUCK_OUTPUT_VOLTAGE_1880mV 0x78
238 #define C3XBUCK_OUTPUT_VOLTAGE_1890mV 0x79
239 #define C3XBUCK_OUTPUT_VOLTAGE_1900mV 0x7A
240 #define C3XBUCK_OUTPUT_VOLTAGE_1910mV 0x7B
241 #define C3XBUCK_OUTPUT_VOLTAGE_1920mV 0x7C
242 #define C3XBUCK_OUTPUT_VOLTAGE_1930mV 0x7D
243 #define C3XBUCK_OUTPUT_VOLTAGE_1940mV 0x7E
244 #define C3XBUCK_OUTPUT_VOLTAGE_1950mV 0x7F
419 #endif // _C3XBUCK_H_
digital_out_t en2
Definition: c3xbuck.h:261
uint8_t slave_address
Definition: c3xbuck.h:270
void c3xbuck_default_cfg(c3xbuck_t *ctx)
Click Default Configuration function.
pin_name_t scl
Definition: c3xbuck.h:281
Click configuration structure definition.
Definition: c3xbuck.h:278
uint32_t i2c_speed
Definition: c3xbuck.h:292
digital_out_t en3
Definition: c3xbuck.h:262
i2c_master_t i2c
Definition: c3xbuck.h:266
pin_name_t en3
Definition: c3xbuck.h:288
void c3xbuck_enable_buck(c3xbuck_t *ctx, uint8_t buck)
Enable Buck function.
void c3xbuck_set_voltage(c3xbuck_t *ctx, uint8_t buck, uint8_t voltage)
Set voltage function.
pin_name_t sda
Definition: c3xbuck.h:282
void c3xbuck_disable_buck(c3xbuck_t *ctx, uint8_t buck)
Disable Buck function.
void c3xbuck_write_byte(c3xbuck_t *ctx, uint8_t reg, uint8_t data_value)
Write byte function.
digital_out_t en1
Definition: c3xbuck.h:260
uint8_t c3xbuck_read_byte(c3xbuck_t *ctx, uint8_t reg)
Generic read function.
pin_name_t en2
Definition: c3xbuck.h:287
pin_name_t en1
Definition: c3xbuck.h:286
Click ctx object definition.
Definition: c3xbuck.h:257
uint8_t c3xbuck_get_status(c3xbuck_t *ctx)
Get status function.
void c3xbuck_configuration_buck(c3xbuck_t *ctx, uint8_t buck, uint8_t config)
Configuration function.
#define C3XBUCK_RETVAL
Definition: c3xbuck.h:65
uint8_t i2c_address
Definition: c3xbuck.h:293
void c3xbuck_cfg_setup(c3xbuck_cfg_t *cfg)
Config Object Initialization function.
C3XBUCK_RETVAL c3xbuck_init(c3xbuck_t *ctx, c3xbuck_cfg_t *cfg)
Initialization function.