no-OS
|
Go to the source code of this file.
Classes | |
struct | ad5293_chip_info |
struct | ad5293_dev |
struct | ad5293_init_param |
Macros | |
#define | CMD_NOP 0 |
#define | CMD_W_WIPER 1 |
#define | CMD_R_WIPER 2 |
#define | CMD_RESET 4 |
#define | CMD_W_CTRL 6 |
#define | CMD_R_CTRL 7 |
#define | CMD_PD 8 |
#define | CMD_SDO_Z 0x8001 |
#define | CALI_MSK NO_OS_BIT(2) |
#define | PROTECT_MSK NO_OS_BIT(1) |
#define | AD5293_W_CTRL_FRAME(pm, cali) (uint16_t)((CMD_W_CTRL<<10)|(pm<<1)|(cali<<2)) |
#define | AD5293_R_CTRL_FRAME (uint16_t)CMD_R_CTRL<<10 |
#define | AD5293_W_WIPER_FRAME(data) (uint16_t)((CMD_W_WIPER<<10)|data) |
#define | AD5293_R_WIPER_FRAME (uint16_t)CMD_R_WIPER<<10 |
#define | SHUTDOWN_FRAME(sd) (uint16_t)((CMD_PD<<10)|sd) |
#define | RESET_FRAME (uint16_t)CMD_RESET<<10 |
Enumerations | |
enum | calibration_mode_t { CALI_PERFORMANCE, CALI_NORMAL } |
enum | protect_mode_t { PROTECT_LOCK, PROTECT_UNLOCK } |
enum | shutdown_t { NORMAL, SHUTDOWN } |
enum | operation_mode_t { BUS, DAISY_CHAIN } |
enum | sdo_mode_t { SDO_DISENABLE, SDO_ENABLE } |
Functions | |
int32_t | ad5293_init (struct ad5293_dev **device, struct ad5293_init_param *init_param) |
Initialize the ad5293 device structure. More... | |
int32_t | ad5293_remove (struct ad5293_dev *dev) |
Free any resource used by the driver. More... | |
int32_t | ad5293_hard_reset (struct ad5293_dev *dev) |
Reset ad5293 through Hardware Reset Pin. More... | |
int32_t | ad5293_soft_reset (struct ad5293_dev *dev) |
Reset ad5293 through software reset command. More... | |
int32_t | ad5293_sdo_setfloat (struct ad5293_dev *dev) |
Place SDO pin in high impedence mode. More... | |
int32_t | ad5293_shutdown (struct ad5293_dev *dev, enum shutdown_t sd) |
Place ad5293 in shutdown mode or recovery. More... | |
int32_t | ad5293_update_cali (struct ad5293_dev *dev, enum calibration_mode_t cali, uint8_t num) |
Update ad5293 chip info struct calibration information. More... | |
int32_t | ad5293_update_wiper (struct ad5293_dev *dev, uint16_t val, uint8_t num) |
Update ad5293 chip info struct wiper value information. More... | |
int32_t | ad5293_write_cali (struct ad5293_dev *dev) |
Write ad5293 chip info struct calibration value through SPI interface. More... | |
int32_t | ad5293_write_wiper (struct ad5293_dev *dev) |
Write ad5293 chip info struct wiper value through SPI interface. More... | |
int32_t | ad5293_read_reg_cali (struct ad5293_dev *dev) |
Read ad5293 device register calibration mode through SPI interface. More... | |
int32_t | ad5293_read_reg_wiper (struct ad5293_dev *dev) |
Read ad5293 device register wiper value through SPI interface. More... | |
int8_t | ad5293_get_cali (struct ad5293_dev *dev, uint8_t num) |
Get calibration of a certain chip. More... | |
int16_t | ad5293_get_wiper (struct ad5293_dev *dev, uint8_t num) |
Get wiper of a certain chip. More... | |
#define AD5293_R_CTRL_FRAME (uint16_t)CMD_R_CTRL<<10 |
#define AD5293_R_WIPER_FRAME (uint16_t)CMD_R_WIPER<<10 |
#define AD5293_W_CTRL_FRAME | ( | pm, | |
cali | |||
) | (uint16_t)((CMD_W_CTRL<<10)|(pm<<1)|(cali<<2)) |
#define AD5293_W_WIPER_FRAME | ( | data | ) | (uint16_t)((CMD_W_WIPER<<10)|data) |
#define CALI_MSK NO_OS_BIT(2) |
#define CMD_NOP 0 |
@file ad5293.h @brief Header file for the AD5293 Driver @author Ming Zeng
The MIT License (MIT)
Copyright (c) 2024 Ming Zeng
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define CMD_PD 8 |
#define CMD_R_CTRL 7 |
#define CMD_R_WIPER 2 |
#define CMD_RESET 4 |
#define CMD_SDO_Z 0x8001 |
#define CMD_W_CTRL 6 |
#define CMD_W_WIPER 1 |
#define PROTECT_MSK NO_OS_BIT(1) |
#define RESET_FRAME (uint16_t)CMD_RESET<<10 |
#define SHUTDOWN_FRAME | ( | sd | ) | (uint16_t)((CMD_PD<<10)|sd) |
enum calibration_mode_t |
enum operation_mode_t |
enum protect_mode_t |
enum sdo_mode_t |
enum shutdown_t |
int8_t ad5293_get_cali | ( | struct ad5293_dev * | dev, |
uint8_t | num | ||
) |
Get calibration of a certain chip.
return chip info struct calibration value to caller.
dev | - The device structure. |
num | - The device number.( 0 to chip_num-1) |
int16_t ad5293_get_wiper | ( | struct ad5293_dev * | dev, |
uint8_t | num | ||
) |
Get wiper of a certain chip.
return chip info struct wiper value to caller.
dev | - The device structure. |
num | - The device number.( 0 to chip_num-1) |
int32_t ad5293_hard_reset | ( | struct ad5293_dev * | dev | ) |
Reset ad5293 through Hardware Reset Pin.
dev | - The device structure. |
int32_t ad5293_init | ( | struct ad5293_dev ** | device, |
struct ad5293_init_param * | init_param | ||
) |
Initialize the ad5293 device structure.
Performs memory allocation of the device structure.
device | - Pointer to location of device structure to write. |
init_param | - Pointer to configuration of the driver. |
int32_t ad5293_read_reg_cali | ( | struct ad5293_dev * | dev | ) |
Read ad5293 device register calibration mode through SPI interface.
read ad5293 calibration value and update it to chip info struct. Note: multiple chips operation should in daisy-chain mode.
dev | - The device structure. |
int32_t ad5293_read_reg_wiper | ( | struct ad5293_dev * | dev | ) |
Read ad5293 device register wiper value through SPI interface.
read ad5293 wiper value and update it to chip info struct. Note: multiple chips operation should in daisy-chain mode.
dev | - The device structure. |
int32_t ad5293_remove | ( | struct ad5293_dev * | dev | ) |
Free any resource used by the driver.
dev | - The device structure. |
int32_t ad5293_sdo_setfloat | ( | struct ad5293_dev * | dev | ) |
Place SDO pin in high impedence mode.
Minimize power dissipation when pin is used.
dev | - The device structure. |
int32_t ad5293_shutdown | ( | struct ad5293_dev * | dev, |
enum shutdown_t | sd | ||
) |
Place ad5293 in shutdown mode or recovery.
In shut down mode, terminal A open, Wiper and terminal B connected.
dev | - The device structure. |
sd | - shutdown mode selection. |
int32_t ad5293_soft_reset | ( | struct ad5293_dev * | dev | ) |
Reset ad5293 through software reset command.
dev | - The device structure. |
int32_t ad5293_update_cali | ( | struct ad5293_dev * | dev, |
enum calibration_mode_t | cali, | ||
uint8_t | num | ||
) |
Update ad5293 chip info struct calibration information.
For calibration register write operation.
dev | - The device structure. |
cali | - calibration mode selection. |
num | - chip indication. |
int32_t ad5293_update_wiper | ( | struct ad5293_dev * | dev, |
uint16_t | val, | ||
uint8_t | num | ||
) |
Update ad5293 chip info struct wiper value information.
For wiper register write operation.
dev | - The device structure. |
val | - wiper value. |
num | - chip indication. |
int32_t ad5293_write_cali | ( | struct ad5293_dev * | dev | ) |
Write ad5293 chip info struct calibration value through SPI interface.
Note: multiple chips operation should in daisy-chain mode.
dev | - The device structure. |
int32_t ad5293_write_wiper | ( | struct ad5293_dev * | dev | ) |
Write ad5293 chip info struct wiper value through SPI interface.
Note: multiple chips operation should in daisy-chain mode.
dev | - The device structure. |