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: DevInterfaces I2Cinterfaces MCP4725 mbed
Reader.h
- Committer:
- katrijnverhasselt
- Date:
- 2016-05-18
- Revision:
- 0:b40341017545
- Child:
- 2:2330ad8b1baa
File content as of revision 0:b40341017545:
#pragma once #include <string> #include "mbed.h" #include "Translator.h" // Reads the input buffer and notifies when a new message is ready class Reader { private: // PC interaction object Serial pc; static const int _maxSize = 255+2; bool _isNewMessageReceived; // set to true if a complete message was read Translator::MessageInfo _lastMessageInfo; int8_t _lastMessage[_maxSize]; // last complete message received int _lastMessageSize; // size of last complete message received int8_t _buffer[_maxSize]; // temporary storage while reading a message int _bufferSize; // size of the buffer int8_t _lastChar; // last byte read bool _isMessageStarted; // starting character was received int _charsToRead; // number of characters to read int _index; // current number of characters read public: // Default constructor, attaches a callback to pc Reader(); // Returns true once if a complete message was read bool IsNewMessageReceived(); Translator::MessageInfo GetLastMessageInfo() const; // Returns the last message (without header) const int8_t* GetLastMessage() const; // Returns the size of the last message int GetLastMessageSize() const; private: // Function to be attached to pc void pcCallback(); };