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

Header file of MAX22200 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 max22200.h:

Classes

struct  max22200_init_param
 
struct  max22200_desc
 

Macros

#define MAX22200_FRAME_SIZE   4
 
#define MAX22200_CHANNELS   8
 
#define MAX22200_CHANNELS_CONFIG   4
 
#define MAX22200_MAX_CHN_IDX   7
 
#define MAX22200_HIT_MAX_VAL   0x7F
 
#define MAX22200_HIT_NO_TIME   0x00
 
#define MAX22200_R1B   NO_OS_BIT(0)
 
#define MAX22200_STATUS_REG   0x00
 
#define MAX22200_CFG_CH(x)
 
#define MAX22200_FAULT_REG   0x09
 
#define MAX22200_CFG_DPM_REG   0x0A
 
#define MAX22200_RW_MASK   NO_OS_BIT(7)
 
#define MAX22200_ADDR_MASK   NO_OS_GENMASK(6, 0)
 
#define MAX22200_ONCH_MASK(x)
 
#define MAX22200_STATUS_ONCH_MASK   NO_OS_GENMASK(31, 24)
 
#define MAX22200_STATUS_FREQ_MASK   NO_OS_BIT(16)
 
#define MAX22200_STATUS_FAULT_MASK(x)
 
#define MAX22200_STATUS_MODE_MASK   NO_OS_GENMASK(15, 8)
 
#define MAX22200_CH_MODE_MASK(x)
 
#define MAX22200_STATUS_FLAG_MASK   NO_OS_GENMASK(7, 0)
 
#define MAX22200_ACTIVE_MASK   NO_OS_BIT(0)
 
#define MAX22200_HFS_MASK   NO_OS_BIT(31)
 
#define MAX22200_HOLD_MASK   NO_OS_GENMASK(30, 24)
 
#define MAX22200_TRGNSP_IO_MASK   NO_OS_BIT(23)
 
#define MAX22200_HIT_MASK   NO_OS_GENMASK(22, 16)
 
#define MAX22200_HIT_T_MASK   NO_OS_GENMASK(15, 8)
 
#define MAX22200_VDRNCDR_MASK   NO_OS_BIT(7)
 
#define MAX22200_HSNLS_MASK   NO_OS_BIT(6)
 
#define MAX22200_FREQ_CFG_MASK   NO_OS_GENMASK(5, 4)
 
#define MAX22200_CH_ENABLE_MASK(x)
 
#define MAX22200_DPM_ISTART_MASK   NO_OS_GENMASK(14, 8)
 
#define MAX22200_DPM_TDEB_MASK   NO_OS_GENMASK(7, 4)
 
#define MAX22200_DPM_IPTH_MASK   NO_OS_GENMASK(3, 0)
 

Enumerations

enum  max22200_fault_mask {
  MAX22200_M_UVM = 17 ,
  MAX22200_M_COMF ,
  MAX22200_M_DPM ,
  MAX22200_M_HHF ,
  MAX22200_M_OLF ,
  MAX22200_M_OCP ,
  MAX22200_M_OVT
}
 
enum  max22200_chopping_freq {
  MAX22200_FREQ_100KHZ ,
  MAX22200_FREQ_80KHZ
}
 
enum  max22200_ch_op_mode {
  MAX22200_INDEPENDENT_MODE ,
  MAX22200_PARALLEL_MODE ,
  MAX22200_HALF_BRIDGE_MODE
}
 
enum  max22200_scale {
  MAX22200_FULLSCALE ,
  MAX22200_HALF_FULL_SCALE
}
 
enum  max22200_trig {
  MAX22200_ONCH_SPI ,
  MAX22200_TRIG
}
 
enum  max22200_ch_drive {
  MAX22200_CURRENT_DRIVE ,
  MAX22200_VOLTAGE_DRIVE
}
 
enum  max22200_ch_side {
  MAX22200_LOW_SIDE ,
  MAX22200_HIGH_SIDE
}
 
