本文整理汇总了Java中com.pi4j.wiringpi.GpioUtil.unexport方法的典型用法代码示例。如果您正苦于以下问题:Java GpioUtil.unexport方法的具体用法?Java GpioUtil.unexport怎么用?Java GpioUtil.unexport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.pi4j.wiringpi.GpioUtil
的用法示例。
在下文中一共展示了GpioUtil.unexport方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: test
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
public void test(int gpio) {
int status = Gpio.wiringPiSetupGpio();
if (status != 0) {
throw new RuntimeException("Error initialising wiringPi: " + status);
}
Gpio.pinMode(gpio, Gpio.INPUT);
Gpio.pullUpDnControl(gpio, Gpio.PUD_UP);
int delay = 20;
System.out.println("Waiting " + delay + "s for events..., thread name=" + Thread.currentThread().getName());
if (Gpio.wiringPiISR(gpio, Gpio.INT_EDGE_BOTH, this) != 1) {
System.out.println("Error in wiringPiISR");
} else {
System.out.println("Sleeping for " + delay + "s");
SleepUtil.sleepSeconds(delay);
}
GpioUtil.unexport(gpio);
}
示例2: closeDevice
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
@Override
protected void closeDevice() throws RuntimeIOException {
Logger.debug("closeDevice()");
switch (pwmType) {
case HARDWARE:
GpioUtil.unexport(gpio);
case SOFTWARE:
SoftPwm.softPwmStop(gpio);
GpioUtil.unexport(gpio);
break;
default:
}
}
示例3: main
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage: " + WiringPiRawPerfTest.class.getName() + " <pin-number> [<iterations>]");
System.exit(1);
}
final int pin = Integer.parseInt(args[0]);
final int iterations = args.length > 1 ? Integer.parseInt(args[1]) : DEFAULT_ITERATIONS;
Gpio.wiringPiSetupGpio();
if (GpioUtil.isExported(pin)) {
GpioUtil.setDirection(pin, GpioUtil.DIRECTION_OUT);
} else {
GpioUtil.export(pin, GpioUtil.DIRECTION_OUT);
}
Gpio.pinMode(pin, Gpio.OUTPUT);
for (int j=0; j<5; j++) {
long start_nano = System.nanoTime();
for (int i=0; i<iterations; i++) {
Gpio.digitalWrite(pin, true);
Gpio.digitalWrite(pin, false);
}
long duration_ns = (System.nanoTime() - start_nano);
System.out.format("Duration for %d iterations: %.4fs%n",
Integer.valueOf(iterations), Float.valueOf(((float)duration_ns) / 1000 / 1000 / 1000));
}
GpioUtil.unexport(pin);
}
示例4: closeDevice
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
@Override
protected void closeDevice() {
Logger.debug("closeDevice()");
//GpioFactory.getInstance().unprovisionPin(pwmOutputPin);
switch (pwmType) {
case HARDWARE:
GpioUtil.unexport(gpio);
case SOFTWARE:
SoftPwm.softPwmStop(gpio);
GpioUtil.unexport(gpio);
break;
default:
}
}
示例5: closeDevice
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
@Override
protected void closeDevice() {
Logger.debug("closeDevice()");
GpioUtil.unexport(gpio);
}
示例6: closeDevice
import com.pi4j.wiringpi.GpioUtil; //导入方法依赖的package包/类
@Override
protected void closeDevice() {
Logger.debug("closeDevice()");
removeListener();
GpioUtil.unexport(gpio);
}