Created
October 26, 2017 00:14
-
-
Save alevy/e4cc793d34923e3fc39dee6413dad25b to your computer and use it in GitHub Desktop.
Capsule "Hello World"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//! Sample capsule for Tock course at SOSP. It handles an alarm to | |
//! sample the ambient light sensor. | |
use kernel::hil::time::{self, Alarm, Frequency}; | |
use kernel::hil::sensors::{AmbientLight, AmbientLightClient}; | |
pub struct Sosp<'a, A: Alarm + 'a> { | |
alarm: &'a A, | |
light: &'a AmbientLight, | |
} | |
impl<'a, A: Alarm> Sosp<'a, A> { | |
pub fn new(alarm: &'a A, light: &'a AmbientLight) -> Sosp<'a, A> { | |
Sosp { | |
alarm: alarm, | |
light: light, | |
} | |
} | |
pub fn start(&self) { | |
debug!("Hello World"); | |
} | |
} | |
impl<'a, A: Alarm> time::Client for Sosp<'a, A> { | |
fn fired(&self) { | |
} | |
} | |
impl<'a, A: Alarm> AmbientLightClient for Sosp<'a, A> { | |
fn callback(&self, lux: usize) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment