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.
Dependencies: mbed
Fork of DataLoggerRS232trial by
DataLoggerRS232/DataLoggerRS232.cpp
- Committer:
- Dengjj
- Date:
- 2016-09-18
- Revision:
- 2:6ebf09171de9
- Parent:
- 1:875d121e9ce9
File content as of revision 2:6ebf09171de9:
#include "mbed.h"
#include "DataLoggerRS232.h"
DataLoggerRS232::DataLoggerRS232(PinName tx, PinName rx, const char* name) : Serial(tx, rx, name) {
printf("Here!! \r\n");
// set up ring buffer
ringBuffer = new char[65536];
// pointer to first sample
rHead = ringBuffer;
// pointer to indicate position in the Ring Buffer
rPos = ringBuffer;
// pointer to indicate display position in the Ring Buffer
rDisplay = ringBuffer;
printf("DataLogger_RS232 Ring Buffer setup complete!\r\n");
}
void DataLoggerRS232::get_ECU_databyte() {
while(Serial::readable()) {
MSserial = Serial::getc();
// save the sample into ring buffer
if( rPos == &ringBuffer[65535] )
rPos = ringBuffer;
else
rPos++;
*rPos = MSserial;
count++;
}
printf("get_ECU_databyte !!\r\n");
}
void DataLoggerRS232::display_ECU_databyte() {
while (rDisplay != rPos) {
printf("%d, %X\n\r",count,rDisplay);
if( rDisplay == &ringBuffer[65535] )
rDisplay = ringBuffer;
else
rDisplay++;
}
//printf("display_ECU_databyte !!\r\n");
}
DataLoggerRS232::~DataLoggerRS232() {
}
