Skip to content

Commit f9eb057

Browse files
Rubuschjic23
authored andcommitted
iio: accel: adxl345: complete the list of defines
Having interrupts events and FIFO available allows to evaluate the sensor events. Cover the list of interrupt based sensor events. Keep them in the header file for readability. Signed-off-by: Lothar Rubusch <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jonathan Cameron <[email protected]>
1 parent cf04212 commit f9eb057

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

drivers/iio/accel/adxl345.h

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,35 @@
99
#define _ADXL345_H_
1010

1111
#define ADXL345_REG_DEVID 0x00
12+
#define ADXL345_REG_THRESH_TAP 0x1D
1213
#define ADXL345_REG_OFSX 0x1E
1314
#define ADXL345_REG_OFSY 0x1F
1415
#define ADXL345_REG_OFSZ 0x20
1516
#define ADXL345_REG_OFS_AXIS(index) (ADXL345_REG_OFSX + (index))
17+
18+
/* Tap duration */
19+
#define ADXL345_REG_DUR 0x21
20+
/* Tap latency */
21+
#define ADXL345_REG_LATENT 0x22
22+
/* Tap window */
23+
#define ADXL345_REG_WINDOW 0x23
24+
/* Activity threshold */
25+
#define ADXL345_REG_THRESH_ACT 0x24
26+
/* Inactivity threshold */
27+
#define ADXL345_REG_THRESH_INACT 0x25
28+
/* Inactivity time */
29+
#define ADXL345_REG_TIME_INACT 0x26
30+
/* Axis enable control for activity and inactivity detection */
31+
#define ADXL345_REG_ACT_INACT_CTRL 0x27
32+
/* Free-fall threshold */
33+
#define ADXL345_REG_THRESH_FF 0x28
34+
/* Free-fall time */
35+
#define ADXL345_REG_TIME_FF 0x29
36+
/* Axis control for single tap or double tap */
37+
#define ADXL345_REG_TAP_AXIS 0x2A
38+
/* Source of single tap or double tap */
39+
#define ADXL345_REG_ACT_TAP_STATUS 0x2B
40+
/* Data rate and power mode control */
1641
#define ADXL345_REG_BW_RATE 0x2C
1742
#define ADXL345_REG_POWER_CTL 0x2D
1843
#define ADXL345_REG_INT_ENABLE 0x2E
@@ -34,19 +59,36 @@
3459

3560
#define ADXL345_INT_OVERRUN BIT(0)
3661
#define ADXL345_INT_WATERMARK BIT(1)
62+
#define ADXL345_INT_FREE_FALL BIT(2)
63+
#define ADXL345_INT_INACTIVITY BIT(3)
64+
#define ADXL345_INT_ACTIVITY BIT(4)
65+
#define ADXL345_INT_DOUBLE_TAP BIT(5)
66+
#define ADXL345_INT_SINGLE_TAP BIT(6)
3767
#define ADXL345_INT_DATA_READY BIT(7)
68+
69+
/*
70+
* BW_RATE bits - Bandwidth and output data rate. The default value is
71+
* 0x0A, which translates to a 100 Hz output data rate
72+
*/
3873
#define ADXL345_BW_RATE GENMASK(3, 0)
74+
#define ADXL345_BW_LOW_POWER BIT(4)
3975
#define ADXL345_BASE_RATE_NANO_HZ 97656250LL
4076

4177
#define ADXL345_POWER_CTL_STANDBY 0x00
78+
#define ADXL345_POWER_CTL_WAKEUP GENMASK(1, 0)
79+
#define ADXL345_POWER_CTL_SLEEP BIT(2)
4280
#define ADXL345_POWER_CTL_MEASURE BIT(3)
81+
#define ADXL345_POWER_CTL_AUTO_SLEEP BIT(4)
82+
#define ADXL345_POWER_CTL_LINK BIT(5)
4383

44-
#define ADXL345_DATA_FORMAT_RANGE GENMASK(1, 0) /* Set the g range */
45-
#define ADXL345_DATA_FORMAT_JUSTIFY BIT(2) /* Left-justified (MSB) mode */
46-
#define ADXL345_DATA_FORMAT_FULL_RES BIT(3) /* Up to 13-bits resolution */
47-
#define ADXL345_DATA_FORMAT_SPI_3WIRE BIT(6) /* 3-wire SPI mode */
48-
#define ADXL345_DATA_FORMAT_SELF_TEST BIT(7) /* Enable a self test */
49-
84+
/* Set the g range */
85+
#define ADXL345_DATA_FORMAT_RANGE GENMASK(1, 0)
86+
/* Data is left justified */
87+
#define ADXL345_DATA_FORMAT_JUSTIFY BIT(2)
88+
/* Up to 13-bits resolution */
89+
#define ADXL345_DATA_FORMAT_FULL_RES BIT(3)
90+
#define ADXL345_DATA_FORMAT_SPI_3WIRE BIT(6)
91+
#define ADXL345_DATA_FORMAT_SELF_TEST BIT(7)
5092
#define ADXL345_DATA_FORMAT_2G 0
5193
#define ADXL345_DATA_FORMAT_4G 1
5294
#define ADXL345_DATA_FORMAT_8G 2

0 commit comments

Comments
 (0)