You are reading a single comment by @luwar and its replies. Click here to read the full conversation.
  • The default bitrate is actually 50000 (at least on proper Espruino boards)... Which one are you using?

    You can check i2c._options.bitrate - however if the use didn't initialise I2C or didn't specify a bitrate then it won't be there, so you'd have to do something like:

    var br = (i2c._options && i2c._options.bitrate) || 50000;
    if (br < 10000 || br > 100000) { ....
    

    This could be built into Espruino itself as a function - but then you'd have to wait for the next version before your code would work.

  • The default bitrate is actually 50000 (at least on proper Espruino boards)... Which one are you using?

    Good to know. I thought the default bitrate were higher. I'm using a classic and different pico boards. So it is unnecessary in my case to check the bitrate if nobody increase it explicitly. Ok, thanks.
    i2c._options.bitrate looks more like an internal API. I would prefer a documented getBitrate() method but that's only my viewpoint.

About

Avatar for luwar @luwar started