Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: torque_calibration_ywsim
HX711.cpp
- Committer:
- mcm
- Date:
- 2017-09-11
- Revision:
- 1:06652a775538
- Parent:
- 0:3a3567ddc17e
- Child:
- 2:1af13a8a8275
File content as of revision 1:06652a775538:
/** * @brief HX711.h * @details 24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales. * Function file. * * * @return NA * * @author Manuel Caballero * @date 11/September/2017 * @version 11/September/2017 The ORIGIN * @pre NaN. * @warning NaN * @pre This code belongs to Nimbus Centre ( http://www.nimbus.cit.ie ). */ #include "HX711.h" HX711::HX711 ( PinName PD_SCK, PinName DOUT, HX711_channel_gain_t myChannel_Gain ) : _PD_SCK ( PD_SCK ) , _DOUT ( DOUT ) , _HX711_CHANNEL_GAIN ( myChannel_Gain ) { } HX711::~HX711() { } /** * @brief HX711_Reset ( void ) * * @details It performs an internal reset. * * @param[in] NaN. * * @param[out] NaN. * * * @return Status of HX711_Reset. * * * @author Manuel Caballero * @date 11/September/2017 * @version 11/September/2017 The ORIGIN * @pre When PD_SCK pin changes from low to high and stays at high for * longer than 60μs, HX711 enters power down mode. * * When PD_SCK returns to low, chip will reset and enter normal * operation mode. * @warning NaN. */ HX711::HX711_status_t HX711::HX711_Reset ( void ) { _PD_SCK = HX711_PIN_HIGH; wait ( 0.120 ); _PD_SCK = HX711_PIN_LOW; if ( _DOUT == HX711_PIN_HIGH ) return HX711_SUCCESS; else return HX711_FAILURE; } /** * @brief HX711_PowerDown ( void ) * * @details It puts the device in power-down mode. * * @param[in] NaN. * * @param[out] NaN. * * * @return Status of HX711_PowerDown. * * * @author Manuel Caballero * @date 11/September/2017 * @version 11/September/2017 The ORIGIN * @pre When PD_SCK pin changes from low to high and stays at high for * longer than 60μs, HX711 enters power down mode. * @warning NaN. */ HX711::HX711_status_t HX711::HX711_PowerDown ( void ) { _PD_SCK = HX711_PIN_HIGH; wait ( 0.120 ); if ( _DOUT == HX711_PIN_HIGH ) return HX711_SUCCESS; else return HX711_FAILURE; }