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.cpp
00001 #include "mbed.h" 00002 #include "DataLoggerRS232.h" 00003 00004 00005 DataLoggerRS232::DataLoggerRS232(PinName tx, PinName rx, const char* name) : Serial(tx, rx, name) { 00006 printf("Here!! \r\n"); 00007 // set up ring buffer 00008 ringBuffer = new char[65536]; 00009 // pointer to first sample 00010 rHead = ringBuffer; 00011 // pointer to indicate position in the Ring Buffer 00012 rPos = ringBuffer; 00013 // pointer to indicate display position in the Ring Buffer 00014 rDisplay = ringBuffer; 00015 00016 printf("DataLogger_RS232 Ring Buffer setup complete!\r\n"); 00017 } 00018 00019 void DataLoggerRS232::get_ECU_databyte() { 00020 00021 while(Serial::readable()) { 00022 00023 MSserial = Serial::getc(); 00024 // save the sample into ring buffer 00025 if( rPos == &ringBuffer[65535] ) 00026 rPos = ringBuffer; 00027 else 00028 rPos++; 00029 00030 *rPos = MSserial; 00031 00032 count++; 00033 } 00034 printf("get_ECU_databyte !!\r\n"); 00035 } 00036 00037 void DataLoggerRS232::display_ECU_databyte() { 00038 00039 while (rDisplay != rPos) { 00040 printf("%d, %X\n\r",count,rDisplay); 00041 if( rDisplay == &ringBuffer[65535] ) 00042 rDisplay = ringBuffer; 00043 else 00044 rDisplay++; 00045 } 00046 //printf("display_ECU_databyte !!\r\n"); 00047 00048 00049 } 00050 00051 00052 DataLoggerRS232::~DataLoggerRS232() { 00053 }
Generated on Sat Jul 30 2022 16:22:58 by
1.7.2
