mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
change power-on order of display and add unchecked variant of put pixel
- remove bounds checking for accelerating blits that are already checked - fix the command ordering for display power-on to remove "noise" during power-on of the display.
This commit is contained in:
parent
e8219cda58
commit
1cb23dd4a2
1 changed files with 22 additions and 2 deletions
|
|
@ -465,7 +465,7 @@ impl<'a> Oled128x128<'a> {
|
|||
SetDCDCSettings(0x0),
|
||||
SetStartLine(0),
|
||||
SetDisplayOffset(0),
|
||||
SetContrastControl(0x2f), // was 0x4f, was a bit too bright
|
||||
SetContrastControl(0x3f), // was 0x4f, was a bit too bright
|
||||
SetAddressMode(AddressMode::Column),
|
||||
SetSegmentReMap(false),
|
||||
SetCOMScanDirection(Direction::Inverted),
|
||||
|
|
@ -476,13 +476,21 @@ impl<'a> Oled128x128<'a> {
|
|||
SetPageAddress(0),
|
||||
ForceEntireDisplay(false),
|
||||
SetDisplayMode(DisplayMode::WhiteOnBlack),
|
||||
DisplayOnOff(DisplayState::On),
|
||||
];
|
||||
|
||||
for command in init_sequence {
|
||||
let bytes = command.encode();
|
||||
self.send_command(bytes);
|
||||
}
|
||||
// clear the frame buffer
|
||||
self.buffer_mut().fill(0xFFFF_FFFF);
|
||||
self.draw();
|
||||
|
||||
let display_on = [DisplayOnOff(DisplayState::On)];
|
||||
for command in display_on {
|
||||
let bytes = command.encode();
|
||||
self.send_command(bytes);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn powerdown(&mut self) {
|
||||
|
|
@ -556,6 +564,18 @@ impl<'a> FrameBuffer for Oled128x128<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
unsafe fn put_pixel_unchecked(&mut self, p: Point, on: ColorNative) {
|
||||
let bitnum = (p.x + p.y * COLUMN) as usize;
|
||||
let word_idx = bitnum >> 5; // bitnum / 32
|
||||
let bit_idx = bitnum & 0x1F; // bitnum % 32
|
||||
if on.0 != 0 {
|
||||
self.buffer[word_idx] |= 1 << bit_idx;
|
||||
} else {
|
||||
self.buffer[word_idx] &= !(1 << bit_idx);
|
||||
}
|
||||
}
|
||||
|
||||
fn dimensions(&self) -> Point { Point::new(COLUMN, ROW) }
|
||||
|
||||
fn get_pixel(&self, p: Point) -> Option<ColorNative> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue