no-OS
Loading...
Searching...
No Matches
max22017.h File Reference

Header file of MAX22017 Driver. More...

#include <stdint.h>
#include <stdbool.h>
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for max22017.h:

Classes

struct  max22017_gpio_init_param
 Structure holding the GPIO initialization parameter for the MAX22017 GPIO Controller. More...
 
struct  max22017_init_param
 Structure holding the MAX22017 initialization parameter. More...
 
struct  max22017_desc
 Structure holding the MAX22017 device descriptor. More...
 

Macros

#define MAX22017_GEN_ID   0x00
 
#define MAX22017_GEN_SERIAL_MSB   0x01
 
#define MAX22017_GEN_SERIAL_LSB   0x02
 
#define MAX22017_GEN_CNFG   0x03
 
#define MAX22017_GEN_GPIO_CTRL   0x04
 
#define MAX22017_GEN_GPIO_DATA   0x05
 
#define MAX22017_GEN_GPI_INT   0x06
 
#define MAX22017_GEN_GPI_INT_STA   0x07
 
#define MAX22017_GEN_INT   0x08
 
#define MAX22017_GEN_INTEN   0x09
 
#define MAX22017_GEN_RST_CTRL   0x0A
 
#define MAX22017_AO_CMD   0x40
 
#define MAX22017_AO_STA   0x41
 
#define MAX22017_AO_CNFG   0x42
 
#define MAX22017_AO_SLEW_RATE_CH1   0x43
 
#define MAX22017_AO_SLEW_RATE_CH2   0x44
 
#define MAX22017_AO_DATA_CH1   0x45
 
#define MAX22017_AO_DATA_CH2   0x46
 
#define MAX22017_AO_OFFSET_CORR_CH1   0x47
 
#define MAX22017_AO_GAIN_CORR_CH1   0x48
 
#define MAX22017_AO_OFFSET_CORR_CH2   0x49
 
#define MAX22017_AO_GAIN_CORR_CH2   0x4A
 
#define MAX22017_FRAME_SIZE   3
 
#define MAX22017_ADRR_MASK   NO_OS_GENMASK(7, 1)
 
#define MAX22017_RW_MASK   NO_OS_BIT(0)
 
#define MAX22017_PAYLOAD_LSB_MASK   NO_OS_GENMASK(7, 0)
 
#define MAX22017_PAYLOAD_MSB_MASK   NO_OS_GENMASK(15, 8)
 
#define MAX22017_CRC_MASK   NO_OS_BIT(1)
 
#define MAX22017_EXT_DAC_REF_MASK   NO_OS_BIT(0)
 
#define MAX22017_GPIO_MASK(x)
 
#define MAX22017_GPIO_DIR_MASK(x)
 
#define MAX22017_GPIO_OUT_VAL_MASK(x)
 
#define MAX22017_GPIO_IN_VAL_MASK(x)
 
#define MAX22017_SR_EN_MASK   NO_OS_BIT(5)
 
#define MAX22017_SR_SEL_MASK   NO_OS_BIT(4)
 
#define MAX22017_SR_STEP_SIZE_MASK   NO_OS_GENMASK(3, 2)
 
#define MAX22017_SR_UPDATE_RATE_MASK   NO_OS_GENMASK(1, 0)
 
#define MAX22017_AO_EN_MASK(x)
 
#define MAX22017_AO_EN_MODE_MASK   NO_OS_BIT(2)
 
#define MAX22017_AI_EN_MASK(x)
 
#define MAX22017_AI_EN_MODE_MASK   NO_OS_BIT(1)
 
#define MAX22017_AO_MODE_MASK(x)
 
#define MAX22017_AO_MODE_MODE_MASK   NO_OS_BIT(0)
 
#define MAX22017_OP_MODE_MASK(x)
 
#define MAX22017_LD_CNFG_MASK(x)
 
#define MAX22017_CM_SENSE_MASK(x)
 
#define MAX22017_UNI_MASK(x)
 
#define MAX22017_OW_MASK(x)
 
#define MAX22017_CNFG_MASK(x)
 
#define MAX22017_COEFF_ONLY_MASK   NO_OS_GENMASK(15, 14)
 
#define MAX22017_RST_MASK(x)
 
#define MAX22017_TIMEOUT_SEL_MASK   NO_OS_GENMASK(13, 10)
 
#define MAX22017_TIMEOUT_CNFG_MASK   NO_OS_BIT(9)
 
#define MAX22017_TIMEOUT_EN_MASK   NO_OS_BIT(8)
 
#define MAX22017_TIMEOUT_MASK   NO_OS_GENMASK(13, 8)
 
#define MAX22017_COEFF_ONLY_VAL   0x03
 
#define MAX22017_GPIO_NUMBER   4
 
#define MAX22017_EXTRA_GPIO_NUMBER   2
 

Enumerations

enum  max22017_op_mode {
  MAX22017_HIGH_Z = 1 ,
  MAX22017_INPUT_VOLTAGE_MODE ,
  MAX22017_INPUT_CURRENT_MODE ,
  MAX22017_OUTPUT_VOLTAGE_NO_MONITORRING ,
  MAX22017_OUTPUT_CURRENT_NO_MONITORRING ,
  MAX22017_OUTPUT_VOLTAGE_MONITORRING ,
  MAX22017_OUTPUT_CURRENT_MONITORRING
}
 
enum  max22017_out_mode {
  MAX22017_BIPOLAR ,
  MAX22017_UNIPOLAR
}
 
enum  max22017_cm_sense {
  MAX22017_50_OHM_RESISTOR ,
  MAX22017_250_OHM_RESISTOR
}
 
enum  max22017_timeout_sel {
  MAX22017_TIMEOUT_100MS ,
  MAX22017_TIMEOUT_200MS ,
  MAX22017_TIMEOUT_300MS ,
  MAX22017_TIMEOUT_400MS ,
  MAX22017_TIMEOUT_500MS ,
  MAX22017_TIMEOUT_600MS ,
  MAX22017_TIMEOUT_700MS ,
  MAX22017_TIMEOUT_800MS ,
  MAX22017_TIMEOUT_900MS ,
  MAX22017_TIMEOUT_1000MS ,
  MAX22017_TIMEOUT_1100MS ,
  MAX22017_TIMEOUT_1200MS ,
  MAX22017_TIMEOUT_1300MS ,
  MAX22017_TIMEOUT_1400MS ,
  MAX22017_TIMEOUT_1500MS ,
  MAX22017_TIMEOUT_1600MS
}
 
enum  max22017_sr_step_size {
  MAX22017_STEP_SIZE_512BITS ,
  MAX22017_STEP_SIZE_1024BITS ,
  MAX22017_STEP_SIZE_4096BITS ,
  MAX22017_STEP_SIZE_16384BITS ,
  MAX22017_STEP_SIZE_26BITS ,
  MAX22017_STEP_SIZE_28BITS ,
  MAX22017_STEP_SIZE_31BITS ,
  MAX22017_STEP_SIZE_35BITS
}
 
enum  max22017_sr_update_rate {
  MAX22017_UPDATE_RATE_4KHZ_2KHZ ,
  MAX22017_UPDATE_RATE_64KHZ_32KHZ ,
  MAX22017_UPDATE_RATE_160KHZ_80KHZ ,
  MAX22017_UPDATE_RATE_200KHZ_100KHZ ,
  MAX22017_UPDATE_RATE_12KHZ_6KHZ ,
  MAX22017_UPDATE_RATE_15KHZ_7KHZ ,
  MAX22017_UPDATE_RATE_20KHZ_10KHZ ,
  MAX22017_UPDATE_RATE_32KHZ_16KHZ
}
 
enum  max22017_channel {
  MAX22017_CH1 ,
  MAX22017_CH2
}
 

Functions

int32_t max22017_gpio_get (struct no_os_gpio_desc **, const struct no_os_gpio_init_param *)
 Obtain the GPIO decriptor.
 
int32_t max22017_gpio_remove (struct no_os_gpio_desc *)
 Free the resources allocated by no_os_gpio_get().
 
int32_t max22017_gpio_direction_input (struct no_os_gpio_desc *)
 Enable the input direction of the specified GPIO.
 
int32_t max22017_gpio_direction_output (struct no_os_gpio_desc *, uint8_t)
 Enable the output direction of the specified GPIO.
 
