Arianna autonomous DAQ firmware

Dependencies:   mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW

Committer:
uci1
Date:
Wed Jun 05 17:29:31 2019 +0000
Revision:
125:ce4045184366
Added SnRateListner proto-class, publishing this version of the code in order to enable exporting of most recent features.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
uci1 125:ce4045184366 1 #include "SnRateListener.h"
uci1 125:ce4045184366 2 #include "SnBitUtils.h"
uci1 125:ce4045184366 3
uci1 125:ce4045184366 4 float SnRateListener::getRate()
uci1 125:ce4045184366 5 {
uci1 125:ce4045184366 6 char results[2];
uci1 125:ce4045184366 7 //Pins 9 and 10 on the LPC1768 correspond to one of two i2c buses.
uci1 125:ce4045184366 8 I2C linkToFpga(p9,p10); //declaring this locally?
uci1 125:ce4045184366 9 for(uint8_t tries=0;(tries<kMaxRateReadTries)&&(getLastAck()==false);++tries)
uci1 125:ce4045184366 10 {
uci1 125:ce4045184366 11 I2C i2c(p9,p10);
uci1 125:ce4045184366 12 setLastAck(!i2c.read(getMMFCAddress(),results,2)); //think about sizeof(uint8_t)*2 here
uci1 125:ce4045184366 13 }
uci1 125:ce4045184366 14 setMSBs(results[0]);
uci1 125:ce4045184366 15 setLSBs(results[1]);
uci1 125:ce4045184366 16 return 0.0; //add interpretation here tomorrow, June 5th, 2019 (JCH)
uci1 125:ce4045184366 17 }
uci1 125:ce4045184366 18 void SnRateListener::setMSBs(uint8_t a)
uci1 125:ce4045184366 19 {
uci1 125:ce4045184366 20 rateMSBs = a;
uci1 125:ce4045184366 21 }
uci1 125:ce4045184366 22 void SnRateListener::setLSBs(uint8_t a)
uci1 125:ce4045184366 23 {
uci1 125:ce4045184366 24 rateLSBs = a;
uci1 125:ce4045184366 25 }
uci1 125:ce4045184366 26 uint8_t SnRateListener::getMMFCAddress()
uci1 125:ce4045184366 27 {
uci1 125:ce4045184366 28 return MMFC_address;
uci1 125:ce4045184366 29 }
uci1 125:ce4045184366 30 void SnRateListener::setLastAck(bool a)
uci1 125:ce4045184366 31 {
uci1 125:ce4045184366 32 lastAcknowledge = a;
uci1 125:ce4045184366 33 }
uci1 125:ce4045184366 34 bool SnRateListener::getLastAck()
uci1 125:ce4045184366 35 {
uci1 125:ce4045184366 36 return lastAcknowledge;
uci1 125:ce4045184366 37 }