no-OS
Classes | Macros | Enumerations | Functions | Variables
max2201x.h File Reference

Header file of MAX2201X 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 max2201x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  max2201x_gpio_init_param
 Structure holding the GPIO initialization parameter for the MAX2201X GPIO Controller. More...
 
struct  max2201x_init_param
 Structure holding the MAX2201X initialization parameter. More...
 
struct  max2201x_desc
 Structure holding the MAX2201X device descriptor. More...
 

Macros

#define MAX2201X_GEN_ID   0x00
 
#define MAX2201X_GEN_SERIAL_MSB   0x01
 
#define MAX2201X_GEN_SERIAL_LSB   0x02
 
#define MAX2201X_GEN_CNFG   0x03
 
#define MAX2201X_GEN_GPIO_CTRL   0x04
 
#define MAX2201X_GEN_GPIO_DATA   0x05
 
#define MAX2201X_GEN_GPI_INT   0x06
 
#define MAX2201X_GEN_GPI_INT_STA   0x07
 
#define MAX2201X_GEN_INT   0x08
 
#define MAX2201X_GEN_INTEN   0x09
 
#define MAX2201X_GEN_RST_CTRL   0x0A
 
#define MAX2201X_AO_CMD   0x40
 
#define MAX2201X_AO_STA   0x41
 
#define MAX2201X_AO_CNFG   0x42
 
#define MAX2201X_AO_SLEW_RATE_CH1   0x43
 
#define MAX2201X_AO_SLEW_RATE_CH2   0x44
 
#define MAX2201X_AO_DATA_CH1   0x45
 
#define MAX2201X_AO_DATA_CH2   0x46
 
#define MAX2201X_AO_OFFSET_CORR_CH1   0x47
 
#define MAX2201X_AO_GAIN_CORR_CH1   0x48
 
#define MAX2201X_AO_OFFSET_CORR_CH2   0x49
 
#define MAX2201X_AO_GAIN_CORR_CH2   0x4A
 
#define MAX2201X_FRAME_SIZE   3
 
#define MAX2201X_ADRR_MASK   NO_OS_GENMASK(7, 1)
 
#define MAX2201X_RW_MASK   NO_OS_BIT(0)
 
#define MAX2201X_PAYLOAD_LSB_MASK   NO_OS_GENMASK(7, 0)
 
#define MAX2201X_PAYLOAD_MSB_MASK   NO_OS_GENMASK(15, 8)
 
#define MAX2201X_CRC_MASK   NO_OS_BIT(1)
 
#define MAX2201X_EXT_DAC_REF_MASK   NO_OS_BIT(0)
 
#define MAX2201X_GPIO_MASK(x)   NO_OS_BIT(8 + (x))
 
#define MAX2201X_GPIO_DIR_MASK(x)   NO_OS_BIT(x)
 
#define MAX2201X_GPIO_OUT_VAL_MASK(x)   NO_OS_BIT(8 + (x))
 
#define MAX2201X_GPIO_IN_VAL_MASK(x)   NO_OS_BIT(x)
 
#define MAX2201X_SR_EN_MASK   NO_OS_BIT(5)
 
#define MAX2201X_SR_SEL_MASK   NO_OS_BIT(4)
 
#define MAX2201X_SR_STEP_SIZE_MASK   NO_OS_GENMASK(3, 2)
 
#define MAX2201X_SR_UPDATE_RATE_MASK   NO_OS_GENMASK(1, 0)
 
#define MAX2201X_AO_EN_MASK(x)   NO_OS_BIT(x)
 
#define MAX2201X_AO_EN_MODE_MASK   NO_OS_BIT(2)
 
#define MAX2201X_AI_EN_MASK(x)   NO_OS_BIT(2 + (x))
 
#define MAX2201X_AI_EN_MODE_MASK   NO_OS_BIT(1)
 
#define MAX2201X_AO_MODE_MASK(x)   NO_OS_BIT(8 + (x))
 
#define MAX2201X_AO_MODE_MODE_MASK   NO_OS_BIT(0)
 
#define MAX2201X_OP_MODE_MASK(x)   (NO_OS_BIT(x) | NO_OS_BIT(2 + (x)) | NO_OS_BIT(8 + (x)))
 
#define MAX2201X_LD_CNFG_MASK(x)   NO_OS_BIT(14 + (x))
 
#define MAX2201X_CM_SENSE_MASK(x)   NO_OS_BIT(12 + (x))
 
#define MAX2201X_UNI_MASK(x)   NO_OS_BIT(10 + (x))
 
#define MAX2201X_OW_MASK(x)   NO_OS_BIT(4 + (x))
 
#define MAX2201X_CNFG_MASK(x)   (NO_OS_BIT(14 + (x)) | NO_OS_BIT(12 + (x)) | NO_OS_BIT(10 + (x)) | NO_OS_BIT(4 + (x)))
 
#define MAX2201X_COEFF_ONLY_MASK   NO_OS_GENMASK(15, 14)
 
#define MAX2201X_RST_MASK(x)   NO_OS_BIT(14 + (x))
 
#define MAX2201X_TIMEOUT_SEL_MASK   NO_OS_GENMASK(13, 10)
 
#define MAX2201X_TIMEOUT_CNFG_MASK   NO_OS_BIT(9)
 
#define MAX2201X_TIMEOUT_EN_MASK   NO_OS_BIT(8)
 
#define MAX2201X_TIMEOUT_MASK   NO_OS_GENMASK(13, 8)
 
#define MAX2201X_COEFF_ONLY_VAL   0x03
 
#define MAX2201X_GPIO_NUMBER   4
 
#define MAX2201X_EXTRA_GPIO_NUMBER   2
 

Enumerations

enum  max2201x_type {
  ID_MAX22017,
  ID_MAX22018
}
 
enum  max2201x_op_mode {
  MAX2201X_HIGH_Z = 1,
  MAX2201X_INPUT_VOLTAGE_MODE,
  MAX2201X_INPUT_CURRENT_MODE,
  MAX2201X_OUTPUT_VOLTAGE_NO_MONITORRING,
  MAX2201X_OUTPUT_CURRENT_NO_MONITORRING,
  MAX2201X_OUTPUT_VOLTAGE_MONITORRING,
  MAX2201X_OUTPUT_CURRENT_MONITORRING
}
 
enum  max2201x_out_mode {
  MAX2201X_BIPOLAR,
  MAX2201X_UNIPOLAR
}
 
enum  max2201x_cm_sense {
  MAX2201X_50_OHM_RESISTOR,
  MAX2201X_250_OHM_RESISTOR
}
 
enum  max2201x_timeout_sel {
  MAX2201X_TIMEOUT_100MS,
  MAX2201X_TIMEOUT_200MS,
  MAX2201X_TIMEOUT_300MS,
  MAX2201X_TIMEOUT_400MS,
  MAX2201X_TIMEOUT_500MS,
  MAX2201X_TIMEOUT_600MS,
  MAX2201X_TIMEOUT_700MS,
  MAX2201X_TIMEOUT_800MS,
  MAX2201X_TIMEOUT_900MS,
  MAX2201X_TIMEOUT_1000MS,
  MAX2201X_TIMEOUT_1100MS,
  MAX2201X_TIMEOUT_1200MS,
  MAX2201X_TIMEOUT_1300MS,
  MAX2201X_TIMEOUT_1400MS,
  MAX2201X_TIMEOUT_1500MS,
  MAX2201X_TIMEOUT_1600MS
}
 
enum  max2201x_sr_step_size {
  MAX2201X_STEP_SIZE_512BITS,
  MAX2201X_STEP_SIZE_1024BITS,
  MAX2201X_STEP_SIZE_4096BITS,
  MAX2201X_STEP_SIZE_16384BITS,
  MAX2201X_STEP_SIZE_26BITS,
  MAX2201X_STEP_SIZE_28BITS,
  MAX2201X_STEP_SIZE_31BITS,
  MAX2201X_STEP_SIZE_35BITS
}
 
