Skip to content

Commit 0c792aa

Browse files
Changed ports/pins for use with Arduino Mega
Please see notes in RGBmatrixPanel.cpp regarding pinouts for use with Mega.
1 parent 2ab6dd4 commit 0c792aa

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

RGBmatrixPanel.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,19 @@ performance and/or lower CPU utilization:
3939
// Arduino Mega hasn't actually been tested -- use at your own peril!
4040
// Because digital pins 2-7 don't map to a contiguous port register,
4141
// the Mega will require connecting the matrix data lines to different
42-
// pins. Ports A, C, and L all offer the requisite contiguous 6 bits;
43-
// I chose PORTL (pins 42-47) because the peripheral functions are not
44-
// unique (hardware PWM is available on other pins, but the external
45-
// memory interface on ports A & C is not). Clock may be any pin on
46-
// PORTH -- this was chosen because the demos won't require different
47-
// code or wiring for the remaining signal lines.
48-
#define DATAPORT PORTL
49-
#define DATADIR DDRL
50-
#define SCLKPORT PORTH
42+
// pins. Ports A, C, and L all offer the requisite contiguous 6 bits.
43+
// I wanted to use PORTL in order to keep the external memory interface
44+
// free, but accessing the upper PORT registers in assembly seems to
45+
// require some additional flaming hoops and doesn't work with the
46+
// inline code here. PORTA is used instead (Mega pins 22-29, though
47+
// only 24-29 are actually connected to the LED matrix). Clock may be
48+
// any pin on PORTB -- on the Mega, this CAN'T be pins 8 or 9 (these
49+
// are on PORTH), thus the wiring will need to be slightly different
50+
// than the tutorial's explanation on the Uno, etc. Pins 10-13 are all
51+
// fair game for the clock, as are pins 50-53.
52+
#define DATAPORT PORTA
53+
#define DATADIR DDRA
54+
#define SCLKPORT PORTB
5155
#elif defined(__AVR_ATmega32U4__)
5256
// Arduino Leonardo is still a work in progress -- DO NOT USE!!!
5357
// Unlike the Uno, digital pins 2-7 do NOT map to a contiguous port

0 commit comments

Comments
 (0)