int32_t max22017_gpio_get_direction (struct no_os_gpio_desc *, uint8_t *)
 Get the direction of the specified GPIO.
 
int32_t max22017_gpio_set_value (struct no_os_gpio_desc *, uint8_t)
 Set the value of the specified GPIO.
 
int32_t max22017_gpio_get_value (struct no_os_gpio_desc *, uint8_t *)
 Get the value of the specified GPIO.
 
int max22017_set_timeout (struct max22017_desc *, bool, bool, enum max22017_timeout_sel)
 Set timeout settings for MAX22017 device.
 
int max22017_set_data (struct max22017_desc *, enum max22017_channel, int32_t)
 Set data of the selected channel.
 
int max22017_get_data (struct max22017_desc *, enum max22017_channel, int32_t *)
 Get data from requestec channel.
 
int max22017_slew_rate (struct max22017_desc *, enum max22017_channel, enum max22017_sr_step_size, enum max22017_sr_update_rate, bool, bool)
 Set slew rate settings for requested channels.
 
int max22017_offset_calib (struct max22017_desc *, enum max22017_channel, int16_t)
 Set offset value for output calibration.
 
int max22017_gain_calib (struct max22017_desc *, enum max22017_channel, uint16_t)
 Set gain value for calibration of requested channel.
 
int max22017_op_mode (struct max22017_desc *, enum max22017_channel, enum max22017_op_mode)
 Set operation mode for requested channel.
 
int max22017_config (struct max22017_desc *, enum max22017_channel, enum max22017_out_mode, enum max22017_cm_sense, bool)
 Set AO configuration.
 
int max22017_soft_reset (struct max22017_desc *, enum max22017_channel, bool)
 Soft reset requested channel.
 
int max22017_reg_read (struct max22017_desc *, uint32_t, uint32_t *)
 Read the value of a device register.
 
int max22017_reg_write (struct max22017_desc *, uint32_t, uint32_t)
 Write the value of a device register.
 
int max22017_reg_update (struct max22017_desc *, uint32_t, uint32_t, uint32_t)
 Update the value of a device register (read/write sequence).
 
int max22017_init (struct max22017_desc **, struct max22017_init_param *)
 Initialize and configure the MAX22017 device.
 
int max22017_remove (struct max22017_desc *)
 Free the resources allocated during init and perform a soft reset.
 

Variables

const struct no_os_gpio_platform_ops max22017_gpio_ops
 

Detailed Description

Header file of MAX22017 Driver.

Author
Radu Sabau (radu..nosp@m.saba.nosp@m.u@ana.nosp@m.log..nosp@m.com)

