diff --git a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/PCA9655E_5_keybrd.ino b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/PCA9655E_5_keybrd.ino index 9e759e9..5a23d3e 100644 --- a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/PCA9655E_5_keybrd.ino +++ b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/PCA9655E_5_keybrd.ino @@ -91,8 +91,6 @@ void setup() { delay(6000); Keyboard.print("PCA9655E_5_keybrd.ino "); - - //Keyboard.begin();todo not needed ?? it's in DH mainSketch.cpp and keybrd_4c_split_keyboard_with_IOE.ino scanner_R.begin(); } diff --git a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/back.JPG b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/back.JPG index b987b87..5a5a3a9 100644 Binary files a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/back.JPG and b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/back.JPG differ diff --git a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/front.JPG b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/front.JPG index f76d3b8..339042c 100644 Binary files a/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/front.JPG and b/examples/IOE_PCA9655E_development/PCA9655E_5_keybrd/front.JPG differ diff --git a/examples/keybrd_MCP23017/keybrd_MCP23017.ino b/examples/keybrd_MCP23017/keybrd_MCP23017.ino new file mode 100644 index 0000000..eed9dbd --- /dev/null +++ b/examples/keybrd_MCP23017/keybrd_MCP23017.ino @@ -0,0 +1,20 @@ +/* keybrd_MCP23017.ino + +MCP23017 pin assignments +DESTINATION PIN PIN_NUMBER PIN DESTINATION + row0 GPB0 1 28 GPA7 + row1 GPB1 2 27 GPA6 + GPB2 3 26 GPA5 + GPB3 4 25 GPA4 + GPB4 5 24 GPA3 + GPB5 6 23 GPA2 + GPB6 7 22 GPA1 col1 + GPB7 8 21 GPA0 col0 + LC 3.3V VDD 9 20 INTA + GND VSS 10 19 INTB + NC 11 18 /RESET VDD + LC 19 SCL 12 17 A2 GND + LC 18 SDA 13 16 A1 GND + NC 14 15 A0 GND + +*/ diff --git a/examples/keybrd_MCP23018/back.JPG b/examples/keybrd_MCP23018/back.JPG new file mode 100644 index 0000000..77b4d9e Binary files /dev/null and b/examples/keybrd_MCP23018/back.JPG differ diff --git a/examples/keybrd_MCP23018/front.JPG b/examples/keybrd_MCP23018/front.JPG new file mode 100644 index 0000000..ab866da Binary files /dev/null and b/examples/keybrd_MCP23018/front.JPG differ diff --git a/examples/keybrd_MCP23018/keybrd_MCP23018.ino b/examples/keybrd_MCP23018/keybrd_MCP23018.ino index 94029ff..2dabd8e 100644 --- a/examples/keybrd_MCP23018/keybrd_MCP23018.ino +++ b/examples/keybrd_MCP23018/keybrd_MCP23018.ino @@ -9,12 +9,28 @@ This sketch: |-------|-------|-------| |-------|-------|-------| | **1** | 1 | 2 | | **1** | 3 | 4 | | **0** | a | b | | **0** | c | d | + +MCP23018 pin assignments +DESTINATION PIN PIN_NUMBER PIN DESTINATION + GND VSS 1 28 NC + NC 2 27 GPA7 + row0 GPB0 3 26 GPA6 + row1 GPB1 4 25 GPA5 + GPB2 5 24 GPA4 + GPB4 7 22 GPA2 + GPB5 8 21 GPA1 col1 + GPB6 9 20 GPA0 col0 + GPB7 10 19 INTA + LC 3.3V VCC 11 18 INTB + LC 19 SCL 12 17 NC + LC 18 SDA 13 16 /RESET VCC + NC 14 15 ADDR GND + */ // ################## GLOBAL ################### // ================= INCLUDES ================== #include #include -#include #include //left matrix @@ -36,28 +52,14 @@ const uint8_t readPinCount = sizeof(readPins)/sizeof(*readPins); Scanner_uC scanner_L(LOW, readPins, readPinCount); -/* =============== RIGHT SCANNER =============== -The right matrix is scanned by an I/O expander. -The MCP23018 address is set by grounding or powering pins. -*/ -const uint8_t IOE_ADDR = 0x20; //MCP23018 address pin grounded +// =============== RIGHT SCANNER =============== +const uint8_t IOE_ADDR = 0x20; //MCP23018 ADDR pin grounded -/* -Normally all strobe pins are on one port, and all the read pins are on the other port. -In this example, portB stobes the row while portA reads the colums. -Port_MCP23018 constructor parameters are: deviceAddr, portNum, readPins. -readPins is a bit pattern, where 0=output, 1=input. -In portA, the first two pins are set to input for reading. -"<<" (bit shift left) and "|" (OR) are bitwise operators. -Pin numbers to be read are delimited by "|" and to the right of "1<<". -*/ Port_MCP23018 portA(IOE_ADDR, 0, 1<<0 | 1<<1 ); //read pins 0, 1 Port_MCP23018 portB(IOE_ADDR, 1, 0); Scanner_IOE scanner_R(LOW, portB, portA); -/* ================= RIGHT LED ================= -The LED_Port constructor parameters are a port and pin number that is connected to an LED. -*/ +// ================= RIGHT LED ================= LED_Port LED_capsLck(portA, 1<<7); // =================== CODES =================== @@ -71,19 +73,8 @@ Code_Sc s_2(KEY_2); Code_Sc s_3(KEY_3); Code_Sc s_4(KEY_4); -Code_LEDLock o_capsLock(KEY_CAPS_LOCK, LED_capsLck);//was testing LED, restore s_4 when done - -/* =================== ROWS ==================== -Left row names contain the letter 'L', while right row names conatain the letter 'R'. - -Row constructor parameters are: scanner, strobePin, ptrsKeys[], keyCount. -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 a bit pattern, 1 indicating an IC pin connected to the row -*/ -/* ---------------- LEFT ROWS ------------------ -The left rows have a Scanner_uC and Arduino pin numbers to strobe. -*/ +// =================== ROWS ==================== +// ---------------- LEFT ROWS ------------------ Key* ptrsKeys_L0[] = { &s_1, &s_2 }; const uint8_t KEY_COUNT_L0 = sizeof(ptrsKeys_L0)/sizeof(*ptrsKeys_L0); Row row_L0(scanner_L, 0, ptrsKeys_L0, KEY_COUNT_L0); @@ -92,10 +83,8 @@ Key* ptrsKeys_L1[] = { &s_a, &s_b }; const uint8_t KEY_COUNT_L1 = sizeof(ptrsKeys_L1)/sizeof(*ptrsKeys_L1); Row row_L1(scanner_L, 1, ptrsKeys_L1, KEY_COUNT_L1); -/* ---------------- RIGHT ROWS ----------------- -The right rows have a Scanner_IOE and pin bits to strobe. -*/ -Key* ptrsKeys_R0[] = { &s_3, &o_capsLock }; +// ---------------- RIGHT ROWS ----------------- +Key* ptrsKeys_R0[] = { &s_3, &s_4 }; const uint8_t KEY_COUNT_R0 = sizeof(ptrsKeys_R0)/sizeof(*ptrsKeys_R0); Row row_R0(scanner_R, 1<<0, ptrsKeys_R0, KEY_COUNT_R0); @@ -106,7 +95,9 @@ Row row_R1(scanner_R, 1<<1, ptrsKeys_R1, KEY_COUNT_R1); // ################### MAIN #################### void setup() { - Keyboard.begin(); + delay(6000); + Keyboard.print("keybrd_MCP23018.ino "); + scanner_R.begin(); } diff --git a/src/Scanner_ShiftRegsRead.h b/src/Scanner_ShiftRegsRead.h index d531e03..34c95c9 100644 --- a/src/Scanner_ShiftRegsRead.h +++ b/src/Scanner_ShiftRegsRead.h @@ -19,10 +19,12 @@ Example instantiation: In the above Row instantiation, argument 0 for "strobePin" is ignored because there is no strobe. -There are three Scanner_ShiftRegsRead parameters. -1. "activeState" paramter is ignored, but should be active state HIGH or LOW for ScannerInterface. +There are three Scanner_ShiftRegsRead-constructor parameters. +1. "activeState" paramter is ignored, but should be HIGH or LOW for documention. + activeState is required by ScannerInterface. + Actual activeState is determined by external pull-up or pull-down resistors described below. 2. "slaveSelect" paramter can be any controller pin connected to shift register's SHIFT-LOAD pin. -3. "byte_count" is the number of bytes to read from shift registers (1 to 4). +3. "byte_count" is the number of bytes to read from shift registers (1, 2, 3, or 4). byte_count should cover all the row's keys: byte_count*8 >= row's keyCount Hardware setup: