Skip to content

Commit

Permalink
Added ESP32_JC_RIBBON_PINOUT and made it default.
Browse files Browse the repository at this point in the history
Tested with Jason Coon ESP32 shield.
  • Loading branch information
marcmerlin committed Feb 26, 2019
1 parent 29c9ad4 commit 9f25daa
Showing 1 changed file with 143 additions and 53 deletions.
196 changes: 143 additions & 53 deletions src/MatrixHardware_ESP32_V0.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,149 @@
#define ESP32_FORUM_PINOUT 0
#define ESP32_FORUM_PINOUT_WITH_LATCH 1
#define SMARTLED_SHIELD_V0_PINOUT 2
#define ESP32_JC_RIBBON_PINOUT 3

#ifndef GPIOPINOUT
#define GPIOPINOUT ESP32_JC_RIBBON_PINOUT
//#define GPIOPINOUT ESP32_FORUM_PINOUT
#endif
//#define GPIOPINOUT ESP32_FORUM_PINOUT_WITH_LATCH // note this mode is untested as of 2018-05-17 - not being used anymore now that SmartMatrix Shield is available
#define GPIOPINOUT SMARTLED_SHIELD_V0_PINOUT
//#define GPIOPINOUT SMARTLED_SHIELD_V0_PINOUT

//Upper half RGB
#define BIT_R1 (1<<0)
#define BIT_G1 (1<<1)
#define BIT_B1 (1<<2)
//Lower half RGB
#define BIT_R2 (1<<3)
#define BIT_G2 (1<<4)
#define BIT_B2 (1<<5)

// Control Signals
#define BIT_LAT (1<<6)
#define BIT_OE (1<<7)

#define BIT_A (1<<8)
#define BIT_B (1<<9)
#define BIT_C (1<<10)
#define BIT_D (1<<11)
#define BIT_E (1<<12)


#if (GPIOPINOUT == ESP32_JC_RIBBON_PINOUT)
#pragma message "Jason Coon ESP32 shield wiring"
// This pinout takes a ribbon cable and flattens it, pin order is 1, 9, 2, 10 ...
// it connects to https://www.tindie.com/products/jasoncoon/16-output-nodemcu-esp32-wifi-ble-led-controller/
// That shield's pinout is this for the output of the level shifters:
// 23, 22, 3, 21, 19, 18, 5, 17, 16, 4, 0, 2, 15, 14, 12, 13

#if (GPIOPINOUT == ESP32_FORUM_PINOUT)
// ADDX is output directly using GPIO
#define CLKS_DURING_LATCH 0
#define MATRIX_I2S_MODE I2S_PARALLEL_BITS_16
#define MATRIX_DATA_STORAGE_TYPE uint16_t

//Upper half RGB
#define BIT_R1 (1<<0)
#define BIT_G1 (1<<1)
#define BIT_B1 (1<<2)
//Lower half RGB
#define BIT_R2 (1<<3)
#define BIT_G2 (1<<4)
#define BIT_B2 (1<<5)
/*
HUB 75
01 02 B0
03 04 Gnd
05 06 G1
07 08 E
09 10 B
11 12 D
13 14 STB/Latch
15 16 Gnd 16/RX2
ESP32 pin / comment
1 R0 23 Red Data (columns 1-16)
2 G0 22 Green Data (columns 1-16)
3 B0 3/RX Blue Data (columns 1-16)
4 GND 21/GND Ground
5 R1 19 Red Data (columns 17-32)
6 G1 18 Green Data (columns 17-32)
7 B1 5 Blue Data (columns 17-32)
8 E 17/TX2 Demux Input E for 64x64 panels
9 A 16/RX2 Demux Input A0
10 B 4 Demux Input A1
// Control Signals
#define BIT_LAT (1<<6)
#define BIT_OE (1<<7)
11 C 0/Boot Demux Input A2
12 D 2 Demux Input E1, E3 (32x32 panels only)
13 CLK 15 LED Drivers' Clock
14 STB 14 LED Drivers' Latch
15 OE 12 LED Drivers' Output Enable
16 GND 13/GND Ground
*/
#define R1_PIN 23
#define G1_PIN 22
#define B1_PIN 3
#define R2_PIN 19
#define G2_PIN 18
#define B2_PIN 5

#define A_PIN 16
#define B_PIN 4
#define C_PIN 0
#define D_PIN 2
#define E_PIN 17

#define CLK_PIN 15
#define LAT_PIN 14
#define OE_PIN 12

