49#if (LIS302DL_USE_SPI) || defined(__DOXYGEN__)
129 "acc_read_raw(), invalid state");
132#if LIS302DL_SHARED_SPI
134 "acc_read_raw(), channel not ready");
138 devp->config->spicfg);
144 axes[i] = (int32_t)((int8_t)tmp);
147#if LIS302DL_SHARED_SPI
183 "acc_read_cooked(), invalid state");
187 axes[i] = (raw[i] * devp->accsensitivity[i]) - devp->accbias[i];
215 "acc_set_bias(), invalid state");
218 devp->accbias[i] = bp[i];
244 "acc_reset_bias(), invalid state");
274 "acc_set_sensivity(), invalid state");
277 devp->accsensitivity[i] = sp[i];
303 "acc_reset_sensivity(), invalid state");
313 "acc_reset_sensivity(), accelerometer full scale issue");
340 "acc_set_full_scale(), invalid state");
342 "acc_set_full_scale(), channel not ready");
358 (newfs != devp->accfullscale)) {
360 scale = newfs / devp->accfullscale;
361 devp->accfullscale = newfs;
364#if LIS302DL_SHARED_SPI
367 devp->config->spicfg);
373#if LIS302DL_SHARED_SPI
382#if LIS302DL_SHARED_SPI
385 devp->config->spicfg);
391#if LIS302DL_SHARED_SPI
398 devp->accsensitivity[i] *= scale;
399 devp->accbias[i] *= scale;
448 uint8_t cr[2] = {0, 0};
452 "lis302dlStart(), invalid state");
454 devp->config = config;
460 devp->config->accodr |
461 devp->config->accfullscale;
466#if LIS302DL_USE_ADVANCED || defined(__DOXYGEN__)
467 if(devp->config->hpmode != LIS302DL_HPM_BYPASSED)
468 cr[1] = devp->config->acchighpass;
473#if LIS302DL_SHARED_SPI
481#if LIS302DL_SHARED_SPI
489 if(devp->config->accsensitivity == NULL)
494 devp->accsensitivity[i] = devp->config->accsensitivity[i];
498 if(devp->config->accsensitivity == NULL)
503 devp->accsensitivity[i] = devp->config->accsensitivity[i];
510 if(devp->config->accbias != NULL)
512 devp->accbias[i] = devp->config->accbias[i];
536 "lis302dlStop(), invalid state");
540#if LIS302DL_SHARED_SPI
543 (devp)->config->spicfg);
549#if LIS302DL_SHARED_SPI
static size_t acc_get_axes_number(void *ip)
Return the number of axes of the BaseAccelerometer.
static msg_t acc_reset_sensivity(void *ip)
Reset sensitivity values for the BaseAccelerometer.
static msg_t acc_set_bias(void *ip, float *bp)
Set bias values for the BaseAccelerometer.
static msg_t acc_reset_bias(void *ip)
Reset bias values for the BaseAccelerometer.
static msg_t acc_set_sensivity(void *ip, float *sp)
Set sensitivity values for the BaseAccelerometer.
static msg_t acc_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseAccelerometer.
static msg_t acc_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseAccelerometer.
static const struct BaseAccelerometerVMT vmt_accelerometer
static const struct ADXL317VMT vmt_device
static msg_t acc_set_full_scale(ADXL355Driver *devp, adxl355_acc_fs_t fs)
Changes the ADXL355Driver accelerometer fullscale value.
#define objGetInstance(type, ip)
Returns the instance pointer starting from an interface pointer.
#define LIS302DL_AD_CTRL_REG1
#define LIS302DL_CTRL_REG1_YEN
void lis302dlStart(LIS302DLDriver *devp, const LIS302DLConfig *config)
Configures and activates LIS302DL Complex Driver peripheral.
static size_t acc_get_axes_number(void *ip)
Return the number of axes of the BaseAccelerometer.
void lis302dlStop(LIS302DLDriver *devp)
Deactivates the LIS302DL Complex Driver peripheral.
#define LIS302DL_ACC_NUMBER_OF_AXES
LIS302DL accelerometer subsystem characteristics.
#define LIS302DL_AD_OUT_X
static msg_t acc_reset_sensivity(void *ip)
Reset sensitivity values for the BaseAccelerometer.
static msg_t acc_set_bias(void *ip, float *bp)
Set bias values for the BaseAccelerometer.
#define LIS302DL_ACC_SENS_8G
lis302dl_acc_fs_t
LIS302DL full scale.
static msg_t acc_set_full_scale(LIS302DLDriver *devp, lis302dl_acc_fs_t fs)
Changes the LIS302DLDriver accelerometer fullscale value.
#define LIS302DL_CTRL_REG1_XEN
#define LIS302DL_ACC_BIAS
void lis302dlObjectInit(LIS302DLDriver *devp)
Initializes an instance.
static msg_t acc_reset_bias(void *ip)
Reset bias values for the BaseAccelerometer.
#define LIS302DL_CTRL_REG1_ZEN
static msg_t acc_set_sensivity(void *ip, float *sp)
Set sensitivity values for the BaseAccelerometer.
#define LIS302DL_ACC_SENS_2G
static msg_t acc_read_cooked(void *ip, float axes[])
Retrieves cooked data from the BaseAccelerometer.
#define LIS302DL_CTRL_REG1_PD
static msg_t acc_read_raw(void *ip, int32_t axes[])
Retrieves raw data from the BaseAccelerometer.
static void lis302dlSPIWriteRegister(SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b)
Writes a value into a generic register using SPI.
static void lis302dlSPIReadRegister(SPIDriver *spip, uint8_t reg, size_t n, uint8_t *b)
Reads a generic register value using SPI.
#define LIS302DL_CTRL_REG1_FS_MASK
#define osalDbgAssert(c, remark)
Condition assertion.
#define osalDbgCheck(c)
Function parameters check.
#define osalThreadSleepMilliseconds(msecs)
Delays the invoking thread for the specified number of milliseconds.
void spiSelect(SPIDriver *spip)
Asserts the slave select signal and prepares for transfers.
void spiReleaseBus(SPIDriver *spip)
Releases exclusive access to the SPI bus.
void spiSend(SPIDriver *spip, size_t n, const void *txbuf)
Sends data over the SPI bus.
void spiAcquireBus(SPIDriver *spip)
Gains exclusive access to the SPI bus.
msg_t spiStart(SPIDriver *spip, const SPIConfig *config)
Configures and activates the SPI peripheral.
struct hal_spi_driver SPIDriver
Type of a structure representing an SPI driver.
void spiStop(SPIDriver *spip)
Deactivates the SPI peripheral.
void spiReceive(SPIDriver *spip, size_t n, void *rxbuf)
Receives data from the SPI bus.
void spiUnselect(SPIDriver *spip)
Deasserts the slave select signal.
#define FALSE
Generic 'false' preprocessor boolean constant.
#define MSG_OK
Normal wakeup message.
#define MSG_RESET
Wakeup caused by a reset condition.
LIS302DL MEMS interface module header.
Base accelerometer class.
const struct BaseAccelerometerVMT * vmt
Virtual Methods Table.
BaseAccelerometer virtual methods table.
LIS302DL configuration structure.
SPIDriver * spip
SPI driver associated to this LIS302DL.
LIS302DL 3-axis accelerometer class.
BaseAccelerometer acc_if
Base accelerometer interface.
const struct LIS302DLVMT * vmt
Virtual Methods Table.
LIS302DL accelerometer virtual methods table.
const SPIConfig * config
Current configuration data.