You can chat about native SDK questions and issues here.
User avatar
By oezcanacar
#59665 Hi,
can someone point me to a location, where a 4x4 keypad connection to esp8266 12e is implemented with native sdk? I am using eclipse and implement this integration with the native sdk.

Thank you.
User avatar
By gjump
#60592 @oezcanacar

There's no embedded function to handle matrix keypads, you should deal with the keypad with GPIO functions.
You can check the keypad by pooling or by interrupt.
Interrupts are available in all GPIO pins, so, you can install interrupts to detect key presses.

Regards,
User avatar
By bisra
#63479 Sample with esp8266 (ESP-07) + MCP23S17 in SPI:

http://esp8266projets.blog.free.fr/public/esp8266_MCP23S17.pdf

Sorry EDI is ARDUINO

/************************************************************************
* WIRING BETWEEN SPI & ESP-07
* **********************************************************************
* MISO:GPIO12 (Master In Slave Out)
* MOSI:GPIO13 (Master Out Slave In)
* CLK: GPIO14
* CS: GPIO4
* Documentation SPI: https://www.arduino.cc/en/Reference/SPI
************************************************************************/
#include <MCP23S17.h>
#include <stdio.h>
#include<Ticker.h>

Ticker ticker;
MCP mcp(00,4);
int i,idx,l,columnPtr;
char S[4][4]={{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}};

void kbHandler() {
columnPtr=columnPtr<<1; //next keypad column
idx++;
if(idx==5)
{
idx=1; columnPtr=0B1110111111111111; //after column 1 return to column 4
}
mcp.digitalWrite(0B1111111111111111 & columnPtr);
i=mcp.byteRead(0x13)&0x0F;
if(i>0)
{
l=0; //find row number
while(i>0){
l++; i=i>>1;
}
Serial.print("key: ");Serial.println(S[l-1][idx-1]);
}
}

void setup() {
Serial.begin(115200); //for debug
ticker.attach(0.002, kbHandler); // 0.002 = 2 millisecondes
mcp.begin(); //init MCP23S17
mcp.pinMode(0xF0FF); //port B pins 5-8 output mode
mcp.pullupMode (0B0000111100000000); // enable pullup 9-12 for reading keypad
mcp.inputInvert (0B0000111100000000); //input invert 9-12
columnPtr=0B1110111111111111; idx=1; //init scan keyboard on column 4
}



void loop()
{

}