summaryrefslogtreecommitdiffstats
path: root/watch-library
diff options
context:
space:
mode:
authorJoey Castillo <joeycastillo@utexas.edu>2022-02-19 13:12:04 -0500
committerJoey Castillo <joeycastillo@utexas.edu>2022-02-19 13:12:04 -0500
commit9f0f72eb203ae1fe93c850a38a6a9de9ab192ba8 (patch)
tree98242256a61cb18d1a500c321b6520bbd0108004 /watch-library
parent3392f73d360c46d2bd79eec2c530a78d9657cf8c (diff)
downloadSensor-Watch-9f0f72eb203ae1fe93c850a38a6a9de9ab192ba8.tar.gz
Sensor-Watch-9f0f72eb203ae1fe93c850a38a6a9de9ab192ba8.tar.bz2
Sensor-Watch-9f0f72eb203ae1fe93c850a38a6a9de9ab192ba8.zip
lis2dw: add support for temperature sensing
Diffstat (limited to 'watch-library')
-rw-r--r--watch-library/shared/driver/lis2dw.c4
-rw-r--r--watch-library/shared/driver/lis2dw.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/watch-library/shared/driver/lis2dw.c b/watch-library/shared/driver/lis2dw.c
index 318ea2e8..f5d83b14 100644
--- a/watch-library/shared/driver/lis2dw.c
+++ b/watch-library/shared/driver/lis2dw.c
@@ -91,6 +91,10 @@ lis2dw_reading_t lis2dw_get_raw_reading(void) {
return retval;
}
+uint16_t lis2dw_get_temperature(void) {
+ return watch_i2c_read16(LIS2DW_ADDRESS, LIS2DW_REG_OUT_TEMP_L);
+}
+
void lis2dw_set_range(lis2dw_range_t range) {
uint8_t val = watch_i2c_read8(LIS2DW_ADDRESS, LIS2DW_REG_CTRL6) & ~(LIS2DW_RANGE_16_G << 4);
uint8_t bits = range << 4;
diff --git a/watch-library/shared/driver/lis2dw.h b/watch-library/shared/driver/lis2dw.h
index ac5de929..25814634 100644
--- a/watch-library/shared/driver/lis2dw.h
+++ b/watch-library/shared/driver/lis2dw.h
@@ -275,6 +275,8 @@ lis2dw_reading_t lis2dw_get_raw_reading(void);
lis2dw_acceleration_measurement_t lis2dw_get_acceleration_measurement(lis2dw_reading_t *out_reading);
+uint16_t lis2dw_get_temperature(void);
+
void lis2dw_set_range(lis2dw_range_t range);
lis2dw_range_t lis2dw_get_range(void);