no-OS
|
Header file of MAX42500 Driver. More...
Go to the source code of this file.
Classes | |
struct | max42500_init_param |
Initialization parameter for the device descriptor. More... | |
struct | max42500_dev |
max42500 device descriptor More... | |
Functions | |
int | max42500_set_state (struct max42500_dev *desc, enum max42500_state state) |
Set device state through EN0 and EN1 pins. More... | |
int | max42500_reg_read (struct max42500_dev *desc, uint8_t reg_addr, uint8_t *reg_data) |
Read a raw value from a register. More... | |
int | max42500_reg_write (struct max42500_dev *desc, uint8_t reg_addr, uint8_t data) |
Write a raw value to a register. More... | |
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. More... | |
int | max42500_set_nominal_voltage (struct max42500_dev *desc, enum max42500_vm_input vm_in, float voltage) |
Set nominal voltage for VM1 to VM5. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | max42500_set_watchdog_enable (struct max42500_dev *desc, bool wd_enable) |
Enable/Disable watchdog. More... | |
int | max42500_set_watchdog_key (struct max42500_dev *desc) |
Update the watchdog key based on the mode and current value. More... | |
int | max42500_set_watchdog_rhld (struct max42500_dev *desc, enum max42500_wd_rhld rhld) |
Set watchdog reset hold time. More... | |
int | max42500_init (struct max42500_dev **, struct max42500_init_param *) |
Initialize the device structure. More... | |
int | max42500_remove (struct max42500_dev *) |
Free the device descriptor. More... | |
Header file of MAX42500 Driver.
Copyright 2024(c) Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define MAX42500_ADDR | ( | x | ) | (0x28 + (x)) |
X is set based on the pull configuration of the ADDR pin
#define MAX42500_I2C_RD_FRAME_SIZE (5) |
#define MAX42500_I2C_WR_FRAME_SIZE (4) |
#define MAX42500_MAX_THRESH_VM1_VM5 10 |
MAX42500 Undervoltage/Overvoltage maximum and minimum thresholds
#define MAX42500_MAX_THRESH_VM6_V7 1.775 |
#define MAX42500_MIN_THRESH_VM1_VM5 2.5 |
#define MAX42500_MIN_THRESH_VM6_V7 0.5 |
#define MAX42500_MIN_VNOM 0.5 |
#define MAX42500_REG_CID 0x2D |
#define MAX42500_REG_CONFIG1 0x01 |
#define MAX42500_REG_CONFIG2 0x02 |
#define MAX42500_REG_DTIME1 0x1F |
#define MAX42500_REG_DTIME2 0x20 |
#define MAX42500_REG_DTIME3 0x21 |
#define MAX42500_REG_DTIME4 0x22 |
#define MAX42500_REG_DTIME5 0x23 |
#define MAX42500_REG_DTIME6 0x24 |
#define MAX42500_REG_DTIME7 0x25 |
#define MAX42500_REG_FPSCFG1 0x17 |
#define MAX42500_REG_FPSSTAT1 0x16 |
#define MAX42500_REG_ID 0x00 |
#define MAX42500_REG_OVUV1 0x11 |
#define MAX42500_REG_OVUV2 0x12 |
#define MAX42500_REG_OVUV3 0x13 |
#define MAX42500_REG_OVUV4 0x14 |
#define MAX42500_REG_OVUV5 0x15 |
#define MAX42500_REG_RSTCTRL 0x2C |
#define MAX42500_REG_RSTMAP 0x04 |
#define MAX42500_REG_STATOFF 0x07 |
#define MAX42500_REG_STATOV 0x05 |
#define MAX42500_REG_STATUV 0x06 |
#define MAX42500_REG_UTIME1 0x18 |
#define MAX42500_REG_UTIME2 0x19 |
#define MAX42500_REG_UTIME3 0x1A |
#define MAX42500_REG_UTIME4 0x1B |
#define MAX42500_REG_UTIME5 0x1C |
#define MAX42500_REG_UTIME6 0x1D |
#define MAX42500_REG_UTIME7 0x1E |
#define MAX42500_REG_VIN1 0x08 |
#define MAX42500_REG_VIN2 0x09 |
#define MAX42500_REG_VIN3 0x0A |
#define MAX42500_REG_VIN4 0x0B |
#define MAX42500_REG_VIN5 0x0C |
#define MAX42500_REG_VINO6 0x0D |
#define MAX42500_REG_VINO7 0x0F |
#define MAX42500_REG_VINU6 0x0E |
#define MAX42500_REG_VINU7 0x10 |
#define MAX42500_REG_VMON 0x03 |
#define MAX42500_REG_WDCDIV 0x27 |
#define MAX42500_REG_WDCFG1 0x28 |
#define MAX42500_REG_WDCFG2 0x29 |
#define MAX42500_REG_WDKEY 0x2A |
#define MAX42500_REG_WDLOCK 0x2B |
#define MAX42500_REG_WDSTAT 0x26 |
#define MAX42500_SILICON_ID (0x30) |
#define MAX42500_VNOM_MAX_VM1_VM4 3.6875 |
MAX42500 Nominal voltage computation
#define MAX42500_VNOM_MAX_VM5 5.6 |
#define MAX42500_VNOM_STEP_VM1_VM4 0.0125 |
#define MAX42500_VNOM_STEP_VM5 0.02 |
enum max42500_comp_stat |
enum max42500_state |
enum max42500_vm_input |
enum max42500_wd_mode |
enum max42500_wd_rhld |
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.
Get the status of the voltage monitor input
desc | - The device structure. |
vm_in | - The voltage monitor input. |
comp_stat | - Status to read. Example: MAX42500_COMP_STAT_OFF - Comparator off status MAX42500_COMP_STAT_UV - Undervoltage status MAX42500_COMP_STAT_OV - Overvoltage status |
status | - Pointer to store the status. Example: 0 - below OV threshold; above UV, OFF threshold 1 - above OV threshold; below UV, OFF threshold |
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.
Get the power-down timestamp for a specified voltage monitor input
desc | - The device structure. |
vm_in | - The voltage monitor input for which to get the timestamp. |
timestamp | - The timestamp in microseconds. If the input voltage never rose above the UV threshold, the timestamp will be set to 0. |
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.
Get the power-up timestamp for a specified voltage monitor input
desc | - The device structure. |
vm_in | - The voltage monitor input for which to get the timestamp. |
timestamp | - The timestamp in microseconds. If the input voltage never rose above the UV threshold, the timestamp will be set to 0. |
int max42500_init | ( | struct max42500_dev ** | desc, |
struct max42500_init_param * | init_param | ||
) |
Initialize the device structure.
Initialize the device structure
desc | - The device structure to be initialized. |
init_param | - Initialization parameter for the device descriptor. |
int max42500_reg_read | ( | struct max42500_dev * | desc, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
Read a raw value from a register.
Read a register value
desc | - The device structure. |
reg_addr | - Address of the register to be written. |
reg_data | - Pointer to store the read data. |
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.
Update a register's value based on a mask
desc | - The device structure. |
reg_addr | - Address of the register to be written. |
mask | - The bits that may be modified. |
data | - Data to write to register |
int max42500_reg_write | ( | struct max42500_dev * | desc, |
uint8_t | reg_addr, | ||
uint8_t | data | ||
) |
Write a raw value to a register.
Write a register value
desc | - The device structure. |
reg_addr | - Address of the register to be written. |
data | - Data to write to register. |
int max42500_remove | ( | struct max42500_dev * | desc | ) |
Free the device descriptor.
Free the device descriptor
desc | - The device structure. |
int max42500_set_nominal_voltage | ( | struct max42500_dev * | desc, |
enum max42500_vm_input | vm_in, | ||
float | voltage | ||
) |
Set nominal voltage for VM1 to VM5.
Set nominal voltage for VM1 to VM5
desc | - The device structure. |
vm_in | - The voltage monitor input. |
voltage | - Nominal voltage to set in volts. Example: 0.5 to 3.6875 for VM1 to VM4 0.5 to 5.6 for VM5 |
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.
Set the overvoltage threshold of VM1 to VM5
desc | - The device structure. |
vm_in | - The voltage monitor input. |
thresh | - The overvoltage threshold in percentage (2.5% to 10%). |
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.
Set the overvoltage threshold of VM6 and VM7
desc | - The device structure. |
vm_in | - The voltage monitor input. |
thresh | - The overvoltage threshold in volts (0.5V to 1.775V). |
int max42500_set_state | ( | struct max42500_dev * | desc, |
enum max42500_state | state | ||
) |
Set device state through EN0 and EN1 pins.
Set device state through EN0 and EN1 pins
desc | - The device structure. |
state | - Device state. |
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.
Set the undervoltage threshold of VM1 to VM5
desc | - The device structure. |
vm_in | - The voltage monitor input. |
thresh | - The undervoltage threshold in percentage (2.5% to 10%). |
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.
Set the undervoltage threshold of VM6 and VM7
desc | - The device structure. |
vm_in | - The voltage monitor input. |
thresh | - The overvoltage threshold in volts (0.5V to 1.775V). |
int max42500_set_watchdog_enable | ( | struct max42500_dev * | desc, |
bool | wd_enable | ||
) |
Enable/Disable watchdog.
Enable/Disable watchdog
desc | - The device structure. |
wd_enable | - Enable/disable MAX42500 watchdog. |
int max42500_set_watchdog_key | ( | struct max42500_dev * | desc | ) |
Update the watchdog key based on the mode and current value.
Update the watchdog key based on the mode and current value
desc | - The device structure. |
int max42500_set_watchdog_rhld | ( | struct max42500_dev * | desc, |
enum max42500_wd_rhld | rhld | ||
) |
Set watchdog reset hold time.
Set watchdog reset hold time
desc | - The device structure. |
rhld | - Reset hold time to set. |