You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Check out http://www.espruino.com/NRF52LL#reference

    I'll just copy the relevant bit below:

    /* Successive approximation analog-to-digital converter
      opts is {
        channels : [ {
          pin : D0, // pin number to use,
          npin : D1, // pin to use for negative input (or undefined)
          pinpull : undefined / "down" / "up" / "vcc/2",   // pin internal resistor state
          npinpull : undefined / "down" / "up" / "vcc/2",  // npin internal resistor state
          gain : 1/6, 1/5, 1/4, 1/3, 1/2, 1(default), 2, 4, // input gain -
          refvdd : bool, // use VDD/4 as a reference (true) or internal 0.6v ref (false)
          tacq : 3(default),5,10,15,20,40 // acquisition time in us
        }, { ... } ] // up to 8 channels
        resolution : 8,10,12,14 // bits (14 default)
        oversample : 0..8, // take 2<<X samples, 0(default) is just 1 sample
        samplerate : 0(default), 80..2047 // Sample from sample task, or at 16MHz/X
        dma : { ptr, cnt } // enable DMA. cnt is in 16 bit words
          // DMA IS REQUIRED UNLESS YOU'RE JUST USING THE 'sample' function
      }
      returns {
        status, // 0=ready, 1=busy
        config, // address of config register
        enable,
        amount, // words transferred since last tStart
        tStart,  // Start ADC
        tSample,  // Start sampling
        tStop,   // Stop ADC
        tCalib,  // Start calibration
        eDone    // event when GPIO changes
        eEnd     // ADC has filled DMA buffer
        setDMA : function({ptr,cnt}) // set new DMA buffer
                   // double-buffered so can be set again right after tStart
        sample : function(cnt) // Make `cnt*channels.length` readings and return the result. resets DMA
      }
    */
    exports.saadc = function (opts) { ... }
    

    so...

    var saadc = ll.saadc({
      resolution : 10, // <--- HERE
      channels : [ { 
       ...
        refvdd:false,   // <--- HERE
    
About

Avatar for Gordon @Gordon started