no-OS
ad5110.h
Go to the documentation of this file.
1 /**************************************************************************/
33 #ifndef _ad5110_H_
34 #define _ad5110_H_
35 
36 /*****************************************************************************/
37 /****************************** Include Files ********************************/
38 /*****************************************************************************/
39 #include <stdint.h>
40 #include "no_os_i2c.h"
41 
42 /******************************************************************************/
43 /************************* Input shift register *******************************/
44 /******************************************************************************/
45 
47 #define COMMAND 8
48 
49 #define CMD_NOP 0
50 #define CMD_WR_RDAC_EEPROM 1
51 #define CMD_WR_RDAC 2
52 #define CMD_SHUT_DOWN 3
53 #define CMD_RESET 4
54 #define CMD_RD_RDAC 5
55 #define CMD_RD_EEPROM 6
56 
57 #define SHUT_DOWN_OFF 0
58 #define SHUT_DOWN_ON 1
59 
60 #define WIPER_POSITION 0
61 #define RESISTOR_TOLERANCE 1
62 
63 /******************************************************************************/
64 /*************************** Types Declarations *******************************/
65 /******************************************************************************/
66 struct ad5110_dev {
67  /* I2C */
69  /* Device Settings */
70  uint8_t ad5110_dev_addr;
71 };
72 
74  /* I2C */
76  /* Device Settings */
77  uint8_t ad5110_dev_addr;
78 };
79 
80 /******************************************************************************/
81 /************************ Functions Declarations ******************************/
82 /******************************************************************************/
83 
85 int8_t ad5110_init(struct ad5110_dev **device,
87 
89 int32_t ad5110_remove(struct ad5110_dev *dev);
90 
92 void ad5110_write_rdac(struct ad5110_dev *dev,
93  uint8_t rdac_value);
94 
96 uint8_t ad5110_read_rdac(struct ad5110_dev *dev);
97 
99 void ad5110_write_rdac_eeprom(struct ad5110_dev *dev);
100 
102 uint8_t ad5110_read_wiper(struct ad5110_dev *dev);
103 
105 uint8_t ad5110_read_res_tolerance(struct ad5110_dev *dev);
106 
108 void ad5110_reset(struct ad5110_dev *dev);
109 
111 void ad5110_shut_down(struct ad5110_dev *dev,
112  uint8_t value);
113 
114 #endif // _ad5110_H_
ad5110_dev::i2c_desc
struct no_os_i2c_desc * i2c_desc
Definition: ad5110.h:68
no_os_alloc.h
no_os_i2c_write
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
no_os_i2c_init
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
ad5110_dev
Definition: ad5110.h:66
ad5110_write_rdac
void ad5110_write_rdac(struct ad5110_dev *dev, uint8_t rdac_value)
Write the content of serial register data to RDAC.
Definition: ad5110.c:96
ad5110_init_param::ad5110_dev_addr
uint8_t ad5110_dev_addr
Definition: ad5110.h:77
ad5110_read_rdac
uint8_t ad5110_read_rdac(struct ad5110_dev *dev)
Read the content of RDAC register.
Definition: ad5110.c:116
CMD_RESET
#define CMD_RESET
Definition: ad5110.h:53
ad5110_shut_down
void ad5110_shut_down(struct ad5110_dev *dev, uint8_t value)
Software shutdown.
Definition: ad5110.c:240
no_os_i2c_remove
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
CMD_SHUT_DOWN
#define CMD_SHUT_DOWN
Definition: ad5110.h:52
ad5110_dev::ad5110_dev_addr
uint8_t ad5110_dev_addr
Definition: ad5110.h:70
ad5110_remove
int32_t ad5110_remove(struct ad5110_dev *dev)
Free the resources allocated by ad5110_init().
Definition: ad5110.c:77
CMD_WR_RDAC
#define CMD_WR_RDAC
Definition: ad5110.h:51
ad5110_read_wiper
uint8_t ad5110_read_wiper(struct ad5110_dev *dev)
Read wiper position from EEPROM.
Definition: ad5110.c:163
device
Definition: ad9361_util.h:69
ad5110_read_rdac
uint8_t ad5110_read_rdac(struct ad5110_dev *dev)
Read the content of RDAC register.
Definition: ad5110.c:116
ad5110_init
int8_t ad5110_init(struct ad5110_dev **device, struct ad5110_init_param init_param)
Initializes the communication with the device.
Definition: ad5110.c:52
ad5110_init_param::i2c_init
struct no_os_i2c_init_param i2c_init
Definition: ad5110.h:75
ad5110_read_wiper
uint8_t ad5110_read_wiper(struct ad5110_dev *dev)
Read wiper position from EEPROM.
Definition: ad5110.c:163
CMD_RD_EEPROM
#define CMD_RD_EEPROM
Definition: ad5110.h:55
ad5110_write_rdac_eeprom
void ad5110_write_rdac_eeprom(struct ad5110_dev *dev)
Write the content of RDAC register to EEPROM.
Definition: ad5110.c:143
CMD_WR_RDAC_EEPROM
#define CMD_WR_RDAC_EEPROM
Definition: ad5110.h:50
ad5110_shut_down
void ad5110_shut_down(struct ad5110_dev *dev, uint8_t value)
Software shutdown.
Definition: ad5110.c:240
ad5110_remove
int32_t ad5110_remove(struct ad5110_dev *dev)
Free the resources allocated by ad5110_init().
Definition: ad5110.c:77
ad5110_init_param
Definition: ad5110.h:73
no_os_i2c_desc
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
no_os_i2c_read
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
ad5110_write_rdac_eeprom
void ad5110_write_rdac_eeprom(struct ad5110_dev *dev)
Write the content of RDAC register to EEPROM.
Definition: ad5110.c:143
no_os_i2c.h
Header file of I2C Interface.
RESISTOR_TOLERANCE
#define RESISTOR_TOLERANCE
Definition: ad5110.h:61
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
ad5110_reset
void ad5110_reset(struct ad5110_dev *dev)
Software reset; makes a refresh of RDAC register with EEPROM.
Definition: ad5110.c:217
no_os_i2c_init_param
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
ad5110_read_res_tolerance
uint8_t ad5110_read_res_tolerance(struct ad5110_dev *dev)
Read resistor tolerance from EEPROM.
Definition: ad5110.c:190
WIPER_POSITION
#define WIPER_POSITION
Definition: ad5110.h:60
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad5110.h
Header file of ad5110 Driver for Microblaze processor.
ad5110_read_res_tolerance
uint8_t ad5110_read_res_tolerance(struct ad5110_dev *dev)
Read resistor tolerance from EEPROM.
Definition: ad5110.c:190
ad5110_init
int8_t ad5110_init(struct ad5110_dev **device, struct ad5110_init_param init_param)
Initializes the communication with the device.
Definition: ad5110.c:52
CMD_RD_RDAC
#define CMD_RD_RDAC
Definition: ad5110.h:54
ad5110_reset
void ad5110_reset(struct ad5110_dev *dev)
Software reset; makes a refresh of RDAC register with EEPROM.
Definition: ad5110.c:217
ad5110_write_rdac
void ad5110_write_rdac(struct ad5110_dev *dev, uint8_t rdac_value)
Write the content of serial register data to RDAC.
Definition: ad5110.c:96