diff options
author | Cristian Maglie <c.maglie@bug.st> | 2014-07-01 17:28:45 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-07-01 17:28:45 +0200 |
commit | 452cab0593ba0fcca89f56d57de6cee67bce78ac (patch) | |
tree | 506fec5846f97dfe5ef4c4f242bcb234b41687ba | |
parent | 07ef56e3cbd6ffc9b083e84777d2ec4186514202 (diff) | |
parent | b4fc466b47e9d69f3d189987dcf0750713afff1a (diff) |
Merge pull request #2139 from cmaglie/init-variant
Allow variants to define an initVariant() function that is called at startup
-rwxr-xr-x | cores/arduino/Arduino.h | 1 | ||||
-rw-r--r-- | cores/arduino/main.cpp | 7 |
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 |