Skip to content

Commit 3645829

Browse files
committed
Allow boards to skip pinMode(INPUT) initialization
1 parent cd66b99 commit 3645829

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cores/arduino/wiring.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,15 @@ void init( void )
8080
// Clock ADC/DAC for Analog
8181
PM->APBCMASK.reg |= PM_APBCMASK_ADC | PM_APBCMASK_DAC ;
8282

83+
// Defining VERY_LOW_POWER breaks Arduino APIs since all pins are considered INPUT at startup
84+
// However, it really lowers the power consumption by a factor of 20 in low power mode (0.03mA vs 0.6mA)
85+
#ifndef VERY_LOW_POWER
8386
// Setup all pins (digital and analog) in INPUT mode (default is nothing)
8487
for (uint32_t ul = 0 ; ul < NUM_DIGITAL_PINS ; ul++ )
8588
{
8689
pinMode( ul, INPUT ) ;
8790
}
91+
#endif
8892

8993
// Initialize Analog Controller
9094
// Setting clock

0 commit comments

Comments
 (0)