We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba0488d commit 0f3f80aCopy full SHA for 0f3f80a
cores/arduino/wiring_digital.c
@@ -82,8 +82,10 @@ void digitalWrite( uint32_t ulPin, uint32_t ulVal )
82
return ;
83
}
84
85
- // Enable pull-up resistor
86
- PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].reg=(uint8_t)(PORT_PINCFG_PULLEN) ;
+ if ( (PORT->Group[g_APinDescription[ulPin].ulPort].DIRSET.reg & (1ul << g_APinDescription[ulPin].ulPin)) == 0 ) {
+ // the pin is not an output, disable pull-up if val is LOW, otherwise enable pull-up
87
+ PORT->Group[g_APinDescription[ulPin].ulPort].PINCFG[g_APinDescription[ulPin].ulPin].bit.PULLEN = (ulVal != LOW) ;
88
+ }
89
90
switch ( ulVal )
91
{
0 commit comments