This commit is contained in:
parent
0344793cdf
commit
f136c42a7c
@ -57,7 +57,7 @@
|
|||||||
//! [InvalidPinTypeError].
|
//! [InvalidPinTypeError].
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
pins::{FilterType, InterruptEdge, InterruptLevel, Pin, PinId, PinMode, PinState},
|
pin::{FilterType, InterruptEdge, InterruptLevel, Pin, PinId, PinMode, PinState},
|
||||||
reg::RegisterInterface,
|
reg::RegisterInterface,
|
||||||
};
|
};
|
||||||
use crate::{clock::FilterClkSel, pac, FunSel, IrqCfg};
|
use crate::{clock::FilterClkSel, pac, FunSel, IrqCfg};
|
@ -3,10 +3,10 @@
|
|||||||
//! The implementation of this GPIO module is heavily based on the
|
//! The implementation of this GPIO module is heavily based on the
|
||||||
//! [ATSAMD HAL implementation](https://docs.rs/atsamd-hal/latest/atsamd_hal/gpio/index.html).
|
//! [ATSAMD HAL implementation](https://docs.rs/atsamd-hal/latest/atsamd_hal/gpio/index.html).
|
||||||
//!
|
//!
|
||||||
//! This API provides two different submodules, [`mod@pins`] and [`dynpins`],
|
//! This API provides two different submodules, [pin] and [dynpin],
|
||||||
//! representing two different ways to handle GPIO pins. The default, [`mod@pins`],
|
//! representing two different ways to handle GPIO pins. The default, [pin],
|
||||||
//! is a type-level API that tracks the state of each pin at compile-time. The
|
//! is a type-level API that tracks the state of each pin at compile-time. The
|
||||||
//! alternative, [`dynpins`] is a type-erased, value-level API that tracks the
|
//! alternative, [dynpin] is a type-erased, value-level API that tracks the
|
||||||
//! state of each pin at run-time.
|
//! state of each pin at run-time.
|
||||||
//!
|
//!
|
||||||
//! The type-level API is strongly preferred. By representing the state of each
|
//! The type-level API is strongly preferred. By representing the state of each
|
||||||
@ -14,7 +14,7 @@
|
|||||||
//! compile-time. Furthermore, the type-level API has absolutely zero run-time
|
//! compile-time. Furthermore, the type-level API has absolutely zero run-time
|
||||||
//! cost.
|
//! cost.
|
||||||
//!
|
//!
|
||||||
//! If needed, [`dynpins`] can be used to erase the type-level differences
|
//! If needed, [dynpin] can be used to erase the type-level differences
|
||||||
//! between pins. However, by doing so, pins must now be tracked at run-time,
|
//! between pins. However, by doing so, pins must now be tracked at run-time,
|
||||||
//! and each pin has a non-zero memory footprint.
|
//! and each pin has a non-zero memory footprint.
|
||||||
//!
|
//!
|
||||||
@ -101,10 +101,10 @@ macro_rules! common_reg_if_functions {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod dynpins;
|
pub mod dynpin;
|
||||||
pub use dynpins::*;
|
pub use dynpin::*;
|
||||||
|
|
||||||
pub mod pins;
|
pub mod pin;
|
||||||
pub use pins::*;
|
pub use pin::*;
|
||||||
|
|
||||||
mod reg;
|
mod reg;
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
//! This module implements all of the embedded HAL GPIO traits for each [`Pin`]
|
//! This module implements all of the embedded HAL GPIO traits for each [`Pin`]
|
||||||
//! in the corresponding [`PinMode`]s, namely: [`InputPin`], [`OutputPin`],
|
//! in the corresponding [`PinMode`]s, namely: [`InputPin`], [`OutputPin`],
|
||||||
//! and [`StatefulOutputPin`].
|
//! and [`StatefulOutputPin`].
|
||||||
use super::dynpins::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
use super::dynpin::{DynAlternate, DynGroup, DynInput, DynOutput, DynPinId, DynPinMode};
|
||||||
use super::reg::RegisterInterface;
|
use super::reg::RegisterInterface;
|
||||||
use crate::{
|
use crate::{
|
||||||
pac::{Irqsel, Porta, Portb, Sysconfig},
|
pac::{Irqsel, Porta, Portb, Sysconfig},
|
@ -1,5 +1,5 @@
|
|||||||
use super::dynpins::{self, DynGroup, DynPinId, DynPinMode};
|
use super::dynpin::{self, DynGroup, DynPinId, DynPinMode};
|
||||||
use super::pins::{FilterType, InterruptEdge, InterruptLevel, PinState};
|
use super::pin::{FilterType, InterruptEdge, InterruptLevel, PinState};
|
||||||
use super::IsMaskedError;
|
use super::IsMaskedError;
|
||||||
use crate::clock::FilterClkSel;
|
use crate::clock::FilterClkSel;
|
||||||
use va108xx::{ioconfig, porta};
|
use va108xx::{ioconfig, porta};
|
||||||
@ -30,7 +30,7 @@ impl From<DynPinMode> for ModeFields {
|
|||||||
use DynPinMode::*;
|
use DynPinMode::*;
|
||||||
match mode {
|
match mode {
|
||||||
Input(config) => {
|
Input(config) => {
|
||||||
use dynpins::DynInput::*;
|
use dynpin::DynInput::*;
|
||||||
fields.dir = false;
|
fields.dir = false;
|
||||||
match config {
|
match config {
|
||||||
Floating => (),
|
Floating => (),
|
||||||
@ -44,7 +44,7 @@ impl From<DynPinMode> for ModeFields {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Output(config) => {
|
Output(config) => {
|
||||||
use dynpins::DynOutput::*;
|
use dynpin::DynOutput::*;
|
||||||
fields.dir = true;
|
fields.dir = true;
|
||||||
match config {
|
match config {
|
||||||
PushPull => (),
|
PushPull => (),
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [REB1 I2C temperature sensor example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/adt75-temp-sensor.rs)
|
//! - [REB1 I2C temperature sensor example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/adt75-temp-sensor.rs
|
||||||
use crate::{
|
use crate::{
|
||||||
clock::enable_peripheral_clock, pac, time::Hertz, typelevel::Sealed, PeripheralSelect,
|
clock::enable_peripheral_clock, pac, time::Hertz, typelevel::Sealed, PeripheralSelect,
|
||||||
};
|
};
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [PWM example](https://egit.irs.uni-stuttgart.de/rust/va108xx-hal/src/branch/main/examples/pwm.rs)
|
//! - [PWM example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/examples/simple/examples/pwm.rs)
|
||||||
use core::convert::Infallible;
|
use core::convert::Infallible;
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
//! - [Blocking SPI example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/examples/simple/examples/spi.rs)
|
//! - [Blocking SPI example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/examples/simple/examples/spi.rs)
|
||||||
use crate::{
|
use crate::{
|
||||||
clock::enable_peripheral_clock,
|
clock::enable_peripheral_clock,
|
||||||
gpio::pins::{
|
gpio::pin::{
|
||||||
AltFunc1, AltFunc2, AltFunc3, Pin, PA10, PA11, PA12, PA13, PA14, PA15, PA16, PA17, PA18,
|
AltFunc1, AltFunc2, AltFunc3, Pin, PA10, PA11, PA12, PA13, PA14, PA15, PA16, PA17, PA18,
|
||||||
PA19, PA20, PA21, PA22, PA23, PA24, PA25, PA26, PA27, PA28, PA29, PA30, PA31, PB0, PB1,
|
PA19, PA20, PA21, PA22, PA23, PA24, PA25, PA26, PA27, PA28, PA29, PA30, PA31, PB0, PB1,
|
||||||
PB10, PB11, PB12, PB13, PB14, PB15, PB16, PB17, PB18, PB19, PB2, PB22, PB23, PB3, PB4, PB5,
|
PB10, PB11, PB12, PB13, PB14, PB15, PB16, PB17, PB18, PB19, PB2, PB22, PB23, PB3, PB4, PB5,
|
||||||
|
@ -12,7 +12,7 @@ use libm::floorf;
|
|||||||
pub use crate::IrqCfg;
|
pub use crate::IrqCfg;
|
||||||
use crate::{
|
use crate::{
|
||||||
clock::{enable_peripheral_clock, PeripheralClocks},
|
clock::{enable_peripheral_clock, PeripheralClocks},
|
||||||
gpio::pins::{
|
gpio::pin::{
|
||||||
AltFunc1, AltFunc2, AltFunc3, Pin, PA16, PA17, PA18, PA19, PA2, PA26, PA27, PA3, PA30,
|
AltFunc1, AltFunc2, AltFunc3, Pin, PA16, PA17, PA18, PA19, PA2, PA26, PA27, PA3, PA30,
|
||||||
PA31, PA8, PA9, PB18, PB19, PB20, PB21, PB22, PB23, PB6, PB7, PB8, PB9,
|
PA31, PA8, PA9, PB18, PB19, PB20, PB21, PB22, PB23, PB6, PB7, PB8, PB9,
|
||||||
},
|
},
|
||||||
|
@ -10,7 +10,7 @@ use cortex_m_rt::entry;
|
|||||||
use embedded_hal::delay::DelayNs;
|
use embedded_hal::delay::DelayNs;
|
||||||
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
|
use embedded_hal::digital::{OutputPin, StatefulOutputPin};
|
||||||
use panic_halt as _;
|
use panic_halt as _;
|
||||||
use va108xx_hal::{gpio::pins::PinsA, pac, prelude::*, timer::set_up_ms_delay_provider};
|
use va108xx_hal::{gpio::PinsA, pac, prelude::*, timer::set_up_ms_delay_provider};
|
||||||
use vorago_reb1::leds::Leds;
|
use vorago_reb1::leds::Leds;
|
||||||
|
|
||||||
// REB LED pin definitions. All on port A
|
// REB LED pin definitions. All on port A
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
//! MAX11619 ADC example applikcation
|
//! MAX11619 ADC example application.
|
||||||
|
//!
|
||||||
|
//! You can turn the potentiometer knob of the REB1 board to measure
|
||||||
|
//! different ADC values.
|
||||||
#![no_main]
|
#![no_main]
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [Button Blinky with IRQs](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-irq.rs)
|
//! - [Button Blinky with IRQs](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/blinky-button-irq.rs)
|
||||||
//! - [Button Blinky with IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-rtic.rs)
|
//! - [Button Blinky with IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/blinky-button-rtic.rs)
|
||||||
use embedded_hal::digital::InputPin;
|
use embedded_hal::digital::InputPin;
|
||||||
use va108xx_hal::{
|
use va108xx_hal::{
|
||||||
gpio::{FilterClkSel, FilterType, InputFloating, InterruptEdge, InterruptLevel, Pin, PA11},
|
gpio::{FilterClkSel, FilterType, InputFloating, InterruptEdge, InterruptLevel, Pin, PA11},
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [LED example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-leds.rs)
|
//! - [LED example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/blinky-leds.rs)
|
||||||
//! - [Button Blinky using IRQs](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-irq.rs)
|
//! - [Button Blinky using IRQs](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/blinky-button-irq.rs)
|
||||||
//! - [Button Blinky using IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/blinky-button-rtic.rs)
|
//! - [Button Blinky using IRQs and RTIC](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/blinky-button-rtic.rs)
|
||||||
use embedded_hal::digital::OutputPin;
|
use embedded_hal::digital::OutputPin;
|
||||||
use va108xx_hal::{
|
use va108xx_hal::{
|
||||||
gpio::dynpins::DynPin,
|
gpio::dynpin::DynPin,
|
||||||
gpio::pins::{Pin, PushPullOutput, PA10, PA6, PA7},
|
gpio::pin::{Pin, PushPullOutput, PA10, PA6, PA7},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type LD2 = Pin<PA10, PushPullOutput>;
|
pub type LD2 = Pin<PA10, PushPullOutput>;
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [ADC example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/max11619-adc.rs)
|
//! - [ADC example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/max11619-adc.rs)
|
||||||
use core::convert::Infallible;
|
use core::convert::Infallible;
|
||||||
use embedded_hal::spi::SpiDevice;
|
use embedded_hal::spi::SpiDevice;
|
||||||
use max116xx_10bit::{
|
use max116xx_10bit::{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ## Examples
|
//! ## Examples
|
||||||
//!
|
//!
|
||||||
//! - [Temperature Sensor example](https://egit.irs.uni-stuttgart.de/rust/vorago-reb1/src/branch/main/examples/adt75-temp-sensor.rs)
|
//! - [Temperature Sensor example](https://egit.irs.uni-stuttgart.de/rust/va108xx-rs/src/branch/main/vorago-reb1/examples/adt75-temp-sensor.rs
|
||||||
use embedded_hal::i2c::{I2c, SevenBitAddress};
|
use embedded_hal::i2c::{I2c, SevenBitAddress};
|
||||||
use va108xx_hal::{
|
use va108xx_hal::{
|
||||||
i2c::{Error, I2cMaster, I2cSpeed, InitError, MasterConfig},
|
i2c::{Error, I2cMaster, I2cSpeed, InitError, MasterConfig},
|
||||||
|
Loading…
Reference in New Issue
Block a user