enum  max22200_ch_freq {
  MAX22200_FREQMAIN_DIV_4 ,
  MAX22200_FREQMAIN_DIV_3 ,
  MAX22200_FREQMAIN_DIV_2 ,
  MAX22200_FREQMAIN
}
 
enum  max22200_ch_enable {
  MAX22200_HHF_ENABLE ,
  MAX22200_DPM_ENABLE ,
  MAX22200_OL_ENABLE ,
  MAX22200_SRC
}
 

Functions

int max22200_reg_read (struct max22200_desc *, uint32_t, uint32_t *)
 Read data from desired register for MAX22200.
 
int max22200_reg_write (struct max22200_desc *, uint32_t, uint32_t)
 Write data to desired register for MAX22200.
 
int max22200_reg_update (struct max22200_desc *, uint32_t, uint32_t, uint32_t)
 Update data in the desired register.
 
int max22200_set_trig_state (struct max22200_desc *, bool)
 Set external trigger's state of the MAX22200.
 
int max22200_set_ch_state (struct max22200_desc *, uint32_t, bool)
 Set channel state for specific channel.
 
int max22200_fault_mask_set (struct max22200_desc *, enum max22200_fault_mask, bool)
 Set fault mask bits in the status register.
 
int max22200_set_chop_freq (struct max22200_desc *, enum max22200_chopping_freq)
 Set chopping frequency value.
 
int max22200_set_ch_hit (struct max22200_desc *, uint32_t, uint8_t, uint8_t)
 Set channel HIT time and HIT current.
 
int max22200_set_ch_hold (struct max22200_desc *, uint32_t, uint8_t)
 Set channel hold current.
 
int max22200_set_ch_scale (struct max22200_desc *, uint32_t, enum max22200_scale)
 Set channel's scale to fullscale or half fullscale.
 
int max22200_set_ch_trig (struct max22200_desc *, uint32_t, enum max22200_trig)
 Set channel's trigger to be either SPI or external trigger.
 
int max22200_set_ch_mode (struct max22200_desc *, uint32_t, enum max22200_ch_drive, enum max22200_ch_side, enum max22200_ch_op_mode)
 Set chanmel operation mode, high-side/low-side and drive.
 
int max22200_set_ch_freq (struct max22200_desc *, uint32_t, enum max22200_ch_freq)
 Set channel's frequency.
 
int max22200_set_ch_enable (struct max22200_desc *, uint32_t, enum max22200_ch_enable, bool)
 Set channel's enables for different checks, detection and functions.
 
int max22200_set_cfg_dpm (struct max22200_desc *, uint8_t, uint8_t)
 Set configuration DPM.
 
int max22200_fault_mask_get (struct max22200_desc *, enum max22200_fault_mask, bool *)
 Fault mask bit get function.
 
int max22200_get_ch_state (struct max22200_desc *, uint32_t, bool *)
 Read the state of a channel.
 
int max22200_get_chop_freq (struct max22200_desc *, enum max22200_chopping_freq *)
 Read chopping frequency.
 
int max22200_get_ch_hit (struct max22200_desc *, uint32_t, uint8_t *, uint8_t *)
 Read channel HIT configuration.
 
int max22200_get_ch_hold (struct max22200_desc *, uint32_t, uint8_t *)
 Read channel HOLD configuration.
 
int max22200_get_ch_scale (struct max22200_desc *, uint32_t, enum max22200_scale *)
 Read channel's scale.
 
int max22200_get_ch_trig (struct max22200_desc *, uint32_t, enum max22200_trig *)
 Read channel's selected trigger for specific channel.
 
int max22200_get_ch_mode (struct max22200_desc *, uint32_t, enum max22200_ch_drive *, enum max22200_ch_side *, enum max22200_ch_op_mode *)
 Read channel's mode configuration.
 
int max22200_get_ch_freq (struct max22200_desc *, uint32_t, enum max22200_ch_freq *)
 Read channel's frequency.
 
int max22200_get_ch_enable (struct max22200_desc *, uint32_t, enum max22200_ch_enable, bool *)
 Read channel's enable bits state.
 
int max22200_get_cfg_dpm (struct max22200_desc *, uint8_t *, uint8_t *)
 Read configuration for the detection of the plunger movement of the device.
 
int max22200_init (struct max22200_desc **, struct max22200_init_param *)
 MAX22200 descriptor initialization function.
 
int max22200_remove (struct max22200_desc *)
 Deallocates all the resources used at initialization.
 

Detailed Description

Header file of MAX22200 Driver.

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

Copyright 2023(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ MAX22200_ACTIVE_MASK

#define MAX22200_ACTIVE_MASK   NO_OS_BIT(0)

◆ MAX22200_ADDR_MASK

#define MAX22200_ADDR_MASK   NO_OS_GENMASK(6, 0)

◆ MAX22200_CFG_CH

#define MAX22200_CFG_CH ( x)
Value:
(0x01 + (0x01 * (x)))

◆ MAX22200_CFG_DPM_REG

#define MAX22200_CFG_DPM_REG   0x0A

◆ MAX22200_CH_ENABLE_MASK

#define MAX22200_CH_ENABLE_MASK ( x)
Value:
#define NO_OS_BIT(x)
Definition no_os_util.h:23

◆ MAX22200_CH_MODE_MASK

#define MAX22200_CH_MODE_MASK ( x)
Value:
NO_OS_GENMASK(8 + (2 * (x)), 9 + (2 * (x)))
#define NO_OS_GENMASK(h, l)
Definition no_os_util.h:60

◆ MAX22200_CHANNELS

#define MAX22200_CHANNELS   8

◆ MAX22200_CHANNELS_CONFIG

#define MAX22200_CHANNELS_CONFIG   4

◆ MAX22200_DPM_IPTH_MASK

#define MAX22200_DPM_IPTH_MASK   NO_OS_GENMASK(3, 0)

◆ MAX22200_DPM_ISTART_MASK

#define MAX22200_DPM_ISTART_MASK   NO_OS_GENMASK(14, 8)

◆ MAX22200_DPM_TDEB_MASK

#define MAX22200_DPM_TDEB_MASK   NO_OS_GENMASK(7, 4)

◆ MAX22200_FAULT_REG

#define MAX22200_FAULT_REG   0x09

◆ MAX22200_FRAME_SIZE

#define MAX22200_FRAME_SIZE   4

◆ MAX22200_FREQ_CFG_MASK

#define MAX22200_FREQ_CFG_MASK   NO_OS_GENMASK(5, 4)

◆ MAX22200_HFS_MASK

#define MAX22200_HFS_MASK   NO_OS_BIT(31)

◆ MAX22200_HIT_MASK

#define MAX22200_HIT_MASK   NO_OS_GENMASK(22, 16)

◆ MAX22200_HIT_MAX_VAL

#define MAX22200_HIT_MAX_VAL   0x7F

◆ MAX22200_HIT_NO_TIME

#define MAX22200_HIT_NO_TIME   0x00

◆ MAX22200_HIT_T_MASK

#define MAX22200_HIT_T_MASK   NO_OS_GENMASK(15, 8)

◆ MAX22200_HOLD_MASK

#define MAX22200_HOLD_MASK   NO_OS_GENMASK(30, 24)

◆ MAX22200_HSNLS_MASK

#define MAX22200_HSNLS_MASK   NO_OS_BIT(6)

◆ MAX22200_MAX_CHN_IDX

#define MAX22200_MAX_CHN_IDX   7

◆ MAX22200_ONCH_MASK

#define MAX22200_ONCH_MASK ( x)
Value:
NO_OS_BIT((x) + 24)

◆ MAX22200_R1B

#define MAX22200_R1B   NO_OS_BIT(0)

◆ MAX22200_RW_MASK

#define MAX22200_RW_MASK   NO_OS_BIT(7)

◆ MAX22200_STATUS_FAULT_MASK

#define MAX22200_STATUS_FAULT_MASK ( x)
Value:

◆ MAX22200_STATUS_FLAG_MASK

#define MAX22200_STATUS_FLAG_MASK   NO_OS_GENMASK(7, 0)

◆ MAX22200_STATUS_FREQ_MASK

#define MAX22200_STATUS_FREQ_MASK   NO_OS_BIT(16)

◆ MAX22200_STATUS_MODE_MASK

#define MAX22200_STATUS_MODE_MASK   NO_OS_GENMASK(15, 8)

◆ MAX22200_STATUS_ONCH_MASK

#define MAX22200_STATUS_ONCH_MASK   NO_OS_GENMASK(31, 24)

◆ MAX22200_STATUS_REG

#define MAX22200_STATUS_REG   0x00

◆ MAX22200_TRGNSP_IO_MASK

#define MAX22200_TRGNSP_IO_MASK   NO_OS_BIT(23)

◆ MAX22200_VDRNCDR_MASK

#define MAX22200_VDRNCDR_MASK   NO_OS_BIT(7)

Enumeration Type Documentation

◆ max22200_ch_drive

Enumerator
MAX22200_CURRENT_DRIVE 
MAX22200_VOLTAGE_DRIVE 

◆ max22200_ch_enable

Enumerator
MAX22200_HHF_ENABLE 
MAX22200_DPM_ENABLE 
MAX22200_OL_ENABLE 
MAX22200_SRC 

◆ max22200_ch_freq

Enumerator
MAX22200_FREQMAIN_DIV_4 
MAX22200_FREQMAIN_DIV_3 
MAX22200_FREQMAIN_DIV_2 
MAX22200_FREQMAIN 

◆ max22200_ch_op_mode

Enumerator
MAX22200_INDEPENDENT_MODE 
MAX22200_PARALLEL_MODE 
MAX22200_HALF_BRIDGE_MODE 

◆ max22200_ch_side

Enumerator
MAX22200_LOW_SIDE 
MAX22200_HIGH_SIDE 

◆ max22200_chopping_freq

Enumerator
MAX22200_FREQ_100KHZ 
MAX22200_FREQ_80KHZ 

◆ max22200_fault_mask

Enumerator
MAX22200_M_UVM 
MAX22200_M_COMF 
MAX22200_M_DPM 
MAX22200_M_HHF 
MAX22200_M_OLF 
MAX22200_M_OCP 
MAX22200_M_OVT 

◆ max22200_scale

Enumerator
MAX22200_FULLSCALE 
MAX22200_HALF_FULL_SCALE 

◆ max22200_trig

Enumerator
MAX22200_ONCH_SPI 
MAX22200_TRIG 

Function Documentation

◆ max22200_fault_mask_get()

int max22200_fault_mask_get ( struct max22200_desc * desc,
enum max22200_fault_mask fault_mask,
bool * enabled )

Fault mask bit get function.

Fault mask bit get function

Parameters
desc- MAX22200 device descriptor.
fault_mask- Fault mask specific bit to read the state for.
enabled- State of the bit.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_fault_mask_set()

int max22200_fault_mask_set ( struct max22200_desc * desc,
enum max22200_fault_mask fault_mask,
bool enabled )

Set fault mask bits in the status register.

Set fault mask bits in the status register.

Parameters
desc- MAX22200 device descriptor.
fault_mask- Desired fault mask bit to set.
enabled- enabled/disabled state of the mask.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_cfg_dpm()

int max22200_get_cfg_dpm ( struct max22200_desc * desc,
uint8_t * dpm_istart_byte,
uint8_t * dpm_tdeb_ipth_byte )

Read configuration for the detection of the plunger movement of the device.

Read configuration for the detection of the plunger movement of the device.

Parameters
desc- MAX22200 device descriptor.
dpm_istart_byte- Detection of plunger movement starting current value.
dpm_tdeb_ipth_byte- Detection of plunger movement debounce time value.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_enable()

int max22200_get_ch_enable ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_enable ch_enable,
bool * enabled )

