Skip to content

Commit

Permalink
DV Display: Claim unused channels and SMs.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jun 28, 2023
1 parent 3f0af97 commit a005585
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
9 changes: 3 additions & 6 deletions drivers/aps6404/aps6404.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 5 additions & 1 deletion drivers/dv_display/dv_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 3 additions & 7 deletions drivers/dv_display/dv_display.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{}

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion drivers/dv_display/swd_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a005585

Please sign in to comment.