accel19 2.0.0.0
accel19.h File Reference

This file contains API for Accel 19 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"
#include "drv_spi_master.h"
#include "spi_specifics.h"

Go to the source code of this file.

Data Structures

struct  accel19_s
 Accel 19 Click context object. More...
 
struct  accel19_cfg_t
 Accel 19 Click configuration object. More...
 
struct  accel19_axis_t
 Accel 19 axis data structure. More...
 

Macros

#define ACCEL19_REG_OUT_T_L   0x0D
 Accel 19 description register.
 
#define ACCEL19_REG_OUT_T_H   0x0E
 
#define ACCEL19_REG_WHO_AM_I   0x0F
 
#define ACCEL19_REG_CTRL1   0x20
 
#define ACCEL19_REG_CTRL2   0x21
 
#define ACCEL19_REG_CTRL3   0x22
 
#define ACCEL19_REG_CTRL4_INT1_PAD_CTRL   0x23
 
#define ACCEL19_REG_CTRL5_INT2_PAD_CTRL   0x24
 
#define ACCEL19_REG_CTRL6   0x25
 
#define ACCEL19_REG_STATUS   0x27
 
#define ACCEL19_REG_OUT_X_L   0x28
 
#define ACCEL19_REG_OUT_X_H   0x29
 
#define ACCEL19_REG_OUT_Y_L   0x2A
 
#define ACCEL19_REG_OUT_Y_H   0x2B
 
#define ACCEL19_REG_OUT_Z_L   0x2C
 
#define ACCEL19_REG_OUT_Z_H   0x2D
 
#define ACCEL19_REG_FIFO_CTRL   0x2E
 
#define ACCEL19_REG_FIFO_SAMPLES   0x2F
 
#define ACCEL19_REG_TAP_THS_X   0x30
 
#define ACCEL19_REG_TAP_THS_Y   0x31
 
#define ACCEL19_REG_TAP_THS_Z   0x32
 
#define ACCEL19_REG_INT_DUR   0x33
 
#define ACCEL19_REG_WAKE_UP_THS   0x34
 
#define ACCEL19_REG_WAKE_UP_DUR   0x35
 
#define ACCEL19_REG_FREE_FALL   0x36
 
#define ACCEL19_REG_STATUS_DUP   0x37
 
#define ACCEL19_REG_WAKE_UP_SRC   0x38
 
#define ACCEL19_REG_TAP_SRC   0x39
 
#define ACCEL19_REG_SIXD_SRC   0x3A
 
#define ACCEL19_REG_ALL_INT_SRC   0x3B
 
#define ACCEL19_REG_X_OFS_USR   0x3C
 
#define ACCEL19_REG_Y_OFS_USR   0x3D
 
#define ACCEL19_REG_Z_OFS_USR   0x3E
 
#define ACCEL19_REG_CTRL7   0x3F
 
#define ACCEL19_DEVICE_ID   0x44
 Accel 19 description setting.
 
#define ACCEL19_CTRL1_ODR_BIT_MASK   0xF0
 Accel 19 Power mode and data rate configuration setting.
 
#define ACCEL19_CTRL1_ODR_POWER_DOWN   0x00
 
#define ACCEL19_CTRL1_ODR_LP_1_6_Hz   0x10
 
#define ACCEL19_CTRL1_ODR_HP_12_5_Hz   0x10
 
#define ACCEL19_CTRL1_ODR_HP_LP_12_5_Hz   0x20
 
#define ACCEL19_CTRL1_ODR_HP_LP_25_Hz   0x30
 
#define ACCEL19_CTRL1_ODR_HP_LP_50_Hz   0x40
 
#define ACCEL19_CTRL1_ODR_HP_LP_100_Hz   0x50
 
#define ACCEL19_CTRL1_ODR_HP_LP_200_Hz   0x60
 
#define ACCEL19_CTRL1_ODR_LP_200_Hz   0x70
 
#define ACCEL19_CTRL1_ODR_HP_400_Hz   0x70
 
#define ACCEL19_CTRL1_ODR_HP_800_Hz   0x80
 
#define ACCEL19_CTRL1_ODR_HP_1600_Hz   0x90
 
#define ACCEL19_CTRL1_OP_MODE_BIT_MASK   0x0C
 Accel 19 Mode selection setting.
 
#define ACCEL19_CTRL1_OP_MODE_LOW_POWER_MODE   0x00
 
#define ACCEL19_CTRL1_OP_MODE_HIGH_POWER_MODE   0x04
 
#define ACCEL19_CTRL1_OP_MODE_SINGLE_DATA_CONV   0x08
 
#define ACCEL19_CTRL1_LP_MODE_BIT_MASK   0x03
 Accel 19 Low-power mode setting.
 
#define ACCEL19_CTRL1_LP_MODE1_RES_12_bit   0x00
 
#define ACCEL19_CTRL1_LP_MODE2_RES_14_bit   0x01
 
#define ACCEL19_CTRL1_LP_MODE3_RES_14_bit   0x02
 
