Skip to content
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

Unpull DOUT pin for ESPRESSIF boards #193

Merged
merged 2 commits into from
Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/HX711.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ uint8_t shiftInSlow(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
#define SHIFTIN_WITH_SPEED_SUPPORT(data,clock,order) shiftIn(data,clock,order)
#endif

#ifdef ARCH_ESPRESSIF
// ESP8266 doesn't read values between 0x20000 and 0x30000 when DOUT is pulled up.
#define DOUT_MODE INPUT
#else
#define DOUT_MODE INPUT_PULLUP
#endif


HX711::HX711() {
}
Expand All @@ -73,7 +80,7 @@ void HX711::begin(byte dout, byte pd_sck, byte gain) {
DOUT = dout;

pinMode(PD_SCK, OUTPUT);
pinMode(DOUT, INPUT_PULLUP);
pinMode(DOUT, DOUT_MODE);

set_gain(gain);
}
Expand Down