mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
fix various driver bugs & harmonize wih precursor color "standard"
This commit is contained in:
parent
3d0d727094
commit
b29d885000
1 changed files with 9 additions and 31 deletions
|
|
@ -38,7 +38,7 @@ pub enum Mono {
|
||||||
impl From<ColorNative> for Mono {
|
impl From<ColorNative> for Mono {
|
||||||
fn from(value: ColorNative) -> Self {
|
fn from(value: ColorNative) -> Self {
|
||||||
match value.0 {
|
match value.0 {
|
||||||
0 => Mono::Black,
|
1 => Mono::Black,
|
||||||
_ => Mono::White,
|
_ => Mono::White,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -46,8 +46,8 @@ impl From<ColorNative> for Mono {
|
||||||
impl Into<ColorNative> for Mono {
|
impl Into<ColorNative> for Mono {
|
||||||
fn into(self) -> ColorNative {
|
fn into(self) -> ColorNative {
|
||||||
match self {
|
match self {
|
||||||
Mono::Black => ColorNative::from(0),
|
Mono::Black => ColorNative::from(1),
|
||||||
Mono::White => ColorNative::from(1),
|
Mono::White => ColorNative::from(0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -409,29 +409,7 @@ impl<'a> Oled128x128<'a> {
|
||||||
|
|
||||||
pub fn redraw(&mut self) { self.draw(); }
|
pub fn redraw(&mut self) { self.draw(); }
|
||||||
|
|
||||||
pub fn blit_screen(&mut self, bmp: &[u32]) {
|
pub fn blit_screen(&mut self, bmp: &[u32]) { self.buffer.copy_from_slice(bmp); }
|
||||||
self.buffer.copy_from_slice(&bmp);
|
|
||||||
/*
|
|
||||||
for (i, &word) in bmp.iter().enumerate() {
|
|
||||||
for bit in 0..32 {
|
|
||||||
if (word & (1 << (31 - bit))) != 0 {
|
|
||||||
self.put_pixel(
|
|
||||||
Point::new((i as isize % 4) * 32 + bit, i as isize / 4),
|
|
||||||
Mono::White.into(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
for (i, &word) in bmp.iter().enumerate() {
|
|
||||||
let bytes = word.to_le_bytes();
|
|
||||||
let start = i * core::mem::size_of::<u32>();
|
|
||||||
let end = start + core::mem::size_of::<u32>();
|
|
||||||
buf[start..end].copy_from_slice(&bytes);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn set_devboot(&mut self, _ena: bool) {
|
pub fn set_devboot(&mut self, _ena: bool) {
|
||||||
unimplemented!("devboot feature does not exist on this platform");
|
unimplemented!("devboot feature does not exist on this platform");
|
||||||
|
|
@ -461,7 +439,7 @@ impl<'a> Oled128x128<'a> {
|
||||||
SetVCOMHDeselectLevel(0x35),
|
SetVCOMHDeselectLevel(0x35),
|
||||||
SetPageAddress(0),
|
SetPageAddress(0),
|
||||||
ForceEntireDisplay(false),
|
ForceEntireDisplay(false),
|
||||||
SetDisplayMode(DisplayMode::BlackOnWhite),
|
SetDisplayMode(DisplayMode::WhiteOnBlack),
|
||||||
DisplayOnOff(DisplayState::On),
|
DisplayOnOff(DisplayState::On),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -501,10 +479,10 @@ impl<'a> FrameBuffer for Oled128x128<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clear(&mut self) { self.buffer_mut().fill(0); }
|
fn clear(&mut self) { self.buffer_mut().fill(0xFFFF_FFFF); }
|
||||||
|
|
||||||
fn put_pixel(&mut self, p: Point, on: ColorNative) {
|
fn put_pixel(&mut self, p: Point, on: ColorNative) {
|
||||||
if p.x > COLUMN || p.y > ROW || p.x < 0 || p.y < 0 {
|
if p.x >= COLUMN || p.y >= ROW || p.x < 0 || p.y < 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let bitnum = (p.x + p.y * COLUMN) as usize;
|
let bitnum = (p.x + p.y * COLUMN) as usize;
|
||||||
|
|
@ -518,7 +496,7 @@ impl<'a> FrameBuffer for Oled128x128<'a> {
|
||||||
fn dimensions(&self) -> Point { Point::new(COLUMN, ROW) }
|
fn dimensions(&self) -> Point { Point::new(COLUMN, ROW) }
|
||||||
|
|
||||||
fn get_pixel(&self, p: Point) -> Option<ColorNative> {
|
fn get_pixel(&self, p: Point) -> Option<ColorNative> {
|
||||||
if p.x > COLUMN || p.y > ROW || p.x < 0 || p.y < 0 {
|
if p.x >= COLUMN || p.y >= ROW || p.x < 0 || p.y < 0 {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let bitnum = (p.x + p.y * COLUMN) as usize;
|
let bitnum = (p.x + p.y * COLUMN) as usize;
|
||||||
|
|
@ -530,7 +508,7 @@ impl<'a> FrameBuffer for Oled128x128<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn xor_pixel(&mut self, p: Point) {
|
fn xor_pixel(&mut self, p: Point) {
|
||||||
if p.x > COLUMN || p.y > ROW || p.x < 0 || p.y < 0 {
|
if p.x >= COLUMN || p.y >= ROW || p.x < 0 || p.y < 0 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let bitnum = (p.x + p.y * COLUMN) as usize;
|
let bitnum = (p.x + p.y * COLUMN) as usize;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue