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:
@ -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)
|
||||
|
Reference in New Issue
Block a user