• While exploring MCP23017 PortExpander driving 4x4 KeyPad w/ interrupt / setWatch for 'keyDown' detection @Gordon posed the question in post #3

    could (interrupt handling) be added to the existing MCP23017 module?

    This conversation is about exploring the options of that.

    As first thing I made a deep dive into the current MCP12017.sjs I2C module and built a test bed - wiring and code - as a solid regression base for adding things and not breaking things (the current code though already breaks things a bit by its different naming... mainly to support my thought process), but that can be reversed.

    Test wiring is for 3 ports - for now - involving these Portexpander and Espruino(-Wifi) pins (as taken from the code. - x.A0 referring Port A0 of Portexpander; var d=... is there only for high lighting the usually very dim and illegible code comments by this forum's css settings --- fine for focus on code, but not so useful when trying to explain code through 'inline' comments):

    var d=`
    // ***** REGRESSION *****
    //
    // --- wiring
    //
    //   Portexpander          Espruino-WiFi (drivers, probes)
    //   (pullup ~100K         (pullup/pulldown ~30k..40k,
    //    when enabled)         when enbaled)
    //
    //   x.A0 ---------------- A1 driver
    //
    //   x.A1 -----.---R1K---- A4 driver
    //             |---------- A5 (probe digital and anlog)
    //             '---R47K--- GND (Low)
    //
    //   x.A2 -----.---R1K---- A6 driver
    //             |---------- A7 (probe digital and analog)
    //             '---R47K----3.3V (High)
    //
    `;
    

    The breadboard setup is shown in attached screen shot.

    Related test output in console looks like this (example: testing digital input):

    _
    T01---plain_digital_input, probes digital
        S00 reset
            |rst(A0)-out|XP-rst_L...|A1-inL|A4-inL|A5-inL|A6-inL|A7-inlL|XP-rst_H.|
        S01 drivers digital input
            |A1-in|A4-in|A6-in|
        S05 probes digital
            |A5-inDig|A7-inDig|
          oooook A5=false
          oooook A7=true
          oooook x.A0=false
          oooook x.A1=false
          oooook x.A2=true
      ok T01---plain_digital_input, probes digital
    

    T## identify Tests, S## identify Setups. Setups are small pieces of code that configure and re/set the ports. They are combined to build a complete setup as part of a test.

    ...to be continued...


    1 Attachment

    • testWiringR.jpg
About

Avatar for allObjects @allObjects started