Skip to content

this closes issue #2198 #2486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions hardware/arduino/sam/cores/arduino/wiring_digital.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ extern void pinMode( uint32_t ulPin, uint32_t ulMode )
switch ( ulMode )
{
case INPUT:
#if defined __SAM3X8E__ || defined __SAM3X8H__

if(g_APinDescription[ulPin].ulPinType != NO_ADC)
adc_enable_channel( ADC, g_APinDescription[ulPin].ulADCChannelNumber);
#endif

/* Enable peripheral for clocking input */
pmc_enable_periph_clk( g_APinDescription[ulPin].ulPeripheralId ) ;
PIO_Configure(
Expand All @@ -52,6 +58,12 @@ extern void pinMode( uint32_t ulPin, uint32_t ulMode )
break ;

case OUTPUT:
#if defined __SAM3X8E__ || defined __SAM3X8H__

if(g_APinDescription[ulPin].ulPinType != NO_ADC)
adc_disable_channel( ADC, g_APinDescription[ulPin].ulADCChannelNumber);
#endif

PIO_Configure(
g_APinDescription[ulPin].pPort,
PIO_OUTPUT_1,
Expand Down