Read channel's enable bits state.

Read channel's enable bits state.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
ch_enable- Requested channel enable bit to read the state for.
enabled- Requested enabled bit state.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_freq()

int max22200_get_ch_freq ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_freq * ch_freq )

Read channel's frequency.

Read channel's frequency.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
ch_freq- Channel's frequency value read from the device.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_hit()

int max22200_get_ch_hit ( struct max22200_desc * desc,
uint32_t ch,
uint8_t * hit_current,
uint8_t * hit_time )

Read channel HIT configuration.

Read channel HIT configuration.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
hit_current- HIT current value read from the device.
hit_time- HIT time value read from the device.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_hold()

int max22200_get_ch_hold ( struct max22200_desc * desc,
uint32_t ch,
uint8_t * hold_current )

Read channel HOLD configuration.

Read channel HOLD configuration.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
hold_current- HOLD current value read from the device.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_mode()

int max22200_get_ch_mode ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_drive * ch_drive,
enum max22200_ch_side * ch_side,
enum max22200_ch_op_mode * ch_op_mode )

Read channel's mode configuration.

Read channel's mode configuration.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
ch_drive- Channel's drive read from the device.
ch_side- Channel's high-side/low-side configuraton read from the device.
ch_op_mode- Channel's operation mode read from the device.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_scale()

