-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setComparatorPolarity and setComparatorLatch are inverting the setting? #80
Comments
Thanks for the issue, |
@HineSite It checks all the "configuration flags". //
// FILE: ADS_test_config.ino
// AUTHOR: Rob.Tillaart
// PURPOSE: test config flags
// URL: https://github.com/RobTillaart/ADS1X15
// triggered by issue 80
#include "ADS1X15.h"
ADS1115 ADS(0x48);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("ADS1X15_LIB_VERSION: ");
Serial.println(ADS1X15_LIB_VERSION);
Wire.begin();
ADS.begin();
Serial.println("\nTEST GAIN");
int gain = 16;
for (int i = 0; i < 6; i++)
{
Serial.print(gain);
ADS.setGain(gain);
if (ADS.getGain() == gain) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST DATARATE");
for (int i = 0; i < 7; i++)
{
Serial.print(i);
ADS.setDataRate(i);
if (ADS.getDataRate() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST MODE");
for (int i = 0; i < 2; i++)
{
Serial.print(i);
ADS.setMode(i);
if (ADS.getMode() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST COMP MODE");
for (int i = 0; i < 2; i++)
{
Serial.print(i);
ADS.setComparatorMode(i);
if (ADS.getComparatorMode() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST COMP POLARITY");
for (int i = 0; i < 2; i++)
{
Serial.print(i);
ADS.setComparatorPolarity(i);
if (ADS.getComparatorPolarity() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST COMP LATCH");
for (int i = 0; i < 2; i++)
{
Serial.print(i);
ADS.setComparatorLatch(i);
if (ADS.getComparatorLatch() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\nTEST COMP QUECONVERT");
for (int i = 0; i < 2; i++)
{
Serial.print(i);
ADS.setComparatorQueConvert(i);
if (ADS.getComparatorQueConvert() == i) Serial.println("\tOK");
else Serial.println("\tFAIL");
}
Serial.println("\ndone...");
}
void loop()
{
}
// -- END OF FILE -- |
Note to myself: check if unit tests can be added |
@HineSite If the readme.md needs additional information on latch/polarity topic feel free to provide such. |
@HineSite |
This is the results when ran against 0.4.5
|
Thanks for running the testcode |
Here are the results against the development branch.
|
@HineSite |
I could be wrong, but I don't think these are correct?
Based on how the registers are being set later:
Example:
Results:
Polarity: 0 | Latch: 0
The text was updated successfully, but these errors were encountered: