From 54a0bdb7d8375c9ecf75beacc038e66ce8b1b75d Mon Sep 17 00:00:00 2001 From: William Clark Date: Sat, 6 Jan 2024 17:25:44 +0000 Subject: [PATCH] README --- README.md | 8 ++++---- example/README.md | 13 ++++++++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e0a94a5..df179a4 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,11 @@ This project has example interface code for I2C and SPI used on Raspberry Pi 4, ```c /* initialise the "interface" */ int init(void); -/* read from register `reg`, `size` amount of bytes, and write them to `dst` */ +/* read from register `reg', `size' amount of bytes, and write them to `dst' */ int read(uint8_t reg, uint8_t *dst, uint32_t size); -/* write `value` to register `reg` */ +/* write `value' to register `reg' */ int write(uint8_t reg, uint8_t value); -/* sleep for `dur_us` microseconds */ +/* sleep for `dur_us' microseconds */ int sleep(uint32_t dur_us); /* deinitalise the "interface" */ int deinit(void); @@ -42,7 +42,7 @@ If `init` and/or `deinit` are set to `NULL`, they will be ignored. Useful on mic ### STM32 ```c -#define LIS3DH_I2C_ADDR 0x18 +#define LIS3DH_I2C_ADDR 0x18 /* can also be 0x19 */ int i2c_write(uint8_t reg, uint8_t value) { uint8_t buf[2] = { reg, value }; diff --git a/example/README.md b/example/README.md index 85b941f..e29025d 100644 --- a/example/README.md +++ b/example/README.md @@ -4,15 +4,22 @@ Basic example of how to use this device ### file: fifo.c -Instead of polling for every single [x y z] set, a FIFO with programmable capacity ("watermark") can be used, and then dumped into memory once full. All FIFO readings use 10-bit resolution regardless of the mode set in `cfg.mode`. The watermark level can be adjusted to a value [1-32] (0 disables FIFO) by modifying the `cfg.fifo.size` property before calling `lis3dh_configure()`. +Instead of polling for every single [x y z] set, a FIFO with programmable capacity ("watermark") can be used, and then dumped into memory once full. + +All FIFO readings use 10-bit resolution regardless of the mode set in `cfg.mode`. + +The watermark level can be adjusted to a value [1-32] (0 disables FIFO) by modifying the `cfg.fifo.size` property before calling `lis3dh_configure()`. The LIS3DH can optionally apply a HP filter on the sampling to reduce 'static acceleration' from the data. -Note: it seems that the highest data rate (ODR) possible using FIFO is 200 Hz, faster than that and it does not want to restart after 1 FIFO buffer. To faster faster, such as at the advertised 5 KHz rate, you have to use `lis3dh_read()`. + +Note: it seems that the highest data rate (ODR) possible using FIFO is 200 Hz, faster than that and it does not want to restart after 1 FIFO buffer. To sample faster, such as at the advertised 5 KHz rate, you have to use `lis3dh_read()` with `LP` mode. ### file: interrupts.c This device supports two different interrupt "output pins," `INT1` and `INT2`. The appropriate flag must be set in either `cfg.pin1` or `cfg.pin2` and the interrupt source must be configured to trigger into `INT1` or `INT2`. -This file contains example code that listens and receives an interrupt when the FIFO overrun is reached i.e. it is full. Note: `pin1.wtm` will NOT trigger if the FIFO size is 32 (default). Use `pin1.overrun` if you want an interrupt when the FIFO is full at full size (32.) +This file contains example code that listens and receives an interrupt when the FIFO overrun is reached i.e. it is full. + +Note: `pin1.wtm` will NOT trigger if the FIFO size is 32 (default). Use `pin1.overrun` if you want an interrupt when the FIFO is full at full size (32.) ### file: single-click.c