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
no_os_alloc.h
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:165
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:68
ltc2312_remove
int32_t ltc2312_remove(struct ltc2312_dev *dev)
Definition: ltc2312.c:100
ltc2312_setup
int32_t ltc2312_setup(struct ltc2312_dev **device, struct ltc2312_init_param *init_param)
Definition: ltc2312.c:68
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:151
ltc2312_remove
int32_t ltc2312_remove(struct ltc2312_dev *dev)
Definition: ltc2312.c:100
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:205
ltc2312_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ltc2312.h:88
LTC2312_14
@ LTC2312_14
Definition: ltc2312.h:74
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
ltc2312_code_to_voltage
void ltc2312_code_to_voltage(struct ltc2312_dev *dev, uint16_t adc_code, float vref, float *voltage)
Definition: ltc2312.c:205
ltc2312_read
int32_t ltc2312_read(struct ltc2312_dev *dev, uint16_t *ptr_adc_code)
Definition: ltc2312.c:151
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:49
ltc2312_dev
Definition: ltc2312.h:77
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
ltc2312_init_param::type
enum device_type type
Definition: ltc2312.h:86
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
ltc2312_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ltc2312.h:81
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:122
ltc2312.h
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:58
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:131
ltc2312_dev::type
enum device_type type
Definition: ltc2312.h:79