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.
Fork of ArduinoAPI by
Revision 5:8072d40c7f3c, committed 2015-03-14
- Comitter:
- JojoS
- Date:
- Sat Mar 14 10:15:36 2015 +0000
- Parent:
- 4:1fec2e4c60e5
- Child:
- 6:926a4df8c0fb
- Commit message:
- improved write: check writeable before putc();
Changed in this revision
--- a/ArduinoSerial.cpp Tue Feb 10 10:39:42 2015 +0000
+++ b/ArduinoSerial.cpp Sat Mar 14 10:15:36 2015 +0000
@@ -1,9 +1,19 @@
#include "ArduinoSerial.h"
+DigitalOut _testPin(P1_20);
+class testPin {
+ public:
+ testPin() {_testPin=1;};
+ ~testPin() {_testPin=0;};
+};
+
+
ArduinoSerialLinkedNode ArduinoSerial::ms_list_head = {NULL, NULL};
unsigned int ArduinoSerial::ms_instance_counter = 0;
void ArduinoSerial::uartIrqCallback(void) {
+ testPin();
+
ArduinoSerialLinkedNode *p;
for (p = ms_list_head.next; p != &ms_list_head; p = p->next) {
if (p->data != NULL) {
@@ -83,6 +93,7 @@
}
size_t ArduinoSerial::write(uint8_t data) {
+ while (!writeable()) {};
putc(data);
return 1;
}
--- a/ArduinoSerial.h Tue Feb 10 10:39:42 2015 +0000
+++ b/ArduinoSerial.h Sat Mar 14 10:15:36 2015 +0000
@@ -4,6 +4,7 @@
#include "Print.h"
#include "WString.h"
+
typedef enum {
ARDUINOSERIAL_BUFFER_SIZE = 512,
} ArduinoSerialConstant;
--- a/WString.cpp Tue Feb 10 10:39:42 2015 +0000
+++ b/WString.cpp Sat Mar 14 10:15:36 2015 +0000
@@ -21,7 +21,6 @@
#include "WString.h"
-
/*********************************************/
/* Constructors */
/*********************************************/
@@ -134,8 +133,13 @@
return 0;
}
+#define CHUNK_SIZE 16U
+
unsigned char String::changeBuffer(unsigned int maxStrLen)
{
+ // testPin();
+
+ //maxStrLen = ((maxStrLen / CHUNK_SIZE) + 1) * CHUNK_SIZE;
char *newbuffer = (char *)realloc(buffer, maxStrLen + 1);
if (newbuffer) {
buffer = newbuffer;
