From 4fdf87c0e8a801093d5f0513e4aab122e20bfc2e Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 25 Jun 2014 15:58:38 +0200 Subject: Allow variants to define an initVariant() function that is called at startup. See #2080 and #2139. --- cores/arduino/Arduino.h | 1 + cores/arduino/main.cpp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 6b923a4..630f0d6 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -118,6 +118,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 +// 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