no-OS
ltc2312.h
Go to the documentation of this file.
1 
45 #ifndef LTC231X_H
46 #define LTC231X_H
47 
49 #ifndef LTC2315_CS
50 #define LTC2315_CS QUIKEVAL_CS
51 #endif
52 
54 // Channel Address
56 #define LTC2315_ADDRESS 0x00
57 
59 #define LTC2312_READ_BYTES_NUMBER 2
60 #define LTC2312_READ_VALUES_NUMBER 100
61 
62 /******************************************************************************/
63 /***************************** Include Files **********************************/
64 /******************************************************************************/
65 #include <stdint.h>
66 #include "no_os_delay.h"
67 #include "no_os_spi.h"
68 
69 /******************************************************************************/
70 /*************************** Types Declarations *******************************/
71 /******************************************************************************/
75 };
76 
77 struct ltc2312_dev {
78  /* Device characteristics */
80  /* SPI */
82 };
83 
85  /* Device characteristics */
87  /* SPI */
89 };
90 
91 /******************************************************************************/
92 /************************ Functions Declarations ******************************/
93 /******************************************************************************/
94 /* Initializes the ltc231x. */
95 int32_t ltc2312_setup(struct ltc2312_dev **device,
97 
98 /* Free the resources allocated by ltc231x_setup(). */
99 int32_t ltc2312_remove(struct ltc2312_dev *dev);
100 
101 /* Reads the LTC2315 and returns 32-bit data in offset binary format. */
102 int32_t ltc2312_read(struct ltc2312_dev *dev, uint16_t *ptr_adc_code);
103 
104 /* Calculates the LTC2315 input voltage given the binary data and LSB weight. */
105 void ltc2312_code_to_voltage(struct ltc2312_dev *dev, uint16_t adc_code,
106  float vref, float *voltage);
107 
108 #endif // LTC2315_H
device_type
device_type
Definition: ltc2312.h:72
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:118
iio_trigger.h
Header file for iio_trigger.
no_os_spi_write_and_read
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:95
no_os_spi.h
Header file of SPI Interface.
ltc2312_setup
int32_t ltc2312_setup(struct ltc2312_dev **device, struct ltc2312_init_param *init_param)
Definition: ltc2312.c:67
ltc2312_remove
int32_t ltc2312_remove(struct ltc2312_dev *dev)
Definition: ltc2312.c:99
ltc2312_setup
int32_t ltc2312_setup(struct ltc2312_dev **device, struct ltc2312_init_param *init_param)
Definition: ltc2312.c:67
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:132
LTC2312_READ_VALUES_NUMBER
#define LTC2312_READ_VALUES_NUMBER
Definition: ltc2312.h:60
no_os_delay.h
Header file of Delay functions.
device
Definition: ad9361_util.h:75
ltc2312_read
int32_t ltc2312_read(struct ltc2312_dev *dev, uint16_t *ptr_adc_code)
Definition: ltc2312.c:150
ltc2312_remove
int32_t ltc2312_remove(struct ltc2312_dev *dev)
Definition: ltc2312.c:99
adc_iio_timer_trig_desc
struct iio_trigger adc_iio_timer_trig_desc
Definition: iio_adc_demo_trig.c:67
iio_sw_trig_handler
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:213
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
ltc2312_code_to_voltage
void ltc2312_code_to_voltage(struct ltc2312_dev *dev, uint16_t adc_code, float vref, float *voltage)
Definition: ltc2312.c:204
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
iio_attribute::name
const char * name
Definition: iio_types.h:133
ltc2312_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ltc2312.h:88
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:115
LTC2312_14
@ LTC2312_14
Definition: ltc2312.h:74
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:131
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:143
ltc2312_code_to_voltage
void ltc2312_code_to_voltage(struct ltc2312_dev *dev, uint16_t adc_code, float vref, float *voltage)
Definition: ltc2312.c:204
ltc2312_read
int32_t ltc2312_read(struct ltc2312_dev *dev, uint16_t *ptr_adc_code)
Definition: ltc2312.c:150
ltc2312_dev
Definition: ltc2312.h:77
iio_trigger
Definition: iio_types.h:231
ltc2312_init_param::type
enum device_type type
Definition: ltc2312.h:86
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
ltc2312_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ltc2312.h:81
iio_adc_demo.h
Header file of ADC Demo iio.
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:77
ltc2312.h
adc_iio_sw_trig_desc
struct iio_trigger adc_iio_sw_trig_desc
Definition: iio_adc_demo_trig.c:61
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:51
iio_trigger::is_synchronous
bool is_synchronous
Definition: iio_types.h:234
LTC2312_12
@ LTC2312_12
Definition: ltc2312.h:73
ltc2312_init_param
Definition: ltc2312.h:84
LTC2312_READ_BYTES_NUMBER
#define LTC2312_READ_BYTES_NUMBER
Definition: ltc2312.h:59
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:121
ltc2312_dev::type
enum device_type type
Definition: ltc2312.h:79