From 73e36b81b1c17b6bd80d174a928b5993cd910f3f Mon Sep 17 00:00:00 2001 From: "H. Utku Maden" Date: Sun, 22 Aug 2021 12:30:57 +0300 Subject: [PATCH] Fix error in status function. --- source/driver.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/driver.c b/source/driver.c index c5d1679..1fd449b 100644 --- a/source/driver.c +++ b/source/driver.c @@ -135,7 +135,7 @@ DS3231_API int ds3231_getStatus(ds3231_t driver, ds3231_status_t *out_status) return -1; } - ds3231_status_t rstatus; + uint8_t rstatus; if (ds3231_io_read(driver->port, DS3231_REGISTER_STATUS, &rstatus, sizeof rstatus)) { errno = EIO; @@ -424,3 +424,17 @@ DS3231_API int ds3231_endTemperature(ds3231_t driver, int16_t *out_temperature) return 0; } + +int ds3231_clearInt(ds3231_t driver) +{ + ASSERT_DRV(); + + uint8_t status = (1 << 3); + if (ds3231_io_write(driver->port, DS3231_REGISTER_STATUS, &status, sizeof status)) + { + errno = EIO; + return -1; + } + + return 0; +}