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.
Fork of OmniWheels by
SerialCom.h
00001 /* 00002 * SerialServer.h 00003 * Copyright (c) 2017, ZHAW 00004 * All rights reserved. 00005 * 00006 * Created on: 05.06.2017 00007 * Author: Marcel Honegger 00008 */ 00009 00010 #ifndef SERIAL_COM_H_ 00011 #define SERIAL_COM_H_ 00012 00013 #include <cstdlib> 00014 #include <string> 00015 #include <vector> 00016 #include <mbed.h> 00017 #include "Signal.h" 00018 00019 using namespace std; 00020 00021 00022 00023 /** 00024 * This class implements a communication server using a serial interface. 00025 */ 00026 class SerialCom { 00027 00028 public: 00029 00030 SerialCom(RawSerial& serial); 00031 virtual ~SerialCom(); 00032 00033 private: 00034 00035 static const uint32_t STACK_SIZE = 2048 ; // stack size of thread, given in [bytes] 00036 static const float PERIOD; // the period of the timer interrupt, given in [s] 00037 static const char DELIM; 00038 00039 RawSerial& serial; 00040 string input; 00041 string output; 00042 vector<string> tokens; 00043 Signal signal; 00044 Thread thread; 00045 Ticker ticker; 00046 bool sendData; 00047 int runCount; 00048 00049 void sendSignal(); 00050 void run(); 00051 void splitString(); 00052 }; 00053 00054 #endif /* SERIAL_COM_H_ */
Generated on Fri Jul 22 2022 04:54:00 by
 1.7.2
 1.7.2 
    