aboutsummaryrefslogtreecommitdiff
path: root/cores
diff options
context:
space:
mode:
Diffstat (limited to 'cores')
-rw-r--r--cores/arduino/Print.cpp2
-rw-r--r--cores/arduino/Stream.h3
-rw-r--r--cores/arduino/USBCore.cpp10
-rw-r--r--cores/arduino/WString.cpp2
4 files changed, 12 insertions, 5 deletions
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 5a092af..652fed0 100644
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -257,7 +257,7 @@ size_t Print::printFloat(double number, uint8_t digits)
while (digits-- > 0)
{
remainder *= 10.0;
- int toPrint = int(remainder);
+ unsigned int toPrint = (unsigned int)(remainder);
n += print(toPrint);
remainder -= toPrint;
}
diff --git a/cores/arduino/Stream.h b/cores/arduino/Stream.h
index db71bb6..e4fd433 100644
--- a/cores/arduino/Stream.h
+++ b/cores/arduino/Stream.h
@@ -66,7 +66,8 @@ class Stream : public Print
// parsing methods
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
-
+ unsigned long getTimeout(void) { return _timeout; }
+
bool find(char *target); // reads data from the stream until the target string is found
bool find(uint8_t *target) { return find ((char *)target); }
// returns true if target string is found, false if timed out (see setTimeout)
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index 44dce72..ddc4812 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -1,6 +1,7 @@
-/* Copyright (c) 2010, Peter Barrett
+/* Copyright (c) 2010, Peter Barrett
+** Sleep/Wakeup support added by Michael Dreher
**
** Permission to use, copy, modify, and/or distribute this software for
** any purpose with or without fee is hereby granted, provided that the
@@ -266,6 +267,11 @@ int USB_Send(u8 ep, const void* d, int len)
if (!_usbConfiguration)
return -1;
+ if (_usbSuspendState & (1<<SUSPI)) {
+ //send a remote wakeup
+ UDCON |= (1 << RMWKUP);
+ }
+
int r = len;
const u8* data = (const u8*)d;
u8 timeout = 250; // 250ms timeout on send? TODO
@@ -733,7 +739,7 @@ static inline void USB_ClockEnable()
ISR(USB_GEN_vect)
{
u8 udint = UDINT;
- UDINT = UDINT &= ~((1<<EORSTI) | (1<<SOFI)); // clear the IRQ flags for the IRQs which are handled here, except WAKEUPI and SUSPI (see below)
+ UDINT &= ~((1<<EORSTI) | (1<<SOFI)); // clear the IRQ flags for the IRQs which are handled here, except WAKEUPI and SUSPI (see below)
// End of Reset
if (udint & (1<<EORSTI))
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index cd3e0e8..9975303 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -193,7 +193,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
void String::move(String &rhs)
{
if (buffer) {
- if (capacity >= rhs.len) {
+ if (rhs && capacity >= rhs.len) {
strcpy(buffer, rhs.buffer);
len = rhs.len;
rhs.len = 0;