no-OS
max14001.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __MAX14001_H__
34 #define __MAX14001_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include <stdbool.h>
41 #include "no_os_spi.h"
42 #include "no_os_gpio.h"
43 #include "no_os_util.h"
44 
45 /******************************************************************************/
46 /********************** Macros and Constants Definitions **********************/
47 /******************************************************************************/
48 #define MAX14001_REG_READ(x) (((x) << 11) & NO_OS_GENMASK(15, 11))
49 #define MAX14001_REG_WRITE(x,y) (MAX14001_REG_READ(x) | \
50  NO_OS_BIT(10) | \
51  (y & MAX14001_REG_DATA_MASK))
52 #define MAX14001_REG_DATA_MASK NO_OS_GENMASK(9, 0)
53 #define VERIFICATION_REG(x) ((x) + 0x10)
54 #define MAX14001_SPI_REG_WRITE_ENABLE 0x294
55 #define MAX14001_SPI_REG_WRITE_DISABLE 0x000
56 
57 /*
58  * MAX14001 registers definition
59  */
60 #define MAX14001_ADC_REG 0x00
61 #define MAX14001_FADC_REG 0x01
62 #define MAX14001_FLAGS_REG 0x02
63 #define MAX14001_FLTEN_REG 0x03
64 #define MAX14001_THL_REG 0x04
65 #define MAX14001_THU_REG 0x05
66 #define MAX14001_INRR_REG 0x06
67 #define MAX14001_INRT_REG 0x07
68 #define MAX14001_INRP_REG 0x08
69 #define MAX14001_CFG_REG 0x09
70 #define MAX14001_ENBL_REG 0x0A
71 #define MAX14001_ACT_REG 0x0B
72 #define MAX14001_WEN_REG 0x0C
73 #define MAX14001_FLTV_REG 0x13
74 #define MAX14001_THLV_REG 0x14
75 #define MAX14001_THUV_REG 0x15
76 #define MAX14001_INRRV_REG 0x16
77 #define MAX14001_INRTV_REG 0x17
78 #define MAX14001_INRPV_REG 0x18
79 #define MAX14001_CFGV_REG 0x19
80 #define MAX14001_ENBLV_REG 0x1A
81 
82 /*
83  * MAX14001_ACT_REG
84  */
85 
87 #define MAX14001_RSET_MASK NO_OS_BIT(7)
88 
90 #define MAX14001_SRES_MASK NO_OS_BIT(6)
91 
93 #define MAX14001_INPLS_MASK NO_OS_BIT(9)
94 
95 /*
96  * MAX14001_FLAGS_REG
97  */
98 #define MAX14001_ADC_FLAG_MASK NO_OS_BIT(1)
99 #define MAX14001_INRD_FLAG_MASK NO_OS_BIT(2)
100 #define MAX14001_SPI_FLAG_MASK NO_OS_BIT(3)
101 #define MAX14001_COM_FLAG_MASK NO_OS_BIT(4)
102 #define MAX14001_CRCL_FLAG_MASK NO_OS_BIT(5)
103 #define MAX14001_CRCF_FLAG_MASK NO_OS_BIT(6)
104 #define MAX14001_FET_FLAG_MASK NO_OS_BIT(7)
105 #define MAX14001_MV_FLAG_MASK NO_OS_BIT(8)
106 
107 /*
108  * MAX14001_FLTEN_REG
109  */
110 #define MAX14001_DYEN_FLTEN_MASK NO_OS_BIT(0)
111 #define MAX14001_EADC_FLTEN_MASK NO_OS_BIT(1)
112 #define MAX14001_EINRD_FLTEN_MASK NO_OS_BIT(2)
113 #define MAX14001_ESPI_FLTEN_MASK NO_OS_BIT(3)
114 #define MAX14001_ECOM_FLTEN_MASK NO_OS_BIT(4)
115 #define MAX14001_ECRCL_FLTEN_MASK NO_OS_BIT(5)
116 #define MAX14001_ECRCF_FLTEN_MASK NO_OS_BIT(6)
117 #define MAX14001_EFET_FLTEN_MASK NO_OS_BIT(7)
118 #define MAX14001_EMV_FLTEN_MASK NO_OS_BIT(8)
119 
120 /*
121  * MAX14001_INRP_REG
122  */
123 #define MAX14001_IINR_INRP_MASK NO_OS_GENMASK(9, 6)
124 #define MAX14001_IINR_INRP_MODE(a) ((MAX14001_IINR(a)) << 6)
125 #define MAX14001_TINR_INRP_MASK NO_OS_GENMASK(5, 2)
126 #define MAX14001_TINR_INRP_MODE(a) ((MAX14001_TINR(a)) << 2)
127 #define MAX14001_DU_INRP_MASK NO_OS_GENMASK(1, 0)
128 #define MAX14001_DU_INRP_MODE(a) (((a) & 0x3) << 0)
129 
130 /*
131  * MAX14001_CFG_REG
132  */
133 #define MAX14001_IBIAS_CFG_MASK NO_OS_GENMASK(9, 6)
134 #define MAX14001_IBIAS_CFG_MODE(a) ((MAX14001_IBIAS(a)) << 6)
135 #define MAX14001_EXRF_CFG_MASK NO_OS_BIT(5)
136 #define MAX14001_EXTI_CFG_MASK NO_OS_BIT(4)
137 #define MAX14001_FT_CFG_MASK NO_OS_GENMASK(3, 2)
138 #define MAX14001_FT_CFG_MODE(a) (((a) & 0x3) << 2)
139 #define MAX14001_FAST_CFG_MASK NO_OS_BIT(1)
140 #define MAX14001_IRAW_CFG_MASK NO_OS_BIT(0)
141 
142 /*
143  * MAX14001_ENBL_REG
144  */
145 #define MAX14001_ENA_ENBL_MASK NO_OS_BIT(4)
146 
147 /*
148  * 16-bit bitswap
149  */
150 #define REVERSE_UINT16(x) ((((x >> 0) & 1) << 15) | \
151  (((x >> 1) & 1 ) << 14) | \
152  (((x >> 2) & 1 ) << 13) | \
153  (((x >> 3) & 1 ) << 12) | \
154  (((x >> 4) & 1 ) << 11) | \
155  (((x >> 5) & 1 ) << 10) | \
156  (((x >> 6) & 1 ) << 9) | \
157  (((x >> 7) & 1 ) << 8) | \
158  (((x >> 8) & 1 ) << 7) | \
159  (((x >> 9) & 1 ) << 6) | \
160  (((x >> 10) & 1) << 5) | \
161  (((x >> 11) & 1) << 4) | \
162  (((x >> 12) & 1) << 3) | \
163  (((x >> 13) & 1) << 2) | \
164  (((x >> 14) & 1) << 1) | \
165  (((x >> 15) & 1) << 0))
166 
167 /*
168  * MAX14001 Quantization of configuration inputs
169  */
170 #define MAX14001_CFG_MIN 0
171 #define MAX14001_CFG_MAX 0xF
172 #define MAX14001_CFG_Q(x,y) (no_os_clamp( \
173  NO_OS_DIV_ROUND_CLOSEST(x,y), \
174  (MAX14001_CFG_MIN),(MAX14001_CFG_MAX)))
175 /*
176  * MAX14001 TINR input to bits equivelent
177  */
178 #define MAX14001_TINR_INC 8 //in terms of ms
179 #define MAX14001_TINR(x) MAX14001_CFG_Q(x, MAX14001_TINR_INC)
180 
181 /*
182  * MAX14001 IINR input to bits equivelent
183  */
184 #define MAX14001_IINR_INC 7 //in terms of mA
185 #define MAX14001_IINR(x) MAX14001_CFG_Q(x, MAX14001_IINR_INC)
186 
187 /*
188  * MAX14001 IBIAS input to bits equivelent
189  */
190 #define MAX14001_MUL 100
191 #define MAX14001_IBIAS_INC 25 //increment of 0.25mA
192 #define MAX14001_IBIAS(x) MAX14001_CFG_Q((int)(x*MAX14001_MUL), \
193  MAX14001_IBIAS_INC)
194 
195 /******************************************************************************/
196 /*************************** Types Declarations *******************************/
197 /******************************************************************************/
198 
204  DUTY_OFF, //default, duty cycle limiting function off
208 };
209 
215  FILTER_OFF, //default, filtering is off
219 };
220 
221 struct max14001_dev {
224 };
225 
229 };
230 
232 int max14001_read(struct max14001_dev *dev,
233  uint8_t reg_addr,
234  uint16_t *reg_data);
235 
237 int max14001_write(struct max14001_dev *dev,
238  uint8_t reg_addr,
239  uint16_t reg_data);
240 
242 int max14001_reg_update(struct max14001_dev *dev,
243  uint8_t reg_addr,
244  uint16_t mask,
245  uint16_t data);
246 
249  uint8_t reg_addr,
250  uint16_t mask,
251  uint16_t data);
252 
254 int max14001_init(struct max14001_dev **device,
256 
258 int max14001_init_config(struct max14001_dev *dev);
259 
261 int max14001_wen(struct max14001_dev *dev, bool write_enable);
262 
264 int max14001_full_reset(struct max14001_dev *dev);
265 
267 int max14001_reg_reset(struct max14001_dev *dev);
268 
270 int max14001_inpls_reset(struct max14001_dev *dev);
271 
273 int max14001_fast_config(struct max14001_dev *dev,
274  bool fast);
275 
277 int max14001_iraw_config(struct max14001_dev *dev,
278  bool raw_data);
279 
281 int max14001_emv_config(struct max14001_dev *dev,
282  bool mode);
283 
285 int max14001_efet_config(struct max14001_dev *dev,
286  bool mode);
287 
289 int max14001_ecrcf_config(struct max14001_dev *dev,
290  bool mode);
291 
293 int max14001_ecrcl_config(struct max14001_dev *dev,
294  bool mode);
295 
297 int max14001_ecom_config(struct max14001_dev *dev,
298  bool mode);
299 
301 int max14001_espi_config(struct max14001_dev *dev,
302  bool mode);
303 
305 int max14001_einrd_config(struct max14001_dev *dev,
306  bool mode);
307 
309 int max14001_eadc_config(struct max14001_dev *dev,
310  bool mode);
311 
313 int max14001_dyen_config(struct max14001_dev *dev,
314  bool mode);
315 
317 int max14001_ena_config(struct max14001_dev *dev,
318  bool enable);
319 
321 int max14001_exrf_config(struct max14001_dev *dev,
322  bool mode);
323 
325 int max14001_exti_config(struct max14001_dev *dev,
326  bool mode);
327 
329 int max14001_tinr_config(struct max14001_dev *dev,
330  int mode);
331 
333 int max14001_iinr_config(struct max14001_dev *dev,
334  int mode);
335 
337 int max14001_du_config(struct max14001_dev *dev,
338  enum max14001_du mode);
339 
341 int max14001_ibias_config(struct max14001_dev *dev,
342  float mode);
343 
345 int max14001_ft_config(struct max14001_dev *dev,
346  enum max14001_ft mode);
347 
349 int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data);
350 
352 int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data);
353 
355 int max14001_remove(struct max14001_dev *dev);
356 
357 #endif /* __MAX14001_H__ */
MAX14001_MV_FLAG_MASK
#define MAX14001_MV_FLAG_MASK
Definition: max14001.h:105
max14001_wen
int max14001_wen(struct max14001_dev *dev, bool write_enable)
Enable write to registers.
Definition: max14001.c:302
no_os_put_unaligned_be16
void no_os_put_unaligned_be16(uint16_t val, uint8_t *buf)
MAX14001_ENA_ENBL_MASK
#define MAX14001_ENA_ENBL_MASK
Definition: max14001.h:145
no_os_alloc.h
AVERAGE_8_READINGS
@ AVERAGE_8_READINGS
Definition: max14001.h:218
max14001_iraw_config
int max14001_iraw_config(struct max14001_dev *dev, bool raw_data)
Selects Inrush comparator input multiplexer.
Definition: max14001.c:496
MAX14001_CFG_REG
#define MAX14001_CFG_REG
Definition: max14001.h:69
MAX14001_REG_WRITE
#define MAX14001_REG_WRITE(x, y)
Definition: max14001.h:49
max14001_wen
int max14001_wen(struct max14001_dev *dev, bool enable)
Enable write to registers.
Definition: max14001.c:302
MAX14001_ADC_REG
#define MAX14001_ADC_REG
Definition: max14001.h:60
MAX14001_FT_CFG_MODE
#define MAX14001_FT_CFG_MODE(a)
Definition: max14001.h:138
MAX14001_WEN_REG
#define MAX14001_WEN_REG
Definition: max14001.h:72
MAX14001_REG_DATA_MASK
#define MAX14001_REG_DATA_MASK
Definition: max14001.h:52
max14001_iraw_config
int max14001_iraw_config(struct max14001_dev *dev, bool raw_data)
Selects Inrush comparator input multiplexer.
Definition: max14001.c:496
max14001_dev
Definition: max14001.h:221
no_os_spi_write_and_read
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
max14001_get_data_filtered
int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data)
Get filtered adc data.
Definition: max14001.c:655
no_os_spi.h
Header file of SPI Interface.
max14001_du
max14001_du
MAX14001 list of possible duty cycle modes.
Definition: max14001.h:203
MAX14001_EXTI_CFG_MASK
#define MAX14001_EXTI_CFG_MASK
Definition: max14001.h:136
max14001_ecrcf_config
int max14001_ecrcf_config(struct max14001_dev *dev, bool mode)
Enable CRCF fault.
Definition: max14001.c:376
MAX14001_FT_CFG_MASK
#define MAX14001_FT_CFG_MASK
Definition: max14001.h:137
max14001_iinr_config
int max14001_iinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush current.
Definition: max14001.c:571
MAX14001_IRAW_CFG_MASK
#define MAX14001_IRAW_CFG_MASK
Definition: max14001.h:140
max14001_ft_config
int max14001_ft_config(struct max14001_dev *dev, enum max14001_ft mode)
Set number of readings averaged in the ADC filter.
Definition: max14001.c:624
max14001_full_reset
int max14001_full_reset(struct max14001_dev *dev)
Full reset, same effect as power on reset.
Definition: max14001.c:314
max14001_reg_update
int max14001_reg_update(struct max14001_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
SPI write to device using a mask.
Definition: max14001.c:125
MAX14001_SRES_MASK
#define MAX14001_SRES_MASK
Definition: max14001.h:90
max14001_ibias_config
int max14001_ibias_config(struct max14001_dev *dev, float mode)
Configure 4-bit bias current.
Definition: max14001.c:606
MAX14001_SPI_REG_WRITE_ENABLE
#define MAX14001_SPI_REG_WRITE_ENABLE
Definition: max14001.h:54
MAX14001_ECOM_FLTEN_MASK
#define MAX14001_ECOM_FLTEN_MASK
Definition: max14001.h:114
no_os_delay.h
Header file of Delay functions.
MAX14001_IINR_INRP_MODE
#define MAX14001_IINR_INRP_MODE(a)
Definition: max14001.h:124
max14001_read
int max14001_read(struct max14001_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Read from device.
Definition: max14001.c:55
MAX14001_FLTV_REG
#define MAX14001_FLTV_REG
Definition: max14001.h:73
MAX14001_TINR_INRP_MASK
#define MAX14001_TINR_INRP_MASK
Definition: max14001.h:125
max14001_ft
max14001_ft
MAX14001 list of possible filtering modes.
Definition: max14001.h:214
max14001_init
int max14001_init(struct max14001_dev **device, struct max14001_init_param init_param)
Initialize the device.
Definition: max14001.c:190
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:148
max14001_emv_config
int max14001_emv_config(struct max14001_dev *dev, bool mode)
Enable MV fault.
Definition: max14001.c:346
device
Definition: ad9361_util.h:69
max14001_inpls_reset
int max14001_inpls_reset(struct max14001_dev *dev)
Trigger an inrush current pulse.
Definition: max14001.c:334
max14001_einrd_config
int max14001_einrd_config(struct max14001_dev *dev, bool mode)
Enable INRD fault.
Definition: max14001.c:436
max14001_write
int max14001_write(struct max14001_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Write to device.
Definition: max14001.c:97
max14001_write_config_verify
int max14001_write_config_verify(struct max14001_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
Write to config registers then to corresponding verification register.
Definition: max14001.c:156
max14001_init
int max14001_init(struct max14001_dev **device, struct max14001_init_param init_param)
Initialize the device.
Definition: max14001.c:190
max14001_emv_config
int max14001_emv_config(struct max14001_dev *dev, bool mode)
Enable MV fault.
Definition: max14001.c:346
MAX14001_DU_INRP_MASK
#define MAX14001_DU_INRP_MASK
Definition: max14001.h:127
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
max14001_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: max14001.h:223
MAX14001_FLAGS_REG
#define MAX14001_FLAGS_REG
Definition: max14001.h:62
AVERAGE_2_READINGS
@ AVERAGE_2_READINGS
Definition: max14001.h:216
MAX14001_IBIAS_CFG_MODE
#define MAX14001_IBIAS_CFG_MODE(a)
Definition: max14001.h:134
max14001_exrf_config
int max14001_exrf_config(struct max14001_dev *dev, bool mode)
Selects the voltage reference source for the ADC.
Definition: max14001.c:526
MAX14001_ACT_REG
#define MAX14001_ACT_REG
Definition: max14001.h:71
max14001_exti_config
int max14001_exti_config(struct max14001_dev *dev, bool mode)
Current source connection.
Definition: max14001.c:541
MAX14001_EINRD_FLTEN_MASK
#define MAX14001_EINRD_FLTEN_MASK
Definition: max14001.h:112
MAX14001_SPI_REG_WRITE_DISABLE
#define MAX14001_SPI_REG_WRITE_DISABLE
Definition: max14001.h:55
max14001_du_config
int max14001_du_config(struct max14001_dev *dev, enum max14001_du mode)
Set maximum duty cycle for inrush current over the last 10 seconds.
Definition: max14001.c:589
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
max14001_get_data_raw
int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data)
Get adc data.
Definition: max14001.c:641
max14001_init_config
int max14001_init_config(struct max14001_dev *dev)
Initialize the configurations of device.
Definition: max14001.c:222
max14001_ecrcl_config
int max14001_ecrcl_config(struct max14001_dev *dev, bool mode)
Enable CRCL fault.
Definition: max14001.c:391
max14001_ena_config
int max14001_ena_config(struct max14001_dev *dev, bool enable)
Enable/Disable field-side current sink.
Definition: max14001.c:511
no_os_error.h
Error codes definition.
max14001_iinr_config
int max14001_iinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush current.
Definition: max14001.c:571
max14001_ft_config
int max14001_ft_config(struct max14001_dev *dev, enum max14001_ft mode)
Set number of readings averaged in the ADC filter.
Definition: max14001.c:624
max14001_du_config
int max14001_du_config(struct max14001_dev *dev, enum max14001_du mode)
Set maximum duty cycle for inrush current over the last 10 seconds.
Definition: max14001.c:589
max14001_get_data_raw
int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data)
Get adc data.
Definition: max14001.c:641
max14001_reg_update
int max14001_reg_update(struct max14001_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
SPI write to device using a mask.
Definition: max14001.c:125
max14001_init_config
int max14001_init_config(struct max14001_dev *dev)
Initialize the configurations of device.
Definition: max14001.c:222
max14001_tinr_config
int max14001_tinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush time.
Definition: max14001.c:556
max14001_ecrcl_config
int max14001_ecrcl_config(struct max14001_dev *dev, bool mode)
Enable CRCL fault.
Definition: max14001.c:391
max14001_read
int max14001_read(struct max14001_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Read from device.
Definition: max14001.c:55
MAX14001_EXRF_CFG_MASK
#define MAX14001_EXRF_CFG_MASK
Definition: max14001.h:135
DUTY_6P3
@ DUTY_6P3
Definition: max14001.h:207
max14001_ecom_config
int max14001_ecom_config(struct max14001_dev *dev, bool mode)
Enable COM fault.
Definition: max14001.c:406
max14001_exrf_config
int max14001_exrf_config(struct max14001_dev *dev, bool mode)
Selects the voltage reference source for the ADC.
Definition: max14001.c:526
MAX14001_ECRCF_FLTEN_MASK
#define MAX14001_ECRCF_FLTEN_MASK
Definition: max14001.h:116
max14001_tinr_config
int max14001_tinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush time.
Definition: max14001.c:556
max14001_reg_reset
int max14001_reg_reset(struct max14001_dev *dev)
Software reset. Restores all registers to their POR value.
Definition: max14001.c:324
max14001_inpls_reset
int max14001_inpls_reset(struct max14001_dev *dev)
Trigger an inrush current pulse.
Definition: max14001.c:334
MAX14001_TINR_INRP_MODE
#define MAX14001_TINR_INRP_MODE(a)
Definition: max14001.h:126
max14001_write_config_verify
int max14001_write_config_verify(struct max14001_dev *dev, uint8_t reg_addr, uint16_t mask, uint16_t data)
Write to config registers then to corresponding verification register.
Definition: max14001.c:156
max14001_ecom_config
int max14001_ecom_config(struct max14001_dev *dev, bool mode)
Enable COM fault.
Definition: max14001.c:406
max14001_ena_config
int max14001_ena_config(struct max14001_dev *dev, bool enable)
Enable/Disable field-side current sink.
Definition: max14001.c:511
AVERAGE_4_READINGS
@ AVERAGE_4_READINGS
Definition: max14001.h:217
REVERSE_UINT16
#define REVERSE_UINT16(x)
Definition: max14001.h:150
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
max14001_ecrcf_config
int max14001_ecrcf_config(struct max14001_dev *dev, bool mode)
Enable CRCF fault.
Definition: max14001.c:376
MAX14001_DU_INRP_MODE
#define MAX14001_DU_INRP_MODE(a)
Definition: max14001.h:128
DUTY_1P6
@ DUTY_1P6
Definition: max14001.h:205
max14001_remove
int max14001_remove(struct max14001_dev *dev)
Free the resources allocated by max14001_init().
Definition: max14001.c:668
MAX14001_REG_READ
#define MAX14001_REG_READ(x)
Definition: max14001.h:48
MAX14001_ESPI_FLTEN_MASK
#define MAX14001_ESPI_FLTEN_MASK
Definition: max14001.h:113
max14001_remove
int max14001_remove(struct max14001_dev *dev)
Free the resources allocated by max14001_init().
Definition: max14001.c:668
MAX14001_INRP_REG
#define MAX14001_INRP_REG
Definition: max14001.h:68
max14001_einrd_config
int max14001_einrd_config(struct max14001_dev *dev, bool mode)
Enable INRD fault.
Definition: max14001.c:436
max14001_write
int max14001_write(struct max14001_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Write to device.
Definition: max14001.c:97
max14001.h
Implementation of max14001.h.
max14001_espi_config
int max14001_espi_config(struct max14001_dev *dev, bool mode)
Enable SPI fault.
Definition: max14001.c:421
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
max14001_get_data_filtered
int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data)
Get filtered adc data.
Definition: max14001.c:655
max14001_eadc_config
int max14001_eadc_config(struct max14001_dev *dev, bool mode)
Enable ADC fault.
Definition: max14001.c:451
max14001_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: max14001.h:228
MAX14001_ENBL_REG
#define MAX14001_ENBL_REG
Definition: max14001.h:70
MAX14001_IINR_INRP_MASK
#define MAX14001_IINR_INRP_MASK
Definition: max14001.h:123
MAX14001_ECRCL_FLTEN_MASK
#define MAX14001_ECRCL_FLTEN_MASK
Definition: max14001.h:115
MAX14001_EADC_FLTEN_MASK
#define MAX14001_EADC_FLTEN_MASK
Definition: max14001.h:111
VERIFICATION_REG
#define VERIFICATION_REG(x)
Definition: max14001.h:53
MAX14001_INPLS_MASK
#define MAX14001_INPLS_MASK
Definition: max14001.h:93
max14001_full_reset
int max14001_full_reset(struct max14001_dev *dev)
Full reset, same effect as power on reset.
Definition: max14001.c:314
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
DUTY_OFF
@ DUTY_OFF
Definition: max14001.h:204
MAX14001_IBIAS_CFG_MASK
#define MAX14001_IBIAS_CFG_MASK
Definition: max14001.h:133
max14001_ibias_config
int max14001_ibias_config(struct max14001_dev *dev, float mode)
Configure 4-bit bias current.
Definition: max14001.c:606
max14001_fast_config
int max14001_fast_config(struct max14001_dev *dev, bool fast)
Enable/Disable fast inrush mode.
Definition: max14001.c:481
MAX14001_DYEN_FLTEN_MASK
#define MAX14001_DYEN_FLTEN_MASK
Definition: max14001.h:110
MAX14001_EFET_FLTEN_MASK
#define MAX14001_EFET_FLTEN_MASK
Definition: max14001.h:117
max14001_dyen_config
int max14001_dyen_config(struct max14001_dev *dev, bool mode)
Enable dynamic FAULT signal.
Definition: max14001.c:466
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
max14001_efet_config
int max14001_efet_config(struct max14001_dev *dev, bool mode)
Enable FET fault.
Definition: max14001.c:361
FILTER_OFF
@ FILTER_OFF
Definition: max14001.h:215
no_os_gpio.h
Header file of GPIO Interface.
max14001_fast_config
int max14001_fast_config(struct max14001_dev *dev, bool fast)
Enable/Disable fast inrush mode.
Definition: max14001.c:481
max14001_eadc_config
int max14001_eadc_config(struct max14001_dev *dev, bool mode)
Enable ADC fault.
Definition: max14001.c:451
MAX14001_FLTEN_REG
#define MAX14001_FLTEN_REG
Definition: max14001.h:63
MAX14001_ENBLV_REG
#define MAX14001_ENBLV_REG
Definition: max14001.h:80
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
max14001_reg_reset
int max14001_reg_reset(struct max14001_dev *dev)
Software reset. Restores all registers to their POR value.
Definition: max14001.c:324
no_os_util.h
Header file of utility functions.
MAX14001_EMV_FLTEN_MASK
#define MAX14001_EMV_FLTEN_MASK
Definition: max14001.h:118
MAX14001_FADC_REG
#define MAX14001_FADC_REG
Definition: max14001.h:61
max14001_espi_config
int max14001_espi_config(struct max14001_dev *dev, bool mode)
Enable SPI fault.
Definition: max14001.c:421
max14001_init_param
Definition: max14001.h:226
max14001_exti_config
int max14001_exti_config(struct max14001_dev *dev, bool mode)
Current source connection.
Definition: max14001.c:541
max14001_dyen_config
int max14001_dyen_config(struct max14001_dev *dev, bool mode)
Enable dynamic FAULT signal.
Definition: max14001.c:466
max14001_efet_config
int max14001_efet_config(struct max14001_dev *dev, bool mode)
Enable FET fault.
Definition: max14001.c:361
MAX14001_RSET_MASK
#define MAX14001_RSET_MASK
Definition: max14001.h:87
DUTY_3P1
@ DUTY_3P1
Definition: max14001.h:206
MAX14001_FAST_CFG_MASK
#define MAX14001_FAST_CFG_MASK
Definition: max14001.h:139
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140