Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
Diff: SnRateListener.cpp
- Revision:
- 125:ce4045184366
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SnRateListener.cpp Wed Jun 05 17:29:31 2019 +0000 @@ -0,0 +1,37 @@ +#include "SnRateListener.h" +#include "SnBitUtils.h" + +float SnRateListener::getRate() +{ + char results[2]; + //Pins 9 and 10 on the LPC1768 correspond to one of two i2c buses. + I2C linkToFpga(p9,p10); //declaring this locally? + for(uint8_t tries=0;(tries<kMaxRateReadTries)&&(getLastAck()==false);++tries) + { + I2C i2c(p9,p10); + setLastAck(!i2c.read(getMMFCAddress(),results,2)); //think about sizeof(uint8_t)*2 here + } + setMSBs(results[0]); + setLSBs(results[1]); + return 0.0; //add interpretation here tomorrow, June 5th, 2019 (JCH) +} +void SnRateListener::setMSBs(uint8_t a) +{ + rateMSBs = a; +} +void SnRateListener::setLSBs(uint8_t a) +{ + rateLSBs = a; +} +uint8_t SnRateListener::getMMFCAddress() +{ + return MMFC_address; +} +void SnRateListener::setLastAck(bool a) +{ + lastAcknowledge = a; +} +bool SnRateListener::getLastAck() +{ + return lastAcknowledge; +} \ No newline at end of file