本文整理汇总了Java中edu.wpi.first.wpilibj.SerialPort.Port方法的典型用法代码示例。如果您正苦于以下问题:Java SerialPort.Port方法的具体用法?Java SerialPort.Port怎么用?Java SerialPort.Port使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.wpi.first.wpilibj.SerialPort
的用法示例。
在下文中一共展示了SerialPort.Port方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SerialIO
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
public SerialIO( SerialPort.Port port_id, byte update_rate_hz, boolean processed_data, IIOCompleteNotification notify_sink, IBoardCapabilities board_capabilities ) {
this.serial_port_id = port_id;
ypr_update_data = new IMUProtocol.YPRUpdate();
gyro_update_data = new IMUProtocol.GyroUpdate();
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
board_id = new AHRSProtocol.BoardID();
board_state = new IIOCompleteNotification.BoardState();
this.notify_sink = notify_sink;
this.board_capabilities = board_capabilities;
serial_port = getMaybeCreateSerialPort();
this.update_rate_hz = update_rate_hz;
if ( processed_data ) {
update_type = AHRSProtocol.MSGID_AHRSPOS_UPDATE;
} else {
update_type = IMUProtocol.MSGID_GYRO_UPDATE;
}
}
示例2: SerialIO
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
public SerialIO( SerialPort.Port port_id, byte update_rate_hz, boolean processed_data, IIOCompleteNotification notify_sink, IBoardCapabilities board_capabilities ) {
this.serial_port_id = port_id;
is_usb = ((port_id == SerialPort.Port.kUSB) ||
(port_id == SerialPort.Port.kUSB1)||
(port_id == SerialPort.Port.kUSB2));
ypr_update_data = new IMUProtocol.YPRUpdate();
gyro_update_data = new IMUProtocol.GyroUpdate();
ahrs_update_data = new AHRSProtocol.AHRSUpdate();
ahrspos_update_data = new AHRSProtocol.AHRSPosUpdate();
ahrspos_ts_update_data = new AHRSProtocol.AHRSPosTSUpdate();
board_id = new AHRSProtocol.BoardID();
board_state = new IIOCompleteNotification.BoardState();
this.notify_sink = notify_sink;
this.board_capabilities = board_capabilities;
serial_port = getMaybeCreateSerialPort();
this.update_rate_hz = update_rate_hz;
if ( processed_data ) {
update_type = AHRSProtocol.MSGID_AHRSPOS_TS_UPDATE;
} else {
update_type = IMUProtocol.MSGID_GYRO_UPDATE;
}
}
示例3: PixyVision
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
public PixyVision(
final String instanceName, Robot robot, int signature, int brightness, Orientation orientation,
SerialPort.Port port)
{
pixyCamera = new FrcPixyCam(instanceName, port,
RobotInfo.PIXY_BAUD_RATE, RobotInfo.PIXY_DATA_BITS, RobotInfo.PIXY_PARITY, RobotInfo.PIXY_STOP_BITS);
commonInit(robot, signature, brightness, orientation);
}
示例4: FrcPixyCam
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Constructor: Create an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port on the RoboRIO.
* @param baudRate specifies the baud rate.
* @param dataBits specifies the number of data bits.
* @param parity specifies the parity type.
* @param stopBits specifies the number of stop bits.
*/
public FrcPixyCam(
final String instanceName, SerialPort.Port port, int baudRate, int dataBits, SerialPort.Parity parity,
SerialPort.StopBits stopBits)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
pixyCam = new FrcSerialPortDevice(instanceName, port, baudRate, dataBits, parity, stopBits);
start();
}
示例5: FrcEmic2TextToSpeech
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Constructor: Create an instance of the object.
*
* @param instanceName specifies the instance name.
* @param port specifies the serial port on the RoboRIO.
* @param baudRate specifies the baud rate.
* @param dataBits specifies the number of data bits.
* @param parity specifies the parity type.
* @param stopBits specifies the number of stop bits.
*/
public FrcEmic2TextToSpeech(
final String instanceName, SerialPort.Port port, int baudRate, int dataBits, SerialPort.Parity parity,
SerialPort.StopBits stopBits)
{
super(instanceName);
if (debugEnabled)
{
dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
}
tts = new FrcSerialPortDevice(instanceName, port, baudRate, dataBits, parity, stopBits);
}
示例6: AHRS
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Constructs the AHRS class using serial communication, overriding the
* default update rate with a custom rate which may be from 4 to 60,
* representing the number of updates per second sent by the sensor.
* <p>
* This constructor should be used if communicating via either TTL UART or
* USB Serial interface.
* <p>
* Note that the serial interfaces can communicate either processed data, or
* raw data, but not both simultaneously. If simultaneous processed and raw
* data are needed, use one of the register-based interfaces (SPI or I2C).
* <p>
* Note that increasing the update rate may increase the CPU utilization.
* <p>
*
* @param serial_port_id
* SerialPort to use
* @param data_type
* either kProcessedData or kRawData
* @param update_rate_hz
* Custom Update Rate (Hz)
*/
public AHRS(SerialPort.Port serial_port_id, SerialDataType data_type, byte update_rate_hz) {
commonInit(update_rate_hz);
boolean processed_data = (data_type == SerialDataType.kProcessedData);
io = new SerialIO(serial_port_id, update_rate_hz, processed_data, io_complete_sink, board_capabilities);
io_thread.start();
}
示例7: AHRS
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Constructs the AHRS class using serial communication, overriding the
* default update rate with a custom rate which may be from 4 to 60,
* representing the number of updates per second sent by the sensor.
*<p>
* This constructor should be used if communicating via either
* TTL UART or USB Serial interface.
*<p>
* Note that the serial interfaces can communicate either
* processed data, or raw data, but not both simultaneously.
* If simultaneous processed and raw data are needed, use
* one of the register-based interfaces (SPI or I2C).
*<p>
* Note that increasing the update rate may increase the
* CPU utilization.
*<p>
* @param serial_port_id SerialPort to use
* @param data_type either kProcessedData or kRawData
* @param update_rate_hz Custom Update Rate (Hz)
*/
public AHRS(SerialPort.Port serial_port_id, SerialDataType data_type, byte update_rate_hz) {
commonInit(update_rate_hz);
boolean processed_data = (data_type == SerialDataType.kProcessedData);
io = new SerialIO(serial_port_id, update_rate_hz, processed_data, io_complete_sink, board_capabilities);
io_thread.start();
}
示例8: AHRS
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Constructs the AHRS class using serial communication, overriding the
* default update rate with a custom rate which may be from 4 to 200,
* representing the number of updates per second sent by the sensor.
*<p>
* This constructor should be used if communicating via either
* TTL UART or USB Serial interface.
*<p>
* Note that the serial interfaces can communicate either
* processed data, or raw data, but not both simultaneously.
* If simultaneous processed and raw data are needed, use
* one of the register-based interfaces (SPI or I2C).
*<p>
* Note that increasing the update rate may increase the
* CPU utilization.
*<p>
* @param serial_port_id SerialPort to use
* @param data_type either kProcessedData or kRawData
* @param update_rate_hz Custom Update Rate (Hz)
*/
public AHRS(SerialPort.Port serial_port_id, SerialDataType data_type, byte update_rate_hz) {
commonInit(update_rate_hz);
boolean processed_data = (data_type == SerialDataType.kProcessedData);
io = new SerialIO(serial_port_id, update_rate_hz, processed_data, io_complete_sink, board_capabilities);
io_thread.start();
}
示例9: TurtleFakeNavX
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Create NavX with specified Serial/USB port
* @param serialPort
*/
public TurtleFakeNavX(SerialPort.Port serialPort) {
this();
}
示例10: LIDARSerial
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Instantiates LIDARLite with given port and update speed
*
* @param port
*/
public LIDARSerial(SerialPort.Port port) {
sensor = new SerialPort(9600, port);
}
示例11: TurtleNavX
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Create NavX with specified Serial/USB port
*
* @param serialPort
*/
public TurtleNavX(SerialPort.Port serialPort) {
navX = new AHRS(serialPort);
registerCallback(dataSubscriber, this);
}
示例12: LIDARLite
import edu.wpi.first.wpilibj.SerialPort; //导入方法依赖的package包/类
/**
* Instantiates LIDARLite with given port and update speed
*
* @param port
*/
public LIDARLite(SerialPort.Port port) {
sensor = new SerialPort(9600, port);
}