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.
Diff: Koala.cpp
- Revision:
- 3:c32adf6f5ec6
- Parent:
- 2:b614b7a16e8d
diff -r b614b7a16e8d -r c32adf6f5ec6 Koala.cpp
--- a/Koala.cpp Thu Jul 15 23:01:51 2010 +0000
+++ b/Koala.cpp Thu Jul 15 23:51:56 2010 +0000
@@ -1,9 +1,9 @@
#include "Koala.h"
-Koala::Koala(PinName tx, PinName rx, int baudrate) : _serial(tx, rx) {
+Koala::Koala(PinName tx, PinName rx, int baudrate) : Serial(tx, rx) {
- _serial.baud(baudrate);
- _serial.format(8,Serial::None,1);
+ this->baud(baudrate);
+ this->format(8,Serial::None,1);
set_speed(0,0);
set_pos_cnt(0,0);
}
@@ -11,13 +11,13 @@
void Koala::dummyread() {
- char dummy = _serial.getc();
+ char dummy = this->getc();
}
char Koala::set_speed(int speedL,int speedR) {
- _serial.printf("D,%d,%d\n",speedL,speedR);
- char reply = _serial.getc();
+ this->printf("D,%d,%d\n",speedL,speedR);
+ char reply = this->getc();
dummyread();
dummyread();
return reply;
@@ -26,8 +26,8 @@
char Koala::set_pos_cnt(int posL,int posR) {
- _serial.printf("G,%d,%d\n",posL,posR);
- char reply = _serial.getc();
+ this->printf("G,%d,%d\n",posL,posR);
+ char reply = this->getc();
dummyread();
dummyread();
return reply;
@@ -39,8 +39,8 @@
PosL = (int*)nPosL;
PosR = (int*)nPosR;
- _serial.printf("H\n");
- _serial.scanf("h,%d,%d",PosL,PosR);
+ this->printf("H\n");
+ this->scanf("h,%d,%d",PosL,PosR);
dummyread();
dummyread();
}
@@ -48,17 +48,9 @@
int Koala::read_channel(int channel) {
int reply;
- _serial.printf("I,%d\n",channel);
- _serial.scanf("i,%d",&reply);
+ this->printf("I,%d\n",channel);
+ this->scanf("i,%d",&reply);
dummyread();
dummyread();
return reply;
-}
-
-int printf(const char* format, ...) {
- return _serial.printf(format)
-}
-
-int scanf(const char* format, ... ) {
- return _serial.scanf(format)
}
\ No newline at end of file