keybrd version 0.x.x is for initial development. | keybrd version 0.x.x is for initial development. | ||||
keybrd version 1.0.0 will be released when the public API is stable. | keybrd version 1.0.0 will be released when the public API is stable. | ||||
0.6.4 (2016-11-16) | |||||
------------------ | |||||
* Enhancements | |||||
* add Port_MCP23018 | |||||
* add Port_MCP23S18 | |||||
* add Port_ShiftRegs | |||||
* add PortWriteInterface | |||||
* add add LED_PortOpenDrain | |||||
* add examples/IOE_PCA9655E_development/ | |||||
* rename strobeOn to activeState | |||||
* move strobe logic from Port_*::write() to Scanner_IOE::scan() | |||||
* Backward incompatible changes | |||||
* rename print_microseconds_per_scan() to printMicrosecondsPerScan() | |||||
* rename print_scans_per_second() to printScansPerSecond() | |||||
* rename Scanner_ShiftRegsPISOSingleRow to Scanner_ShiftRegsRead | |||||
* rename Scanner_ShiftRegsPISOMultiRow to Scanner_ShiftRegsReadStrobed | |||||
* in Scanner_ShiftRegsReadStrobed, reverse slaveSelect HIGH/LOW for SPI compatible tri-state | |||||
* in Port_MCP23S17, add slaveSelect to constructor parameter | |||||
* in Port_*, replace write() with writeHigh() and writeLow() | |||||
0.6.3 (2016-10-06) | 0.6.3 (2016-10-06) | ||||
------------------ | ------------------ | ||||
* Enhancements | * Enhancements |
The series of sketches in this folder where used to develope the Port_PCA9655E class. | |||||
The series of sketches in this folder where used to develop the Port_PCA9655E class in stages. | |||||
The folder numbers are ordered from fundamental to practical. | The folder numbers are ordered from fundamental to practical. | ||||
Each sketch was tested on a breadboard. Breadboards hold: | Each sketch was tested on a breadboard. Breadboards hold: |
{ | { | ||||
uint8_t pullUp; //bits, GPPU 0=pull-up disabled, 1=pull-up enabled | uint8_t pullUp; //bits, GPPU 0=pull-up disabled, 1=pull-up enabled | ||||
if (activeState == LOW) //if active low | |||||
if (activeState == LOW) //if active low | |||||
{ | { | ||||
pullUp = readPins; //0=pull-up disabled (for LED), 1=pull-up enabled (for read) | pullUp = readPins; //0=pull-up disabled (for LED), 1=pull-up enabled (for read) | ||||
} | } | ||||
else //if active high | else //if active high | ||||
{ | { | ||||
pullUp = 0; //0=pull-up disabled (for external pull-down resistors) | |||||
pullUp = 0; //0=pull-up disabled (external pull-down resistors) | |||||
} | } | ||||
Wire.beginTransmission(deviceAddr); | Wire.beginTransmission(deviceAddr); | ||||
*/ | */ | ||||
void Port_MCP23017::writeLow(const uint8_t pin) | void Port_MCP23017::writeLow(const uint8_t pin) | ||||
{ | { | ||||
outputVal &= ~pin; //set pin output to low | |||||
outputVal &= ~pin; //set pin output to low | |||||
Wire.beginTransmission(deviceAddr); | Wire.beginTransmission(deviceAddr); | ||||
Wire.write(portNum + 0x12); //GPIO | Wire.write(portNum + 0x12); //GPIO | ||||
{ | { | ||||
Wire.beginTransmission(deviceAddr); | Wire.beginTransmission(deviceAddr); | ||||
Wire.write(portNum + 0x12); //GPIO | Wire.write(portNum + 0x12); //GPIO | ||||
Wire.endTransmission(false); //MCP23017 needs false to send a restart ??todo really? | |||||
Wire.endTransmission(false); //MCP23017 needs false to send a restart | |||||
Wire.requestFrom(deviceAddr, 1u); //request one byte from input port | Wire.requestFrom(deviceAddr, 1u); //request one byte from input port | ||||
// --------------- RIGHT SCANNER --------------- | // --------------- RIGHT SCANNER --------------- | ||||
const uint8_t IOE_ADDR = 0x20; //MCP23S17 address, all 3 ADDR pins are grounded | const uint8_t IOE_ADDR = 0x20; //MCP23S17 address, all 3 ADDR pins are grounded | ||||
const uint8_t slaveSelect = 10; | |||||
const uint8_t slaveSelect = 10; //Arduino-pin number connected to MCP23S17 CS or SS | |||||
Port_MCP23S17 portA(slaveSelect , IOE_ADDR, 0, 1<<0 | 1<<1 ); //for read | Port_MCP23S17 portA(slaveSelect , IOE_ADDR, 0, 1<<0 | 1<<1 ); //for read | ||||
Port_MCP23S17 portB(slaveSelect , IOE_ADDR, 1, 0); //for strobe | Port_MCP23S17 portB(slaveSelect , IOE_ADDR, 1, 0); //for strobe | ||||
void setup() | void setup() | ||||
{ | { | ||||
scanner_R.begin(); | scanner_R.begin(); | ||||
layerState.begin(); //todo call LayerState_LED::begin() after Scanner_IOE::begin() | |||||
layerState.begin(); //call LayerState_LED::begin() after Scanner_IOE::begin() | |||||
} | } | ||||
void loop() | void loop() |
5. Study other keybrd port classes. | 5. Study other keybrd port classes. | ||||
* SPI I/O expander port classes: Port_MCP23S17 | * SPI I/O expander port classes: Port_MCP23S17 | ||||
* I2C I/O expander port classes: Port_PCA9655E | * I2C I/O expander port classes: Port_PCA9655E | ||||
6. Write the port classes for your I/O expander. Debugging I/O expander code is hard because | |||||
6. Write the port classes for your I/O expander. | |||||
* [Example](../examples/IOE_PCA9655E_development/) shows how Port_PCA9655E was developed in stages, from fundamental to practical | |||||
* Debugging I/O expander code is hard because | |||||
SPI or I2C protocol, expander configuration, and expander commands. | SPI or I2C protocol, expander configuration, and expander commands. | ||||
<br> | <br> |