mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix hosted mode
This commit is contained in:
parent
772c818908
commit
c9d513599c
1 changed files with 13 additions and 7 deletions
|
|
@ -28,7 +28,6 @@ use bao1x_api::*;
|
||||||
use bao1x_emu::{
|
use bao1x_emu::{
|
||||||
camera::Gc2145,
|
camera::Gc2145,
|
||||||
display::{MainThreadToken, Mono, Oled128x128, claim_main_thread},
|
display::{MainThreadToken, Mono, Oled128x128, claim_main_thread},
|
||||||
i2c::I2c,
|
|
||||||
udma::UdmaGlobal,
|
udma::UdmaGlobal,
|
||||||
};
|
};
|
||||||
// breadcrumb to future self:
|
// breadcrumb to future self:
|
||||||
|
|
@ -173,6 +172,7 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
// ---- basic hardware setup
|
// ---- basic hardware setup
|
||||||
let iox = IoxHal::new();
|
let iox = IoxHal::new();
|
||||||
let udma_global = UdmaGlobal::new();
|
let udma_global = UdmaGlobal::new();
|
||||||
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
let mut i2c = I2c::new();
|
let mut i2c = I2c::new();
|
||||||
#[allow(unused_variables)]
|
#[allow(unused_variables)]
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
|
|
@ -306,6 +306,9 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
|
|
||||||
(cam, cam_pdwn)
|
(cam, cam_pdwn)
|
||||||
};
|
};
|
||||||
|
#[cfg(feature = "hosted-baosec")]
|
||||||
|
// unused dummy object
|
||||||
|
let mut cam = unsafe { Gc2145::new().expect("couldn't allocate camera") };
|
||||||
|
|
||||||
#[cfg(not(feature = "hosted-baosec"))]
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
let cid = xous::connect(sid).unwrap(); // self-connection always succeeds
|
let cid = xous::connect(sid).unwrap(); // self-connection always succeeds
|
||||||
|
|
@ -461,12 +464,15 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
||||||
if qr_request.is_some() {
|
if qr_request.is_some() {
|
||||||
cam.capture_async();
|
cam.capture_async();
|
||||||
} else {
|
} else {
|
||||||
// power down the camera, now that the request is done
|
#[cfg(not(feature = "hosted-baosec"))]
|
||||||
// assert PWWDN
|
{
|
||||||
iox.set_gpio_pin_value(cam_pdwn.0, cam_pdwn.1, IoxValue::High);
|
// power down the camera, now that the request is done
|
||||||
// stop MCLK
|
// assert PWWDN
|
||||||
tt.sleep_ms(2).ok();
|
iox.set_gpio_pin_value(cam_pdwn.0, cam_pdwn.1, IoxValue::High);
|
||||||
timer.rmwf(utra::pwm::REG_TIM0_CMD_R_TIMER0_START, 0);
|
// stop MCLK
|
||||||
|
tt.sleep_ms(2).ok();
|
||||||
|
timer.rmwf(utra::pwm::REG_TIM0_CMD_R_TIMER0_START, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the camera data to our FB
|
// copy the camera data to our FB
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue