Contiki 3.x
Macros | Enumerations | Functions
lis3dh.h File Reference

    Interface of LIS3DH SPI driver used in the Mulle platform.
More...

#include <stdint.h>

Go to the source code of this file.

Macros

#define LIS3DH_WHO_AM_I_RESPONSE   (0b00110011)
 The WHO_AM_I register should contain this value in order to correctly identify the chip.
 
#define LIS3DH_TEMP_CFG_REG_ADC_PD_MASK   (1 << 7)
 ADC enable. More...
 
#define LIS3DH_TEMP_CFG_REG_TEMP_EN_MASK   (1 << 6)
 Temperature sensor (T) enable. More...
 
#define LIS3DH_CTRL_REG1_ODR_SHIFT   (4)
 Data rate selection. More...
 
#define LIS3DH_CTRL_REG1_LPEN_MASK   (1 << 3)
 Low power mode enable. More...
 
#define LIS3DH_CTRL_REG1_ZEN_MASK   (1 << LIS3DH_CTRL_REG1_ZEN_SHIFT)
 Z axis enable. More...
 
#define LIS3DH_CTRL_REG1_YEN_MASK   (1 << LIS3DH_CTRL_REG1_YEN_SHIFT)
 Y axis enable. More...
 
#define LIS3DH_CTRL_REG1_XEN_MASK   (1 << LIS3DH_CTRL_REG1_XEN_SHIFT)
 X axis enable. More...
 
#define LIS3DH_AXES_XYZ   (LIS3DH_CTRL_REG1_XYZEN_MASK)
 Convenience macro for enabling all axes.
 
#define LIS3DH_CTRL_REG2_HPM1_MASK   (1 << 7)
 High pass filter mode selection. More...
 
#define LIS3DH_CTRL_REG2_HPCF2_MASK   (1 << 5)
 High pass filter cut off frequency selection.
 
#define LIS3DH_CTRL_REG2_FDS_MASK   (1 << 3)
 Filtered data selection. More...
 
#define LIS3DH_CTRL_REG2_HPCLICK_MASK   (1 << 2)
 High pass filter enabled for CLICK function. More...
 
#define LIS3DH_CTRL_REG2_HPIS2_MASK   (1 << 1)
 High pass filter enabled for AOI function on interrupt 2, (0: filter bypassed; 1: filter enabled)
 
#define LIS3DH_CTRL_REG3_I1_CLICK_MASK   (1 << 7)
 CLICK interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_AOI1_MASK   (1 << 6)
 AOI1 interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_AOI2_MASK   (1 << 5)
 AOI2 interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_DRDY1_MASK   (1 << 4)
 DRDY1 interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_DRDY2_MASK   (1 << 3)
 DRDY2 interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_WTM_MASK   (1 << 2)
 FIFO Watermark interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG3_I1_OVERRUN_MASK   (1 << 1)
 FIFO Overrun interrupt on INT1. More...
 
#define LIS3DH_CTRL_REG4_BDU_MASK   (1 << 7)
 Block data update. More...
 
#define LIS3DH_CTRL_REG4_BLE_MASK   (1 << 6)
 Big/little endian data selection. More...
 
#define LIS3DH_CTRL_REG4_FS1_MASK   (1 << 5)
 Full scale selection. More...
 
#define LIS3DH_CTRL_REG4_HR_MASK   (1 << 3)
 High resolution output mode: Default value: 0 (0: High resolution disable; 1: High resolution Enable)
 
#define LIS3DH_CTRL_REG4_ST1_MASK   (1 << 2)
 Self test enable. More...
 
#define LIS3DH_CTRL_REG4_SIM_MASK   (1 << 0)
 SPI serial interface mode selection. More...
 
#define LIS3DH_CTRL_REG5_REBOOT_MASK   (1 << 7)
 Reboot memory content. More...
 
#define LIS3DH_CTRL_REG5_FIFO_EN_MASK   (1 << 6)
 FIFO enable. More...
 
#define LIS3DH_CTRL_REG5_LIR_I1_MASK   (1 << 3)
 Latch interrupt request on INT1_SRC register, with INT1_SRC register cleared by reading INT1_SRC itself. More...
 
