no-OS
Classes | Macros | Enumerations | Functions | Variables
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:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

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)   NO_OS_BIT(8 + (x))
 
#define MAX22017_GPIO_DIR_MASK(x)   NO_OS_BIT(x)
 
#define MAX22017_GPIO_OUT_VAL_MASK(x)   NO_OS_BIT(8 + (x))
 
#define MAX22017_GPIO_IN_VAL_MASK(x)   NO_OS_BIT(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)   NO_OS_BIT(x)
 
#define MAX22017_AO_EN_MODE_MASK   NO_OS_BIT(2)
 
#define MAX22017_AI_EN_MASK(x)   NO_OS_BIT(2 + (x))
 
#define MAX22017_AI_EN_MODE_MASK   NO_OS_BIT(1)
 
#define MAX22017_AO_MODE_MASK(x)   NO_OS_BIT(8 + (x))
 
#define MAX22017_AO_MODE_MODE_MASK   NO_OS_BIT(0)
 
#define MAX22017_OP_MODE_MASK(x)   (NO_OS_BIT(x) | NO_OS_BIT(2 + (x)) | NO_OS_BIT(8 + (x)))
 
#define MAX22017_LD_CNFG_MASK(x)   NO_OS_BIT(14 + (x))
 
#define MAX22017_CM_SENSE_MASK(x)   NO_OS_BIT(12 + (x))
 
#define MAX22017_UNI_MASK(x)   NO_OS_BIT(10 + (x))
 
#define MAX22017_OW_MASK(x)   NO_OS_BIT(4 + (x))
 
#define MAX22017_CNFG_MASK(x)   (NO_OS_BIT(14 + (x)) | NO_OS_BIT(12 + (x)) | NO_OS_BIT(10 + (x)) | NO_OS_BIT(4 + (x)))
 
#define MAX22017_COEFF_ONLY_MASK   NO_OS_GENMASK(15, 14)
 
#define MAX22017_RST_MASK(x)   NO_OS_BIT(14 + (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. More...
 
int32_t max22017_gpio_remove (struct no_os_gpio_desc *)
 Free the resources allocated by no_os_gpio_get(). More...
 
int32_t max22017_gpio_direction_input (struct no_os_gpio_desc *)
 Enable the input direction of the specified GPIO. More...
 
int32_t max22017_gpio_direction_output (struct no_os_gpio_desc *, uint8_t)
 Enable the output direction of the specified GPIO. More...
 
int32_t max22017_gpio_get_direction (struct no_os_gpio_desc *, uint8_t *)
 Get the direction of the specified GPIO. More...
 
int32_t max22017_gpio_set_value (struct no_os_gpio_desc *, uint8_t)
 Set the value of the specified GPIO. More...
 
int32_t max22017_gpio_get_value (struct no_os_gpio_desc *, uint8_t *)
 Get the value of the specified GPIO. More...
 
int max22017_set_timeout (struct max22017_desc *, bool, bool, enum max22017_timeout_sel)
 Set timeout settings for MAX22017 device. More...
 
int max22017_set_data (struct max22017_desc *, enum max22017_channel, int32_t)
 Set data of the selected channel. More...
 
int max22017_get_data (struct max22017_desc *, enum max22017_channel, int32_t *)
 Get data from requestec channel. More...
 
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. More...
 
int max22017_offset_calib (struct max22017_desc *, enum max22017_channel, int16_t)
 Set offset value for output calibration. More...
 
int max22017_gain_calib (struct max22017_desc *, enum max22017_channel, uint16_t)
 Set gain value for calibration of requested channel. More...
 
int max22017_op_mode (struct max22017_desc *, enum max22017_channel, enum max22017_op_mode)
 Set operation mode for requested channel. More...
 
int max22017_config (struct max22017_desc *, enum max22017_channel, enum max22017_out_mode, enum max22017_cm_sense, bool)
 Set AO configuration. More...
 
int max22017_soft_reset (struct max22017_desc *, enum max22017_channel, bool)
 Soft reset requested channel. More...
 
int max22017_reg_read (struct max22017_desc *, uint32_t, uint32_t *)
 Read the value of a device register. More...
 
int max22017_reg_write (struct max22017_desc *, uint32_t, uint32_t)
 Write the value of a device register. More...
 
int max22017_reg_update (struct max22017_desc *, uint32_t, uint32_t, uint32_t)
 Update the value of a device register (read/write sequence). More...
 
int max22017_init (struct max22017_desc **, struct max22017_init_param *)
 Initialize and configure the MAX22017 device. More...
 
int max22017_remove (struct max22017_desc *)
 Free the resources allocated during init and perform a soft reset. More...
 

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.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

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)    NO_OS_BIT(2 + (x))

◆ 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)    NO_OS_BIT(x)

◆ 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)    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)    NO_OS_BIT(12 + (x))

◆ MAX22017_CNFG_MASK

#define MAX22017_CNFG_MASK (   x)    (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)    NO_OS_BIT(x)

◆ MAX22017_GPIO_IN_VAL_MASK

#define MAX22017_GPIO_IN_VAL_MASK (   x)    NO_OS_BIT(x)

◆ MAX22017_GPIO_MASK

#define MAX22017_GPIO_MASK (   x)    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)    NO_OS_BIT(8 + (x))

◆ MAX22017_LD_CNFG_MASK

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

◆ MAX22017_OP_MODE_MASK

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

◆ MAX22017_OW_MASK

#define MAX22017_OW_MASK (   x)    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)    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)    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
Here is the caller graph for this function:

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

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

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

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

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

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

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

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

Variable Documentation

◆ max22017_gpio_ops

const struct no_os_gpio_platform_ops max22017_gpio_ops