enum  max2201x_sr_update_rate {
  MAX2201X_UPDATE_RATE_4KHZ_2KHZ,
  MAX2201X_UPDATE_RATE_64KHZ_32KHZ,
  MAX2201X_UPDATE_RATE_160KHZ_80KHZ,
  MAX2201X_UPDATE_RATE_200KHZ_100KHZ,
  MAX2201X_UPDATE_RATE_12KHZ_6KHZ,
  MAX2201X_UPDATE_RATE_15KHZ_7KHZ,
  MAX2201X_UPDATE_RATE_20KHZ_10KHZ,
  MAX2201X_UPDATE_RATE_32KHZ_16KHZ
}
 
enum  max2201x_channel {
  MAX2201X_CH1,
  MAX2201X_CH2
}
 

Functions

int32_t max2201x_gpio_get (struct no_os_gpio_desc **, const struct no_os_gpio_init_param *)
 Obtain the GPIO decriptor. More...
 
int32_t max2201x_gpio_remove (struct no_os_gpio_desc *)
 Free the resources allocated by no_os_gpio_get(). More...
 
int32_t max2201x_gpio_direction_input (struct no_os_gpio_desc *)
 Enable the input direction of the specified GPIO. More...
 
int32_t max2201x_gpio_direction_output (struct no_os_gpio_desc *, uint8_t)
 Enable the output direction of the specified GPIO. More...
 
int32_t max2201x_gpio_get_direction (struct no_os_gpio_desc *, uint8_t *)
 Get the direction of the specified GPIO. More...
 
int32_t max2201x_gpio_set_value (struct no_os_gpio_desc *, uint8_t)
 Set the value of the specified GPIO. More...
 
int32_t max2201x_gpio_get_value (struct no_os_gpio_desc *, uint8_t *)
 Get the value of the specified GPIO. More...
 
int max2201x_set_timeout (struct max2201x_desc *, bool, bool, enum max2201x_timeout_sel)
 Set timeout settings for MAX2201X device. More...
 
int max2201x_set_data (struct max2201x_desc *, enum max2201x_channel, int32_t)
 Set data of the selected channel. More...
 
int max2201x_get_data (struct max2201x_desc *, enum max2201x_channel, int32_t *)
 Get data from requestec channel. More...
 
int max2201x_slew_rate (struct max2201x_desc *, enum max2201x_channel, enum max2201x_sr_step_size, enum max2201x_sr_update_rate, bool, bool)
 Set slew rate settings for requested channels. More...
 
int max2201x_offset_calib (struct max2201x_desc *, enum max2201x_channel, int16_t)
 Set offset value for output calibration. More...
 
int max2201x_gain_calib (struct max2201x_desc *, enum max2201x_channel, uint16_t)
 Set gain value for calibration of requested channel. More...
 
int max2201x_op_mode (struct max2201x_desc *, enum max2201x_channel, enum max2201x_op_mode)
 Set operation mode for requested channel. More...
 
int max2201x_config (struct max2201x_desc *, enum max2201x_channel, enum max2201x_out_mode, enum max2201x_cm_sense, bool)
 Set AO configuration. More...
 
int max2201x_soft_reset (struct max2201x_desc *, enum max2201x_channel, bool)
 Soft reset requested channel. More...
 
int max2201x_reg_read (struct max2201x_desc *, uint32_t, uint32_t *)
 Read the value of a device register. More...
 
int max2201x_reg_write (struct max2201x_desc *, uint32_t, uint32_t)
 Write the value of a device register. More...
 
int max2201x_reg_update (struct max2201x_desc *, uint32_t, uint32_t, uint32_t)
 Update the value of a device register (read/write sequence). More...
 
int max2201x_init (struct max2201x_desc **, struct max2201x_init_param *)
 Initialize and configure the MAX2201X device. More...
 
int max2201x_remove (struct max2201x_desc *)
 Free the resources allocated during init and perform a soft reset. More...
 

Variables

const struct no_os_gpio_platform_ops max2201x_gpio_ops
 

Detailed Description

Header file of MAX2201X Driver.

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

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.

Macro Definition Documentation

◆ MAX2201X_ADRR_MASK

#define MAX2201X_ADRR_MASK   NO_OS_GENMASK(7, 1)

