mirror of
https://github.com/DCC-EX/CommandStation-EX.git
synced 2024-11-22 23:56:13 +01:00
speedup
This commit is contained in:
parent
3e5d3b1caa
commit
e06668f042
|
@ -70,23 +70,22 @@ void _loopInput(unsigned long currentMicros) {
|
|||
|
||||
//set latch to HIGH to freeze & store parallel data
|
||||
ArduinoPins::fastWriteDigital(_latchPin, HIGH);
|
||||
delayMicroseconds(50);
|
||||
delayMicroseconds(1);
|
||||
//set latch to LOW to enable the data to be transmitted serially
|
||||
ArduinoPins::fastWriteDigital(_latchPin, LOW);
|
||||
delayMicroseconds(50);
|
||||
|
||||
// stream in the bitmap using mapping order provided at constructor
|
||||
for (int xmitByte=0;xmitByte<_nShiftBytes; xmitByte++) {
|
||||
byte newByte=0;
|
||||
for (int xmitBit=0;xmitBit<8; xmitBit++) {
|
||||
ArduinoPins::fastWriteDigital(_clockPin, LOW);
|
||||
delayMicroseconds(20);
|
||||
delayMicroseconds(1);
|
||||
bool data = ArduinoPins::fastReadDigital(_dataPin);
|
||||
byte map=_pinMap[xmitBit];
|
||||
if (data) newByte |= map;
|
||||
else newByte &= ~map;
|
||||
ArduinoPins::fastWriteDigital(_clockPin, HIGH);
|
||||
delayMicroseconds(20);
|
||||
delayMicroseconds(1);
|
||||
}
|
||||
_pinValues[xmitByte]=newByte;
|
||||
// DIAG(F("DIN %x=%x"),xmitByte, newByte);
|
||||
|
|
Loading…
Reference in New Issue
Block a user