1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-02 13:24:12 +01:00

Modified Matrix to work with MAX7221: changing latching from rising edge to falling edge.

This commit is contained in:
David A. Mellis 2008-05-10 05:02:09 +00:00
parent 8588045f7f
commit 114a19c9a2

View File

@ -116,13 +116,13 @@ void Matrix::putByte(uint8_t data)
// sets register to a byte value for all screens
void Matrix::setRegister(uint8_t reg, uint8_t data)
{
digitalWrite(_pinLoad, HIGH); // begin
digitalWrite(_pinLoad, LOW); // begin
for(uint8_t i = 0; i < _screens; ++i){
putByte(reg); // specify register
putByte(data); // send data
}
digitalWrite(_pinLoad, LOW); // latch in data
digitalWrite(_pinLoad, HIGH); // end
digitalWrite(_pinLoad, HIGH); // latch in data
digitalWrite(_pinLoad, LOW); // end
}
// syncs row of display with buffer
@ -132,13 +132,13 @@ void Matrix::syncRow(uint8_t row)
// uint8_t's can't be negative, so don't test for negative row
if (row >= 8) return;
digitalWrite(_pinLoad, HIGH); // begin
digitalWrite(_pinLoad, LOW); // begin
for(uint8_t i = 0; i < _screens; ++i){
putByte(8 - row); // specify register
putByte(_buffer[row + (8 * i)]); // send data
}
digitalWrite(_pinLoad, LOW); // latch in data
digitalWrite(_pinLoad, HIGH); // end
digitalWrite(_pinLoad, HIGH); // latch in data
digitalWrite(_pinLoad, LOW); // end
}
/******************************************************************************