int max22200_get_ch_scale ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_scale * scale )

Read channel's scale.

Read channel's scale.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
scale- Scale read from device's channel.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_state()

int max22200_get_ch_state ( struct max22200_desc * desc,
uint32_t ch,
bool * ch_state )

Read the state of a channel.

Get the state of a specific channel.

Parameters
desc- MAX22200 device descriptor
ch- Channel number (0 based).
ch_state- State of the channel.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_ch_trig()

int max22200_get_ch_trig ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_trig * trig )

Read channel's selected trigger for specific channel.

Read channel's selected trigger for specific channel.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
trig- Selected trigger for the channel requested read from the device.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_get_chop_freq()

int max22200_get_chop_freq ( struct max22200_desc * desc,
enum max22200_chopping_freq * chopping_freq )

Read chopping frequency.

Read device frequency

Parameters
desc- MAX22200 device descriptor.
chopping_freq- Pointer of the variable holding the value of the chopping frequency.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_init()

int max22200_init ( struct max22200_desc ** desc,
struct max22200_init_param * init_param )

MAX22200 descriptor initialization function.

MAX22200 device initialization function.

Parameters
desc- MAX22200 device descriptor.
init_param- Initialization parameter containing data about the device descriptor to be initialized.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_reg_read()

int max22200_reg_read ( struct max22200_desc * desc,
uint32_t reg,
uint32_t * val )

Read data from desired register for MAX22200.

Read data from desired register for MAX22200.

Parameters
desc- MAX22200 device descriptor.
reg- Register address to read data from.
val- Value read from the register.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_reg_update()

int max22200_reg_update ( struct max22200_desc * desc,
uint32_t reg,
uint32_t mask,
uint32_t val )

Update data in the desired register.

Update data in the desired register.

Parameters
desc- MAX22200 device descriptor.
reg- Register address to update data to.
mask- Bit mask of the field to be updated.
val- Value to be updated in the desired register. Should be bit shifted by using no_os_field_prep(mask, val)
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_reg_write()

int max22200_reg_write ( struct max22200_desc * desc,
uint32_t reg,
uint32_t val )

Write data to desired register for MAX22200.

Write data to desired register for MAX22200

Parameters
desc- MAXX22200 device descriptor.
reg- Register address to write data to.
val- Value to be written to the register.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_remove()

int max22200_remove ( struct max22200_desc * desc)

Deallocates all the resources used at initialization.

Deallocates all the resources used at initialization.

Parameters
desc- MAX22200 device descriptor.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_cfg_dpm()

int max22200_set_cfg_dpm ( struct max22200_desc * desc,
uint8_t dpm_istart_byte,
uint8_t dpm_tdeb_ipth_byte )

