Files
kaptan/firmware/platforms/stm32f7/src/f722/mod.rs
T
Onur Özkan f9a61a086f feat(firmware): validate configuration and migrate sensor-driven flight APIs
Validate configuration through its owning schemas and keep board
declarations separate from shared F722 resource ownership. Bound USB
transitions, isolate transport failures and retain restart-only activation.

Migrate navigation and flight consumers with the sensor and schema
contracts. Require explicit installation data and synchronous output
authority; board motor outputs remain inhibited.

Validation: assembled-prefix host tests, strict Clippy, platform/USB tests
and both ARM release builds. Final-source coverage and scoped Miri/Kani
evidence are retained separately from hardware qualification.
2026-11-07 18:12:11 +03:00

67 lines
1.8 KiB
Rust

//! STM32F722 initialization and RTIC runtime.
mod board;
mod clock;
mod config;
mod data_channel;
mod firmware;
mod interrupts;
mod motor_inhibit;
mod notification;
mod peripherals;
pub mod ports;
mod routes;
mod sensors;
mod serial;
mod usb;
#[cfg(test)]
#[path = "../../../../boards/geprc-f722-v2/src/board.rs"]
mod geprc;
#[cfg(test)]
#[path = "../../../../boards/kakute-f7-mini-v3/src/board.rs"]
mod kakute;
#[cfg(test)]
#[path = "../../tests/support/config_active_state.rs"]
mod config_active_state;
#[cfg(test)]
#[path = "../../tests/support/config_files.rs"]
mod config_files;
#[cfg(test)]
#[path = "../../tests/support/route_variants.rs"]
mod route_variants;
use kaptan_config::Config;
use crate::{BoardError, F7ImmutableConfig};
pub use kaptan_spi::SpiCompletion as F722ImuTransferCompletion;
pub use board::{
F722InitResources, F722LidarState, F722MavlinkState, F722ServiceTimer, process_imu,
};
pub use config::F722UserConfig;
pub use interrupts::F722Interrupts;
pub use notification::EventNotification;
pub use routes::F722Route;
pub use sensors::{Icm42688Imu, ImuEvent, ImuService, Mpu6000Imu};
/// Inhibits motor outputs, validates configuration, then initializes hardware.
/// Called after RTIC takes the PAC peripherals.
pub fn initialize<C, I, const N: usize, const MAX_PAYLOAD_BYTES: usize>(
core: cortex_m::Peripherals,
device: stm32f7::stm32f722::Peripherals,
factory: C,
immutable: I,
) -> Result<F722InitResources<C, I, N, MAX_PAYLOAD_BYTES>, BoardError>
where
C: Clone + Config,
I: F7ImmutableConfig,
{
let hardware = immutable.f722().hardware;
motor_inhibit::inhibit(&device.RCC, &device.GPIOB, hardware.motors);
board::validate_board_config::<C, I, N>(&factory, &immutable)?;
board::initialize::<C, I, N, MAX_PAYLOAD_BYTES>(core, device, factory, immutable, hardware)
}