no-OS
Loading...
Searching...
No Matches
max22915.c File Reference

Source file of MAX22915 Driver. More...

#include "max22915.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "no_os_spi.h"
#include "no_os_print_log.h"
#include <stdio.h>
#include <errno.h>
Include dependency graph for max22915.c:

Functions

int max22915_reg_read (struct max22915_desc *desc, uint8_t reg_addr, uint8_t *reg_data)
 Read register data from MAX22915.
 
int max22915_reg_write (struct max22915_desc *desc, uint8_t reg_addr, uint8_t reg_data)
 Write register data to MAX22915.
 
int max22915_reg_write_mask (struct max22915_desc *desc, uint8_t reg_addr, uint8_t mask, uint8_t reg_data)
 Write register data to MAX22915 with mask.
 
int max22915_set_sw_state (struct max22915_desc *dev, uint8_t channel, enum max22915_sw_state state)
 Set the switch state of a channel.
 
int max22915_set_owon_config (struct max22915_desc *dev, uint8_t channel, bool owon_enable)
 Set the open-wire on detection configuration for a channel.
 
int max22915_set_owoff_config (struct max22915_desc *dev, uint8_t channel, bool owoff_enable)
 Set the open-wire off detection configuration for a channel.
 
int max22915_set_shvdd_config (struct max22915_desc *dev, uint8_t channel, bool shtvdd_enable)
 Set the short to VDD detection configuration for a channel.
 
int max22915_set_current_config (struct max22915_desc *dev, struct max22915_current_config *config)
 Set the current measurement configuration.
 
int max22915_set_temperature_config (struct max22915_desc *dev, struct max22915_temp_config *config)
 Set the temperature measurement configuration.
 
int max22915_init (struct max22915_desc **device, struct max22915_init_param *init_param)
 Initialize and configure the MAX22915 device.
 
int max22915_remove (struct max22915_desc *dev)
 Remove resources allocated for MAX22915.
 

Detailed Description

Source file of MAX22915 Driver.

Author
Janani Sunil (janan.nosp@m.i.su.nosp@m.nil@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2025-2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ max22915_init()

int max22915_init ( struct max22915_desc ** device,
struct max22915_init_param * init_param )

Initialize and configure the MAX22915 device.

Parameters
device- Device descriptor for the MAX22915 that will be initialized
init_param- Initialization parameter for the device
Returns
0 in case of success, negative error code otherwise

◆ max22915_reg_read()

int max22915_reg_read ( struct max22915_desc * desc,
uint8_t reg_addr,
uint8_t * reg_data )

Read register data from MAX22915.

Parameters
desc- Device descriptor for the MAX22915
reg_addr- Register address to read from
reg_data- Pointer to store the read data
Returns
0 in case of success, negative error code otherwise

◆ max22915_reg_write()

int max22915_reg_write ( struct max22915_desc * desc,
uint8_t reg_addr,
uint8_t reg_data )

Write register data to MAX22915.

Parameters
desc- Device descriptor for the MAX22915
reg_addr- Register address to write to
reg_data- Data to be written
Returns
0 in case of success, negative error code otherwise

◆ max22915_reg_write_mask()

int max22915_reg_write_mask ( struct max22915_desc * desc,
uint8_t reg_addr,
uint8_t mask,
uint8_t reg_data )

Write register data to MAX22915 with mask.

Parameters
desc- Device descriptor for the MAX22915
reg_addr- Register address to write to
mask- Bit mask for the operation
reg_data- Data to be written
Returns
0 in case of success, negative error code otherwise

◆ max22915_remove()

int max22915_remove ( struct max22915_desc * dev)

Remove resources allocated for MAX22915.

Parameters
dev- device descriptor for the MAX22915
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_current_config()

int max22915_set_current_config ( struct max22915_desc * dev,
struct max22915_current_config * config )

Set the current measurement configuration.

Parameters
dev- Device descriptor for the MAX22915
config- Pointer to current configuration structure
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_owoff_config()

int max22915_set_owoff_config ( struct max22915_desc * dev,
uint8_t channel,
bool owoff_enable )

Set the open-wire off detection configuration for a channel.

Parameters
dev- Device descriptor for the MAX22915
channel- Channel index
owoff_enable- True to enable, false to disable
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_owon_config()

int max22915_set_owon_config ( struct max22915_desc * dev,
uint8_t channel,
bool owon_enable )

Set the open-wire on detection configuration for a channel.

Parameters
dev- Device descriptor for the MAX22915
channel- Channel index
owon_enable- True to enable, false to disable
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_shvdd_config()

int max22915_set_shvdd_config ( struct max22915_desc * dev,
uint8_t channel,
bool shtvdd_enable )

Set the short to VDD detection configuration for a channel.

Parameters
dev- Device descriptor for the MAX22915
channel- Channel index
shtvdd_enable- True to enable, false to disable
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_sw_state()

int max22915_set_sw_state ( struct max22915_desc * dev,
uint8_t channel,
enum max22915_sw_state state )

Set the switch state of a channel.

Parameters
dev- Device descriptor for the MAX22915
channel- Channel index
state- Switch state to be set
Returns
0 in case of success, negative error code otherwise

◆ max22915_set_temperature_config()

int max22915_set_temperature_config ( struct max22915_desc * dev,
struct max22915_temp_config * config )

Set the temperature measurement configuration.

Parameters
dev- Device descriptor for the MAX22915
config- Pointer to temperature configuration structure
Returns
0 in case of success, negative error code otherwise