Will Salisbury / SensorNode
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SensorNode.h Source File

SensorNode.h

00001 /*
00002  * File: SensorNode/SensorNode.h
00003  * Author: William Jessup Salisbury
00004  * Company: Tufts Hybrid Racing Team
00005  * Copyright: CC BY-NC-SA 3.0
00006  * Date: 1/12/2012
00007  */
00008 
00009 #ifndef SENSOR_NODE_H
00010 #define SENSOR_NODE_H
00011 
00012 #include "mbed.h"
00013 
00014 const PinName CAN_RX = p30;
00015 const PinName CAN_TX = p29;
00016 const PinName LW_PIN = p11;
00017 const PinName RW_PIN = p12;
00018 
00019 const int ticksPerRevolution = 32;
00020 const int tickerTimeout = 1;
00021 
00022 class SensorNode {
00023 public:
00024     SensorNode();
00025     ~SensorNode();
00026 private:
00027     inline void Reset();
00028     void leftTick();
00029     void rightTick();
00030     void canSend();
00031     void canReceive();
00032     
00033     InterruptIn _leftWheel, _rightWheel;
00034     CAN _can;
00035     Serial _console;
00036     Ticker _statusTicker;
00037     volatile int _leftTicks, _rightTicks;
00038     volatile int _leftRevolutions, _rightRevolutions;
00039     volatile char _syncID;
00040 };
00041 
00042 #endif