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.
Node/Observer/BufferedOutput/BufferedOutput.h@0:99928431bb44, 2015-07-07 (annotated)
- Committer:
- millanea
- Date:
- Tue Jul 07 09:36:12 2015 +0000
- Revision:
- 0:99928431bb44
First commit. Committing the entire project such that it can be published.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
millanea | 0:99928431bb44 | 1 | |
millanea | 0:99928431bb44 | 2 | #ifndef BUFFEREDOUTPUT_H |
millanea | 0:99928431bb44 | 3 | #define BUFFEREDOUTPUT_H |
millanea | 0:99928431bb44 | 4 | |
millanea | 0:99928431bb44 | 5 | // Dependancies |
millanea | 0:99928431bb44 | 6 | #include "mbed.h" |
millanea | 0:99928431bb44 | 7 | #include "debug.h" |
millanea | 0:99928431bb44 | 8 | |
millanea | 0:99928431bb44 | 9 | // Circular buffer for mavlink characters |
millanea | 0:99928431bb44 | 10 | const int framesBufferSize = 255; |
millanea | 0:99928431bb44 | 11 | |
millanea | 0:99928431bb44 | 12 | class BufferedOutput |
millanea | 0:99928431bb44 | 13 | { |
millanea | 0:99928431bb44 | 14 | public: |
millanea | 0:99928431bb44 | 15 | |
millanea | 0:99928431bb44 | 16 | // Constructor |
millanea | 0:99928431bb44 | 17 | BufferedOutput( Serial& serial ) ; |
millanea | 0:99928431bb44 | 18 | |
millanea | 0:99928431bb44 | 19 | // Contains the MAVlink passthrough background tasks |
millanea | 0:99928431bb44 | 20 | void executeBackgroundTask() ; |
millanea | 0:99928431bb44 | 21 | |
millanea | 0:99928431bb44 | 22 | // Adding a frame to the output buffer |
millanea | 0:99928431bb44 | 23 | //void addFrame( char* frame, char length ) ; |
millanea | 0:99928431bb44 | 24 | |
millanea | 0:99928431bb44 | 25 | // Adding a character to the output buffer |
millanea | 0:99928431bb44 | 26 | void addChar( char c ) ; |
millanea | 0:99928431bb44 | 27 | |
millanea | 0:99928431bb44 | 28 | protected: |
millanea | 0:99928431bb44 | 29 | |
millanea | 0:99928431bb44 | 30 | // Serial object where outward frames are written |
millanea | 0:99928431bb44 | 31 | Serial& framesOut ; |
millanea | 0:99928431bb44 | 32 | |
millanea | 0:99928431bb44 | 33 | // Frames Send Callback |
millanea | 0:99928431bb44 | 34 | void framesOutCallback() ; |
millanea | 0:99928431bb44 | 35 | |
millanea | 0:99928431bb44 | 36 | // Buffer which hold mavlink characters received via the serial connection |
millanea | 0:99928431bb44 | 37 | char framesBuffer[ framesBufferSize + 1 ] ; |
millanea | 0:99928431bb44 | 38 | // Pointers to entry and exit points to the buffer |
millanea | 0:99928431bb44 | 39 | volatile char framesBufferIn ; |
millanea | 0:99928431bb44 | 40 | volatile char framesBufferOut ; |
millanea | 0:99928431bb44 | 41 | |
millanea | 0:99928431bb44 | 42 | // Indicates if a frame is currently being transfered over serial |
millanea | 0:99928431bb44 | 43 | bool frameTransferInProgress ; |
millanea | 0:99928431bb44 | 44 | |
millanea | 0:99928431bb44 | 45 | } ; |
millanea | 0:99928431bb44 | 46 | |
millanea | 0:99928431bb44 | 47 | |
millanea | 0:99928431bb44 | 48 | #endif |