diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2021-11-30 20:02:41 -0500 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2021-11-30 20:02:41 -0500 |
commit | 45282f2ef40a54e337b1596af45009c609981130 (patch) | |
tree | ee6f9f2f6edcfcf046046e5d508ebd9c69173c5d /watch-library/driver/lis2dh.c | |
parent | 4ae46f907b2c6f54f87c350920d7f297967764fe (diff) | |
download | Sensor-Watch-45282f2ef40a54e337b1596af45009c609981130.tar.gz Sensor-Watch-45282f2ef40a54e337b1596af45009c609981130.tar.bz2 Sensor-Watch-45282f2ef40a54e337b1596af45009c609981130.zip |
lis2dh driver: add support for int2 pin
Diffstat (limited to 'watch-library/driver/lis2dh.c')
-rw-r--r-- | watch-library/driver/lis2dh.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/watch-library/driver/lis2dh.c b/watch-library/driver/lis2dh.c index 2ebf53fb..8266905f 100644 --- a/watch-library/driver/lis2dh.c +++ b/watch-library/driver/lis2dh.c @@ -125,3 +125,15 @@ void lis2dh_configure_aoi_int1(lis2dh_interrupt_configuration configuration, uin lis2dh_interrupt_state lis2dh_get_int1_state() { return (lis2dh_interrupt_state) watch_i2c_read8(LIS2DH_ADDRESS, LIS2DH_REG_INT1_SRC); } + +void lis2dh_configure_aoi_int2(lis2dh_interrupt_configuration configuration, uint8_t threshold, uint8_t duration) { + watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_CTRL6, LIS2DH_CTRL6_VAL_I2_INT2); + watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_INT2_CFG, configuration); + watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_INT2_THS, threshold); + watch_i2c_write8(LIS2DH_ADDRESS, LIS2DH_REG_INT2_DUR, duration); +} + +lis2dh_interrupt_state lis2dh_get_int2_state() { + return (lis2dh_interrupt_state) watch_i2c_read8(LIS2DH_ADDRESS, LIS2DH_REG_INT2_SRC); +} + |