24 lines
453 B
Rust
24 lines
453 B
Rust
// Copyright (c) 2025 shibedrill
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
use crate::{asm::*, log::LogSubscriber};
|
|
|
|
#[derive(Clone, Copy)]
|
|
pub struct Serialport {
|
|
port: u16,
|
|
}
|
|
|
|
impl LogSubscriber for Serialport {
|
|
fn write(&self, msg: &str) {
|
|
for c in msg.chars() {
|
|
unsafe { port_write_u8(self.port, c as u8) };
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Serialport {
|
|
pub fn new(port: u16) -> Self {
|
|
Serialport { port }
|
|
}
|
|
}
|