Go to the documentation of this file.
50 #define LTC2672_16_DONT_CARE 0xFFF0
51 #define LTC2672_MUX_DONT_CARE 0xFFFE0
52 #define LTC2672_DUMMY 0xFFFF
53 #define LTC2672_FAULT_REG_MASK 0xFF0000
56 #define LTC2672_BASE_CURRENT 3.125 // base current in mA
57 #define LTC2672_VMINUS_FIXED_CURRENT -80 // Fixed V- Current as per data sheet
58 #define LTC2672_OFF_CURRENT 0
59 #define LTC2672_300MA_CURRENT 300
60 #define LTC2672_16BIT_RESO 65535
61 #define LTC2672_12BIT_RESO 4095
62 #define LTC2672_TOTAL_CHANNELS 5
63 #define LTC2672_MAX_CONFIG_MASK 15
64 #define LTC2672_MAX_TOGGLE_MASK 31
65 #define LTC2672_BIT_SHIFT_12BIT 4
66 #define LTC2672_NUM_MUX_SELECTS 22
67 #define LTC2672_NUM_CURRENT_SPANS 10
68 #define LTC2672_NUM_FAULTS 7
90 #define LTC2672_COMMAND32_GENERATE(comm, add, dat) \
91 (0xFF << 24) | (comm << 20) | (add << 16) | (dat)
93 #define LTC2672_COMMAND24_GENERATE(comm, add, dat) \
94 (comm << 20) | (add << 16) | (dat)
96 #define LTC2672_SPAN_SET(span_code) LTC2672_16_DONT_CARE | span_code
98 #define LTC2672_MUX_SET(mux_code) LTC2672_MUX_DONT_CARE | mux_code
100 #define LTC2672_MUX32_GENERATE(comm, dat) \
101 (0xFF << 24) | (comm << 20) | (dat)
103 #define LTC2672_MUX24_GENERATE(comm, dat) \
262 #endif // __LTC2672_H__
@ LTC2672_NO_OP
Definition: ltc2672.h:86
@ LTC2672_100VREF
Definition: ltc2672.h:125
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
int ltc2672_enable_toggle_channel(struct ltc2672_dev *, uint32_t)
enables or disables selected channel/s for toggling
Definition: ltc2672.c:532
Header file for iio_trigger.
@ LTC2672_MUX_VOUT1
Definition: ltc2672.h:155
#define LTC2672_MAX_CONFIG_MASK
Definition: ltc2672.h:63
int ltc2672_set_span_all_channels(struct ltc2672_dev *device, enum ltc2672_out_range ch_span)
sets the same output span for all channels
Definition: ltc2672.c:333
@ LTC2672_MUX_VDD2
Definition: ltc2672.h:149
Header file of DAC Demo iio.
ltc2672_commands
Definition: ltc2672.h:70
#define LTC2672_BIT_SHIFT_12BIT
Definition: ltc2672.h:65
int ltc2672_config_command(struct ltc2672_dev *device, uint8_t mask)
configures the fault detection bits
Definition: ltc2672.c:568
int ltc2672_monitor_mux(struct ltc2672_dev *device, enum ltc2672_mux_commands mux_comm)
configures mux output depending on target measurement
Definition: ltc2672.c:443
int ltc2672_remove(struct ltc2672_dev *device)
Remove resources allocated by the init function.
Definition: ltc2672.c:88
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
@ LTC2672_CODE_TO_CHANNEL_X_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:73
@ LTC2672_SPAN_TO_CHANNEL_ALL
Definition: ltc2672.h:85
@ LTC2672_MUX_IOUT4
Definition: ltc2672.h:142
Header file of SPI Interface.
@ LTC2672_PWRDWN_DEV
Definition: ltc2672.h:76
int ltc2672_set_span_all_channels(struct ltc2672_dev *, enum ltc2672_out_range)
sets the same output span for all channels
Definition: ltc2672.c:333
int ltc2672_chip_power_down(struct ltc2672_dev *device)
power down ltc2672
Definition: ltc2672.c:384
ltc2672_out_range
Definition: ltc2672.h:122
#define LTC2672_MAX_TOGGLE_MASK
Definition: ltc2672.h:64
@ LTC2672_MUX_VDD4
Definition: ltc2672.h:151
int ltc2672_global_toggle(struct ltc2672_dev *, bool)
enables or disables global toggle bit
Definition: ltc2672.c:550
@ LTC2672_OVER_TEMP
Definition: ltc2672.h:168
int ltc2672_power_down_channel(struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch)
power down a channel
Definition: ltc2672.c:400
@ LTC2672_DAC4
Definition: ltc2672.h:118
@ LTC2672_MUX_VOUT4
Definition: ltc2672.h:158
#define LTC2672_VMINUS_FIXED_CURRENT
Definition: ltc2672.h:57
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:127
int ltc2672_set_code_all_channels(struct ltc2672_dev *device, uint16_t code)
sets the same dac code for all channels
Definition: ltc2672.c:222
@ LTC2672_50VREF
Definition: ltc2672.h:124
#define LTC2672_MUX_SET(mux_code)
Definition: ltc2672.h:98
@ LTC2672_MUX_GND
Definition: ltc2672.h:153
@ LTC2672_OFF
Definition: ltc2672.h:123
@ LTC2672_TOGGLE_GLBL
Definition: ltc2672.h:84
@ LTC2672_PWRUP_UPD_CHANNEL_X
Definition: ltc2672.h:72
@ LTC2672_SPAN_TO_CHANNEL_X
Definition: ltc2672.h:77
@ LTC2672_16
Definition: ltc2672.h:109
Definition: ad9361_util.h:69
int ltc2672_power_down_all_channels(struct ltc2672_dev *)
power down ALL channels
Definition: ltc2672.c:419
@ LTC2672_DAC3
Definition: ltc2672.h:117
ltc2672_device_id
Definition: ltc2672.h:107
@ LTC2672_400VREF
Definition: ltc2672.h:127
@ LTC2672_MUX_IOUT1
Definition: ltc2672.h:139
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
int ltc2672_monitor_mux(struct ltc2672_dev *, enum ltc2672_mux_commands)
configures mux output depending on target measurement
Definition: ltc2672.c:443
@ LTC2672_MUX_VDD3
Definition: ltc2672.h:150
@ LTC2672_CODE_TO_CHANNEL_ALL
Definition: ltc2672.h:79
struct iio_trigger dac_iio_sw_trig_desc
Definition: iio_dac_demo_trig.c:55
@ LTC2672_200VREF
Definition: ltc2672.h:126
@ LTC2672_MUC_VCC
Definition: ltc2672.h:143
@ LTC2672_800VREF
Definition: ltc2672.h:128
int iio_sw_trig_handler(void *trig, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Handles the write request for trigger_now attribute.
Definition: iio_trigger.c:208
@ LTC2672_VMINUS_VREF
Definition: ltc2672.h:131
int ltc2672_power_down_all_channels(struct ltc2672_dev *device)
power down ALL channels
Definition: ltc2672.c:419
int ltc2672_config_command(struct ltc2672_dev *, uint8_t)
configures the fault detection bits
Definition: ltc2672.c:568
#define LTC2672_MUX24_GENERATE(comm, dat)
Definition: ltc2672.h:103
#define LTC2672_DUMMY
Definition: ltc2672.h:52
int ltc2672_set_current_all_channels(struct ltc2672_dev *device, uint32_t current)
sets the same current for all channels
Definition: ltc2672.c:254
int ltc2672_set_current_all_channels(struct ltc2672_dev *, uint32_t)
sets the same current for all channels
Definition: ltc2672.c:254
const char * name
Definition: iio_types.h:131
@ LTC2672_OPEN_OUT3
Definition: ltc2672.h:166
int ltc2672_set_code_all_channels(struct ltc2672_dev *device, uint16_t code)
sets the same dac code for all channels
Definition: ltc2672.c:222
@ LTC2672_DAC2
Definition: ltc2672.h:116
int ltc2672_init(struct ltc2672_dev **device, struct ltc2672_init_param *init_param)
Device and communication init function.
Definition: ltc2672.c:58
@ LTC2672_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:80
int ltc2672_enable_toggle_channel(struct ltc2672_dev *device, uint32_t mask)
enables or disables selected channel/s for toggling
Definition: ltc2672.c:532
@ LTC2672_MON_MUX
Definition: ltc2672.h:82
@ LTC2672_MUX_IOUT2
Definition: ltc2672.h:140
@ LTC2672_MUX_VOUT3
Definition: ltc2672.h:157
int ltc2672_transaction(struct ltc2672_dev *device, uint32_t, bool)
Write raw register value.
Definition: ltc2672.c:109
#define LTC2672_300MA_CURRENT
Definition: ltc2672.h:59
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
@ LTC2672_CODE_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:81
int ltc2672_set_current_channel(struct ltc2672_dev *device, uint32_t current, enum ltc2672_dac_ch out_ch)
set the current for a selected DAC channel
Definition: ltc2672.c:201
@ LTC2672_OPEN_OUT2
Definition: ltc2672.h:165
@ LTC2672_MUX_DISABLED
Definition: ltc2672.h:137
@ LTC2672_1600VREF
Definition: ltc2672.h:129
Structure holding ltc2672 descriptor.
Definition: ltc2672.h:177
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
int ltc2672_transaction(struct ltc2672_dev *device, uint32_t comm, bool is_32)
Write raw register value.
Definition: ltc2672.c:109
int ltc2672_set_span_channel(struct ltc2672_dev *device, enum ltc2672_out_range ch_span, enum ltc2672_dac_ch out_ch)
sets output span for channel
Definition: ltc2672.c:282
#define LTC2672_BASE_CURRENT
Definition: ltc2672.h:56
@ LTC2672_UNUSED
Definition: ltc2672.h:169
@ LTC2672_DAC1
Definition: ltc2672.h:115
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
int ltc2672_chip_power_down(struct ltc2672_dev *)
power down ltc2672
Definition: ltc2672.c:384
@ LTC2672_OPEN_OUT1
Definition: ltc2672.h:164
ltc2672_dac_ch
Definition: ltc2672.h:113
int ltc2672_set_code_channel(struct ltc2672_dev *device, uint16_t code, enum ltc2672_dac_ch out_ch)
sets the dac code for channel
Definition: ltc2672.c:165
@ LTC2672_3200VREF
Definition: ltc2672.h:130
ltc2672_mux_commands
Definition: ltc2672.h:136
@ LTC2672_INV_LENGTH
Definition: ltc2672.h:170
int ltc2672_init(struct ltc2672_dev **, struct ltc2672_init_param *)
Device and communication init function.
Definition: ltc2672.c:58
Structure holding the parameters for ltc2672 initialization.
Definition: ltc2672.h:196
struct iio_trigger dac_iio_timer_trig_desc
Definition: iio_dac_demo_trig.c:61
uint32_t max_currents[LTC2672_TOTAL_CHANNELS]
Definition: ltc2672.h:185
@ LTC2672_OPEN_OUT4
Definition: ltc2672.h:167
@ LTC2672_12
Definition: ltc2672.h:108
int ltc2672_set_code_channel(struct ltc2672_dev *device, uint16_t code, enum ltc2672_dac_ch out_ch)
sets the dac code for channel
Definition: ltc2672.c:165
@ LTC2672_MUX_DIE_TEMP
Definition: ltc2672.h:146
#define LTC2672_OFF_CURRENT
Definition: ltc2672.h:58
@ LTC2672_TOGGLE_SEL
Definition: ltc2672.h:83
@ LTC2672_OPEN_OUT0
Definition: ltc2672.h:163
enum ltc2672_device_id id
Definition: ltc2672.h:181
Header file of ltc2672 Driver.
struct no_os_spi_init_param spi_init
Definition: ltc2672.h:198
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
enum ltc2672_device_id id
Definition: ltc2672.h:200
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
@ LTC2672_MUX_VOUT2
Definition: ltc2672.h:156
#define MICROAMPER_PER_MILLIAMPER
Definition: no_os_units.h:63
int ltc2672_set_current_channel(struct ltc2672_dev *, uint32_t, enum ltc2672_dac_ch)
set the current for a selected DAC channel
Definition: ltc2672.c:201
Definition: iio_types.h:231
#define LTC2672_SPAN_SET(span_code)
Definition: ltc2672.h:96
int ltc2672_set_span_channel(struct ltc2672_dev *, enum ltc2672_out_range, enum ltc2672_dac_ch)
sets output span for channel
Definition: ltc2672.c:282
@ LTC2672_CODE_PWRUP_UPD_CHANNEL_X
Definition: ltc2672.h:74
@ LTC2672_MUX_VOUT0
Definition: ltc2672.h:154
@ LTC2672_MUX_IOUT0
Definition: ltc2672.h:138
@ LTC2672_CODE_TO_CHANNEL_X
Definition: ltc2672.h:71
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define LTC2672_TOTAL_CHANNELS
Definition: ltc2672.h:62
enum ltc2672_out_range out_spans[LTC2672_TOTAL_CHANNELS]
Definition: ltc2672.h:183
@ LTC2672_4800VREF
Definition: ltc2672.h:132
#define LTC2672_16BIT_RESO
Definition: ltc2672.h:60
int ltc2672_setup_toggle_channel(struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch, uint32_t current_reg_a, uint32_t current_reg_b)
setup toggle parameters for a channel
Definition: ltc2672.c:467
@ LTC2672_PWRDWN_CHANNEL_X
Definition: ltc2672.h:75
@ LTC2672_MUX_VDD1
Definition: ltc2672.h:148
@ LTC2672_CNFG_CMD
Definition: ltc2672.h:78
bool global_toggle
Definition: ltc2672.h:189
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
#define LTC2672_12BIT_RESO
Definition: ltc2672.h:61
uint32_t ltc2672_current_to_code(struct ltc2672_dev *device, uint32_t, enum ltc2672_dac_ch)
get dac code value from current of a selected DAC channel
Definition: ltc2672.c:142
@ LTC2672_MUX_IOUT3
Definition: ltc2672.h:141
@ LTC2672_MUX_VREF
Definition: ltc2672.h:144
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
int ltc2672_power_down_channel(struct ltc2672_dev *, enum ltc2672_dac_ch)
power down a channel
Definition: ltc2672.c:400
bool is_synchronous
Definition: iio_types.h:234
@ LTC2672_DAC0
Definition: ltc2672.h:114
int ltc2672_remove(struct ltc2672_dev *)
Remove resources allocated by the init function.
Definition: ltc2672.c:88
Header file of utility functions.
@ LTC2672_MUX_VDD0
Definition: ltc2672.h:147
uint32_t prev_command
Definition: ltc2672.h:187
@ LTC2672_MUX_VREF_LO
Definition: ltc2672.h:145
struct no_os_spi_desc * comm_desc
Definition: ltc2672.h:179
#define LTC2672_COMMAND24_GENERATE(comm, add, dat)
Definition: ltc2672.h:93
int ltc2672_setup_toggle_channel(struct ltc2672_dev *, enum ltc2672_dac_ch, uint32_t, uint32_t)
setup toggle parameters for a channel
Definition: ltc2672.c:467
Error macro definition for ARM Compiler.
ltc2672_faults
Definition: ltc2672.h:162
uint32_t ltc2672_current_to_code(struct ltc2672_dev *device, uint32_t dac_current, enum ltc2672_dac_ch out_ch)
get dac code value from current of a selected DAC channel
Definition: ltc2672.c:142
@ LTC2672_MUX_VMINUS
Definition: ltc2672.h:152
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
int ltc2672_global_toggle(struct ltc2672_dev *device, bool is_enable)
enables or disables global toggle bit
Definition: ltc2672.c:550