no-OS
max14001.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef __MAX14001_H__
40 #define __MAX14001_H__
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 #include <stdint.h>
46 #include <stdbool.h>
47 #include "no_os_spi.h"
48 #include "no_os_gpio.h"
49 #include "no_os_util.h"
50 
51 /******************************************************************************/
52 /********************** Macros and Constants Definitions **********************/
53 /******************************************************************************/
54 #define MAX14001_REG_READ(x) (((x) << 11) & NO_OS_GENMASK(15, 11))
55 #define MAX14001_REG_WRITE(x,y) (MAX14001_REG_READ(x) | \
56  NO_OS_BIT(10) | \
57  (y & MAX14001_REG_DATA_MASK))
58 #define MAX14001_REG_DATA_MASK NO_OS_GENMASK(9, 0)
59 #define VERIFICATION_REG(x) ((x) + 0x10)
60 #define MAX14001_SPI_REG_WRITE_ENABLE 0x294
61 #define MAX14001_SPI_REG_WRITE_DISABLE 0x000
62 
63 /*
64  * MAX14001 registers definition
65  */
66 #define MAX14001_ADC_REG 0x00
67 #define MAX14001_FADC_REG 0x01
68 #define MAX14001_FLAGS_REG 0x02
69 #define MAX14001_FLTEN_REG 0x03
70 #define MAX14001_THL_REG 0x04
71 #define MAX14001_THU_REG 0x05
72 #define MAX14001_INRR_REG 0x06
73 #define MAX14001_INRT_REG 0x07
74 #define MAX14001_INRP_REG 0x08
75 #define MAX14001_CFG_REG 0x09
76 #define MAX14001_ENBL_REG 0x0A
77 #define MAX14001_ACT_REG 0x0B
78 #define MAX14001_WEN_REG 0x0C
79 #define MAX14001_FLTV_REG 0x13
80 #define MAX14001_THLV_REG 0x14
81 #define MAX14001_THUV_REG 0x15
82 #define MAX14001_INRRV_REG 0x16
83 #define MAX14001_INRTV_REG 0x17
84 #define MAX14001_INRPV_REG 0x18
85 #define MAX14001_CFGV_REG 0x19
86 #define MAX14001_ENBLV_REG 0x1A
87 
88 /*
89  * MAX14001_ACT_REG
90  */
91 
93 #define MAX14001_RSET_MASK NO_OS_BIT(7)
94 
96 #define MAX14001_SRES_MASK NO_OS_BIT(6)
97 
99 #define MAX14001_INPLS_MASK NO_OS_BIT(9)
100 
101 /*
102  * MAX14001_FLAGS_REG
103  */
104 #define MAX14001_ADC_FLAG_MASK NO_OS_BIT(1)
105 #define MAX14001_INRD_FLAG_MASK NO_OS_BIT(2)
106 #define MAX14001_SPI_FLAG_MASK NO_OS_BIT(3)
107 #define MAX14001_COM_FLAG_MASK NO_OS_BIT(4)
108 #define MAX14001_CRCL_FLAG_MASK NO_OS_BIT(5)
109 #define MAX14001_CRCF_FLAG_MASK NO_OS_BIT(6)
110 #define MAX14001_FET_FLAG_MASK NO_OS_BIT(7)
111 #define MAX14001_MV_FLAG_MASK NO_OS_BIT(8)
112 
113 /*
114  * MAX14001_FLTEN_REG
115  */
116 #define MAX14001_DYEN_FLTEN_MASK NO_OS_BIT(0)
117 #define MAX14001_EADC_FLTEN_MASK NO_OS_BIT(1)
118 #define MAX14001_EINRD_FLTEN_MASK NO_OS_BIT(2)
119 #define MAX14001_ESPI_FLTEN_MASK NO_OS_BIT(3)
120 #define MAX14001_ECOM_FLTEN_MASK NO_OS_BIT(4)
121 #define MAX14001_ECRCL_FLTEN_MASK NO_OS_BIT(5)
122 #define MAX14001_ECRCF_FLTEN_MASK NO_OS_BIT(6)
123 #define MAX14001_EFET_FLTEN_MASK NO_OS_BIT(7)
124 #define MAX14001_EMV_FLTEN_MASK NO_OS_BIT(8)
125 
126 /*
127  * MAX14001_INRP_REG
128  */
129 #define MAX14001_IINR_INRP_MASK NO_OS_GENMASK(9, 6)
130 #define MAX14001_IINR_INRP_MODE(a) ((MAX14001_IINR(a)) << 6)
131 #define MAX14001_TINR_INRP_MASK NO_OS_GENMASK(5, 2)
132 #define MAX14001_TINR_INRP_MODE(a) ((MAX14001_TINR(a)) << 2)
133 #define MAX14001_DU_INRP_MASK NO_OS_GENMASK(1, 0)
134 #define MAX14001_DU_INRP_MODE(a) (((a) & 0x3) << 0)
135 
136 /*
137  * MAX14001_CFG_REG
138  */
139 #define MAX14001_IBIAS_CFG_MASK NO_OS_GENMASK(9, 6)
140 #define MAX14001_IBIAS_CFG_MODE(a) ((MAX14001_IBIAS(a)) << 6)
141 #define MAX14001_EXRF_CFG_MASK NO_OS_BIT(5)
142 #define MAX14001_EXTI_CFG_MASK NO_OS_BIT(4)
143 #define MAX14001_FT_CFG_MASK NO_OS_GENMASK(3, 2)
144 #define MAX14001_FT_CFG_MODE(a) (((a) & 0x3) << 2)
145 #define MAX14001_FAST_CFG_MASK NO_OS_BIT(1)
146 #define MAX14001_IRAW_CFG_MASK NO_OS_BIT(0)
147 
148 /*
149  * MAX14001_ENBL_REG
150  */
151 #define MAX14001_ENA_ENBL_MASK NO_OS_BIT(4)
152 
153 /*
154  * 16-bit bitswap
155  */
156 #define REVERSE_UINT16(x) ((((x >> 0) & 1) << 15) | \
157  (((x >> 1) & 1 ) << 14) | \
158  (((x >> 2) & 1 ) << 13) | \
159  (((x >> 3) & 1 ) << 12) | \
160  (((x >> 4) & 1 ) << 11) | \
161  (((x >> 5) & 1 ) << 10) | \
162  (((x >> 6) & 1 ) << 9) | \
163  (((x >> 7) & 1 ) << 8) | \
164  (((x >> 8) & 1 ) << 7) | \
165  (((x >> 9) & 1 ) << 6) | \
166  (((x >> 10) & 1) << 5) | \
167  (((x >> 11) & 1) << 4) | \
168  (((x >> 12) & 1) << 3) | \
169  (((x >> 13) & 1) << 2) | \
170  (((x >> 14) & 1) << 1) | \
171  (((x >> 15) & 1) << 0))
172 
173 /*
174  * MAX14001 Quantization of configuration inputs
175  */
176 #define MAX14001_CFG_MIN 0
177 #define MAX14001_CFG_MAX 0xF
178 #define MAX14001_CFG_Q(x,y) (no_os_clamp( \
179  NO_OS_DIV_ROUND_CLOSEST(x,y), \
180  (MAX14001_CFG_MIN),(MAX14001_CFG_MAX)))
181 /*
182  * MAX14001 TINR input to bits equivelent
183  */
184 #define MAX14001_TINR_INC 8 //in terms of ms
185 #define MAX14001_TINR(x) MAX14001_CFG_Q(x, MAX14001_TINR_INC)
186 
187 /*
188  * MAX14001 IINR input to bits equivelent
189  */
190 #define MAX14001_IINR_INC 7 //in terms of mA
191 #define MAX14001_IINR(x) MAX14001_CFG_Q(x, MAX14001_IINR_INC)
192 
193 /*
194  * MAX14001 IBIAS input to bits equivelent
195  */
196 #define MAX14001_MUL 100
197 #define MAX14001_IBIAS_INC 25 //increment of 0.25mA
198 #define MAX14001_IBIAS(x) MAX14001_CFG_Q((int)(x*MAX14001_MUL), \
199  MAX14001_IBIAS_INC)
200 
201 /******************************************************************************/
202 /*************************** Types Declarations *******************************/
203 /******************************************************************************/
204 
210  DUTY_OFF, //default, duty cycle limiting function off
214 };
215 
221  FILTER_OFF, //default, filtering is off
225 };
226 
227 struct max14001_dev {
230 };
231 
235 };
236 
238 int max14001_read(struct max14001_dev *dev,
239  uint8_t reg_addr,
240  uint16_t *reg_data);
241 
243 int max14001_write(struct max14001_dev *dev,
244  uint8_t reg_addr,
245  uint16_t reg_data);
246 
248 int max14001_reg_update(struct max14001_dev *dev,
249  uint8_t reg_addr,
250  uint16_t mask,
251  uint16_t data);
252 
255  uint8_t reg_addr,
256  uint16_t mask,
257  uint16_t data);
258 
260 int max14001_init(struct max14001_dev **device,
262 
264 int max14001_init_config(struct max14001_dev *dev);
265 
267 int max14001_wen(struct max14001_dev *dev, bool write_enable);
268 
270 int max14001_full_reset(struct max14001_dev *dev);
271 
273 int max14001_reg_reset(struct max14001_dev *dev);
274 
276 int max14001_inpls_reset(struct max14001_dev *dev);
277 
279 int max14001_fast_config(struct max14001_dev *dev,
280  bool fast);
281 
283 int max14001_iraw_config(struct max14001_dev *dev,
284  bool raw_data);
285 
287 int max14001_emv_config(struct max14001_dev *dev,
288  bool mode);
289 
291 int max14001_efet_config(struct max14001_dev *dev,
292  bool mode);
293 
295 int max14001_ecrcf_config(struct max14001_dev *dev,
296  bool mode);
297 
299 int max14001_ecrcl_config(struct max14001_dev *dev,
300  bool mode);
301 
303 int max14001_ecom_config(struct max14001_dev *dev,
304  bool mode);
305 
307 int max14001_espi_config(struct max14001_dev *dev,
308  bool mode);
309 
311 int max14001_einrd_config(struct max14001_dev *dev,
312  bool mode);
313 
315 int max14001_eadc_config(struct max14001_dev *dev,
316  bool mode);
317 
319 int max14001_dyen_config(struct max14001_dev *dev,
320  bool mode);
321 
323 int max14001_ena_config(struct max14001_dev *dev,
324  bool enable);
325 
327 int max14001_exrf_config(struct max14001_dev *dev,
328  bool mode);
329 
331 int max14001_exti_config(struct max14001_dev *dev,
332  bool mode);
333 
335 int max14001_tinr_config(struct max14001_dev *dev,
336  int mode);
337 
339 int max14001_iinr_config(struct max14001_dev *dev,
340  int mode);
341 
343 int max14001_du_config(struct max14001_dev *dev,
344  enum max14001_du mode);
345 
347 int max14001_ibias_config(struct max14001_dev *dev,
348  float mode);
349 
351 int max14001_ft_config(struct max14001_dev *dev,
352  enum max14001_ft mode);
353 
355 int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data);
356 
358 int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data);
359 
361 int max14001_remove(struct max14001_dev *dev);
362 
363 #endif /* __MAX14001_H__ */
MAX14001_MV_FLAG_MASK
#define MAX14001_MV_FLAG_MASK
Definition: max14001.h:111
max14001_wen
int max14001_wen(struct max14001_dev *dev, bool write_enable)
Enable write to registers.
Definition: max14001.c:308
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:151
no_os_alloc.h
AVERAGE_8_READINGS
@ AVERAGE_8_READINGS
Definition: max14001.h:224
max14001_iraw_config
int max14001_iraw_config(struct max14001_dev *dev, bool raw_data)
Selects Inrush comparator input multiplexer.
Definition: max14001.c:502
MAX14001_CFG_REG
#define MAX14001_CFG_REG
Definition: max14001.h:75
MAX14001_REG_WRITE
#define MAX14001_REG_WRITE(x, y)
Definition: max14001.h:55
max14001_wen
int max14001_wen(struct max14001_dev *dev, bool enable)
Enable write to registers.
Definition: max14001.c:308
MAX14001_ADC_REG
#define MAX14001_ADC_REG
Definition: max14001.h:66
MAX14001_FT_CFG_MODE
#define MAX14001_FT_CFG_MODE(a)
Definition: max14001.h:144
MAX14001_WEN_REG
#define MAX14001_WEN_REG
Definition: max14001.h:78
MAX14001_REG_DATA_MASK
#define MAX14001_REG_DATA_MASK
Definition: max14001.h:58
max14001_iraw_config
int max14001_iraw_config(struct max14001_dev *dev, bool raw_data)
Selects Inrush comparator input multiplexer.
Definition: max14001.c:502
max14001_dev
Definition: max14001.h:227
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:165
max14001_get_data_filtered
int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data)
Get filtered adc data.
Definition: max14001.c:661
no_os_spi.h
Header file of SPI Interface.
max14001_du
max14001_du
MAX14001 list of possible duty cycle modes.
Definition: max14001.h:209
MAX14001_EXTI_CFG_MASK
#define MAX14001_EXTI_CFG_MASK
Definition: max14001.h:142
max14001_ecrcf_config
int max14001_ecrcf_config(struct max14001_dev *dev, bool mode)
Enable CRCF fault.
Definition: max14001.c:382
MAX14001_FT_CFG_MASK
#define MAX14001_FT_CFG_MASK
Definition: max14001.h:143
max14001_iinr_config
int max14001_iinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush current.
Definition: max14001.c:577
MAX14001_IRAW_CFG_MASK
#define MAX14001_IRAW_CFG_MASK
Definition: max14001.h:146
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:630
max14001_full_reset
int max14001_full_reset(struct max14001_dev *dev)
Full reset, same effect as power on reset.
Definition: max14001.c:320
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:131
MAX14001_SRES_MASK
#define MAX14001_SRES_MASK
Definition: max14001.h:96
max14001_ibias_config
int max14001_ibias_config(struct max14001_dev *dev, float mode)
Configure 4-bit bias current.
Definition: max14001.c:612
MAX14001_SPI_REG_WRITE_ENABLE
#define MAX14001_SPI_REG_WRITE_ENABLE
Definition: max14001.h:60
MAX14001_ECOM_FLTEN_MASK
#define MAX14001_ECOM_FLTEN_MASK
Definition: max14001.h:120
no_os_delay.h
Header file of Delay functions.
MAX14001_IINR_INRP_MODE
#define MAX14001_IINR_INRP_MODE(a)
Definition: max14001.h:130
max14001_read
int max14001_read(struct max14001_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Read from device.
Definition: max14001.c:61
MAX14001_FLTV_REG
#define MAX14001_FLTV_REG
Definition: max14001.h:79
MAX14001_TINR_INRP_MASK
#define MAX14001_TINR_INRP_MASK
Definition: max14001.h:131
max14001_ft
max14001_ft
MAX14001 list of possible filtering modes.
Definition: max14001.h:220
max14001_init
int max14001_init(struct max14001_dev **device, struct max14001_init_param init_param)
Initialize the device.
Definition: max14001.c:196
no_os_spi_init_param::mode
enum no_os_spi_mode mode
Definition: no_os_spi.h:139
max14001_emv_config
int max14001_emv_config(struct max14001_dev *dev, bool mode)
Enable MV fault.
Definition: max14001.c:352
device
Definition: ad9361_util.h:75
max14001_inpls_reset
int max14001_inpls_reset(struct max14001_dev *dev)
Trigger an inrush current pulse.
Definition: max14001.c:340
max14001_einrd_config
int max14001_einrd_config(struct max14001_dev *dev, bool mode)
Enable INRD fault.
Definition: max14001.c:442
max14001_write
int max14001_write(struct max14001_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Write to device.
Definition: max14001.c:103
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:162
max14001_init
int max14001_init(struct max14001_dev **device, struct max14001_init_param init_param)
Initialize the device.
Definition: max14001.c:196
max14001_emv_config
int max14001_emv_config(struct max14001_dev *dev, bool mode)
Enable MV fault.
Definition: max14001.c:352
MAX14001_DU_INRP_MASK
#define MAX14001_DU_INRP_MASK
Definition: max14001.h:133
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:60
max14001_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: max14001.h:229
MAX14001_FLAGS_REG
#define MAX14001_FLAGS_REG
Definition: max14001.h:68
AVERAGE_2_READINGS
@ AVERAGE_2_READINGS
Definition: max14001.h:222
MAX14001_IBIAS_CFG_MODE
#define MAX14001_IBIAS_CFG_MODE(a)
Definition: max14001.h:140
max14001_exrf_config
int max14001_exrf_config(struct max14001_dev *dev, bool mode)
Selects the voltage reference source for the ADC.
Definition: max14001.c:532
MAX14001_ACT_REG
#define MAX14001_ACT_REG
Definition: max14001.h:77
max14001_exti_config
int max14001_exti_config(struct max14001_dev *dev, bool mode)
Current source connection.
Definition: max14001.c:547
MAX14001_EINRD_FLTEN_MASK
#define MAX14001_EINRD_FLTEN_MASK
Definition: max14001.h:118
MAX14001_SPI_REG_WRITE_DISABLE
#define MAX14001_SPI_REG_WRITE_DISABLE
Definition: max14001.h:61
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:595
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
max14001_get_data_raw
int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data)
Get adc data.
Definition: max14001.c:647
max14001_init_config
int max14001_init_config(struct max14001_dev *dev)
Initialize the configurations of device.
Definition: max14001.c:228
max14001_ecrcl_config
int max14001_ecrcl_config(struct max14001_dev *dev, bool mode)
Enable CRCL fault.
Definition: max14001.c:397
max14001_ena_config
int max14001_ena_config(struct max14001_dev *dev, bool enable)
Enable/Disable field-side current sink.
Definition: max14001.c:517
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:577
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:630
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:595
max14001_get_data_raw
int max14001_get_data_raw(struct max14001_dev *dev, uint16_t *data)
Get adc data.
Definition: max14001.c:647
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:131
max14001_init_config
int max14001_init_config(struct max14001_dev *dev)
Initialize the configurations of device.
Definition: max14001.c:228
max14001_tinr_config
int max14001_tinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush time.
Definition: max14001.c:562
max14001_ecrcl_config
int max14001_ecrcl_config(struct max14001_dev *dev, bool mode)
Enable CRCL fault.
Definition: max14001.c:397
max14001_read
int max14001_read(struct max14001_dev *dev, uint8_t reg_addr, uint16_t *reg_data)
Read from device.
Definition: max14001.c:61
MAX14001_EXRF_CFG_MASK
#define MAX14001_EXRF_CFG_MASK
Definition: max14001.h:141
DUTY_6P3
@ DUTY_6P3
Definition: max14001.h:213
max14001_ecom_config
int max14001_ecom_config(struct max14001_dev *dev, bool mode)
Enable COM fault.
Definition: max14001.c:412
max14001_exrf_config
int max14001_exrf_config(struct max14001_dev *dev, bool mode)
Selects the voltage reference source for the ADC.
Definition: max14001.c:532
MAX14001_ECRCF_FLTEN_MASK
#define MAX14001_ECRCF_FLTEN_MASK
Definition: max14001.h:122
max14001_tinr_config
int max14001_tinr_config(struct max14001_dev *dev, int mode)
Configure 4-bit inrush time.
Definition: max14001.c:562
max14001_reg_reset
int max14001_reg_reset(struct max14001_dev *dev)
Software reset. Restores all registers to their POR value.
Definition: max14001.c:330
max14001_inpls_reset
int max14001_inpls_reset(struct max14001_dev *dev)
Trigger an inrush current pulse.
Definition: max14001.c:340
MAX14001_TINR_INRP_MODE
#define MAX14001_TINR_INRP_MODE(a)
Definition: max14001.h:132
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:162
max14001_ecom_config
int max14001_ecom_config(struct max14001_dev *dev, bool mode)
Enable COM fault.
Definition: max14001.c:412
max14001_ena_config
int max14001_ena_config(struct max14001_dev *dev, bool enable)
Enable/Disable field-side current sink.
Definition: max14001.c:517
AVERAGE_4_READINGS
@ AVERAGE_4_READINGS
Definition: max14001.h:223
REVERSE_UINT16
#define REVERSE_UINT16(x)
Definition: max14001.h:156
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
max14001_ecrcf_config
int max14001_ecrcf_config(struct max14001_dev *dev, bool mode)
Enable CRCF fault.
Definition: max14001.c:382
MAX14001_DU_INRP_MODE
#define MAX14001_DU_INRP_MODE(a)
Definition: max14001.h:134
DUTY_1P6
@ DUTY_1P6
Definition: max14001.h:211
max14001_remove
int max14001_remove(struct max14001_dev *dev)
Free the resources allocated by max14001_init().
Definition: max14001.c:674
MAX14001_REG_READ
#define MAX14001_REG_READ(x)
Definition: max14001.h:54
MAX14001_ESPI_FLTEN_MASK
#define MAX14001_ESPI_FLTEN_MASK
Definition: max14001.h:119
max14001_remove
int max14001_remove(struct max14001_dev *dev)
Free the resources allocated by max14001_init().
Definition: max14001.c:674
MAX14001_INRP_REG
#define MAX14001_INRP_REG
Definition: max14001.h:74
max14001_einrd_config
int max14001_einrd_config(struct max14001_dev *dev, bool mode)
Enable INRD fault.
Definition: max14001.c:442
max14001_write
int max14001_write(struct max14001_dev *dev, uint8_t reg_addr, uint16_t reg_data)
Write to device.
Definition: max14001.c:103
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:427
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:75
max14001_get_data_filtered
int max14001_get_data_filtered(struct max14001_dev *dev, uint16_t *data)
Get filtered adc data.
Definition: max14001.c:661
max14001_eadc_config
int max14001_eadc_config(struct max14001_dev *dev, bool mode)
Enable ADC fault.
Definition: max14001.c:457
max14001_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: max14001.h:234
MAX14001_ENBL_REG
#define MAX14001_ENBL_REG
Definition: max14001.h:76
MAX14001_IINR_INRP_MASK
#define MAX14001_IINR_INRP_MASK
Definition: max14001.h:129
MAX14001_ECRCL_FLTEN_MASK
#define MAX14001_ECRCL_FLTEN_MASK
Definition: max14001.h:121
MAX14001_EADC_FLTEN_MASK
#define MAX14001_EADC_FLTEN_MASK
Definition: max14001.h:117
VERIFICATION_REG
#define VERIFICATION_REG(x)
Definition: max14001.h:59
MAX14001_INPLS_MASK
#define MAX14001_INPLS_MASK
Definition: max14001.h:99
max14001_full_reset
int max14001_full_reset(struct max14001_dev *dev)
Full reset, same effect as power on reset.
Definition: max14001.c:320
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
DUTY_OFF
@ DUTY_OFF
Definition: max14001.h:210
MAX14001_IBIAS_CFG_MASK
#define MAX14001_IBIAS_CFG_MASK
Definition: max14001.h:139
max14001_ibias_config
int max14001_ibias_config(struct max14001_dev *dev, float mode)
Configure 4-bit bias current.
Definition: max14001.c:612
max14001_fast_config
int max14001_fast_config(struct max14001_dev *dev, bool fast)
Enable/Disable fast inrush mode.
Definition: max14001.c:487
MAX14001_DYEN_FLTEN_MASK
#define MAX14001_DYEN_FLTEN_MASK
Definition: max14001.h:116
MAX14001_EFET_FLTEN_MASK
#define MAX14001_EFET_FLTEN_MASK
Definition: max14001.h:123
max14001_dyen_config
int max14001_dyen_config(struct max14001_dev *dev, bool mode)
Enable dynamic FAULT signal.
Definition: max14001.c:472
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:122
max14001_efet_config
int max14001_efet_config(struct max14001_dev *dev, bool mode)
Enable FET fault.
Definition: max14001.c:367
FILTER_OFF
@ FILTER_OFF
Definition: max14001.h:221
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:487
max14001_eadc_config
int max14001_eadc_config(struct max14001_dev *dev, bool mode)
Enable ADC fault.
Definition: max14001.c:457
MAX14001_FLTEN_REG
#define MAX14001_FLTEN_REG
Definition: max14001.h:69
MAX14001_ENBLV_REG
#define MAX14001_ENBLV_REG
Definition: max14001.h:86
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:58
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:330
no_os_util.h
Header file of utility functions.
MAX14001_EMV_FLTEN_MASK
#define MAX14001_EMV_FLTEN_MASK
Definition: max14001.h:124
MAX14001_FADC_REG
#define MAX14001_FADC_REG
Definition: max14001.h:67
max14001_espi_config
int max14001_espi_config(struct max14001_dev *dev, bool mode)
Enable SPI fault.
Definition: max14001.c:427
max14001_init_param
Definition: max14001.h:232
max14001_exti_config
int max14001_exti_config(struct max14001_dev *dev, bool mode)
Current source connection.
Definition: max14001.c:547
max14001_dyen_config
int max14001_dyen_config(struct max14001_dev *dev, bool mode)
Enable dynamic FAULT signal.
Definition: max14001.c:472
max14001_efet_config
int max14001_efet_config(struct max14001_dev *dev, bool mode)
Enable FET fault.
Definition: max14001.c:367
MAX14001_RSET_MASK
#define MAX14001_RSET_MASK
Definition: max14001.h:93
DUTY_3P1
@ DUTY_3P1
Definition: max14001.h:212
MAX14001_FAST_CFG_MASK
#define MAX14001_FAST_CFG_MASK
Definition: max14001.h:145
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131