Fork me on GitHub
beagleboard.org

BoneScript

You might be able to see a newer version of this on beagleboard.org/support/bonescript/getPinMode

getPinMode(pin, [callback])

Get the mode of a pin.

Arguments

Return value

  • mux: index of mux mode
  • options: array of mode names
  • slew: 'fast' or 'slow'
  • rx: 'enabled' or 'disabled'
  • pullup: 'diabled', 'pullup' or 'pulldown'
  • pin: key string for pin
  • name: pin name
  • err: error status message

callback(err,resp)

  • resp: response object containing:
    • mux: index of mux mode
    • options: array of mode names
    • slew: 'fast' or 'slow'
    • rx: 'enabled' or 'disabled'
    • pullup: 'diabled', 'pullup' or 'pulldown'
    • pin: key string for pin
    • name: pin name
  • err: error status message

Example

var b = require('bonescript');
b.getPinMode("P8_13", printPinMux);
function printPinMux(err,resp) {
    console.log('mux = ' + resp.mux);
    console.log('pullup = ' + resp.pullup);
    console.log('slew = ' + resp.slew);
    if(resp.options) 
        console.log('options = ' + 
            resp.options.join(','));
    console.log('pin = ' + resp.pin);
    console.log('name = ' + resp.name);
    console.log('err = ' + err);
}

Build and execute instructions

Check out some of the other examples to see and verify getPinMode functionality.

See also

Topics

Related functions