#define LIS3DH_CTRL_REG5_D4D_I1_MASK   (1 << 2)
 4D enable: 4D detection is enabled on INT1 when 6D bit on INT1_CFG is set to 1.
 
#define LIS3DH_STATUS_REG_ZYXOR_MASK   (1 << 7)
 X, Y and Z axis data overrun. More...
 
#define LIS3DH_STATUS_REG_ZOR_MASK   (1 << 6)
 Z axis data overrun. More...
 
#define LIS3DH_STATUS_REG_YOR_MASK   (1 << 5)
 Y axis data overrun. More...
 
#define LIS3DH_STATUS_REG_XOR_MASK   (1 << 4)
 X axis data overrun. More...
 
#define LIS3DH_STATUS_REG_ZYXDA_MASK   (1 << 3)
 X, Y and Z axis new data available. More...
 
#define LIS3DH_STATUS_REG_ZDA_MASK   (1 << 2)
 Z axis new data available. More...
 
#define LIS3DH_STATUS_REG_YDA_MASK   (1 << 1)
 Y axis new data available. More...
 
#define LIS3DH_STATUS_REG_XDA_MASK   (1 << 0)
 X axis new data available. More...
 
#define LIS3DH_SPI_READ_MASK   (1 << 7)
 The READ bit must be set when reading.
 
#define LIS3DH_SPI_MULTI_MASK   (1 << 6)
 Multi byte transfers must assert this bit when writing the address.
 
#define LIS3DH_SPI_SINGLE_MASK   (0 << 6)
 Opposite of LIS3DH_SPI_MULTI_MASK.
 
#define LIS3DH_SPI_ADDRESS_MASK   (0x3F)
 Mask of the address bits in the address byte during transfers.
 
#define LIS3DH_ACC_DATA_SIZE   (2)
 Length of X, Y, Z data in bytes.
 

Enumerations

enum  lis3dh_reg_addr_t
 All LIS3DH hardware registers are enumerated here.
 
enum  lis3dh_odr_t
 Allowed values for the Output Data Rate of the sensor. More...
 
enum  lis3dh_scale_t
 Scale parameters, use these names when calling lis3dh_set_scale(scale).
 
enum  lis3dh_fifo_mode_t
 Allowed FIFO modes. More...
 

Functions

void lis3dh_set_bits (const lis3dh_reg_addr_t addr, const uint8_t bitmask)
 Set bits of an 8-bit register on the LIS3DH.
 
void lis3dh_clear_bits (const lis3dh_reg_addr_t addr, const uint8_t bitmask)
 Clear bits of an 8-bit register on the LIS3DH.
 
int16_t lis3dh_read_xaxis ()
 Get one X-axis reading from the accelerometer. More...
 
int16_t lis3dh_read_yaxis ()
 Get one Y-axis reading from the accelerometer. More...
 
int16_t lis3dh_read_zaxis ()
 Get one Z-axis reading from the accelerometer. More...
 
void lis3dh_read_xyz (int16_t *buffer)
 Read all three axes in a single transaction. More...
 
int16_t lis3dh_read_aux_adc1 ()
 Get one reading from the first channel of the auxiliary ADC. More...
 
int16_t lis3dh_read_aux_adc2 ()
 Get one reading from the second channel of the auxiliary ADC. More...
 
int16_t lis3dh_read_aux_adc3 ()
 Get one reading from the third channel of the auxiliary ADC. More...
 
void lis3dh_set_aux_adc (const uint8_t enable, const uint8_t temperature)
 Turn on/off power to the auxiliary ADC in LIS3DH. More...
 
void lis3dh_set_axes (const uint8_t axes)
 Enable/disable accelerometer axes. More...
 
void lis3dh_set_fifo_mode (const lis3dh_fifo_mode_t mode)
 Set the FIFO mode. More...
 
void lis3dh_set_fifo (const uint8_t enable)
 Enable/disable the FIFO. More...
 
void lis3dh_set_odr (const lis3dh_odr_t odr)
 Set the output data rate of the sensor. More...
 
void lis3dh_set_scale (const lis3dh_scale_t scale)
 Set the full scale range of the sensor. More...
 
