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.
ait_link_mbed.h@3:bfc4928cd279, 2016-04-06 (annotated)
- Committer:
- bhepp
- Date:
- Wed Apr 06 08:27:25 2016 +0000
- Revision:
- 3:bfc4928cd279
- Parent:
- 2:502d1a5f79a0
Updated license
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| bhepp | 3:bfc4928cd279 | 1 | // |
| bhepp | 3:bfc4928cd279 | 2 | // HDLC based serial communication class. |
| bhepp | 3:bfc4928cd279 | 3 | // |
| bhepp | 3:bfc4928cd279 | 4 | // Created by Benjamin Hepp on 02.04.16. |
| bhepp | 3:bfc4928cd279 | 5 | // Copyright (c) 2016 Benjamin Hepp. All rights reserved. |
| bhepp | 3:bfc4928cd279 | 6 | // |
| bhepp | 3:bfc4928cd279 | 7 | |
| bhepp | 2:502d1a5f79a0 | 8 | #pragma once |
| bhepp | 2:502d1a5f79a0 | 9 | |
| bhepp | 2:502d1a5f79a0 | 10 | #include <BufferedSerial/BufferedSerial.h> |
| bhepp | 2:502d1a5f79a0 | 11 | |
| bhepp | 2:502d1a5f79a0 | 12 | #include "ait_link.h" |
| bhepp | 2:502d1a5f79a0 | 13 | |
| bhepp | 2:502d1a5f79a0 | 14 | #ifdef __MBED__ |
| bhepp | 2:502d1a5f79a0 | 15 | |
| bhepp | 2:502d1a5f79a0 | 16 | namespace ait { |
| bhepp | 2:502d1a5f79a0 | 17 | |
| bhepp | 2:502d1a5f79a0 | 18 | class AITLinkMbed : public AITLink { |
| bhepp | 2:502d1a5f79a0 | 19 | BufferedSerial* _serial; |
| bhepp | 0:8e8dfc870cb2 | 20 | |
| bhepp | 2:502d1a5f79a0 | 21 | public: |
| bhepp | 2:502d1a5f79a0 | 22 | AITLinkMbed(BufferedSerial* serial, uint16_t max_frame_length = 1024) |
| bhepp | 2:502d1a5f79a0 | 23 | : AITLink(max_frame_length), _serial(serial) { |
| bhepp | 2:502d1a5f79a0 | 24 | } |
| bhepp | 2:502d1a5f79a0 | 25 | |
| bhepp | 2:502d1a5f79a0 | 26 | virtual ~AITLinkMbed() { |
| bhepp | 2:502d1a5f79a0 | 27 | } |
| bhepp | 2:502d1a5f79a0 | 28 | |
| bhepp | 2:502d1a5f79a0 | 29 | virtual void frameHandler(const uint8_t* frame_buffer, size_t frame_length) { |
| bhepp | 2:502d1a5f79a0 | 30 | } |
| bhepp | 2:502d1a5f79a0 | 31 | |
| bhepp | 2:502d1a5f79a0 | 32 | virtual void sendChar(uint8_t data) { |
| bhepp | 2:502d1a5f79a0 | 33 | _serial->putc(data); |
| bhepp | 2:502d1a5f79a0 | 34 | } |
| bhepp | 2:502d1a5f79a0 | 35 | }; |
| bhepp | 2:502d1a5f79a0 | 36 | |
| bhepp | 2:502d1a5f79a0 | 37 | } |
| bhepp | 2:502d1a5f79a0 | 38 | |
| bhepp | 2:502d1a5f79a0 | 39 | #endif // __MBED__ |