airmotion 2.1.0.0
Air Motion Click Driver

API for configuring and manipulating Air Motion Click driver. More...

Topics

 Air Motion Registers List
 List of registers of Air Motion Click driver.
 
 Air Motion Registers Settings
 Settings for registers of Air Motion Click driver.
 
 Air Motion MikroBUS Map
 MikroBUS pin mapping of Air Motion Click driver.
 

Functions

void airmotion_cfg_setup (airmotion_cfg_t *cfg)
 Air Motion configuration object setup function.
 
void airmotion_drv_interface_selection (airmotion_cfg_t *cfg, airmotion_drv_t drv_sel)
 Air Motion driver interface setup function.
 
err_t airmotion_init (airmotion_t *ctx, airmotion_cfg_t *cfg)
 Air Motion initialization function.
 
err_t airmotion_default_cfg (airmotion_t *ctx)
 Air Motion default configuration function.
 
err_t airmotion_generic_write (airmotion_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Air Motion data writing function.
 
err_t airmotion_generic_read (airmotion_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Air Motion data reading function.
 
err_t airmotion_set_reg_bank (airmotion_t *ctx, uint8_t bank)
 Air Motion set register bank function.
 
err_t airmotion_reg_write (airmotion_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_in, uint8_t len)
 Air Motion register data writing function.
 
err_t airmotion_reg_read (airmotion_t *ctx, uint8_t reg_bank, uint8_t reg, uint8_t *data_out, uint8_t len)
 Air Motion data reading function.
 
err_t airmotion_configure_digital_interface (airmotion_t *ctx, uint8_t slew_rate)
 Air Motion configure digital interface function.
 
uint8_t airmotion_get_int1_state (airmotion_t *ctx)
 Air Motion read INT1 pin state function.
 
err_t airmotion_sw_reset (airmotion_t *ctx)
 Air Motion software reset function.
 
err_t airmotion_read_temperature (airmotion_t *ctx, float *temperature_data)
 Air Motion read temperature function.
 
err_t airmotion_read_timestamp (airmotion_t *ctx, uint32_t *tmst_data)
 Air Motion read timestamp function.
 
err_t airmotion_get_data_from_register (airmotion_t *ctx, float *temperature_data, airmotion_data_t *accel_data, airmotion_data_t *gyro_data, uint32_t *tmst_data)
 Air Motion read data function.
 
err_t airmotion_set_basic_tap_detection (airmotion_t *ctx)
 Air Motion basic tap detection configuration function.
 
err_t airmotion_get_tap_detection (airmotion_t *ctx, uint8_t *tap_num, uint8_t *tap_axis, uint8_t *tap_dir)
 Air Motion get tap detection data function.
 

Detailed Description

API for configuring and manipulating Air Motion Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ airmotion_cfg_setup()

void airmotion_cfg_setup ( airmotion_cfg_t * cfg)

Air Motion configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See airmotion_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ airmotion_configure_digital_interface()

err_t airmotion_configure_digital_interface ( airmotion_t * ctx,
uint8_t slew_rate )

Air Motion configure digital interface function.

This function sets a digital communication interface based on selected communication.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]slew_rate: Slew rate of selected interface.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_default_cfg()

err_t airmotion_default_cfg ( airmotion_t * ctx)

Air Motion default configuration function.

This function executes a default configuration of Air Motion click board.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ airmotion_drv_interface_selection()

void airmotion_drv_interface_selection ( airmotion_cfg_t * cfg,
airmotion_drv_t drv_sel )

Air Motion driver interface setup function.

This function sets a serial driver interface which will be used further in the click driver.

Parameters
[out]cfg: Click configuration structure. See airmotion_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See airmotion_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be call before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ airmotion_generic_read()

err_t airmotion_generic_read ( airmotion_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Air Motion data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_generic_write()

err_t airmotion_generic_write ( airmotion_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Air Motion data writing function.

This function writes a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_get_data_from_register()

err_t airmotion_get_data_from_register ( airmotion_t * ctx,
float * temperature_data,
airmotion_data_t * accel_data,
airmotion_data_t * gyro_data,
uint32_t * tmst_data )

Air Motion read data function.

This function is used to read accel, gyro, temperature, and timestamp data from the Air Motion click board. This data can be then processed and used in a specific way.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[out]temperature_data: Temperature data value.
[out]accel_data: Accel data value.
[out]gyro_data: Gyro data value.
[out]tmst_data: Timestamp value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_get_int1_state()

uint8_t airmotion_get_int1_state ( airmotion_t * ctx)

Air Motion read INT1 pin state function.

Air Motion read INT2 pin state function.

This function is used to get state of the INT1 (int_pin).

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
Returns
State of INT1 pin.
Note
None.

This function is used to get state of the INT2 (int_pin).

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
Returns
State of INT2 pin.
Note
None.

◆ airmotion_get_tap_detection()

err_t airmotion_get_tap_detection ( airmotion_t * ctx,
uint8_t * tap_num,
uint8_t * tap_axis,
uint8_t * tap_dir )

Air Motion get tap detection data function.

This function is used to read tap detection data from the Air Motion click board.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[out]tap_num: Numbers of taps.
[out]tap_axis: Axis of the tap direction.
[out]tap_dir: Direction of the tap in correspondence to the starting point.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_init()

err_t airmotion_init ( airmotion_t * ctx,
airmotion_cfg_t * cfg )

Air Motion initialization function.

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

Parameters
[out]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See airmotion_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_read_temperature()

err_t airmotion_read_temperature ( airmotion_t * ctx,
float * temperature_data )

Air Motion read temperature function.

This function is used to read temperature from the Air Motion click board.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[out]temperature_data: Temperature value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_read_timestamp()

err_t airmotion_read_timestamp ( airmotion_t * ctx,
uint32_t * tmst_data )

Air Motion read timestamp function.

This function is used to read data timestamp from the Air Motion click board.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[out]tmst_data: Timestamp value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_reg_read()

err_t airmotion_reg_read ( airmotion_t * ctx,
uint8_t reg_bank,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Air Motion data reading function.

This function reads a desired number of data bytes starting from the selected register.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]reg: Start register address.
[out]data_out: Output read data.
[in]len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_reg_write()

err_t airmotion_reg_write ( airmotion_t * ctx,
uint8_t reg_bank,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Air Motion register data writing function.

This function writes a desired number of data bytes starting from the selected register. Register addresses are self increasing according to the number of bytes of input data.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]bank: Specific register bank.
[in]reg: Start register address.
[in]data_in: Data to be written.
[in]len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_set_basic_tap_detection()

err_t airmotion_set_basic_tap_detection ( airmotion_t * ctx)

Air Motion basic tap detection configuration function.

This function is used to configure the Air Motion click board into tap detection configuration.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_set_reg_bank()

err_t airmotion_set_reg_bank ( airmotion_t * ctx,
uint8_t bank )

Air Motion set register bank function.

This function switches to the desired register bank in order to access specific registers on that bank.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
[in]bank: Specific register bank.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ airmotion_sw_reset()

err_t airmotion_sw_reset ( airmotion_t * ctx)

Air Motion software reset function.

This function is used to perform a software reset of the Air Motion click board.

Parameters
[in]ctx: Click context object. See airmotion_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
All registers will be set at their default value.