-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* nice colorful display on floppsy * builds on feather rp2040 again too
- Loading branch information
Showing
5 changed files
with
266 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#pragma once | ||
|
||
bool ever_refreshed; | ||
|
||
void update_display(bool force_refresh); | ||
|
||
bool operator!=(const display_state &a, const display_state &b) { | ||
return a.capacity_kib != b.capacity_kib || a.trk0 != b.trk0 || a.wp != b.wp || | ||
a.rdy != b.rdy || a.dirty != b.dirty || a.trk != b.trk || | ||
a.side != b.side; | ||
} | ||
|
||
void maybe_update_display(bool force_refresh, bool tick) { | ||
noInterrupts(); | ||
new_state = display_state{ | ||
mfm_floppy.sectorCount() / 2, | ||
floppy.get_track0_sense(), | ||
floppy.get_write_protect(), | ||
!!digitalRead(READY_PIN), | ||
mfm_floppy.dirty(), | ||
floppy.track(), | ||
floppy.get_side(), | ||
}; | ||
interrupts(); | ||
|
||
force_refresh = force_refresh || !ever_refreshed; | ||
if (force_refresh || (old_state != new_state) || tick) { | ||
Serial.printf("P %d\n", new_state.trk); | ||
update_display(force_refresh); | ||
old_state = new_state; | ||
ever_refreshed = true; | ||
} | ||
} |
Oops, something went wrong.