Compare commits
No commits in common. "c96f77127dd330bf1032db5b2f6276b970e253be" and "7e8652c3b19c092cf34c40e06c52452adeb6c977" have entirely different histories.
c96f77127d
...
7e8652c3b1
103
README.md
103
README.md
@ -140,7 +140,13 @@ $ ./lis3dh
|
|||||||
x: 0.534000, y: -0.882000, z: -0.102000
|
x: 0.534000, y: -0.882000, z: -0.102000
|
||||||
x: 0.538000, y: -0.866000, z: -0.136000
|
x: 0.538000, y: -0.866000, z: -0.136000
|
||||||
x: 0.518000, y: -0.846000, z: -0.100000
|
x: 0.518000, y: -0.846000, z: -0.100000
|
||||||
...
|
x: 0.518000, y: -0.840000, z: -0.098000
|
||||||
|
x: 0.542000, y: -0.876000, z: -0.098000
|
||||||
|
x: 0.518000, y: -0.834000, z: -0.146000
|
||||||
|
x: 0.512000, y: -0.854000, z: -0.106000
|
||||||
|
x: 0.574000, y: -0.870000, z: -0.122000
|
||||||
|
x: 0.518000, y: -0.846000, z: -0.098000
|
||||||
|
x: 0.516000, y: -0.852000, z: -0.112000
|
||||||
```
|
```
|
||||||
## Using FIFO
|
## Using FIFO
|
||||||
Instead of polling for every single [x y z] set, a FIFO with programmable capacity ("watermark") can be used like such:
|
Instead of polling for every single [x y z] set, a FIFO with programmable capacity ("watermark") can be used like such:
|
||||||
@ -205,7 +211,35 @@ $ ./lis3dh
|
|||||||
x: 0.544000, y: -0.904000, z: -0.104000
|
x: 0.544000, y: -0.904000, z: -0.104000
|
||||||
x: 0.536000, y: -0.880000, z: -0.104000
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
x: 0.528000, y: -0.880000, z: -0.104000
|
x: 0.528000, y: -0.880000, z: -0.104000
|
||||||
...
|
x: 0.528000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.104000
|
||||||
|
x: 0.536000, y: -0.880000, z: -0.128000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.568000, y: -0.872000, z: -0.160000
|
||||||
|
x: 0.560000, y: -0.872000, z: -0.160000
|
||||||
```
|
```
|
||||||
## Using the HP filter
|
## Using the HP filter
|
||||||
The LIS3DH can optionally apply a HP filter on the sample data. It can be used to greatly reduce the "DC acceleration" present.
|
The LIS3DH can optionally apply a HP filter on the sample data. It can be used to greatly reduce the "DC acceleration" present.
|
||||||
@ -269,7 +303,35 @@ $ ./lis3dh
|
|||||||
x: 0.008000, y: 0.000000, z: 0.000000
|
x: 0.008000, y: 0.000000, z: 0.000000
|
||||||
x: 0.000000, y: 0.000000, z: 0.016000
|
x: 0.000000, y: 0.000000, z: 0.016000
|
||||||
x: -0.016000, y: -0.008000, z: -0.008000
|
x: -0.016000, y: -0.008000, z: -0.008000
|
||||||
...
|
x: -0.032000, y: 0.008000, z: 0.000000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.032000
|
||||||
|
x: 0.024000, y: -0.016000, z: -0.008000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.016000, y: -0.032000, z: -0.040000
|
||||||
|
x: -0.008000, y: -0.024000, z: -0.008000
|
||||||
```
|
```
|
||||||
## Using interrupts
|
## Using interrupts
|
||||||
|
|
||||||
@ -349,10 +411,37 @@ int main() {
|
|||||||
Output:
|
Output:
|
||||||
```
|
```
|
||||||
$ ./lis3dh
|
$ ./lis3dh
|
||||||
0.2040 -1.0120 -0.1720
|
0.2040 -1.0120 -0.1720 1.0466
|
||||||
0.2200 -1.0200 -0.1600
|
0.2200 -1.0200 -0.1600 1.0557
|
||||||
0.2160 -1.0200 -0.1600
|
0.2160 -1.0200 -0.1600 1.0548
|
||||||
...
|
0.2120 -1.0240 -0.1600 1.0579
|
||||||
|
0.2200 -1.0160 -0.1760 1.0543
|
||||||
|
0.2080 -0.9960 -0.1720 1.0319
|
||||||
|
0.2080 -0.9960 -0.1760 1.0326
|
||||||
|
0.2200 -1.0200 -0.1600 1.0557
|
||||||
|
0.2200 -1.0160 -0.1560 1.0512
|
||||||
|
0.2160 -1.0200 -0.1600 1.0548
|
||||||
|
0.2120 -1.0240 -0.1520 1.0567
|
||||||
|
0.2200 -1.0240 -0.1520 1.0583
|
||||||
|
0.2160 -1.0200 -0.1520 1.0536
|
||||||
|
0.2160 -1.0200 -0.1560 1.0542
|
||||||
|
0.2080 -0.9960 -0.1760 1.0326
|
||||||
|
0.2200 -1.0240 -0.1600 1.0595
|
||||||
|
0.2120 -1.0000 -0.1720 1.0366
|
||||||
|
0.2120 -0.9960 -0.1760 1.0334
|
||||||
|
0.2200 -1.0240 -0.1600 1.0595
|
||||||
|
0.2200 -1.0200 -0.1600 1.0557
|
||||||
|
0.2080 -0.9960 -0.1640 1.0306
|
||||||
|
0.1920 -1.0080 -0.1600 1.0385
|
||||||
|
0.2080 -1.0080 -0.1600 1.0416
|
||||||
|
0.2200 -1.0240 -0.1520 1.0583
|
||||||
|
0.2080 -1.0000 -0.1720 1.0358
|
||||||
|
0.2080 -0.9960 -0.1480 1.0282
|
||||||
|
0.2040 -1.0240 -0.1560 1.0557
|
||||||
|
0.2200 -1.0240 -0.1560 1.0589
|
||||||
|
0.2120 -1.0040 -0.1520 1.0373
|
||||||
|
0.2120 -1.0200 -0.1560 1.0534
|
||||||
|
0.2200 -1.0240 -0.1560 1.0589
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using i2c on STM32
|
### Using i2c on STM32
|
||||||
|
1
main.c
1
main.c
@ -17,6 +17,7 @@ float mag(float x, float y, float z) {
|
|||||||
/* print message then exit */
|
/* print message then exit */
|
||||||
void quit(const char *msg, lis3dh_t *lis) {
|
void quit(const char *msg, lis3dh_t *lis) {
|
||||||
lis->dev.deinit();
|
lis->dev.deinit();
|
||||||
|
int_unregister(GPIO_INTERRUPT_PIN);
|
||||||
fprintf(stderr, "%s\n", msg);
|
fprintf(stderr, "%s\n", msg);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user