lsm303agr 2.0.0.0
Public function

Functions

void lsm303agr_cfg_setup (lsm303agr_cfg_t *cfg)
 Config Object Initialization function.
 
LSM303AGR_RETVAL lsm303agr_init (lsm303agr_t *ctx, lsm303agr_cfg_t *cfg)
 Initialization function.
 
void lsm303agr_default_cfg (lsm303agr_t *ctx)
 Click Default Configuration function.
 
void lsm303agr_read_data (lsm303agr_t *ctx, uint8_t reg_addr, uint8_t *read_buf, uint8_t read_len)
 Generic read data function.
 
void lsm303agr_write_data (lsm303agr_t *ctx, uint8_t reg_addr, uint8_t *write_buf, uint8_t write_len)
 Generic write data function.
 
float lsm303agr_get_acc_axis_x (lsm303agr_t *ctx)
 Reading the raw X axis data and calculating the value :
 
float lsm303agr_get_acc_axis_y (lsm303agr_t *ctx)
 Reading the raw Y axis data and calculating the value :
 
float lsm303agr_get_acc_axis_z (lsm303agr_t *ctx)
 Reading the raw Z axis data and calculating the value :
 
float lsm303agr_get_mag_axis_x (lsm303agr_t *ctx)
 Reading the raw X axis data and calculating the value :
 
float lsm303agr_get_mag_axis_y (lsm303agr_t *ctx)
 Reading the raw Y axis data and calculating the value :
 
float lsm303agr_get_mag_axis_z (lsm303agr_t *ctx)
 Reading the raw Z axis data and calculating the value :
 
void lsm303agr_accelerometer_init (lsm303agr_t *ctx)
 Accelerometer init.
 
void lsm303agr_magnetometer_init (lsm303agr_t *ctx)
 Magnetometer init.
 

Detailed Description

Function Documentation

◆ lsm303agr_accelerometer_init()

void lsm303agr_accelerometer_init ( lsm303agr_t * ctx)

Accelerometer init.

Parameters
ctxClick object.
Note

Sets accelerometer operating mode to HR / Normal / Low-power mode (100 Hz) 
by writing  0x57h in 0x20h address

◆ lsm303agr_cfg_setup()

void lsm303agr_cfg_setup ( lsm303agr_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.

◆ lsm303agr_default_cfg()

void lsm303agr_default_cfg ( lsm303agr_t * ctx)

Click Default Configuration function.

Parameters
ctxClick object.

@description This function executes default configuration for LSM303AGR click.

◆ lsm303agr_get_acc_axis_x()

float lsm303agr_get_acc_axis_x ( lsm303agr_t * ctx)

Reading the raw X axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns X axis accel data

◆ lsm303agr_get_acc_axis_y()

float lsm303agr_get_acc_axis_y ( lsm303agr_t * ctx)

Reading the raw Y axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns Y axis accel data

◆ lsm303agr_get_acc_axis_z()

float lsm303agr_get_acc_axis_z ( lsm303agr_t * ctx)

Reading the raw Z axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns Z axis accel data

◆ lsm303agr_get_mag_axis_x()

float lsm303agr_get_mag_axis_x ( lsm303agr_t * ctx)

Reading the raw X axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns raw X axis from the magnetometer.

◆ lsm303agr_get_mag_axis_y()

float lsm303agr_get_mag_axis_y ( lsm303agr_t * ctx)

Reading the raw Y axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns raw Y axis from the magnetometer.

◆ lsm303agr_get_mag_axis_z()

float lsm303agr_get_mag_axis_z ( lsm303agr_t * ctx)

Reading the raw Z axis data and calculating the value :

Parameters
ctxClick object.
Returns
Returns raw Z axis from the magnetometer.

◆ lsm303agr_init()

LSM303AGR_RETVAL lsm303agr_init ( lsm303agr_t * ctx,
lsm303agr_cfg_t * cfg )

Initialization function.

Parameters
lsm303agrClick object.
cfgClick configuration structure.

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

◆ lsm303agr_magnetometer_init()

void lsm303agr_magnetometer_init ( lsm303agr_t * ctx)

Magnetometer init.

Parameters
ctxClick object.
Note
 Sets magnetoometer operating mode to Continuous mode / ODR 10 Hz 
  by writing  0x00h in 0x60h address

◆ lsm303agr_read_data()

void lsm303agr_read_data ( lsm303agr_t * ctx,
uint8_t reg_addr,
uint8_t * read_buf,
uint8_t read_len )

Generic read data function.

Parameters
lightrangerClick object.
reg_addrRegister address.
read_bufRead buffer.
read_lenBuffer length.

@description This function reads 16-bit data from given address.

◆ lsm303agr_write_data()

void lsm303agr_write_data ( lsm303agr_t * ctx,
uint8_t reg_addr,
uint8_t * write_buf,
uint8_t write_len )

Generic write data function.

Parameters
lsm303agrClick object.
reg_addrRegister address.
write_bufRead buffer.
write_lenBuffer length.

@description This function writes 16-bit command to given address.