• Just realised - it's reset, not unset in Espruino (although unset would probably have made more sense :).

    Hmm, I'm not sure about the separate module for PEP. It definitely feels like it should be in a different module, but actually the functions are quite small and there's not much common code - I wonder who'd use two different port expanders in the same project (which would be the only time it really helped).

    If not, defining the class in the same file means you could make it faster by 'inlining' MCP32x08.write if you wanted to... for instance:

    PEP.prototype.set=function(){this.p.s(9,­this.p.olat|=1<<this.b)};
    PEP.prototype.reset=function(){this.p.s(­9,this.p.olat&=~(1<<this.b))};
    
About

Avatar for Gordon @Gordon started