Add a timer trait
This commit is contained in:
parent
468289e05f
commit
1f638dbea3
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
pub use self::register::{Bitset, Mask, Register, RegisterValue};
|
pub use self::register::{Bitset, Mask, Register, RegisterValue};
|
||||||
pub use self::pin::Pin;
|
pub use self::pin::Pin;
|
||||||
|
pub use self::timer::Timer8;
|
||||||
pub use self::usart::HardwareUsart;
|
pub use self::usart::HardwareUsart;
|
||||||
|
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
|
@ -29,6 +30,7 @@ pub mod config;
|
||||||
mod register;
|
mod register;
|
||||||
mod pin;
|
mod pin;
|
||||||
mod usart;
|
mod usart;
|
||||||
|
mod timer;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod std_stub;
|
pub mod std_stub;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
use {Register};
|
||||||
|
|
||||||
|
/// An 8-bit timer.
|
||||||
|
pub trait Timer8 {
|
||||||
|
/// The first compare register.
|
||||||
|
/// For example, OCR0A.
|
||||||
|
type CompareA: Register<u8>;
|
||||||
|
|
||||||
|
/// The second compare register.
|
||||||
|
/// For example, OCR0B.
|
||||||
|
type CompareB: Register<u8>;
|
||||||
|
|
||||||
|
/// The counter register.
|
||||||
|
///
|
||||||
|
/// For example, TCNT0.
|
||||||
|
type Counter: Register<u8>;
|
||||||
|
|
||||||
|
/// The first control register.
|
||||||
|
///
|
||||||
|
/// For example, TCCR0A.
|
||||||
|
type ControlA: Register<u8>;
|
||||||
|
|
||||||
|
/// The second control register.
|
||||||
|
///
|
||||||
|
/// For example, TCCR0B.
|
||||||
|
type ControlB: Register<u8>;
|
||||||
|
|
||||||
|
/// The interrupt mask register.
|
||||||
|
///
|
||||||
|
/// For example, TIMSK0.
|
||||||
|
type InterruptMask: Register<u8>;
|
||||||
|
|
||||||
|
/// The interrupt flag register.
|
||||||
|
///
|
||||||
|
/// For example, TIFR0.
|
||||||
|
type InterruptFlag: Register<u8>;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue