simulavr  1.1.0
spisink.h
Go to the documentation of this file.
1 #ifndef _spisinkh_
2 #define _spisinkh_
3 #include "avrdevice.h"
4 
5 // This class monitors the /SS, SCLK, and MISO pin of the AVR and
6 // prints the results one byte at a time to stdout.
7 // PetrH: Implemented using simulated polling (each 1 us). TODO: Rewrite.
8 class SpiSink : public SimulationMember {
9  private:
10  unsigned char _port;
11  Pin _ss; // Output to AVR
12  Pin _sclk; // Output to AVR
13  Pin _miso; // Output to AVR
14  bool _ssState;
15  bool _sclkState;
16  bool _misoState;
17  unsigned _state;
18  unsigned char _sr;
22  bool _prevSS;
23  public:
24  SpiSink( Net& ssNet,
25  Net& sclkNet,
26  Net& misoNet,
27  bool clockIsIdleHigh = true,
28  bool clockSampleOnLeadingEdge = true
29  ) throw();
30  private: // SimulationMember
31  int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0);
32 
33  };
34 
35 #endif
Pin _sclk
Definition: spisink.h:12
Pin class, handles input and output to external parts.
Definition: pin.h:98
int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0)
Return nonzero if a breakpoint was hit.
Definition: spisink.cpp:42
unsigned char _sr
Definition: spisink.h:18
unsigned _state
Definition: spisink.h:17
bool _clockIsIdleHigh
Definition: spisink.h:19
bool _prevClkState
Definition: spisink.h:21
bool _ssState
Definition: spisink.h:14
bool _prevSS
Definition: spisink.h:22
long long SystemClockOffset
SpiSink(Net &ssNet, Net &sclkNet, Net &misoNet, bool clockIsIdleHigh=true, bool clockSampleOnLeadingEdge=true)
Definition: spisink.cpp:12
bool _sclkState
Definition: spisink.h:15
Pin _ss
Definition: spisink.h:11
Definition: spisink.h:8
bool _clockSampleOnLeadingEdge
Definition: spisink.h:20
unsigned char _port
Definition: spisink.h:10
Pin _miso
Definition: spisink.h:13
bool _misoState
Definition: spisink.h:16
Connect Pins to each other and transfers a output change from a pin to input values for all pins...
Definition: net.h:34