Device driver interface for the ADXL345.
More...
Device driver interface for the ADXL345.
This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.
|
enum | { ADXL345_ADDR_1D = 0x1D,
ADXL345_ADDR_53 = 0x53
} |
| Possible ADXL345 hardware addresses (wiring specific) More...
|
|
enum | { ADXL345_MEASURE_MODE,
ADXL345_STANDBY_MODE,
ADXL345_SLEEP_MODE,
ADXL345_AUTOSLEEP_MODE
} |
| List ADXL345 power mode. More...
|
|
enum | { ADXL345_RANGE_2G = 0,
ADXL345_RANGE_4G = 1,
ADXL345_RANGE_8G = 2,
ADXL345_RANGE_16G = 3
} |
| Define ADXL345 sensitivity. More...
|
|
enum | {
ADXL345_RATE_0HZ1 = 0,
ADXL345_RATE_0HZ2 = 1,
ADXL345_RATE_0HZ39 = 2,
ADXL345_RATE_0HZ78 = 3,
ADXL345_RATE_1HZ56 = 4,
ADXL345_RATE_3HZ13 = 5,
ADXL345_RATE_6HZ25 = 6,
ADXL345_RATE_12HZ50 = 7,
ADXL345_RATE_25HZ = 8,
ADXL345_RATE_50HZ = 9,
ADXL345_RATE_100HZ = 10,
ADXL345_RATE_200HZ = 11,
ADXL345_RATE_400HZ = 12,
ADXL345_RATE_800HZ = 13,
ADXL345_RATE_1600HZ = 14,
ADXL345_RATE_3200HZ = 15
} |
| List bandwidth rate. More...
|
|
enum | { ADXL345_BYPASS = 0,
ADXL345_FIFO = 1,
ADXL345_STREAM = 2,
ADXL345_TRIGGER = 3
} |
| List fifo mode. More...
|
|
enum | { ADXL345_INT1,
ADXL345_INT2
} |
| Output Interrupt selection. More...
|
|
enum | {
ADXL345_OK = 0,
ADXL345_DATA_READY = 1,
ADXL345_NOI2C = -1,
ADXL345_NODEV = -2,
ADXL345_NODATA = -3
} |
| Named return values. More...
|
|
◆ anonymous enum
Possible ADXL345 hardware addresses (wiring specific)
Enumerator |
---|
ADXL345_ADDR_1D | I2C device address if Alt addr pin is high.
|
ADXL345_ADDR_53 | I2C device address if Alt addr pin is low.
|
Definition at line 37 of file adxl345.h.
◆ anonymous enum
List ADXL345 power mode.
Enumerator |
---|
ADXL345_MEASURE_MODE | Measure mode.
|
ADXL345_STANDBY_MODE | Standby mode.
|
ADXL345_SLEEP_MODE | Sleep mode.
|
ADXL345_AUTOSLEEP_MODE | Autosleep mode.
|
Definition at line 45 of file adxl345.h.
◆ anonymous enum
Define ADXL345 sensitivity.
Enumerator |
---|
ADXL345_RANGE_2G | +/- 2 g Full Scale Range
|
ADXL345_RANGE_4G | +/- 4 g Full Scale Range
|
ADXL345_RANGE_8G | +/- 8 g Full Scale Range
|
ADXL345_RANGE_16G | +/- 16 g Full Scale Range
|
Definition at line 55 of file adxl345.h.
◆ anonymous enum
List bandwidth rate.
Enumerator |
---|
ADXL345_RATE_0HZ1 | 0.1 Hz Output Data Rate
|
ADXL345_RATE_0HZ2 | 0.2 Hz Output Data Rate
|
ADXL345_RATE_0HZ39 | 0.39 Hz Output Data Rate
|
ADXL345_RATE_0HZ78 | 0.78 Hz Output Data Rate
|
ADXL345_RATE_1HZ56 | 1.56 Hz Output Data Rate
|
ADXL345_RATE_3HZ13 | 3.13 Hz Output Data Rate
|
ADXL345_RATE_6HZ25 | 6.25 Hz Output Data Rate
|
ADXL345_RATE_12HZ50 | 12.5 Hz Output Data Rate
|
ADXL345_RATE_25HZ | 25 Hz Output Data Rate
|
ADXL345_RATE_50HZ | 50 Hz Output Data Rate
|
ADXL345_RATE_100HZ | 100 Hz Output Data Rate
|
ADXL345_RATE_200HZ | 200 Hz Output Data Rate
|
ADXL345_RATE_400HZ | 400 Hz Output Data Rate
|
ADXL345_RATE_800HZ | 800 Hz Output Data Rate
|
ADXL345_RATE_1600HZ | 1600 Hz Output Data Rate
|
ADXL345_RATE_3200HZ | 3200 Hz Output Data Rate
|
Definition at line 65 of file adxl345.h.
◆ anonymous enum
List fifo mode.
Enumerator |
---|
ADXL345_BYPASS | FIFO bypass mode.
|
ADXL345_FIFO | FIFO mode.
|
ADXL345_STREAM | FIFO stream mode.
|
ADXL345_TRIGGER | FIFO trigger mode.
|
Definition at line 87 of file adxl345.h.
◆ anonymous enum
Output Interrupt selection.
Enumerator |
---|
ADXL345_INT1 | Output interrupt on INT1 pin.
|
ADXL345_INT2 | Output interrupt on INT2 pin.
|
Definition at line 97 of file adxl345.h.
◆ anonymous enum
Named return values.
Enumerator |
---|
ADXL345_OK | everything was fine
|
ADXL345_DATA_READY | new data ready to be read
|
ADXL345_NOI2C | I2C communication failed.
|
ADXL345_NODEV | no ADXL345 device found on the bus
|
ADXL345_NODATA | no data available
|
Definition at line 105 of file adxl345.h.
◆ adxl345_init()
Initialize the ADXL345 accelerometer driver.
- Parameters
-
[out] | dev | device descriptor of accelerometer to initialize |
[in] | params | configuration parameters |
- Returns
- ADXL345_OK on success
-
ADXL345_NOI2C if initialization of I2C bus failed
-
ADXL345_NODEV if accelerometer test failed
◆ adxl345_read()
◆ adxl345_set_autosleep()
void adxl345_set_autosleep |
( |
const adxl345_t * |
dev | ) |
|
Set autosleep mode.
- Parameters
-
[in] | dev | device descriptor of accelerometer |
◆ adxl345_set_bandwidth_rate()
void adxl345_set_bandwidth_rate |
( |
const adxl345_t * |
dev, |
|
|
uint8_t |
bw_rate |
|
) |
| |
Set bandwidth rate.
- Parameters
-
[in] | dev | device descriptor of accelerometer |
[in] | bw_rate | new datarate |
◆ adxl345_set_fifo_mode()
void adxl345_set_fifo_mode |
( |
const adxl345_t * |
dev, |
|
|
uint8_t |
mode, |
|
|
uint8_t |
output, |
|
|
uint8_t |
value |
|
) |
| |
Set fifo mode with its configuration.
- Parameters
-
[in] | dev | device descriptor of accelerometer |
[in] | mode | fifo mode configuration |
[in] | output | set trigger output |
[in] | value | set trigger's value |
◆ adxl345_set_interrupt()
void adxl345_set_interrupt |
( |
const adxl345_t * |
dev | ) |
|
set ADXL345's interrupts configuration
- Parameters
-
[in] | dev | device descriptor of accelerometer |
◆ adxl345_set_measure()
void adxl345_set_measure |
( |
const adxl345_t * |
dev | ) |
|
set ADXL345's measure mode
- Parameters
-
[in] | dev | device descriptor of accelerometer |
◆ adxl345_set_sleep()
void adxl345_set_sleep |
( |
const adxl345_t * |
dev | ) |
|
Set sleep mode.
- Parameters
-
[in] | dev | device descriptor of accelerometer |
◆ adxl345_set_standby()
void adxl345_set_standby |
( |
const adxl345_t * |
dev | ) |
|
Set standby mode.
- Parameters
-
[in] | dev | device descriptor of accelerometer |