From f742a1495b121261434a9f5b2bce3617bf15b957 Mon Sep 17 00:00:00 2001 From: millercommamatt <41195794+millercommamatt@users.noreply.github.com> Date: Wed, 26 Nov 2025 10:49:17 -0500 Subject: [PATCH 1/4] Added set PGA bypass method Added set PGA bypass method Addressing user need from: https://forums.adafruit.com/viewtopic.php?t=221332 --- Adafruit_NAU7802.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Adafruit_NAU7802.cpp b/Adafruit_NAU7802.cpp index 7cec0db..5dd381f 100644 --- a/Adafruit_NAU7802.cpp +++ b/Adafruit_NAU7802.cpp @@ -337,6 +337,24 @@ bool Adafruit_NAU7802::setPGACap(bool enable) { return true; } +/**************************************************************************/ +/*! + @brief Enable or disable optional PGA bypass. + @param enable Use true to enable or false to disable + @return False if any I2C error occurred +*/ +/**************************************************************************/ +bool Adafruit_NAU7802::setPGABypass(bool enable) { + Adafruit_BusIO_Register bypass_reg(i2c_dev, NAU7802_PGA_REG, 1,4); // # bits, bit_shift + return bypass_reg.write(value); + Adafruit_I2CRegister bypass_reg = Adafruit_I2CRegister(i2c_dev, NAU7802_PGA_REG); + Adafruit_I2CRegisterBits bypass_set = + Adafruit_I2CRegisterBits(&bypass_reg, 1, 4); // # bits, bit_shift + if (!bypass_set.write(enable ? 1 : 0)) + return false; + return true; +} + /**************************************************************************/ /*! @brief Perform the internal calibration procedure From 732394f1c1566fdbe378c0d6d513d09d4a721ea9 Mon Sep 17 00:00:00 2001 From: millercommamatt <41195794+millercommamatt@users.noreply.github.com> Date: Wed, 26 Nov 2025 10:51:28 -0500 Subject: [PATCH 2/4] Added set PGA bypass method Added set PGA bypass method Addressing user need from: https://forums.adafruit.com/viewtopic.php?t=221332 --- Adafruit_NAU7802.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Adafruit_NAU7802.h b/Adafruit_NAU7802.h index e1a8966..8f801f4 100644 --- a/Adafruit_NAU7802.h +++ b/Adafruit_NAU7802.h @@ -93,6 +93,7 @@ class Adafruit_NAU7802 { bool setRate(NAU7802_SampleRate gain); NAU7802_SampleRate getRate(void); bool setPGACap(bool enable); + bool setPGABypass(bool enable); bool calibrate(NAU7802_Calibration mode); private: From 3e545ccc7d49182c125ba282b9e0c714312fcd3b Mon Sep 17 00:00:00 2001 From: millercommamatt <41195794+millercommamatt@users.noreply.github.com> Date: Wed, 26 Nov 2025 10:59:15 -0500 Subject: [PATCH 3/4] Update Adafruit_NAU7802.cpp Fixing where I copy and pasted too much --- Adafruit_NAU7802.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Adafruit_NAU7802.cpp b/Adafruit_NAU7802.cpp index 5dd381f..1ce44f0 100644 --- a/Adafruit_NAU7802.cpp +++ b/Adafruit_NAU7802.cpp @@ -345,8 +345,6 @@ bool Adafruit_NAU7802::setPGACap(bool enable) { */ /**************************************************************************/ bool Adafruit_NAU7802::setPGABypass(bool enable) { - Adafruit_BusIO_Register bypass_reg(i2c_dev, NAU7802_PGA_REG, 1,4); // # bits, bit_shift - return bypass_reg.write(value); Adafruit_I2CRegister bypass_reg = Adafruit_I2CRegister(i2c_dev, NAU7802_PGA_REG); Adafruit_I2CRegisterBits bypass_set = Adafruit_I2CRegisterBits(&bypass_reg, 1, 4); // # bits, bit_shift From db2f5999b6351f110394965a2bfaf1468307a01c Mon Sep 17 00:00:00 2001 From: millercommamatt <41195794+millercommamatt@users.noreply.github.com> Date: Wed, 26 Nov 2025 11:07:35 -0500 Subject: [PATCH 4/4] Update Adafruit_NAU7802.cpp Fixing misnamed register... I'm going to stop letting Gemini draft my code. --- Adafruit_NAU7802.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adafruit_NAU7802.cpp b/Adafruit_NAU7802.cpp index 1ce44f0..6269278 100644 --- a/Adafruit_NAU7802.cpp +++ b/Adafruit_NAU7802.cpp @@ -345,7 +345,7 @@ bool Adafruit_NAU7802::setPGACap(bool enable) { */ /**************************************************************************/ bool Adafruit_NAU7802::setPGABypass(bool enable) { - Adafruit_I2CRegister bypass_reg = Adafruit_I2CRegister(i2c_dev, NAU7802_PGA_REG); + Adafruit_I2CRegister bypass_reg = Adafruit_I2CRegister(i2c_dev, NAU7802_PGA); Adafruit_I2CRegisterBits bypass_set = Adafruit_I2CRegisterBits(&bypass_reg, 1, 4); // # bits, bit_shift if (!bypass_set.write(enable ? 1 : 0))