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.
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 bool dataRecived; 00034 float gainG; 00035 float gain_dG; 00036 float offsetX; 00037 float offsetY; 00038 00039 private: 00040 00041 static const uint32_t STACK_SIZE = 2048 ; // stack size of thread, given in [bytes] 00042 static const float PERIOD; // the period of the timer interrupt, given in [s] 00043 static const char DELIM; 00044 00045 RawSerial& serial; 00046 string input; 00047 string output; 00048 vector<string> tokens; 00049 Signal signal; 00050 Thread thread; 00051 Ticker ticker; 00052 bool sendData; 00053 int runCount; 00054 00055 void sendSignal(); 00056 void run(); 00057 void splitString(); 00058 }; 00059 00060 #endif /* SERIAL_COM_H_ */ 00061 00062
Generated on Tue Jul 12 2022 18:18:48 by
