Re: i==3
We only want to leave the power on when we issue the copy scratchpad command, not for other commands. This is the only time that s() gets called with a 4 element array, all other times it's called with 1 or 3 element array - hence checking for i==3 is true for the write scratchpad command only.
Re: allObjects' comment about connect - Hmm. Not sure what to do here. Am I understanding correctly that the issue is that if you don't export the whole class, then you can't add things to the prototype? And thus, if you had multiple eeproms and wanted to add somethign to the prototypes (like the helper functions I mentioned above for converting numbers to bytes or w/e). What are the disadvantages of exporting the class?
DS2xxx? Done.
Worth noting - there aren't any other EEPROMs for the OneWire bus as far as I can tell, just the line from Dallas Semi.
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.
Re: i==3
We only want to leave the power on when we issue the copy scratchpad command, not for other commands. This is the only time that s() gets called with a 4 element array, all other times it's called with 1 or 3 element array - hence checking for i==3 is true for the write scratchpad command only.
Re: allObjects' comment about connect - Hmm. Not sure what to do here. Am I understanding correctly that the issue is that if you don't export the whole class, then you can't add things to the prototype? And thus, if you had multiple eeproms and wanted to add somethign to the prototypes (like the helper functions I mentioned above for converting numbers to bytes or w/e). What are the disadvantages of exporting the class?
DS2xxx? Done.
Worth noting - there aren't any other EEPROMs for the OneWire bus as far as I can tell, just the line from Dallas Semi.