XBee API operation library for mbed for miniprojects
Dependencies: SmartLabXBeeCore
Fork of SmartLabXBeeAPI2 by
SerialData.cpp
00001 #include "SerialData.h" 00002 00003 SerialData::SerialData(PinName tx, PinName rx) 00004 { 00005 serialPort = new Serial(tx, rx); 00006 serialPort->baud(9600); 00007 } 00008 00009 SerialData::SerialData(PinName tx, PinName rx, int baudRate) 00010 { 00011 serialPort = new Serial(tx, rx); 00012 serialPort->baud(baudRate); 00013 } 00014 00015 SerialData::~SerialData() 00016 { 00017 if (serialPort != NULL) 00018 delete serialPort; 00019 } 00020 00021 int SerialData::readByte() 00022 { 00023 return serialPort->getc(); 00024 } 00025 00026 void SerialData::writeByte(char data) 00027 { 00028 serialPort->putc(data); 00029 } 00030 00031 bool SerialData::peek() 00032 { 00033 if (serialPort->readable()) 00034 return true; 00035 else return false; 00036 } 00037 00038 bool SerialData::isOpen() 00039 { 00040 return true; 00041 } 00042 00043 void SerialData::open() 00044 {} 00045 00046 void SerialData::close() 00047 {}
Generated on Sun Jul 17 2022 19:50:18 by 1.7.2