compass8  2.1.0.0
Modules | Functions
Compass 8 Click Driver

API for configuring and manipulating Compass 8 Click driver. More...

Modules

 Compass 8 Registers List
 List of registers of Compass 8 Click driver.
 
 Compass 8 Registers Settings
 Settings for registers of Compass 8 Click driver.
 
 Compass 8 MikroBUS Map
 MikroBUS pin mapping of Compass 8 Click driver.
 

Functions

void compass8_cfg_setup (compass8_cfg_t *cfg)
 Compass 8 configuration object setup function. More...
 
err_t compass8_init (compass8_t *ctx, compass8_cfg_t *cfg)
 Compass 8 initialization function. More...
 
err_t compass8_default_cfg (compass8_t *ctx)
 Compass 8 default configuration function. More...
 
void compass8_device_enable (compass8_t *ctx)
 Compass 8 device enable function. More...
 
void compass8_device_disable (compass8_t *ctx)
 Compass 8 device disable function. More...
 
err_t compass8_generic_write (compass8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Compass 8 I2C writing function. More...
 
err_t compass8_generic_read (compass8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Compass 8 I2C reading function. More...
 
err_t compass8_get_company_id (compass8_t *ctx, uint8_t *company_id)
 Compass 8 get company ID function. More...
 
err_t compass8_get_device_id (compass8_t *ctx, uint8_t *device_id)
 Compass 8 get device ID function. More...
 
err_t compass8_wait_data_ready (compass8_t *ctx)
 Compass 8 wait data ready function. More...
 
err_t compass8_get_raw_data (compass8_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 8 get mag raw data function. More...
 
err_t compass8_get_magnetic_data (compass8_t *ctx, compass8_axes_t *axis)
 Compass 8 get magnetic data function. More...
 
err_t compass8_set_operation_mode (compass8_t *ctx, uint8_t op_mode)
 Compass 8 set operation mode function. More...
 
err_t compass8_get_operation_mode (compass8_t *ctx, uint8_t *op_mode)
 Compass 8 get operation mode function. More...
 
err_t compass8_set_control (compass8_t *ctx, uint8_t ctrl_reg, uint8_t data_in)
 Compass 8 set control function. More...
 
err_t compass8_sw_reset (compass8_t *ctx)
 Compass 8 soft reset function. More...
 

Detailed Description

API for configuring and manipulating Compass 8 Click driver.

Function Documentation

◆ compass8_cfg_setup()

void compass8_cfg_setup ( compass8_cfg_t cfg)

Compass 8 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ compass8_default_cfg()

err_t compass8_default_cfg ( compass8_t ctx)

Compass 8 default configuration function.

This function executes a default configuration of Compass 8 click board.

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

◆ compass8_device_disable()

void compass8_device_disable ( compass8_t ctx)

Compass 8 device disable function.

This function disable the device.

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

◆ compass8_device_enable()

void compass8_device_enable ( compass8_t ctx)

Compass 8 device enable function.

This function enabled the device.

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

◆ compass8_generic_read()

err_t compass8_generic_read ( compass8_t ctx,
uint8_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

Compass 8 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using the I2C serial interface.

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

◆ compass8_generic_write()

err_t compass8_generic_write ( compass8_t ctx,
uint8_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

Compass 8 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using the I2C serial interface.

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

◆ compass8_get_company_id()

err_t compass8_get_company_id ( compass8_t ctx,
uint8_t *  company_id 
)

Compass 8 get company ID function.

This function reads company ID register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See compass8_t object definition for detailed explanation.
[out]company_id: Company ID [0x48].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ compass8_get_device_id()

err_t compass8_get_device_id ( compass8_t ctx,
uint8_t *  device_id 
)

Compass 8 get device ID function.

This function reads device ID register by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See compass8_t object definition for detailed explanation.
[out]device_id: Device ID [0x0E].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ compass8_get_magnetic_data()

err_t compass8_get_magnetic_data ( compass8_t ctx,
compass8_axes_t axis 
)

Compass 8 get magnetic data function.

This function reads the raw magnetic sensor measurement data and calculates magnetic flux density [microTesla] using the I2C serial interface.

Parameters
[in]ctx: Click context object. See compass8_t object definition for detailed explanation.
[out]axis: Magnetic flux density [microTesla]. See compass8_axes_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ compass8_get_operation_mode()

err_t compass8_get_operation_mode ( compass8_t ctx,
uint8_t *  op_mode 
)

Compass 8 get operation mode function.

This function reads the current operation mode by using the I2C serial interface.

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

◆ compass8_get_raw_data()

err_t compass8_get_raw_data ( compass8_t ctx,
int16_t *  axis_x,
int16_t *  axis_y,
int16_t *  axis_z 
)

Compass 8 get mag raw data function.

This function reads the magnetic measurement raw data by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See compass8_t object definition for detailed explanation.
[out]axis_x: Measurement data of magnetic sensor X-axis.
[out]axis_y: Measurement data of magnetic sensor Y-axis.
[out]axis_z: Measurement data of magnetic sensor Z-axis.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ compass8_init()

err_t compass8_init ( compass8_t ctx,
compass8_cfg_t cfg 
)

Compass 8 initialization function.

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

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

◆ compass8_set_control()

err_t compass8_set_control ( compass8_t ctx,
uint8_t  ctrl_reg,
uint8_t  data_in 
)

Compass 8 set control function.

This function sets the data of the desired control register data by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See compass8_t object definition for detailed explanation.
[in]ctrl_reg: Control register selector.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ compass8_set_operation_mode()

err_t compass8_set_operation_mode ( compass8_t ctx,
uint8_t  op_mode 
)

Compass 8 set operation mode function.

This function sets the desired sensor operation mode by using the I2C serial interface.

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

◆ compass8_sw_reset()

err_t compass8_sw_reset ( compass8_t ctx)

Compass 8 soft reset function.

This function performs software reset by using the I2C serial interface.

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

◆ compass8_wait_data_ready()

err_t compass8_wait_data_ready ( compass8_t ctx)

Compass 8 wait data ready function.

This function waits until data is ready by using the I2C serial interface.

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