-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSerialStream.cpp
More file actions
47 lines (39 loc) · 733 Bytes
/
Copy pathSerialStream.cpp
File metadata and controls
47 lines (39 loc) · 733 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
Serial Stream class
Author : Yasuhiro ISHII
*/
#include <stdio.h>
//#include "testlibs.h"
#include "CommunicationStream.h"
#include "SerialStream.h"
SerialStream::SerialStream(void)
{
mConnected = false;
}
int SerialStream::isConnected(void)
{
return(mConnected);
}
int SerialStream::available(void)
{
return (mHardwareSerial->available());
}
unsigned char SerialStream::read(void)
{
return (mHardwareSerial->read());
}
int SerialStream::write(unsigned char* buff,int len)
{
mHardwareSerial->write(buff,len);
}
void SerialStream::flush(void)
{
mHardwareSerial->flush();
}
void SerialStream::setInterface(HardwareSerial* s)
{
if(s != NULL){
mHardwareSerial = s;
mConnected = true;
}
}