Go to the documentation of this file.
56 #define LTC2672_16_DONT_CARE 0xFFF0
57 #define LTC2672_MUX_DONT_CARE 0xFFFE0
58 #define LTC2672_DUMMY 0xFFFF
59 #define LTC2672_FAULT_REG_MASK 0xFF0000
62 #define LTC2672_BASE_CURRENT 3.125 // base current in mA
63 #define LTC2672_VMINUS_FIXED_CURRENT -80 // Fixed V- Current as per data sheet
64 #define LTC2672_OFF_CURRENT 0
65 #define LTC2672_300MA_CURRENT 300
66 #define LTC2672_16BIT_RESO 65535
67 #define LTC2672_12BIT_RESO 4095
68 #define LTC2672_TOTAL_CHANNELS 5
69 #define LTC2672_MAX_CONFIG_MASK 15
70 #define LTC2672_MAX_TOGGLE_MASK 31
71 #define LTC2672_BIT_SHIFT_12BIT 4
72 #define LTC2672_NUM_MUX_SELECTS 22
73 #define LTC2672_NUM_CURRENT_SPANS 10
74 #define LTC2672_NUM_FAULTS 7
96 #define LTC2672_COMMAND32_GENERATE(comm, add, dat) \
97 (0xFF << 24) | (comm << 20) | (add << 16) | (dat)
99 #define LTC2672_COMMAND24_GENERATE(comm, add, dat) \
100 (comm << 20) | (add << 16) | (dat)
102 #define LTC2672_SPAN_SET(span_code) LTC2672_16_DONT_CARE | span_code
104 #define LTC2672_MUX_SET(mux_code) LTC2672_MUX_DONT_CARE | mux_code
106 #define LTC2672_MUX32_GENERATE(comm, dat) \
107 (0xFF << 24) | (comm << 20) | (dat)
109 #define LTC2672_MUX24_GENERATE(comm, dat) \
268 #endif // __LTC2672_H__
@ LTC2672_NO_OP
Definition: ltc2672.h:92
@ LTC2672_100VREF
Definition: ltc2672.h:131
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:122
int ltc2672_enable_toggle_channel(struct ltc2672_dev *, uint32_t)
enables or disables selected channel/s for toggling
Definition: ltc2672.c:538
Header file for iio_trigger.
@ LTC2672_MUX_VOUT1
Definition: ltc2672.h:161
#define LTC2672_MAX_CONFIG_MASK
Definition: ltc2672.h:69
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:339
@ LTC2672_MUX_VDD2
Definition: ltc2672.h:155
Header file of DAC Demo iio.
ltc2672_commands
Definition: ltc2672.h:76
#define LTC2672_BIT_SHIFT_12BIT
Definition: ltc2672.h:71
int ltc2672_config_command(struct ltc2672_dev *device, uint8_t mask)
configures the fault detection bits
Definition: ltc2672.c:574
int ltc2672_monitor_mux(struct ltc2672_dev *device, enum ltc2672_mux_commands mux_comm)
configures mux output depending on target measurement
Definition: ltc2672.c:449
int ltc2672_remove(struct ltc2672_dev *device)
Remove resources allocated by the init function.
Definition: ltc2672.c:94
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:165
@ LTC2672_CODE_TO_CHANNEL_X_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:79
@ LTC2672_SPAN_TO_CHANNEL_ALL
Definition: ltc2672.h:91
@ LTC2672_MUX_IOUT4
Definition: ltc2672.h:148
Header file of SPI Interface.
@ LTC2672_PWRDWN_DEV
Definition: ltc2672.h:82
int ltc2672_set_span_all_channels(struct ltc2672_dev *, enum ltc2672_out_range)
sets the same output span for all channels
Definition: ltc2672.c:339
int ltc2672_chip_power_down(struct ltc2672_dev *device)
power down ltc2672
Definition: ltc2672.c:390
ltc2672_out_range
Definition: ltc2672.h:128
#define LTC2672_MAX_TOGGLE_MASK
Definition: ltc2672.h:70
@ LTC2672_MUX_VDD4
Definition: ltc2672.h:157
int ltc2672_global_toggle(struct ltc2672_dev *, bool)
enables or disables global toggle bit
Definition: ltc2672.c:556
@ LTC2672_OVER_TEMP
Definition: ltc2672.h:174
int ltc2672_power_down_channel(struct ltc2672_dev *device, enum ltc2672_dac_ch out_ch)
power down a channel
Definition: ltc2672.c:406
@ LTC2672_DAC4
Definition: ltc2672.h:124
@ LTC2672_MUX_VOUT4
Definition: ltc2672.h:164
#define LTC2672_VMINUS_FIXED_CURRENT
Definition: ltc2672.h:63
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:133
int ltc2672_set_code_all_channels(struct ltc2672_dev *device, uint16_t code)
sets the same dac code for all channels
Definition: ltc2672.c:228
@ LTC2672_50VREF
Definition: ltc2672.h:130
#define LTC2672_MUX_SET(mux_code)
Definition: ltc2672.h:104
@ LTC2672_MUX_GND
Definition: ltc2672.h:159
@ LTC2672_OFF
Definition: ltc2672.h:129
@ LTC2672_TOGGLE_GLBL
Definition: ltc2672.h:90
@ LTC2672_PWRUP_UPD_CHANNEL_X
Definition: ltc2672.h:78
@ LTC2672_SPAN_TO_CHANNEL_X
Definition: ltc2672.h:83
@ LTC2672_16
Definition: ltc2672.h:115
Definition: ad9361_util.h:75
int ltc2672_power_down_all_channels(struct ltc2672_dev *)
power down ALL channels
Definition: ltc2672.c:425
@ LTC2672_DAC3
Definition: ltc2672.h:123
ltc2672_device_id
Definition: ltc2672.h:113
@ LTC2672_400VREF
Definition: ltc2672.h:133
@ LTC2672_MUX_IOUT1
Definition: ltc2672.h:145
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
int ltc2672_monitor_mux(struct ltc2672_dev *, enum ltc2672_mux_commands)
configures mux output depending on target measurement
Definition: ltc2672.c:449
@ LTC2672_MUX_VDD3
Definition: ltc2672.h:156
@ LTC2672_CODE_TO_CHANNEL_ALL
Definition: ltc2672.h:85
struct iio_trigger dac_iio_sw_trig_desc
Definition: iio_dac_demo_trig.c:61
@ LTC2672_200VREF
Definition: ltc2672.h:132
@ LTC2672_MUC_VCC
Definition: ltc2672.h:149
@ LTC2672_800VREF
Definition: ltc2672.h:134
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:214
@ LTC2672_VMINUS_VREF
Definition: ltc2672.h:137
int ltc2672_power_down_all_channels(struct ltc2672_dev *device)
power down ALL channels
Definition: ltc2672.c:425
int ltc2672_config_command(struct ltc2672_dev *, uint8_t)
configures the fault detection bits
Definition: ltc2672.c:574
#define LTC2672_MUX24_GENERATE(comm, dat)
Definition: ltc2672.h:109
#define LTC2672_DUMMY
Definition: ltc2672.h:58
int ltc2672_set_current_all_channels(struct ltc2672_dev *device, uint32_t current)
sets the same current for all channels
Definition: ltc2672.c:260
int ltc2672_set_current_all_channels(struct ltc2672_dev *, uint32_t)
sets the same current for all channels
Definition: ltc2672.c:260
const char * name
Definition: iio_types.h:137
@ LTC2672_OPEN_OUT3
Definition: ltc2672.h:172
int ltc2672_set_code_all_channels(struct ltc2672_dev *device, uint16_t code)
sets the same dac code for all channels
Definition: ltc2672.c:228
@ LTC2672_DAC2
Definition: ltc2672.h:122
int ltc2672_init(struct ltc2672_dev **device, struct ltc2672_init_param *init_param)
Device and communication init function.
Definition: ltc2672.c:64
@ LTC2672_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:86
int ltc2672_enable_toggle_channel(struct ltc2672_dev *device, uint32_t mask)
enables or disables selected channel/s for toggling
Definition: ltc2672.c:538
@ LTC2672_MON_MUX
Definition: ltc2672.h:88
@ LTC2672_MUX_IOUT2
Definition: ltc2672.h:146
@ LTC2672_MUX_VOUT3
Definition: ltc2672.h:163
int ltc2672_transaction(struct ltc2672_dev *device, uint32_t, bool)
Write raw register value.
Definition: ltc2672.c:115
#define LTC2672_300MA_CURRENT
Definition: ltc2672.h:65
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:116
@ LTC2672_CODE_PWRUP_UPD_CHANNEL_ALL
Definition: ltc2672.h:87
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:207
@ LTC2672_OPEN_OUT2
Definition: ltc2672.h:171
@ LTC2672_MUX_DISABLED
Definition: ltc2672.h:143
@ LTC2672_1600VREF
Definition: ltc2672.h:135
Structure holding ltc2672 descriptor.
Definition: ltc2672.h:183
Structure holding pointers to show and store functions.
Definition: iio_types.h:135
int ltc2672_transaction(struct ltc2672_dev *device, uint32_t comm, bool is_32)
Write raw register value.
Definition: ltc2672.c:115
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:288
#define LTC2672_BASE_CURRENT
Definition: ltc2672.h:62
@ LTC2672_UNUSED
Definition: ltc2672.h:175
@ LTC2672_DAC1
Definition: ltc2672.h:121
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
int ltc2672_chip_power_down(struct ltc2672_dev *)
power down ltc2672
Definition: ltc2672.c:390
@ LTC2672_OPEN_OUT1
Definition: ltc2672.h:170
ltc2672_dac_ch
Definition: ltc2672.h:119
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:171
@ LTC2672_3200VREF
Definition: ltc2672.h:136
ltc2672_mux_commands
Definition: ltc2672.h:142
@ LTC2672_INV_LENGTH
Definition: ltc2672.h:176
int ltc2672_init(struct ltc2672_dev **, struct ltc2672_init_param *)
Device and communication init function.
Definition: ltc2672.c:64
Structure holding the parameters for ltc2672 initialization.
Definition: ltc2672.h:202
struct iio_trigger dac_iio_timer_trig_desc
Definition: iio_dac_demo_trig.c:67
uint32_t max_currents[LTC2672_TOTAL_CHANNELS]
Definition: ltc2672.h:191
@ LTC2672_OPEN_OUT4
Definition: ltc2672.h:173
@ LTC2672_12
Definition: ltc2672.h:114
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:171
@ LTC2672_MUX_DIE_TEMP
Definition: ltc2672.h:152
#define LTC2672_OFF_CURRENT
Definition: ltc2672.h:64
@ LTC2672_TOGGLE_SEL
Definition: ltc2672.h:89
@ LTC2672_OPEN_OUT0
Definition: ltc2672.h:169
enum ltc2672_device_id id
Definition: ltc2672.h:187
Header file of ltc2672 Driver.
struct no_os_spi_init_param spi_init
Definition: ltc2672.h:204
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
enum ltc2672_device_id id
Definition: ltc2672.h:206
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
@ LTC2672_MUX_VOUT2
Definition: ltc2672.h:162
#define MICROAMPER_PER_MILLIAMPER
Definition: no_os_units.h:69
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:207
Definition: iio_types.h:237
#define LTC2672_SPAN_SET(span_code)
Definition: ltc2672.h:102
int ltc2672_set_span_channel(struct ltc2672_dev *, enum ltc2672_out_range, enum ltc2672_dac_ch)
sets output span for channel
Definition: ltc2672.c:288
@ LTC2672_CODE_PWRUP_UPD_CHANNEL_X
Definition: ltc2672.h:80
@ LTC2672_MUX_VOUT0
Definition: ltc2672.h:160
@ LTC2672_MUX_IOUT0
Definition: ltc2672.h:144
@ LTC2672_CODE_TO_CHANNEL_X
Definition: ltc2672.h:77
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
#define LTC2672_TOTAL_CHANNELS
Definition: ltc2672.h:68
enum ltc2672_out_range out_spans[LTC2672_TOTAL_CHANNELS]
Definition: ltc2672.h:189
@ LTC2672_4800VREF
Definition: ltc2672.h:138
#define LTC2672_16BIT_RESO
Definition: ltc2672.h:66
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:473
@ LTC2672_PWRDWN_CHANNEL_X
Definition: ltc2672.h:81
@ LTC2672_MUX_VDD1
Definition: ltc2672.h:154
@ LTC2672_CNFG_CMD
Definition: ltc2672.h:84
bool global_toggle
Definition: ltc2672.h:195
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:122
#define LTC2672_12BIT_RESO
Definition: ltc2672.h:67
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:148
@ LTC2672_MUX_IOUT3
Definition: ltc2672.h:147
@ LTC2672_MUX_VREF
Definition: ltc2672.h:150
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:58
int ltc2672_power_down_channel(struct ltc2672_dev *, enum ltc2672_dac_ch)
power down a channel
Definition: ltc2672.c:406
bool is_synchronous
Definition: iio_types.h:240
@ LTC2672_DAC0
Definition: ltc2672.h:120
int ltc2672_remove(struct ltc2672_dev *)
Remove resources allocated by the init function.
Definition: ltc2672.c:94
Header file of utility functions.
@ LTC2672_MUX_VDD0
Definition: ltc2672.h:153
uint32_t prev_command
Definition: ltc2672.h:193
@ LTC2672_MUX_VREF_LO
Definition: ltc2672.h:151
struct no_os_spi_desc * comm_desc
Definition: ltc2672.h:185
#define LTC2672_COMMAND24_GENERATE(comm, add, dat)
Definition: ltc2672.h:99
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:473
Error macro definition for ARM Compiler.
ltc2672_faults
Definition: ltc2672.h:168
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:148
@ LTC2672_MUX_VMINUS
Definition: ltc2672.h:158
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
int ltc2672_global_toggle(struct ltc2672_dev *device, bool is_enable)
enables or disables global toggle bit
Definition: ltc2672.c:556