From 32692475a89024409d081e1bed6f8185deadb135 Mon Sep 17 00:00:00 2001 From: tyeth Date: Wed, 24 Apr 2024 21:30:26 +0100 Subject: [PATCH 1/8] Add NAU7802 --- library.properties | 2 +- platformio.ini | 1 + src/components/i2c/WipperSnapper_I2C.cpp | 11 ++ src/components/i2c/WipperSnapper_I2C.h | 2 + .../WipperSnapper_I2C_Driver_NAU7802.h | 102 ++++++++++++++++++ 5 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h diff --git a/library.properties b/library.properties index 7b9005467..e6ef4c5bb 100644 --- a/library.properties +++ b/library.properties @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper category=Communication url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino architectures=* -depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit INA219, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork +depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit INA219, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork diff --git a/platformio.ini b/platformio.ini index fb4ad821d..4b97b2e4a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -47,6 +47,7 @@ lib_deps = adafruit/Adafruit MPL115A2 adafruit/Adafruit MPRLS Library adafruit/Adafruit MS8607 + adafruit/Adafruit NAU7802 Library adafruit/Adafruit TMP117 adafruit/Adafruit TSL2591 Library adafruit/Adafruit_VL53L0X diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 144938cc8..9f75e4cb7 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -386,6 +386,17 @@ bool WipperSnapper_Component_I2C::initI2CDevice( _ltr329->configureDriver(msgDeviceInitReq); drivers.push_back(_ltr329); WS_DEBUG_PRINTLN("LTR329/303 Initialized Successfully!"); + } else if (strcmp("nau7802", msgDeviceInitReq->i2c_device_name) == 0) { + _nau7802 = new WipperSnapper_I2C_Driver_NAU7802(this->_i2c, i2cAddress); + if (!_nau7802->begin()) { + WS_DEBUG_PRINTLN("ERROR: Failed to initialize NAU7802/303"); + _busStatusResponse = + wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL; + return false; + } + _nau7802->configureDriver(msgDeviceInitReq); + drivers.push_back(_nau7802); + WS_DEBUG_PRINTLN("NAU7802/303 Initialized Successfully!"); } else if (strcmp("sgp30", msgDeviceInitReq->i2c_device_name) == 0) { _sgp30 = new WipperSnapper_I2C_Driver_SGP30(this->_i2c, i2cAddress); if (!_sgp30->begin()) { diff --git a/src/components/i2c/WipperSnapper_I2C.h b/src/components/i2c/WipperSnapper_I2C.h index c408eac3a..ed57cf6c6 100644 --- a/src/components/i2c/WipperSnapper_I2C.h +++ b/src/components/i2c/WipperSnapper_I2C.h @@ -45,6 +45,7 @@ #include "drivers/WipperSnapper_I2C_Driver_MPL115A2.h" #include "drivers/WipperSnapper_I2C_Driver_MPRLS.h" #include "drivers/WipperSnapper_I2C_Driver_MS8607.h" +#include "drivers/WipperSnapper_I2C_Driver_NAU7802.h" #include "drivers/WipperSnapper_I2C_Driver_PCT2075.h" #include "drivers/WipperSnapper_I2C_Driver_PM25.h" #include "drivers/WipperSnapper_I2C_Driver_SCD30.h" @@ -134,6 +135,7 @@ class WipperSnapper_Component_I2C { WipperSnapper_I2C_Driver_MPL115A2 *_mpl115a2 = nullptr; WipperSnapper_I2C_Driver_MPRLS *_mprls = nullptr; WipperSnapper_I2C_Driver_MS8607 *_ms8607 = nullptr; + WipperSnapper_I2C_Driver_NAU7802 *_nau7802 = nullptr; WipperSnapper_I2C_Driver_TMP117 *_tmp117 = nullptr; WipperSnapper_I2C_Driver_TSL2591 *_tsl2591 = nullptr; WipperSnapper_I2C_Driver_VCNL4020 *_vcnl4020 = nullptr; diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h new file mode 100644 index 000000000..e71e7249c --- /dev/null +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -0,0 +1,102 @@ +/*! + * @file WipperSnapper_I2C_Driver_NAU7802.h + * + * Device driver for the NAU7802 24bit ADC / load cell breakout + * + * Adafruit invests time and resources providing this open source code, + * please support Adafruit and open-source hardware by purchasing + * products from Adafruit! + * + * Copyright (c) Tyeth Gundry for Adafruit Industries 2024 + * + * MIT license, all text here must be included in any redistribution. + * + */ + +#ifndef WipperSnapper_I2C_Driver_NAU7802_H +#define WipperSnapper_I2C_Driver_NAU7802_H + +#include "WipperSnapper_I2C_Driver.h" +#include + +/**************************************************************************/ +/*! + @brief Class that provides a driver interface for the NAU7802. +*/ +/**************************************************************************/ +class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { +public: + /*******************************************************************************/ + /*! + @brief Constructor for an NAU7802. + @param i2c + The I2C interface. + @param sensorAddress + 7-bit device address. + */ + /*******************************************************************************/ + WipperSnapper_I2C_Driver_NAU7802(TwoWire *i2c, uint16_t sensorAddress) + : WipperSnapper_I2C_Driver(i2c, sensorAddress) { + _i2c = i2c; + _sensorAddress = sensorAddress; + _nau7802 = new Adafruit_NAU7802(); + } + + /*******************************************************************************/ + /*! + @brief Destructor for an NAU7802. + */ + /*******************************************************************************/ + ~WipperSnapper_I2C_Driver_NAU7802() { _nau7802 = nullptr; } + + /*******************************************************************************/ + /*! + @brief Initializes the NAU7802 sensor and begins I2C. + @returns True if initialized successfully, False otherwise. + */ + /*******************************************************************************/ + bool begin() { + if (!_nau7802->begin(_i2c)) + return false; + + if (!_nau7802->setLDO(NAU7802_3V0)) { + WS_DEBUG_PRINTLN("Failed to set LDO to 3V0"); + } + + if (!_nau7802->setGain(NAU7802_GAIN_128)) { + WS_DEBUG_PRINTLN("Failed to set gain to 128"); + } + + if (!_nau7802->setRate(NAU7802_RATE_10SPS)) { + WS_DEBUG_PRINTLN("Failed to set sample rate to 10SPS"); + } + return true; + } + + /*******************************************************************************/ + /*! + @brief Gets the sensor's raw "force" value. + @param rawEvent + Pointer to an Adafruit_Sensor event. + @returns True if the reading was obtained successfully, False otherwise. + */ + /*******************************************************************************/ + bool getEventRaw(sensors_event_t *rawEvent) { + unsigned long start = millis(); + + // Wait for the sensor to be ready + while (!_nau7802->available()) { + if (millis() - start > 1000) { + WS_DEBUG_PRINTLN("NAU7802 not available"); + return false; + } + } + rawEvent->data[0] = (float)_nau7802->read(); + return true; + } + +protected: + Adafruit_NAU7802 *_nau7802 = nullptr; ///< NAU7802 object +}; + +#endif // WipperSnapper_I2C_Driver_NAU7802_H \ No newline at end of file From 1d650a02f0cebd8a8a3d9c9fc2f6697c87394c16 Mon Sep 17 00:00:00 2001 From: tyeth Date: Fri, 3 May 2024 14:19:48 +0100 Subject: [PATCH 2/8] Updates from PR feedback + build settings --- .vscode/settings.json | 5 ++-- src/components/i2c/WipperSnapper_I2C.cpp | 4 ++-- .../WipperSnapper_I2C_Driver_NAU7802.h | 23 +++++++++++-------- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 6bad5c070..65076780b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "limits": "c", "type_traits": "c" }, - "C_Cpp.dimInactiveRegions": false, - "dotnet.defaultSolution": "disable" + "C_Cpp.dimInactiveRegions": true, + "dotnet.defaultSolution": "disable", + "cmake.configureOnOpen": false } \ No newline at end of file diff --git a/src/components/i2c/WipperSnapper_I2C.cpp b/src/components/i2c/WipperSnapper_I2C.cpp index 9f75e4cb7..ba82da678 100644 --- a/src/components/i2c/WipperSnapper_I2C.cpp +++ b/src/components/i2c/WipperSnapper_I2C.cpp @@ -389,14 +389,14 @@ bool WipperSnapper_Component_I2C::initI2CDevice( } else if (strcmp("nau7802", msgDeviceInitReq->i2c_device_name) == 0) { _nau7802 = new WipperSnapper_I2C_Driver_NAU7802(this->_i2c, i2cAddress); if (!_nau7802->begin()) { - WS_DEBUG_PRINTLN("ERROR: Failed to initialize NAU7802/303"); + WS_DEBUG_PRINTLN("ERROR: Failed to initialize NAU7802"); _busStatusResponse = wippersnapper_i2c_v1_BusResponse_BUS_RESPONSE_DEVICE_INIT_FAIL; return false; } _nau7802->configureDriver(msgDeviceInitReq); drivers.push_back(_nau7802); - WS_DEBUG_PRINTLN("NAU7802/303 Initialized Successfully!"); + WS_DEBUG_PRINTLN("NAU7802 Initialized Successfully!"); } else if (strcmp("sgp30", msgDeviceInitReq->i2c_device_name) == 0) { _sgp30 = new WipperSnapper_I2C_Driver_SGP30(this->_i2c, i2cAddress); if (!_sgp30->begin()) { diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index e71e7249c..16fb74e6f 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -19,6 +19,8 @@ #include "WipperSnapper_I2C_Driver.h" #include +#define NAU7802_TIMEOUT_MS 250 // Timeout waiting for data from NAU7802 + /**************************************************************************/ /*! @brief Class that provides a driver interface for the NAU7802. @@ -55,20 +57,23 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { @returns True if initialized successfully, False otherwise. */ /*******************************************************************************/ - bool begin() { - if (!_nau7802->begin(_i2c)) - return false; + bool begin() { return _nau7802->begin(_i2c) && configure_nau7802(); } + /*******************************************************************************/ + /*! + @brief Configures the NAU7802 sensor. + @returns True if configured successfully, False otherwise. + */ + /*******************************************************************************/ + bool configure_nau7802() { if (!_nau7802->setLDO(NAU7802_3V0)) { WS_DEBUG_PRINTLN("Failed to set LDO to 3V0"); + return false; } if (!_nau7802->setGain(NAU7802_GAIN_128)) { WS_DEBUG_PRINTLN("Failed to set gain to 128"); - } - - if (!_nau7802->setRate(NAU7802_RATE_10SPS)) { - WS_DEBUG_PRINTLN("Failed to set sample rate to 10SPS"); + return false; } return true; } @@ -86,8 +91,8 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { // Wait for the sensor to be ready while (!_nau7802->available()) { - if (millis() - start > 1000) { - WS_DEBUG_PRINTLN("NAU7802 not available"); + if (millis() - start > NAU7802_TIMEOUT_MS) { + WS_DEBUG_PRINTLN("NAU7802 data not available"); return false; } } From 0a8a784453a823bf0974129a0f47b253a91d8352 Mon Sep 17 00:00:00 2001 From: tyeth Date: Tue, 7 May 2024 13:18:25 +0100 Subject: [PATCH 3/8] WIP: revert --- .../WipperSnapper_I2C_Driver_NAU7802.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index 16fb74e6f..8fbdb9eca 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -75,6 +75,26 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { WS_DEBUG_PRINTLN("Failed to set gain to 128"); return false; } + + if (!_nau7802->setRate(NAU7802_RATE_10SPS) && + !_nau7802->setRate(NAU7802_RATE_10SPS)) { + WS_DEBUG_PRINTLN("Failed to set sample rate to 10SPS"); + return false; + } + + // Take 10 readings to flush out old readings (10 samples per second) + for (uint8_t skipCounter = 0; skipCounter < 10; skipCounter++) { + while (!_nau7802->available()) + delay(1); + _nau7802->read(); + } + + while (!_nau7802->calibrate(NAU7802_CALMOD_INTERNAL)) { + WS_DEBUG_PRINTLN("Failed to calibrate internal offset, retrying!"); + delay(1000); + } + WS_DEBUG_PRINTLN("Calibrated internal offset"); + return true; } From fecbdb693cb0bc66a9284b3e7a8d197404ab5ccb Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Fri, 17 May 2024 17:40:21 +0100 Subject: [PATCH 4/8] doxygen: nau7802 timeout --- src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index 8fbdb9eca..493f1d85b 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -19,7 +19,7 @@ #include "WipperSnapper_I2C_Driver.h" #include -#define NAU7802_TIMEOUT_MS 250 // Timeout waiting for data from NAU7802 +#define NAU7802_TIMEOUT_MS 250 //> Timeout waiting for data from NAU7802 /**************************************************************************/ /*! From c062140a862b3750eaabcbd53d2c58909aff2e8d Mon Sep 17 00:00:00 2001 From: tyeth Date: Fri, 17 May 2024 17:49:57 +0100 Subject: [PATCH 5/8] NAU7802: doxygen? --- ci | 1 + src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 ci diff --git a/ci b/ci new file mode 160000 index 000000000..72918f8b8 --- /dev/null +++ b/ci @@ -0,0 +1 @@ +Subproject commit 72918f8b8dd8655f5fc5e2a58f133a1656e43d7f diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index 493f1d85b..9829cd254 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -19,7 +19,7 @@ #include "WipperSnapper_I2C_Driver.h" #include -#define NAU7802_TIMEOUT_MS 250 //> Timeout waiting for data from NAU7802 +#define NAU7802_TIMEOUT_MS 250 ///< Timeout waiting for data from NAU7802 /**************************************************************************/ /*! From 7be1e2444b71f26053c1d9153d03659885e40981 Mon Sep 17 00:00:00 2001 From: tyeth Date: Fri, 17 May 2024 17:56:52 +0100 Subject: [PATCH 6/8] Fix: NAU7802 infinite loop waiting for calibration offset. --- .../i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index 9829cd254..f953a341c 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -89,13 +89,16 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { _nau7802->read(); } - while (!_nau7802->calibrate(NAU7802_CALMOD_INTERNAL)) { + for (int retries = 0; retries < 3; retries++) { + if (_nau7802->calibrate(NAU7802_CALMOD_INTERNAL)) { + WS_DEBUG_PRINTLN("Calibrated internal offset"); + return true; + } WS_DEBUG_PRINTLN("Failed to calibrate internal offset, retrying!"); delay(1000); } - WS_DEBUG_PRINTLN("Calibrated internal offset"); - - return true; + WS_DEBUG_PRINTLN("ERROR: Failed to calibrate internal offset of NAU7802."); + return false; } /*******************************************************************************/ From 7b2a4370458254a660ef2300d118441d5781d731 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Tue, 21 May 2024 14:31:45 +0100 Subject: [PATCH 7/8] NAU7802: refactor data flushing --- .../WipperSnapper_I2C_Driver_NAU7802.h | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index f953a341c..f1741da08 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -83,11 +83,7 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { } // Take 10 readings to flush out old readings (10 samples per second) - for (uint8_t skipCounter = 0; skipCounter < 10; skipCounter++) { - while (!_nau7802->available()) - delay(1); - _nau7802->read(); - } + flushNAU7802(10); for (int retries = 0; retries < 3; retries++) { if (_nau7802->calibrate(NAU7802_CALMOD_INTERNAL)) { @@ -101,6 +97,19 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { return false; } + /*******************************************************************************/ + /*! + @brief Gets datapoints from sensor and discards (flushes old data). + */ + /*******************************************************************************/ + void flushNAU7802(uint8_t count) { + for (uint8_t skipCounter = 0; skipCounter < count; skipCounter++) { + while (!_nau7802->available()) + delay(1); + _nau7802->read(); + } + } + /*******************************************************************************/ /*! @brief Gets the sensor's raw "force" value. From 0089c50f457e70d5b8ad272050fad56a79ac4143 Mon Sep 17 00:00:00 2001 From: Tyeth Gundry Date: Tue, 21 May 2024 15:20:14 +0100 Subject: [PATCH 8/8] NAU7802: Doxygen comments for flush method --- src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h index f1741da08..85a6ffae5 100644 --- a/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h +++ b/src/components/i2c/drivers/WipperSnapper_I2C_Driver_NAU7802.h @@ -100,6 +100,8 @@ class WipperSnapper_I2C_Driver_NAU7802 : public WipperSnapper_I2C_Driver { /*******************************************************************************/ /*! @brief Gets datapoints from sensor and discards (flushes old data). + @param count + Number of readings to discard. */ /*******************************************************************************/ void flushNAU7802(uint8_t count) {