Skip to content

Commit f179794

Browse files
committed
Adding pin-change interrupt pin mapping macros to pins_arduino.h.
http://code.google.com/p/arduino/issues/detail?id=490
1 parent f14fd94 commit f179794

File tree

4 files changed

+30
-70
lines changed

4 files changed

+30
-70
lines changed

hardware/arduino/pins/mega/pins_arduino.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,31 @@ const static uint8_t A13 = 67;
5353
const static uint8_t A14 = 68;
5454
const static uint8_t A15 = 69;
5555

56+
// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins)
57+
// Only pins available for RECEIVE (TRANSMIT can be on any pin):
58+
// (I've deliberately left out pin mapping to the Hardware USARTs - seems senseless to me)
59+
// Pins: 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69
60+
61+
#define digitalPinToPCICR(p) ( (((p) >= 10) && ((p) <= 13)) || \
62+
(((p) >= 50) && ((p) <= 53)) || \
63+
(((p) >= 62) && ((p) <= 69)) ? (&PCICR) : ((uint8_t *)0) )
64+
65+
#define digitalPinToPCICRbit(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? 0 : \
66+
( (((p) >= 62) && ((p) <= 69)) ? 2 : \
67+
0 ) )
68+
69+
#define digitalPinToPCMSK(p) ( (((p) >= 10) && ((p) <= 13)) || (((p) >= 50) && ((p) <= 53)) ? (&PCMSK0) : \
70+
( (((p) >= 62) && ((p) <= 69)) ? (&PCMSK2) : \
71+
((uint8_t *)0) ) )
72+
73+
#define digitalPinToPCMSKbit(p) ( (((p) >= 10) && ((p) <= 13)) ? ((p) - 6) : \
74+
( ((p) == 50) ? 3 : \
75+
( ((p) == 51) ? 2 : \
76+
( ((p) == 52) ? 1 : \
77+
( ((p) == 53) ? 0 : \
78+
( (((p) >= 62) && ((p) <= 69)) ? ((p) - 62) : \
79+
0 ) ) ) ) ) )
80+
5681
#ifdef ARDUINO_MAIN
5782

5883
const uint16_t PROGMEM port_to_mode_PGM[] = {

hardware/arduino/pins/standard/pins_arduino.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ const static uint8_t A5 = 19;
4545
const static uint8_t A6 = 20;
4646
const static uint8_t A7 = 21;
4747

48+
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
49+
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
50+
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
51+
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))
52+
4853
#ifdef ARDUINO_MAIN
4954

5055
// On the Arduino board, digital pins are also used

libraries/SoftwareSerial/SoftwareSerial.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ The latest version of this library can always be found at
4242
#include <avr/pgmspace.h>
4343
#include "Arduino.h"
4444
#include "SoftwareSerial.h"
45-
#include "icrmacros.h"
4645
//
4746
// Lookup table
4847
//

libraries/SoftwareSerial/icrmacros.h

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)