Rework library structure

Changed:

- Move most library components to new [`vorago-shared-periphs`](https://egit.irs.uni-stuttgart.de/rust/vorago-shared-periphs)
  which is mostly re-exported in this crate.
- Overhaul and simplification of several HAL APIs. The system configuration and IRQ router
  peripheral instance generally does not need to be passed to HAL API anymore.
- All HAL drivers are now type erased. The constructors will still expect and consume the PAC
  singleton component for resource management purposes, but are not cached anymore.
- Refactoring of GPIO library to be more inline with embassy GPIO API.

Added:

- I2C clock timeout feature support.
This commit is contained in:
2025-04-24 14:05:02 +02:00
parent d641f3943f
commit d014e04249
53 changed files with 1767 additions and 9226 deletions

View File

@ -16,7 +16,7 @@ cortex-m-rt = "0.7"
embedded-hal = "1"
lis2dh12 = { version = "0.7", features = ["out_f32"] }
va416xx-hal = { version = ">=0.3, <=0.5", features = ["va41630"] }
va416xx-hal = { version = ">=0.3, <=0.5", path = "../va416xx-hal", features = ["va41630"] }
[features]
rt = ["va416xx-hal/rt"]

View File

@ -19,7 +19,7 @@ pub mod accelerometer {
};
// Accelerometer located on the GPIO board.
pub type Accelerometer = Lis2dh12<I2cMaster<pac::I2c0>>;
pub type Accelerometer = Lis2dh12<I2cMaster>;
#[derive(Debug)]
pub enum ConstructorError {
@ -30,14 +30,12 @@ pub mod accelerometer {
pub fn new_with_addr_detection(
i2c: pac::I2c0,
sysconfig: &mut pac::Sysconfig,
clocks: &Clocks,
) -> Result<Accelerometer, ConstructorError> {
let mut i2c_master = I2cMaster::new(
i2c,
sysconfig,
MasterConfig::default(),
clocks,
MasterConfig::default(),
I2cSpeed::Regular100khz,
)
.map_err(ConstructorError::ClkError)?;
@ -47,7 +45,7 @@ pub mod accelerometer {
}
pub fn new_with_i2cm(
i2c: I2cMaster<pac::I2c0>,
i2c: I2cMaster,
addr: lis2dh12::SlaveAddr,
) -> Result<Accelerometer, lis2dh12::Error<i2c::Error>> {
Lis2dh12::new(i2c, addr)