#define ACCEL19_CTRL1_LP_MODE4_RES_14_bit   0x03
 
#define ACCEL19_CTRL2_SOFT_RESET   0x40
 Accel 19 Soft reset data.
 
#define ACCEL19_INT_DRDY   0x00
 Accel 19 data ready.
 
#define ACCEL19_STATUS_DRDY   0x01
 
#define ACCEL19_CTRL6_BW_FILT_BIT_MASK   0xC0
 Accel 19 Bandwidth selection setting.
 
#define ACCEL19_CTRL6_BW_FILT_ODR_2   0x00
 
#define ACCEL19_CTRL6_BW_FILT_ODR_4   0x40
 
#define ACCEL19_CTRL6_BW_FILT_ODR_10   0x80
 
#define ACCEL19_CTRL6_BW_FILT_ODR_20   0xC0
 
#define ACCEL19_CTRL6_FS_BIT_MASK   0x30
 Accel 19 FS selection setting.
 
#define ACCEL19_CTRL6_FS_2g   0x00
 
#define ACCEL19_CTRL6_FS_4g   0x10
 
#define ACCEL19_CTRL6_FS_8g   0x20
 
#define ACCEL19_CTRL6_FS_16g   0x30
 
#define ACCEL19_SET_DEV_ADDR_0   0x18
 Accel 19 device address setting.
 
#define ACCEL19_SET_DEV_ADDR_1   0x19
 
#define ACCEL19_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ACCEL19_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ACCEL19_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Typedefs

typedef err_t(* accel19_master_io_t) (struct accel19_s *, uint8_t, uint8_t *, uint8_t)
 Accel 19 Click driver interface.
 
typedef struct accel19_s accel19_t
 Accel 19 Click context object.
 

Enumerations

enum  accel19_drv_t { ACCEL19_DRV_SEL_SPI , ACCEL19_DRV_SEL_I2C }
 Accel 19 Click driver selector. More...
 
enum  accel19_return_value_t { ACCEL19_OK = 0 , ACCEL19_ERROR = -1 }
 Accel 19 Click return value data. More...
 

Functions

void accel19_cfg_setup (accel19_cfg_t *cfg)
 Accel 19 configuration object setup function.
 
void accel19_drv_interface_selection (accel19_cfg_t *cfg, accel19_drv_t drv_sel)
 Accel 19 driver interface setup function.
 
err_t accel19_init (accel19_t *ctx, accel19_cfg_t *cfg)
 Accel 19 initialization function.
 
err_t accel19_default_cfg (accel19_t *ctx)
 Accel 19 default configuration function.
 
err_t accel19_generic_write (accel19_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Accel 19 data writing function.
 
err_t accel19_generic_read (accel19_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Accel 19 data reading function.
 
err_t accel19_get_temperature (accel19_t *ctx, float *temperature)
 Accel 19 get temperature function.
 
err_t accel19_check_device_id (accel19_t *ctx)
 Accel 19 check device ID function.
 
err_t accel19_set_control (accel19_t *ctx, uint8_t odr, uint8_t op_mode, uint8_t lp_mode)
 Accel 19 set control function.
 
err_t accel19_soft_reset (accel19_t *ctx)
 Accel 19 soft reset function.
 
err_t accel19_get_status (accel19_t *ctx, uint8_t *status)
 Accel 19 get status function.
 
uint8_t accel19_data_ready (accel19_t *ctx)
 Accel 19 data ready function.
 
err_t accel19_set_full_scale (accel19_t *ctx, uint8_t full_scale)
 Accel 19 set full scale function.
 
err_t accel19_set_bw_filt_odr (accel19_t *ctx, uint8_t bw_filt_odr)
 Accel 19 set digital filtering cutoff function.
 
err_t accel19_get_axis_data (accel19_t *ctx, accel19_axis_t *axis)
 Accel 19 get accelerometer axis function.
 
uint8_t accel19_get_int_1 (accel19_t *ctx)
 Accel 19 get Interrupt 1 function.
 
uint8_t accel19_get_int_2 (accel19_t *ctx)
 Accel 19 get Interrupt 2 function.
 

Detailed Description

This file contains API for Accel 19 Click Driver.

Typedef Documentation

◆ accel19_master_io_t

typedef err_t(* accel19_master_io_t) (struct accel19_s *, uint8_t, uint8_t *, uint8_t)

Accel 19 Click driver interface.

Definition of driver interface of Accel 19 Click driver. Driver serial interface.

◆ accel19_t

typedef struct accel19_s accel19_t

Accel 19 Click context object.

Context object definition of Accel 19 Click driver.

Enumeration Type Documentation

◆ accel19_drv_t

Accel 19 Click driver selector.

Selects target driver interface of Accel 19 Click driver.

Enumerator
ACCEL19_DRV_SEL_SPI 

SPI driver descriptor.

ACCEL19_DRV_SEL_I2C 

I2C driver descriptor.

◆ accel19_return_value_t

Accel 19 Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCEL19_OK 
ACCEL19_ERROR