diff --git a/RGBmatrixPanel.cpp b/RGBmatrixPanel.cpp index 45f3161..be80890 100644 --- a/RGBmatrixPanel.cpp +++ b/RGBmatrixPanel.cpp @@ -106,7 +106,11 @@ void RGBmatrixPanel::init(uint8_t rows, uint8_t a, uint8_t b, uint8_t c, ) { #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP32) // R1, G1, B1, R2, G2, B2 pins - static const uint8_t defaultrgbpins[] = { 2,3,4,5,6,7 }; + #if defined(ARDUINO_SAMD_NANO_33_IOT) + static const uint8_t defaultrgbpins[] = { 4,5,6,7,8,9 }; + #else + static const uint8_t defaultrgbpins[] = { 2,3,4,5,6,7 }; + #endif memcpy(rgbpins, pinlist ? pinlist : defaultrgbpins, sizeof rgbpins); #if defined(ARDUINO_ARCH_SAMD) // All six RGB pins MUST be on the same PORT # as CLK @@ -147,7 +151,7 @@ void RGBmatrixPanel::init(uint8_t rows, uint8_t a, uint8_t b, uint8_t c, addrbport = portOutputRegister(digitalPinToPort(b)); addrbmask = digitalPinToBitMask(b); addrcport = portOutputRegister(digitalPinToPort(c)); - addrcmask = digitalPinToBitMask(c); + addrcmask = digitalPinToBitMask(c); plane = nPlanes - 1; row = nRows - 1; swapflag = false; @@ -870,10 +874,10 @@ void RGBmatrixPanel::updateDisplay(void) { ((ptr[i+WIDTH*2] << 2) & 0x0C); CLKPORT = tick; // Clock lo CLKPORT = tock; // Clock hi - } + } #elif defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP32) for (int i=0; i #include "image.h" // Precomputed colorwheel image is here +// Most of the signal pins are configurable, but the CLK pin has some +// special constraints. On 8-bit AVR boards it must be on PORTB... +// Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), +// Pin 11 works on the Arduino Mega. +// Pin 8 works on the Adafruit Metro M0 or Arduino Zero, +// Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB +// Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works + #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 diff --git a/examples/plasma_16x32/plasma_16x32.ino b/examples/plasma_16x32/plasma_16x32.ino index 728cf82..ecc3b1c 100644 --- a/examples/plasma_16x32/plasma_16x32.ino +++ b/examples/plasma_16x32/plasma_16x32.ino @@ -11,16 +11,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 @@ -126,4 +130,3 @@ void loop() { matrix.swapBuffers(false); } - diff --git a/examples/plasma_32x32/plasma_32x32.ino b/examples/plasma_32x32/plasma_32x32.ino index 13d3251..5d6e372 100644 --- a/examples/plasma_32x32/plasma_32x32.ino +++ b/examples/plasma_32x32/plasma_32x32.ino @@ -11,16 +11,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 @@ -121,4 +125,3 @@ void loop() { angle4 -= 0.15; hueShift += 2; } - diff --git a/examples/scrolltext_16x32/scrolltext_16x32.ino b/examples/scrolltext_16x32/scrolltext_16x32.ino index 795af98..3991b64 100644 --- a/examples/scrolltext_16x32/scrolltext_16x32.ino +++ b/examples/scrolltext_16x32/scrolltext_16x32.ino @@ -11,16 +11,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 diff --git a/examples/testcolors_16x32/testcolors_16x32.ino b/examples/testcolors_16x32/testcolors_16x32.ino index 010be58..b156c2d 100644 --- a/examples/testcolors_16x32/testcolors_16x32.ino +++ b/examples/testcolors_16x32/testcolors_16x32.ino @@ -12,16 +12,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 @@ -69,4 +73,3 @@ void setup() { void loop() { // Do nothing -- image doesn't change } - diff --git a/examples/testshapes_16x32/testshapes_16x32.ino b/examples/testshapes_16x32/testshapes_16x32.ino index 61ae36f..b4b270a 100644 --- a/examples/testshapes_16x32/testshapes_16x32.ino +++ b/examples/testshapes_16x32/testshapes_16x32.ino @@ -12,16 +12,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 diff --git a/examples/testshapes_32x32/testshapes_32x32.ino b/examples/testshapes_32x32/testshapes_32x32.ino index 8cc5dba..a9cfb5e 100644 --- a/examples/testshapes_32x32/testshapes_32x32.ino +++ b/examples/testshapes_32x32/testshapes_32x32.ino @@ -12,16 +12,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works #define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 diff --git a/examples/testshapes_32x64/testshapes_32x64.ino b/examples/testshapes_32x64/testshapes_32x64.ino index 6572c70..d2b8361 100644 --- a/examples/testshapes_32x64/testshapes_32x64.ino +++ b/examples/testshapes_32x64/testshapes_32x64.ino @@ -9,16 +9,20 @@ // Most of the signal pins are configurable, but the CLK pin has some // special constraints. On 8-bit AVR boards it must be on PORTB... // Pin 8 works on the Arduino Uno & compatibles (e.g. Adafruit Metro), -// Pin 11 works on the Arduino Mega. On 32-bit SAMD boards it must be -// on the same PORT as the RGB data pins (D2-D7)... +// Pin 11 works on the Arduino Mega. // Pin 8 works on the Adafruit Metro M0 or Arduino Zero, // Pin A4 works on the Adafruit Metro M4 (if using the Adafruit RGB // Matrix Shield, cut trace between CLK pads and run a wire to A4). +// Pin A6 works on the Nano 33 IoT +// On other 32-bit SAMD boards it must be on the same PORT as the RGB +// data pins (D2-D7)... Pin 8 works -#define CLK 8 // USE THIS ON ADAFRUIT METRO M0, etc. +#define CLK 8 // USE THIS ON ARDUINO UNO, ADAFRUIT METRO M0, etc. //#define CLK A4 // USE THIS ON METRO M4 (not M0) //#define CLK 11 // USE THIS ON ARDUINO MEGA -#define OE 9 +//#define CLK A6 // USE THIS ON NANO 33 IoT +#define OE 9 // USE THIS ON EXCEPT ON NANO 33 IoT +//#define OE 11 // USE THIS ON NANO 33 IoT #define LAT 10 #define A A0 #define B A1 diff --git a/library.properties b/library.properties index a24c83e..4e30462 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=RGB matrix Panel -version=1.1.1 +version=1.1.2 author=Adafruit maintainer=Adafruit sentence=Arduino library and example code for the 16x32 RGB matrix panels in the shop