|
Contiki 3.x
|
Implementation of LIS3DH SPI driver used in the Mulle platform.More...
Go to the source code of this file.
Functions | |
| void | lis3dh_set_bits (const lis3dh_reg_addr_t addr, const uint8_t mask) |
| Set bits of an 8-bit register on the LIS3DH. | |
| void | lis3dh_clear_bits (const lis3dh_reg_addr_t addr, const uint8_t mask) |
| Clear bits of an 8-bit register on the LIS3DH. | |
| void | lis3dh_write_bits (const lis3dh_reg_addr_t addr, const uint8_t mask, const uint8_t values) |
| Write (both set and clear) bits of an 8-bit register on the LIS3DH. More... | |
| 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... | |
Implementation of LIS3DH SPI driver used in the Mulle platform.
Definition in file lis3dh.c.
| void lis3dh_init | ( | ) |
Initialize a LIS3DH accelerometer.
Definition at line 261 of file lis3dh.c.
References lis3dh_arch_init(), lis3dh_read_byte(), LIS3DH_WHO_AM_I_RESPONSE, and lis3dh_write_byte().
| int16_t lis3dh_read_aux_adc1 | ( | ) |
Get one reading from the first channel of the auxiliary ADC.
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.
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.
Definition at line 157 of file lis3dh.c.
References lis3dh_read_int16().
| int16_t lis3dh_read_xaxis | ( | ) |
Get one X-axis reading from the accelerometer.
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.
| buffer | Pointer 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.
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.
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.
| enable | Power state of the auxiliary ADC |
| temperature | If not zero, switch the ADC mux so that a temperature reading is available on OUT_3_L, OUT_3_H. |
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.
| axes | An OR-ed combination of LIS3DH_AXES_X, LIS3DH_AXES_Y, LIS3DH_AXES_Z. |
Definition at line 186 of file lis3dh.c.
References lis3dh_write_bits().
| void lis3dh_set_fifo | ( | const uint8_t | enable | ) |
Enable/disable the FIFO.
| enable | If 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.
| mode | The 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.
| odr | Chosen 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.
| scale | The chosen sensitivity scale. |
Definition at line 231 of file lis3dh.c.
References lis3dh_write_bits().
| void lis3dh_write_bits | ( | const lis3dh_reg_addr_t | addr, |
| const uint8_t | mask, | ||
| const uint8_t | values | ||
| ) |
Write (both set and clear) bits of an 8-bit register on the LIS3DH.
| addr | Register address on the LIS3DH. |
| mask | Bitmask for the bits to modify. |
| values | The values to write to the masked bits. |
Definition at line 77 of file lis3dh.c.
References lis3dh_read_byte(), and lis3dh_write_byte().
Referenced by lis3dh_set_aux_adc(), lis3dh_set_axes(), lis3dh_set_fifo(), lis3dh_set_fifo_mode(), lis3dh_set_odr(), and lis3dh_set_scale().
1.8.5