From 3fa0aee2e279e9fe2f8c1949605c0eb7673ba8e1 Mon Sep 17 00:00:00 2001 From: wolfv6 Date: Mon, 31 Oct 2016 17:43:53 -0600 Subject: [PATCH] add tri-state and right 74HC165 to sr0_LED_shiftRegs.ino --- src/Row.h | 8 ++++++-- src/Scanner_ShiftRegsPISOMultiRow.cpp | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Row.h b/src/Row.h index a44c784..74add18 100644 --- a/src/Row.h +++ b/src/Row.h @@ -11,8 +11,12 @@ /* strobePin has one of two formats: - * if refScanner a Scanner_uC, then strobePin is an Arduino pin number connected to this row - * otherwise strobePin is bit pattern, 1 indicating an IC pin connected to this row +1. if strobe pin is on uC (Scanner_uC or Scanner_ShiftRegsPISOMultiRow), + then strobePin is an Arduino pin number connected to this row. +2. if strobe pin is on I/O expander (Scanner_IOE), then strobePin is bit pattern, + 1 indicating the I/O expander pin connected to this row + +todo instantiation examples - here or in Scanner? */ class Row { diff --git a/src/Scanner_ShiftRegsPISOMultiRow.cpp b/src/Scanner_ShiftRegsPISOMultiRow.cpp index e29972b..a9125d4 100644 --- a/src/Scanner_ShiftRegsPISOMultiRow.cpp +++ b/src/Scanner_ShiftRegsPISOMultiRow.cpp @@ -21,7 +21,7 @@ Initializes shift register's shift/load pin. */ void Scanner_ShiftRegsPISOMultiRow::begin() { - SPI.begin(); + SPI.begin(); //todo move this to constructor or init() } /* scan() strobes the row's strobePin and returns state of the shift register's input pins. @@ -32,7 +32,7 @@ read_pins_t Scanner_ShiftRegsPISOMultiRow::scan(const uint8_t strobePin) { read_pins_t readState = 0; //bits, 1 means key is pressed, 0 means released - //SPI.beginTransaction( SPISettings(5000000, MSBFIRST, SPI_MODE0) ); //control SPI bus, 5 MHz + SPI.beginTransaction( SPISettings(5000000, MSBFIRST, SPI_MODE0) ); //control SPI bus, 5 MHz digitalWrite(slaveSelect, LOW); //load parallel inputs to registers @@ -46,7 +46,7 @@ read_pins_t Scanner_ShiftRegsPISOMultiRow::scan(const uint8_t strobePin) SPI.transfer(&readState, byte_count); - //SPI.endTransaction(); + SPI.endTransaction(); return readState; }