Skip to content

Commit ab57171

Browse files
authored
Merge pull request #23 from millercommamatt/master
Add set PGA bypass method
2 parents c00c1c7 + db2f599 commit ab57171

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

Adafruit_NAU7802.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,22 @@ bool Adafruit_NAU7802::setPGACap(bool enable) {
337337
return true;
338338
}
339339

340+
/**************************************************************************/
341+
/*!
342+
@brief Enable or disable optional PGA bypass.
343+
@param enable Use true to enable or false to disable
344+
@return False if any I2C error occurred
345+
*/
346+
/**************************************************************************/
347+
bool Adafruit_NAU7802::setPGABypass(bool enable) {
348+
Adafruit_I2CRegister bypass_reg = Adafruit_I2CRegister(i2c_dev, NAU7802_PGA);
349+
Adafruit_I2CRegisterBits bypass_set =
350+
Adafruit_I2CRegisterBits(&bypass_reg, 1, 4); // # bits, bit_shift
351+
if (!bypass_set.write(enable ? 1 : 0))
352+
return false;
353+
return true;
354+
}
355+
340356
/**************************************************************************/
341357
/*!
342358
@brief Perform the internal calibration procedure

Adafruit_NAU7802.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ class Adafruit_NAU7802 {
9393
bool setRate(NAU7802_SampleRate gain);
9494
NAU7802_SampleRate getRate(void);
9595
bool setPGACap(bool enable);
96+
bool setPGABypass(bool enable);
9697
bool calibrate(NAU7802_Calibration mode);
9798

9899
private:

0 commit comments

Comments
 (0)