diff --git a/drivers/aps6404/aps6404.cpp b/drivers/aps6404/aps6404.cpp index dce1be1c2..c935452d5 100644 --- a/drivers/aps6404/aps6404.cpp +++ b/drivers/aps6404/aps6404.cpp @@ -48,14 +48,11 @@ namespace pimoroni { gpio_disable_pulls(pin_d0 + i); } - pio_sm = 1; - pio_sm_claim(pio, pio_sm); + pio_sm = pio_claim_unused_sm(pio, true); // Claim DMA channels - dma_channel = 0; - dma_channel_claim(dma_channel); - read_cmd_dma_channel = 1; - dma_channel_claim(read_cmd_dma_channel); + dma_channel = dma_claim_unused_channel(true); + read_cmd_dma_channel = dma_claim_unused_channel(true); } void APS6404::init() { diff --git a/drivers/dv_display/dv_display.cpp b/drivers/dv_display/dv_display.cpp index 512197c3a..8ba85d7da 100644 --- a/drivers/dv_display/dv_display.cpp +++ b/drivers/dv_display/dv_display.cpp @@ -15,7 +15,11 @@ extern "C" { namespace pimoroni { - void DVDisplay::init() { + void DVDisplay::init(uint16_t width, uint16_t height, Mode mode) { + this->width = width; + this->height = height; + this->mode = mode; + uint8_t res_mode = 0xFF; uint16_t full_width = width; uint16_t full_height = height; diff --git a/drivers/dv_display/dv_display.hpp b/drivers/dv_display/dv_display.hpp index 7140ea3a4..c5bab8e16 100644 --- a/drivers/dv_display/dv_display.hpp +++ b/drivers/dv_display/dv_display.hpp @@ -72,19 +72,15 @@ namespace pimoroni { // 800x600 (60Hz), 800x480 (60Hz), 800x450 (60Hz), 960x540 (50Hz), 1280x720 (30Hz) // Note resolutions on the second line require quite extreme overclocking and may not work on all hardware. // Either or both of the horizontal or vertical component of any resolution may be halved. - DVDisplay(uint16_t width, uint16_t height, Mode mode = MODE_RGB555) + DVDisplay() : ram(CS, D0, pio1) , i2c(new I2C(I2C_SDA, I2C_SCL)) - , width(width), height(height) - , mode(mode) , pixel_buffer_location(-1, -1) {} - DVDisplay(uint16_t width, uint16_t height, I2C* i2c, Mode mode = MODE_RGB555) + DVDisplay(I2C* i2c) : ram(CS, D0, pio1) , i2c(i2c) - , width(width), height(height) - , mode(mode) , pixel_buffer_location(-1, -1) {} @@ -131,7 +127,7 @@ namespace pimoroni { void write_pixel(const Point &p, RGB888 colour) override; void write_pixel_span(const Point &p, uint l, RGB888 colour) override; - void init(); + void init(uint16_t width, uint16_t height, Mode mode = MODE_RGB555); void flip(); // 32 colour palette mode. Note that palette entries range from 0-31, diff --git a/drivers/dv_display/swd_load.cpp b/drivers/dv_display/swd_load.cpp index 87040a9e8..df180b65a 100644 --- a/drivers/dv_display/swd_load.cpp +++ b/drivers/dv_display/swd_load.cpp @@ -102,7 +102,7 @@ static bool connect(bool first = true, uint core = 0) { if (first) { pio_prog = &swd_raw_write_program; pio_offset = pio_change_exclusive_program(swd_pio, &swd_raw_write_program); - pio_sm = 0; + pio_sm = pio_claim_unused_sm(swd_pio, true); swd_initial_init(swd_pio, pio_sm, 2, 3);