00001 #ifndef _pinmonh_ 00002 #define _pinmonh_ 00003 #include "avrdevice.h" 00004 #include "pin.h" 00005 #include "pinnotify.h" 00006 #include "net.h" 00007 00008 // This class monitors a single pin and prints 00009 // changes in the pin state to stdout. 00010 class PinMonitor : public HasPinNotifyFunction { 00011 private: 00012 // This string printed as a prefix on stdout with each pin change. 00013 const char* _pinDescStr; 00014 // String printed when the pin is HIGH. 00015 const char* _pinHighStr; 00016 // String printed when the pin is LOW. 00017 const char* _pinLowStr; 00018 // Previous state of pin since change callback doesn't *really* 00019 // mean "change"! 00020 bool _prevState; 00021 public: 00022 PinMonitor( AvrDevice& avr, 00023 const char* pinNameStr, // AVR pin name. (e.g. "B1","C2", etc.) 00024 const char* pinDescStr = 0, 00025 const char* pinHighStr = 0, 00026 const char* pinLowStr = 0 00027 ) throw(); 00028 private: // HasPinNotifyFunction 00029 void PinStateHasChanged(Pin*); 00030 }; 00031 00032 #endif