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: source/AsyncSerial.cpp
- Revision:
- 2:efec63739aa3
- Parent:
- 1:a3f39ec7d5f2
- Child:
- 3:af3caa18e928
--- a/source/AsyncSerial.cpp Mon Mar 30 17:12:30 2015 +0100
+++ b/source/AsyncSerial.cpp Tue Mar 31 10:50:40 2015 +0000
@@ -2,7 +2,6 @@
#include "mbed.h"
-template<class T>
AsyncSerial::AsyncSerial(PinName tx, PinName rx, PinName rts, PinName cts)
: SerialBase(tx, rx),
@@ -118,22 +117,6 @@
sendDoneHandler = handler;
sendObject = NULL;
- sendMember = 0;
-
- send(buffer, length);
- }
-}
-
-template<typename T>
-void AsyncSerial::send(T *object, void (T::*member)(void), uint8_t* buffer, uint16_t length)
-{
- if (object && member && buffer && length)
- {
- sendObject = static_cast<void*>(object);
- memcpy(sendMember, &member, sizeof(member));
- sendDoneObject = &AsyncSerial::membercaller<T>;
-
- sendDoneHandler = 0;
send(buffer, length);
}
@@ -148,8 +131,6 @@
SerialBase::_base_putc(sendBuffer[sendIndex]);
}
-
-
void AsyncSerial::receive(receive_done_t handler,
uint8_t* buffer, uint16_t maxLength,
const uint8_t* conditionBuffer, uint16_t conditionLength,
@@ -165,26 +146,8 @@
}
}
-template<typename T>
-void AsyncSerial::receive(T *object, void (T::*member)(uint8_t*, uint16_t),
- uint8_t* buffer, uint16_t maxLength,
- const uint8_t* conditionBuffer, uint16_t conditionLength,
- uint32_t timeoutMilli)
-{
- if (object && member && receiveBuffer && maxLength)
- {
- receiveObject = static_cast<void*>(object);
- memcpy(receiveMember, (uint8_t*) &member, sizeof(member));
- receiveDoneObject = &AsyncSerial::membercaller<T>;
-
- receiveDoneHandler = NULL;
-
- receive(buffer, maxLength, conditionBuffer, conditionLength, timeoutMilli);
- }
-}
-
-void AsyncSerial::receive(uint8_t* receiveBuffer, uint16_t maxLength,
- const uint8_t* conditionBuffer, uint16_t conditionLength,
+void AsyncSerial::receive(uint8_t* buffer, uint16_t maxLength,
+ const uint8_t* _conditionBuffer, uint16_t _conditionLength,
uint32_t timeoutMilli)
{
receiveBuffer = buffer;
@@ -198,15 +161,6 @@
timeout.attach_us<AsyncSerial>(this, &AsyncSerial::getDone, timeoutMilli * 1000);
}
-template<typename T>
-static void AsyncSerial::membercaller(void* object, uint8_t* member, uint8_t* buffer, uint16_t length)
-{
- T* o = static_cast<T*>(object);
- void (T::*m)(uint8_t*, uint16_t);
- memcpy(&m, member, sizeof(m));
- (o->*m)(buffer, length);
-}
-
int AsyncSerial::getc()
{
return SerialBase::_base_getc();

