Skip to content

Commit 3aef8f4

Browse files
Merge pull request #43 from Neotron-Compute/vga-tidyup
VGA tidyup
2 parents 402e0c8 + d3ef48f commit 3aef8f4

4 files changed

Lines changed: 842 additions & 177 deletions

File tree

src/main.rs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ struct Pins {
167167
i2s_dac_data: Pin<bank0::Gpio26, Function<pac::PIO1>>,
168168
i2s_bit_clock: Pin<bank0::Gpio27, Function<pac::PIO1>>,
169169
i2s_lr_clock: Pin<bank0::Gpio28, Function<pac::PIO1>>,
170-
pico_led: Pin<bank0::Gpio25, Output<PushPull>>,
171170
}
172171

173172
// -----------------------------------------------------------------------------
@@ -468,6 +467,11 @@ impl Hardware {
468467
delay: cortex_m::delay::Delay,
469468
) -> (Hardware, IrqPin) {
470469
let hal_pins = rp_pico::Pins::new(bank, pads, sio, resets);
470+
// We construct the pin here and then throw it away. Then Core 1 does
471+
// some unsafe writes to the GPIO_SET/GPIO_CLEAR registers to set/clear
472+
// pin 25 to track render loop timing. This avoids trying to 'move' the pin
473+
// over to Core 1.
474+
let _pico_led = hal_pins.led.into_push_pull_output();
471475

472476
(
473477
Hardware {
@@ -607,7 +611,6 @@ impl Hardware {
607611
i2s_dac_data: hal_pins.gpio26.into_mode(),
608612
i2s_bit_clock: hal_pins.gpio27.into_mode(),
609613
i2s_lr_clock: hal_pins.gpio28.into_mode(),
610-
pico_led: hal_pins.led.into_mode(),
611614
},
612615

613616
// We are in SPI MODE 0. This means we change the COPI pin on the
@@ -1183,10 +1186,7 @@ pub extern "C" fn configuration_set(_buffer: common::ApiByteSlice) -> common::Re
11831186

11841187
/// Does this Neotron BIOS support this video mode?
11851188
pub extern "C" fn video_is_valid_mode(mode: common::video::Mode) -> bool {
1186-
mode == common::video::Mode::new(
1187-
common::video::Timing::T640x480,
1188-
common::video::Format::Text8x16,
1189-
)
1189+
vga::test_video_mode(mode)
11901190
}
11911191

11921192
/// Switch to a new video mode.
@@ -1643,16 +1643,6 @@ extern "C" fn time_ticks_per_second() -> common::Ticks {
16431643
common::Ticks(1000)
16441644
}
16451645

1646-
/// Called when DMA raises IRQ0; i.e. when a DMA transfer to the pixel FIFO or
1647-
/// the timing FIFO has completed.
1648-
#[interrupt]
1649-
#[link_section = ".data"]
1650-
fn DMA_IRQ_0() {
1651-
unsafe {
1652-
vga::irq();
1653-
}
1654-
}
1655-
16561646
static IRQ_PIN: Mutex<RefCell<Option<IrqPin>>> = Mutex::new(RefCell::new(None));
16571647

16581648
/// Called when we get a SIO interrupt on the main bank of GPIO pins.

src/vga/font16.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030
//! SUCH DAMAGE.
3131
3232
/// An 8x16 font
33-
pub static FONT: super::Font = super::Font {
34-
height: 16,
35-
data: &DATA,
36-
};
33+
pub static FONT: super::Font = super::Font { data: &DATA };
3734

3835
/// Our font data - arranged as 256 glyphs of 1 byte/row x 16 row/glyph.
3936
#[link_section = ".data"]

src/vga/font8.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
//! SUCH DAMAGE.
3333
3434
/// An 8x16 font
35-
pub static FONT: super::Font = super::Font {
36-
height: 8,
37-
data: &DATA,
38-
};
35+
pub static FONT: super::Font = super::Font { data: &DATA };
3936

4037
/// Our font data - arranged as 256 glyphs of 1 byte/row x 8 row/glyph.
4138
#[link_section = ".data"]

0 commit comments

Comments
 (0)