Add volatile crate
This commit is contained in:
parent
0e9bff7bff
commit
65c824e104
@ -12,4 +12,5 @@ panic = "abort"
|
||||
|
||||
[dependencies]
|
||||
bootloader = "0.6.0"
|
||||
volatile = "0.2.6"
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
use volatile::Volatile;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
#[repr(u8)]
|
||||
@ -42,7 +44,7 @@ const BUFFER_HEIGHT: usize = 25;
|
||||
|
||||
#[repr(transparent)]
|
||||
struct Buffer {
|
||||
chars: [[ScreenChar; BUFFER_WIDTH]; BUFFER_HEIGHT],
|
||||
chars: [[Volatile<ScreenChar>; BUFFER_WIDTH]; BUFFER_HEIGHT],
|
||||
}
|
||||
|
||||
pub struct Writer {
|
||||
@ -71,9 +73,9 @@ impl Writer {
|
||||
let row = BUFFER_HEIGHT - 1;
|
||||
let col = self.column_position;
|
||||
let color_code = self.color_code;
|
||||
self.buffer.chars[row][col] = ScreenChar {
|
||||
self.buffer.chars[row][col].write(ScreenChar {
|
||||
ascii_char: byte, color_code,
|
||||
};
|
||||
});
|
||||
self.column_position += 1;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user