本文整理汇总了Java中ioio.lib.api.TwiMaster.Rate类的典型用法代码示例。如果您正苦于以下问题:Java Rate类的具体用法?Java Rate怎么用?Java Rate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Rate类属于ioio.lib.api.TwiMaster包,在下文中一共展示了Rate类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: openTwiMaster
点赞 3
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
@Override
synchronized public TwiMaster openTwiMaster(int twiNum, Rate rate,
boolean smbus) throws ConnectionLostException {
checkState();
checkTwiFree(twiNum);
final int[][] twiPins = hardware_.twiPins();
checkPinFree(twiPins[twiNum][0]);
checkPinFree(twiPins[twiNum][1]);
openPins_[twiPins[twiNum][0]] = true;
openPins_[twiPins[twiNum][1]] = true;
openTwi_[twiNum] = true;
TwiMasterImpl twi = new TwiMasterImpl(this, twiNum);
addDisconnectListener(twi);
incomingState_.addTwiListener(twiNum, twi);
try {
protocol_.i2cConfigureMaster(twiNum, rate, smbus);
} catch (IOException e) {
twi.close();
throw new ConnectionLostException(e);
}
return twi;
}
开发者ID:jrieke,
项目名称:ioiometer,
代码行数:23,
代码来源:IOIOImpl.java
示例2: openTwiMaster
点赞 3
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
@Override
synchronized public TwiMaster openTwiMaster(int twiNum, Rate rate,
boolean smbus) throws ConnectionLostException {
checkState();
final int[][] twiPins = hardware_.twiPins();
Resource twi = new Resource(ResourceType.TWI, twiNum);
Resource[] pins = new Resource[]{
new Resource(ResourceType.PIN, twiPins[twiNum][0]),
new Resource(ResourceType.PIN, twiPins[twiNum][1])};
resourceManager_.alloc(twi, pins);
TwiMasterImpl result = new TwiMasterImpl(this, twi, pins);
addDisconnectListener(result);
incomingState_.addTwiListener(twiNum, result);
try {
protocol_.i2cConfigureMaster(twiNum, rate, smbus);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:flyver,
项目名称:Flyver-Apps,
代码行数:26,
代码来源:IOIOImpl.java
示例3: openTwiMaster
点赞 3
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
@Override
synchronized public TwiMaster openTwiMaster(int twiNum, Rate rate,
boolean smbus) throws ConnectionLostException {
checkState();
checkTwiFree(twiNum);
checkPinFree(Constants.TWI_PINS[twiNum][0]);
checkPinFree(Constants.TWI_PINS[twiNum][1]);
openPins_[Constants.TWI_PINS[twiNum][0]] = true;
openPins_[Constants.TWI_PINS[twiNum][1]] = true;
openTwi_[twiNum] = true;
TwiMasterImpl twi = new TwiMasterImpl(this, twiNum);
addDisconnectListener(twi);
incomingState_.addTwiListener(twiNum, twi);
try {
protocol_.i2cConfigureMaster(twiNum, rate, smbus);
} catch (IOException e) {
twi.close();
throw new ConnectionLostException(e);
}
return twi;
}
开发者ID:smartebikes,
项目名称:SmartEbikesMonitorSystem,
代码行数:22,
代码来源:IOIOImpl.java
示例4: openTwiMaster
点赞 3
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
@Override
synchronized public TwiMaster openTwiMaster(int twiNum, Rate rate,
boolean smbus) throws ConnectionLostException {
checkState();
final int[][] twiPins = hardware_.twiPins();
Resource twi = new Resource(ResourceType.TWI, twiNum);
Resource[] pins = new Resource[] {
new Resource(ResourceType.PIN, twiPins[twiNum][0]),
new Resource(ResourceType.PIN, twiPins[twiNum][1]) };
resourceManager_.alloc(twi, pins);
TwiMasterImpl result = new TwiMasterImpl(this, twi, pins);
addDisconnectListener(result);
incomingState_.addTwiListener(twiNum, result);
try {
protocol_.i2cConfigureMaster(twiNum, rate, smbus);
} catch (IOException e) {
result.close();
throw new ConnectionLostException(e);
}
return result;
}
开发者ID:edarn,
项目名称:kryp-client,
代码行数:26,
代码来源:IOIOImpl.java
示例5: i2cConfigureMaster
点赞 2
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
synchronized public void i2cConfigureMaster(int i2cNum, Rate rate,
boolean smbusLevels) throws IOException {
int rateBits = (rate == Rate.RATE_1MHz ? 3
: (rate == Rate.RATE_400KHz ? 2 : 1));
beginBatch();
writeByte(I2C_CONFIGURE_MASTER);
writeByte((smbusLevels ? 0x80 : 0) | (rateBits << 5) | i2cNum);
endBatch();
}
开发者ID:jrieke,
项目名称:ioiometer,
代码行数:10,
代码来源:IOIOProtocol.java
示例6: openSpiMaster
点赞 2
import ioio.lib.api.TwiMaster.Rate; //导入依赖的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
示例7: i2cConfigureMaster
点赞 2
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
synchronized public void i2cConfigureMaster(int i2cNum, Rate rate, boolean smbusLevels)
throws IOException {
int rateBits = (rate == Rate.RATE_1MHz ? 3 : (rate == Rate.RATE_400KHz ? 2 : 1));
beginBatch();
writeByte(I2C_CONFIGURE_MASTER);
writeByte((smbusLevels ? 0x80 : 0) | (rateBits << 5) | i2cNum);
endBatch();
}
开发者ID:flyver,
项目名称:Flyver-Apps,
代码行数:9,
代码来源:IOIOProtocol.java
示例8: openSpiMaster
点赞 2
import ioio.lib.api.TwiMaster.Rate; //导入依赖的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
示例9: i2cConfigureMaster
点赞 2
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
synchronized public void i2cConfigureMaster(int i2cNum, Rate rate, boolean smbusLevels)
throws IOException {
int rateBits = (rate == Rate.RATE_1MHz ? 3 : (rate == Rate.RATE_400KHz ? 2 : 1));
beginBatch();
writeByte(I2C_CONFIGURE_MASTER);
writeByte((smbusLevels ? 0x80 : 0) | (rateBits << 5) | i2cNum);
endBatch();
}
开发者ID:edarn,
项目名称:kryp-client,
代码行数:9,
代码来源:IOIOProtocol.java
示例10: openSpiMaster
点赞 1
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
/**
* Shorthand for
* {@link #openSpiMaster(ioio.lib.api.DigitalInput.Spec, ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec[], ioio.lib.api.SpiMaster.Config)}
* , where the pins are all open with the default modes and default
* configuration values are used.
*
* @see #openSpiMaster(ioio.lib.api.DigitalInput.Spec,
* ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec,
* ioio.lib.api.DigitalOutput.Spec[], ioio.lib.api.SpiMaster.Config)
*/
public SpiMaster openSpiMaster(int miso, int mosi, int clk,
int[] slaveSelect, SpiMaster.Rate rate)
throws ConnectionLostException;
开发者ID:jrieke,
项目名称:ioiometer,
代码行数:14,
代码来源:IOIO.java
示例11: openTwiMaster
点赞 1
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
/**
* Open a TWI (Two-Wire Interface, such as I2C/SMBus) master module,
* enabling communication with multiple TWI-enabled slave modules.
* <p>
* TWI is a common hardware communication protocol, enabling half-duplex,
* synchronous point-to-multi-point data transfer. It requires a physical
* connection of two lines (SDA, SCL) shared by all the bus nodes, where the
* SDA is open-drain and externally pulled-up.
* <p>
* Note that there is a fixed number of TWI modules, and the pins they use
* are static. Client has to make sure these pins are not already opened
* before calling this method. See board documentation for the number of
* modules and the respective pins they use.
* <p>
* The TWI module will operate, and the pins will work in their respective
* modes until close() is invoked on the returned interface. It is illegal
* to use pins that have already been opened and has not been closed. A
* connection must have been established prior to calling this method, by
* invoking {@link #waitForConnect()}.
*
* @param twiNum
* The TWI module index to use. Will also determine the pins
* used.
* @param rate
* The clock rate. Can be 100KHz / 400KHz / 1MHz.
* @param smbus
* When true, will use SMBus voltage levels. When false, I2C
* voltage levels.
* @return Interface of the assigned module.
* @throws ConnectionLostException
* Connection was lost before or during the execution of this
* method.
* @see TwiMaster
*/
public TwiMaster openTwiMaster(int twiNum, Rate rate, boolean smbus)
throws ConnectionLostException;
开发者ID:jrieke,
项目名称:ioiometer,
代码行数:37,
代码来源:IOIO.java
示例12: openSpiMaster
点赞 1
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
/**
* Shorthand for
* {@link #openSpiMaster(ioio.lib.api.DigitalInput.Spec, ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec[], ioio.lib.api.SpiMaster.Config)}
* , where the pins are all open with the default modes and default configuration values are
* used.
*
* @see #openSpiMaster(ioio.lib.api.DigitalInput.Spec, ioio.lib.api.DigitalOutput.Spec,
* ioio.lib.api.DigitalOutput.Spec, ioio.lib.api.DigitalOutput.Spec[],
* ioio.lib.api.SpiMaster.Config)
*/
public SpiMaster openSpiMaster(int miso, int mosi, int clk, int[] slaveSelect,
SpiMaster.Rate rate) throws ConnectionLostException;
开发者ID:flyver,
项目名称:Flyver-Apps,
代码行数:13,
代码来源:IOIO.java
示例13: openTwiMaster
点赞 1
import ioio.lib.api.TwiMaster.Rate; //导入依赖的package包/类
/**
* Open a TWI (Two-Wire Interface, such as I2C/SMBus) master module, enabling communication with
* multiple TWI-enabled slave modules.
* <p/>
* TWI is a common hardware communication protocol, enabling half-duplex, synchronous
* point-to-multi-point data transfer. It requires a physical connection of two lines (SDA, SCL)
* shared by all the bus nodes, where the SDA is open-drain and externally pulled-up.
* <p/>
* Note that there is a fixed number of TWI modules, and the pins they use are static. Client
* has to make sure these pins are not already opened before calling this method. See board
* documentation for the number of modules and the respective pins they use.
* <p/>
* The TWI module will operate, and the pins will work in their respective modes until close()
* is invoked on the returned interface. It is illegal to use pins that have already been opened
* and has not been closed. A connection must have been established prior to calling this
* method, by invoking {@link #waitForConnect()}.
*
* @param twiNum The TWI module index to use. Will also determine the pins used.
* @param rate The clock rate. Can be 100KHz / 400KHz / 1MHz.
* @param smbus When true, will use SMBus voltage levels. When false, I2C voltage levels.
* @return Interface of the assigned module.
* @throws ConnectionLostException Connection was lost before or during the execution of this method.
* @see TwiMaster
*/
public TwiMaster openTwiMaster(int twiNum, Rate rate, boolean smbus)
throws ConnectionLostException;
开发者ID:flyver,
项目名称:Flyver-Apps,
代码行数:27,
代码来源:IOIO.java