compass5 2.0.0.0
Compass 5 Click Driver

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

Topics

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

Functions

void compass5_cfg_setup (compass5_cfg_t *cfg)
 Compass 5 configuration object setup function.
 
err_t compass5_init (compass5_t *ctx, compass5_cfg_t *cfg)
 Compass 5 initialization function.
 
err_t compass5_generic_write (compass5_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Compass 5 I2C writing function.
 
err_t compass5_generic_read (compass5_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Compass 5 I2C reading function.
 
void compass5_write_byte (compass5_t *ctx, uint8_t reg, uint8_t tx_data)
 Compass 5 write byte function.
 
uint8_t compass5_read_byte (compass5_t *ctx, uint8_t reg)
 Compass 5 read 1 byte function.
 
void compass5_sw_reset (compass5_t *ctx)
 Compass 5 software reset function.
 
void compass5_get_id (compass5_t *ctx, uint8_t *company_id, uint8_t *device_id)
 Compass 5 get ID function.
 
uint8_t compass5_check_data_ready (compass5_t *ctx)
 Compass 5 check data ready function.
 
uint8_t compass5_check_data_overrun (compass5_t *ctx)
 Compass 5 check data overrun function.
 
uint8_t compass5_set_operation_mode (compass5_t *ctx, uint8_t op_mode)
 Compass 5 set operation mode function.
 
uint8_t compass5_get_operation_mode (compass5_t *ctx)
 Compass 5 get operation mode function.
 
void compass5_measurement_axis (compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 5 full measurement axis function.
 
void compass5_get_mag_data (compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 5 full measurement axis function.
 

Detailed Description

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

◆ compass5_cfg_setup()

void compass5_cfg_setup ( compass5_cfg_t * cfg)

Compass 5 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ compass5_check_data_overrun()

uint8_t compass5_check_data_overrun ( compass5_t * ctx)

Compass 5 check data overrun function.

This function for check data overrun.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
Returns
dor data.
Note
None.

◆ compass5_check_data_ready()

uint8_t compass5_check_data_ready ( compass5_t * ctx)

Compass 5 check data ready function.

This function for check data ready.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
Returns
Error data.
Note
None.

◆ compass5_generic_read()

err_t compass5_generic_read ( compass5_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

Compass 5 I2C reading function.

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

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

◆ compass5_generic_write()

err_t compass5_generic_write ( compass5_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

Compass 5 I2C writing function.

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

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

◆ compass5_get_id()

void compass5_get_id ( compass5_t * ctx,
uint8_t * company_id,
uint8_t * device_id )

Compass 5 get ID function.

This function for get ID.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
[out]company_id: Company ID - WIA1.
[out]device_id: Device ID - WIA2.
Returns
Nothing.
Note
None.

◆ compass5_get_mag_data()

void compass5_get_mag_data ( compass5_t * ctx,
int16_t * axis_x,
int16_t * axis_y,
int16_t * axis_z )

Compass 5 full measurement axis function.

This function for full measurement axis.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
[out]axis_x: x-axis.
[out]axis_y: y-axis.
[out]axis_z: z-axis.
Returns
Nothing.
Note
None.

◆ compass5_get_operation_mode()

uint8_t compass5_get_operation_mode ( compass5_t * ctx)

Compass 5 get operation mode function.

This function for get operation mode.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
Returns
Operation mode.
Note
None.

◆ compass5_init()

err_t compass5_init ( compass5_t * ctx,
compass5_cfg_t * cfg )

Compass 5 initialization function.

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

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

◆ compass5_measurement_axis()

void compass5_measurement_axis ( compass5_t * ctx,
int16_t * axis_x,
int16_t * axis_y,
int16_t * axis_z )

Compass 5 full measurement axis function.

This function for full measurement axis.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
[out]axis_x: x-axis.
[out]axis_y: y-axis.
[out]axis_z: z-axis.
Returns
Nothing.
Note
None.

◆ compass5_read_byte()

uint8_t compass5_read_byte ( compass5_t * ctx,
uint8_t reg )

Compass 5 read 1 byte function.

This function read 1 byte.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
[out]reg: 8-bit register address.
Returns
Returns the read data.
Note
None.

◆ compass5_set_operation_mode()

uint8_t compass5_set_operation_mode ( compass5_t * ctx,
uint8_t op_mode )

Compass 5 set operation mode function.

This function for set operation mode.

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

◆ compass5_sw_reset()

void compass5_sw_reset ( compass5_t * ctx)

Compass 5 software reset function.

This function for software reset.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
Returns
Nothing.
Note
None.

◆ compass5_write_byte()

void compass5_write_byte ( compass5_t * ctx,
uint8_t reg,
uint8_t tx_data )

Compass 5 write byte function.

This function write byte.

Parameters
[out]ctx: Click configuration structure. See compass5_t object definition for detailed explanation.
[in]reg: 8-bit register address.
[in]tx_data: 8-bit write data.
Returns
Nothing.
Note
None.