You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Ok - I just had a quick play with this code on nRF52:

    var data = new Uint8Array(100);
    data.fill(0x55);
    SPI1.setup({mosi:A_PIN,  baud:1000000});
    SPI1.write(data);
    

    That outputs a stream of bits, just 1/0/1/0/etc at 1MHz - and it seems pretty stable and reliable, even with Bluetooth running at the same time.

    So I think that should be fine, so I think 'all' you'll need to do is work out what bits you need to send.

    I'd say maybe the easiest way to do it is to write it all out as a string of digits:

    "0001000100110011...."
    

    Then you can add to it bit by bit, and can also print it to help you debug.

    Then when you're ready you can convert it to an array with something like:

    data = new Uint8Array(s.length>>3);
    for (var i=0;i<data.length;i++) data[i]=parseInt(s.substr(i*8,8),2);
    
About

Avatar for Gordon @Gordon started