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.
CSV.cpp
00001 #include "mbed.h" 00002 #include "CSV.h" 00003 00004 CSV::CSV(PinName TX, PinName RX, int bps) : myserial(TX, RX) 00005 { 00006 myserial.baud(bps); 00007 myserial.attach(this, &CSV::_serialEvent, Serial::RxIrq); 00008 dataIndex = 0; 00009 } 00010 00011 void CSV::_serialEvent() 00012 { 00013 rcvData[dataIndex] = myserial.getc(); 00014 if(rcvData[dataIndex] != '\n') 00015 dataIndex++; 00016 else 00017 { 00018 rcvData[dataIndex] = '\0'; 00019 dataIndex = 0; 00020 valueData[0] = atoi(strtok(rcvData, ",")); 00021 int i = 1; 00022 char *tmp; 00023 do 00024 { 00025 tmp = strtok(NULL, ","); 00026 valueData[i++] = atoi(tmp); 00027 }while(tmp != NULL); 00028 } 00029 } 00030 00031 int CSV::getValue(int num) 00032 { 00033 return valueData[num]; 00034 }
Generated on Sat Jul 23 2022 01:00:10 by
