gyro6 2.0.0.0
Gyro 6 Click Driver

API for configuring and manipulating Gyro 6 Click driver. More...

Topics

 Gyro 6 Registers List
 List of registers of Gyro 6 Click driver.
 
 Gyro 6 Registers Settings
 Settings for registers of Gyro 6 Click driver.
 
 Gyro 6 MikroBUS Map
 MikroBUS pin mapping of Gyro 6 Click driver.
 

Functions

void gyro6_cfg_setup (gyro6_cfg_t *cfg)
 Gyro 6 configuration object setup function.
 
void gyro6_drv_interface_selection (gyro6_cfg_t *cfg, gyro6_drv_t drv_sel)
 Gyro 6 driver interface setup function.
 
err_t gyro6_init (gyro6_t *ctx, gyro6_cfg_t *cfg)
 Gyro 6 initialization function.
 
err_t gyro6_default_cfg (gyro6_t *ctx)
 Gyro 6 default configuration function.
 
err_t gyro6_generic_write (gyro6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Gyro 6 data writing function.
 
err_t gyro6_generic_read (gyro6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Gyro 6 data reading function.
 
err_t gyro6_write_register (gyro6_t *ctx, uint8_t reg, uint8_t data_in)
 Gyro 6 write register function.
 
err_t gyro6_read_register (gyro6_t *ctx, uint8_t reg, uint8_t *data_out)
 Gyro 6 read register function.
 
uint8_t gyro6_get_int_pin (gyro6_t *ctx)
 Gyro 6 get INT pin function.
 
void gyro6_set_pwm_pin (gyro6_t *ctx, uint8_t state)
 Gyro 6 set PWM pin function.
 
err_t gyro6_check_communication (gyro6_t *ctx)
 Gyro 6 check communication function.
 
err_t gyro6_read_die_temperature (gyro6_t *ctx, float *temperature)
 Gyro 6 read DIE temperature function.
 
err_t gyro6_get_axis (gyro6_t *ctx, float *x_axis, float *y_axis, float *z_axis)
 Gyro 6 get axis function.
 
err_t gyro6_set_low_power_mode (gyro6_t *ctx, uint8_t sample_rate, uint8_t average)
 Gyro 6 set low power mode function.
 

Detailed Description

API for configuring and manipulating Gyro 6 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

◆ gyro6_cfg_setup()

void gyro6_cfg_setup ( gyro6_cfg_t * cfg)

Gyro 6 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ gyro6_check_communication()

err_t gyro6_check_communication ( gyro6_t * ctx)

Gyro 6 check communication function.

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

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

◆ gyro6_default_cfg()

err_t gyro6_default_cfg ( gyro6_t * ctx)

Gyro 6 default configuration function.

This function executes a default configuration of Gyro 6 click board.

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

◆ gyro6_drv_interface_selection()

void gyro6_drv_interface_selection ( gyro6_cfg_t * cfg,
gyro6_drv_t drv_sel )

Gyro 6 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 gyro6_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See gyro6_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.

◆ gyro6_generic_read()

err_t gyro6_generic_read ( gyro6_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Gyro 6 data reading function.

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

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

◆ gyro6_generic_write()

err_t gyro6_generic_write ( gyro6_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Gyro 6 data writing function.

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

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

◆ gyro6_get_axis()

err_t gyro6_get_axis ( gyro6_t * ctx,
float * x_axis,
float * y_axis,
float * z_axis )

Gyro 6 get axis function.

This function reads the gyroscope values for all three axis.

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

◆ gyro6_get_int_pin()

uint8_t gyro6_get_int_pin ( gyro6_t * ctx)

Gyro 6 get INT pin function.

This function returns the INT pin logic state.

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

◆ gyro6_init()

err_t gyro6_init ( gyro6_t * ctx,
gyro6_cfg_t * cfg )

Gyro 6 initialization function.

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

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

◆ gyro6_read_die_temperature()

err_t gyro6_read_die_temperature ( gyro6_t * ctx,
float * temperature )

Gyro 6 read DIE temperature function.

This function reads the chip internal temperature.

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

◆ gyro6_read_register()

err_t gyro6_read_register ( gyro6_t * ctx,
uint8_t reg,
uint8_t * data_out )

Gyro 6 read register function.

This function reads a data byte from the selected register.

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

◆ gyro6_set_low_power_mode()

err_t gyro6_set_low_power_mode ( gyro6_t * ctx,
uint8_t sample_rate,
uint8_t average )

Gyro 6 set low power mode function.

This function enables low power mode and sets the sample rate and average sample data.

Parameters
[in]ctx: Click context object. See gyro6_t object definition for detailed explanation.
[in]sample_rate: Sample Rate divider.
[in]average: Average sample data. See #gyro6_set group for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
SAMPLE_RATE = INTERNAL_SAMPLE_RATE / (1 + SMPLRT_DIV), where INTERNAL_SAMPLE_RATE = 1 kHz.

◆ gyro6_set_pwm_pin()

void gyro6_set_pwm_pin ( gyro6_t * ctx,
uint8_t state )

Gyro 6 set PWM pin function.

This function sets the PWM pin logic state.

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

◆ gyro6_write_register()

err_t gyro6_write_register ( gyro6_t * ctx,
uint8_t reg,
uint8_t data_in )

Gyro 6 write register function.

This function writes a data byte to the selected register.

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