Skip to content

Add PERIPH_A and PERIPH_B to Due pinMode() options #2257

Closed
@CF20852

Description

@CF20852

I wanted to configure TIOA7 to come out on D3 on my Due. I found that I could do so by adding

#define PERIPH_A 0x3
#define PERIPH_B 0x4

to wiring_constants.h in the hardware/arduino/sam/cores/arduino folder, and

    case PERIPH_A:
        PIO_Configure(
            g_APinDescription[ulPin].pPort,
            PIO_PERIPH_A,
            g_APinDescription[ulPin].ulPin,
            g_APinDescription[ulPin].ulPinConfiguration ) ;

        break ;

    case PERIPH_B:
        PIO_Configure(
            g_APinDescription[ulPin].pPort,
            PIO_PERIPH_B,
            g_APinDescription[ulPin].ulPin,
            g_APinDescription[ulPin].ulPinConfiguration ) ;

        break ;

to the switch/case statement in the pinMode code in wiring_digital.c in the same folder.
Then in my sketch I can just write

  pinMode(3, PERIPH_B);

I figure if this is was a good idea, someone would have already done it :-) But here it is, just in case.
And yes, the PERIPH_A stuff is superfluous to my immediate need.

Metadata

Metadata

Assignees

Labels

Architecture: SAMApplies only to the SAM microcontrollers (Due)Component: CoreRelated to the code for the standard Arduino APIfeature requestA request to make an enhancement (not a bug fix)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions