compass4 2.0.0.0
Public function

Functions

void compass4_cfg_setup (compass4_cfg_t *cfg)
 Config Object Initialization function.
 
COMPASS4_RETVAL compass4_init (compass4_t *ctx, compass4_cfg_t *cfg)
 Initialization function.
 
void compass4_generic_write (compass4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void compass4_generic_read (compass4_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void compass4_hardware_reset (compass4_t *ctx)
 Hardware reset function.
 
void compass4_set_rst_pin_state (compass4_t *ctx, uint8_t state)
 Sets RST pin state.
 
void compass4_software_reset (compass4_t *ctx)
 Software reset function.
 
void compass4_configuration (compass4_t *ctx, uint8_t cfg1, uint8_t cfg2)
 Configuration function.
 
uint8_t compass4_get_status (compass4_t *ctx, uint8_t status)
 Get status.
 
uint8_t compass4_check_device (compass4_t *ctx)
 Check device function.
 
uint8_t compass4_get_interrupt (compass4_t *ctx)
 Gets INT pin state (DRDY pin)
 
uint8_t compass4_get_axis (compass4_t *ctx, compass4_axis_t *axis)
 Gets X\Y\Z Axis value.
 
uint8_t compass4_get_single_axis (compass4_t *ctx, uint8_t axis_reg, int16_t *axis_data)
 Gets single axis value.
 
uint8_t compass4_get_magnetic_flux (compass4_t *ctx, compass4_flux_t *flux)
 Gets magnetic flux of X\Y\Z axis value.
 
uint8_t compass4_get_single_magnetic_flux (compass4_t *ctx, uint8_t axis, float *flux_data)
 Gets single axis flux value.
 

Detailed Description

Function Documentation

◆ compass4_cfg_setup()

void compass4_cfg_setup ( compass4_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ compass4_check_device()

uint8_t compass4_check_device ( compass4_t * ctx)

Check device function.

Parameters
ctxClick object.
Returns
device state ( 1 - Device ERROR // 0 - Device OK )

@description This function reads device and company id, because tests communication

◆ compass4_configuration()

void compass4_configuration ( compass4_t * ctx,
uint8_t cfg1,
uint8_t cfg2 )

Configuration function.

Parameters
ctxClick object.
cfg1Config data for configuration register 1
cfg2Config data for configuration register 2

@description Used this function for configuration module

◆ compass4_generic_read()

void compass4_generic_read ( compass4_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function reads data from the desired register.

◆ compass4_generic_write()

void compass4_generic_write ( compass4_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function writes data to the desired register.

◆ compass4_get_axis()

uint8_t compass4_get_axis ( compass4_t * ctx,
compass4_axis_t * axis )

Gets X\Y\Z Axis value.

Parameters
ctxClick object.
axisRaw axis data object
Returns
device state ( 1 - Device ERROR // 0 - Device OK )

@description Used this function for reads current axis data

◆ compass4_get_interrupt()

uint8_t compass4_get_interrupt ( compass4_t * ctx)

Gets INT pin state (DRDY pin)

Parameters
ctxClick object.
Returns
INT pin state

@description Used this function for getting current interrupt pin state

◆ compass4_get_magnetic_flux()

uint8_t compass4_get_magnetic_flux ( compass4_t * ctx,
compass4_flux_t * flux )

Gets magnetic flux of X\Y\Z axis value.

Parameters
ctxClick object.
fluxMagnetic flux of axis data
Returns
device state ( 1 - Device ERROR // 0 - Device OK )

@description Used this function for reads magnetic flux of axis data

◆ compass4_get_single_axis()

uint8_t compass4_get_single_axis ( compass4_t * ctx,
uint8_t axis_reg,
int16_t * axis_data )

Gets single axis value.

Parameters
ctxClick object.
axis_regAxis register ( LSB )
axis_dataaxis data that reads from the register
Returns
device state ( 1 - Device ERROR // 0 - Device OK )

@description Used this function for reads current single axis data

◆ compass4_get_single_magnetic_flux()

uint8_t compass4_get_single_magnetic_flux ( compass4_t * ctx,
uint8_t axis,
float * flux_data )

Gets single axis flux value.

Parameters
ctxClick object.
axisAxis register ( LSB )
flux_dataFlux data that reads and calculate
Returns
device state ( 1 - Device ERROR // 0 - Device OK )

@description Used this function for reads current single flux or axis data

◆ compass4_get_status()

uint8_t compass4_get_status ( compass4_t * ctx,
uint8_t status )

Get status.

Parameters
ctxClick object.
cfg1Config data for configuration register 1
cfg2Config data for configuration register 2

@description Used this function for configuration module

◆ compass4_hardware_reset()

void compass4_hardware_reset ( compass4_t * ctx)

Hardware reset function.

Parameters
ctxClick object.

@description Used this function for start hardware reset module

◆ compass4_init()

COMPASS4_RETVAL compass4_init ( compass4_t * ctx,
compass4_cfg_t * cfg )

Initialization function.

Parameters
compass4Click object.
cfgClick configuration structure.

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

◆ compass4_set_rst_pin_state()

void compass4_set_rst_pin_state ( compass4_t * ctx,
uint8_t state )

Sets RST pin state.

Parameters
ctxClick object.
stateNew pin state @description Used this function for set RST pin state

◆ compass4_software_reset()

void compass4_software_reset ( compass4_t * ctx)

Software reset function.

Parameters
ctxClick object.

@description Used this function for start software reset module