![]() |
no-OS
|
Source file of MAX42500 Driver. More...
#include "max42500.h"#include "no_os_error.h"#include "no_os_util.h"#include "no_os_alloc.h"#include "no_os_crc8.h"Macros | |
| #define | CRC8_PEC 0x07 /* Implements Polynomial X^8 + X^2 + X^1 +1 */ |
Functions | |
| NO_OS_DECLARE_CRC8_TABLE (max42500_crc8) | |
| int | max42500_set_state (struct max42500_dev *desc, enum max42500_state state) |
| Set device state through EN0 and EN1 pins. | |
| int | max42500_reg_read (struct max42500_dev *desc, uint8_t reg_addr, uint8_t *reg_data) |
| Read a raw value from a register. | |
| int | max42500_reg_write (struct max42500_dev *desc, uint8_t reg_addr, uint8_t data) |
| Write a raw value to a register. | |
| 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. | |
| int | max42500_set_nominal_voltage (struct max42500_dev *desc, enum max42500_vm_input vm_in, float voltage) |
| Set nominal voltage for VM1 to VM5. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| int | max42500_set_watchdog_enable (struct max42500_dev *desc, bool wd_enable) |
| Enable/Disable watchdog. | |
| int | max42500_set_watchdog_key (struct max42500_dev *desc) |
| Update the watchdog key based on the mode and current value. | |
| int | max42500_set_watchdog_rhld (struct max42500_dev *desc, enum max42500_wd_rhld rhld) |
| Set watchdog reset hold time. | |
| int | max42500_init (struct max42500_dev **desc, struct max42500_init_param *init_param) |
| Initialize the device structure. | |
| int | max42500_remove (struct max42500_dev *desc) |
| Free the device descriptor. | |
Source file of MAX42500 Driver.
Copyright 2024(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define CRC8_PEC 0x07 /* Implements Polynomial X^8 + X^2 + X^1 +1 */ |
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| desc | - The device structure. |
| int max42500_set_watchdog_rhld | ( | struct max42500_dev * | desc, |
| enum max42500_wd_rhld | rhld ) |
Set watchdog reset hold time.
| desc | - The device structure. |
| rhld | - Reset hold time to set. |
| NO_OS_DECLARE_CRC8_TABLE | ( | max42500_crc8 | ) |