0

在我的 BeagleBone Black 上,当我运行此脚本时:

#!/usr/bin/node

var b = require('bonescript');

b.getPlatform(printData);
function printData(x) {
    console.log('name = ' + x.name);
    console.log('version = ' + x.version);
    console.log('serialNumber = ' + x.serialNumber);
    console.log('bonescript = ' + x.bonescript);
    console.log();
}

b.pinMode("P9_11", b.OUTPUT, 7, 'pullup', 'slow');
b.pinMode("P9_13", b.OUTPUT, 7, 'pullup', 'slow');
b.pinMode("P9_15", b.OUTPUT, 7, 'pullup', 'slow');
b.pinMode("P9_17", b.OUTPUT, 7, 'pullup', 'slow');

b.getPinMode("P9_11", printPinMux);
b.getPinMode("P9_13", printPinMux);
b.getPinMode("P9_15", printPinMux);
b.getPinMode("P9_17", printPinMux);

function printPinMux(x) {
    console.log('mux = ' + x.mux);
    console.log('pullup = ' + x.pullup);
    console.log('slew = ' + x.slew);
    if(x.options) {
        console.log('options = ' + x.options.join(','));
    }
    console.log('pin = ' + x.pin);
    console.log('name = ' + x.name);
    console.log('err = ' + x.err);
    console.log();
}

我得到这个输出:

name = BeagleBone Black
version = 0A5A
serialNumber = 1813BBBK7710
bonescript = 0.2

mux = 7
pullup = pullup
slew = fast
options = gpmc_wait0,mii2_crs,NA,rmii2_crs_dv,mmc1_sdcd,NA,NA,gpio0_30
pin = P9_11
name = UART4_RXD
err = undefined

mux = 7
pullup = pullup
slew = fast
options = gpmc_wpn,mii2_rxerr,NA,rmii2_rxerr,mmc2_sdcd,NA,NA,gpio0_31
pin = P9_13
name = UART4_TXD
err = undefined

mux = 2
pullup = pulldown
slew = slow
options = spi0_cs0,mmc2_sdwp,i2c1_scl,NA,NA,NA,NA,gpio0_5
pin = P9_17
name = I2C1_SCL
err = undefined

mux = 0
pullup = pulldown
slew = fast
options = mii1_rxd3,NA,rgmii1_rd3,mmc0_dat5,mmc1_dat2,NA,mcasp0_axr0,gpio2_18
pin = P9_15
name = GPIO1_16
err = undefined

看起来 b.pinMode() 没有设置引脚的模式。为什么?

4

0 回答 0