1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-18 12:54:25 +01:00

Added INPUT_PULLUP mode for pinMode command

This commit is contained in:
Cristian Maglie 2012-06-25 16:31:34 +02:00
parent 8c5e21470f
commit 6640bc9bd2
2 changed files with 11 additions and 0 deletions

View File

@ -28,6 +28,7 @@ extern "C"{
#define INPUT 0x0 #define INPUT 0x0
#define OUTPUT 0x1 #define OUTPUT 0x1
#define INPUT_PULLUP 0x2
#define true 0x1 #define true 0x1
#define false 0x0 #define false 0x0

View File

@ -41,6 +41,16 @@ extern void pinMode( uint32_t ulPin, uint32_t ulMode )
0 ) ; 0 ) ;
break ; break ;
case INPUT_PULLUP:
/* Enable peripheral for clocking input */
pmc_enable_periph_clk( g_APinDescription[ulPin].ulPeripheralId ) ;
PIO_Configure(
g_APinDescription[ulPin].pPort,
PIO_INPUT,
g_APinDescription[ulPin].ulPin,
PIO_PULLUP ) ;
break ;
case OUTPUT: case OUTPUT:
PIO_Configure( PIO_Configure(
g_APinDescription[ulPin].pPort, g_APinDescription[ulPin].pPort,