no-OS
max22017.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef _MAX22017_H
34 #define _MAX22017_H
35 
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include "no_os_gpio.h"
39 #include "no_os_spi.h"
40 #include "no_os_util.h"
41 
42 /* GEN Registers */
43 #define MAX22017_GEN_ID 0x00
44 #define MAX22017_GEN_SERIAL_MSB 0x01
45 #define MAX22017_GEN_SERIAL_LSB 0x02
46 #define MAX22017_GEN_CNFG 0x03
47 #define MAX22017_GEN_GPIO_CTRL 0x04
48 #define MAX22017_GEN_GPIO_DATA 0x05
49 #define MAX22017_GEN_GPI_INT 0x06
50 #define MAX22017_GEN_GPI_INT_STA 0x07
51 #define MAX22017_GEN_INT 0x08
52 #define MAX22017_GEN_INTEN 0x09
53 #define MAX22017_GEN_RST_CTRL 0x0A
54 
55 /* AO Registers */
56 #define MAX22017_AO_CMD 0x40
57 #define MAX22017_AO_STA 0x41
58 #define MAX22017_AO_CNFG 0x42
59 #define MAX22017_AO_SLEW_RATE_CH1 0x43
60 #define MAX22017_AO_SLEW_RATE_CH2 0x44
61 #define MAX22017_AO_DATA_CH1 0x45
62 #define MAX22017_AO_DATA_CH2 0x46
63 #define MAX22017_AO_OFFSET_CORR_CH1 0x47
64 #define MAX22017_AO_GAIN_CORR_CH1 0x48
65 #define MAX22017_AO_OFFSET_CORR_CH2 0x49
66 #define MAX22017_AO_GAIN_CORR_CH2 0x4A
67 
68 #define MAX22017_FRAME_SIZE 3
69 
70 #define MAX22017_ADRR_MASK NO_OS_GENMASK(7, 1)
71 #define MAX22017_RW_MASK NO_OS_BIT(0)
72 #define MAX22017_PAYLOAD_LSB_MASK NO_OS_GENMASK(7, 0)
73 #define MAX22017_PAYLOAD_MSB_MASK NO_OS_GENMASK(15, 8)
74 #define MAX22017_CRC_MASK NO_OS_BIT(1)
75 #define MAX22017_EXT_DAC_REF_MASK NO_OS_BIT(0)
76 #define MAX22017_GPIO_MASK(x) NO_OS_BIT(8 + (x))
77 #define MAX22017_GPIO_DIR_MASK(x) NO_OS_BIT(x)
78 #define MAX22017_GPIO_OUT_VAL_MASK(x) NO_OS_BIT(8 + (x))
79 #define MAX22017_GPIO_IN_VAL_MASK(x) NO_OS_BIT(x)
80 #define MAX22017_SR_EN_MASK NO_OS_BIT(5)
81 #define MAX22017_SR_SEL_MASK NO_OS_BIT(4)
82 #define MAX22017_SR_STEP_SIZE_MASK NO_OS_GENMASK(3, 2)
83 #define MAX22017_SR_UPDATE_RATE_MASK NO_OS_GENMASK(1, 0)
84 #define MAX22017_AO_EN_MASK(x) NO_OS_BIT(x)
85 #define MAX22017_AO_EN_MODE_MASK NO_OS_BIT(2)
86 #define MAX22017_AI_EN_MASK(x) NO_OS_BIT(2 + (x))
87 #define MAX22017_AI_EN_MODE_MASK NO_OS_BIT(1)
88 #define MAX22017_AO_MODE_MASK(x) NO_OS_BIT(8 + (x))
89 #define MAX22017_AO_MODE_MODE_MASK NO_OS_BIT(0)
90 #define MAX22017_OP_MODE_MASK(x) (NO_OS_BIT(x) | NO_OS_BIT(2 + (x)) | NO_OS_BIT(8 + (x)))
91 #define MAX22017_LD_CNFG_MASK(x) NO_OS_BIT(14 + (x))
92 #define MAX22017_CM_SENSE_MASK(x) NO_OS_BIT(12 + (x))
93 #define MAX22017_UNI_MASK(x) NO_OS_BIT(10 + (x))
94 #define MAX22017_OW_MASK(x) NO_OS_BIT(4 + (x))
95 #define MAX22017_CNFG_MASK(x) (NO_OS_BIT(14 + (x)) | NO_OS_BIT(12 + (x)) | NO_OS_BIT(10 + (x)) | NO_OS_BIT(4 + (x)))
96 #define MAX22017_COEFF_ONLY_MASK NO_OS_GENMASK(15, 14)
97 #define MAX22017_RST_MASK(x) NO_OS_BIT(14 + (x))
98 #define MAX22017_TIMEOUT_SEL_MASK NO_OS_GENMASK(13, 10)
99 #define MAX22017_TIMEOUT_CNFG_MASK NO_OS_BIT(9)
100 #define MAX22017_TIMEOUT_EN_MASK NO_OS_BIT(8)
101 #define MAX22017_TIMEOUT_MASK NO_OS_GENMASK(13, 8)
102 
103 #define MAX22017_COEFF_ONLY_VAL 0x03
104 
105 #define MAX22017_GPIO_NUMBER 4
106 #define MAX22017_EXTRA_GPIO_NUMBER 2
107 
108 extern const struct no_os_gpio_platform_ops max22017_gpio_ops;
109 
118 };
119 
123 };
124 
128 };
129 
147 };
148 
158 };
159 
169 };
170 
174 };
175 
182 };
183 
193  bool crc_en;
195 };
196 
206  uint8_t buff[MAX22017_FRAME_SIZE + 1];
207  bool crc_en;
208  bool uni;
209 };
210 
212 int32_t max22017_gpio_get(struct no_os_gpio_desc **,
213  const struct no_os_gpio_init_param *);
214 
216 int32_t max22017_gpio_remove(struct no_os_gpio_desc *);
217 
220 
222 int32_t max22017_gpio_direction_output(struct no_os_gpio_desc *, uint8_t);
223 
225 int32_t max22017_gpio_get_direction(struct no_os_gpio_desc *, uint8_t *);
226 
228 int32_t max22017_gpio_set_value(struct no_os_gpio_desc *, uint8_t);
229 
231 int32_t max22017_gpio_get_value(struct no_os_gpio_desc *, uint8_t *);
232 
234 int max22017_set_timeout(struct max22017_desc *, bool, bool,
235  enum max22017_timeout_sel);
236 
238 int max22017_set_data(struct max22017_desc *, enum max22017_channel, int32_t);
239 
241 int max22017_get_data(struct max22017_desc *, enum max22017_channel, int32_t *);
242 
246  bool, bool);
247 
250  int16_t);
251 
254  uint16_t);
255 
258  enum max22017_op_mode);
259 
262  enum max22017_out_mode, enum max22017_cm_sense, bool);
263 
265 int max22017_soft_reset(struct max22017_desc *, enum max22017_channel, bool);
266 
268 int max22017_reg_read(struct max22017_desc *, uint32_t, uint32_t *);
269 
271 int max22017_reg_write(struct max22017_desc *, uint32_t, uint32_t);
272 
274 int max22017_reg_update(struct max22017_desc *, uint32_t, uint32_t, uint32_t);
275 
277 int max22017_init(struct max22017_desc **, struct max22017_init_param *);
278 
280 int max22017_remove(struct max22017_desc *);
281 
282 #endif /* _MAX22017_H */
no_os_gpio_desc::extra
void * extra
Definition: no_os_gpio.h:106
MAX22017_250_OHM_RESISTOR
@ MAX22017_250_OHM_RESISTOR
Definition: max22017.h:127
MAX22017_UPDATE_RATE_64KHZ_32KHZ
@ MAX22017_UPDATE_RATE_64KHZ_32KHZ
Definition: max22017.h:162
timeout
uint32_t timeout
Definition: ad413x.c:49
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
MAX22017_ADRR_MASK
#define MAX22017_ADRR_MASK
Definition: max22017.h:70
max22017_gpio_ops
const struct no_os_gpio_platform_ops max22017_gpio_ops
Definition: max22017.c:674
MAX22017_TIMEOUT_800MS
@ MAX22017_TIMEOUT_800MS
Definition: max22017.h:138
max22017_desc::buff
uint8_t buff[MAX22017_FRAME_SIZE+1]
Definition: max22017.h:206
MAX22017_TIMEOUT_1300MS
@ MAX22017_TIMEOUT_1300MS
Definition: max22017.h:143
MAX22017_TIMEOUT_900MS
@ MAX22017_TIMEOUT_900MS
Definition: max22017.h:139
MAX22017_SR_SEL_MASK
#define MAX22017_SR_SEL_MASK
Definition: max22017.h:81
MAX22017_INPUT_VOLTAGE_MODE
@ MAX22017_INPUT_VOLTAGE_MODE
Definition: max22017.h:112
MAX22017_EXT_DAC_REF_MASK
#define MAX22017_EXT_DAC_REF_MASK
Definition: max22017.h:75
MAX22017_GPIO_MASK
#define MAX22017_GPIO_MASK(x)
Definition: max22017.h:76
max22017_op_mode
int max22017_op_mode(struct max22017_desc *desc, enum max22017_channel ch, enum max22017_op_mode op_mode)
Set operation mode for requested channel.
Definition: max22017.c:376
MAX22017_SR_STEP_SIZE_MASK
#define MAX22017_SR_STEP_SIZE_MASK
Definition: max22017.h:82
max22017_gpio_direction_output
int32_t max22017_gpio_direction_output(struct no_os_gpio_desc *, uint8_t)
Enable the output direction of the specified GPIO.
Definition: max22017.c:140
MAX22017_AO_SLEW_RATE_CH2
#define MAX22017_AO_SLEW_RATE_CH2
Definition: max22017.h:60
MAX22017_UPDATE_RATE_12KHZ_6KHZ
@ MAX22017_UPDATE_RATE_12KHZ_6KHZ
Definition: max22017.h:165
MAX22017_STEP_SIZE_26BITS
@ MAX22017_STEP_SIZE_26BITS
Definition: max22017.h:154
no_os_spi.h
Header file of SPI Interface.
MAX22017_AO_CNFG
#define MAX22017_AO_CNFG
Definition: max22017.h:58
MAX22017_CH1
@ MAX22017_CH1
Definition: max22017.h:172
MAX22017_OUTPUT_VOLTAGE_NO_MONITORRING
@ MAX22017_OUTPUT_VOLTAGE_NO_MONITORRING
Definition: max22017.h:114
MAX22017_COEFF_ONLY_MASK
#define MAX22017_COEFF_ONLY_MASK
Definition: max22017.h:96
max22017_gain_calib
int max22017_gain_calib(struct max22017_desc *, enum max22017_channel, uint16_t)
Set gain value for calibration of requested channel.
Definition: max22017.c:362
MAX22017_AO_SLEW_RATE_CH1
#define MAX22017_AO_SLEW_RATE_CH1
Definition: max22017.h:59
max22017.h
Header file of MAX22017 Driver.
max22017_init_param::fault_param
struct no_os_gpio_init_param * fault_param
Definition: max22017.h:191
MAX22017_AO_MODE_MODE_MASK
#define MAX22017_AO_MODE_MODE_MASK
Definition: max22017.h:89
MAX22017_TIMEOUT_1600MS
@ MAX22017_TIMEOUT_1600MS
Definition: max22017.h:146
no_os_spi_msg
Definition: no_os_spi.h:100
max22017_slew_rate
int max22017_slew_rate(struct max22017_desc *, enum max22017_channel, enum max22017_sr_step_size, enum max22017_sr_update_rate, bool, bool)
Set slew rate settings for requested channels.
Definition: max22017.c:321
MAX22017_AO_EN_MODE_MASK
#define MAX22017_AO_EN_MODE_MASK
Definition: max22017.h:85
MAX22017_TIMEOUT_1000MS
@ MAX22017_TIMEOUT_1000MS
Definition: max22017.h:140
max22017_desc::crc_en
bool crc_en
Definition: max22017.h:207
max22017_remove
int max22017_remove(struct max22017_desc *)
Free the resources allocated during init and perform a soft reset.
Definition: max22017.c:652
MAX22017_UPDATE_RATE_15KHZ_7KHZ
@ MAX22017_UPDATE_RATE_15KHZ_7KHZ
Definition: max22017.h:166
max22017_init_param::crc_en
bool crc_en
Definition: max22017.h:193
MAX22017_STEP_SIZE_1024BITS
@ MAX22017_STEP_SIZE_1024BITS
Definition: max22017.h:151
max22017_gpio_get
int32_t max22017_gpio_get(struct no_os_gpio_desc **, const struct no_os_gpio_init_param *)
Obtain the GPIO decriptor.
Definition: max22017.c:49
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
no_os_gpio_init_param::number
int32_t number
Definition: no_os_gpio.h:83
MAX22017_UNI_MASK
#define MAX22017_UNI_MASK(x)
Definition: max22017.h:93
max22017_set_data
int max22017_set_data(struct max22017_desc *desc, enum max22017_channel ch, int32_t data)
Set data of the selected channel.
Definition: max22017.c:274
MAX22017_STEP_SIZE_16384BITS
@ MAX22017_STEP_SIZE_16384BITS
Definition: max22017.h:153
MAX22017_GPIO_IN_VAL_MASK
#define MAX22017_GPIO_IN_VAL_MASK(x)
Definition: max22017.h:79
max22017_soft_reset
int max22017_soft_reset(struct max22017_desc *desc, enum max22017_channel ch, bool coeff_only)
Soft reset requested channel.
Definition: max22017.c:442
max22017_cm_sense
max22017_cm_sense
Definition: max22017.h:125
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
MAX22017_TIMEOUT_700MS
@ MAX22017_TIMEOUT_700MS
Definition: max22017.h:137
MAX22017_UNIPOLAR
@ MAX22017_UNIPOLAR
Definition: max22017.h:122
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:124
max22017_desc::fault_desc
struct no_os_gpio_desc * fault_desc
Definition: max22017.h:204
MAX22017_TIMEOUT_600MS
@ MAX22017_TIMEOUT_600MS
Definition: max22017.h:136
max22017_gpio_get_value
int32_t max22017_gpio_get_value(struct no_os_gpio_desc *, uint8_t *)
Get the value of the specified GPIO.
Definition: max22017.c:221
max22017_config
int max22017_config(struct max22017_desc *desc, enum max22017_channel ch, enum max22017_out_mode uni, enum max22017_cm_sense cm_sense, bool ldac)
Set AO configuration.
Definition: max22017.c:404
max22017_desc::rstb_desc
struct no_os_gpio_desc * rstb_desc
Definition: max22017.h:202
NO_OS_PULL_NONE
@ NO_OS_PULL_NONE
Definition: no_os_gpio.h:66
no_os_gpio_init_param::platform_ops
const struct no_os_gpio_platform_ops * platform_ops
Definition: no_os_gpio.h:87
MAX22017_AO_OFFSET_CORR_CH1
#define MAX22017_AO_OFFSET_CORR_CH1
Definition: max22017.h:63
max22017_reg_write
int max22017_reg_write(struct max22017_desc *, uint32_t, uint32_t)
Write the value of a device register.
Definition: max22017.c:513
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_spi_msg::tx_buff
uint8_t * tx_buff
Definition: no_os_spi.h:102
MAX22017_OUTPUT_VOLTAGE_MONITORRING
@ MAX22017_OUTPUT_VOLTAGE_MONITORRING
Definition: max22017.h:116
max22017_init_param::rstb_param
struct no_os_gpio_init_param * rstb_param
Definition: max22017.h:189
max22017_reg_read
int max22017_reg_read(struct max22017_desc *, uint32_t, uint32_t *)
Read the value of a device register.
Definition: max22017.c:468
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
max22017_gpio_init_param::max22017_desc
struct max22017_desc * max22017_desc
Definition: max22017.h:181
max22017_gpio_init_param
Structure holding the GPIO initialization parameter for the MAX22017 GPIO Controller.
Definition: max22017.h:180
MAX22017_TIMEOUT_CNFG_MASK
#define MAX22017_TIMEOUT_CNFG_MASK
Definition: max22017.h:99
MAX22017_TIMEOUT_100MS
@ MAX22017_TIMEOUT_100MS
Definition: max22017.h:131
no_os_error.h
Error codes definition.
no_os_gpio_desc::platform_ops
const struct no_os_gpio_platform_ops * platform_ops
Definition: no_os_gpio.h:104
MAX22017_OP_MODE_MASK
#define MAX22017_OP_MODE_MASK(x)
Definition: max22017.h:90
max22017_set_data
int max22017_set_data(struct max22017_desc *, enum max22017_channel, int32_t)
Set data of the selected channel.
Definition: max22017.c:274
MAX22017_GPIO_OUT_VAL_MASK
#define MAX22017_GPIO_OUT_VAL_MASK(x)
Definition: max22017.h:78
max22017_init_param::ldac_param
struct no_os_gpio_init_param * ldac_param
Definition: max22017.h:188
max22017_gpio_set_value
int32_t max22017_gpio_set_value(struct no_os_gpio_desc *, uint8_t)
Set the value of the specified GPIO.
Definition: max22017.c:200
max22017_get_data
int max22017_get_data(struct max22017_desc *, enum max22017_channel, int32_t *)
Get data from requestec channel.
Definition: max22017.c:294
max22017_init
int max22017_init(struct max22017_desc **desc, struct max22017_init_param *param)
Initialize and configure the MAX22017 device.
Definition: max22017.c:566
max22017_init_param::busy_param
struct no_os_gpio_init_param * busy_param
Definition: max22017.h:190
MAX22017_TIMEOUT_1400MS
@ MAX22017_TIMEOUT_1400MS
Definition: max22017.h:144
max22017_desc::ldac_desc
struct no_os_gpio_desc * ldac_desc
Definition: max22017.h:201
no_os_crc8_populate_msb
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
MAX22017_RW_MASK
#define MAX22017_RW_MASK
Definition: max22017.h:71
MAX22017_FRAME_SIZE
#define MAX22017_FRAME_SIZE
Definition: max22017.h:68
MAX22017_50_OHM_RESISTOR
@ MAX22017_50_OHM_RESISTOR
Definition: max22017.h:126
MAX22017_AI_EN_MODE_MASK
#define MAX22017_AI_EN_MODE_MASK
Definition: max22017.h:87
MAX22017_LD_CNFG_MASK
#define MAX22017_LD_CNFG_MASK(x)
Definition: max22017.h:91
MAX22017_UPDATE_RATE_160KHZ_80KHZ
@ MAX22017_UPDATE_RATE_160KHZ_80KHZ
Definition: max22017.h:163
MAX22017_AO_DATA_CH1
#define MAX22017_AO_DATA_CH1
Definition: max22017.h:61
MAX22017_GPIO_DIR_MASK
#define MAX22017_GPIO_DIR_MASK(x)
Definition: max22017.h:77
max22017_gpio_direction_input
int32_t max22017_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: max22017.c:118
MAX22017_CM_SENSE_MASK
#define MAX22017_CM_SENSE_MASK(x)
Definition: max22017.h:92
MAX22017_AO_DATA_CH2
#define MAX22017_AO_DATA_CH2
Definition: max22017.h:62
max22017_init_param
Structure holding the MAX22017 initialization parameter.
Definition: max22017.h:187
max22017_soft_reset
int max22017_soft_reset(struct max22017_desc *, enum max22017_channel, bool)
Soft reset requested channel.
Definition: max22017.c:442
max22017_out_mode
max22017_out_mode
Definition: max22017.h:120
MAX22017_AI_EN_MASK
#define MAX22017_AI_EN_MASK(x)
Definition: max22017.h:86
MAX22017_AO_GAIN_CORR_CH2
#define MAX22017_AO_GAIN_CORR_CH2
Definition: max22017.h:66
max22017_remove
int max22017_remove(struct max22017_desc *desc)
Free the resources allocated during init and perform a soft reset.
Definition: max22017.c:652
MAX22017_HIGH_Z
@ MAX22017_HIGH_Z
Definition: max22017.h:111
MAX22017_STEP_SIZE_512BITS
@ MAX22017_STEP_SIZE_512BITS
Definition: max22017.h:150
max22017_op_mode
max22017_op_mode
Definition: max22017.h:110
MAX22017_AO_GAIN_CORR_CH1
#define MAX22017_AO_GAIN_CORR_CH1
Definition: max22017.h:64
max22017_desc::uni
bool uni
Definition: max22017.h:208
gpio_extra
const struct xil_gpio_init_param gpio_extra
Definition: ad5758_sdz.c:67
max22017_init_param::ext_dac_ref
bool ext_dac_ref
Definition: max22017.h:194
MAX22017_UPDATE_RATE_32KHZ_16KHZ
@ MAX22017_UPDATE_RATE_32KHZ_16KHZ
Definition: max22017.h:168
max22017_get_data
int max22017_get_data(struct max22017_desc *desc, enum max22017_channel ch, int32_t *data)
Get data from requestec channel.
Definition: max22017.c:294
MAX22017_TIMEOUT_MASK
#define MAX22017_TIMEOUT_MASK
Definition: max22017.h:101
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
max22017_reg_update
int max22017_reg_update(struct max22017_desc *, uint32_t, uint32_t, uint32_t)
Update the value of a device register (read/write sequence).
Definition: max22017.c:544
no_os_gpio_desc::port
int32_t port
Definition: no_os_gpio.h:98
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
MAX22017_TIMEOUT_200MS
@ MAX22017_TIMEOUT_200MS
Definition: max22017.h:132
max22017_timeout_sel
max22017_timeout_sel
Definition: max22017.h:130
MAX22017_TIMEOUT_1200MS
@ MAX22017_TIMEOUT_1200MS
Definition: max22017.h:142
MAX22017_SR_UPDATE_RATE_MASK
#define MAX22017_SR_UPDATE_RATE_MASK
Definition: max22017.h:83
MAX22017_GEN_CNFG
#define MAX22017_GEN_CNFG
Definition: max22017.h:46
MAX22017_TIMEOUT_300MS
@ MAX22017_TIMEOUT_300MS
Definition: max22017.h:133
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
max22017_gpio_direction_input
int32_t max22017_gpio_direction_input(struct no_os_gpio_desc *)
Enable the input direction of the specified GPIO.
Definition: max22017.c:118
MAX22017_OUTPUT_CURRENT_NO_MONITORRING
@ MAX22017_OUTPUT_CURRENT_NO_MONITORRING
Definition: max22017.h:115
max22017_gpio_set_value
int32_t max22017_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: max22017.c:200
MAX22017_TIMEOUT_EN_MASK
#define MAX22017_TIMEOUT_EN_MASK
Definition: max22017.h:100
no_os_spi_transfer
int32_t no_os_spi_transfer(struct no_os_spi_desc *desc, struct no_os_spi_msg *msgs, uint32_t len)
Iterate over head list and send all spi messages.
Definition: no_os_spi.c:185
no_os_spi_msg::bytes_number
uint32_t bytes_number
Definition: no_os_spi.h:106
max22017_gpio_get_direction
int32_t max22017_gpio_get_direction(struct no_os_gpio_desc *, uint8_t *)
Get the direction of the specified GPIO.
Definition: max22017.c:170
max22017_gpio_ops
const struct no_os_gpio_platform_ops max22017_gpio_ops
Definition: max22017.c:674
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
max22017_sr_step_size
max22017_sr_step_size
Definition: max22017.h:149
MAX22017_TIMEOUT_1100MS
@ MAX22017_TIMEOUT_1100MS
Definition: max22017.h:141
MAX22017_GEN_RST_CTRL
#define MAX22017_GEN_RST_CTRL
Definition: max22017.h:53
max22017_gpio_direction_output
int32_t max22017_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: max22017.c:140
max22017_desc::comm_desc
struct no_os_spi_desc * comm_desc
Definition: max22017.h:205
MAX22017_OW_MASK
#define MAX22017_OW_MASK(x)
Definition: max22017.h:94
MAX22017_UPDATE_RATE_4KHZ_2KHZ
@ MAX22017_UPDATE_RATE_4KHZ_2KHZ
Definition: max22017.h:161
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
max22017_gain_calib
int max22017_gain_calib(struct max22017_desc *desc, enum max22017_channel ch, uint16_t gain)
Set gain value for calibration of requested channel.
Definition: max22017.c:362
MAX22017_STEP_SIZE_4096BITS
@ MAX22017_STEP_SIZE_4096BITS
Definition: max22017.h:152
no_os_crc8
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
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
max22017_gpio_get_value
int32_t max22017_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: max22017.c:221
max22017_set_timeout
int max22017_set_timeout(struct max22017_desc *desc, bool timeout_cnfg, bool timeout_en, enum max22017_timeout_sel timeout)
Set timeout settings for MAX22017 device.
Definition: max22017.c:254
MAX22017_RST_MASK
#define MAX22017_RST_MASK(x)
Definition: max22017.h:97
max22017_init
int max22017_init(struct max22017_desc **, struct max22017_init_param *)
Initialize and configure the MAX22017 device.
Definition: max22017.c:566
max22017_gpio_get
int32_t max22017_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: max22017.c:49
max22017_reg_read
int max22017_reg_read(struct max22017_desc *desc, uint32_t addr, uint32_t *val)
Read the value of a device register.
Definition: max22017.c:468
no_os_gpio_desc::pull
enum no_os_gpio_pull_up pull
Definition: no_os_gpio.h:102
MAX22017_AO_EN_MASK
#define MAX22017_AO_EN_MASK(x)
Definition: max22017.h:84
MAX22017_PAYLOAD_MSB_MASK
#define MAX22017_PAYLOAD_MSB_MASK
Definition: max22017.h:73
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
max22017_gpio_remove
int32_t max22017_gpio_remove(struct no_os_gpio_desc *)
Free the resources allocated by no_os_gpio_get().
Definition: max22017.c:92
MAX22017_UPDATE_RATE_20KHZ_10KHZ
@ MAX22017_UPDATE_RATE_20KHZ_10KHZ
Definition: max22017.h:167
MAX22017_TIMEOUT_1500MS
@ MAX22017_TIMEOUT_1500MS
Definition: max22017.h:145
MAX22017_STEP_SIZE_31BITS
@ MAX22017_STEP_SIZE_31BITS
Definition: max22017.h:156
max22017_offset_calib
int max22017_offset_calib(struct max22017_desc *desc, enum max22017_channel ch, int16_t offset)
Set offset value for output calibration.
Definition: max22017.c:344
MAX22017_STEP_SIZE_28BITS
@ MAX22017_STEP_SIZE_28BITS
Definition: max22017.h:155
MAX22017_AO_MODE_MASK
#define MAX22017_AO_MODE_MASK(x)
Definition: max22017.h:88
MAX22017_TIMEOUT_500MS
@ MAX22017_TIMEOUT_500MS
Definition: max22017.h:135
max22017_config
int max22017_config(struct max22017_desc *, enum max22017_channel, enum max22017_out_mode, enum max22017_cm_sense, bool)
Set AO configuration.
Definition: max22017.c:404
no_os_spi_remove
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
no_os_gpio_platform_ops
Structure holding gpio function pointers that point to the platform specific function.
Definition: no_os_gpio.h:127
no_os_gpio_init_param::extra
void * extra
Definition: no_os_gpio.h:89
MAX22017_UPDATE_RATE_200KHZ_100KHZ
@ MAX22017_UPDATE_RATE_200KHZ_100KHZ
Definition: max22017.h:164
MAX22017_TIMEOUT_400MS
@ MAX22017_TIMEOUT_400MS
Definition: max22017.h:134
no_os_gpio.h
Header file of GPIO Interface.
MAX22017_BIPOLAR
@ MAX22017_BIPOLAR
Definition: max22017.h:121
max22017_reg_update
int max22017_reg_update(struct max22017_desc *desc, uint32_t addr, uint32_t mask, uint32_t val)
Update the value of a device register (read/write sequence).
Definition: max22017.c:544
MAX22017_CNFG_MASK
#define MAX22017_CNFG_MASK(x)
Definition: max22017.h:95
max22017_desc::busy_desc
struct no_os_gpio_desc * busy_desc
Definition: max22017.h:203
max22017_reg_write
int max22017_reg_write(struct max22017_desc *desc, uint32_t addr, uint32_t val)
Write the value of a device register.
Definition: max22017.c:513
MAX22017_INPUT_CURRENT_MODE
@ MAX22017_INPUT_CURRENT_MODE
Definition: max22017.h:113
MAX22017_CRC_MASK
#define MAX22017_CRC_MASK
Definition: max22017.h:74
no_os_spi_init
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
MAX22017_AO_OFFSET_CORR_CH2
#define MAX22017_AO_OFFSET_CORR_CH2
Definition: max22017.h:65
max22017_channel
max22017_channel
Definition: max22017.h:171
NO_OS_DECLARE_CRC8_TABLE
NO_OS_DECLARE_CRC8_TABLE(table)
no_os_util.h
Header file of utility functions.
no_os_gpio_platform_ops::gpio_ops_get
int32_t(* gpio_ops_get)(struct no_os_gpio_desc **, const struct no_os_gpio_init_param *)
Definition: no_os_gpio.h:129
max22017_set_timeout
int max22017_set_timeout(struct max22017_desc *, bool, bool, enum max22017_timeout_sel)
Set timeout settings for MAX22017 device.
Definition: max22017.c:254
MAX22017_OUTPUT_CURRENT_MONITORRING
@ MAX22017_OUTPUT_CURRENT_MONITORRING
Definition: max22017.h:117
no_os_sign_extend32
int32_t no_os_sign_extend32(uint32_t value, int index)
max22017_desc
Structure holding the MAX22017 device descriptor.
Definition: max22017.h:200
max22017_slew_rate
int max22017_slew_rate(struct max22017_desc *desc, enum max22017_channel ch, enum max22017_sr_step_size step_size, enum max22017_sr_update_rate update_rate, bool enable, bool hart)
Set slew rate settings for requested channels.
Definition: max22017.c:321
max22017_offset_calib
int max22017_offset_calib(struct max22017_desc *, enum max22017_channel, int16_t)
Set offset value for output calibration.
Definition: max22017.c:344
max22017_init_param::comm_param
struct no_os_spi_init_param * comm_param
Definition: max22017.h:192
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
MAX22017_STEP_SIZE_35BITS
@ MAX22017_STEP_SIZE_35BITS
Definition: max22017.h:157
max22017_gpio_get_direction
int32_t max22017_gpio_get_direction(struct no_os_gpio_desc *desc, uint8_t *direction)
Get the direction of the specified GPIO.
Definition: max22017.c:170
MAX22017_GEN_GPIO_CTRL
#define MAX22017_GEN_GPIO_CTRL
Definition: max22017.h:47
no_os_gpio_desc::number
int32_t number
Definition: no_os_gpio.h:100
MAX22017_GEN_GPIO_DATA
#define MAX22017_GEN_GPIO_DATA
Definition: max22017.h:48
MAX22017_CH2
@ MAX22017_CH2
Definition: max22017.h:173
max22017_sr_update_rate
max22017_sr_update_rate
Definition: max22017.h:160
max22017_gpio_remove
int32_t max22017_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: max22017.c:92
no_os_crc8.h
Header file of CRC-8 computation.
MAX22017_COEFF_ONLY_VAL
#define MAX22017_COEFF_ONLY_VAL
Definition: max22017.h:103
MAX22017_TIMEOUT_SEL_MASK
#define MAX22017_TIMEOUT_SEL_MASK
Definition: max22017.h:98
MAX22017_SR_EN_MASK
#define MAX22017_SR_EN_MASK
Definition: max22017.h:80
MAX22017_PAYLOAD_LSB_MASK
#define MAX22017_PAYLOAD_LSB_MASK
Definition: max22017.h:72
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75