Skip to content

Commit 1708161

Browse files
committed
Merge pull request #2319 from cmaglie/ide-1.5.x-sam-portModeRegister
(Arduino Due/SAM) Removed macro digitalPinToTimer and added comment for portModeRegister
2 parents f85a728 + 974613a commit 1708161

File tree

1 file changed

+18
-2
lines changed
  • hardware/arduino/sam/variants/arduino_due_x

1 file changed

+18
-2
lines changed

Diff for: hardware/arduino/sam/variants/arduino_due_x/variant.h

+18-2
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,29 @@ extern "C"{
6161

6262
#define digitalPinToPort(P) ( g_APinDescription[P].pPort )
6363
#define digitalPinToBitMask(P) ( g_APinDescription[P].ulPin )
64-
#define digitalPinToTimer(P) ( )
6564
//#define analogInPinToBit(P) ( )
6665
#define portOutputRegister(port) ( &(port->PIO_ODSR) )
6766
#define portInputRegister(port) ( &(port->PIO_PDSR) )
68-
//#define portModeRegister(P) ( )
6967
#define digitalPinHasPWM(P) ( g_APinDescription[P].ulPWMChannel != NOT_ON_PWM || g_APinDescription[P].ulTCChannel != NOT_ON_TIMER )
7068

69+
/*
70+
* portModeRegister(..) should return a register to set pin mode
71+
* INPUT or OUTPUT by setting the corresponding bit to 0 or 1.
72+
* Unfortunately on SAM architecture the PIO_OSR register is
73+
* read-only and can be set only through the enable/disable registers
74+
* pair PIO_OER/PIO_ODR.
75+
*/
76+
// #define portModeRegister(port) ( &(port->PIO_OSR) )
77+
78+
/*
79+
* digitalPinToTimer(..) is AVR-specific and is not defined for SAM
80+
* architecture. If you need to check if a pin supports PWM you must
81+
* use digitalPinHasPWM(..).
82+
*
83+
* https://github.com/arduino/Arduino/issues/1833
84+
*/
85+
// #define digitalPinToTimer(P)
86+
7187
// Interrupts
7288
#define digitalPinToInterrupt(p) ((p) < NUM_DIGITAL_PINS ? (p) : -1)
7389

0 commit comments

Comments
 (0)