compass2 2.0.0.0
Public function

Functions

void compass2_cfg_setup (compass2_cfg_t *cfg)
 Config Object Initialization function.
 
COMPASS2_RETVAL compass2_init (compass2_t *ctx, compass2_cfg_t *cfg)
 Initialization function.
 
void compass2_default_cfg (compass2_t *ctx)
 Click Default Configuration function.
 
void compass2_generic_write (compass2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void compass2_generic_read (compass2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void compass2_write_byte (compass2_t *ctx, uint8_t reg, uint8_t data_buf)
 Write byte function.
 
uint8_t compass2_read_byte (compass2_t *ctx, uint8_t reg)
 Read byte function.
 
void compass2_reset (compass2_t *ctx)
 Hardware reset function.
 
void compass2_i2c_disable (compass2_t *ctx)
 Switch from I2C to SPI mode function.
 
void compass2_software_reset (compass2_t *ctx)
 Software reset function.
 
float compass2_get_resolution_parameter (uint8_t res)
 Get resolution function.
 
uint8_t compass2_get_rdy (compass2_t *ctx)
 Get ready function.
 
uint8_t compass2_get_data_overrun (compass2_t *ctx)
 Get data overrun function.
 
void compass2_get_adjustment (compass2_t *ctx, uint8_t *x, uint8_t *y, uint8_t *z)
 Get axis adjustment function.
 
void compass2_set_out_resolution (compass2_t *ctx, uint8_t res)
 Set output resolution function.
 
void compass2_set_mode (compass2_t *ctx, uint8_t mode)
 Set output resolution function.
 
void compass2_get_all_data (compass2_t *ctx, int16_t *x, int16_t *y, int16_t *z)
 Get all data function.
 
int16_t compass2_get_axis_data (compass2_t *ctx, uint8_t axis)
 Get one axis data function.
 
void compass2_new_measurement (compass2_t *ctx)
 New measurement function.
 

Detailed Description

Function Documentation

◆ compass2_cfg_setup()

void compass2_cfg_setup ( compass2_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.

◆ compass2_default_cfg()

void compass2_default_cfg ( compass2_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for Compass 2 click.

◆ compass2_generic_read()

void compass2_generic_read ( compass2_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.

◆ compass2_generic_write()

void compass2_generic_write ( compass2_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.

◆ compass2_get_adjustment()

void compass2_get_adjustment ( compass2_t * ctx,
uint8_t * x,
uint8_t * y,
uint8_t * z )

Get axis adjustment function.

Parameters
ctxClick object.
*xPointer fox x.
*yPointer for y.
*zPointer for z.

@description This function does adjustments to the axes.

◆ compass2_get_all_data()

void compass2_get_all_data ( compass2_t * ctx,
int16_t * x,
int16_t * y,
int16_t * z )

Get all data function.

Parameters
ctxClick object.
xX axis.
yY axis.
zZ axis.

@description This function gets the data from all axes.

◆ compass2_get_axis_data()

int16_t compass2_get_axis_data ( compass2_t * ctx,
uint8_t axis )

Get one axis data function.

Parameters
ctxClick object.
axisAxis selector.

@description This function gets the data from one specified axis.

◆ compass2_get_data_overrun()

uint8_t compass2_get_data_overrun ( compass2_t * ctx)

Get data overrun function.

Parameters
ctxClick object.

@description This function returns the data overrun status.

◆ compass2_get_rdy()

uint8_t compass2_get_rdy ( compass2_t * ctx)

Get ready function.

Parameters
ctxClick object.

@description This function returns the ready status.

◆ compass2_get_resolution_parameter()

float compass2_get_resolution_parameter ( uint8_t res)

Get resolution function.

Parameters
resResolution mode selector.

@description This function returns a 14 or 16 bit resolution transformation coefficient.

◆ compass2_i2c_disable()

void compass2_i2c_disable ( compass2_t * ctx)

Switch from I2C to SPI mode function.

Parameters
ctxClick object.

@description This function reads one byte from the desired register.

◆ compass2_init()

COMPASS2_RETVAL compass2_init ( compass2_t * ctx,
compass2_cfg_t * cfg )

Initialization function.

Parameters
compass2Click object.
cfgClick configuration structure.

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

◆ compass2_new_measurement()

void compass2_new_measurement ( compass2_t * ctx)

New measurement function.

Parameters
ctxClick object.

@description This function prepares the device for a new measurement.

◆ compass2_read_byte()

uint8_t compass2_read_byte ( compass2_t * ctx,
uint8_t reg )

Read byte function.

Parameters
ctxClick object.
regRegister address.

@description This function reads one byte from the desired register.

◆ compass2_reset()

void compass2_reset ( compass2_t * ctx)

Hardware reset function.

Parameters
ctxClick object.

@description This function does a hardware reset of the device.

◆ compass2_set_mode()

void compass2_set_mode ( compass2_t * ctx,
uint8_t mode )

Set output resolution function.

Parameters
ctxClick object.
modeMode value.

@description This function sets the output resolution mode.

◆ compass2_set_out_resolution()

void compass2_set_out_resolution ( compass2_t * ctx,
uint8_t res )

Set output resolution function.

Parameters
ctxClick object.
resResolution value.

@description This function sets the output resolution.

◆ compass2_software_reset()

void compass2_software_reset ( compass2_t * ctx)

Software reset function.

Parameters
ctxClick object.

@description This function does a software reset of the module.

◆ compass2_write_byte()

void compass2_write_byte ( compass2_t * ctx,
uint8_t reg,
uint8_t data_buf )

Write byte function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.

@description This function writes one byte to the desired register.