accel6 2.0.0.0
Public function

Functions

void accel6_cfg_setup (accel6_cfg_t *cfg)
 Config Object Initialization function.
 
ACCEL6_RETVAL accel6_init (accel6_t *ctx, accel6_cfg_t *cfg)
 Initialization function.
 
void accel6_generic_write (accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void accel6_generic_read (accel6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void accel6_soft_reset (accel6_t *ctx)
 Functions for software reset.
 
void accel6_default_cfg (accel6_t *ctx, uint8_t range_data, uint8_t bw_data, uint8_t lpw_data)
 Click Default Configuration function.
 
void accel6_data_offset (accel6_t *ctx, uint8_t set_offset, float *offset_data)
 Functions for set offset.
 
uint8_t accel6_get_tap_status (accel6_t *ctx)
 Functions for detect tap on the x/y/z axis.
 
uint8_t accel6_get_slope_status (accel6_t *ctx)
 Functions for detect slope on the x/y/z axis.
 
void accel6_get_orient (accel6_t *ctx, uint8_t *z_orient, uint8_t *xy_orient)
 Functions for read orient.
 
float accel6_get_axis (accel6_t *ctx, uint8_t axis)
 Functions for read axis data.
 
float accel6_get_temperature (accel6_t *ctx)
 Functions for read temperature.
 

Detailed Description

Function Documentation

◆ accel6_cfg_setup()

void accel6_cfg_setup ( accel6_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ accel6_data_offset()

void accel6_data_offset ( accel6_t * ctx,
uint8_t set_offset,
float * offset_data )

Functions for set offset.

Parameters
ctxClick object.
set_offsetData which will be written in offset settings register
offset_dataBuffer in which the XYZ offset will be written.
  • offset_data[ 0 ] = x_offset
  • offset_data[ 1 ] = y_offset
  • offset_data[ 2 ] = z_offset

◆ accel6_default_cfg()

void accel6_default_cfg ( accel6_t * ctx,
uint8_t range_data,
uint8_t bw_data,
uint8_t lpw_data )

Click Default Configuration function.

Parameters
ctxClick object.
range_dataAccelerometer g-range
bw_dataAcceleration data filter bandwidth
lpw_dataPower mode and the low power sleep period.

@description This function executes default configuration for Accel 6 click.

Note
Default configuration of the chip contains the settings:
 
      Set ACCEL6_REG_PMU_RANGE reg:
        - range_data
      Set ACCEL6_REG_PMU_BW reg:
        - bw_data
      Set ACCEL6_REG_PMU_LPW reg:
        - lpw_data
      Set ACCEL6_REG_BGW_SPI3_WDT reg:
        - ACCEL6_I2C_ENABLE | ACCEL6_I2C_WTD_50ms
      Set ACCEL6_REG_INT_EN_1 reg:
        - ACCEL6_INT_EN_1_DATA_ENABLE
      Set ACCEL6_REG_INT_MAP_1 reg:
        - ACCEL6_INT1_MAP_DATA_ENABLE
      Set ACCEL6_REG_INT_EN_0 reg:
        - ACCEL6_INT1_MAP_ORIENT_ENABLE |
          ACCEL6_INT1_MAP_SINGLE_TAP_ENABLE | 
          ACCEL6_INT1_MAP_DOUBLE_TAP_ENABLE |
          ACCEL6_INT1_MAP_SLOPE_ENABLE;
      Set ACCEL6_REG_INT9 reg:
        - 0x0A
      Set ACCEL6_REG_INT_OUT_CTRL reg:
        - ACCEL6_INT2_CTRL_ACTIVE_HIGH_LEVEL | ACCEL6_INT1_CTRL_ACTIVE_HIGH_LEVEL

 -storage accel range
 -storage bandwidth data

◆ accel6_generic_read()

void accel6_generic_read ( accel6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function reads data from the desired register.

◆ accel6_generic_write()

void accel6_generic_write ( accel6_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function writes data to the desired register.

◆ accel6_get_axis()

float accel6_get_axis ( accel6_t * ctx,
uint8_t axis )

Functions for read axis data.

Parameters
ctxClick object.
axisAxis data which will be read
Return values
Axisdata in mg

@description This function reads data from the desired register.

◆ accel6_get_orient()

void accel6_get_orient ( accel6_t * ctx,
uint8_t * z_orient,
uint8_t * xy_orient )

Functions for read orient.

Parameters
ctxClick object.
z_orientBuffer in which the Z-axis chip orientation will be written.
xy_orientBuffer in which the XY-axis chip orientation will be written.
Note
   Z orientation :
       - UPWARD LOOKING
       - DOWNWARD LOOKING
    XY orientation :
       - UPRIGHT
       - UPSIDE DOWN
       - LANDSCAPE LEFT
       - LANDSCAPE RIGHT
*

◆ accel6_get_slope_status()

uint8_t accel6_get_slope_status ( accel6_t * ctx)

Functions for detect slope on the x/y/z axis.

Parameters
ctxClick object.
Return values
Informationof the slope
Note
  Tap detection :
     - X negative  (0x01)
     - Y negative  (0x02)
     - Z negative  (0x03)
     - X positive  (0x04)
     - Y positive  (0x05)
     - Z positive  (0x06) 
*

◆ accel6_get_tap_status()

uint8_t accel6_get_tap_status ( accel6_t * ctx)

Functions for detect tap on the x/y/z axis.

Parameters
ctxClick object.
Return values
Informationof the Tap
Note
  Tap detection :
     - X negative  (0x01)
     - Y negative  (0x02)
     - Z negative  (0x03)
     - X positive  (0x04)
     - Y positive  (0x05)
     - Z positive  (0x06) 
*

◆ accel6_get_temperature()

float accel6_get_temperature ( accel6_t * ctx)

Functions for read temperature.

Parameters
ctxClick object.
Return values
Temperaturedata in C
Note
Formula:
  Temperature = 0.5 * Temp_data + 23.0
  - Temp_data  data read from ACCEL6_REG_TEMPERATURE register
  The formula for calculating the temperature is from dataheet.

◆ accel6_init()

ACCEL6_RETVAL accel6_init ( accel6_t * ctx,
accel6_cfg_t * cfg )

Initialization function.

Parameters
accel6Click object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ accel6_soft_reset()

void accel6_soft_reset ( accel6_t * ctx)

Functions for software reset.

Parameters
ctxClick object.