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.
HY3116.h
00001 #include "main.h" 00002 #include "mbed.h" 00003 00004 /** 00005 * Define I2C addresses for the device 00006 */ 00007 #define HY3116_ADDRESS 0xA0 00008 #define RESET_ADDRESS 0x00 00009 00010 /** 00011 * Define settings & I2C command registers 00012 */ 00013 #define SYS 0x00 00014 #define ADC1 0x01 00015 #define ADC2 0x02 00016 #define ADC3 0x03 00017 #define ADC4 0x04 00018 #define ADO 0x05 00019 #define RESET 0x06 00020 00021 /** 00022 * HY3116 class definition 00023 */ 00024 class HY3116 00025 { 00026 public: 00027 HY3116(); 00028 HY3116(PinName sda, PinName scl); 00029 HY3116(PinName sda, PinName scl, int freq); 00030 ~HY3116(); 00031 uint8_t readAdc(int32_t *_adcReading); 00032 bool init(); 00033 00034 private: 00035 I2C i2c; 00036 00037 int writeRegister(uint8_t regAddress, uint8_t data); 00038 int readRegister(uint8_t regAddress, uint8_t byteNum, uint8_t* dest); 00039 int resetChip(); 00040 };
Generated on Thu Jul 14 2022 23:25:52 by
