Go to the documentation of this file.
33 #ifndef IIO_MAX22200_H
34 #define IIO_MAX22200_H
41 #define MAX22200_HOLD_MAX_VAL 0xFF
42 #define MAX22200_HIT_T_MAX_VAL 0xFF
76 static const char *
const max22200_scale_avail[2] = {
81 static const char *
const max22200_channel_trig_avail[2] = {
86 static const char *
const max22200_ch_drive_avail[2] = {
91 static const char *
const max22200_ch_side_avail[2] = {
96 static const char *
const max22200_ch_op_mode_avail[3] = {
102 static const char *
const max22200_channel_freq_avail[4] = {
109 static const char *
const max22200_chopping_freq_avail[2] = {
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.
Definition: max22200.c:609
@ MAX22200_IIO_CH_SIDE
Definition: iio_max22200.h:61
@ MAX22200_IIO_CH_OP_MODE
Definition: iio_max22200.h:62
@ MAX22200_IIO_CH_DRIVE
Definition: iio_max22200.h:60
@ MAX22200_HHF_ENABLE
Definition: max22200.h:136
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.
Definition: max22200.c:324
@ MAX22200_M_DPM
Definition: max22200.h:90
int max22200_get_ch_freq(struct max22200_desc *desc, uint32_t ch, enum max22200_ch_freq *ch_freq)
Read channel's frequency.
Definition: max22200.c:644
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
int max22200_get_ch_state(struct max22200_desc *desc, uint32_t ch, bool *ch_state)
Read the state of a channel.
Definition: max22200.c:456
@ IIO_VAL_INT
Definition: iio_types.h:50
Struct describing the scan type.
Definition: iio_types.h:168
@ MAX22200_IIO_CH_TRIG
Definition: iio_max22200.h:59
#define MAX22200_CHANNEL(_addr)
Definition: iio_max22200.c:43
@ MAX22200_IIO_OVT_MASK
Definition: iio_max22200.h:51
struct iio_channel * channels
Definition: iio_types.h:254
@ MAX22200_SRC
Definition: max22200.h:139
MAX22200 specific IIO descriptor.
Definition: iio_max22200.h:117
@ MAX22200_IIO_CHOP_FREQ_AVAILABLE
Definition: iio_max22200.h:70
struct iio_device * iio_dev
Definition: iio_max22200.h:119
Structure holding channel attributess.
Definition: iio_types.h:103
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.
Definition: max22200.c:231
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.
Definition: max22200.c:670
@ MAX22200_IIO_CH_FREQ_AVAILABLE
Definition: iio_max22200.h:69
Definition: max22200.h:151
struct max22200_desc * max22200_desc
Definition: iio_max22200.h:118
max22200_chopping_freq
Definition: max22200.h:97
@ MAX22200_IIO_HOLD_CURRENT
Definition: iio_max22200.h:58
@ MAX22200_IIO_SCALE_AVAILABLE
Definition: iio_max22200.h:67
Initalization parameter fr the MAX22200 IIO descriptor.
Definition: iio_max22200.h:125
#define MAX22200_HFS_MASK
Definition: max22200.h:72
@ MAX22200_M_OCP
Definition: max22200.h:93
int max22200_init(struct max22200_desc **desc, struct max22200_init_param *init_param)
MAX22200 descriptor initialization function.
Definition: max22200.c:724
@ MAX22200_OL_ENABLE
Definition: max22200.h:138
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
int max22200_get_ch_scale(struct max22200_desc *desc, uint32_t ch, enum max22200_scale *scale)
Read channel's scale.
Definition: max22200.c:555
@ MAX22200_M_OVT
Definition: max22200.h:94
@ MAX22200_IIO_HHF_MASK
Definition: iio_max22200.h:48
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:283
@ MAX22200_IIO_CH_FREQ
Definition: iio_max22200.h:63
int max22200_get_ch_hold(struct max22200_desc *desc, uint32_t ch, uint8_t *hold_current)
Read channel HOLD configuration.
Definition: max22200.c:530
@ MAX22200_IIO_CH_DRIVE_AVAILABLE
Definition: iio_max22200.h:71
bool ch_out
Definition: iio_types.h:188
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:122
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max22200_scale
Definition: max22200.h:108
@ MAX22200_IIO_HIT_CURRENT
Definition: iio_max22200.h:56
const char * name
Definition: iio_types.h:131
int max22200_reg_read(struct max22200_desc *desc, uint32_t reg, uint32_t *val)
Read data from desired register for MAX22200.
Definition: max22200.c:48
struct max22200_init_param * max22200_init_param
Definition: iio_max22200.h:126
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.
Definition: max22200.c:391
max22200_iio_ch_attrs
Definition: iio_max22200.h:54
Header file of MAX22200 Driver.
@ MAX22200_DPM_ENABLE
Definition: max22200.h:137
@ MAX22200_M_HHF
Definition: max22200.h:91
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
@ MAX22200_TRIG
Definition: max22200.h:115
max22200_iio_fault_mask
Definition: iio_max22200.h:44
max22200_ch_drive
Definition: max22200.h:118
bool ch_enable[MAX22200_CHANNELS]
Definition: iio_max22200.h:127
int max22200_iio_remove(struct max22200_iio_desc *)
Free resources allocated by the init function.
Definition: iio_max22200.c:1080
int max22200_set_chop_freq(struct max22200_desc *desc, enum max22200_chopping_freq chopping_freq)
Set chopping frequency value.
Definition: max22200.c:214
@ MAX22200_M_OLF
Definition: max22200.h:92
int32_t iio_parse_value(char *buf, enum iio_val fmt, int32_t *val, int32_t *val2)
Definition: iio.c:630
@ MAX22200_IIO_CH_TRIG_AVAILABLE
Definition: iio_max22200.h:68
#define MAX22200_HIT_T_MAX_VAL
Definition: iio_max22200.h:42
Definition: max22200.h:142
@ MAX22200_IIO_OCP_MASK
Definition: iio_max22200.h:50
@ MAX22200_ONCH_SPI
Definition: max22200.h:114
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.
Definition: max22200.c:280
@ MAX22200_IIO_CH_SIDE_AVAILABLE
Definition: iio_max22200.h:72
int max22200_set_trig_state(struct max22200_desc *desc, bool trig_state)
Set external trigger's state of the MAX22200.
Definition: max22200.c:164
int max22200_iio_remove(struct max22200_iio_desc *iio_desc)
Free resources allocated by the init function.
Definition: iio_max22200.c:1080
max22200_ch_freq
Definition: max22200.h:128
@ MAX22200_IIO_DPM_MASK
Definition: iio_max22200.h:47
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.
Definition: max22200.c:302
@ MAX22200_FULLSCALE
Definition: max22200.h:109
int iio_format_value(char *buf, uint32_t len, enum iio_val fmt, int32_t size, int32_t *vals)
Definition: iio.c:686
int max22200_set_ch_hold(struct max22200_desc *desc, uint32_t ch, uint8_t hold_current)
Set channel hold current.
Definition: max22200.c:260
int max22200_iio_init(struct max22200_iio_desc **, struct max22200_iio_desc_init_param *)
Initializes the MAX22200 IIO descriptor.
Definition: iio_max22200.c:1041
uint32_t address
Definition: iio_types.h:113
@ MAX22200_IIO_HIT_TIME
Definition: iio_max22200.h:57
@ MAX22200_IIO_SCALE
Definition: iio_max22200.h:55
struct iio_attribute * attributes
Definition: iio_types.h:186
int max22200_get_ch_hit(struct max22200_desc *desc, uint32_t ch, uint8_t *hit_current, uint8_t *hit_time)
Read channel HIT configuration.
Definition: max22200.c:504
uint16_t num_ch
Definition: iio_types.h:252
@ MAX22200_M_UVM
Definition: max22200.h:88
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
@ MAX22200_IIO_CH_OP_MODE_AVAILABLE
Definition: iio_max22200.h:73
max22200_ch_side
Definition: max22200.h:123
@ MAX22200_HALF_FULL_SCALE
Definition: max22200.h:110
int max22200_set_ch_freq(struct max22200_desc *desc, uint32_t ch, enum max22200_ch_freq ch_freq)
Set channel's frequency.
Definition: max22200.c:372
int max22200_remove(struct max22200_desc *desc)
Deallocates all the resources used at initialization.
Definition: max22200.c:866
int max22200_fault_mask_get(struct max22200_desc *desc, enum max22200_fault_mask fault_mask, bool *enabled)
Fault mask bit get function.
Definition: max22200.c:433
#define MAX22200_CHANNELS
Definition: max22200.h:44
@ MAX22200_IIO_COMER_MASK
Definition: iio_max22200.h:46
max22200_ch_op_mode
Definition: max22200.h:102
#define NULL
Definition: wrapper.h:64
#define MAX22200_HOLD_MAX_VAL
Definition: iio_max22200.h:41
@ MAX22200_IIO_OLF_MASK
Definition: iio_max22200.h:49
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
int max22200_iio_setup_channels(struct max22200_iio_desc *desc, bool *ch_enable)
Definition: iio_max22200.c:998
#define MAX22200_HIT_MAX_VAL
Definition: max22200.h:47
int max22200_get_ch_trig(struct max22200_desc *desc, uint32_t ch, enum max22200_trig *trig)
Read channel's selected trigger for specific channel.
Definition: max22200.c:581
@ MAX22200_IIO_UVM_MASK
Definition: iio_max22200.h:45
#define MAX22200_TRGNSP_IO_MASK
Definition: max22200.h:74
max22200_iio_available
Definition: iio_max22200.h:66
int max22200_get_chop_freq(struct max22200_desc *desc, enum max22200_chopping_freq *chopping_freq)
Read chopping frequency.
Definition: max22200.c:481
Header file of IIO MAX22200 Driver.
Header file of utility functions.
max22200_trig
Definition: max22200.h:113
int max22200_iio_init(struct max22200_iio_desc **iio_desc, struct max22200_iio_desc_init_param *init_param)
Initializes the MAX22200 IIO descriptor.
Definition: iio_max22200.c:1041
int max22200_reg_write(struct max22200_desc *desc, uint32_t reg, uint32_t val)
Write data to desired register for MAX22200.
Definition: max22200.c:95
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.
Definition: max22200.c:197
@ MAX22200_M_COMF
Definition: max22200.h:89
int max22200_set_ch_state(struct max22200_desc *desc, uint32_t ch, bool ch_state)
Set channel state for specific channel.
Definition: max22200.c:180