void lis3dh_init ()
 Initialize a LIS3DH accelerometer. More...
 
void lis3dh_write_byte (const lis3dh_reg_addr_t addr, const uint8_t value)
 Write a single byte to the LIS3DH. More...
 
uint8_t lis3dh_read_byte (const lis3dh_reg_addr_t addr)
 Read a single byte from the LIS3DH. More...
 
int16_t lis3dh_read_int16 (const lis3dh_reg_addr_t lsb_addr)
 Read a 16-bit integer from the LIS3DH. More...
 
void lis3dh_memcpy_from_device (const lis3dh_reg_addr_t start_address, uint8_t *buffer, uint8_t count)
 Read multiple bytes from the LIS3DH. More...
 
void lis3dh_memcpy_to_device (const lis3dh_reg_addr_t start_address, const uint8_t *buffer, uint8_t count)
 Write multiple bytes to the LIS3DH. More...
 
void lis3dh_arch_init ()
 Perform the platform specific part of the initialization process of the LIS3DH. More...
 

Detailed Description

    Interface of LIS3DH SPI driver used in the Mulle platform.
Author
Joakim Gebart joaki.nosp@m.m.ge.nosp@m.bart@.nosp@m.eist.nosp@m.ec.se

Definition in file lis3dh.h.

Macro Definition Documentation

#define LIS3DH_CTRL_REG1_LPEN_MASK   (1 << 3)

Low power mode enable.

Default value: 0 (0: normal mode, 1: low power mode)

Definition at line 166 of file lis3dh.h.

#define LIS3DH_CTRL_REG1_ODR_SHIFT   (4)

Data rate selection.

Default value: 00 (0000: Power down; Others: Refer to Table 25, “Data rate configuration”)

Definition at line 118 of file lis3dh.h.

Referenced by lis3dh_set_odr().

#define LIS3DH_CTRL_REG1_XEN_MASK   (1 << LIS3DH_CTRL_REG1_XEN_SHIFT)

X axis enable.

Default value: 1 (0: X axis disabled; 1: X axis enabled)

Definition at line 187 of file lis3dh.h.

#define LIS3DH_CTRL_REG1_YEN_MASK   (1 << LIS3DH_CTRL_REG1_YEN_SHIFT)

Y axis enable.

Default value: 1 (0: Y axis disabled; 1: Y axis enabled)

Definition at line 180 of file lis3dh.h.

#define LIS3DH_CTRL_REG1_ZEN_MASK   (1 << LIS3DH_CTRL_REG1_ZEN_SHIFT)

Z axis enable.

Default value: 1 (0: Z axis disabled; 1: Z axis enabled)

Definition at line 173 of file lis3dh.h.

#define LIS3DH_CTRL_REG2_FDS_MASK   (1 << 3)

Filtered data selection.

Default value: 0 (0: internal filter bypassed; 1: data from internal filter sent to output register and FIFO)

Definition at line 218 of file lis3dh.h.

#define LIS3DH_CTRL_REG2_HPCLICK_MASK   (1 << 2)

High pass filter enabled for CLICK function.

(0: filter bypassed; 1: filter enabled)

Definition at line 224 of file lis3dh.h.

#define LIS3DH_CTRL_REG2_HPM1_MASK   (1 << 7)

High pass filter mode selection.

Default value: 00 Refer to Table 29, "High pass filter mode configuration"

Definition at line 205 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_AOI1_MASK   (1 << 6)

AOI1 interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 243 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_AOI2_MASK   (1 << 5)

AOI2 interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 248 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_CLICK_MASK   (1 << 7)

CLICK interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 237 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_DRDY1_MASK   (1 << 4)

DRDY1 interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 253 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_DRDY2_MASK   (1 << 3)

DRDY2 interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 258 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_OVERRUN_MASK   (1 << 1)

FIFO Overrun interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 268 of file lis3dh.h.

#define LIS3DH_CTRL_REG3_I1_WTM_MASK   (1 << 2)

FIFO Watermark interrupt on INT1.

Default value 0. (0: Disable; 1: Enable)

Definition at line 263 of file lis3dh.h.

