compass2  2.0.0.0
Functions
Public function

Functions

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

Detailed Description

Function Documentation

◆ compass2_cfg_setup()

void compass2_cfg_setup ( compass2_cfg_t cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

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.

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.

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

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.

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.

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.

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.

This function returns the data overrun status.

◆ compass2_get_rdy()

uint8_t compass2_get_rdy ( compass2_t ctx)

Get ready function.

Parameters
ctxClick object.

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.

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.

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.

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.

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.

This function reads one byte from the desired register.

◆ compass2_reset()

void compass2_reset ( compass2_t ctx)

Hardware reset function.

Parameters
ctxClick object.

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.

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.

This function sets the output resolution.

◆ compass2_software_reset()

void compass2_software_reset ( compass2_t ctx)

Software reset function.

Parameters
ctxClick object.

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.

This function writes one byte to the desired register.