Source file of the MAX17851 driver. More...
Functions | |
int | max17851_send_command (struct max17851_desc *desc, enum max17851_command command, bool enable) |
Send specific device command over SPI. | |
int | max17851_read_msg (struct max17851_desc *desc, uint8_t *data, uint8_t len) |
Read message over UART from the MAX17851. | |
int | max17851_write_msg (struct max17851_desc *desc, const uint8_t *data, uint8_t len) |
Write message over UART using MAX17851. | |
int | max17851_config_gen2 (struct max17851_desc *desc, enum max17851_config_gen2_sel sel, bool enable) |
Configure general settings for MAX17851. | |
int | max17851_sel_alrtpckt_time (struct max17851_desc *desc, enum max17851_alrtpckt_time time) |
Set timing for Alert Packets/Keep-Alive Packets. | |
int | max17851_select_queue (struct max17851_desc *desc, enum max17851_queue_sel sel) |
Select queue for transmitting/loading TX buffer for UART. | |
int | max17851_clear_buff (struct max17851_desc *desc, bool tx_buf) |
Clear RX/TX buffer inside the MAX17851 memory. | |
int | max17851_get_alert (struct max17851_desc *desc, enum max17851_alert alert, bool *enable) |
Read specific alert state. | |
int | max17851_set_alert (struct max17851_desc *desc, enum max17851_alert alert, bool enable) |
Enable/Disable specific alert. | |
int | max17851_set_alert_debounce (struct max17851_desc *desc, enum max17851_status_debounce dbnc) |
Select the number of unmasked consecutive Alert Packet status alerts, which must happen prior to taking action in either Safe Minotring or Sleep Mode. | |
int | max17851_set_safemon_dly (struct max17851_desc *desc, enum max17851_safemon_dly delay) |
Select Safe Monitoring Mode Scan Delay. | |
int | max17851_set_safemon_gpio (struct max17851_desc *desc, enum max17851_safemon_gpio gpio, bool enable) |
Select which GPIO pins to be configured as SAFEMON output. | |
int | max17851_set_comm (struct max17851_desc *desc, enum max17851_comm_try_count count, enum max17851_comm_timeout_delay delay) |
Set communication retry count and timeout delay. | |
int | max17851_reg_read (struct max17851_desc *desc, uint8_t reg, uint8_t *data) |
MAX17851 register read function. | |
int | max17851_reg_write (struct max17851_desc *desc, uint8_t reg, uint8_t data) |
MAX17851 register write function. | |
int | max17851_reg_update (struct max17851_desc *desc, uint8_t reg, uint8_t mask, uint8_t data) |
MAX17851 register update function. | |
int | max17851_init (struct max17851_desc **desc, struct max17851_init_param *init_param) |
MAX17851 device initialization function. | |
int | max17851_remove (struct max17851_desc *desc) |
Deallocate any resources used at the initialization function. | |
Variables | |
const struct no_os_uart_platform_ops | max17851_uart_ops |
MAX17851 platform specific UART platform ops structure. | |
Source file of the MAX17851 driver.
Copyright 2025(c) Analog Devices, Inc.
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, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.
int max17851_clear_buff | ( | struct max17851_desc * | desc, |
bool | tx_buf ) |
Clear RX/TX buffer inside the MAX17851 memory.
desc | - MAX17851 device descriptor. |
tx_buf | - True - Clear TX buffer. False - Clear RX buffer. |
int max17851_config_gen2 | ( | struct max17851_desc * | desc, |
enum max17851_config_gen2_sel | sel, | ||
bool | enable ) |
Configure general settings for MAX17851.
desc | - MAX17851 device descriptor. |
sel | - Specific setting to be changed. |
enable | - Disable/Enable specific setting. |
int max17851_get_alert | ( | struct max17851_desc * | desc, |
enum max17851_alert | alert, | ||
bool * | enable ) |
Read specific alert state.
desc | - MAX17851 device descriptor. |
alert | - Specific alert state to be read. |
enable | - Pointer to alert state value to be read. |
int max17851_init | ( | struct max17851_desc ** | desc, |
struct max17851_init_param * | init_param ) |
MAX17851 device initialization function.
desc | - MAX17851 device descriptor to be intialized. |
init_param | - MAX17851 initialization parameter. |
int max17851_read_msg | ( | struct max17851_desc * | desc, |
uint8_t * | data, | ||
uint8_t | len ) |
Read message over UART from the MAX17851.
desc | - MAX17851 device descriptor. |
data | - Pointer to data containing buffer. |
len | - Length of the message in bytes. |
int max17851_reg_read | ( | struct max17851_desc * | desc, |
uint8_t | reg, | ||
uint8_t * | data ) |
MAX17851 register read function.
desc | - MAX17851 device descriptor. |
reg | - Register Address. |
data | - Data byte to be read. |
int max17851_reg_update | ( | struct max17851_desc * | desc, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | data ) |
MAX17851 register update function.
desc | - MAX17851 device descriptor. |
reg | - Register Address. |
mask | - Field mask to be udated inside the register. |
data | - Data byte to be updated. |
int max17851_reg_write | ( | struct max17851_desc * | desc, |
uint8_t | reg, | ||
uint8_t | data ) |
MAX17851 register write function.
desc | - MAX17851 device descriptor. |
reg | - Register Address. |
data | - Data byte to be written. |
int max17851_remove | ( | struct max17851_desc * | desc | ) |
Deallocate any resources used at the initialization function.
desc | - MAX17851 device descriptor. |
int max17851_sel_alrtpckt_time | ( | struct max17851_desc * | desc, |
enum max17851_alrtpckt_time | time ) |
Set timing for Alert Packets/Keep-Alive Packets.
desc | - MAX17851 device descriptor. |
time | - Specific pre-defined time value to be set. |
int max17851_select_queue | ( | struct max17851_desc * | desc, |
enum max17851_queue_sel | sel ) |
Select queue for transmitting/loading TX buffer for UART.
desc | - MAX17851 device descriptor. |
sel | - Specific pre-defined value for either TX or LD queue selection. |
int max17851_send_command | ( | struct max17851_desc * | desc, |
enum max17851_command | command, | ||
bool | enable ) |
Send specific device command over SPI.
desc | - MAX17851 device descriptor. |
command | - Specific command from the command list. |
enable | - Enable/Disable function in case of some commands. Appropiated value needed only for SWPORT or SLEEP_EN commands, ohterwise can be left either true or false. |
int max17851_set_alert | ( | struct max17851_desc * | desc, |
enum max17851_alert | alert, | ||
bool | enable ) |
Enable/Disable specific alert.
desc | - MAX17851 device descriptor. |
alert | - Specific alert to be enabled/disabled. |
enable | - true - Enable specific alert. false - Disable specific alert. |
int max17851_set_alert_debounce | ( | struct max17851_desc * | desc, |
enum max17851_status_debounce | dbnc ) |
Select the number of unmasked consecutive Alert Packet status alerts, which must happen prior to taking action in either Safe Minotring or Sleep Mode.
desc | - MAX17851 device descriptor. |
dbnc | - Specific pre-defined value for number of debounces. |
int max17851_set_comm | ( | struct max17851_desc * | desc, |
enum max17851_comm_try_count | count, | ||
enum max17851_comm_timeout_delay | delay ) |
Set communication retry count and timeout delay.
desc | - MAX17851 device descriptor. |
count | - Specific pre-defined value for communication retry count. |
delay | - Specific pre-defined value for communication timeout delay. |
int max17851_set_safemon_dly | ( | struct max17851_desc * | desc, |
enum max17851_safemon_dly | delay ) |
Select Safe Monitoring Mode Scan Delay.
desc | - MAX17851 device descriptor. |
delay | - Specific pre-defined time delay. |
int max17851_set_safemon_gpio | ( | struct max17851_desc * | desc, |
enum max17851_safemon_gpio | gpio, | ||
bool | enable ) |
Select which GPIO pins to be configured as SAFEMON output.
desc | - MAX17851 device descriptor. |
gpio | - Selected GPIO. |
enable | - Enable/Disable the SAFEMON output function of the GPIO. |
int max17851_write_msg | ( | struct max17851_desc * | desc, |
const uint8_t * | data, | ||
uint8_t | len ) |
Write message over UART using MAX17851.
desc | - MAX17851 device descriptor. |
data | - Pointer to data containing buffer. |
len | - Length of the message in bytes. |
const struct no_os_uart_platform_ops max17851_uart_ops |
MAX17851 platform specific UART platform ops structure.