本文整理汇总了Java中ioio.lib.api.DigitalOutput类的典型用法代码示例。如果您正苦于以下问题:Java DigitalOutput类的具体用法?Java DigitalOutput怎么用?Java DigitalOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DigitalOutput类属于ioio.lib.api包,在下文中一共展示了DigitalOutput类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: openDigitalOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public DigitalOutput openDigitalOutput(
DigitalOutput.Spec spec, boolean startValue)
throws ConnectionLostException {
checkState();
hardware_.checkValidPin(spec.pin);
checkPinFree(spec.pin);
DigitalOutputImpl result = new DigitalOutputImpl(this, spec.pin, startValue);
addDisconnectListener(result);
openPins_[spec.pin] = true;
try {
protocol_.setPinDigitalOut(spec.pin, startValue, spec.mode);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:jrieke,项目名称:ioiometer,代码行数:19,代码来源:IOIOImpl.java
示例2: openDigitalOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public DigitalOutput openDigitalOutput(
DigitalOutput.Spec spec, boolean startValue)
throws ConnectionLostException {
checkState();
Resource pin = new Resource(ResourceType.PIN, spec.pin);
resourceManager_.alloc(pin);
DigitalOutputImpl result = new DigitalOutputImpl(this, pin, startValue);
addDisconnectListener(result);
try {
protocol_.setPinDigitalOut(spec.pin, startValue, spec.mode);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:19,代码来源:IOIOImpl.java
示例3: openDigitalOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public DigitalOutput openDigitalOutput(
DigitalOutput.Spec spec, boolean startValue)
throws ConnectionLostException {
checkState();
PinFunctionMap.checkValidPin(spec.pin);
checkPinFree(spec.pin);
DigitalOutputImpl result = new DigitalOutputImpl(this, spec.pin, startValue);
addDisconnectListener(result);
openPins_[spec.pin] = true;
try {
protocol_.setPinDigitalOut(spec.pin, startValue, spec.mode);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:smartebikes,项目名称:SmartEbikesMonitorSystem,代码行数:19,代码来源:IOIOImpl.java
示例4: createIOIOLooper
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
protected IOIOLooper createIOIOLooper() {
return new BaseIOIOLooper() {
private DigitalOutput led_;
@Override
protected void setup() throws ConnectionLostException,
InterruptedException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN);
}
@Override
public void loop() throws ConnectionLostException,
InterruptedException {
led_.write(false);
Thread.sleep(500);
led_.write(true);
Thread.sleep(500);
}
};
}
开发者ID:PinkHatSpike,项目名称:pioio,代码行数:22,代码来源:HelloIOIOService.java
示例5: createIOIOLooper
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public IOIOLooper createIOIOLooper(String connectionType, Object extra) {
return new BaseIOIOLooper() {
private DigitalOutput led_;
@Override
protected void setup() throws ConnectionLostException,
InterruptedException {
led_ = ioio_.openDigitalOutput(IOIO.LED_PIN, true);
}
@Override
public void loop() throws ConnectionLostException,
InterruptedException {
led_.write(!ledOn_);
Thread.sleep(10);
}
};
}
开发者ID:PinkHatSpike,项目名称:pioio,代码行数:20,代码来源:HelloIOIOConsole.java
示例6: openDigitalOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public DigitalOutput openDigitalOutput(
DigitalOutput.Spec spec, boolean startValue)
throws ConnectionLostException {
checkState();
Resource pin = new Resource(ResourceType.PIN, spec.pin);
resourceManager_.alloc(pin);
DigitalOutputImpl result = new DigitalOutputImpl(this, pin, startValue);
addDisconnectListener(result);
try {
protocol_.setPinDigitalOut(spec.pin, startValue, spec.mode);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:edarn,项目名称:kryp-client,代码行数:19,代码来源:IOIOImpl.java
示例7: setPinDigitalOut
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
synchronized public void setPinDigitalOut(int pin, boolean value,
DigitalOutput.Spec.Mode mode) throws IOException {
beginBatch();
writeByte(SET_PIN_DIGITAL_OUT);
writeByte((pin << 2)
| (mode == DigitalOutput.Spec.Mode.OPEN_DRAIN ? 0x01 : 0x00)
| (value ? 0x02 : 0x00));
endBatch();
}
开发者ID:jrieke,项目名称:ioiometer,代码行数:10,代码来源:IOIOProtocol.java
示例8: openPwmOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public PwmOutput openPwmOutput(DigitalOutput.Spec spec,
int freqHz) throws ConnectionLostException {
checkState();
hardware_.checkSupportsPeripheralOutput(spec.pin);
checkPinFree(spec.pin);
int pwmNum = pwmAllocator_.allocateModule();
int scale = 0;
float baseUs;
int period;
while (true) {
final int clk = 16000000 / IOIOProtocol.PwmScale.values()[scale].scale;
period = clk / freqHz;
if (period <= 65536) {
baseUs = 1000000.0f / clk;
break;
}
if (++scale >= PwmScale.values().length) {
throw new IllegalArgumentException("Frequency too low: "
+ freqHz);
}
}
PwmImpl pwm = new PwmImpl(this, spec.pin, pwmNum, period, baseUs);
addDisconnectListener(pwm);
openPins_[spec.pin] = true;
try {
protocol_.setPinDigitalOut(spec.pin, false, spec.mode);
protocol_.setPinPwm(spec.pin, pwmNum, true);
protocol_.setPwmPeriod(pwmNum, period - 1,
IOIOProtocol.PwmScale.values()[scale]);
} catch (IOException e) {
pwm.close();
throw new ConnectionLostException(e);
}
return pwm;
}
开发者ID:jrieke,项目名称:ioiometer,代码行数:39,代码来源:IOIOImpl.java
示例9: openUart
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public Uart openUart(int rx, int tx, int baud, Uart.Parity parity,
Uart.StopBits stopbits) throws ConnectionLostException {
return openUart(rx == INVALID_PIN ? null : new DigitalInput.Spec(rx),
tx == INVALID_PIN ? null : new DigitalOutput.Spec(tx), baud,
parity, stopbits);
}
开发者ID:jrieke,项目名称:ioiometer,代码行数:8,代码来源:IOIOImpl.java
示例10: openSpiMaster
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public SpiMaster openSpiMaster(int miso, int mosi, int clk,
int[] slaveSelect, SpiMaster.Rate rate)
throws ConnectionLostException {
DigitalOutput.Spec[] slaveSpecs = new DigitalOutput.Spec[slaveSelect.length];
for (int i = 0; i < slaveSelect.length; ++i) {
slaveSpecs[i] = new DigitalOutput.Spec(slaveSelect[i]);
}
return openSpiMaster(new DigitalInput.Spec(miso, Mode.PULL_UP),
new DigitalOutput.Spec(mosi), new DigitalOutput.Spec(clk),
slaveSpecs, new SpiMaster.Config(rate));
}
开发者ID:jrieke,项目名称:ioiometer,代码行数:13,代码来源:IOIOImpl.java
示例11: setPinDigitalOut
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
synchronized public void setPinDigitalOut(int pin, boolean value, DigitalOutput.Spec.Mode mode)
throws IOException {
beginBatch();
writeByte(SET_PIN_DIGITAL_OUT);
writeByte((pin << 2) | (mode == DigitalOutput.Spec.Mode.OPEN_DRAIN ? 0x01 : 0x00)
| (value ? 0x02 : 0x00));
endBatch();
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:9,代码来源:IOIOProtocol.java
示例12: openUart
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public Uart openUart(int rx, int tx, int baud, Uart.Parity parity,
Uart.StopBits stopbits) throws ConnectionLostException {
return openUart(rx == INVALID_PIN ? null : new DigitalInput.Spec(rx),
tx == INVALID_PIN ? null : new DigitalOutput.Spec(tx), baud,
parity, stopbits);
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:8,代码来源:IOIOImpl.java
示例13: openSpiMaster
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public SpiMaster openSpiMaster(int miso, int mosi, int clk,
int[] slaveSelect, SpiMaster.Rate rate)
throws ConnectionLostException {
DigitalOutput.Spec[] slaveSpecs = new DigitalOutput.Spec[slaveSelect.length];
for (int i = 0; i < slaveSelect.length; ++i) {
slaveSpecs[i] = new DigitalOutput.Spec(slaveSelect[i]);
}
return openSpiMaster(new DigitalInput.Spec(miso, Mode.PULL_UP),
new DigitalOutput.Spec(mosi), new DigitalOutput.Spec(clk),
slaveSpecs, new SpiMaster.Config(rate));
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:13,代码来源:IOIOImpl.java
示例14: ChannelOutCompare
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
protected ChannelOutCompare(DigitalOutput.Spec[] specs) {
specs_ = specs;
oc_ = new Resource(ResourceType.OUTCOMPARE);
ocs_.add(oc_);
for (DigitalOutput.Spec spec : specs) {
ioio_.hardware_.checkSupportsPeripheralOutput(spec.pin);
pins_.add(new Resource(ResourceType.PIN, spec.pin));
}
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:10,代码来源:SequencerImpl.java
示例15: openPins
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
public final void openPins() throws ConnectionLostException {
try {
for (DigitalOutput.Spec spec : specs_) {
ioio_.protocol_.setPinDigitalOut(spec.pin, false, spec.mode);
ioio_.protocol_.setPinPwm(spec.pin, oc_.id, true);
}
} catch (IOException e) {
throw new ConnectionLostException(e);
}
}
开发者ID:flyver,项目名称:Flyver-Apps,代码行数:12,代码来源:SequencerImpl.java
示例16: openPwmOutput
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
@Override
synchronized public PwmOutput openPwmOutput(DigitalOutput.Spec spec,
int freqHz) throws ConnectionLostException {
checkState();
PinFunctionMap.checkSupportsPeripheralOutput(spec.pin);
checkPinFree(spec.pin);
int pwmNum = pwmAllocator_.allocateModule();
int scale = 0;
float baseUs;
int period;
while (true) {
final int clk = 16000000 / IOIOProtocol.PwmScale.values()[scale].scale;
period = clk / freqHz;
if (period <= 65536) {
baseUs = 1000000.0f / clk;
break;
}
if (++scale >= PwmScale.values().length) {
throw new IllegalArgumentException("Frequency too low: "
+ freqHz);
}
}
PwmImpl pwm = new PwmImpl(this, spec.pin, pwmNum, period, baseUs);
addDisconnectListener(pwm);
openPins_[spec.pin] = true;
try {
protocol_.setPinDigitalOut(spec.pin, false, spec.mode);
protocol_.setPinPwm(spec.pin, pwmNum, true);
protocol_.setPwmPeriod(pwmNum, period - 1,
IOIOProtocol.PwmScale.values()[scale]);
} catch (IOException e) {
pwm.close();
throw new ConnectionLostException(e);
}
return pwm;
}
开发者ID:smartebikes,项目名称:SmartEbikesMonitorSystem,代码行数:39,代码来源:IOIOImpl.java
示例17: setPinDigitalOut
import ioio.lib.api.DigitalOutput; //导入依赖的package包/类
synchronized public void setPinDigitalOut(int pin, boolean value, DigitalOutput.Spec.Mode mode)
throws IOException {
beginBatch();
writeByte(SET_PIN_DIGITAL_OUT);
writeByte((pin << 2) | (mode == DigitalOutput.Spec.Mode.OPEN_DRAIN ? 0x01 : 0x00)
| (value ? 0x02 : 0x00));
endBatch();
}
开发者ID:edarn,项目名称:kryp-client,代码行数:9,代码来源:IOIOProtocol.java
注:本文中的ioio.lib.api.DigitalOutput类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论