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

@ -319,12 +319,21 @@ pub fn usb_ep1_bulk_out_complete(
// maintain the changes... // maintain the changes...
let mut sh1107 = unsafe { let mut sh1107 = unsafe {
Oled128x128::from_raw_parts( Oled128x128::from_raw_parts(
(
( (
match channel { match channel {
SpimChannel::Channel0 => utra::udma_spim_0::HW_UDMA_SPIM_0_BASE, SpimChannel::Channel0 => {
SpimChannel::Channel1 => utra::udma_spim_1::HW_UDMA_SPIM_1_BASE, utra::udma_spim_0::HW_UDMA_SPIM_0_BASE
SpimChannel::Channel2 => utra::udma_spim_2::HW_UDMA_SPIM_2_BASE, }
SpimChannel::Channel3 => utra::udma_spim_3::HW_UDMA_SPIM_3_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, SpimCs::Cs0,
0, 0,
@ -342,6 +351,8 @@ pub fn usb_ep1_bulk_out_complete(
0, 0,
None, None,
), ),
false,
),
&iox, &iox,
) )
}; };

View file

@ -752,6 +752,23 @@ impl Gfx {
Ok(response) 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")] #[cfg(feature = "hosted-baosec")]
pub fn acquire_qr(&self) -> Result<QrAcquisition, xous::Error> { 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(); 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,6 +42,7 @@ const TEXT_MARGIN: isize = 0;
pub(crate) fn panic_handler_thread( pub(crate) fn panic_handler_thread(
is_panic: Arc<AtomicBool>, is_panic: Arc<AtomicBool>,
display_parts: ( display_parts: (
(
usize, usize,
udma::SpimCs, udma::SpimCs,
u8, u8,
@ -55,6 +56,8 @@ pub(crate) fn panic_handler_thread(
u8, u8,
Option<CommandSet>, Option<CommandSet>,
), ),
bool,
),
) { ) {
thread::spawn({ thread::spawn({
move || { move || {