Copyright 2024(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ MAX22017_ADRR_MASK

#define MAX22017_ADRR_MASK   NO_OS_GENMASK(7, 1)

◆ MAX22017_AI_EN_MASK

#define MAX22017_AI_EN_MASK ( x)
Value:
NO_OS_BIT(2 + (x))
#define NO_OS_BIT(x)
Definition no_os_util.h:23

◆ MAX22017_AI_EN_MODE_MASK

#define MAX22017_AI_EN_MODE_MASK   NO_OS_BIT(1)

◆ MAX22017_AO_CMD

#define MAX22017_AO_CMD   0x40

◆ MAX22017_AO_CNFG

#define MAX22017_AO_CNFG   0x42

◆ MAX22017_AO_DATA_CH1

#define MAX22017_AO_DATA_CH1   0x45

◆ MAX22017_AO_DATA_CH2

#define MAX22017_AO_DATA_CH2   0x46

◆ MAX22017_AO_EN_MASK

#define MAX22017_AO_EN_MASK ( x)
Value:

◆ MAX22017_AO_EN_MODE_MASK

#define MAX22017_AO_EN_MODE_MASK   NO_OS_BIT(2)

◆ MAX22017_AO_GAIN_CORR_CH1

#define MAX22017_AO_GAIN_CORR_CH1   0x48

◆ MAX22017_AO_GAIN_CORR_CH2

#define MAX22017_AO_GAIN_CORR_CH2   0x4A

◆ MAX22017_AO_MODE_MASK

#define MAX22017_AO_MODE_MASK ( x)
Value:
NO_OS_BIT(8 + (x))

◆ MAX22017_AO_MODE_MODE_MASK

#define MAX22017_AO_MODE_MODE_MASK   NO_OS_BIT(0)

◆ MAX22017_AO_OFFSET_CORR_CH1

#define MAX22017_AO_OFFSET_CORR_CH1   0x47

◆ MAX22017_AO_OFFSET_CORR_CH2

#define MAX22017_AO_OFFSET_CORR_CH2   0x49

◆ MAX22017_AO_SLEW_RATE_CH1

#define MAX22017_AO_SLEW_RATE_CH1   0x43

◆ MAX22017_AO_SLEW_RATE_CH2

#define MAX22017_AO_SLEW_RATE_CH2   0x44

◆ MAX22017_AO_STA

#define MAX22017_AO_STA   0x41

◆ MAX22017_CM_SENSE_MASK

#define MAX22017_CM_SENSE_MASK ( x)
Value:
NO_OS_BIT(12 + (x))

◆ MAX22017_CNFG_MASK

#define MAX22017_CNFG_MASK ( x)
Value:
(NO_OS_BIT(14 + (x)) | NO_OS_BIT(12 + (x)) | NO_OS_BIT(10 + (x)) | NO_OS_BIT(4 + (x)))

◆ MAX22017_COEFF_ONLY_MASK

#define MAX22017_COEFF_ONLY_MASK   NO_OS_GENMASK(15, 14)

◆ MAX22017_COEFF_ONLY_VAL

#define MAX22017_COEFF_ONLY_VAL   0x03

◆ MAX22017_CRC_MASK

#define MAX22017_CRC_MASK   NO_OS_BIT(1)

◆ MAX22017_EXT_DAC_REF_MASK

#define MAX22017_EXT_DAC_REF_MASK   NO_OS_BIT(0)

◆ MAX22017_EXTRA_GPIO_NUMBER

#define MAX22017_EXTRA_GPIO_NUMBER   2

◆ MAX22017_FRAME_SIZE

#define MAX22017_FRAME_SIZE   3

◆ MAX22017_GEN_CNFG

#define MAX22017_GEN_CNFG   0x03

◆ MAX22017_GEN_GPI_INT

#define MAX22017_GEN_GPI_INT   0x06

◆ MAX22017_GEN_GPI_INT_STA

#define MAX22017_GEN_GPI_INT_STA   0x07

◆ MAX22017_GEN_GPIO_CTRL

#define MAX22017_GEN_GPIO_CTRL   0x04

◆ MAX22017_GEN_GPIO_DATA

#define MAX22017_GEN_GPIO_DATA   0x05

◆ MAX22017_GEN_ID

#define MAX22017_GEN_ID   0x00

◆ MAX22017_GEN_INT

#define MAX22017_GEN_INT   0x08

◆ MAX22017_GEN_INTEN

#define MAX22017_GEN_INTEN   0x09

◆ MAX22017_GEN_RST_CTRL

#define MAX22017_GEN_RST_CTRL   0x0A

◆ MAX22017_GEN_SERIAL_LSB

#define MAX22017_GEN_SERIAL_LSB   0x02

◆ MAX22017_GEN_SERIAL_MSB

#define MAX22017_GEN_SERIAL_MSB   0x01

◆ MAX22017_GPIO_DIR_MASK

#define MAX22017_GPIO_DIR_MASK ( x)
Value:

◆ MAX22017_GPIO_IN_VAL_MASK

#define MAX22017_GPIO_IN_VAL_MASK ( x)
Value:

◆ MAX22017_GPIO_MASK

#define MAX22017_GPIO_MASK ( x)
Value:
NO_OS_BIT(8 + (x))

◆ MAX22017_GPIO_NUMBER

#define MAX22017_GPIO_NUMBER   4

◆ MAX22017_GPIO_OUT_VAL_MASK

#define MAX22017_GPIO_OUT_VAL_MASK ( x)
Value:
NO_OS_BIT(8 + (x))

◆ MAX22017_LD_CNFG_MASK

#define MAX22017_LD_CNFG_MASK ( x)
Value:
NO_OS_BIT(14 + (x))

◆ MAX22017_OP_MODE_MASK

#define MAX22017_OP_MODE_MASK ( x)
Value:
(NO_OS_BIT(x) | NO_OS_BIT(2 + (x)) | NO_OS_BIT(8 + (x)))

◆ MAX22017_OW_MASK

#define MAX22017_OW_MASK ( x)
Value:
NO_OS_BIT(4 + (x))

◆ MAX22017_PAYLOAD_LSB_MASK

#define MAX22017_PAYLOAD_LSB_MASK   NO_OS_GENMASK(7, 0)

◆ MAX22017_PAYLOAD_MSB_MASK

#define MAX22017_PAYLOAD_MSB_MASK   NO_OS_GENMASK(15, 8)

◆ MAX22017_RST_MASK

#define MAX22017_RST_MASK ( x)
Value:
NO_OS_BIT(14 + (x))

◆ MAX22017_RW_MASK

#define MAX22017_RW_MASK   NO_OS_BIT(0)

◆ MAX22017_SR_EN_MASK

#define MAX22017_SR_EN_MASK   NO_OS_BIT(5)

◆ MAX22017_SR_SEL_MASK

#define MAX22017_SR_SEL_MASK   NO_OS_BIT(4)

◆ MAX22017_SR_STEP_SIZE_MASK

#define MAX22017_SR_STEP_SIZE_MASK   NO_OS_GENMASK(3, 2)

◆ MAX22017_SR_UPDATE_RATE_MASK

#define MAX22017_SR_UPDATE_RATE_MASK   NO_OS_GENMASK(1, 0)

◆ MAX22017_TIMEOUT_CNFG_MASK

#define MAX22017_TIMEOUT_CNFG_MASK   NO_OS_BIT(9)

◆ MAX22017_TIMEOUT_EN_MASK

#define MAX22017_TIMEOUT_EN_MASK   NO_OS_BIT(8)

◆ MAX22017_TIMEOUT_MASK

#define MAX22017_TIMEOUT_MASK   NO_OS_GENMASK(13, 8)

◆ MAX22017_TIMEOUT_SEL_MASK

#define MAX22017_TIMEOUT_SEL_MASK   NO_OS_GENMASK(13, 10)

◆ MAX22017_UNI_MASK

#define MAX22017_UNI_MASK ( x)
Value:
NO_OS_BIT(10 + (x))

Enumeration Type Documentation

◆ max22017_channel

Enumerator
MAX22017_CH1 
MAX22017_CH2 

◆ max22017_cm_sense

Enumerator
MAX22017_50_OHM_RESISTOR 
MAX22017_250_OHM_RESISTOR 

◆ max22017_op_mode

Enumerator
MAX22017_HIGH_Z 
MAX22017_INPUT_VOLTAGE_MODE 
MAX22017_INPUT_CURRENT_MODE 
MAX22017_OUTPUT_VOLTAGE_NO_MONITORRING 
MAX22017_OUTPUT_CURRENT_NO_MONITORRING 
MAX22017_OUTPUT_VOLTAGE_MONITORRING 
MAX22017_OUTPUT_CURRENT_MONITORRING 

◆ max22017_out_mode

Enumerator
MAX22017_BIPOLAR 
MAX22017_UNIPOLAR 

◆ max22017_sr_step_size

Enumerator
MAX22017_STEP_SIZE_512BITS 
MAX22017_STEP_SIZE_1024BITS 
MAX22017_STEP_SIZE_4096BITS 
MAX22017_STEP_SIZE_16384BITS 
MAX22017_STEP_SIZE_26BITS 
MAX22017_STEP_SIZE_28BITS 
MAX22017_STEP_SIZE_31BITS 
MAX22017_STEP_SIZE_35BITS 

◆ max22017_sr_update_rate

Enumerator
MAX22017_UPDATE_RATE_4KHZ_2KHZ 
MAX22017_UPDATE_RATE_64KHZ_32KHZ 
MAX22017_UPDATE_RATE_160KHZ_80KHZ 
MAX22017_UPDATE_RATE_200KHZ_100KHZ 
MAX22017_UPDATE_RATE_12KHZ_6KHZ 
MAX22017_UPDATE_RATE_15KHZ_7KHZ 
MAX22017_UPDATE_RATE_20KHZ_10KHZ 
MAX22017_UPDATE_RATE_32KHZ_16KHZ 

◆ max22017_timeout_sel

Enumerator
MAX22017_TIMEOUT_100MS 
MAX22017_TIMEOUT_200MS 
MAX22017_TIMEOUT_300MS 
MAX22017_TIMEOUT_400MS 
MAX22017_TIMEOUT_500MS 
MAX22017_TIMEOUT_600MS 
MAX22017_TIMEOUT_700MS 
MAX22017_TIMEOUT_800MS 
MAX22017_TIMEOUT_900MS 
MAX22017_TIMEOUT_1000MS 
MAX22017_TIMEOUT_1100MS 
MAX22017_TIMEOUT_1200MS 
MAX22017_TIMEOUT_1300MS 
MAX22017_TIMEOUT_1400MS 
MAX22017_TIMEOUT_1500MS 
MAX22017_TIMEOUT_1600MS 

Function Documentation

◆ max22017_config()

int max22017_config ( struct max22017_desc * desc,
enum max22017_channel ch,
enum max22017_out_mode uni,
enum max22017_cm_sense cm_sense,
bool ldac )

Set AO configuration.

Set AO configuration settings for specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
uni- Polarity type : false - bipolar true - unipolar
cm_sense- CM sense resistor value, affects OW value as well
ldac- Enable/Disable LDAC function, takes effect only if LDAC GPIO is set with load_control API.
Returns
0 in case of succes, negative error code otherwise

◆ max22017_gain_calib()

int max22017_gain_calib ( struct max22017_desc * desc,
enum max22017_channel ch,
uint16_t gain )

Set gain value for calibration of requested channel.

Adjust the gain of a specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
gain- Gain value
Returns
0 in case of succes, negative error code otherwise

◆ max22017_get_data()

int max22017_get_data ( struct max22017_desc * desc,
enum max22017_channel ch,
int32_t * data )

Get data from requestec channel.

Get data from specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
data- Received data from channel
Returns
0 in case of succes, negative error code otherwise

◆ max22017_gpio_direction_input()

int32_t max22017_gpio_direction_input ( struct no_os_gpio_desc * desc)

Enable the input direction of the specified GPIO.

Set GPIO direction as input.

Parameters
desc- The GPIO descriptor.
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_direction_output()

int32_t max22017_gpio_direction_output ( struct no_os_gpio_desc * desc,
uint8_t value )

Enable the output direction of the specified GPIO.

Set GPIO direction as output.

Parameters
desc- The GPIO descriptor.
value- The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_get()

int32_t max22017_gpio_get ( struct no_os_gpio_desc ** desc,
const struct no_os_gpio_init_param * param )

Obtain the GPIO decriptor.

Get GPIO descriptor for MAX22017.

Parameters
desc- The GPIO descriptor.
param- GPIO initialization parameters
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_get_direction()

int32_t max22017_gpio_get_direction ( struct no_os_gpio_desc * desc,
uint8_t * direction )

Get the direction of the specified GPIO.

Get GPIO direction for MAX22017.

Parameters
desc- The GPIO descriptor.
direction- The direction. Example: NO_OS_GPIO_OUT NO_OS_GPIO_IN
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_get_value()

int32_t max22017_gpio_get_value ( struct no_os_gpio_desc * desc,
uint8_t * value )

Get the value of the specified GPIO.

Get GPIO value for MAX22017.

Parameters
desc- The GPIO descriptor.
value- The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_remove()

int32_t max22017_gpio_remove ( struct no_os_gpio_desc * desc)

Free the resources allocated by no_os_gpio_get().

Free the resources allocated by no_os_gpio_get().

Parameters
desc- The GPIO descriptor.
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_gpio_set_value()

int32_t max22017_gpio_set_value ( struct no_os_gpio_desc * desc,
uint8_t value )

Set the value of the specified GPIO.

Set GPIO value for MAX22017.

Parameters
desc- The GPIO descriptor.
value- The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW
Returns
0 in case of success, errno error codes otherwise.

◆ max22017_init()

int max22017_init ( struct max22017_desc ** desc,
struct max22017_init_param * param )

Initialize and configure the MAX22017 device.

Initialize the MAX22017 device descriptor.

Parameters
desc- device descriptor for the MAX22017 that will be initialized.
param- initialization parameter for the device.
Returns
0 in case of success, negative error code otherwise

◆ max22017_offset_calib()

int max22017_offset_calib ( struct max22017_desc * desc,
enum max22017_channel ch,
int16_t offset )

Set offset value for output calibration.

Calibrate the offset of a specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
offset- Offset value
Returns
0 in case of succes, negative error code otherwise

◆ max22017_op_mode()

int max22017_op_mode ( struct max22017_desc * desc,
enum max22017_channel ch,
enum max22017_op_mode op_mode )

Set operation mode for requested channel.

Set operation mode for specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
op_mode- Operation mode
Returns
0 in case of succes, negative error code otherwise

◆ max22017_reg_read()

int max22017_reg_read ( struct max22017_desc * desc,
uint32_t addr,
uint32_t * val )

Read the value of a device register.

Read register value from the MAX22017.

Parameters
desc- device descriptor for the MAX22017
addr- address of the register
val- value of the register
Returns
0 in case of success, negative error code otherwise

◆ max22017_reg_update()

int max22017_reg_update ( struct max22017_desc * desc,
uint32_t addr,
uint32_t mask,
uint32_t val )

Update the value of a device register (read/write sequence).

Update the value of a register from the MAX22017.

Parameters
desc- device descriptor for the MAX22017
addr- address of the register
mask- bit mask of the field to be updated
val- value of the masked field. Should be bit shifted by using no_os_field_prep(mask, val)
Returns
0 in case of success, negative error code otherwise

◆ max22017_reg_write()

int max22017_reg_write ( struct max22017_desc * desc,
uint32_t addr,
uint32_t val )

Write the value of a device register.

Write to a register from MAX22017.

Parameters
desc- device descriptor for the MAX22017
addr- address of the register
val- value of the register
Returns
0 in case of success, negative error code otherwise

◆ max22017_remove()

int max22017_remove ( struct max22017_desc * desc)

Free the resources allocated during init and perform a soft reset.

Free resources allocated by the init() function.

Parameters
desc- device descriptor for the MAX22017 that will be initialized.
Returns
0 in case of success, negative error code otherwise

◆ max22017_set_data()

int max22017_set_data ( struct max22017_desc * desc,
enum max22017_channel ch,
int32_t data )

Set data of the selected channel.

Set data for specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
data- Data to be set.
Returns
0 in case of succes, negative error code otherwise

◆ max22017_set_timeout()

int max22017_set_timeout ( struct max22017_desc * desc,
bool timeout_cnfg,
bool timeout_en,
enum max22017_timeout_sel timeout )

Set timeout settings for MAX22017 device.

Set timeout settings.

Parameters
desc- MAX22017 device descriptor
timeout_cnfg- Timeout configuration : false - A timeout will only assert TMOUT_INT bit in Interrupts Register true - A timeout will also reset AO_EN, AI_EN and GPIO_EN pair of bits.
timeout_en- Enable/disable timeout
timeout- Timeout time value
Returns
0 in case of succes, negative error code otherwise

◆ max22017_slew_rate()

int max22017_slew_rate ( struct max22017_desc * desc,
enum max22017_channel ch,
enum max22017_sr_step_size step_size,
enum max22017_sr_update_rate update_rate,
bool enable,
bool hart )

Set slew rate settings for requested channels.

Set slew rate settings for specific channel.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
step_size- Step size value
update_rate- Update rate value
enable- Enable/disable slew rate control
hart- true - Slew rate times for HART applications false - Slew rate times for inductive load applications
Returns
0 in case of succes, negative error code otherwise

◆ max22017_soft_reset()

int max22017_soft_reset ( struct max22017_desc * desc,
enum max22017_channel ch,
bool coeff_only )

Soft reset requested channel.

Soft-reset the MAX22017.

Parameters
desc- MAX22017 device descriptor
ch- Selected channel
coeff_only- Coefficient only reset enable/disable
Returns
0 in case of succes, negative error code otherwise

Variable Documentation

◆ max22017_gpio_ops

const struct no_os_gpio_platform_ops max22017_gpio_ops
extern