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.h
- 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. * Header 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 ). */ #ifndef HX711_H #define HX711_H #include "mbed.h" /** Example: [todo] */ /*! Library for the HX711 24-Bit Analog-to-Digital Converter (ADC) for Weigh Scales. */ class HX711 { public: /** * @brief CHANNELS & GAIN */ typedef enum { CHANNEL_A_GAIN_128 = 0, /*!< Channel A 128 Gain. */ CHANNEL_B_GAIN_32 = 1, /*!< Channel B 32 Gain. */ CHANNEL_A_GAIN_64 = 2 /*!< Channel A 64 Gain. */ } HX711_channel_gain_t; /** * @brief READY/#BUSY BIT */ typedef enum { HX711_DATA_BUSY = 0, /*!< HX711 data is NOT ready to be read. */ HX711_DATA_READY = 1 /*!< HX711 data is ready to be read. */ } HX711_data_output_status_t; /* #ifndef VECTOR_STRUCT_H #define VECTOR_STRUCT_H typedef struct { uint16_t EEPROM_Data; uint16_t DAC_Data; } Vector_data_t; typedef struct { uint32_t DAC_New_Value; } Vector_new_dac_value_t; #endif */ /** * @brief INTERNAL CONSTANTS */ #define HX711_PIN_HIGH 0x00 /*!< Pin 'HIGH' */ #define HX711_PIN_LOW 0x00 /*!< Pin 'LOW' */ typedef enum { HX711_SUCCESS = 0, HX711_FAILURE = 1, } HX711_status_t; /** Create an HX711 object connected to the specified pins. * * @param pd_sck HX711 Power down control (high active) and serial clock input * @param dout HX711 Serial data output * @param myChannelGain HX711 Channel and Gain */ HX711 ( PinName PD_SCK, PinName DOUT, HX711_channel_gain_t myChannel_Gain ); /** Delete HX711 object. */ ~HX711(); /** It performs an internal reset. */ HX711_status_t HX711_Reset ( void ); /** It puts the device into power-down mode. */ HX711_status_t HX711_PowerDown ( void ); private: DigitalOut _PD_SCK; DigitalIn _DOUT; uint32_t _HX711_CHANNEL_GAIN; }; #endif