Skip to content

Commit e4cb57d

Browse files
committed
First try to support architecture dependent query functions (digitalPinToPort, etc)
1 parent 932a8fd commit e4cb57d

File tree

2 files changed

+102
-110
lines changed

2 files changed

+102
-110
lines changed

cores/arduino/Arduino.h

+9-14
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,17 @@ extern void loop( void ) ;
5353
// Get the bit location within the hardware port of the given virtual pin.
5454
// This comes from the pins_*.c file for the active board configuration.
5555
//
56-
// These perform slightly better as macros compared to inline functions
57-
//
58-
#define digitalPinToPort( ulPin ) ( g_APinDescription[ulPin]->pPort->PIO_PDSR )
59-
#define digitalPinToBitMask( ulPin ) ( g_APinDescription[ulPin]->dwPin )
60-
#define digitalPinToTimer( P ) ( )
61-
#define analogInPinToBit( P ) ( P )
62-
#define portOutputRegister( P ) ( )
63-
#define portInputRegister( P ) ( )
64-
#define portModeRegister( P ) ( )
56+
#define digitalPinToPort(P) ( g_APinDescription[P]->pPort )
57+
#define digitalPinToBitMask(P) ( g_APinDescription[P]->ulPin )
58+
#define digitalPinToTimer(P) ( )
59+
//#define analogInPinToBit(P) ( )
60+
#define portOutputRegister(port) ( port->PIO_ODSR )
61+
#define portInputRegister(port) ( port->PIO_PDSR )
62+
//#define portModeRegister(P) ( )
6563

6664
//#define NOT_A_PIN 0 // defined in pio.h/EPioType
6765
#define NOT_A_PORT 0
6866

69-
#define NOT_ON_TIMER 0
70-
#define TIMER0 1
71-
7267
typedef enum _EExt_Interrupts
7368
{
7469
EXTERNAL_INT_0=0,
@@ -122,7 +117,7 @@ typedef enum _EAnalogChannel
122117
// Definitions for PWM channels
123118
typedef enum _EPWMChannel
124119
{
125-
NO_PWM=-1,
120+
NOT_ON_PWM=-1,
126121
PWM_CH0=0,
127122
PWM_CH1,
128123
PWM_CH2,
@@ -136,7 +131,7 @@ typedef enum _EPWMChannel
136131
// Definitions for TC channels
137132
typedef enum _ETCChannel
138133
{
139-
NO_TC=-1,
134+
NOT_ON_TIMER=-1,
140135
TC0_CHA0=0,
141136
TC0_CHB0,
142137
TC0_CHA1,

0 commit comments

Comments
 (0)