inclinometer2 2.0.0.0
Inclinometer 2 Click Driver

API for configuring and manipulating Inclinometer 2 Click driver. More...

Topics

 Inclinometer 2 Registers List
 List of registers of Inclinometer 2 Click driver.
 
 Inclinometer 2 Registers Settings
 Settings for registers of Inclinometer 2 Click driver.
 
 Inclinometer 2 MikroBUS Map
 MikroBUS pin mapping of Inclinometer 2 Click driver.
 

Functions

void inclinometer2_cfg_setup (inclinometer2_cfg_t *cfg)
 Inclinometer 2 configuration object setup function.
 
void inclinometer2_drv_interface_selection (inclinometer2_cfg_t *cfg, inclinometer2_drv_t drv_sel)
 Inclinometer 2 driver interface setup function.
 
err_t inclinometer2_init (inclinometer2_t *ctx, inclinometer2_cfg_t *cfg)
 Inclinometer 2 initialization function.
 
err_t inclinometer2_default_cfg (inclinometer2_t *ctx)
 Inclinometer 2 default configuration function.
 
err_t inclinometer2_generic_write (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Inclinometer 2 data writing function.
 
err_t inclinometer2_generic_read (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Inclinometer 2 data reading function.
 
err_t inclinometer2_write_register (inclinometer2_t *ctx, uint8_t reg, uint8_t data_in)
 Inclinometer 2 write register function.
 
err_t inclinometer2_read_register (inclinometer2_t *ctx, uint8_t reg, uint8_t *data_out)
 Inclinometer 2 read register function.
 
err_t inclinometer2_check_communication (inclinometer2_t *ctx)
 Inclinometer 2 check communication function.
 
uint8_t inclinometer2_get_int_pin (inclinometer2_t *ctx)
 Inclinometer 2 get int pin function.
 
err_t inclinometer2_set_fsr_and_odr (inclinometer2_t *ctx, inclinometer2_fsr_t fsr, inclinometer2_odr_t odr)
 Inclinometer 2 set fsr and odr function.
 
err_t inclinometer2_get_accel (inclinometer2_t *ctx, float *x_axis, float *y_axis)
 Inclinometer 2 get accel function.
 
err_t inclinometer2_get_temperature (inclinometer2_t *ctx, float *temperature)
 Inclinometer 2 get temperature function.
 

Detailed Description

API for configuring and manipulating Inclinometer 2 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

◆ inclinometer2_cfg_setup()

void inclinometer2_cfg_setup ( inclinometer2_cfg_t * cfg)

Inclinometer 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ inclinometer2_check_communication()

err_t inclinometer2_check_communication ( inclinometer2_t * ctx)

Inclinometer 2 check communication function.

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

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

◆ inclinometer2_default_cfg()

err_t inclinometer2_default_cfg ( inclinometer2_t * ctx)

Inclinometer 2 default configuration function.

This function executes a default configuration of Inclinometer 2 click board.

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

◆ inclinometer2_drv_interface_selection()

void inclinometer2_drv_interface_selection ( inclinometer2_cfg_t * cfg,
inclinometer2_drv_t drv_sel )

Inclinometer 2 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 inclinometer2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See inclinometer2_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.

◆ inclinometer2_generic_read()

err_t inclinometer2_generic_read ( inclinometer2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Inclinometer 2 data reading function.

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

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

◆ inclinometer2_generic_write()

err_t inclinometer2_generic_write ( inclinometer2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Inclinometer 2 data writing function.

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

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

◆ inclinometer2_get_accel()

err_t inclinometer2_get_accel ( inclinometer2_t * ctx,
float * x_axis,
float * y_axis )

Inclinometer 2 get accel function.

This function checks if the accel data is ready and than reads the accel X and Y axis in mg.

Parameters
[in]ctx: Click context object. See inclinometer2_t object definition for detailed explanation.
[out]x_axis: Accel X-axis data in mg.
[out]y_axis: Accel Y-axis data in mg.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ inclinometer2_get_int_pin()

uint8_t inclinometer2_get_int_pin ( inclinometer2_t * ctx)

Inclinometer 2 get int pin function.

This function returns the INT pin logic state.

Parameters
[in]ctx: Click context object. See inclinometer2_t object definition for detailed explanation.
Returns
None.
Note
None.

◆ inclinometer2_get_temperature()

err_t inclinometer2_get_temperature ( inclinometer2_t * ctx,
float * temperature )

Inclinometer 2 get temperature function.

This function checks if the temperature data is ready and than reads the temperature in Celsius.

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

◆ inclinometer2_init()

err_t inclinometer2_init ( inclinometer2_t * ctx,
inclinometer2_cfg_t * cfg )

Inclinometer 2 initialization function.

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

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

◆ inclinometer2_read_register()

err_t inclinometer2_read_register ( inclinometer2_t * ctx,
uint8_t reg,
uint8_t * data_out )

Inclinometer 2 read register function.

This function reads data from the selected register.

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

◆ inclinometer2_set_fsr_and_odr()

err_t inclinometer2_set_fsr_and_odr ( inclinometer2_t * ctx,
inclinometer2_fsr_t fsr,
inclinometer2_odr_t odr )

Inclinometer 2 set fsr and odr function.

This function sets the accel full-scale range (FSR) and output data rate (ODR) bits in CTRL1_XL register.

Parameters
[in]ctx: Click context object. See inclinometer2_t object definition for detailed explanation.
[in]fsr: Accel full-scale range bits setting. See inclinometer2_fsr_t enum definition for detailed explanation.
[in]odr: Output data rate bits setting. See inclinometer2_odr_t enum definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ inclinometer2_write_register()

err_t inclinometer2_write_register ( inclinometer2_t * ctx,
uint8_t reg,
uint8_t data_in )

Inclinometer 2 write register function.

This function writes a data byte to the selected register.

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