◆ MAX2201X_AI_EN_MASK

#define MAX2201X_AI_EN_MASK (   x)    NO_OS_BIT(2 + (x))

◆ MAX2201X_AI_EN_MODE_MASK

#define MAX2201X_AI_EN_MODE_MASK   NO_OS_BIT(1)

◆ MAX2201X_AO_CMD

#define MAX2201X_AO_CMD   0x40

◆ MAX2201X_AO_CNFG

#define MAX2201X_AO_CNFG   0x42

◆ MAX2201X_AO_DATA_CH1

#define MAX2201X_AO_DATA_CH1   0x45

◆ MAX2201X_AO_DATA_CH2

#define MAX2201X_AO_DATA_CH2   0x46

◆ MAX2201X_AO_EN_MASK

#define MAX2201X_AO_EN_MASK (   x)    NO_OS_BIT(x)

◆ MAX2201X_AO_EN_MODE_MASK

#define MAX2201X_AO_EN_MODE_MASK   NO_OS_BIT(2)

◆ MAX2201X_AO_GAIN_CORR_CH1

#define MAX2201X_AO_GAIN_CORR_CH1   0x48

◆ MAX2201X_AO_GAIN_CORR_CH2

#define MAX2201X_AO_GAIN_CORR_CH2   0x4A

◆ MAX2201X_AO_MODE_MASK

#define MAX2201X_AO_MODE_MASK (   x)    NO_OS_BIT(8 + (x))

◆ MAX2201X_AO_MODE_MODE_MASK

#define MAX2201X_AO_MODE_MODE_MASK   NO_OS_BIT(0)

◆ MAX2201X_AO_OFFSET_CORR_CH1

#define MAX2201X_AO_OFFSET_CORR_CH1   0x47

◆ MAX2201X_AO_OFFSET_CORR_CH2

#define MAX2201X_AO_OFFSET_CORR_CH2   0x49

◆ MAX2201X_AO_SLEW_RATE_CH1

#define MAX2201X_AO_SLEW_RATE_CH1   0x43

◆ MAX2201X_AO_SLEW_RATE_CH2

#define MAX2201X_AO_SLEW_RATE_CH2   0x44

◆ MAX2201X_AO_STA

#define MAX2201X_AO_STA   0x41

◆ MAX2201X_CM_SENSE_MASK

#define MAX2201X_CM_SENSE_MASK (   x)    NO_OS_BIT(12 + (x))

◆ MAX2201X_CNFG_MASK

#define MAX2201X_CNFG_MASK (   x)    (NO_OS_BIT(14 + (x)) | NO_OS_BIT(12 + (x)) | NO_OS_BIT(10 + (x)) | NO_OS_BIT(4 + (x)))

◆ MAX2201X_COEFF_ONLY_MASK

#define MAX2201X_COEFF_ONLY_MASK   NO_OS_GENMASK(15, 14)

◆ MAX2201X_COEFF_ONLY_VAL

#define MAX2201X_COEFF_ONLY_VAL   0x03

◆ MAX2201X_CRC_MASK

#define MAX2201X_CRC_MASK   NO_OS_BIT(1)

◆ MAX2201X_EXT_DAC_REF_MASK

#define MAX2201X_EXT_DAC_REF_MASK   NO_OS_BIT(0)

◆ MAX2201X_EXTRA_GPIO_NUMBER

#define MAX2201X_EXTRA_GPIO_NUMBER   2

◆ MAX2201X_FRAME_SIZE

#define MAX2201X_FRAME_SIZE   3

◆ MAX2201X_GEN_CNFG

#define MAX2201X_GEN_CNFG   0x03

◆ MAX2201X_GEN_GPI_INT

#define MAX2201X_GEN_GPI_INT   0x06

◆ MAX2201X_GEN_GPI_INT_STA

#define MAX2201X_GEN_GPI_INT_STA   0x07

◆ MAX2201X_GEN_GPIO_CTRL

#define MAX2201X_GEN_GPIO_CTRL   0x04

◆ MAX2201X_GEN_GPIO_DATA

#define MAX2201X_GEN_GPIO_DATA   0x05

