mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
move camera clock pin setup into the camera driver in Xous.
previously this was setup in the loader, which is a bit of an abstraction bodge.
This commit is contained in:
parent
483e8f3508
commit
b86664d279
1 changed files with 45 additions and 0 deletions
|
|
@ -191,6 +191,51 @@ pub fn wrapped_main(main_thread_token: MainThreadToken) -> ! {
|
|||
// ---- camera initialization
|
||||
#[cfg(not(feature = "hosted-baosec"))]
|
||||
{
|
||||
// setup camera clock
|
||||
iox.setup_pin(IoxPort::PF, 9, Some(IoxDir::Input), Some(IoxFunction::Gpio), None, None, None, None);
|
||||
iox.setup_pin(
|
||||
IoxPort::PA,
|
||||
0,
|
||||
Some(IoxDir::Output),
|
||||
Some(IoxFunction::Gpio),
|
||||
None,
|
||||
None,
|
||||
Some(IoxEnable::Disable),
|
||||
Some(IoxDriveStrength::Drive8mA),
|
||||
);
|
||||
iox.setup_pin(
|
||||
IoxPort::PA,
|
||||
0,
|
||||
Some(IoxDir::Output),
|
||||
Some(IoxFunction::AF3),
|
||||
None,
|
||||
None,
|
||||
Some(IoxEnable::Disable),
|
||||
Some(IoxDriveStrength::Drive8mA),
|
||||
);
|
||||
let timer_range = xous::map_memory(
|
||||
xous::MemoryAddress::new(utra::pwm::HW_PWM_BASE),
|
||||
None,
|
||||
4096,
|
||||
xous::MemoryFlags::R | xous::MemoryFlags::W,
|
||||
)
|
||||
.expect("couldn't map PWM range");
|
||||
let mut timer = utralib::CSR::new(timer_range.as_ptr() as usize as *mut u32);
|
||||
timer.wo(utra::pwm::REG_CH_EN, 1);
|
||||
timer.rmwf(utra::pwm::REG_TIM0_CFG_R_TIMER0_SAW, 1);
|
||||
timer.rmwf(utra::pwm::REG_TIM0_CH0_TH_R_TIMER0_CH0_TH, 0);
|
||||
timer.rmwf(utra::pwm::REG_TIM0_CH0_TH_R_TIMER0_CH0_MODE, 3);
|
||||
let pwm = timer_range.as_mut_ptr() as *mut u32;
|
||||
unsafe { pwm.add(2).write_volatile(0) }; // for some reason the register extraction didn't get this register...
|
||||
timer.rmwf(utra::pwm::REG_TIM0_CMD_R_TIMER0_START, 1);
|
||||
log::info!("PWM running on PA0");
|
||||
/* // register debug
|
||||
for i in 0..12 {
|
||||
println!("0x{:2x}: 0x{:08x}", i, unsafe { pwm.add(i).read_volatile() })
|
||||
}
|
||||
println!("0x{:2x}: 0x{:08x}", 65, unsafe { pwm.add(65).read_volatile() });
|
||||
*/
|
||||
|
||||
// setup camera pins
|
||||
let (cam_pdwn_bnk, cam_pdwn_pin) = bao1x_hal::board::setup_camera_pins(&iox);
|
||||
// disable camera powerdown
|
||||
|
|
|
|||
Loading…
Reference in a new issue