16 bool clockSampleOnLeadingEdge
19 _ss( &_port, (
unsigned char)(1<<
SSBIT) ),
20 _sclk( &_port, (
unsigned char)(1<<
SCLKBIT) ),
21 _miso( &_port, (
unsigned char)(1<<
MISOBIT) ),
27 _clockIsIdleHigh(clockIsIdleHigh),
28 _clockSampleOnLeadingEdge(clockSampleOnLeadingEdge),
29 _prevClkState(clockIsIdleHigh),
43 *timeToNextStepIn_ns = 1000;
46 _ssState = (_port & (1<<
SSBIT))?
true:
false;
47 _sclkState = (_port & (1<<
SCLKBIT))?
true:
false;
48 _misoState = (_port & (1<<
MISOBIT))?
true:
false;
51 if(_prevClkState != _sclkState){
52 _prevClkState = _sclkState;
55 if(_clockSampleOnLeadingEdge){
57 sample = (_sclkState)?
false:
true;
61 sample = (_sclkState)?
true:
false;
66 if(_clockSampleOnLeadingEdge){
68 sample = (_sclkState)?
true:
false;
72 sample = (_sclkState)?
false:
true;
113 streamsize streamWidth = cout.width();
114 ios_base::fmtflags saved = cout.flags();
115 cout.setf(ios_base::hex,ios_base::basefield);
116 cout.setf(ios_base::uppercase);
117 cout.setf(ios_base::right);
118 cout <<
"spisink: 0x";
121 cout << (
unsigned long)_sr;
123 cout.width(streamWidth);
131 if(_ssState != _prevSS){
133 cout <<
"spisink: /SS negated" << endl;
136 cout <<
"spisink: /SS asserted" << endl;
int Step(bool &trueHwStep, SystemClockOffset *timeToNextStepIn_ns=0)
Return nonzero if a breakpoint was hit.
long long SystemClockOffset
SpiSink(Net &ssNet, Net &sclkNet, Net &misoNet, bool clockIsIdleHigh=true, bool clockSampleOnLeadingEdge=true)
Connect Pins to each other and transfers a output change from a pin to input values for all pins...