◆ MAX2201X_GEN_ID

#define MAX2201X_GEN_ID   0x00

◆ MAX2201X_GEN_INT

#define MAX2201X_GEN_INT   0x08

◆ MAX2201X_GEN_INTEN

#define MAX2201X_GEN_INTEN   0x09

◆ MAX2201X_GEN_RST_CTRL

#define MAX2201X_GEN_RST_CTRL   0x0A

◆ MAX2201X_GEN_SERIAL_LSB

#define MAX2201X_GEN_SERIAL_LSB   0x02

◆ MAX2201X_GEN_SERIAL_MSB

#define MAX2201X_GEN_SERIAL_MSB   0x01

◆ MAX2201X_GPIO_DIR_MASK

#define MAX2201X_GPIO_DIR_MASK (   x)    NO_OS_BIT(x)

◆ MAX2201X_GPIO_IN_VAL_MASK

#define MAX2201X_GPIO_IN_VAL_MASK (   x)    NO_OS_BIT(x)

◆ MAX2201X_GPIO_MASK

#define MAX2201X_GPIO_MASK (   x)    NO_OS_BIT(8 + (x))

◆ MAX2201X_GPIO_NUMBER

#define MAX2201X_GPIO_NUMBER   4

◆ MAX2201X_GPIO_OUT_VAL_MASK

#define MAX2201X_GPIO_OUT_VAL_MASK (   x)    NO_OS_BIT(8 + (x))

◆ MAX2201X_LD_CNFG_MASK

#define MAX2201X_LD_CNFG_MASK (   x)    NO_OS_BIT(14 + (x))

◆ MAX2201X_OP_MODE_MASK

#define MAX2201X_OP_MODE_MASK (   x)    (NO_OS_BIT(x) | NO_OS_BIT(2 + (x)) | NO_OS_BIT(8 + (x)))

◆ MAX2201X_OW_MASK

#define MAX2201X_OW_MASK (   x)    NO_OS_BIT(4 + (x))

◆ MAX2201X_PAYLOAD_LSB_MASK

#define MAX2201X_PAYLOAD_LSB_MASK   NO_OS_GENMASK(7, 0)

◆ MAX2201X_PAYLOAD_MSB_MASK

#define MAX2201X_PAYLOAD_MSB_MASK   NO_OS_GENMASK(15, 8)

◆ MAX2201X_RST_MASK

#define MAX2201X_RST_MASK (   x)    NO_OS_BIT(14 + (x))

◆ MAX2201X_RW_MASK

#define MAX2201X_RW_MASK   NO_OS_BIT(0)

◆ MAX2201X_SR_EN_MASK

#define MAX2201X_SR_EN_MASK   NO_OS_BIT(5)

◆ MAX2201X_SR_SEL_MASK

#define MAX2201X_SR_SEL_MASK   NO_OS_BIT(4)

◆ MAX2201X_SR_STEP_SIZE_MASK

#define MAX2201X_SR_STEP_SIZE_MASK   NO_OS_GENMASK(3, 2)

◆ MAX2201X_SR_UPDATE_RATE_MASK

#define MAX2201X_SR_UPDATE_RATE_MASK   NO_OS_GENMASK(1, 0)

◆ MAX2201X_TIMEOUT_CNFG_MASK

#define MAX2201X_TIMEOUT_CNFG_MASK   NO_OS_BIT(9)

◆ MAX2201X_TIMEOUT_EN_MASK

#define MAX2201X_TIMEOUT_EN_MASK   NO_OS_BIT(8)

◆ MAX2201X_TIMEOUT_MASK

#define MAX2201X_TIMEOUT_MASK   NO_OS_GENMASK(13, 8)

◆ MAX2201X_TIMEOUT_SEL_MASK

#define MAX2201X_TIMEOUT_SEL_MASK   NO_OS_GENMASK(13, 10)

◆ MAX2201X_UNI_MASK

#define MAX2201X_UNI_MASK (   x)    NO_OS_BIT(10 + (x))

Enumeration Type Documentation

◆ max2201x_channel

