• @Gordon, ...just returning from looking at it for he first time... :( ... :[ ... 8{... LOL

    Intially, I had the feeling there must be already something because you listed a keypad under items with Espruino... but somehow did not look it up... and the problem kind of 'challenged' me. So my work was totally unbiased... may be because of the forum question and not finding a reference to the keypad module in your post there, I ventured into this exercise. Looking now at the existing moudule, it feels really like a programming excercise (like at a job interview)... but it was fun and is even more fun now to look at both and have 3rd thoughts (phase of 2nd thoughts have long gone).

    Conceptually I find the same things: array of driving pins and array of sensing pins, setting and clearing watches. Differences are:

    1. 'both' and 'repeat' on watches vs. only falling or rising and single
    2. read/write with array of pins in one shot where possible vs. looping through pin arrays
    3. closure/ module using functions vs. object with methods
    4. user can ask status (scan status) when no callback is provided vs. always requires callback
    5. available module has no enable/disable

    Have to test and figure out behavior... used just wire to touch the castellation pads (have no keypad and was too lazy to wire up a DIY), and got flurry of events, which puzzled me, because I asked for 'repeat: false' in setWatch-option. Initially, in scan (readStatus in existing module), I wanted to use just the digitalWrite/Read with implicite output / input pinMod() setting on the driving pins, but it did not do what I wanted... may be I missed something or most likely got derailed by some other temporary issues the code had.

    Other than that, about the same... the available module looks a bit leaner due to function use and write/read of array. Both use set and clear watches... not much other way to do that.

About

Avatar for allObjects @allObjects started