no-OS
|
Header file for the ad2s1210 driver. More...
Go to the source code of this file.
Classes | |
struct | ad2s1210_init_param |
struct | ad2s1210_dev |
Enumerations | |
enum | ad2s1210_mode { MODE_POS, MODE_RESERVED, MODE_VEL, MODE_CONFIG } |
enum | ad2s1210_res { AD2S1210_RES_10BIT, AD2S1210_RES_12BIT, AD2S1210_RES_14BIT, AD2S1210_RES_16BIT } |
enum | ad2s1210_channel { AD2S1210_POS, AD2S1210_VEL } |
Functions | |
int | ad2s1210_init (struct ad2s1210_dev **dev, struct ad2s1210_init_param *init_param) |
int | ad2s1210_remove (struct ad2s1210_dev *dev) |
Remove the driver's descriptor by freeing the associated resources. More... | |
int | ad2s1210_reg_write (struct ad2s1210_dev *dev, uint8_t addr, uint8_t val) |
int | ad2s1210_reg_read (struct ad2s1210_dev *dev, uint8_t addr, uint8_t *val) |
int | ad2s1210_spi_single_conversion (struct ad2s1210_dev *dev, uint32_t active_mask, void *data, uint32_t size) |
Returns the result of a conversion. More... | |
int | ad2s1210_hysteresis_is_enabled (struct ad2s1210_dev *dev) |
int | ad2s1210_set_hysteresis (struct ad2s1210_dev *dev, bool enable) |
int | ad2s1210_reinit_excitation_frequency (struct ad2s1210_dev *dev, uint16_t fexcit) |
int | ad2s1210_get_excitation_frequency (struct ad2s1210_dev *dev, uint16_t *fexcit) |
Header file for the ad2s1210 driver.
Copyright (c) 2023 Analog Devices, Inc. Copyright (c) 2023 BayLibre, SAS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AD2S1210_CONTROL_RES0_MASK NO_OS_BIT(0) |
#define AD2S1210_CONTROL_RES1_MASK NO_OS_BIT(1) |
#define AD2S1210_CONTROL_RES_MASK NO_OS_GENMASK(1, 0) |
#define AD2S1210_ENABLE_HYSTERESIS NO_OS_BIT(4) |
#define AD2S1210_MAX_CLKIN 10240000 |
#define AD2S1210_MAX_EXCIT 20000 |
#define AD2S1210_MAX_FCW 0x50 |
#define AD2S1210_MIN_CLKIN 6144000 |
#define AD2S1210_MIN_EXCIT 2000 |
#define AD2S1210_MIN_FCW 0x4 |
#define AD2S1210_POS_MASK NO_OS_BIT(0) |
#define AD2S1210_REG_CONTROL 0x92 |
#define AD2S1210_REG_DOS_MIS_THRD 0x8A |
#define AD2S1210_REG_DOS_OVR_THRD 0x89 |
#define AD2S1210_REG_DOS_RST_MAX_THRD 0x8B |
#define AD2S1210_REG_DOS_RST_MIN_THRD 0x8C |
#define AD2S1210_REG_EXCIT_FREQ 0x91 |
#define AD2S1210_REG_FAULT 0xFF |
#define AD2S1210_REG_LOS_THRD 0x88 |
#define AD2S1210_REG_LOT_HIGH_THRD 0x8D |
#define AD2S1210_REG_LOT_LOW_THRD 0x8E |
#define AD2S1210_REG_MIN AD2S1210_REG_POSITION |
#define AD2S1210_REG_POSITION 0x80 |
#define AD2S1210_REG_SOFT_RESET 0xF0 |
#define AD2S1210_REG_VELOCITY 0x82 |
#define AD2S1210_STEP_EXCIT 250 |
#define AD2S1210_VEL_MASK NO_OS_BIT(1) |
enum ad2s1210_channel |
enum ad2s1210_mode |
enum ad2s1210_res |
int ad2s1210_get_excitation_frequency | ( | struct ad2s1210_dev * | dev, |
uint16_t * | fexcit | ||
) |
int ad2s1210_hysteresis_is_enabled | ( | struct ad2s1210_dev * | dev | ) |
int ad2s1210_init | ( | struct ad2s1210_dev ** | dev, |
struct ad2s1210_init_param * | init_param | ||
) |
int ad2s1210_reg_read | ( | struct ad2s1210_dev * | dev, |
uint8_t | addr, | ||
uint8_t * | val | ||
) |
int ad2s1210_reg_write | ( | struct ad2s1210_dev * | dev, |
uint8_t | addr, | ||
uint8_t | val | ||
) |
int ad2s1210_reinit_excitation_frequency | ( | struct ad2s1210_dev * | dev, |
uint16_t | fexcit | ||
) |
int ad2s1210_remove | ( | struct ad2s1210_dev * | dev | ) |
Remove the driver's descriptor by freeing the associated resources.
dev | - Device descriptor. |
int ad2s1210_set_hysteresis | ( | struct ad2s1210_dev * | dev, |
bool | enable | ||
) |
int ad2s1210_spi_single_conversion | ( | struct ad2s1210_dev * | dev, |
uint32_t | active_mask, | ||
void * | data, | ||
uint32_t | size | ||
) |
Returns the result of a conversion.
dev | - The device structure. |
active_mask | - mask of active channels angle = bit 0, velocity = bit 1 |
data | - Buffer to store sampled register data. |
size | - size in bytes of the data buffer |