Skip to content

Commit 6eb0f90

Browse files
authored
Merge pull request #904 from pimoroni/ci/micropython-1.22.2
CI: Bump MicroPython to v1.22.2.
2 parents d831074 + b0d53da commit 6eb0f90

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

.github/workflows/micropython.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
types: [created]
88

99
env:
10-
MICROPYTHON_VERSION: v1.22.1
10+
MICROPYTHON_VERSION: v1.22.2
1111

1212
jobs:
1313
build:

drivers/hub75/hub75.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,6 @@ void Hub75::FM6126A_setup() {
113113

114114
void Hub75::start(irq_handler_t handler) {
115115
if(handler) {
116-
dma_channel = 0;
117-
118-
// Try as I might, I can't seem to coax MicroPython into leaving PIO in a known state upon soft reset
119-
// check for claimed PIO and prepare a clean slate.
120-
stop(handler);
121-
122116
if (panel_type == PANEL_FM6126A) {
123117
FM6126A_setup();
124118
}
@@ -139,7 +133,7 @@ void Hub75::start(irq_handler_t handler) {
139133
// Prevent flicker in Python caused by the smaller dataset just blasting through the PIO too quickly
140134
pio_sm_set_clkdiv(pio, sm_data, width <= 32 ? 2.0f : 1.0f);
141135

142-
dma_channel_claim(dma_channel);
136+
dma_channel = dma_claim_unused_channel(true);
143137
dma_channel_config config = dma_channel_get_default_config(dma_channel);
144138
channel_config_set_transfer_data_size(&config, DMA_SIZE_32);
145139
channel_config_set_bswap(&config, false);
@@ -148,15 +142,13 @@ void Hub75::start(irq_handler_t handler) {
148142

149143

150144
// Same handler for both DMA channels
151-
irq_set_exclusive_handler(DMA_IRQ_0, handler);
152-
irq_set_exclusive_handler(DMA_IRQ_1, handler);
145+
irq_add_shared_handler(DMA_IRQ_0, handler, PICO_SHARED_IRQ_HANDLER_DEFAULT_ORDER_PRIORITY);
153146

154147
dma_channel_set_irq0_enabled(dma_channel, true);
155148

156149
irq_set_enabled(pio_get_dreq(pio, sm_data, true), true);
157150
irq_set_enabled(DMA_IRQ_0, true);
158151

159-
160152
row = 0;
161153
bit = 0;
162154

@@ -169,10 +161,9 @@ void Hub75::start(irq_handler_t handler) {
169161
void Hub75::stop(irq_handler_t handler) {
170162

171163
irq_set_enabled(DMA_IRQ_0, false);
172-
irq_set_enabled(DMA_IRQ_1, false);
173164
irq_set_enabled(pio_get_dreq(pio, sm_data, true), false);
174165

175-
if(dma_channel_is_claimed(dma_channel)) {
166+
if(dma_channel != -1 && dma_channel_is_claimed(dma_channel)) {
176167
dma_channel_set_irq0_enabled(dma_channel, false);
177168
irq_remove_handler(DMA_IRQ_0, handler);
178169
//dma_channel_wait_for_finish_blocking(dma_channel);
@@ -184,17 +175,21 @@ void Hub75::stop(irq_handler_t handler) {
184175
if(pio_sm_is_claimed(pio, sm_data)) {
185176
pio_sm_set_enabled(pio, sm_data, false);
186177
pio_sm_drain_tx_fifo(pio, sm_data);
178+
pio_remove_program(pio, &hub75_data_rgb888_program, data_prog_offs);
187179
pio_sm_unclaim(pio, sm_data);
188180
}
189181

190182
if(pio_sm_is_claimed(pio, sm_row)) {
191183
pio_sm_set_enabled(pio, sm_row, false);
192184
pio_sm_drain_tx_fifo(pio, sm_row);
185+
if (inverted_stb) {
186+
pio_remove_program(pio, &hub75_row_inverted_program, row_prog_offs);
187+
} else {
188+
pio_remove_program(pio, &hub75_row_program, row_prog_offs);
189+
}
193190
pio_sm_unclaim(pio, sm_row);
194191
}
195192

196-
pio_clear_instruction_memory(pio);
197-
198193
// Make sure the GPIO is in a known good state
199194
// since we don't know what the PIO might have done with it
200195
gpio_put_masked(0b111111 << pin_r0, 0);

drivers/hub75/hub75.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Hub75 {
7373
Pixel background = 0;
7474

7575
// DMA & PIO
76-
uint dma_channel = 0;
76+
int dma_channel = -1;
7777
uint bit = 0;
7878
uint row = 0;
7979

0 commit comments

Comments
 (0)