no-OS
ad7303.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef __AD7303_H__
34 #define __AD7303_H__
35 
36 /******************************************************************************/
37 /***************************** Include Files **********************************/
38 /******************************************************************************/
39 #include <stdint.h>
40 #include "no_os_spi.h"
41 
42 /******************************************************************************/
43 /******************************** AD7303 **************************************/
44 /******************************************************************************/
45 /* Control Bits */
46 #define AD7303_INT (0 << 7) // Selects internal reference.
47 #define AD7303_EXT (1 << 7) // Selects external reference.
48 #define AD7303_LDAC (1 << 5) // Load DAC bit.
49 #define AD7303_PDB (1 << 4) // Power-down DAC B.
50 #define AD7303_PDA (1 << 3) // Power-down DAC A.
51 #define AD7303_A (0 << 2) // Address bit to select DAC A.
52 #define AD7303_B (1 << 2) // Address bit to select DAC B.
53 #define AD7303_CR1 (1 << 1) // Control Bit 1.
54 #define AD7303_CR0 (1 << 0) // Control Bit 0.
55 
56 /******************************************************************************/
57 /*************************** Types Declarations *******************************/
58 /******************************************************************************/
59 
60 struct ad7303_dev {
61  /* SPI */
63 };
64 
66  /* SPI */
68 };
69 
70 /******************************************************************************/
71 /************************ Functions Declarations ******************************/
72 /******************************************************************************/
73 
75 int8_t ad7303_init(struct ad7303_dev **device,
77 
79 int32_t ad7303_remove(struct ad7303_dev *dev);
80 
82 void ad7303_write(struct ad7303_dev *dev,
83  uint8_t control_reg,
84  uint8_t data_reg);
85 
86 #endif /* __AD7303_H__ */
no_os_alloc.h
ad7303_init_param
Definition: ad7303.h:65
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:159
no_os_spi.h
Header file of SPI Interface.
device
Definition: ad9361_util.h:69
ad7303_dev
Definition: ad7303.h:60
ad7303_init
int8_t ad7303_init(struct ad7303_dev **device, struct ad7303_init_param init_param)
Initializes SPI communication.
Definition: ad7303.c:52
ad7303_init
int8_t ad7303_init(struct ad7303_dev **device, struct ad7303_init_param init_param)
Initializes SPI communication.
Definition: ad7303.c:52
ad7303_init_param::spi_init
struct no_os_spi_init_param spi_init
Definition: ad7303.h:67
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:171
ad7303_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad7303.h:62
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
ad7303_remove
int32_t ad7303_remove(struct ad7303_dev *dev)
Free the resources allocated by ad7303_init().
Definition: ad7303.c:76
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
ad7303_write
void ad7303_write(struct ad7303_dev *dev, uint8_t control_reg, uint8_t data_reg)
Sends data to AD7303.
Definition: ad7303.c:100
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
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
ad7303.h
Header file of AD7303 Driver.
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
ad7303_write
void ad7303_write(struct ad7303_dev *dev, uint8_t control_reg, uint8_t data_reg)
Sends data to AD7303.
Definition: ad7303.c:100
ad7303_remove
int32_t ad7303_remove(struct ad7303_dev *dev)
Free the resources allocated by ad7303_init().
Definition: ad7303.c:76
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:125