Enumerator
MAX2201X_CH1 
MAX2201X_CH2 

◆ max2201x_cm_sense

Enumerator
MAX2201X_50_OHM_RESISTOR 
MAX2201X_250_OHM_RESISTOR 

◆ max2201x_op_mode

Enumerator
MAX2201X_HIGH_Z 
MAX2201X_INPUT_VOLTAGE_MODE 
MAX2201X_INPUT_CURRENT_MODE 
MAX2201X_OUTPUT_VOLTAGE_NO_MONITORRING 
MAX2201X_OUTPUT_CURRENT_NO_MONITORRING 
MAX2201X_OUTPUT_VOLTAGE_MONITORRING 
MAX2201X_OUTPUT_CURRENT_MONITORRING 

◆ max2201x_out_mode

Enumerator
MAX2201X_BIPOLAR 
MAX2201X_UNIPOLAR 

◆ max2201x_sr_step_size

Enumerator
MAX2201X_STEP_SIZE_512BITS 
MAX2201X_STEP_SIZE_1024BITS 
MAX2201X_STEP_SIZE_4096BITS 
MAX2201X_STEP_SIZE_16384BITS 
MAX2201X_STEP_SIZE_26BITS 
MAX2201X_STEP_SIZE_28BITS 
MAX2201X_STEP_SIZE_31BITS 
MAX2201X_STEP_SIZE_35BITS 

◆ max2201x_sr_update_rate

Enumerator
MAX2201X_UPDATE_RATE_4KHZ_2KHZ 
MAX2201X_UPDATE_RATE_64KHZ_32KHZ 
MAX2201X_UPDATE_RATE_160KHZ_80KHZ 
MAX2201X_UPDATE_RATE_200KHZ_100KHZ 
MAX2201X_UPDATE_RATE_12KHZ_6KHZ 
MAX2201X_UPDATE_RATE_15KHZ_7KHZ 
MAX2201X_UPDATE_RATE_20KHZ_10KHZ 
MAX2201X_UPDATE_RATE_32KHZ_16KHZ 

◆ max2201x_timeout_sel

Enumerator
MAX2201X_TIMEOUT_100MS 
MAX2201X_TIMEOUT_200MS 
MAX2201X_TIMEOUT_300MS 
MAX2201X_TIMEOUT_400MS 
MAX2201X_TIMEOUT_500MS 
MAX2201X_TIMEOUT_600MS 
MAX2201X_TIMEOUT_700MS 
MAX2201X_TIMEOUT_800MS 
MAX2201X_TIMEOUT_900MS 
MAX2201X_TIMEOUT_1000MS 
MAX2201X_TIMEOUT_1100MS 
MAX2201X_TIMEOUT_1200MS 
MAX2201X_TIMEOUT_1300MS 
MAX2201X_TIMEOUT_1400MS 
MAX2201X_TIMEOUT_1500MS 
MAX2201X_TIMEOUT_1600MS 

◆ max2201x_type

Enumerator
ID_MAX22017 
ID_MAX22018 

Function Documentation

◆ max2201x_config()

int max2201x_config ( struct max2201x_desc desc,
enum max2201x_channel  ch,
enum max2201x_out_mode  uni,
enum max2201x_cm_sense  cm_sense,
bool  ldac 
)

Set AO configuration.

Set AO configuration settings for specific channel.

Parameters
desc- MAX2201X 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
Here is the caller graph for this function:

◆ max2201x_gain_calib()

int max2201x_gain_calib ( struct max2201x_desc desc,
enum max2201x_channel  ch,
uint16_t  gain 
)

Set gain value for calibration of requested channel.

Adjust the gain of a specific channel.

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

◆ max2201x_get_data()

int max2201x_get_data ( struct max2201x_desc desc,
enum max2201x_channel  ch,
int32_t *  data 
)

Get data from requestec channel.

Get data from specific channel.

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

◆ max2201x_gpio_direction_input()

int32_t max2201x_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.

◆ max2201x_gpio_direction_output()

int32_t max2201x_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.

◆ max2201x_gpio_get()

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

Obtain the GPIO decriptor.

Get GPIO descriptor for MAX2201X.

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

◆ max2201x_gpio_get_direction()

int32_t max2201x_gpio_get_direction ( struct no_os_gpio_desc desc,
uint8_t *  direction 
)

Get the direction of the specified GPIO.

Get GPIO direction for MAX2201X.

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.

◆ max2201x_gpio_get_value()

int32_t max2201x_gpio_get_value ( struct no_os_gpio_desc desc,
uint8_t *  value 
)

Get the value of the specified GPIO.

Get GPIO value for MAX2201x.

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.

◆ max2201x_gpio_remove()

int32_t max2201x_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.

◆ max2201x_gpio_set_value()

int32_t max2201x_gpio_set_value ( struct no_os_gpio_desc desc,
uint8_t  value 
)

Set the value of the specified GPIO.

Set GPIO value for MAX2201X.

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.

◆ max2201x_init()

int max2201x_init ( struct max2201x_desc **  desc,
struct max2201x_init_param param 
)

Initialize and configure the MAX2201X device.

Initialize the MAX2201X device descriptor.

Parameters
desc- device descriptor for the MAX2201X that will be initialized.
param- initialization parameter for the device.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max2201x_offset_calib()

int max2201x_offset_calib ( struct max2201x_desc desc,
enum max2201x_channel  ch,
int16_t  offset 
)

Set offset value for output calibration.

Calibrate the offset of a specific channel.

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

◆ max2201x_op_mode()

int max2201x_op_mode ( struct max2201x_desc desc,
enum max2201x_channel  ch,
enum max2201x_op_mode  op_mode 
)

Set operation mode for requested channel.

Set operation mode for specific channel.

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

◆ max2201x_reg_read()

int max2201x_reg_read ( struct max2201x_desc desc,
uint32_t  addr,
uint32_t *  val 
)

Read the value of a device register.

Read register value from the MAX2201X.

Parameters
desc- device descriptor for the MAX2201X
addr- address of the register
val- value of the register
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max2201x_reg_update()

int max2201x_reg_update ( struct max2201x_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 MAX2201X.

Parameters
desc- device descriptor for the MAX2201X
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
Here is the caller graph for this function:

◆ max2201x_reg_write()

int max2201x_reg_write ( struct max2201x_desc desc,
uint32_t  addr,
uint32_t  val 
)

Write the value of a device register.

Write to a register from MAX2201X.

Parameters
desc- device descriptor for the MAX2201X
addr- address of the register
val- value of the register
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max2201x_remove()

int max2201x_remove ( struct max2201x_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 MAX2201X that will be initialized.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ max2201x_set_data()

int max2201x_set_data ( struct max2201x_desc desc,
enum max2201x_channel  ch,
int32_t  data 
)

Set data of the selected channel.

Set data for specific channel.

Parameters
desc- MAX2201X device descriptor
ch- Selected channel
data- Data to be set.
Returns
0 in case of succes, negative error code otherwise
Here is the caller graph for this function:

◆ max2201x_set_timeout()

int max2201x_set_timeout ( struct max2201x_desc desc,
bool  timeout_cnfg,
bool  timeout_en,
enum max2201x_timeout_sel  timeout 
)

Set timeout settings for MAX2201X device.

Set timeout settings.

Parameters
desc- MAX2201X 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

◆ max2201x_slew_rate()

int max2201x_slew_rate ( struct max2201x_desc desc,
enum max2201x_channel  ch,
enum max2201x_sr_step_size  step_size,
enum max2201x_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- MAX2201X 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
Here is the caller graph for this function:

◆ max2201x_soft_reset()

int max2201x_soft_reset ( struct max2201x_desc desc,
enum max2201x_channel  ch,
bool  coeff_only 
)

Soft reset requested channel.

Soft-reset the MAX2201X.

Parameters
desc- MAX2201X device descriptor
ch- Selected channel
coeff_only- Coefficient only reset enable/disable
Returns
0 in case of succes, negative error code otherwise
Here is the caller graph for this function:

Variable Documentation

◆ max2201x_gpio_ops

const struct no_os_gpio_platform_ops max2201x_gpio_ops