diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-05-03 11:20:05 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-05-21 20:16:31 -0400 |
commit | cb6cce3934bb37cd17d845b16640413b093bbe45 (patch) | |
tree | 0ac86715713916ab551190bd2560b0da9c76c03f | |
parent | 3dc7c9ab291ccbf9a90996705e3e460e680a1e8f (diff) | |
download | kutter-cb6cce3934bb37cd17d845b16640413b093bbe45.tar.gz kutter-cb6cce3934bb37cd17d845b16640413b093bbe45.tar.xz kutter-cb6cce3934bb37cd17d845b16640413b093bbe45.zip |
sensor_ldc1612: Don't require DRDY bit to be set on data read
It is not clear if DRDY is cleared during a STATUS read (which could
occur from command_query_ldc1612_status() ). So, just check the
"unread conversion" bit when reading data.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/sensor_ldc1612.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/sensor_ldc1612.c b/src/sensor_ldc1612.c index 9258ce6d..2e3f5694 100644 --- a/src/sensor_ldc1612.c +++ b/src/sensor_ldc1612.c @@ -124,7 +124,7 @@ ldc1612_query(struct ldc1612 *ld, uint8_t oid) // Check if data available uint16_t status = read_reg_status(ld); - if (status != 0x48) + if (!(status & 0x08)) return; // Read coil0 frequency @@ -185,7 +185,7 @@ command_query_ldc1612_status(uint32_t *args) uint16_t status = read_reg_status(ld); uint32_t time2 = timer_read_time(); - uint32_t fifo = status == 0x48 ? BYTES_PER_SAMPLE : 0; + uint32_t fifo = status & 0x08 ? BYTES_PER_SAMPLE : 0; sensor_bulk_status(&ld->sb, args[0], time1, time2-time1, fifo); } DECL_COMMAND(command_query_ldc1612_status, "query_ldc1612_status oid=%c"); |