#define LIS3DH_CTRL_REG4_BDU_MASK   (1 << 7)

Block data update.

Default value: 0 (0: continuous update; 1: output registers not updated until MSB and LSB reading)

Definition at line 275 of file lis3dh.h.

#define LIS3DH_CTRL_REG4_BLE_MASK   (1 << 6)

Big/little endian data selection.

Default value 0. (0: Data LSB @ lower address; 1: Data MSB @ lower address)

Definition at line 283 of file lis3dh.h.

#define LIS3DH_CTRL_REG4_FS1_MASK   (1 << 5)

Full scale selection.

default value: 00 (00: +/- 2G; 01: +/- 4G; 10: +/- 8G; 11: +/- 16G)

Definition at line 292 of file lis3dh.h.

#define LIS3DH_CTRL_REG4_SIM_MASK   (1 << 0)

SPI serial interface mode selection.

Default value: 0 (0: 4-wire interface; 1: 3-wire interface).

Definition at line 328 of file lis3dh.h.

#define LIS3DH_CTRL_REG4_ST1_MASK   (1 << 2)

Self test enable.

Default value: 00 (00: Self test disabled; Other: See Table 34)

Definition at line 321 of file lis3dh.h.

#define LIS3DH_CTRL_REG5_FIFO_EN_MASK   (1 << 6)

FIFO enable.

Default value: 0 (0: FIFO disable; 1: FIFO Enable)

Definition at line 340 of file lis3dh.h.

Referenced by lis3dh_set_fifo().

#define LIS3DH_CTRL_REG5_LIR_I1_MASK   (1 << 3)

Latch interrupt request on INT1_SRC register, with INT1_SRC register cleared by reading INT1_SRC itself.

Default value: 0. (0: interrupt request not latched; 1: interrupt request latched)

Definition at line 347 of file lis3dh.h.

#define LIS3DH_CTRL_REG5_REBOOT_MASK   (1 << 7)

Reboot memory content.

Default value: 0 (0: normal mode; 1: reboot memory content)

Definition at line 334 of file lis3dh.h.

#define LIS3DH_STATUS_REG_XDA_MASK   (1 << 0)

X axis new data available.

Default value: 0 (0: a new data for the X-axis is not yet available; 1: a new data for the X-axis is available)

Definition at line 406 of file lis3dh.h.

#define LIS3DH_STATUS_REG_XOR_MASK   (1 << 4)

X axis data overrun.

Default value: 0 (0: no overrun has occurred; 1: a new data for the X-axis has overwritten the previous one)

Definition at line 379 of file lis3dh.h.

#define LIS3DH_STATUS_REG_YDA_MASK   (1 << 1)

Y axis new data available.

Default value: 0 (0: a new data for the Y-axis is not yet available; 1: a new data for the Y-axis is available)

Definition at line 399 of file lis3dh.h.

#define LIS3DH_STATUS_REG_YOR_MASK   (1 << 5)

Y axis data overrun.

Default value: 0 (0: no overrun has occurred; 1: a new data for the Y-axis has overwritten the previous one)

Definition at line 372 of file lis3dh.h.

#define LIS3DH_STATUS_REG_ZDA_MASK   (1 << 2)

Z axis new data available.

Default value: 0 (0: a new data for the Z-axis is not yet available; 1: a new data for the Z-axis is available)

Definition at line 392 of file lis3dh.h.

#define LIS3DH_STATUS_REG_ZOR_MASK   (1 << 6)

Z axis data overrun.

Default value: 0 (0: no overrun has occurred; 1: a new data for the Z-axis has overwritten the previous one)

Definition at line 365 of file lis3dh.h.

#define LIS3DH_STATUS_REG_ZYXDA_MASK   (1 << 3)

X, Y and Z axis new data available.

Default value: 0 (0: a new set of data is not yet available; 1: a new set of data is available)

Definition at line 385 of file lis3dh.h.

#define LIS3DH_STATUS_REG_ZYXOR_MASK   (1 << 7)

X, Y and Z axis data overrun.

Default value: 0 (0: no overrun has occurred; 1: a new set of data has overwritten the previous ones)

Definition at line 358 of file lis3dh.h.

#define LIS3DH_TEMP_CFG_REG_ADC_PD_MASK   (1 << 7)

ADC enable.

Default value: 0 (0: ADC disabled; 1: ADC enabled)

Definition at line 107 of file lis3dh.h.

Referenced by lis3dh_set_aux_adc().

#define LIS3DH_TEMP_CFG_REG_TEMP_EN_MASK   (1 << 6)

Temperature sensor (T) enable.

Default value: 0 (0: T disabled; 1: T enabled)

Definition at line 112 of file lis3dh.h.

Referenced by lis3dh_set_aux_adc().

Enumeration Type Documentation

Allowed FIFO modes.

Used when calling lis3dh_set_fifo_mode(mode).

Definition at line 432 of file lis3dh.h.

Allowed values for the Output Data Rate of the sensor.

Use these when calling lis3dh_set_odr(odr).

Definition at line 149 of file lis3dh.h.

Function Documentation

void lis3dh_arch_init ( )

Perform the platform specific part of the initialization process of the LIS3DH.

This function is expected to set up the SPI module for the LIS3DH.

Definition at line 231 of file lis3dh-arch.c.

References PORTD, SIM, and SPI0.

Referenced by lis3dh_init().

void lis3dh_init ( )

Initialize a LIS3DH accelerometer.

Todo:
Signal errors when initializing the LIS3DH hardware.

Definition at line 261 of file lis3dh.c.

References lis3dh_arch_init(), lis3dh_read_byte(), LIS3DH_WHO_AM_I_RESPONSE, and lis3dh_write_byte().

void lis3dh_memcpy_from_device ( const lis3dh_reg_addr_t  start_address,
uint8_t *  buffer,
uint8_t  count 
)

Read multiple bytes from the LIS3DH.

Parameters
start_addressThe lower address of the source registers.
bufferA buffer to write the read values into.
countNumber of bytes to read.

Definition at line 160 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_MULTI_MASK, and LIS3DH_SPI_READ_MASK.

Referenced by lis3dh_read_xyz().

void lis3dh_memcpy_to_device ( const lis3dh_reg_addr_t  start_address,
const uint8_t *  buffer,
uint8_t  count 
)

Write multiple bytes to the LIS3DH.

Parameters
start_addressThe lower address of the target registers.
bufferA buffer to read the values from.
countNumber of bytes to write.

Definition at line 197 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, and LIS3DH_SPI_MULTI_MASK.

int16_t lis3dh_read_aux_adc1 ( )

Get one reading from the first channel of the auxiliary ADC.

Returns
The current ADC reading.

Definition at line 134 of file lis3dh.c.

References lis3dh_read_int16().

int16_t lis3dh_read_aux_adc2 ( )

Get one reading from the second channel of the auxiliary ADC.

Returns
The current ADC reading.

Definition at line 144 of file lis3dh.c.

References lis3dh_read_int16().

int16_t lis3dh_read_aux_adc3 ( )

Get one reading from the third channel of the auxiliary ADC.

Note
The internal temperature sensor is connected to the third channel on the auxiliary ADC when the TEMP_EN bit of TEMP_CFG_REG is set.
Returns
The current ADC reading.

Definition at line 157 of file lis3dh.c.

References lis3dh_read_int16().

uint8_t lis3dh_read_byte ( const lis3dh_reg_addr_t  addr)

Read a single byte from the LIS3DH.

Parameters
addrThe source register.
Returns
The value of the register.

Definition at line 109 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_READ_MASK, and LIS3DH_SPI_SINGLE_MASK.

Referenced by lis3dh_clear_bits(), lis3dh_init(), lis3dh_set_bits(), and lis3dh_write_bits().

int16_t lis3dh_read_int16 ( const lis3dh_reg_addr_t  lsb_addr)

Read a 16-bit integer from the LIS3DH.

Parameters
lsb_addrThe lower address of the two source registers.
Returns
The value of the register, byte order depends on the big/little endian setting of the LIS3DH.
Note
The BLE bit of CTRL_REG4 will affect the byte order of the return value.

Definition at line 127 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, LIS3DH_SPI_MULTI_MASK, and LIS3DH_SPI_READ_MASK.

Referenced by lis3dh_read_aux_adc1(), lis3dh_read_aux_adc2(), lis3dh_read_aux_adc3(), lis3dh_read_xaxis(), lis3dh_read_yaxis(), and lis3dh_read_zaxis().

int16_t lis3dh_read_xaxis ( )

Get one X-axis reading from the accelerometer.

Returns
The oldest X axis acceleration measurement available.

Definition at line 93 of file lis3dh.c.

References lis3dh_read_int16().

void lis3dh_read_xyz ( int16_t *  buffer)

Read all three axes in a single transaction.

Parameters
bufferPointer to an int16_t[3] buffer.

Definition at line 123 of file lis3dh.c.

References LIS3DH_ACC_DATA_SIZE, and lis3dh_memcpy_from_device().

int16_t lis3dh_read_yaxis ( )

Get one Y-axis reading from the accelerometer.

Returns
The oldest Y axis acceleration measurement available.

Definition at line 103 of file lis3dh.c.

References lis3dh_read_int16().

int16_t lis3dh_read_zaxis ( )

Get one Z-axis reading from the accelerometer.

Returns
The oldest Z axis acceleration measurement available.

Definition at line 113 of file lis3dh.c.

References lis3dh_read_int16().

void lis3dh_set_aux_adc ( const uint8_t  enable,
const uint8_t  temperature 
)

Turn on/off power to the auxiliary ADC in LIS3DH.

Parameters
enablePower state of the auxiliary ADC
temperatureIf not zero, switch the ADC mux so that a temperature reading is available on OUT_3_L, OUT_3_H.
Note
This ADC is only used for the temperature reading and the external ADC pins. The accelerometer ADC is turned on by lis3dh_set_odr().

Definition at line 172 of file lis3dh.c.

References LIS3DH_TEMP_CFG_REG_ADC_PD_MASK, LIS3DH_TEMP_CFG_REG_TEMP_EN_MASK, and lis3dh_write_bits().

void lis3dh_set_axes ( const uint8_t  axes)

Enable/disable accelerometer axes.

Parameters
axesAn OR-ed combination of LIS3DH_AXES_X, LIS3DH_AXES_Y, LIS3DH_AXES_Z.
Note
The macro LIS3DH_AXES_XYZ is a convenience shortcut to enable all axes.

Definition at line 186 of file lis3dh.c.

References lis3dh_write_bits().

void lis3dh_set_fifo ( const uint8_t  enable)

Enable/disable the FIFO.

Parameters
enableIf zero, disable the FIFO, otherwise enables the FIFO.

Definition at line 207 of file lis3dh.c.

References LIS3DH_CTRL_REG5_FIFO_EN_MASK, and lis3dh_write_bits().

void lis3dh_set_fifo_mode ( const lis3dh_fifo_mode_t  mode)

Set the FIFO mode.

Parameters
modeThe chosen FIFO mode.

Definition at line 196 of file lis3dh.c.

References lis3dh_write_bits().

void lis3dh_set_odr ( const lis3dh_odr_t  odr)

Set the output data rate of the sensor.

Parameters
odrChosen output data rate.

Definition at line 218 of file lis3dh.c.

References LIS3DH_CTRL_REG1_ODR_SHIFT, and lis3dh_write_bits().

void lis3dh_set_scale ( const lis3dh_scale_t  scale)

Set the full scale range of the sensor.

Valid values for scale is 2, 4, 8, 16 and represents the full range of the sensor.

Parameters
scaleThe chosen sensitivity scale.

Definition at line 231 of file lis3dh.c.

References lis3dh_write_bits().

void lis3dh_write_byte ( const lis3dh_reg_addr_t  addr,
const uint8_t  value 
)

Write a single byte to the LIS3DH.

Parameters
addrThe target register.
valueThe value to write.

Definition at line 95 of file lis3dh-arch.c.

References LIS3DH_SPI_ADDRESS_MASK, and LIS3DH_SPI_SINGLE_MASK.

Referenced by lis3dh_clear_bits(), lis3dh_init(), lis3dh_set_bits(), and lis3dh_write_bits().