Set configuration DPM.

Set configuration DPM.

Parameters
desc- MAX22200 device descriptor.
dpm_istart_byte- Detection of plunger movement starting current
dpm_tdeb_ipth_byte- Detection of plunger movement debounce time.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_enable()

int max22200_set_ch_enable ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_enable ch_enable,
bool enabled )

Set channel's enables for different checks, detection and functions.

Set channel's enables for different checks, detection and functions.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
ch_enable- Channel enable to be set.
enabled- Disabled/Enabled state.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_freq()

int max22200_set_ch_freq ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_freq ch_freq )

Set channel's frequency.

Set channel's frequency.

Parameters
desc- MAX22200 device descriptor
ch- Channel's number (0 based).
ch_freq- 80KHz/100KHz frequency.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_hit()

int max22200_set_ch_hit ( struct max22200_desc * desc,
uint32_t ch,
uint8_t hit_current,
uint8_t hit_time )

Set channel HIT time and HIT current.

Set channel HIT time and HIT current.

Parameters
desc- MAX22200 device descriptor.
ch- Channel for which HIT time is to be set.(0 based)
hit_current- HIT current value, it shall not be greater than 127 since the value is stored only on 7 bits in the channel's configuration register.
hit_time- HIT time value to be set.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_hold()

int max22200_set_ch_hold ( struct max22200_desc * desc,
uint32_t ch,
uint8_t hold_current )

Set channel hold current.

Set channel hold current.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
hold_current- Hold current value to be set. It shall not be greater than 127 since the value it's stored on 7 bits in the channel's configuration register.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_mode()

int max22200_set_ch_mode ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_ch_drive ch_drive,
enum max22200_ch_side ch_side,
enum max22200_ch_op_mode ch_op_mode )

Set chanmel operation mode, high-side/low-side and drive.

Set chanmel operation mode, high-side/low-side and drive.

Parameters
desc- MAX22200 device descriptor.
ch- Channel number (0 based).
ch_drive- Voltage/Current drive.
ch_side- High-Side/Low-Side.
ch_op_mode- Independent/Half-Bridge/Full-Bridge mode.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_scale()

int max22200_set_ch_scale ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_scale scale )

Set channel's scale to fullscale or half fullscale.

Set channel's scale to fullscale or half fullscale.

Parameters
desc- MAX22200 device dscriptor.
ch- Channel's number (0 based).
scale- Scale value.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_ch_state()

int max22200_set_ch_state ( struct max22200_desc * desc,
uint32_t ch,
bool ch_state )

Set channel state for specific channel.

Set channel state for specific channel.

Parameters
desc- MAX22200 device descriptor.
ch- Channel number.
ch_state- Channel's state to be changed into.
Returns
0 in case of succces, negative error code otherwise.

◆ max22200_set_ch_trig()

int max22200_set_ch_trig ( struct max22200_desc * desc,
uint32_t ch,
enum max22200_trig trig )

Set channel's trigger to be either SPI or external trigger.

Set channel's trigger to be either SPI or external trigger.

Parameters
desc- MAX22200 device descriptor.
ch- Channel's number (0 based).
trig- Trigger to be set. If external trigger is requested but no external's trigger descriptor was initialized, will return negative error code.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_chop_freq()

int max22200_set_chop_freq ( struct max22200_desc * desc,
enum max22200_chopping_freq chopping_freq )

Set chopping frequency value.

Set device frequency value.

Parameters
desc- MAX22200 device descriptor.
chopping_freq- Chopping frequency value.
Returns
0 in case of succes, negative error code otherwise.

◆ max22200_set_trig_state()

int max22200_set_trig_state ( struct max22200_desc * desc,
bool trig_state )

Set external trigger's state of the MAX22200.

Set external trigger's state of the MAX22200.

Parameters
desc- MAX22200 device descriptor.
trig_state- State to change to.
Returns
0 in case of succes, negative error code otherwise.