Skip to content

Commit 5bcebf2

Browse files
committed
Clean up imports.
1 parent 9161fd7 commit 5bcebf2

File tree

5 files changed

+28
-38
lines changed

5 files changed

+28
-38
lines changed

src/commands/screen.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
//! Screen-related commands for Neotron OS
22
3-
use crate::{osprint, osprintln, Ctx};
4-
use neotron_common_bios::{
5-
video::{Format, Mode},
6-
ApiResult,
3+
use crate::{
4+
bios::{
5+
video::{Format, Mode},
6+
ApiResult,
7+
},
8+
osprint, osprintln, Ctx,
79
};
810

911
pub static CLS_ITEM: menu::Item<Ctx> = menu::Item {

src/commands/sound.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Sound related commands for Neotron OS
22
3-
use crate::{osprint, osprintln, Ctx, API};
3+
use crate::{bios, osprint, osprintln, Ctx, API};
44

55
pub static MIXER_ITEM: menu::Item<Ctx> = menu::Item {
66
item_type: menu::ItemType::Callback {
@@ -53,7 +53,7 @@ fn mixer(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], _ctx: &
5353
let mut found = false;
5454
for mixer_id in 0u8..=255u8 {
5555
match (api.audio_mixer_channel_get_info)(mixer_id) {
56-
neotron_common_bios::FfiOption::Some(mixer_info) => {
56+
bios::FfiOption::Some(mixer_info) => {
5757
if mixer_info.name.as_str() == selected_mixer {
5858
if let Err(e) =
5959
(api.audio_mixer_channel_set_level)(mixer_id, level_int).into()
@@ -70,7 +70,7 @@ fn mixer(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], _ctx: &
7070
break;
7171
}
7272
}
73-
neotron_common_bios::FfiOption::None => {
73+
bios::FfiOption::None => {
7474
break;
7575
}
7676
}
@@ -84,11 +84,11 @@ fn mixer(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], _ctx: &
8484
osprintln!("Mixers:");
8585
for mixer_id in 0u8..=255u8 {
8686
match (api.audio_mixer_channel_get_info)(mixer_id) {
87-
neotron_common_bios::FfiOption::Some(mixer_info) => {
87+
bios::FfiOption::Some(mixer_info) => {
8888
let dir_str = match mixer_info.direction {
89-
neotron_common_bios::audio::Direction::Input => "In",
90-
neotron_common_bios::audio::Direction::Loopback => "Loop",
91-
neotron_common_bios::audio::Direction::Output => "Out",
89+
bios::audio::Direction::Input => "In",
90+
bios::audio::Direction::Loopback => "Loop",
91+
bios::audio::Direction::Output => "Out",
9292
};
9393
if selected_mixer
9494
.and_then(|s| Some(s == mixer_info.name.as_str()))
@@ -104,7 +104,7 @@ fn mixer(_menu: &menu::Menu<Ctx>, item: &menu::Item<Ctx>, args: &[&str], _ctx: &
104104
);
105105
}
106106
}
107-
neotron_common_bios::FfiOption::None => {
107+
bios::FfiOption::None => {
108108
// Run out of mixers
109109
break;
110110
}
@@ -117,7 +117,7 @@ fn play(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &m
117117
fn play_inner(
118118
file_name: &str,
119119
scratch: &mut [u8],
120-
) -> Result<(), embedded_sdmmc::Error<neotron_common_bios::Error>> {
120+
) -> Result<(), embedded_sdmmc::Error<bios::Error>> {
121121
osprintln!("Loading /{} from Block Device 0", file_name);
122122
let bios_block = crate::fs::BiosBlock();
123123
let time = crate::fs::BiosTime();
@@ -142,7 +142,7 @@ fn play(_menu: &menu::Menu<Ctx>, _item: &menu::Item<Ctx>, args: &[&str], ctx: &m
142142
let bytes_read = mgr.read(&mut volume, &mut file, &mut buffer)?;
143143
let mut buffer = &buffer[0..bytes_read];
144144
while !buffer.is_empty() {
145-
let slice = neotron_common_bios::FfiByteSlice::new(buffer);
145+
let slice = bios::FfiByteSlice::new(buffer);
146146
let played = unsafe { (api.audio_output_data)(slice).unwrap() };
147147
buffer = &buffer[played..];
148148
delta += played;

src/fs.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
//! Filesystem related types
22
33
use chrono::{Datelike, Timelike};
4-
use neotron_common_bios as bios;
54

6-
use crate::API;
5+
use crate::{bios, API};
76

87
pub struct BiosBlock();
98

src/program.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use embedded_sdmmc::File;
44

55
use crate::{
6+
bios,
67
fs::{BiosBlock, BiosTime},
78
osprint, osprintln,
89
};
@@ -38,23 +39,21 @@ pub enum Error {
3839
/// The file was too large for RAM.
3940
ProgramTooLarge,
4041
/// A filesystem error occurred
41-
Filesystem(embedded_sdmmc::Error<neotron_common_bios::Error>),
42+
Filesystem(embedded_sdmmc::Error<bios::Error>),
4243
/// An ELF error occurred
43-
Elf(neotron_loader::Error<embedded_sdmmc::Error<neotron_common_bios::Error>>),
44+
Elf(neotron_loader::Error<embedded_sdmmc::Error<bios::Error>>),
4445
/// Tried to run when nothing was loaded
4546
NothingLoaded,
4647
}
4748

48-
impl From<embedded_sdmmc::Error<neotron_common_bios::Error>> for Error {
49-
fn from(value: embedded_sdmmc::Error<neotron_common_bios::Error>) -> Self {
49+
impl From<embedded_sdmmc::Error<bios::Error>> for Error {
50+
fn from(value: embedded_sdmmc::Error<bios::Error>) -> Self {
5051
Error::Filesystem(value)
5152
}
5253
}
5354

54-
impl From<neotron_loader::Error<embedded_sdmmc::Error<neotron_common_bios::Error>>> for Error {
55-
fn from(
56-
value: neotron_loader::Error<embedded_sdmmc::Error<neotron_common_bios::Error>>,
57-
) -> Self {
55+
impl From<neotron_loader::Error<embedded_sdmmc::Error<bios::Error>>> for Error {
56+
fn from(value: neotron_loader::Error<embedded_sdmmc::Error<bios::Error>>) -> Self {
5857
Error::Elf(value)
5958
}
6059
}
@@ -89,7 +88,7 @@ impl FileSource {
8988
&self,
9089
offset: u32,
9190
out_buffer: &mut [u8],
92-
) -> Result<(), embedded_sdmmc::Error<neotron_common_bios::Error>> {
91+
) -> Result<(), embedded_sdmmc::Error<bios::Error>> {
9392
osprintln!("Reading from {}", offset);
9493
self.file.borrow_mut().seek_from_start(offset).unwrap();
9594
self.mgr
@@ -100,7 +99,7 @@ impl FileSource {
10099
}
101100

102101
impl neotron_loader::traits::Source for &FileSource {
103-
type Error = embedded_sdmmc::Error<neotron_common_bios::Error>;
102+
type Error = embedded_sdmmc::Error<bios::Error>;
104103

105104
fn read(&self, mut offset: u32, out_buffer: &mut [u8]) -> Result<(), Self::Error> {
106105
for chunk in out_buffer.chunks_mut(FileSource::BUFFER_LEN) {

src/vgaconsole.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// Modules and Imports
2525
// ===========================================================================
2626

27-
use neotron_common_bios::video::{Attr, TextBackgroundColour, TextForegroundColour};
27+
use crate::bios::video::{Attr, Mode, TextBackgroundColour, TextForegroundColour};
2828

2929
// ===========================================================================
3030
// Global Variables
@@ -74,7 +74,7 @@ impl VgaConsole {
7474
/// Change the video mode
7575
///
7676
/// Non text modes are ignored.
77-
pub fn change_mode(&mut self, mode: neotron_common_bios::video::Mode) {
77+
pub fn change_mode(&mut self, mode: Mode) {
7878
if let (Some(height), Some(width)) = (mode.text_height(), mode.text_width()) {
7979
self.inner.height = height as isize;
8080
self.inner.width = width as isize;
@@ -91,11 +91,6 @@ impl VgaConsole {
9191
self.inner.cursor_enable();
9292
}
9393

94-
/// Set the default attribute for any future text.
95-
pub fn set_attr(&mut self, attr: Attr) {
96-
self.inner.set_attr(attr);
97-
}
98-
9994
/// Write a UTF-8 byte string to the console.
10095
///
10196
/// Is parsed for ANSI codes, and Unicode is converted to Code Page 850 for
@@ -225,11 +220,6 @@ impl ConsoleInner {
225220
self.home();
226221
}
227222

228-
/// Set the default attribute for any future text.
229-
fn set_attr(&mut self, attr: Attr) {
230-
self.attr = attr;
231-
}
232-
233223
/// Put a glyph at the current position on the screen.
234224
///
235225
/// Don't do this if the cursor is enabled.

0 commit comments

Comments
 (0)