Library for working with the HYCON HY3116/8 24-bit weigh-scales ADC series.

Committer:
seajayshore
Date:
Tue Jun 28 13:27:09 2016 +0000
Revision:
3:535ed9a0ce59
Parent:
2:2da9fbab02b7
Child:
5:3fdbe36e5057
Post-China revision, trying to use proper constructors now, incomplete

Who changed what in which revision?

UserRevisionLine numberNew contents of line
seajayshore 0:80768ca5d5ff 1 #include "mbed.h"
seajayshore 0:80768ca5d5ff 2
seajayshore 0:80768ca5d5ff 3 #define HY3116_ADDRESS 0xA0
seajayshore 0:80768ca5d5ff 4
seajayshore 0:80768ca5d5ff 5 #define SYS 0x00
seajayshore 0:80768ca5d5ff 6 #define ADC1 0x01
seajayshore 0:80768ca5d5ff 7 #define ADC2 0x02
seajayshore 0:80768ca5d5ff 8 #define ADC3 0x03
seajayshore 0:80768ca5d5ff 9 #define ADC4 0x04
seajayshore 0:80768ca5d5ff 10 #define ADO 0x05
seajayshore 0:80768ca5d5ff 11 #define RESET 0x06
seajayshore 0:80768ca5d5ff 12
seajayshore 0:80768ca5d5ff 13 /* Function Prototypes */
seajayshore 0:80768ca5d5ff 14 class HY3116
seajayshore 0:80768ca5d5ff 15 {
seajayshore 2:2da9fbab02b7 16 public:
seajayshore 3:535ed9a0ce59 17 HY3116(PinName sda, PinName scl);
seajayshore 3:535ed9a0ce59 18 ~HY3116();
seajayshore 0:80768ca5d5ff 19 void writeByte(uint8_t address, uint8_t subAddress, uint8_t data);
seajayshore 0:80768ca5d5ff 20 void resetChip();
seajayshore 0:80768ca5d5ff 21 void readBytes(uint8_t address, uint8_t subAddress, uint8_t byteNum, uint8_t* dest, bool alreadyRead);
seajayshore 1:1967c3f48465 22 bool readAdc(int32_t *_adcReading);
seajayshore 0:80768ca5d5ff 23 void init();
seajayshore 0:80768ca5d5ff 24
seajayshore 3:535ed9a0ce59 25 private:
seajayshore 3:535ed9a0ce59 26 I2C i2c;
seajayshore 3:535ed9a0ce59 27
seajayshore 0:80768ca5d5ff 28 };