From 7a31770a9ae88f9b0482fb8a1e4cc702cacaf86e Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 19 Jun 2014 19:49:47 +0200 Subject: Allow variants to define an initVariant() function that is called at startup. See #2080 --- cores/arduino/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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 +// 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 -- cgit v1.2.3-18-g5258 From b4fc466b47e9d69f3d189987dcf0750713afff1a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 27 Jun 2014 14:26:32 +0200 Subject: initVariant() is now declared as external "C" function. See #2080 for more details. --- cores/arduino/Arduino.h | 1 + 1 file changed, 1 insertion(+) 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); -- cgit v1.2.3-18-g5258