|
8 | 8 |
|
9 | 9 | namespace pimoroni {
|
10 | 10 |
|
11 |
| -Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb, COLOR_ORDER color_order) |
12 |
| - : width(width), height(height), panel_type(panel_type), inverted_stb(inverted_stb), color_order(color_order) |
| 11 | +Hub75::Hub75(uint width, uint height, Pixel *buffer, PanelType panel_type, bool inverted_stb, COLOR_ORDER color_order, bool duo) |
| 12 | + : width(width), height(height), panel_type(panel_type), inverted_stb(inverted_stb), color_order(color_order), duo_mode(duo) |
13 | 13 | {
|
| 14 | + if(duo) { |
| 15 | + pin_r0 += 32; |
| 16 | + pin_g0 += 32; |
| 17 | + pin_b0 += 32; |
| 18 | + pin_r1 += 32; |
| 19 | + pin_g1 += 32; |
| 20 | + pin_b1 += 32; |
| 21 | + pin_row_a += 32; |
| 22 | + pin_row_b += 32; |
| 23 | + pin_row_c += 32; |
| 24 | + pin_row_d += 32; |
| 25 | + pin_row_e += 32; |
| 26 | + pin_clk += 32; |
| 27 | + pin_stb += 32; |
| 28 | + pin_oe += 32; |
| 29 | + pio = pio1; |
| 30 | + pio_set_gpio_base(pio, 16); |
| 31 | + } |
| 32 | + |
14 | 33 | // Set up allllll the GPIO
|
15 | 34 | gpio_init(pin_r0); gpio_set_function(pin_r0, GPIO_FUNC_SIO); gpio_set_dir(pin_r0, true); gpio_put(pin_r0, 0);
|
16 | 35 | gpio_init(pin_g0); gpio_set_function(pin_g0, GPIO_FUNC_SIO); gpio_set_dir(pin_g0, true); gpio_put(pin_g0, 0);
|
@@ -159,8 +178,15 @@ void Hub75::start(irq_handler_t handler) {
|
159 | 178 | } else {
|
160 | 179 | row_prog_offs = pio_add_program(pio, &hub75_row_program);
|
161 | 180 | }
|
162 |
| - hub75_data_rgb888_program_init(pio, sm_data, data_prog_offs, DATA_BASE_PIN, pin_clk); |
163 |
| - hub75_row_program_init(pio, sm_row, row_prog_offs, ROWSEL_BASE_PIN, ROWSEL_N_PINS, pin_stb, latch_cycles); |
| 181 | + |
| 182 | + if(duo_mode) { |
| 183 | + hub75_data_rgb888_program_init(pio, sm_data, data_prog_offs, DUO_DATA_BASE_PIN, pin_clk); |
| 184 | + hub75_row_program_init(pio, sm_row, row_prog_offs, DUO_ROWSEL_BASE_PIN, ROWSEL_N_PINS, pin_stb, latch_cycles); |
| 185 | + } |
| 186 | + else { |
| 187 | + hub75_data_rgb888_program_init(pio, sm_data, data_prog_offs, DATA_BASE_PIN, pin_clk); |
| 188 | + hub75_row_program_init(pio, sm_row, row_prog_offs, ROWSEL_BASE_PIN, ROWSEL_N_PINS, pin_stb, latch_cycles); |
| 189 | + } |
164 | 190 |
|
165 | 191 | // Prevent flicker in Python caused by the smaller dataset just blasting through the PIO too quickly
|
166 | 192 | pio_sm_set_clkdiv(pio, sm_data, width <= 32 ? 2.0f : 1.0f);
|
|
0 commit comments