no-OS
|
Source file of MAX2201X Driver. More...
#include <stdlib.h>
#include <string.h>
#include "max2201x.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
#include "no_os_crc8.h"
Functions | |
NO_OS_DECLARE_CRC8_TABLE (table) | |
int32_t | max2201x_gpio_get (struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param) |
Obtain the GPIO decriptor. More... | |
int32_t | max2201x_gpio_remove (struct no_os_gpio_desc *desc) |
Free the resources allocated by no_os_gpio_get(). More... | |
int32_t | max2201x_gpio_direction_input (struct no_os_gpio_desc *desc) |
Enable the input direction of the specified GPIO. More... | |
int32_t | max2201x_gpio_direction_output (struct no_os_gpio_desc *desc, uint8_t value) |
Enable the output direction of the specified GPIO. More... | |
int32_t | max2201x_gpio_get_direction (struct no_os_gpio_desc *desc, uint8_t *direction) |
Get the direction of the specified GPIO. More... | |
int32_t | max2201x_gpio_set_value (struct no_os_gpio_desc *desc, uint8_t value) |
Set the value of the specified GPIO. More... | |
int32_t | max2201x_gpio_get_value (struct no_os_gpio_desc *desc, uint8_t *value) |
Get the value of the specified GPIO. More... | |
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. More... | |
int | max2201x_set_data (struct max2201x_desc *desc, enum max2201x_channel ch, int32_t data) |
Set data of the selected channel. More... | |
int | max2201x_get_data (struct max2201x_desc *desc, enum max2201x_channel ch, int32_t *data) |
Get data from requestec channel. More... | |
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. More... | |
int | max2201x_offset_calib (struct max2201x_desc *desc, enum max2201x_channel ch, int16_t offset) |
Set offset value for output calibration. More... | |
int | max2201x_gain_calib (struct max2201x_desc *desc, enum max2201x_channel ch, uint16_t gain) |
Set gain value for calibration of requested channel. More... | |
int | max2201x_op_mode (struct max2201x_desc *desc, enum max2201x_channel ch, enum max2201x_op_mode op_mode) |
Set operation mode for requested channel. More... | |
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. More... | |
int | max2201x_soft_reset (struct max2201x_desc *desc, enum max2201x_channel ch, bool coeff_only) |
Soft reset requested channel. More... | |
int | max2201x_reg_read (struct max2201x_desc *desc, uint32_t addr, uint32_t *val) |
Read the value of a device register. More... | |
int | max2201x_reg_write (struct max2201x_desc *desc, uint32_t addr, uint32_t val) |
Write the value of a device register. More... | |
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). More... | |
int | max2201x_init (struct max2201x_desc **desc, struct max2201x_init_param *param) |
Initialize and configure the MAX2201X device. More... | |
int | max2201x_remove (struct max2201x_desc *desc) |
Free the resources allocated during init and perform a soft reset. More... | |
Variables | |
const struct no_os_gpio_platform_ops | max2201x_gpio_ops |
Source file of MAX2201X Driver.
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.
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.
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. |
int max2201x_gain_calib | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
uint16_t | gain | ||
) |
Set gain value for calibration of requested channel.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
gain | - Gain value |
int max2201x_get_data | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
int32_t * | data | ||
) |
Get data from requestec channel.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
data | - Received data from channel |
int32_t max2201x_gpio_direction_input | ( | struct no_os_gpio_desc * | desc | ) |
Enable the input direction of the specified GPIO.
desc | - The GPIO descriptor. |
int32_t max2201x_gpio_direction_output | ( | struct no_os_gpio_desc * | desc, |
uint8_t | value | ||
) |
Enable the output direction of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW |
int32_t max2201x_gpio_get | ( | struct no_os_gpio_desc ** | desc, |
const struct no_os_gpio_init_param * | param | ||
) |
Obtain the GPIO decriptor.
desc | - The GPIO descriptor. |
param | - GPIO initialization parameters |
int32_t max2201x_gpio_get_direction | ( | struct no_os_gpio_desc * | desc, |
uint8_t * | direction | ||
) |
Get the direction of the specified GPIO.
desc | - The GPIO descriptor. |
direction | - The direction. Example: NO_OS_GPIO_OUT NO_OS_GPIO_IN |
int32_t max2201x_gpio_get_value | ( | struct no_os_gpio_desc * | desc, |
uint8_t * | value | ||
) |
Get the value of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW |
int32_t max2201x_gpio_remove | ( | struct no_os_gpio_desc * | desc | ) |
Free the resources allocated by no_os_gpio_get().
desc | - The GPIO descriptor. |
int32_t max2201x_gpio_set_value | ( | struct no_os_gpio_desc * | desc, |
uint8_t | value | ||
) |
Set the value of the specified GPIO.
desc | - The GPIO descriptor. |
value | - The value. Example: NO_OS_GPIO_HIGH NO_OS_GPIO_LOW |
int max2201x_init | ( | struct max2201x_desc ** | desc, |
struct max2201x_init_param * | param | ||
) |
Initialize and configure the MAX2201X device.
desc | - device descriptor for the MAX2201X that will be initialized. |
param | - initialization parameter for the device. |
int max2201x_offset_calib | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
int16_t | offset | ||
) |
Set offset value for output calibration.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
offset | - Offset value |
int max2201x_op_mode | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
enum max2201x_op_mode | op_mode | ||
) |
Set operation mode for requested channel.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
op_mode | - Operation mode |
int max2201x_reg_read | ( | struct max2201x_desc * | desc, |
uint32_t | addr, | ||
uint32_t * | val | ||
) |
Read the value of a device register.
desc | - device descriptor for the MAX2201X |
addr | - address of the register |
val | - value of the register |
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).
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) |
int max2201x_reg_write | ( | struct max2201x_desc * | desc, |
uint32_t | addr, | ||
uint32_t | val | ||
) |
Write the value of a device register.
desc | - device descriptor for the MAX2201X |
addr | - address of the register |
val | - value of the register |
int max2201x_remove | ( | struct max2201x_desc * | desc | ) |
Free the resources allocated during init and perform a soft reset.
desc | - device descriptor for the MAX2201X that will be initialized. |
int max2201x_set_data | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
int32_t | data | ||
) |
Set data of the selected channel.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
data | - Data to be set. |
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.
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 |
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.
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 |
int max2201x_soft_reset | ( | struct max2201x_desc * | desc, |
enum max2201x_channel | ch, | ||
bool | coeff_only | ||
) |
Soft reset requested channel.
desc | - MAX2201X device descriptor |
ch | - Selected channel |
coeff_only | - Coefficient only reset enable/disable |
NO_OS_DECLARE_CRC8_TABLE | ( | table | ) |
const struct no_os_gpio_platform_ops max2201x_gpio_ops |