inner workings of the Espruino firmware...

Posted on
  • Hi, Im curious as to how the firmware code handles the i2c bus. Please bear with me, I dont know enough of the terminology. How does the i2c bus 'know' how to split the incoming data into an object, later allowing the user to manipulate the data easily?

  • 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.

  • @DrAzzy Thanks for the explaination :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

inner workings of the Espruino firmware...

Posted by Avatar for d0773d @d0773d

Actions