aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
Diffstat (limited to 'cores/arduino')
-rwxr-xr-xcores/arduino/Arduino.h1
-rw-r--r--cores/arduino/CDC.cpp2
-rw-r--r--cores/arduino/USBAPI.h1
-rw-r--r--cores/arduino/main.cpp7
4 files changed, 11 insertions, 0 deletions
diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h
index 93a3525..425dfcb 100755
--- a/cores/arduino/Arduino.h
+++ b/cores/arduino/Arduino.h
@@ -113,6 +113,7 @@ typedef uint8_t boolean;
typedef uint8_t byte;
void init(void);
+void initVariant(void);
void pinMode(uint8_t, uint8_t);
void digitalWrite(uint8_t, uint8_t);
diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp
index 3cfd1b7..aae91c2 100644
--- a/cores/arduino/CDC.cpp
+++ b/cores/arduino/CDC.cpp
@@ -116,10 +116,12 @@ bool WEAK CDC_Setup(Setup& setup)
void Serial_::begin(unsigned long baud_count)
{
+ peek_buffer = -1;
}
void Serial_::begin(unsigned long baud_count, byte config)
{
+ peek_buffer = -1;
}
void Serial_::end(void)
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index d506b58..4846fc2 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -30,6 +30,7 @@ class Serial_ : public Stream
private:
int peek_buffer;
public:
+ Serial_() { peek_buffer = -1; };
void begin(unsigned long);
void begin(unsigned long, uint8_t);
void end(void);
diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp
index 0ad6962..091c365 100644
--- a/cores/arduino/main.cpp
+++ b/cores/arduino/main.cpp
@@ -19,10 +19,17 @@
#include <Arduino.h>
+// Weak empty variant initialization function.
+// May be redefined by variant files.
+void initVariant() __attribute__((weak));
+void initVariant() { }
+
int main(void)
{
init();
+ initVariant();
+
#if defined(USBCON)
USBDevice.attach();
#endif