#define GPIO_PWM0A_OUT GPIO_NUM_32
#define GPIO_SYNC0_IN GPIO_NUM_34

#elif (GPIOPINOUT == ESP32_FORUM_PINOUT)

#define BIT_A (1<<8)
#define BIT_B (1<<9)
#define BIT_C (1<<10)
#define BIT_D (1<<11)
#define BIT_E (1<<12)
#pragma message "ESP32 forum wiring"

// ADDX is output directly using GPIO
#define CLKS_DURING_LATCH 0
#define MATRIX_I2S_MODE I2S_PARALLEL_BITS_16
#define MATRIX_DATA_STORAGE_TYPE uint16_t

/*
HUB 75
01 02 B0
03 04 Gnd
05 06 G1
07 08 E
09 10 B
11 12 D
13 14 STB/Latch
15 16 Gnd 16/RX2
ESP32 pin / comment
1 R0 2 Red Data (columns 1-16)
2 G0 15 Green Data (columns 1-16)
3 B0 4 Blue Data (columns 1-16)
4 GND GND Ground
5 R1 16/RX2 Red Data (columns 17-32)
6 G1 27 Green Data (columns 17-32)
7 B1 17/TX2 Blue Data (columns 17-32)
8 E 12 Demux Input E for 64x64 panels
9 A 5 Demux Input A0
10 B 18 Demux Input A1
11 C 19 Demux Input A2
12 D 21 Demux Input E1, E3 (32x32 panels only)
13 CLK 22 LED Drivers' Clock
14 STB 26 LED Drivers' Latch
15 OE 25 LED Drivers' Output Enable
16 GND GND Ground
*/
#define R1_PIN 2
#define G1_PIN 15
#define B1_PIN 4
Expand All @@ -80,33 +193,15 @@

#define GPIO_PWM0A_OUT GPIO_NUM_32
#define GPIO_SYNC0_IN GPIO_NUM_34
#endif

#if (GPIOPINOUT == ESP32_FORUM_PINOUT_WITH_LATCH)
#elif (GPIOPINOUT == ESP32_FORUM_PINOUT_WITH_LATCH)
#pragma message "ESP32 forum wiring with latch"

// ADDX is output on RGB pins and stored in external latch (need multiple of 32-bits for full data struct, so pad 2 CLKs to 4 here)
#define MATRIX_I2S_MODE I2S_PARALLEL_BITS_8
#define MATRIX_DATA_STORAGE_TYPE uint8_t
#define CLKS_DURING_LATCH 4

//Upper half RGB
#define BIT_R1 (1<<0)
#define BIT_G1 (1<<1)
#define BIT_B1 (1<<2)
//Lower half RGB
#define BIT_R2 (1<<3)
#define BIT_G2 (1<<4)
#define BIT_B2 (1<<5)

// Control Signals
#define BIT_LAT (1<<6)
#define BIT_OE (1<<7)

#define BIT_A (1<<8)
#define BIT_B (1<<9)
#define BIT_C (1<<10)
#define BIT_D (1<<11)
#define BIT_E (1<<12)

#define R1_PIN 2
#define G1_PIN 15
#define B1_PIN 4
Expand All @@ -126,26 +221,21 @@

#define GPIO_PWM0A_OUT GPIO_NUM_32
#define GPIO_SYNC0_IN GPIO_NUM_34
#endif

#if (GPIOPINOUT == SMARTLED_SHIELD_V0_PINOUT)
#elif (GPIOPINOUT == SMARTLED_SHIELD_V0_PINOUT)

#pragma message "ESP32 SmartLED shield V0 pinout"

// ADDX is output on RGB pins and stored in external latch (need multiple of 32-bits for full data struct, so pad 2 CLKs to 4 here)
#define MATRIX_I2S_MODE I2S_PARALLEL_BITS_8
#define MATRIX_DATA_STORAGE_TYPE uint8_t
#define CLKS_DURING_LATCH 4

//Upper half RGB
#define BIT_R1 (1<<0)
#define BIT_G1 (1<<1)
#define BIT_B1 (1<<2)
//Lower half RGB
#define BIT_R2 (1<<3)
#define BIT_G2 (1<<4)
#define BIT_B2 (1<<5)

// Control Signals
#define BIT_LAT (1<<6)
#define BIT_OE (1<<7)
#undef BIT_A
#undef BIT_B
#undef BIT_C
#undef BIT_D
#undef BIT_E

#define R1_PIN 4
#define G1_PIN 21
Expand Down

0 comments on commit 9f25daa

Please sign in to comment.