simulavr  1.1.0
pinmon.h
Go to the documentation of this file.
1 #ifndef _pinmonh_
2 #define _pinmonh_
3 #include "avrdevice.h"
4 #include "pin.h"
5 #include "pinnotify.h"
6 #include "net.h"
7 
8 // This class monitors a single pin and prints
9 // changes in the pin state to stdout.
11  private:
12  // This string printed as a prefix on stdout with each pin change.
13  const char* _pinDescStr;
14  // String printed when the pin is HIGH.
15  const char* _pinHighStr;
16  // String printed when the pin is LOW.
17  const char* _pinLowStr;
18  // Previous state of pin since change callback doesn't *really*
19  // mean "change"!
20  bool _prevState;
21  public:
22  PinMonitor( AvrDevice& avr,
23  const char* pinNameStr, // AVR pin name. (e.g. "B1","C2", etc.)
24  const char* pinDescStr = 0,
25  const char* pinHighStr = 0,
26  const char* pinLowStr = 0
27  ) throw();
28  private: // HasPinNotifyFunction
29  void PinStateHasChanged(Pin*);
30  };
31 
32 #endif
Basic AVR device, contains the core functionality.
Definition: avrdevice.h:66
const char * _pinLowStr
Definition: pinmon.h:17
void PinStateHasChanged(Pin *)
Definition: pinmon.cpp:21
Pin class, handles input and output to external parts.
Definition: pin.h:98
const char * _pinDescStr
Definition: pinmon.h:13
const char * _pinHighStr
Definition: pinmon.h:15
PinMonitor(AvrDevice &avr, const char *pinNameStr, const char *pinDescStr=0, const char *pinHighStr=0, const char *pinLowStr=0)
Definition: pinmon.cpp:6
bool _prevState
Definition: pinmon.h:20