no-OS
max42500.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef __MAX42500_H__
41 #define __MAX42500_H__
42 
43 #include <stdint.h>
44 #include <stdbool.h>
45 #include "no_os_i2c.h"
46 #include "no_os_gpio.h"
47 
48 #define MAX42500_REG_ID 0x00
49 #define MAX42500_REG_CONFIG1 0x01
50 #define MAX42500_REG_CONFIG2 0x02
51 #define MAX42500_REG_VMON 0x03
52 #define MAX42500_REG_RSTMAP 0x04
53 #define MAX42500_REG_STATOV 0x05
54 #define MAX42500_REG_STATUV 0x06
55 #define MAX42500_REG_STATOFF 0x07
56 #define MAX42500_REG_VIN1 0x08
57 #define MAX42500_REG_VIN2 0x09
58 #define MAX42500_REG_VIN3 0x0A
59 #define MAX42500_REG_VIN4 0x0B
60 #define MAX42500_REG_VIN5 0x0C
61 #define MAX42500_REG_VINO6 0x0D
62 #define MAX42500_REG_VINU6 0x0E
63 #define MAX42500_REG_VINO7 0x0F
64 #define MAX42500_REG_VINU7 0x10
65 #define MAX42500_REG_OVUV1 0x11
66 #define MAX42500_REG_OVUV2 0x12
67 #define MAX42500_REG_OVUV3 0x13
68 #define MAX42500_REG_OVUV4 0x14
69 #define MAX42500_REG_OVUV5 0x15
70 #define MAX42500_REG_FPSSTAT1 0x16
71 #define MAX42500_REG_FPSCFG1 0x17
72 #define MAX42500_REG_UTIME1 0x18
73 #define MAX42500_REG_UTIME2 0x19
74 #define MAX42500_REG_UTIME3 0x1A
75 #define MAX42500_REG_UTIME4 0x1B
76 #define MAX42500_REG_UTIME5 0x1C
77 #define MAX42500_REG_UTIME6 0x1D
78 #define MAX42500_REG_UTIME7 0x1E
79 #define MAX42500_REG_DTIME1 0x1F
80 #define MAX42500_REG_DTIME2 0x20
81 #define MAX42500_REG_DTIME3 0x21
82 #define MAX42500_REG_DTIME4 0x22
83 #define MAX42500_REG_DTIME5 0x23
84 #define MAX42500_REG_DTIME6 0x24
85 #define MAX42500_REG_DTIME7 0x25
86 #define MAX42500_REG_WDSTAT 0x26
87 #define MAX42500_REG_WDCDIV 0x27
88 #define MAX42500_REG_WDCFG1 0x28
89 #define MAX42500_REG_WDCFG2 0x29
90 #define MAX42500_REG_WDKEY 0x2A
91 #define MAX42500_REG_WDLOCK 0x2B
92 #define MAX42500_REG_RSTCTRL 0x2C
93 #define MAX42500_REG_CID 0x2D
94 
96 #define MAX42500_ADDR(x) (0x28 + (x))
97 #define MAX42500_SILICON_ID (0x30)
98 #define MAX42500_I2C_WR_FRAME_SIZE (4)
99 #define MAX42500_I2C_RD_FRAME_SIZE (5)
100 
102 #define MAX42500_VNOM_MAX_VM1_VM4 3.6875
103 #define MAX42500_VNOM_MAX_VM5 5.6
104 #define MAX42500_MIN_VNOM 0.5
105 #define MAX42500_VNOM_STEP_VM1_VM4 0.0125
106 #define MAX42500_VNOM_STEP_VM5 0.02
107 
109 #define MAX42500_MAX_THRESH_VM1_VM5 10
110 #define MAX42500_MIN_THRESH_VM1_VM5 2.5
111 #define MAX42500_MAX_THRESH_VM6_V7 1.775
112 #define MAX42500_MIN_THRESH_VM6_V7 0.5
113 
114 /* MAX42500 device state */
120 };
121 
122 /* MAX42500 voltage monitor input */
132 };
133 
134 /* MAX42500 comparator status */
140 };
141 
142 /* MAX42500 watchdog mode */
147 };
148 
149 /* MAX42500 reset hold/active timeout time. */
156 };
157 
162  /* I2C */
164  /* EN0 pin GPIO */
166  /* EN1 pin GPIO */
168  /* ADDR pin GPIO */
170  /* ADDR selection */
171  uint8_t addr_sel;
172  /* Packet error checking enable */
173  uint8_t pece;
174  /* Enabled voltage monitor inputs */
175  uint8_t vmon_en;
176  /* Voltage monitor power down enable */
177  uint8_t vmon_vmpd;
178  /* Enabled voltage monitor reset mapping */
179  uint8_t reset_map;
180  /* Watchdog mode */
182  /* Watchdog clock div */
183  uint8_t wd_cdiv;
184  /* Watchdog close window */
185  uint8_t wd_close;
186  /* Watchdog open window */
187  uint8_t wd_open;
188  /* Watchdog first update window */
189  uint8_t wd_1ud;
190  /* Watchdog enable */
191  uint8_t wd_en;
192 };
193 
197 struct max42500_dev {
198  /* I2C */
200  /* EN0 pin GPIO */
202  /* EN1 pin GPIO */
204  /* ADDR pin GPIO */
206  /* ADDR selection */
207  uint8_t addr_sel;
208  /* Packet error checking enable */
209  uint8_t pece;
210  /* Enabled voltage monitor inputs */
211  uint8_t vmon_en;
212  /* Voltage monitor power down enable */
213  uint8_t vmon_vmpd;
214  /* Enabled voltage monitor reset mapping */
215  uint8_t reset_map;
216  /* Watchdog mode */
218  /* Watchdog clock div */
219  uint8_t wd_cdiv;
220  /* Watchdog close window */
221  uint8_t wd_close;
222  /* Watchdog open window */
223  uint8_t wd_open;
224  /* Watchdog first update window */
225  uint8_t wd_1ud;
226  /* Watchdog enable */
227  uint8_t wd_en;
228 };
229 
231 int max42500_set_state(struct max42500_dev *desc, enum max42500_state state);
232 
234 int max42500_reg_read(struct max42500_dev *desc,
235  uint8_t reg_addr,
236  uint8_t *reg_data);
237 
239 int max42500_reg_write(struct max42500_dev *desc,
240  uint8_t reg_addr,
241  uint8_t data);
242 
244 int max42500_reg_update(struct max42500_dev *desc,
245  uint8_t reg_addr,
246  uint8_t mask,
247  uint8_t data);
248 
251  enum max42500_vm_input vm_in,
252  float voltage);
253 
255 int max42500_get_comp_status(struct max42500_dev *desc,
256  enum max42500_vm_input vm_in,
257  enum max42500_comp_stat comp_stat,
258  uint8_t *status);
259 
261 int max42500_set_ov_thresh1(struct max42500_dev *desc,
262  enum max42500_vm_input vm_in,
263  float thresh);
264 
266 int max42500_set_ov_thresh2(struct max42500_dev *desc,
267  enum max42500_vm_input vm_in,
268  float thresh);
269 
271 int max42500_set_uv_thresh1(struct max42500_dev *desc,
272  enum max42500_vm_input vm_in,
273  float thresh);
274 
276 int max42500_set_uv_thresh2(struct max42500_dev *desc,
277  enum max42500_vm_input vm_in,
278  float thresh);
279 
282  enum max42500_vm_input vm_in,
283  uint8_t *timestamp);
284 
287  enum max42500_vm_input vm_in,
288  uint8_t *timestamp);
289 
291 int max42500_set_watchdog_enable(struct max42500_dev *desc, bool wd_enable);
292 
294 int max42500_set_watchdog_key(struct max42500_dev *desc);
295 
298  enum max42500_wd_rhld rhld);
299 
301 int max42500_init(struct max42500_dev **, struct max42500_init_param *);
302 
304 int max42500_remove(struct max42500_dev *);
305 
306 #endif // __MAX42500_H__
max42500_reg_write
int max42500_reg_write(struct max42500_dev *desc, uint8_t reg_addr, uint8_t data)
Write a raw value to a register.
Definition: max42500.c:163
MAX42500_VM4
@ MAX42500_VM4
Definition: max42500.h:127
no_os_alloc.h
max42500_dev::wd_open
uint8_t wd_open
Definition: max42500.h:223
max42500_wd_mode
max42500_wd_mode
Definition: max42500.h:143
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
max42500_init_param::en1_param
struct no_os_gpio_init_param en1_param
Definition: max42500.h:167
max42500_init_param::reset_map
uint8_t reset_map
Definition: max42500.h:179
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
MAX42500_WD_RHOLD_32_MS
@ MAX42500_WD_RHOLD_32_MS
Definition: max42500.h:154
max42500_dev::pece
uint8_t pece
Definition: max42500.h:209
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
max42500_set_watchdog_key
int max42500_set_watchdog_key(struct max42500_dev *desc)
Update the watchdog key based on the mode and current value.
Definition: max42500.c:589
max42500_set_ov_thresh1
int max42500_set_ov_thresh1(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the overvoltage threshold of VM1 to VM5.
Definition: max42500.c:304
max42500_state
max42500_state
Definition: max42500.h:115
NO_OS_GENMASK
#define NO_OS_GENMASK(h, l)
Definition: no_os_util.h:82
MAX42500_REG_VINU6
#define MAX42500_REG_VINU6
Definition: max42500.h:62
max42500_remove
int max42500_remove(struct max42500_dev *)
Free the device descriptor.
Definition: max42500.c:805
MAX42500_I2C_WR_FRAME_SIZE
#define MAX42500_I2C_WR_FRAME_SIZE
Definition: max42500.h:98
MAX42500_COMP_STAT_OFF
@ MAX42500_COMP_STAT_OFF
Definition: max42500.h:136
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
max42500_dev::addr_sel
uint8_t addr_sel
Definition: max42500.h:207
MAX42500_WD_MODE_SIMPLE
@ MAX42500_WD_MODE_SIMPLE
Definition: max42500.h:145
max42500_set_nominal_voltage
int max42500_set_nominal_voltage(struct max42500_dev *desc, enum max42500_vm_input vm_in, float voltage)
Set nominal voltage for VM1 to VM5.
Definition: max42500.c:217
max42500_init_param::vmon_en
uint8_t vmon_en
Definition: max42500.h:175
MAX42500_VM_MAX
@ MAX42500_VM_MAX
Definition: max42500.h:131
MAX42500_MIN_THRESH_VM1_VM5
#define MAX42500_MIN_THRESH_VM1_VM5
Definition: max42500.h:110
max42500_dev::wd_cdiv
uint8_t wd_cdiv
Definition: max42500.h:219
MAX42500_REG_VINO6
#define MAX42500_REG_VINO6
Definition: max42500.h:61
MAX42500_I2C_RD_FRAME_SIZE
#define MAX42500_I2C_RD_FRAME_SIZE
Definition: max42500.h:99
max42500_wd_rhld
max42500_wd_rhld
Definition: max42500.h:150
max42500_dev::wd_close
uint8_t wd_close
Definition: max42500.h:221
max42500_set_state
int max42500_set_state(struct max42500_dev *desc, enum max42500_state state)
Set device state through EN0 and EN1 pins.
Definition: max42500.c:71
max42500_vm_input
max42500_vm_input
Definition: max42500.h:123
max42500_set_watchdog_rhld
int max42500_set_watchdog_rhld(struct max42500_dev *desc, enum max42500_wd_rhld rhld)
Set watchdog reset hold time.
Definition: max42500.c:618
MAX42500_SILICON_ID
#define MAX42500_SILICON_ID
Definition: max42500.h:97
max42500_reg_read
int max42500_reg_read(struct max42500_dev *desc, uint8_t reg_addr, uint8_t *reg_data)
Read a raw value from a register.
Definition: max42500.c:114
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
max42500_dev::comm_desc
struct no_os_i2c_desc * comm_desc
Definition: max42500.h:199
MAX42500_REG_VMON
#define MAX42500_REG_VMON
Definition: max42500.h:51
max42500_get_power_down_timestamp
int max42500_get_power_down_timestamp(struct max42500_dev *desc, enum max42500_vm_input vm_in, uint8_t *timestamp)
Get the power-down timestamp for a specified voltage monitor input.
Definition: max42500.c:505
MAX42500_REG_WDKEY
#define MAX42500_REG_WDKEY
Definition: max42500.h:90
max42500_init_param::wd_mode
enum max42500_wd_mode wd_mode
Definition: max42500.h:181
MAX42500_VM6
@ MAX42500_VM6
Definition: max42500.h:129
max42500_init_param::en0_param
struct no_os_gpio_init_param en0_param
Definition: max42500.h:165
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
max42500_init_param::pece
uint8_t pece
Definition: max42500.h:173
max42500_reg_update
int max42500_reg_update(struct max42500_dev *desc, uint8_t reg_addr, uint8_t mask, uint8_t data)
Update a register's value based on a mask.
Definition: max42500.c:190
max42500_set_ov_thresh1
int max42500_set_ov_thresh1(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the overvoltage threshold of VM1 to VM5.
Definition: max42500.c:304
MAX42500_VM7
@ MAX42500_VM7
Definition: max42500.h:130
max42500_get_comp_status
int max42500_get_comp_status(struct max42500_dev *desc, enum max42500_vm_input vm_in, enum max42500_comp_stat comp_stat, uint8_t *status)
Get the status of the voltage monitor input.
Definition: max42500.c:264
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
MAX42500_REG_STATOFF
#define MAX42500_REG_STATOFF
Definition: max42500.h:55
MAX42500_COMP_STAT_MAX
@ MAX42500_COMP_STAT_MAX
Definition: max42500.h:139
max42500_init_param::wd_close
uint8_t wd_close
Definition: max42500.h:185
no_os_i2c_desc::slave_address
uint8_t slave_address
Definition: no_os_i2c.h:109
max42500_dev::vmon_vmpd
uint8_t vmon_vmpd
Definition: max42500.h:213
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max42500_init_param::addr_sel
uint8_t addr_sel
Definition: max42500.h:171
no_os_error.h
Error codes definition.
max42500_dev::vmon_en
uint8_t vmon_en
Definition: max42500.h:211
MAX42500_VM3
@ MAX42500_VM3
Definition: max42500.h:126
max42500_init_param
Initialization parameter for the device descriptor.
Definition: max42500.h:161
max42500_init_param::wd_open
uint8_t wd_open
Definition: max42500.h:187
max42500_set_watchdog_enable
int max42500_set_watchdog_enable(struct max42500_dev *desc, bool wd_enable)
Enable/Disable watchdog.
Definition: max42500.c:539
MAX42500_COMP_STAT_UV
@ MAX42500_COMP_STAT_UV
Definition: max42500.h:137
max42500_set_ov_thresh2
int max42500_set_ov_thresh2(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the overvoltage threshold of VM6 and VM7.
Definition: max42500.c:341
no_os_crc8_populate_msb
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
MAX42500_REG_WDCDIV
#define MAX42500_REG_WDCDIV
Definition: max42500.h:87
max42500_remove
int max42500_remove(struct max42500_dev *desc)
Free the device descriptor.
Definition: max42500.c:805
max42500_set_watchdog_rhld
int max42500_set_watchdog_rhld(struct max42500_dev *desc, enum max42500_wd_rhld rhld)
Set watchdog reset hold time.
Definition: max42500.c:618
MAX42500_VM2
@ MAX42500_VM2
Definition: max42500.h:125
MAX42500_VNOM_MAX_VM1_VM4
#define MAX42500_VNOM_MAX_VM1_VM4
Definition: max42500.h:102
MAX42500_REG_STATOV
#define MAX42500_REG_STATOV
Definition: max42500.h:53
max42500_get_power_down_timestamp
int max42500_get_power_down_timestamp(struct max42500_dev *desc, enum max42500_vm_input vm_in, uint8_t *timestamp)
Get the power-down timestamp for a specified voltage monitor input.
Definition: max42500.c:505
max42500_dev::reset_map
uint8_t reset_map
Definition: max42500.h:215
MAX42500_STATE_OFF
@ MAX42500_STATE_OFF
Definition: max42500.h:116
max42500_init_param::addr_param
struct no_os_gpio_init_param addr_param
Definition: max42500.h:169
MAX42500_REG_DTIME1
#define MAX42500_REG_DTIME1
Definition: max42500.h:79
max42500_init_param::vmon_vmpd
uint8_t vmon_vmpd
Definition: max42500.h:177
MAX42500_VM1
@ MAX42500_VM1
Definition: max42500.h:124
MAX42500_WD_RHOLD_8_MS
@ MAX42500_WD_RHOLD_8_MS
Definition: max42500.h:152
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
MAX42500_MIN_VNOM
#define MAX42500_MIN_VNOM
Definition: max42500.h:104
MAX42500_REG_UTIME1
#define MAX42500_REG_UTIME1
Definition: max42500.h:72
MAX42500_REG_VIN1
#define MAX42500_REG_VIN1
Definition: max42500.h:56
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
max42500_set_uv_thresh1
int max42500_set_uv_thresh1(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the undervoltage threshold of VM1 to VM5.
Definition: max42500.c:375
max42500_init_param::comm_param
struct no_os_i2c_init_param comm_param
Definition: max42500.h:163
MAX42500_MIN_THRESH_VM6_V7
#define MAX42500_MIN_THRESH_VM6_V7
Definition: max42500.h:112
max42500_init_param::wd_1ud
uint8_t wd_1ud
Definition: max42500.h:189
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
no_os_i2c.h
Header file of I2C Interface.
max42500_get_power_up_timestamp
int max42500_get_power_up_timestamp(struct max42500_dev *desc, enum max42500_vm_input vm_in, uint8_t *timestamp)
Get the power-up timestamp for a specified voltage monitor input.
Definition: max42500.c:468
MAX42500_WD_MODE_CH_RESP
@ MAX42500_WD_MODE_CH_RESP
Definition: max42500.h:144
MAX42500_REG_STATUV
#define MAX42500_REG_STATUV
Definition: max42500.h:54
MAX42500_REG_VINO7
#define MAX42500_REG_VINO7
Definition: max42500.h:63
max42500_set_uv_thresh2
int max42500_set_uv_thresh2(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the undervoltage threshold of VM6 and VM7.
Definition: max42500.c:410
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
MAX42500_REG_VIN5
#define MAX42500_REG_VIN5
Definition: max42500.h:60
MAX42500_VNOM_STEP_VM1_VM4
#define MAX42500_VNOM_STEP_VM1_VM4
Definition: max42500.h:105
MAX42500_VNOM_MAX_VM5
#define MAX42500_VNOM_MAX_VM5
Definition: max42500.h:103
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
no_os_crc8
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
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
MAX42500_WD_RHOLD_16_MS
@ MAX42500_WD_RHOLD_16_MS
Definition: max42500.h:153
MAX42500_REG_ID
#define MAX42500_REG_ID
Definition: max42500.h:48
MAX42500_WD_MODE_MAX
@ MAX42500_WD_MODE_MAX
Definition: max42500.h:146
max42500.h
Header file of MAX42500 Driver.
MAX42500_REG_CONFIG1
#define MAX42500_REG_CONFIG1
Definition: max42500.h:49
max42500_comp_stat
max42500_comp_stat
Definition: max42500.h:135
MAX42500_STATE_MAX
@ MAX42500_STATE_MAX
Definition: max42500.h:119
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
max42500_init
int max42500_init(struct max42500_dev **, struct max42500_init_param *)
Initialize the device structure.
Definition: max42500.c:633
MAX42500_VNOM_STEP_VM5
#define MAX42500_VNOM_STEP_VM5
Definition: max42500.h:106
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
MAX42500_REG_RSTCTRL
#define MAX42500_REG_RSTCTRL
Definition: max42500.h:92
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
MAX42500_MAX_THRESH_VM6_V7
#define MAX42500_MAX_THRESH_VM6_V7
Definition: max42500.h:111
max42500_dev::wd_en
uint8_t wd_en
Definition: max42500.h:227
max42500_init_param::wd_en
uint8_t wd_en
Definition: max42500.h:191
MAX42500_VM5
@ MAX42500_VM5
Definition: max42500.h:128
MAX42500_REG_FPSCFG1
#define MAX42500_REG_FPSCFG1
Definition: max42500.h:71
MAX42500_STATE_ON
@ MAX42500_STATE_ON
Definition: max42500.h:118
max42500_reg_write
int max42500_reg_write(struct max42500_dev *desc, uint8_t reg_addr, uint8_t data)
Write a raw value to a register.
Definition: max42500.c:163
MAX42500_REG_VINU7
#define MAX42500_REG_VINU7
Definition: max42500.h:64
MAX42500_STATE_SLEEP
@ MAX42500_STATE_SLEEP
Definition: max42500.h:117
max42500_set_state
int max42500_set_state(struct max42500_dev *desc, enum max42500_state state)
Set device state through EN0 and EN1 pins.
Definition: max42500.c:71
max42500_set_watchdog_enable
int max42500_set_watchdog_enable(struct max42500_dev *desc, bool wd_enable)
Enable/Disable watchdog.
Definition: max42500.c:539
max42500_set_uv_thresh1
int max42500_set_uv_thresh1(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the undervoltage threshold of VM1 to VM5.
Definition: max42500.c:375
max42500_set_ov_thresh2
int max42500_set_ov_thresh2(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the overvoltage threshold of VM6 and VM7.
Definition: max42500.c:341
max42500_reg_read
int max42500_reg_read(struct max42500_dev *desc, uint8_t reg_addr, uint8_t *reg_data)
Read a raw value from a register.
Definition: max42500.c:114
max42500_dev::en1
struct no_os_gpio_desc * en1
Definition: max42500.h:203
NO_OS_DECLARE_CRC8_TABLE
NO_OS_DECLARE_CRC8_TABLE(max42500_crc8)
no_os_gpio.h
Header file of GPIO Interface.
max42500_set_watchdog_key
int max42500_set_watchdog_key(struct max42500_dev *desc)
Update the watchdog key based on the mode and current value.
Definition: max42500.c:589
MAX42500_REG_RSTMAP
#define MAX42500_REG_RSTMAP
Definition: max42500.h:52
CRC8_PEC
#define CRC8_PEC
Definition: max42500.c:53
max42500_dev::addr
struct no_os_gpio_desc * addr
Definition: max42500.h:205
MAX42500_REG_WDCFG1
#define MAX42500_REG_WDCFG1
Definition: max42500.h:88
max42500_dev::wd_1ud
uint8_t wd_1ud
Definition: max42500.h:225
max42500_reg_update
int max42500_reg_update(struct max42500_dev *desc, uint8_t reg_addr, uint8_t mask, uint8_t data)
Update a register's value based on a mask.
Definition: max42500.c:190
max42500_dev
max42500 device descriptor
Definition: max42500.h:197
MAX42500_WD_RHOLD_MAX
@ MAX42500_WD_RHOLD_MAX
Definition: max42500.h:155
no_os_util.h
Header file of utility functions.
max42500_get_power_up_timestamp
int max42500_get_power_up_timestamp(struct max42500_dev *desc, enum max42500_vm_input vm_in, uint8_t *timestamp)
Get the power-up timestamp for a specified voltage monitor input.
Definition: max42500.c:468
MAX42500_REG_WDCFG2
#define MAX42500_REG_WDCFG2
Definition: max42500.h:89
max42500_set_uv_thresh2
int max42500_set_uv_thresh2(struct max42500_dev *desc, enum max42500_vm_input vm_in, float thresh)
Set the undervoltage threshold of VM6 and VM7.
Definition: max42500.c:410
max42500_dev::wd_mode
enum max42500_wd_mode wd_mode
Definition: max42500.h:217
max42500_get_comp_status
int max42500_get_comp_status(struct max42500_dev *desc, enum max42500_vm_input vm_in, enum max42500_comp_stat comp_stat, uint8_t *status)
Get the status of the voltage monitor input.
Definition: max42500.c:264
max42500_dev::en0
struct no_os_gpio_desc * en0
Definition: max42500.h:201
MAX42500_REG_OVUV1
#define MAX42500_REG_OVUV1
Definition: max42500.h:65
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
max42500_init
int max42500_init(struct max42500_dev **desc, struct max42500_init_param *init_param)
Initialize the device structure.
Definition: max42500.c:633
MAX42500_MAX_THRESH_VM1_VM5
#define MAX42500_MAX_THRESH_VM1_VM5
Definition: max42500.h:109
max42500_set_nominal_voltage
int max42500_set_nominal_voltage(struct max42500_dev *desc, enum max42500_vm_input vm_in, float voltage)
Set nominal voltage for VM1 to VM5.
Definition: max42500.c:217
MAX42500_WD_RHOLD_0_MS
@ MAX42500_WD_RHOLD_0_MS
Definition: max42500.h:151
no_os_crc8.h
Header file of CRC-8 computation.
MAX42500_COMP_STAT_OV
@ MAX42500_COMP_STAT_OV
Definition: max42500.h:138
NO_OS_DIV_ROUND_CLOSEST
#define NO_OS_DIV_ROUND_CLOSEST(x, y)
Definition: no_os_util.h:54
max42500_init_param::wd_cdiv
uint8_t wd_cdiv
Definition: max42500.h:183