accel16 2.0.0.0
accel16.h File Reference

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

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

Go to the source code of this file.

Data Structures

struct  accel16_t
 Accel 16 Click context object. More...
 
struct  accel16_cfg_t
 Accel 16 Click configuration object. More...
 
struct  accel16_axes_t
 Accel 16 Click axes data. More...
 

Macros

#define ACCEL16_CMD_WRITE_REG   0x0A
 Accel 16 control commands.
 
#define ACCEL16_CMD_READ_REG   0x0B
 
#define ACCEL16_CMD_READ_FIFO   0x0D
 
#define ACCEL16_REG_DEVID_AD   0x00
 Accel 16 description register.
 
#define ACCEL16_REG_DEVID_MST   0x01
 
#define ACCEL16_REG_DEVID   0x02
 
#define ACCEL16_REG_REVID   0x03
 
#define ACCEL16_REG_XDATA   0x08
 
#define ACCEL16_REG_YDATA   0x09
 
#define ACCEL16_REG_ZDATA   0x0A
 
#define ACCEL16_REG_STATUS   0x0B
 
#define ACCEL16_REG_FIFO_ENTRIES_L   0x0C
 
#define ACCEL16_REG_FIFO_ENTRIES_H   0x0D
 
#define ACCEL16_REG_XDATA_L   0x0E
 
#define ACCEL16_REG_XDATA_H   0x0F
 
#define ACCEL16_REG_YDATA_L   0x10
 
#define ACCEL16_REG_YDATA_H   0x11
 
#define ACCEL16_REG_ZDATA_L   0x12
 
#define ACCEL16_REG_ZDATA_H   0x13
 
#define ACCEL16_REG_TEMP_L   0x14
 
#define ACCEL16_REG_TEMP_H   0x15
 
#define ACCEL16_REG_ADC_DATA_L   0x16
 
#define ACCEL16_REG_ADC_DATA_H   0x17
 
#define ACCEL16_REG_SOFT_RESET   0x1F
 
#define ACCEL16_REG_THRESH_ACT_L   0x20
 
#define ACCEL16_REG_THRESH_ACT_H   0x21
 
#define ACCEL16_REG_TIME_ACT   0x22
 
#define ACCEL16_REG_THRESH_INACT_L   0x23
 
#define ACCEL16_REG_THRESH_INACT_H   0x24
 
#define ACCEL16_REG_TIME_INACT_L   0x25
 
#define ACCEL16_REG_TIME_INACT_H   0x26
 
#define ACCEL16_REG_ACT_INACT_CTL   0x27
 
#define ACCEL16_REG_FIFO_CONTROL   0x28
 
#define ACCEL16_REG_FIFO_SAMPLES   0x29
 
#define ACCEL16_REG_INTMAP1   0x2A
 
#define ACCEL16_REG_INTMAP2   0x2B
 
#define ACCEL16_REG_FILTER_CTL   0x2C
 
#define ACCEL16_REG_POWER_CTL   0x2D
 
#define ACCEL16_REG_SELF_CTL   0x2E
 
#define ACCEL16_APPLICATION_FIFO   0xAA
 Accel 16 description setting.
 
#define ACCEL16_APPLICATION_REG   0xBB
 
#define ACCEL16_ROOM_TEMPERATURE   25.0
 Accel 16 temperature calculation values.
 
#define ACCEL16_TEMPERATURE_BIAS   350
 
#define ACCEL16_TEMPERATURE_RES   0.065
 
#define ACCEL16_TEMPERATURE_CAL_SAMPLE_NUM   100
 
#define ACCEL16_SET_DATA_SAMPLE_EDGE   SET_SPI_DATA_SAMPLE_EDGE
 Data sample selection.
 
#define ACCEL16_SET_DATA_SAMPLE_MIDDLE   SET_SPI_DATA_SAMPLE_MIDDLE
 
#define ACCEL16_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  accel16_return_value_t { ACCEL16_OK = 0 , ACCEL16_ERROR = -1 }
 Accel 16 Click return value data. More...
 
enum  accel16_gain_t { ACCEL16_2G = 0 , ACCEL16_4G = 1 , ACCEL16_8G = 2 }
 Accel 16 Click gain. More...
 
enum  accel16_output_rate_t {
  ACCEL16_12p5HZ = 0 , ACCEL16_25HZ , ACCEL16_50HZ , ACCEL16_100HZ ,
  ACCEL16_200HZ , ACCEL16_400HZ
}
 Accel 16 Click output data rate. More...
 

Functions

void accel16_cfg_setup (accel16_cfg_t *cfg)
 Accel 16 configuration object setup function.
 
err_t accel16_init (accel16_t *ctx, accel16_cfg_t *cfg)
 Accel 16 initialization function.
 
err_t accel16_default_cfg (accel16_t *ctx)
 Accel 16 default configuration function.
 
err_t accel16_multiple_reg_write (accel16_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Write multiple registers.
 
err_t accel16_single_reg_write (accel16_t *ctx, uint8_t reg, uint8_t data_in)
 Write single register.
 
err_t accel16_multiple_reg_read (accel16_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Read multiple registers.
 
err_t accel16_single_reg_read (accel16_t *ctx, uint8_t reg, uint8_t *data_out)
 Read single registers.
 
err_t accel16_fifo_read (accel16_t *ctx, uint8_t *data_out, uint16_t len)
 Read fifo.
 
uint8_t accel16_get_interrupt_1 (accel16_t *ctx)
 Get interrupt 1 state.
 
uint8_t accel16_get_interrupt_2 (accel16_t *ctx)
 Get interrupt 2 state.
 
err_t accel16_filter_configuration (accel16_t *ctx, accel16_gain_t gain, accel16_output_rate_t odr)
 Filter configuration.
 
err_t accel16_get_axes (accel16_t *ctx, accel16_axes_t *axes)
 Get axes data.
 
err_t accel16_get_temperature (accel16_t *ctx, float *temperature)
 Get temperature data.
 
err_t accel16_get_adc (accel16_t *ctx, float *v_adc)
 Get adc data.
 
err_t accel16_calibrate_temperature (accel16_t *ctx, float room_temperature)
 Accel 16 calibrate temperature function.
 

Detailed Description

This file contains API for Accel 16 Click Driver.

Enumeration Type Documentation

◆ accel16_gain_t

Accel 16 Click gain.

Predefined enum values for driver gain.

Enumerator
ACCEL16_2G 
ACCEL16_4G 
ACCEL16_8G 

◆ accel16_output_rate_t

Accel 16 Click output data rate.

Predefined enum values for driver output data rate.

Enumerator
ACCEL16_12p5HZ 
ACCEL16_25HZ 
ACCEL16_50HZ 
ACCEL16_100HZ 
ACCEL16_200HZ 
ACCEL16_400HZ 

◆ accel16_return_value_t

Accel 16 Click return value data.

Predefined enum values for driver return values.

Enumerator
ACCEL16_OK 
ACCEL16_ERROR