Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 452cab0

Browse files
committedJul 1, 2014
Merge pull request #2139 from cmaglie/init-variant
Allow variants to define an initVariant() function that is called at startup
2 parents 07ef56e + b4fc466 commit 452cab0

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
 

‎cores/arduino/Arduino.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ typedef uint8_t boolean;
113113
typedef uint8_t byte;
114114

115115
void init(void);
116+
void initVariant(void);
116117

117118
void pinMode(uint8_t, uint8_t);
118119
void digitalWrite(uint8_t, uint8_t);

‎cores/arduino/main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919

2020
#include <Arduino.h>
2121

22+
// Weak empty variant initialization function.
23+
// May be redefined by variant files.
24+
void initVariant() __attribute__((weak));
25+
void initVariant() { }
26+
2227
int main(void)
2328
{
2429
init();
2530

31+
initVariant();
32+
2633
#if defined(USBCON)
2734
USBDevice.attach();
2835
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.