no-OS
iio_max14906.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef IIO_MAX14906_H
34 #define IIO_MAX14906_H
35 
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include "iio.h"
39 #include "max14906.h"
40 
41 #define MAX14906_FUNCTION_CNT 3
42 
47  bool enabled;
48  enum max14906_function function;
49 };
50 
54 static const char *const max14906_function_avail[MAX14906_FUNCTION_CNT] = {
55  [MAX14906_OUT] = "output",
56  [MAX14906_IN] = "input",
57  [MAX14906_HIGH_Z] = "high_z"
58 };
59 
63 static const char *const max14906_do_mode_avail[4] = {
64  [MAX14906_HIGH_SIDE] = "High_side",
65  [MAX14906_HIGH_SIDE_INRUSH] = "High_side_2x_inrush",
66  [MAX14906_PUSH_PULL_CLAMP] = "Push_pull_clamp",
67  [MAX14906_PUSH_PULL] = "Push_pull",
68 };
69 
73 static const char *const max14906_iec_avail[2] = {
74  "Type_1_3",
75  "Type_2"
76 };
77 
84  uint32_t active_channels;
87 };
88 
95 };
96 
100 
103 
104 #endif /* IIO_MAX14906_H */
MAX14906_OUT
@ MAX14906_OUT
Definition: max14906.h:85
max14906_iio_desc::channel_configs
struct max14906_ch_config channel_configs[MAX14906_CHANNELS]
Definition: iio_max14906.h:86
no_os_alloc.h
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
max149x6_reg_read
int max149x6_reg_read(struct max149x6_desc *desc, uint32_t addr, uint32_t *val)
Read the value of a device register.
Definition: max149x6-base.c:126
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:50
iio_channel
Struct describing the scan type.
Definition: iio_types.h:168
max14906_iio_desc::max14906_desc
struct max149x6_desc * max14906_desc
Definition: iio_max14906.h:82
max149x6_desc
Device descriptor for MAX149X6.
Definition: max149x6-base.h:67
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:254
max14906_remove
int max14906_remove(struct max149x6_desc *desc)
Free the resources allocated during init and place all the channels in high-z.
Definition: max14906.c:278
MAX14906_DO_MASK
#define MAX14906_DO_MASK(x)
Definition: max14906.h:66
iio_desc
Definition: iio.c:204
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
no_os_units.h
Header file of Units.
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:107
max14906_iio_desc_init_param
Initialization parameter for the MAX14906 IIO descriptor.
Definition: iio_max14906.h:92
MAX14906_CONFIG_CURR_LIM
#define MAX14906_CONFIG_CURR_LIM
Definition: max14906.h:57
max149x6_reg_update
int max149x6_reg_update(struct max149x6_desc *desc, uint32_t addr, uint32_t mask, uint32_t val)
Update the value of a device register (read/write sequence).
Definition: max149x6-base.c:172
no_os_calloc
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
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
iio_device::debug_reg_read
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:283
max14906_iio_desc
MAX14906 specific IIO descriptor.
Definition: iio_max14906.h:81
MAX14906_FUNCTION_CNT
#define MAX14906_FUNCTION_CNT
Definition: iio_max14906.h:41
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:188
max14906_iio_desc_init_param::channel_configs
struct max14906_ch_config channel_configs[MAX14906_CHANNELS]
Definition: iio_max14906.h:94
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:122
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max14906_ch_set
int max14906_ch_set(struct max149x6_desc *desc, uint32_t ch, uint32_t val)
Write the (logic) state of a channel (only for output channels).
Definition: max14906.c:70
max149x6_reg_write
int max149x6_reg_write(struct max149x6_desc *desc, uint32_t addr, uint32_t val)
Write the value of a device register.
Definition: max149x6-base.c:98
MAX14906_HIGH_Z
@ MAX14906_HIGH_Z
Definition: max14906.h:87
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
max14906_ch_get
int max14906_ch_get(struct max149x6_desc *desc, uint32_t ch, uint32_t *val)
Read the (voltage) state of a channel (works for both input or output).
Definition: max14906.c:47
max14906_iio_init
int max14906_iio_init(struct max14906_iio_desc **iio_desc, struct max14906_iio_desc_init_param *init_param)
Initializes the MAX14906 IIO descriptor.
Definition: iio_max14906.c:579
iio_max14906.h
Header file of MAX14906 IIO Driver.
iio_attribute::name
const char * name
Definition: iio_types.h:131
max14906_iio_desc::active_channels
uint32_t active_channels
Definition: iio_max14906.h:84
MAX14906_HIGH_SIDE_INRUSH
@ MAX14906_HIGH_SIDE_INRUSH
Definition: max14906.h:95
max14906_iio_remove
int max14906_iio_remove(struct max14906_iio_desc *)
Free resources allocated by the init function.
Definition: iio_max14906.c:622
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
max14906_iec_type
max14906_iec_type
Definition: max14906.h:76
MAX14906_IN
@ MAX14906_IN
Definition: max14906.h:86
max14906_function
max14906_function
Channel configuration options.
Definition: max14906.h:84
iio_parse_value
int32_t iio_parse_value(char *buf, enum iio_val fmt, int32_t *val, int32_t *val2)
Definition: iio.c:630
max14906_ch_config::enabled
bool enabled
Definition: iio_max14906.h:47
max14906_iio_init
int max14906_iio_init(struct max14906_iio_desc **, struct max14906_iio_desc_init_param *)
Initializes the MAX14906 IIO descriptor.
Definition: iio_max14906.c:579
max14906_iio_desc::no_active_channels
uint32_t no_active_channels
Definition: iio_max14906.h:85
MAX14906_PUSH_PULL
@ MAX14906_PUSH_PULL
Definition: max14906.h:97
max14906_iio_remove
int max14906_iio_remove(struct max14906_iio_desc *iio_desc)
Free resources allocated by the init function.
Definition: iio_max14906.c:622
MAX14906_CHANNELS
#define MAX14906_CHANNELS
Definition: max14906.h:43
iio_format_value
int iio_format_value(char *buf, uint32_t len, enum iio_val fmt, int32_t size, int32_t *vals)
Definition: iio.c:686
iio_ch_info::address
uint32_t address
Definition: iio_types.h:113
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:186
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:252
no_os_free
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
MAX14906_PUSH_PULL_CLAMP
@ MAX14906_PUSH_PULL_CLAMP
Definition: max14906.h:96
MAX14906_CONFIG_DO_REG
#define MAX14906_CONFIG_DO_REG
Definition: max14906.h:56
MAX14906_CHANNEL
#define MAX14906_CHANNEL(_addr)
Definition: iio_max14906.c:44
NULL
#define NULL
Definition: wrapper.h:64
MAX14906_HIGH_SIDE
@ MAX14906_HIGH_SIDE
Definition: max14906.h:94
max14906_ch_func
int max14906_ch_func(struct max149x6_desc *desc, uint32_t ch, enum max14906_function function)
Configure a channel's function.
Definition: max14906.c:87
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
max14906.h
Header file of MAX14906 Driver.
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:105
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
MAX14906_CL_MASK
#define MAX14906_CL_MASK(x)
Definition: max14906.h:70
max14906_init
int max14906_init(struct max149x6_desc **desc, struct max149x6_init_param *param)
Initialize and configure the MAX14906 device.
Definition: max14906.c:168
max14906_ch_config
Configuration structure for a MAX14906 channel.
Definition: iio_max14906.h:46
max14906_iio_desc_init_param::max14906_init_param
struct max149x6_init_param * max14906_init_param
Definition: iio_max14906.h:93
MAX14906_CONFIG_DI_REG
#define MAX14906_CONFIG_DI_REG
Definition: max14906.h:55
MAX14906_IEC_TYPE_MASK
#define MAX14906_IEC_TYPE_MASK
Definition: max14906.h:69
max14906_iio_setup_channels
int max14906_iio_setup_channels(struct max14906_iio_desc *desc)
Configure a set if IIO channels based on the operation modes of the enabled physical channels.
Definition: iio_max14906.c:492
max149x6_init_param
Initialization parameter for the MAX149X6 device.
Definition: max149x6-base.h:54
no_os_util.h
Header file of utility functions.
IIO_SHARED_BY_DIR
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:121
max14906_iio_desc::iio_dev
struct iio_device * iio_dev
Definition: iio_max14906.h:83
max14906_ch_config::function
enum max14906_function function
Definition: iio_max14906.h:48