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 ROME2_P3 by
Diff: SerialServer.h
- Revision:
- 6:67263dc2c2cf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SerialServer.h Thu Apr 26 12:22:58 2018 +0000 @@ -0,0 +1,45 @@ +/* + * SerialServer.h + * Copyright (c) 2018, ZHAW + * All rights reserved. + */ + +#ifndef SERIAL_SERVER_H_ +#define SERIAL_SERVER_H_ + +#include <cstdlib> +#include <string> +#include <mbed.h> +#include "IMU.h" +#include "Controller.h" + +using namespace std; + +/** + * This class implements a communication server using a serial interface. + */ +class SerialServer { + + public: + + SerialServer(Serial& serial, IMU& imu, Controller& controller); + virtual ~SerialServer(); + + private: + + static const float PERIOD; + static const int BUFFER_SIZE = 64; + + Serial& serial; + IMU& imu; + Controller& controller; + string input; + string output; + Ticker ticker; + + void receive(); + void transmit(); +}; + +#endif /* SERIAL_SERVER_H_ */ +