That looks really neat... Maybe you want some feedback if someone specifies an invalid pin mode?
MCP32x08.prototype.mode=function(pin,mode) {
if (["input","output","input_pullup"].indexOf(mode)<0)
throw "Pin mode "+mode+" not available";
And if this is a form that you'd copy for other port expanders too, a readPort/writePort (or similar) function that reads/writes all pins at once would be really cool - as I imagine it's something that might often be required.
Looks great though - it'll be really good to have different types of expander supported.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
That looks really neat... Maybe you want some feedback if someone specifies an invalid pin mode?
And if this is a form that you'd copy for other port expanders too, a
readPort/writePort
(or similar) function that reads/writes all pins at once would be really cool - as I imagine it's something that might often be required.Looks great though - it'll be really good to have different types of expander supported.