aboutsummaryrefslogtreecommitdiff
path: root/cores/arduino
diff options
context:
space:
mode:
authorCristian Maglie <c.maglie@bug.st>2014-07-01 17:28:45 +0200
committerCristian Maglie <c.maglie@bug.st>2014-07-01 17:28:45 +0200
commit452cab0593ba0fcca89f56d57de6cee67bce78ac (patch)
tree506fec5846f97dfe5ef4c4f242bcb234b41687ba /cores/arduino
parent07ef56e3cbd6ffc9b083e84777d2ec4186514202 (diff)
parentb4fc466b47e9d69f3d189987dcf0750713afff1a (diff)
Merge pull request #2139 from cmaglie/init-variant
Allow variants to define an initVariant() function that is called at startup
Diffstat (limited to 'cores/arduino')
-rwxr-xr-xcores/arduino/Arduino.h1
-rw-r--r--cores/arduino/main.cpp7
2 files changed, 8 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/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