Benjamin Hepp / ait_link
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ait_link_mbed.h Source File

ait_link_mbed.h

00001 //
00002 // HDLC based serial communication class.
00003 //
00004 // Created by Benjamin Hepp on 02.04.16.
00005 // Copyright (c) 2016 Benjamin Hepp. All rights reserved.
00006 //
00007 
00008 #pragma once
00009 
00010 #include <BufferedSerial/BufferedSerial.h>
00011 
00012 #include "ait_link.h"
00013 
00014 #ifdef __MBED__
00015 
00016 namespace ait {
00017 
00018   class AITLinkMbed : public AITLink {
00019     BufferedSerial* _serial;
00020 
00021 public:
00022     AITLinkMbed(BufferedSerial* serial, uint16_t max_frame_length = 1024)
00023         : AITLink(max_frame_length), _serial(serial) {
00024     }
00025 
00026     virtual ~AITLinkMbed() {
00027     }
00028 
00029     virtual void frameHandler(const uint8_t* frame_buffer, size_t frame_length) {
00030     }
00031 
00032     virtual void sendChar(uint8_t data) {
00033         _serial->putc(data);
00034     }
00035 };
00036 
00037 }
00038 
00039 #endif // __MBED__