What difference does this make?

MyKeypad::MyKeypad(void (*pt2Func)(int, boolean))
{
        pt2Function = pt2Func;
      
}
void MyKeypad::begin (uint8_t addr)
{
          mcp.begin(addr);
        delay(10);
        mcp.pinMode(0,INPUT);
        mcp.pullUp(0,HIGH);
        mcp.pinMode(1,INPUT);
        mcp.pullUp(1,HIGH);
        mcp.pinMode(2,INPUT);
        mcp.pullUp(2,HIGH);
        mcp.pinMode(3,INPUT);
        mcp.pullUp(3,HIGH);
        mcp.pinMode(4,INPUT);
        mcp.pullUp(4,HIGH);
        mcp.pinMode(5,INPUT);
        mcp.pullUp(5,HIGH);
        mcp.pinMode(6,INPUT);
        mcp.pullUp(6,HIGH);
        mcp.pinMode(7,INPUT);
        //mcp.pullUp(7,HIGH);
        mcp.setupInterrupts(false,LOW);
        mcp.setupInterruptPin(5,FALLING);
}

So this is my constructor for my keypad object, previously all of begin was inside MyKeypad::MyKeypad(blah).
That was working just fine and then on recent ParticleOS’s when running on an electron, flashing that basically turn it into an unresponsive brick, solid white LED. I couldn’t see anything all that different in what I was doing to other similar MCP23008 based libraries. I broke out the MCP config code into a separate begin() routine on a complete whim and suddenly the electron seems happy again. Photon was always fine, the begin routine adds in passing the address whereas previously it was hardcoded so every cloud has a silver lining.

Thoughts?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.