no-OS
iio_max14906.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef IIO_MAX14906_H
40 #define IIO_MAX14906_H
41 
42 #include <stdint.h>
43 #include <stdbool.h>
44 #include "iio.h"
45 #include "max14906.h"
46 
47 #define MAX14906_FUNCTION_CNT 3
48 
53  bool enabled;
54  enum max14906_function function;
55 };
56 
60 static const char *const max14906_function_avail[MAX14906_FUNCTION_CNT] = {
61  [MAX14906_OUT] = "output",
62  [MAX14906_IN] = "input",
63  [MAX14906_HIGH_Z] = "high_z"
64 };
65 
69 static const char *const max14906_do_mode_avail[4] = {
70  [MAX14906_HIGH_SIDE] = "High_side",
71  [MAX14906_HIGH_SIDE_INRUSH] = "High_side_2x_inrush",
72  [MAX14906_PUSH_PULL_CLAMP] = "Push_pull_clamp",
73  [MAX14906_PUSH_PULL] = "Push_pull",
74 };
75 
79 static const char *const max14906_iec_avail[2] = {
80  "Type_1_3",
81  "Type_2"
82 };
83 
90  uint32_t active_channels;
93 };
94 
101 };
102 
106 
109 
110 #endif /* IIO_MAX14906_H */
MAX14906_OUT
@ MAX14906_OUT
Definition: max14906.h:91
max14906_iio_desc::channel_configs
struct max14906_ch_config channel_configs[MAX14906_CHANNELS]
Definition: iio_max14906.h:92
no_os_alloc.h
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:122
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:132
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:56
iio_channel
Struct describing the scan type.
Definition: iio_types.h:174
max14906_iio_desc::max14906_desc
struct max149x6_desc * max14906_desc
Definition: iio_max14906.h:88
max149x6_desc
Device descriptor for MAX149X6.
Definition: max149x6-base.h:73
iio_device::channels
struct iio_channel * channels
Definition: iio_types.h:260
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:284
MAX14906_DO_MASK
#define MAX14906_DO_MASK(x)
Definition: max14906.h:72
iio_desc
Definition: iio.c:210
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:109
no_os_units.h
Header file of Units.
iio_ch_info::ch_out
bool ch_out
Definition: iio_types.h:113
max14906_iio_desc_init_param
Initialization parameter for the MAX14906 IIO descriptor.
Definition: iio_max14906.h:98
MAX14906_CONFIG_CURR_LIM
#define MAX14906_CONFIG_CURR_LIM
Definition: max14906.h:63
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:178
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:60
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:55
iio_device::debug_reg_read
int32_t(* debug_reg_read)(void *dev, uint32_t reg, uint32_t *readval)
Definition: iio_types.h:289
max14906_iio_desc
MAX14906 specific IIO descriptor.
Definition: iio_max14906.h:87
MAX14906_FUNCTION_CNT
#define MAX14906_FUNCTION_CNT
Definition: iio_max14906.h:47
iio_channel::ch_out
bool ch_out
Definition: iio_types.h:194
max14906_iio_desc_init_param::channel_configs
struct max14906_ch_config channel_configs[MAX14906_CHANNELS]
Definition: iio_max14906.h:100
IIO_SHARED_BY_ALL
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:128
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:76
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:104
MAX14906_HIGH_Z
@ MAX14906_HIGH_Z
Definition: max14906.h:93
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:53
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:585
iio_max14906.h
Header file of MAX14906 IIO Driver.
iio_attribute::name
const char * name
Definition: iio_types.h:137
max14906_iio_desc::active_channels
uint32_t active_channels
Definition: iio_max14906.h:90
MAX14906_HIGH_SIDE_INRUSH
@ MAX14906_HIGH_SIDE_INRUSH
Definition: max14906.h:101
max14906_iio_remove
int max14906_iio_remove(struct max14906_iio_desc *)
Free resources allocated by the init function.
Definition: iio_max14906.c:628
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:135
max14906_iec_type
max14906_iec_type
Definition: max14906.h:82
MAX14906_IN
@ MAX14906_IN
Definition: max14906.h:92
max14906_function
max14906_function
Channel configuration options.
Definition: max14906.h:90
iio_parse_value
int32_t iio_parse_value(char *buf, enum iio_val fmt, int32_t *val, int32_t *val2)
Definition: iio.c:616
max14906_ch_config::enabled
bool enabled
Definition: iio_max14906.h:53
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:585
max14906_iio_desc::no_active_channels
uint32_t no_active_channels
Definition: iio_max14906.h:91
MAX14906_PUSH_PULL
@ MAX14906_PUSH_PULL
Definition: max14906.h:103
max14906_iio_remove
int max14906_iio_remove(struct max14906_iio_desc *iio_desc)
Free resources allocated by the init function.
Definition: iio_max14906.c:628
MAX14906_CHANNELS
#define MAX14906_CHANNELS
Definition: max14906.h:49
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:667
iio_ch_info::address
uint32_t address
Definition: iio_types.h:119
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:192
iio_device::num_ch
uint16_t num_ch
Definition: iio_types.h:258
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:75
MAX14906_PUSH_PULL_CLAMP
@ MAX14906_PUSH_PULL_CLAMP
Definition: max14906.h:102
MAX14906_CONFIG_DO_REG
#define MAX14906_CONFIG_DO_REG
Definition: max14906.h:62
MAX14906_CHANNEL
#define MAX14906_CHANNEL(_addr)
Definition: iio_max14906.c:50
NULL
#define NULL
Definition: wrapper.h:64
MAX14906_HIGH_SIDE
@ MAX14906_HIGH_SIDE
Definition: max14906.h:100
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:93
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
max14906.h
Header file of MAX14906 Driver.
iio_ch_info::ch_num
int16_t ch_num
Definition: iio_types.h:111
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:253
MAX14906_CL_MASK
#define MAX14906_CL_MASK(x)
Definition: max14906.h:76
max14906_init
int max14906_init(struct max149x6_desc **desc, struct max149x6_init_param *param)
Initialize and configure the MAX14906 device.
Definition: max14906.c:174
max14906_ch_config
Configuration structure for a MAX14906 channel.
Definition: iio_max14906.h:52
max14906_iio_desc_init_param::max14906_init_param
struct max149x6_init_param * max14906_init_param
Definition: iio_max14906.h:99
MAX14906_CONFIG_DI_REG
#define MAX14906_CONFIG_DI_REG
Definition: max14906.h:61
MAX14906_IEC_TYPE_MASK
#define MAX14906_IEC_TYPE_MASK
Definition: max14906.h:75
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:498
max149x6_init_param
Initialization parameter for the MAX149X6 device.
Definition: max149x6-base.h:60
no_os_util.h
Header file of utility functions.
IIO_SHARED_BY_DIR
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:127
max14906_iio_desc::iio_dev
struct iio_device * iio_dev
Definition: iio_max14906.h:89
max14906_ch_config::function
enum max14906_function function
Definition: iio_max14906.h:54