smartdof5  2.1.0.0
Modules | Functions
Smart DOF 5 Click Driver

API for configuring and manipulating Smart DOF 5 Click driver. More...

Modules

 Smart DOF 5 Registers List
 List of registers of Smart DOF 5 Click driver.
 
 Smart DOF 5 Registers Settings
 Settings for registers of Smart DOF 5 Click driver.
 
 Smart DOF 5 MikroBUS Map
 MikroBUS pin mapping of Smart DOF 5 Click driver.
 

Functions

void smartdof5_cfg_setup (smartdof5_cfg_t *cfg)
 Smart DOF 5 configuration object setup function. More...
 
void smartdof5_drv_interface_sel (smartdof5_cfg_t *cfg, smartdof5_drv_t drv_sel)
 Smart DOF 5 driver interface setup function. More...
 
err_t smartdof5_init (smartdof5_t *ctx, smartdof5_cfg_t *cfg)
 Smart DOF 5 initialization function. More...
 
err_t smartdof5_default_cfg (smartdof5_t *ctx)
 Smart DOF 5 default configuration function. More...
 
err_t smartdof5_write_reg (smartdof5_t *ctx, uint8_t reg, uint8_t data_in)
 Smart DOF 5 write reg function. More...
 
err_t smartdof5_write_regs (smartdof5_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Smart DOF 5 write regs function. More...
 
err_t smartdof5_read_reg (smartdof5_t *ctx, uint8_t reg, uint8_t *data_out)
 Smart DOF 5 read reg function. More...
 
err_t smartdof5_read_regs (smartdof5_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Smart DOF 5 read regs function. More...
 
uint8_t smartdof5_get_int_pin (smartdof5_t *ctx)
 Smart DOF 5 get int pin function. More...
 
err_t smartdof5_check_communication (smartdof5_t *ctx)
 Smart DOF 5 check communication function. More...
 
err_t smartdof5_set_mem_bank (smartdof5_t *ctx, uint8_t mem_bank)
 Smart DOF 5 set mem bank function. More...
 
err_t smartdof5_sw_reset (smartdof5_t *ctx)
 Smart DOF 5 sw reset function. More...
 
err_t smartdof5_set_accel_odr (smartdof5_t *ctx, uint8_t odr)
 Smart DOF 5 set accel odr function. More...
 
err_t smartdof5_set_gyro_odr (smartdof5_t *ctx, uint8_t odr)
 Smart DOF 5 set gyro odr function. More...
 
err_t smartdof5_set_accel_fsr (smartdof5_t *ctx, uint8_t fsr)
 Smart DOF 5 set accel fsr function. More...
 
err_t smartdof5_set_gyro_fsr (smartdof5_t *ctx, uint8_t fsr)
 Smart DOF 5 set gyro fsr function. More...
 
err_t smartdof5_get_accel_drdy (smartdof5_t *ctx, uint8_t *drdy)
 Smart DOF 5 get accel drdy function. More...
 
err_t smartdof5_get_gyro_drdy (smartdof5_t *ctx, uint8_t *drdy)
 Smart DOF 5 get gyro drdy function. More...
 
err_t smartdof5_get_temp_drdy (smartdof5_t *ctx, uint8_t *drdy)
 Smart DOF 5 get temp drdy function. More...
 
err_t smartdof5_get_accel (smartdof5_t *ctx, smartdof5_axes_t *accel)
 Smart DOF 5 get accel function. More...
 
err_t smartdof5_get_gyro (smartdof5_t *ctx, smartdof5_axes_t *gyro)
 Smart DOF 5 get gyro function. More...
 
err_t smartdof5_get_temp (smartdof5_t *ctx, float *temp)
 Smart DOF 5 get temp function. More...
 
err_t smartdof5_get_data (smartdof5_t *ctx, smartdof5_data_t *data_out)
 Smart DOF 5 get data function. More...
 

Detailed Description

API for configuring and manipulating Smart DOF 5 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

◆ smartdof5_cfg_setup()

void smartdof5_cfg_setup ( smartdof5_cfg_t cfg)

Smart DOF 5 configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ smartdof5_check_communication()

err_t smartdof5_check_communication ( smartdof5_t ctx)

Smart DOF 5 check communication function.

This function checks the communication by reading and verifying the device ID.

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

◆ smartdof5_default_cfg()

err_t smartdof5_default_cfg ( smartdof5_t ctx)

Smart DOF 5 default configuration function.

This function executes a default configuration of Smart DOF 5 Click board.

Parameters
[in]ctx: Click context object. See smartdof5_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.

◆ smartdof5_drv_interface_sel()

void smartdof5_drv_interface_sel ( smartdof5_cfg_t cfg,
smartdof5_drv_t  drv_sel 
)

Smart DOF 5 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 smartdof5_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See smartdof5_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called 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.

◆ smartdof5_get_accel()

err_t smartdof5_get_accel ( smartdof5_t ctx,
smartdof5_axes_t accel 
)

Smart DOF 5 get accel function.

This function reads the accelerometer of X, Y, and Z axis relative to standard gravity (g).

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]accel: Output accelerometer data. See smartdof5_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_get_accel_drdy()

err_t smartdof5_get_accel_drdy ( smartdof5_t ctx,
uint8_t *  drdy 
)

Smart DOF 5 get accel drdy function.

This function gets the accel new data available flag.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]drdy:
  • 0 - no new data available,
  • 1 - new data available.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_get_data()

err_t smartdof5_get_data ( smartdof5_t ctx,
smartdof5_data_t data_out 
)

Smart DOF 5 get data function.

This function reads the accelerometer, gyroscope, and temperature measurement data.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]data_out: Output data structure read. See smartdof5_data_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_get_gyro()

err_t smartdof5_get_gyro ( smartdof5_t ctx,
smartdof5_axes_t gyro 
)

Smart DOF 5 get gyro function.

This function reads the angular rate of X, Y, and Z axis in degrees per second (dps).

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]gyro: Output gyro data. See smartdof5_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_get_gyro_drdy()

err_t smartdof5_get_gyro_drdy ( smartdof5_t ctx,
uint8_t *  drdy 
)

Smart DOF 5 get gyro drdy function.

This function gets the gyro new data available flag.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]drdy:
  • 0 - no new data available,
  • 1 - new data available.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_get_int_pin()

uint8_t smartdof5_get_int_pin ( smartdof5_t ctx)

Smart DOF 5 get int pin function.

This function returns the interrupt 1 pin logic state.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
Returns
Pin logic state.
Note
None.

◆ smartdof5_get_temp()

err_t smartdof5_get_temp ( smartdof5_t ctx,
float *  temp 
)

Smart DOF 5 get temp function.

This function reads the temperature measurement in degrees Celsius.

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

◆ smartdof5_get_temp_drdy()

err_t smartdof5_get_temp_drdy ( smartdof5_t ctx,
uint8_t *  drdy 
)

Smart DOF 5 get temp drdy function.

This function gets the temperature new data available flag.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[out]drdy:
  • 0 - no new data available,
  • 1 - new data available.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_init()

err_t smartdof5_init ( smartdof5_t ctx,
smartdof5_cfg_t cfg 
)

Smart DOF 5 initialization function.

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

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

◆ smartdof5_read_reg()

err_t smartdof5_read_reg ( smartdof5_t ctx,
uint8_t  reg,
uint8_t *  data_out 
)

Smart DOF 5 read reg function.

This function reads a data byte from the selected register.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_read_regs()

err_t smartdof5_read_regs ( smartdof5_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Smart DOF 5 read regs function.

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

Parameters
[in]ctx: Click context object. See smartdof5_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.

◆ smartdof5_set_accel_fsr()

err_t smartdof5_set_accel_fsr ( smartdof5_t ctx,
uint8_t  fsr 
)

Smart DOF 5 set accel fsr function.

This function sets the accel measurement full scale range.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]fsr:
  • 0 - 2G,
  • 1 - 4G,
  • 2 - 8G,
  • 3 - 16G.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_set_accel_odr()

err_t smartdof5_set_accel_odr ( smartdof5_t ctx,
uint8_t  odr 
)

Smart DOF 5 set accel odr function.

This function sets the accel measurement output data rate.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]odr:
  • 0 - OFF,
  • 1 - 12.5Hz,
  • 2 - 26Hz,
  • 3 - 52Hz,
  • 4 - 104Hz,
  • 5 - 208Hz,
  • 6 - 416Hz,
  • 7 - 833Hz,
  • 8 - 1667Hz,
  • 9 - 3333Hz,
  • 10 - 6667Hz,
  • 11 - 1.6Hz.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_set_gyro_fsr()

err_t smartdof5_set_gyro_fsr ( smartdof5_t ctx,
uint8_t  fsr 
)

Smart DOF 5 set gyro fsr function.

This function sets the gyro measurement full scale range.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]fsr:
  • 0 - 250DPS,
  • 1 - 500DPS,
  • 2 - 1000DPS,
  • 3 - 2000DPS,
  • 4 - 4000DPS,
  • 5 - 125DPS.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_set_gyro_odr()

err_t smartdof5_set_gyro_odr ( smartdof5_t ctx,
uint8_t  odr 
)

Smart DOF 5 set gyro odr function.

This function sets the gyro measurement output data rate.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]odr:
  • 0 - OFF,
  • 1 - 12.5Hz,
  • 2 - 26Hz,
  • 3 - 52Hz,
  • 4 - 104Hz,
  • 5 - 208Hz,
  • 6 - 416Hz,
  • 7 - 833Hz,
  • 8 - 1667Hz,
  • 9 - 3333Hz,
  • 10 - 6667Hz.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_set_mem_bank()

err_t smartdof5_set_mem_bank ( smartdof5_t ctx,
uint8_t  mem_bank 
)

Smart DOF 5 set mem bank function.

This function sets the memory bank to user memory, sensor hub, or embedded functions configuration registers.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]mem_bank:
  • 0 - User memory,
  • 1 - Sensor hub,
  • 2 - Embedded functions.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_sw_reset()

err_t smartdof5_sw_reset ( smartdof5_t ctx)

Smart DOF 5 sw reset function.

This function restores the default values in user memory registers.

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

◆ smartdof5_write_reg()

err_t smartdof5_write_reg ( smartdof5_t ctx,
uint8_t  reg,
uint8_t  data_in 
)

Smart DOF 5 write reg function.

This function writes a data byte to the selected register.

Parameters
[in]ctx: Click context object. See smartdof5_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ smartdof5_write_regs()

err_t smartdof5_write_regs ( smartdof5_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Smart DOF 5 write regs function.

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

Parameters
[in]ctx: Click context object. See smartdof5_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.