|
void HX711::powerDown() { |
|
|
|
std::lock_guard<std::mutex> lock(this->_commLock); |
|
|
|
/** |
|
* The delay between low to high is probably not necessary, but it |
|
* should help to keep the underlying code from optimising it away - |
|
* if does at all. |
|
*/ |
|
Utility::writeGpio(this->_gpioHandle, this->_clockPin, GpioLevel::LOW); |
|
Utility::delay(std::chrono::microseconds(1)); |
|
Utility::writeGpio(this->_gpioHandle, this->_clockPin, GpioLevel::HIGH); |
|
|
|
/** |
|
* "When PD_SCK pin changes from low to high |
|
* and stays at high for longer than 60µs, HX711 |
|
* enters power down mode (Fig.3)." |
|
* Datasheet pg. 5 |
|
*/ |
|
Utility::sleep(_POWER_DOWN_TIMEOUT); |
|
|
|
} |
Timeout should be separate from powering down to allow other/concurrent code to run.