Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SnRateListener.cpp Source File

SnRateListener.cpp

00001 #include "SnRateListener.h"
00002 #include "SnBitUtils.h"
00003 
00004 float SnRateListener::getRate()
00005 {
00006     char results[2];
00007     //Pins 9 and 10 on the LPC1768 correspond to one of two i2c buses.
00008     I2C linkToFpga(p9,p10); //declaring this locally?
00009     for(uint8_t tries=0;(tries<kMaxRateReadTries)&&(getLastAck()==false);++tries)
00010     {
00011         I2C i2c(p9,p10);
00012         setLastAck(!i2c.read(getMMFCAddress(),results,2)); //think about sizeof(uint8_t)*2 here
00013     }
00014     setMSBs(results[0]);
00015     setLSBs(results[1]);
00016     return 0.0; //add interpretation here tomorrow, June 5th, 2019 (JCH)
00017 }
00018 void SnRateListener::setMSBs(uint8_t a)
00019 {
00020     rateMSBs = a;
00021 }
00022 void SnRateListener::setLSBs(uint8_t a)
00023 {
00024     rateLSBs = a;
00025 }
00026 uint8_t SnRateListener::getMMFCAddress()
00027 {
00028     return MMFC_address;
00029 }
00030 void SnRateListener::setLastAck(bool a)
00031 {
00032     lastAcknowledge = a;
00033 }
00034 bool SnRateListener::getLastAck()
00035 {
00036     return lastAcknowledge;
00037 }