• While porting some Arduino C code to an Espruino module i stumbled over

    SPI.begin()

    SPI.begin() Description

    Initializes the SPI bus by setting SCK, MOSI, and SS to outputs,
    pulling SCK and MOSI low, and SS high.

    as far as i understand the Espruino reference for SPI the first part

    Initializes the SPI bus by setting SCK, MOSI, and SS to outputs,

    is (in part) handled by SPI.setup() e.g.

    SPI3.setup({mosi:B5,miso:B4,sck:B3,mode:­3});
    

    for the second part

    pulling SCK and MOSI low, and SS high.

    i am clueless

    • is there something similar for Espruino?
      • If yes, where - maybe hidden from user - ?
    • Is that even needed?
  • It happens as part of setup - when it makes the pins outputs they output the default values for SPI. What exactly those are depends on the mode, but I think as you're using mode 3 that's correct.

  • thx for the help, i found the mode description on the Wikipedia SPI site

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

What is the Espruino equivalence for Arduino SPI.begin()

Posted by Avatar for MichaelPralow @MichaelPralow

Actions