update apis to accommodate power savings mode

This commit is contained in:
bunnie 2025-12-11 02:10:25 +08:00
parent 0a47620da2
commit 8269f9f759
3 changed files with 63 additions and 32 deletions

View file

@ -320,27 +320,38 @@ pub fn usb_ep1_bulk_out_complete(
let mut sh1107 = unsafe {
Oled128x128::from_raw_parts(
(
match channel {
SpimChannel::Channel0 => utra::udma_spim_0::HW_UDMA_SPIM_0_BASE,
SpimChannel::Channel1 => utra::udma_spim_1::HW_UDMA_SPIM_1_BASE,
SpimChannel::Channel2 => utra::udma_spim_2::HW_UDMA_SPIM_2_BASE,
SpimChannel::Channel3 => utra::udma_spim_3::HW_UDMA_SPIM_3_BASE,
},
SpimCs::Cs0,
0,
0,
None,
SpimMode::Standard,
SpimByteAlign::Disable,
bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::board::DISPLAY_IFRAM_ADDR,
bao1x_hal::board::DISPLAY_IFRAM_ADDR,
4096 * 2,
(
match channel {
SpimChannel::Channel0 => {
utra::udma_spim_0::HW_UDMA_SPIM_0_BASE
}
SpimChannel::Channel1 => {
utra::udma_spim_1::HW_UDMA_SPIM_1_BASE
}
SpimChannel::Channel2 => {
utra::udma_spim_2::HW_UDMA_SPIM_2_BASE
}
SpimChannel::Channel3 => {
utra::udma_spim_3::HW_UDMA_SPIM_3_BASE
}
},
SpimCs::Cs0,
0,
0,
None,
SpimMode::Standard,
SpimByteAlign::Disable,
bao1x_hal::ifram::IframRange::from_raw_parts(
bao1x_hal::board::DISPLAY_IFRAM_ADDR,
bao1x_hal::board::DISPLAY_IFRAM_ADDR,
4096 * 2,
),
2048 + 256,
2048,
0,
None,
),
2048 + 256,
2048,
0,
None,
false,
),
&iox,
)

View file

@ -752,6 +752,23 @@ impl Gfx {
Ok(response)
}
#[cfg(feature = "board-baosec")]
pub fn set_power(&self, turn_on: bool) -> Result<(), xous::Error> {
if turn_on {
send_message(
self.conn,
Message::new_blocking_scalar(GfxOpcode::PowerUp.to_usize().unwrap(), 0, 0, 0, 0),
)
.map(|_| ())
} else {
send_message(
self.conn,
Message::new_blocking_scalar(GfxOpcode::PowerDown.to_usize().unwrap(), 0, 0, 0, 0),
)
.map(|_| ())
}
}
#[cfg(feature = "hosted-baosec")]
pub fn acquire_qr(&self) -> Result<QrAcquisition, xous::Error> {
let dummy = "otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30".to_string();

View file

@ -42,18 +42,21 @@ const TEXT_MARGIN: isize = 0;
pub(crate) fn panic_handler_thread(
is_panic: Arc<AtomicBool>,
display_parts: (
usize,
udma::SpimCs,
u8,
u8,
Option<EventChannel>,
udma::SpimMode,
udma::SpimByteAlign,
IframRange,
usize,
usize,
u8,
Option<CommandSet>,
(
usize,
udma::SpimCs,
u8,
u8,
Option<EventChannel>,
udma::SpimMode,
udma::SpimByteAlign,
IframRange,
usize,
usize,
u8,
Option<CommandSet>,
),
bool,
),
) {
thread::spawn({