mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
Update to 2018_v4 image and new build system. (#598)
* Revert "Force OpenCV to 3.1.0 (#602)"
This reverts commit 50ed55e8e2.
* Removes Simulation
* Removes old build system
* Removes old gtest
* Adds new gmock and gtest
* Updates to new ni-libraries
* removes MyRobot (to be replaced)
* moves files to new location
* Adds new sim backend and new test executables
* updates .styleguide and .gitignore
* Changes cpp WPILibVersion to a function
MSVC throws an AV with the old version.
* Disables USBCamera on all systems except for linux
* 2018 NI Libraries
* New build system
This commit is contained in:
committed by
Peter Johnson
parent
50ed55e8e2
commit
e1195e8b9d
80
wpilibc/src/main/native/include/SerialPort.h
Normal file
80
wpilibc/src/main/native/include/SerialPort.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ErrorBase.h"
|
||||
#include "llvm/StringRef.h"
|
||||
|
||||
namespace frc {
|
||||
|
||||
/**
|
||||
* Driver for the RS-232 serial port on the roboRIO.
|
||||
*
|
||||
* The current implementation uses the VISA formatted I/O mode. This means that
|
||||
* all traffic goes through the fomatted buffers. This allows the intermingled
|
||||
* use of Printf(), Scanf(), and the raw buffer accessors Read() and Write().
|
||||
*
|
||||
* More information can be found in the NI-VISA User Manual here:
|
||||
* http://www.ni.com/pdf/manuals/370423a.pdf
|
||||
* and the NI-VISA Programmer's Reference Manual here:
|
||||
* http://www.ni.com/pdf/manuals/370132c.pdf
|
||||
*/
|
||||
class SerialPort : public ErrorBase {
|
||||
public:
|
||||
enum Parity {
|
||||
kParity_None = 0,
|
||||
kParity_Odd = 1,
|
||||
kParity_Even = 2,
|
||||
kParity_Mark = 3,
|
||||
kParity_Space = 4
|
||||
};
|
||||
enum StopBits {
|
||||
kStopBits_One = 10,
|
||||
kStopBits_OnePointFive = 15,
|
||||
kStopBits_Two = 20
|
||||
};
|
||||
enum FlowControl {
|
||||
kFlowControl_None = 0,
|
||||
kFlowControl_XonXoff = 1,
|
||||
kFlowControl_RtsCts = 2,
|
||||
kFlowControl_DtrDsr = 4
|
||||
};
|
||||
enum WriteBufferMode { kFlushOnAccess = 1, kFlushWhenFull = 2 };
|
||||
enum Port { kOnboard = 0, kMXP = 1, kUSB = 2, kUSB1 = 2, kUSB2 = 3 };
|
||||
|
||||
SerialPort(int baudRate, Port port = kOnboard, int dataBits = 8,
|
||||
Parity parity = kParity_None, StopBits stopBits = kStopBits_One);
|
||||
~SerialPort();
|
||||
|
||||
SerialPort(const SerialPort&) = delete;
|
||||
SerialPort& operator=(const SerialPort&) = delete;
|
||||
|
||||
void SetFlowControl(FlowControl flowControl);
|
||||
void EnableTermination(char terminator = '\n');
|
||||
void DisableTermination();
|
||||
int GetBytesReceived();
|
||||
int Read(char* buffer, int count);
|
||||
int Write(const char* buffer, int count);
|
||||
int Write(llvm::StringRef buffer);
|
||||
void SetTimeout(double timeout);
|
||||
void SetReadBufferSize(int size);
|
||||
void SetWriteBufferSize(int size);
|
||||
void SetWriteBufferMode(WriteBufferMode mode);
|
||||
void Flush();
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
int m_resourceManagerHandle = 0;
|
||||
int m_portHandle = 0;
|
||||
bool m_consoleModeEnabled = false;
|
||||
int m_port;
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user