Arianna autonomous DAQ firmware
Dependencies: mbed SDFileSystemFilinfo AriSnProtocol NetServicesMin AriSnComm MODSERIAL PowerControlClkPatch DS1820OW
SnEventFrame.h@110:d1da040a0cf2, 2015-11-24 (annotated)
- Committer:
- uci1
- Date:
- Tue Nov 24 21:52:27 2015 +0000
- Revision:
- 110:d1da040a0cf2
- Parent:
- 84:80b15993944e
- Child:
- 114:554fa3a956b4
Stn32 (slow) with conf name. SD stall fix. No interface chip. Safety nets.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
uci1 | 0:664899e0b988 | 1 | #ifndef SN_SnEventFrame |
uci1 | 0:664899e0b988 | 2 | #define SN_SnEventFrame |
uci1 | 0:664899e0b988 | 3 | |
uci1 | 0:664899e0b988 | 4 | #include <stdint.h> |
uci1 | 0:664899e0b988 | 5 | #include "SnConstants.h" |
uci1 | 0:664899e0b988 | 6 | |
uci1 | 15:f2569d8e4176 | 7 | //#define EVDEBUG |
uci1 | 15:f2569d8e4176 | 8 | |
uci1 | 0:664899e0b988 | 9 | class SnEventFrame { |
uci1 | 0:664899e0b988 | 10 | |
uci1 | 0:664899e0b988 | 11 | public: |
uci1 | 0:664899e0b988 | 12 | // i/o version |
uci1 | 8:95a325df1f6b | 13 | static const uint8_t kIOVers; // MUST BE INCREASED if any member var changes (==> also if kNchans, etc. change!) |
uci1 | 56:0bba0ef15697 | 14 | static const uint32_t kMaxSizeOfV1 = |
uci1 | 0:664899e0b988 | 15 | ((sizeof(uint32_t)*4u)+sizeof(int32_t)+sizeof(uint16_t) |
uci1 | 56:0bba0ef15697 | 16 | +(kTotSampsAtwd4ch*sizeof(uint16_t))+1u); |
uci1 | 56:0bba0ef15697 | 17 | static const uint32_t kMaxSizeOfV2 = kMaxSizeOfV1 |
uci1 | 56:0bba0ef15697 | 18 | - (kTotSampsAtwd4ch*sizeof(uint16_t)) + (kTotSampsSst4ch*sizeof(uint16_t)) |
uci1 | 56:0bba0ef15697 | 19 | + (kNstopBytesSst4ch*sizeof(uint8_t)); |
uci1 | 56:0bba0ef15697 | 20 | static const uint32_t kMaxSizeOf = kMaxSizeOfV2; // biggest one |
uci1 | 0:664899e0b988 | 21 | |
uci1 | 0:664899e0b988 | 22 | private: |
uci1 | 0:664899e0b988 | 23 | // !! |
uci1 | 0:664899e0b988 | 24 | // !! If any member variables change, update: SizeOf function and kIOVers value! (also if kNchans, etc. change!) |
uci1 | 0:664899e0b988 | 25 | // !! |
uci1 | 0:664899e0b988 | 26 | |
uci1 | 0:664899e0b988 | 27 | uint16_t fData[kTotSamps]; // the (uncompressed) waveform data |
uci1 | 0:664899e0b988 | 28 | uint32_t fMbedTime; // mbed time in seconds since epoch |
uci1 | 0:664899e0b988 | 29 | // TODO: time since last event? |
uci1 | 0:664899e0b988 | 30 | uint32_t fEvtNum; // written event number ... |
uci1 | 0:664899e0b988 | 31 | int32_t fDTms; // time since last written event (ms) |
uci1 | 0:664899e0b988 | 32 | uint32_t fTrgNum; // this event is trigger number ... |
uci1 | 0:664899e0b988 | 33 | uint16_t fTrgBits; // trigger bit word |
uci1 | 0:664899e0b988 | 34 | mutable uint32_t fCRC; // CRC on the uncompressed waveform data |
uci1 | 56:0bba0ef15697 | 35 | #if CHIPBOARD!=ATWD4CH |
uci1 | 56:0bba0ef15697 | 36 | uint8_t fStop[kNstopBytes];// the stop bit word (one bit per sample) |
uci1 | 56:0bba0ef15697 | 37 | #endif |
uci1 | 0:664899e0b988 | 38 | // TODO: check if other parameters should be added: |
uci1 | 0:664899e0b988 | 39 | // - stop position? |
uci1 | 0:664899e0b988 | 40 | // - card(s) producing trigger? |
uci1 | 0:664899e0b988 | 41 | |
uci1 | 0:664899e0b988 | 42 | void CalcCRC(); |
uci1 | 0:664899e0b988 | 43 | |
uci1 | 0:664899e0b988 | 44 | static |
uci1 | 0:664899e0b988 | 45 | bool ReadFromFileToBuf(FILE* f, |
uci1 | 0:664899e0b988 | 46 | char* const evtBuf, |
uci1 | 0:664899e0b988 | 47 | const uint8_t loseLSB, const uint8_t loseMSB); |
uci1 | 0:664899e0b988 | 48 | |
uci1 | 0:664899e0b988 | 49 | static |
uci1 | 0:664899e0b988 | 50 | bool WriteToFileFromBuf(FILE* f, char* const evtBuf, |
uci1 | 0:664899e0b988 | 51 | const uint8_t loseLSB, const uint8_t loseMSB); |
uci1 | 0:664899e0b988 | 52 | |
uci1 | 0:664899e0b988 | 53 | public: |
uci1 | 84:80b15993944e | 54 | SnEventFrame() { ClearEvent(true, true); } |
uci1 | 0:664899e0b988 | 55 | virtual ~SnEventFrame() {} |
uci1 | 40:1324da35afd4 | 56 | |
uci1 | 40:1324da35afd4 | 57 | virtual void CopyTo(SnEventFrame& evt) const { |
uci1 | 56:0bba0ef15697 | 58 | if (&evt!=this) { |
uci1 | 56:0bba0ef15697 | 59 | evt.fMbedTime = fMbedTime; |
uci1 | 56:0bba0ef15697 | 60 | evt.fEvtNum = fEvtNum; |
uci1 | 56:0bba0ef15697 | 61 | evt.fDTms = fDTms; |
uci1 | 56:0bba0ef15697 | 62 | evt.fTrgNum = fTrgNum; |
uci1 | 56:0bba0ef15697 | 63 | evt.fTrgBits = fTrgBits; |
uci1 | 56:0bba0ef15697 | 64 | evt.fCRC = fCRC; |
uci1 | 56:0bba0ef15697 | 65 | memcpy(evt.fData, fData, kTotSamps*sizeof(uint16_t)); |
uci1 | 56:0bba0ef15697 | 66 | #if CHIPBOARD!=ATWD4CH |
uci1 | 56:0bba0ef15697 | 67 | memcpy(evt.fStop, fStop, kNstopBytes*sizeof(uint8_t)); |
uci1 | 56:0bba0ef15697 | 68 | #endif |
uci1 | 56:0bba0ef15697 | 69 | } |
uci1 | 40:1324da35afd4 | 70 | } |
uci1 | 0:664899e0b988 | 71 | |
uci1 | 0:664899e0b988 | 72 | const uint16_t* GetData() const { return fData; } |
uci1 | 0:664899e0b988 | 73 | uint16_t* GetData() { return fData; } |
uci1 | 0:664899e0b988 | 74 | const uint16_t* GetData(const uint8_t ch) const { return fData + (ch*kNsamps); } |
uci1 | 0:664899e0b988 | 75 | uint16_t* GetData(const uint8_t ch) { return fData + (ch*kNsamps); } |
uci1 | 56:0bba0ef15697 | 76 | uint16_t GetData(const uint8_t ch, const uint16_t sm) const |
uci1 | 0:664899e0b988 | 77 | { return fData[(ch*kNsamps)+sm]; } |
uci1 | 56:0bba0ef15697 | 78 | uint16_t& GetData(const uint8_t ch, const uint16_t sm) |
uci1 | 0:664899e0b988 | 79 | { return fData[(ch*kNsamps)+sm]; } |
uci1 | 0:664899e0b988 | 80 | |
uci1 | 56:0bba0ef15697 | 81 | #if CHIPBOARD!=ATWD4CH |
uci1 | 56:0bba0ef15697 | 82 | const uint8_t* GetStop() const { return fStop; } |
uci1 | 56:0bba0ef15697 | 83 | uint8_t* GetStop() { return fStop; } |
uci1 | 56:0bba0ef15697 | 84 | #endif |
uci1 | 56:0bba0ef15697 | 85 | |
uci1 | 22:f957c4f840ad | 86 | uint32_t GetMbedTime() const { return fMbedTime; } |
uci1 | 84:80b15993944e | 87 | uint32_t GetEvtNum() const { return fEvtNum; } |
uci1 | 84:80b15993944e | 88 | int32_t GetDTms() const { return fDTms; } |
uci1 | 84:80b15993944e | 89 | uint32_t GetTrgNum() const { return fTrgNum; } |
uci1 | 84:80b15993944e | 90 | uint16_t GetTrgBits() const { return fTrgBits; } |
uci1 | 84:80b15993944e | 91 | uint32_t GetCRC() const { return fCRC; } |
uci1 | 22:f957c4f840ad | 92 | |
uci1 | 84:80b15993944e | 93 | void ClearEvent(const bool clearTrigs, |
uci1 | 84:80b15993944e | 94 | const bool clearWaveData) { |
uci1 | 21:ce51bb0ba4a5 | 95 | #ifdef EVDEBUG |
uci1 | 21:ce51bb0ba4a5 | 96 | printf("CLEARING EVENT!\r\n"); |
uci1 | 21:ce51bb0ba4a5 | 97 | #endif |
uci1 | 22:f957c4f840ad | 98 | fMbedTime = 0; |
uci1 | 84:80b15993944e | 99 | |
uci1 | 84:80b15993944e | 100 | if (clearWaveData) { |
uci1 | 84:80b15993944e | 101 | memset(fData, 0, kTotSamps*sizeof(int16_t)); |
uci1 | 56:0bba0ef15697 | 102 | #if CHIPBOARD!=ATWD4CH |
uci1 | 84:80b15993944e | 103 | memset(fStop, 0, kNstopBytes*sizeof(uint8_t)); |
uci1 | 56:0bba0ef15697 | 104 | #endif |
uci1 | 84:80b15993944e | 105 | fCRC = 0; |
uci1 | 84:80b15993944e | 106 | } |
uci1 | 84:80b15993944e | 107 | if (clearTrigs) { |
uci1 | 22:f957c4f840ad | 108 | fEvtNum = fTrgNum = 0; |
uci1 | 22:f957c4f840ad | 109 | fTrgBits = 0; |
uci1 | 22:f957c4f840ad | 110 | } |
uci1 | 0:664899e0b988 | 111 | } |
uci1 | 0:664899e0b988 | 112 | |
uci1 | 84:80b15993944e | 113 | void SetTrgBit(const ETrgBit_t t) { fTrgBits |= t; } |
uci1 | 0:664899e0b988 | 114 | void SetTrgNum(const uint32_t t) { fTrgNum = t; } |
uci1 | 0:664899e0b988 | 115 | void SetEvtNum(const uint32_t n) { fEvtNum = n; } |
uci1 | 0:664899e0b988 | 116 | void SetDTms(const int32_t dtms) { fDTms = dtms; } |
uci1 | 0:664899e0b988 | 117 | void SetCurMbedTime() { fMbedTime = time(0); } |
uci1 | 0:664899e0b988 | 118 | |
uci1 | 84:80b15993944e | 119 | // bool IsForcedTrg() const { return (fTrgBits & kFrcTrg)!=0; } |
uci1 | 0:664899e0b988 | 120 | |
uci1 | 56:0bba0ef15697 | 121 | #if CHIPBOARD!=ATWD4CH |
uci1 | 56:0bba0ef15697 | 122 | void ReadWaveformsSST(SPI& spi, DigitalOut& readingData) { |
uci1 | 56:0bba0ef15697 | 123 | readingData = 1; // start reading |
uci1 | 56:0bba0ef15697 | 124 | |
uci1 | 56:0bba0ef15697 | 125 | // first get waveform data |
uci1 | 56:0bba0ef15697 | 126 | uint16_t* d = fData; |
uci1 | 56:0bba0ef15697 | 127 | for (uint8_t ch=0; ch<kNchans; ++ch) { |
uci1 | 56:0bba0ef15697 | 128 | #ifdef EVDEBUG |
uci1 | 56:0bba0ef15697 | 129 | printf("new channel %hhu\r\n",ch); |
uci1 | 56:0bba0ef15697 | 130 | #endif |
uci1 | 56:0bba0ef15697 | 131 | |
uci1 | 56:0bba0ef15697 | 132 | spi.format( 5, 1 ); // throw away leading bits (1 meaningless + 4 MSB 0's bits before 12 bit ADC value) |
uci1 | 56:0bba0ef15697 | 133 | spi.write(0); // get the throw away bits |
uci1 | 56:0bba0ef15697 | 134 | spi.format( 12, 1); // read remaining |
uci1 | 56:0bba0ef15697 | 135 | |
uci1 | 56:0bba0ef15697 | 136 | for (uint16_t i=0; i<kNsamps; ++i, ++d) { |
uci1 | 56:0bba0ef15697 | 137 | *d = spi.write(0x00)/* >> 1*/; // get rid of stop bit (TODO: is this right?) |
uci1 | 56:0bba0ef15697 | 138 | if (i==0) { |
uci1 | 56:0bba0ef15697 | 139 | spi.format( 16, 1); // back to normal |
uci1 | 56:0bba0ef15697 | 140 | } |
uci1 | 56:0bba0ef15697 | 141 | #ifdef EVDEBUG |
uci1 | 56:0bba0ef15697 | 142 | if (i==0 || i==1) { |
uci1 | 56:0bba0ef15697 | 143 | printf("d: spi gave (%hu) ",*d); |
uci1 | 56:0bba0ef15697 | 144 | SnBitUtils::printBits(*d, false); |
uci1 | 56:0bba0ef15697 | 145 | } |
uci1 | 56:0bba0ef15697 | 146 | #endif |
uci1 | 56:0bba0ef15697 | 147 | } |
uci1 | 56:0bba0ef15697 | 148 | } |
uci1 | 56:0bba0ef15697 | 149 | // now get stop data |
uci1 | 56:0bba0ef15697 | 150 | uint8_t* s = fStop; |
uci1 | 56:0bba0ef15697 | 151 | uint16_t sd(0); |
uci1 | 56:0bba0ef15697 | 152 | for (uint16_t i=0; i<kNstopBytes; i+=2, s+=2) { |
uci1 | 56:0bba0ef15697 | 153 | if (i==0) { |
uci1 | 56:0bba0ef15697 | 154 | // need to throw away the very first bit |
uci1 | 56:0bba0ef15697 | 155 | // but we can't ask spi to send only 1 bit |
uci1 | 56:0bba0ef15697 | 156 | spi.format( 5, 1 ); |
uci1 | 56:0bba0ef15697 | 157 | sd = spi.write(0x00); |
uci1 | 56:0bba0ef15697 | 158 | // toss the first bit totally |
uci1 | 56:0bba0ef15697 | 159 | // move the other 4 bits to the front |
uci1 | 56:0bba0ef15697 | 160 | sd <<= 12; |
uci1 | 56:0bba0ef15697 | 161 | spi.format( 12, 1); // read the rest of the real 16 bits |
uci1 | 56:0bba0ef15697 | 162 | sd |= spi.write(0x00); |
uci1 | 56:0bba0ef15697 | 163 | spi.format( 16, 1); // normal after this |
uci1 | 56:0bba0ef15697 | 164 | } else { |
uci1 | 56:0bba0ef15697 | 165 | sd = spi.write(0x00); |
uci1 | 56:0bba0ef15697 | 166 | } |
uci1 | 56:0bba0ef15697 | 167 | #ifdef EVDEBUG |
uci1 | 56:0bba0ef15697 | 168 | /* |
uci1 | 56:0bba0ef15697 | 169 | printf("s: spi gave (%hu) ",sd); |
uci1 | 56:0bba0ef15697 | 170 | SnBitUtils::printBits(sd, false); |
uci1 | 56:0bba0ef15697 | 171 | */ |
uci1 | 56:0bba0ef15697 | 172 | #endif |
uci1 | 56:0bba0ef15697 | 173 | *s = (sd & 0xFF00) >> BITS_IN_CHAR; |
uci1 | 56:0bba0ef15697 | 174 | *(s+1) = sd & 0x00FF; |
uci1 | 56:0bba0ef15697 | 175 | } |
uci1 | 56:0bba0ef15697 | 176 | readingData = 0; // done reading |
uci1 | 56:0bba0ef15697 | 177 | /* |
uci1 | 56:0bba0ef15697 | 178 | // get rid of stop bit (TODO: is this right?) |
uci1 | 56:0bba0ef15697 | 179 | *s >>= 1; |
uci1 | 56:0bba0ef15697 | 180 | *s <<= 1; |
uci1 | 56:0bba0ef15697 | 181 | */ |
uci1 | 56:0bba0ef15697 | 182 | #ifdef EVDEBUG |
uci1 | 56:0bba0ef15697 | 183 | /* |
uci1 | 56:0bba0ef15697 | 184 | d = fData; |
uci1 | 56:0bba0ef15697 | 185 | for (uint8_t ch=0; ch<kNchans; ch++) { |
uci1 | 56:0bba0ef15697 | 186 | for (uint16_t i=0; i<kNsamps; i++, d++) { |
uci1 | 56:0bba0ef15697 | 187 | printf("(%hhu,%03hhu,%hu) ",ch,i,*d); |
uci1 | 56:0bba0ef15697 | 188 | } |
uci1 | 56:0bba0ef15697 | 189 | printf("\r\n"); |
uci1 | 56:0bba0ef15697 | 190 | } |
uci1 | 56:0bba0ef15697 | 191 | s = fStop; |
uci1 | 56:0bba0ef15697 | 192 | for (uint16_t i=0; i<kNstopBytes; ++i, ++s) { |
uci1 | 56:0bba0ef15697 | 193 | for (int16_t j=(sizeof(uint8_t)*BITS_IN_CHAR)-1; j>-1; --j) { |
uci1 | 56:0bba0ef15697 | 194 | if ( (*s&(1<<j))!=0 ) { |
uci1 | 56:0bba0ef15697 | 195 | printf("stop bit at %hu\r\n", |
uci1 | 56:0bba0ef15697 | 196 | j+(BITS_IN_CHAR*sizeof(uint8_t)*i)); |
uci1 | 56:0bba0ef15697 | 197 | } |
uci1 | 56:0bba0ef15697 | 198 | } |
uci1 | 56:0bba0ef15697 | 199 | } |
uci1 | 56:0bba0ef15697 | 200 | */ |
uci1 | 56:0bba0ef15697 | 201 | #endif |
uci1 | 56:0bba0ef15697 | 202 | CalcCRC(); |
uci1 | 56:0bba0ef15697 | 203 | } |
uci1 | 56:0bba0ef15697 | 204 | #endif |
uci1 | 56:0bba0ef15697 | 205 | |
uci1 | 56:0bba0ef15697 | 206 | void ReadWaveformsATWD(SPI& spi, |
uci1 | 56:0bba0ef15697 | 207 | DigitalOut& cardHiBit, DigitalOut& cardLoBit) { |
uci1 | 0:664899e0b988 | 208 | uint16_t* dev=fData; |
uci1 | 0:664899e0b988 | 209 | for( uint8_t ch = 0; ch < kNchans; ch++ ) { |
uci1 | 0:664899e0b988 | 210 | // Pick which register to read. |
uci1 | 0:664899e0b988 | 211 | SnBitUtils::SetChanNumBits(ch, cardHiBit, cardLoBit); |
uci1 | 56:0bba0ef15697 | 212 | for( uint16_t i = 0; i < kNsamps; i++, dev++ ) { |
uci1 | 0:664899e0b988 | 213 | *dev = spi.write(0x00) >> 1; |
uci1 | 0:664899e0b988 | 214 | } |
uci1 | 0:664899e0b988 | 215 | } |
uci1 | 15:f2569d8e4176 | 216 | #ifdef EVDEBUG |
uci1 | 15:f2569d8e4176 | 217 | dev = fData; |
uci1 | 15:f2569d8e4176 | 218 | for (uint8_t ch=0; ch<kNchans; ch++) { |
uci1 | 56:0bba0ef15697 | 219 | for (uint16_t i=0; i<kNsamps; i++, dev++) { |
uci1 | 56:0bba0ef15697 | 220 | printf("(%hhu,%03hhu,%hu) ",ch,i,*dev); |
uci1 | 15:f2569d8e4176 | 221 | } |
uci1 | 15:f2569d8e4176 | 222 | printf("\r\n"); |
uci1 | 15:f2569d8e4176 | 223 | } |
uci1 | 15:f2569d8e4176 | 224 | #endif |
uci1 | 0:664899e0b988 | 225 | CalcCRC(); |
uci1 | 0:664899e0b988 | 226 | } |
uci1 | 0:664899e0b988 | 227 | |
uci1 | 56:0bba0ef15697 | 228 | |
uci1 | 56:0bba0ef15697 | 229 | static |
uci1 | 56:0bba0ef15697 | 230 | uint16_t GetTotSamplesForIOVers(const uint8_t rv) { |
uci1 | 56:0bba0ef15697 | 231 | if (rv<2) { |
uci1 | 56:0bba0ef15697 | 232 | return kTotSampsAtwd4ch; |
uci1 | 56:0bba0ef15697 | 233 | } else { |
uci1 | 56:0bba0ef15697 | 234 | return kTotSampsSst4ch; |
uci1 | 56:0bba0ef15697 | 235 | } |
uci1 | 56:0bba0ef15697 | 236 | } |
uci1 | 56:0bba0ef15697 | 237 | |
uci1 | 56:0bba0ef15697 | 238 | static |
uci1 | 56:0bba0ef15697 | 239 | uint16_t GetStopBytesForIOVers(const uint8_t rv) { |
uci1 | 56:0bba0ef15697 | 240 | if (rv<2) { |
uci1 | 56:0bba0ef15697 | 241 | return 0; |
uci1 | 56:0bba0ef15697 | 242 | } else { |
uci1 | 56:0bba0ef15697 | 243 | return kNstopBytesSst4ch; |
uci1 | 56:0bba0ef15697 | 244 | } |
uci1 | 56:0bba0ef15697 | 245 | } |
uci1 | 56:0bba0ef15697 | 246 | |
uci1 | 0:664899e0b988 | 247 | static |
uci1 | 8:95a325df1f6b | 248 | uint32_t SizeOf(const uint8_t rv, const uint8_t loseLSB, const uint8_t loseMSB) { |
uci1 | 0:664899e0b988 | 249 | // size of member vars + size of packed waveform + 1 for i/o version |
uci1 | 56:0bba0ef15697 | 250 | uint32_t sz(0); |
uci1 | 56:0bba0ef15697 | 251 | const uint16_t ntotsamps = GetTotSamplesForIOVers(rv); |
uci1 | 56:0bba0ef15697 | 252 | if (rv==1) { |
uci1 | 56:0bba0ef15697 | 253 | sz = kMaxSizeOfV1; |
uci1 | 56:0bba0ef15697 | 254 | } else if (rv==2) { |
uci1 | 56:0bba0ef15697 | 255 | sz = kMaxSizeOfV2; |
uci1 | 0:664899e0b988 | 256 | } else { |
uci1 | 56:0bba0ef15697 | 257 | sz = kMaxSizeOf; |
uci1 | 56:0bba0ef15697 | 258 | } |
uci1 | 56:0bba0ef15697 | 259 | if ((loseLSB==0) && (loseMSB==0)) { |
uci1 | 56:0bba0ef15697 | 260 | return sz; |
uci1 | 56:0bba0ef15697 | 261 | } else { |
uci1 | 56:0bba0ef15697 | 262 | return (sz-(ntotsamps*sizeof(uint16_t)) |
uci1 | 56:0bba0ef15697 | 263 | +SizeOfPackedWavef(loseLSB, loseMSB)); |
uci1 | 0:664899e0b988 | 264 | } |
uci1 | 0:664899e0b988 | 265 | } |
uci1 | 0:664899e0b988 | 266 | |
uci1 | 0:664899e0b988 | 267 | static |
uci1 | 0:664899e0b988 | 268 | uint32_t SizeOfPackedWavef(const uint8_t loseLSB, |
uci1 | 0:664899e0b988 | 269 | const uint8_t loseMSB) { |
uci1 | 0:664899e0b988 | 270 | const uint8_t p = BITS_IN_SHORT-loseLSB-loseMSB; |
uci1 | 0:664899e0b988 | 271 | return ((p*kTotSamps)/8u) + (((p*kTotSamps)%8u)!=0 ? 1u : 0u); |
uci1 | 0:664899e0b988 | 272 | } |
uci1 | 0:664899e0b988 | 273 | |
uci1 | 3:24c5f0f50bf1 | 274 | const char* ReadFrom(const char* const buf, |
uci1 | 3:24c5f0f50bf1 | 275 | const uint8_t loseLSB, const uint8_t loseMSB, |
uci1 | 3:24c5f0f50bf1 | 276 | const uint16_t wvBaseline); |
uci1 | 0:664899e0b988 | 277 | |
uci1 | 3:24c5f0f50bf1 | 278 | char* WriteTo(char* const buf, |
uci1 | 3:24c5f0f50bf1 | 279 | const uint8_t loseLSB, const uint8_t loseMSB, |
uci1 | 3:24c5f0f50bf1 | 280 | const uint16_t wvBaseline) const; |
uci1 | 0:664899e0b988 | 281 | |
uci1 | 0:664899e0b988 | 282 | bool ReadFrom(FILE* f, char* const evtBuf, |
uci1 | 0:664899e0b988 | 283 | const uint8_t loseLSB, const uint8_t loseMSB, |
uci1 | 0:664899e0b988 | 284 | const uint16_t wvBaseline); |
uci1 | 0:664899e0b988 | 285 | bool WriteTo(FILE* f, char* const evtBuf, |
uci1 | 0:664899e0b988 | 286 | const uint8_t loseLSB, const uint8_t loseMSB, |
uci1 | 0:664899e0b988 | 287 | const uint16_t wvBaseline) const; |
uci1 | 0:664899e0b988 | 288 | |
uci1 | 0:664899e0b988 | 289 | static |
uci1 | 0:664899e0b988 | 290 | const uint8_t* UnpackWavef(const uint8_t* const buf, |
uci1 | 0:664899e0b988 | 291 | uint16_t* const data, |
uci1 | 0:664899e0b988 | 292 | const uint8_t loseLSB, |
uci1 | 0:664899e0b988 | 293 | const uint8_t loseMSB, |
uci1 | 56:0bba0ef15697 | 294 | const uint16_t wvBaseline, |
uci1 | 56:0bba0ef15697 | 295 | const uint16_t nsamps); |
uci1 | 0:664899e0b988 | 296 | |
uci1 | 0:664899e0b988 | 297 | static |
uci1 | 0:664899e0b988 | 298 | uint8_t* PackWavef(uint8_t* const buf, const uint16_t* const data, |
uci1 | 0:664899e0b988 | 299 | const uint8_t loseLSB, const uint8_t loseMSB, |
uci1 | 56:0bba0ef15697 | 300 | const uint16_t wvBaseline, |
uci1 | 56:0bba0ef15697 | 301 | const uint16_t nsamps); |
uci1 | 0:664899e0b988 | 302 | }; |
uci1 | 0:664899e0b988 | 303 | |
uci1 | 0:664899e0b988 | 304 | |
uci1 | 0:664899e0b988 | 305 | #endif // SN_SnEventFrame |