Skip to content

Instantly share code, notes, and snippets.

Last active August 18, 2017 03:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save alevy/798d11dbfa5409e0aa56d870b4b7afcf to your computer and use it in GitHub Desktop.
Tock capsule periodic accelerometer reading
use kernel::hil::time::{self, Alarm, Frequency};
use kernel::hil::sensors::{NineDof, NineDofClient};
pub struct Accelerate<'a, A: Alarm + 'a> {
alarm: &'a A,
ninedof: &'a NineDof
impl<'a, A: Alarm> Accelerate<'a, A> {
pub fn new(alarm: &'a A, ninedof: &'a NineDof) -> Accelerate<'a, A> {
Accelerate {
alarm: alarm,
ninedof: ninedof,
pub fn start(&self) {
impl<'a, A: Alarm> time::Client for Accelerate<'a, A> {
fn fired(&self) {
impl<'a, A: Alarm> NineDofClient for Accelerate<'a, A> {
fn callback(&self, x: usize, y: usize, z: usize) {
debug!("{} {} {}", x, y, z);
let accelerate_virtual_alarm = static_init!(
VirtualMuxAlarm<'static, sam4l::ast::Ast>,
let accelerate = static_init!(
VirtualMuxAlarm<'static, sam4l::ast::Ast<'static>>>,
capsules::accelerate::Accelerate::new(accelerate_virtual_alarm, fxos8700));
use kernel::hil::sensors::NineDof;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment