Library for working with the HYCON HY3116/8 24-bit weigh-scales ADC series.
HY3116.h@6:435b50250491, 2016-07-14 (annotated)
- Committer:
- seajayshore
- Date:
- Thu Jul 14 16:51:32 2016 +0000
- Revision:
- 6:435b50250491
- Parent:
- 5:3fdbe36e5057
- Child:
- 7:c9a0ce000a18
BoB_2 revision 84 update. Added DigitalIn define for the ADC_IRQ pin (incase it was causing problems left floating unknown).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
seajayshore | 6:435b50250491 | 1 | #include "main.h" |
seajayshore | 0:80768ca5d5ff | 2 | #include "mbed.h" |
seajayshore | 0:80768ca5d5ff | 3 | |
seajayshore | 0:80768ca5d5ff | 4 | #define HY3116_ADDRESS 0xA0 |
seajayshore | 0:80768ca5d5ff | 5 | |
seajayshore | 0:80768ca5d5ff | 6 | #define SYS 0x00 |
seajayshore | 0:80768ca5d5ff | 7 | #define ADC1 0x01 |
seajayshore | 0:80768ca5d5ff | 8 | #define ADC2 0x02 |
seajayshore | 0:80768ca5d5ff | 9 | #define ADC3 0x03 |
seajayshore | 0:80768ca5d5ff | 10 | #define ADC4 0x04 |
seajayshore | 0:80768ca5d5ff | 11 | #define ADO 0x05 |
seajayshore | 0:80768ca5d5ff | 12 | #define RESET 0x06 |
seajayshore | 0:80768ca5d5ff | 13 | |
seajayshore | 0:80768ca5d5ff | 14 | /* Function Prototypes */ |
seajayshore | 0:80768ca5d5ff | 15 | class HY3116 |
seajayshore | 0:80768ca5d5ff | 16 | { |
seajayshore | 2:2da9fbab02b7 | 17 | public: |
seajayshore | 5:3fdbe36e5057 | 18 | // HY3116(PinName sda, PinName scl); |
seajayshore | 5:3fdbe36e5057 | 19 | // ~HY3116(); |
seajayshore | 0:80768ca5d5ff | 20 | void writeByte(uint8_t address, uint8_t subAddress, uint8_t data); |
seajayshore | 0:80768ca5d5ff | 21 | void resetChip(); |
seajayshore | 0:80768ca5d5ff | 22 | void readBytes(uint8_t address, uint8_t subAddress, uint8_t byteNum, uint8_t* dest, bool alreadyRead); |
seajayshore | 1:1967c3f48465 | 23 | bool readAdc(int32_t *_adcReading); |
seajayshore | 0:80768ca5d5ff | 24 | void init(); |
seajayshore | 0:80768ca5d5ff | 25 | |
seajayshore | 3:535ed9a0ce59 | 26 | private: |
seajayshore | 5:3fdbe36e5057 | 27 | // I2C i2c; |
seajayshore | 3:535ed9a0ce59 | 28 | |
seajayshore | 0:80768ca5d5ff | 29 | }; |