Skip to content

Instantly share code, notes, and snippets.

@alevy
Created October 26, 2017 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alevy/e4cc793d34923e3fc39dee6413dad25b to your computer and use it in GitHub Desktop.
Save alevy/e4cc793d34923e3fc39dee6413dad25b to your computer and use it in GitHub Desktop.
Capsule "Hello World"
//! 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