When you do I2C1.setup({settings.......}), the firmware interprets that and sets the appropriate registers such that I2C is on those pins and configured as specified.
writeTo()/readFrom() don't do anything particularly fancy to interpret or process the data - I think writeTo() just converts it to bytes and sends it out, while readFrom() just returns an array of bytes.
In the case of the existing modules, the module code itself, not the firmware, is where the array of bytes returned from I2C.readFrom() (or spi.send() or what-have-you) gets transformed into a nice sensible object. Many of the module docs link to the module code (I have been lax about this in my modules, I think), and in any event, they're all under http://espruino.com/modules (not the same as http://espruino.com/Modules ), and you can read through the module code there.
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.
It doesn't?
When you do I2C1.setup({settings.......}), the firmware interprets that and sets the appropriate registers such that I2C is on those pins and configured as specified.
writeTo()/readFrom() don't do anything particularly fancy to interpret or process the data - I think writeTo() just converts it to bytes and sends it out, while readFrom() just returns an array of bytes.
In the case of the existing modules, the module code itself, not the firmware, is where the array of bytes returned from I2C.readFrom() (or spi.send() or what-have-you) gets transformed into a nice sensible object. Many of the module docs link to the module code (I have been lax about this in my modules, I think), and in any event, they're all under http://espruino.com/modules (not the same as http://espruino.com/Modules ), and you can read through the module code there.