diff options
author | 2018-11-03 17:02:41 +0100 | |
---|---|---|
committer | 2018-11-03 17:16:55 +0100 | |
commit | c631049efcadca8b07940c794cce2be58fa48444 (patch) | |
tree | f6bd73e5c396fc06072557ee965cc59e9c8e3e9f /src/examples/_7_generics.rs | |
parent | 653338e7997a0cdc5deaed98b1bb5f60006717ed (diff) | |
download | rtic-c631049efcadca8b07940c794cce2be58fa48444.tar.gz rtic-c631049efcadca8b07940c794cce2be58fa48444.tar.zst rtic-c631049efcadca8b07940c794cce2be58fa48444.zip |
v0.4.0
closes #32
closes #33
Diffstat (limited to 'src/examples/_7_generics.rs')
-rw-r--r-- | src/examples/_7_generics.rs | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/src/examples/_7_generics.rs b/src/examples/_7_generics.rs deleted file mode 100644 index 5dafdbf2..00000000 --- a/src/examples/_7_generics.rs +++ /dev/null @@ -1,77 +0,0 @@ -//! Working with resources in a generic fashion -//! -//! ``` -//! #![deny(unsafe_code)] -//! #![deny(warnings)] -//! #![no_std] -//! -//! extern crate cortex_m_rtfm as rtfm; -//! extern crate stm32f103xx; -//! -//! use rtfm::{app, Resource, Threshold}; -//! use stm32f103xx::{GPIOA, SPI1}; -//! -//! app! { -//! device: stm32f103xx, -//! -//! resources: { -//! static GPIOA: GPIOA; -//! static SPI1: SPI1; -//! }, -//! -//! tasks: { -//! EXTI0: { -//! path: exti0, -//! priority: 1, -//! resources: [GPIOA, SPI1], -//! }, -//! -//! EXTI1: { -//! path: exti1, -//! priority: 2, -//! resources: [GPIOA, SPI1], -//! }, -//! }, -//! } -//! -//! fn init(p: init::Peripherals) -> init::LateResources { -//! init::LateResources { -//! GPIOA: p.device.GPIOA, -//! SPI1: p.device.SPI1, -//! } -//! } -//! -//! fn idle() -> ! { -//! loop { -//! rtfm::wfi(); -//! } -//! } -//! -//! // A generic function that uses some resources -//! fn work<G, S>(t: &mut Threshold, gpioa: &G, spi1: &S) -//! where -//! G: Resource<Data = GPIOA>, -//! S: Resource<Data = SPI1>, -//! { -//! gpioa.claim(t, |_gpioa, t| { -//! // drive NSS low -//! -//! spi1.claim(t, |_spi1, _| { -//! // transfer data -//! }); -//! -//! // drive NSS high -//! }); -//! } -//! -//! // This task needs critical sections to access the resources -//! fn exti0(t: &mut Threshold, r: EXTI0::Resources) { -//! work(t, &r.GPIOA, &r.SPI1); -//! } -//! -//! // This task has direct access to the resources -//! fn exti1(t: &mut Threshold, r: EXTI1::Resources) { -//! work(t, &r.GPIOA, &r.SPI1); -//! } -//! ``` -// Auto-generated. Do not modify. |