diff --git a/.gitignore b/.gitignore index a2d6622..8943d2e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ DriveBase/.settings DriveBase/sysProps.xml .metadata +.settings/* diff --git a/DriveBase/src/Robot.cpp b/DriveBase/src/Robot.cpp index 1baa401..8b4fca8 100644 --- a/DriveBase/src/Robot.cpp +++ b/DriveBase/src/Robot.cpp @@ -15,7 +15,7 @@ #define TRIGGER 1 #define THUMB 2 -#endif +#endif // BUTTON_LAYOUT class Robot: public IterativeRobot { CANTalon r1_drive; diff --git a/Robot2016/.cproject b/Robot2016/.cproject new file mode 100644 index 0000000..09f9db3 --- /dev/null +++ b/Robot2016/.cproject @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Robot2016/.gitignore b/Robot2016/.gitignore new file mode 100644 index 0000000..3df573f --- /dev/null +++ b/Robot2016/.gitignore @@ -0,0 +1 @@ +/Debug/ diff --git a/Robot2016/.project b/Robot2016/.project new file mode 100644 index 0000000..69c1953 --- /dev/null +++ b/Robot2016/.project @@ -0,0 +1,28 @@ + + + Robot2016 + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature + + diff --git a/Robot2016/.settings/org.eclipse.cdt.managedbuilder.core.prefs b/Robot2016/.settings/org.eclipse.cdt.managedbuilder.core.prefs new file mode 100644 index 0000000..a3c3365 --- /dev/null +++ b/Robot2016/.settings/org.eclipse.cdt.managedbuilder.core.prefs @@ -0,0 +1,13 @@ +eclipse.preferences.version=1 +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPLUS_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/CPLUS_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/C_INCLUDE_PATH/delimiter=; +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/C_INCLUDE_PATH/operation=remove +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/append=true +environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/appendContributed=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/LIBRARY_PATH/delimiter=; +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/LIBRARY_PATH/operation=remove +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/append=true +environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.cross.exe.debug.1104744751/appendContributed=true diff --git a/Robot2016/build.properties b/Robot2016/build.properties new file mode 100644 index 0000000..f51b8ca --- /dev/null +++ b/Robot2016/build.properties @@ -0,0 +1,11 @@ +# Build information +out=FRCUserProgram +src.dir=src +build.dir=build +out.exe=Debug/${out} + +# Simulation +simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world + +# Use the current C++ library by default +cpp-version=current diff --git a/Robot2016/build.xml b/Robot2016/build.xml new file mode 100644 index 0000000..82e7940 --- /dev/null +++ b/Robot2016/build.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Robot2016/src/Robot.cpp b/Robot2016/src/Robot.cpp new file mode 100644 index 0000000..5e3a67c --- /dev/null +++ b/Robot2016/src/Robot.cpp @@ -0,0 +1,137 @@ +#include "WPILib.h" +#include "Shooter.h" + +#ifndef BUTTON_LAYOUT +#define BUTTON_LAYOUT + +#define TRIGGER 1 // Trigger button number +#define THUMB 2 // Thumb button number +#define RAMP_RAISE 3 // Button 3 for Raising Ramp +#define RAMP_LOWER 4 // Button 4 to lower ramp. + +#endif // BUTTON_LAYOUT + +class Robot: public IterativeRobot +{ + Talon left_drive, right_drive; + CANTalon shooter1, shooter2, + ramp; + RobotDrive drive; + Shooter shooter; + Joystick driver_stick, operator_stick; +public: + Robot(): + left_drive(1), // Left DriveTrain Talons plug into PWM channel 1 with a Y-spliter + right_drive(2), // Right DriveTrain Talons plug // left wheel 2 + shooter1(10), // shooter drive 1 + shooter2(11), // shooter drive 2 + ramp(12), + drive(&left_drive, &right_drive), + shooter( // initialize Shooter object. + &shooter1, &shooter2, &ramp), + driver_stick(0), // right stick (operator) + operator_stick(1) // left stick (driver) + { + + } + +private: + // instance variables + bool pickupRunning; // don't want to spam the Talon with set messages. Toggle the pickup when a button is pressed or released. + + LiveWindow *lw = LiveWindow::GetInstance(); + SendableChooser *chooser; + const std::string autoNameDefault = "Default"; + const std::string autoNameCustom = "My Auto"; + std::string autoSelected; + + void RobotInit() + { + chooser = new SendableChooser(); + chooser->AddDefault(autoNameDefault, (void*)&autoNameDefault); + chooser->AddObject(autoNameCustom, (void*)&autoNameCustom); + SmartDashboard::PutData("Auto Modes", chooser); + } + + + /** + * This autonomous (along with the chooser code above) shows how to select between different autonomous modes + * using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW + * Dashboard, remove all of the chooser code and uncomment the GetString line to get the auto name from the text box + * below the Gyro + * + * You can add additional auto modes by adding additional comparisons to the if-else structure below with additional strings. + * If using the SendableChooser make sure to add them to the chooser code above as well. + */ + void AutonomousInit() + { + shooter.CalibrateRamp(); + shooter.SetRamp(Shoot); + + autoSelected = *((std::string*)chooser->GetSelected()); + //std::string autoSelected = SmartDashboard::GetString("Auto Selector", autoNameDefault); + std::cout << "Auto selected: " << autoSelected << std::endl; + + if(autoSelected == autoNameCustom){ + //Custom Auto goes here + } else { + //Default Auto goes here + } + } + + void AutonomousPeriodic() + { + if(autoSelected == autoNameCustom){ + //Custom Auto goes here + } else { + //Default Auto goes here + } + } + + void TeleopInit() + { + shooter.CalibrateRamp(); + shooter.SetRamp(Shoot); // start in the full up position! + } + + void TeleopPeriodic() + { + drive.ArcadeDrive(&driver_stick); + + // This is shit code for testing. Replace it with real code. + if(operator_stick.GetRawButton(RAMP_RAISE)) + { + ramp.Set(1); + } + else if(operator_stick.GetRawButton(RAMP_LOWER)) + { + ramp.Set(-1); + } + else + { + ramp.Set(0); + } + + if(operator_stick.GetRawButton(THUMB) && !pickupRunning) + { + shooter.PickUp(); + pickupRunning = true; + } + else if(pickupRunning) + { + shooter.PickUp(false); + pickupRunning = false; + } + + + float power = (1.0 - operator_stick.GetThrottle()) / 2.0; + shooter.SetPower(power); + } + + void TestPeriodic() + { + lw->Run(); + } +}; + +START_ROBOT_CLASS(Robot) diff --git a/Robot2016/src/Shooter.h b/Robot2016/src/Shooter.h new file mode 100644 index 0000000..1fe8b0e --- /dev/null +++ b/Robot2016/src/Shooter.h @@ -0,0 +1,93 @@ +/* + * Shooter.h + * + * Created on: Feb 2, 2016 + * Author: Jason + */ + +#ifndef SRC_SHOOTER_H_ +#define SRC_SHOOTER_H_ + +#define PICKUP_POWER 0.5 +#define RAMP_LOWER_DURATION 2 //Rotations. + + +/** + * You can use the values assigned to each of these values as the number + * of rotations to run the motor down from the "Shoot" position. + * + * This might not be the best way to do it, and also requires that we + * figure out how to read the Hall Effect signal from the motor. + */ +enum RampState { + Shoot = 0, // 0 rotations + Half = (RAMP_LOWER_DURATION / 2), // 1 rotation? + Down = RAMP_LOWER_DURATION, // 2 rotations? + Uncalibrated = -1, + Transitioning = -2 +}; + +class Shooter { +public: + /** + * Shooter talons and ramp talon. + * s2 is also for the pickup-mechanism and can be controlled independently. + * + */ + Shooter(CANTalon *s1, CANTalon *s2, CANTalon *r) { + shooterDrive = new RobotDrive(s1, s2); + pickup = s2; + ramp = r; + rampState = Uncalibrated; + } + + /** + * Call this method on TeleopInit so that the ramp is properly + * set at the beginning of the match. + */ + RampState CalibrateRamp() { + // TODO: + // Raise ramp until limit switch is triggered, + // then lower the ramp to its lower limit. + + return Down; + } + + virtual ~Shooter() { + delete shooterDrive; + delete pickup; + delete ramp; + } + + void PickUp(bool state = true) { + pickup->Set((float) (state * PICKUP_POWER)); + } + + void SetRamp(RampState state) { + // TODO: + // Move the Ramp to the set position. + } + + /** + * Call this to run the pickup backwards if the ball gets jammed somehow... + */ + void Unjam() + { + pickup->Set(-1 * PICKUP_POWER); + } + + void SetPower(float power) { + shooterDrive->TankDrive(power, -power, false); + } +private: + + RobotDrive *shooterDrive; + CANTalon *pickup; + CANTalon *ramp; + + RampState rampState; + RampState targetState; + RampState previousState; +}; + +#endif /* SRC_SHOOTER_H_ */ diff --git a/Robot2016/wpilib/cpp/current/ant/ant-classloadertask.jar b/Robot2016/wpilib/cpp/current/ant/ant-classloadertask.jar new file mode 100644 index 0000000..d2f58d9 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/ant/ant-classloadertask.jar differ diff --git a/Robot2016/wpilib/cpp/current/ant/ant-contrib.jar b/Robot2016/wpilib/cpp/current/ant/ant-contrib.jar new file mode 100644 index 0000000..ea817cd Binary files /dev/null and b/Robot2016/wpilib/cpp/current/ant/ant-contrib.jar differ diff --git a/Robot2016/wpilib/cpp/current/ant/build.properties b/Robot2016/wpilib/cpp/current/ant/build.properties new file mode 100644 index 0000000..2c2123f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/ant/build.properties @@ -0,0 +1,22 @@ +# Deployment information +username=lvuser +password= +deploy.dir=/home/lvuser +deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r +command.dir=/home/lvuser/ + +# Libraries to use +wpilib=${user.home}/wpilib/cpp/${cpp-version} +wpilib.lib=${wpilib}/lib +roboRIOAllowedImages=19 + +# Ant support +wpilib.ant.dir=${wpilib}/ant +jsch.jar=${wpilib.ant.dir}/jsch-0.1.50.jar +classloadertask.jar=${wpilib.ant.dir}/ant-classloadertask.jar + +#simulation stuff +sim.exe=linux_simulate/${out} +wpilib.sim=${wpilib}/sim +sim.tools=${wpilib.sim}/tools +sim.lib=${wpilib.sim}/lib diff --git a/Robot2016/wpilib/cpp/current/ant/build.xml b/Robot2016/wpilib/cpp/current/ant/build.xml new file mode 100644 index 0000000..5ea15c0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/ant/build.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + Trying Target: ${target} + + + + roboRIO found via mDNS + + + + roboRIO not found via mDNS, falling back to static USB + + + + + roboRIO found via static USB + + + + + + + roboRIO not found via USB, falling back to static address of ${target} + + + + + + roboRIO found via Ethernet static + + + + + + + + + + [athena-deploy] Copying code over. + + + + + + + + [athena-deploy] Starting program. + + + + + + + + + + + + + + + [simulate] You may now run Gazebo and your driver station + [simulate] Running Code. + + + + + + + + + + + + + + + + + + + + roboRIO image version validated + + diff --git a/Robot2016/wpilib/cpp/current/ant/jsch-0.1.50.jar b/Robot2016/wpilib/cpp/current/ant/jsch-0.1.50.jar new file mode 100644 index 0000000..85c044f Binary files /dev/null and b/Robot2016/wpilib/cpp/current/ant/jsch-0.1.50.jar differ diff --git a/Robot2016/wpilib/cpp/current/ant/robotCommand b/Robot2016/wpilib/cpp/current/ant/robotCommand new file mode 100644 index 0000000..06757bd --- /dev/null +++ b/Robot2016/wpilib/cpp/current/ant/robotCommand @@ -0,0 +1 @@ +/usr/local/frc/bin/netconsole-host /home/lvuser/FRCUserProgram diff --git a/Robot2016/wpilib/cpp/current/include/ADXL345_I2C.h b/Robot2016/wpilib/cpp/current/include/ADXL345_I2C.h new file mode 100644 index 0000000..e0327f7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ADXL345_I2C.h @@ -0,0 +1,79 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "interfaces/Accelerometer.h" +#include "I2C.h" +#include "LiveWindow/LiveWindowSendable.h" +#include + +/** + * ADXL345 Accelerometer on I2C. + * + * This class allows access to a Analog Devices ADXL345 3-axis accelerometer on + * an I2C bus. + * This class assumes the default (not alternate) sensor address of 0x1D (7-bit + * address). + */ +class ADXL345_I2C : public Accelerometer, + public I2C, + public LiveWindowSendable { + protected: + static const uint8_t kAddress = 0x1D; + static const uint8_t kPowerCtlRegister = 0x2D; + static const uint8_t kDataFormatRegister = 0x31; + static const uint8_t kDataRegister = 0x32; + static constexpr double kGsPerLSB = 0.00390625; + enum PowerCtlFields { + kPowerCtl_Link = 0x20, + kPowerCtl_AutoSleep = 0x10, + kPowerCtl_Measure = 0x08, + kPowerCtl_Sleep = 0x04 + }; + enum DataFormatFields { + kDataFormat_SelfTest = 0x80, + kDataFormat_SPI = 0x40, + kDataFormat_IntInvert = 0x20, + kDataFormat_FullRes = 0x08, + kDataFormat_Justify = 0x04 + }; + + public: + enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + struct AllAxes { + double XAxis; + double YAxis; + double ZAxis; + }; + + public: + explicit ADXL345_I2C(Port port, Range range = kRange_2G, int deviceAddress = kAddress); + virtual ~ADXL345_I2C() = default; + + ADXL345_I2C(const ADXL345_I2C&) = delete; + ADXL345_I2C& operator=(const ADXL345_I2C&) = delete; + + // Accelerometer interface + virtual void SetRange(Range range) override; + virtual double GetX() override; + virtual double GetY() override; + virtual double GetZ() override; + + virtual double GetAcceleration(Axes axis); + virtual AllAxes GetAccelerations(); + + virtual std::string GetSmartDashboardType() const override; + virtual void InitTable(std::shared_ptr subtable) override; + virtual void UpdateTable() override; + virtual std::shared_ptr GetTable() const override; + virtual void StartLiveWindowMode() override {} + virtual void StopLiveWindowMode() override {} + + private: + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/ADXL345_SPI.h b/Robot2016/wpilib/cpp/current/include/ADXL345_SPI.h new file mode 100644 index 0000000..ceb28cd --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ADXL345_SPI.h @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "interfaces/Accelerometer.h" +#include "SensorBase.h" +#include "SPI.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +class DigitalInput; +class DigitalOutput; + +/** + * ADXL345 Accelerometer on SPI. + * + * This class allows access to an Analog Devices ADXL345 3-axis accelerometer + * via SPI. + * This class assumes the sensor is wired in 4-wire SPI mode. + */ +class ADXL345_SPI : public Accelerometer, + protected SPI, + public LiveWindowSendable { + protected: + static const uint8_t kPowerCtlRegister = 0x2D; + static const uint8_t kDataFormatRegister = 0x31; + static const uint8_t kDataRegister = 0x32; + static constexpr double kGsPerLSB = 0.00390625; + enum SPIAddressFields { kAddress_Read = 0x80, kAddress_MultiByte = 0x40 }; + enum PowerCtlFields { + kPowerCtl_Link = 0x20, + kPowerCtl_AutoSleep = 0x10, + kPowerCtl_Measure = 0x08, + kPowerCtl_Sleep = 0x04 + }; + enum DataFormatFields { + kDataFormat_SelfTest = 0x80, + kDataFormat_SPI = 0x40, + kDataFormat_IntInvert = 0x20, + kDataFormat_FullRes = 0x08, + kDataFormat_Justify = 0x04 + }; + + public: + enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + struct AllAxes { + double XAxis; + double YAxis; + double ZAxis; + }; + + public: + ADXL345_SPI(SPI::Port port, Range range = kRange_2G); + virtual ~ADXL345_SPI() = default; + + ADXL345_SPI(const ADXL345_SPI&) = delete; + ADXL345_SPI& operator=(const ADXL345_SPI&) = delete; + + // Accelerometer interface + virtual void SetRange(Range range) override; + virtual double GetX() override; + virtual double GetY() override; + virtual double GetZ() override; + + virtual double GetAcceleration(Axes axis); + virtual AllAxes GetAccelerations(); + + virtual std::string GetSmartDashboardType() const override; + virtual void InitTable(std::shared_ptr subtable) override; + virtual void UpdateTable() override; + virtual std::shared_ptr GetTable() const override; + virtual void StartLiveWindowMode() override {} + virtual void StopLiveWindowMode() override {} + + private: + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/ADXL362.h b/Robot2016/wpilib/cpp/current/include/ADXL362.h new file mode 100644 index 0000000..d4c2e0b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ADXL362.h @@ -0,0 +1,63 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "interfaces/Accelerometer.h" +#include "SensorBase.h" +#include "SPI.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +class DigitalInput; +class DigitalOutput; + +/** + * ADXL362 SPI Accelerometer. + * + * This class allows access to an Analog Devices ADXL362 3-axis accelerometer. + */ +class ADXL362 : public Accelerometer, public LiveWindowSendable { + public: + enum Axes { kAxis_X = 0x00, kAxis_Y = 0x02, kAxis_Z = 0x04 }; + struct AllAxes { + double XAxis; + double YAxis; + double ZAxis; + }; + + public: + ADXL362(Range range = kRange_2G); + ADXL362(SPI::Port port, Range range = kRange_2G); + virtual ~ADXL362() = default; + + ADXL362(const ADXL362&) = delete; + ADXL362& operator=(const ADXL362&) = delete; + + // Accelerometer interface + virtual void SetRange(Range range) override; + virtual double GetX() override; + virtual double GetY() override; + virtual double GetZ() override; + + virtual double GetAcceleration(Axes axis); + virtual AllAxes GetAccelerations(); + + virtual std::string GetSmartDashboardType() const override; + virtual void InitTable(std::shared_ptr subtable) override; + virtual void UpdateTable() override; + virtual std::shared_ptr GetTable() const override; + virtual void StartLiveWindowMode() override {} + virtual void StopLiveWindowMode() override {} + + private: + SPI m_spi; + double m_gsPerLSB = 0.001; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/ADXRS450_Gyro.h b/Robot2016/wpilib/cpp/current/include/ADXRS450_Gyro.h new file mode 100644 index 0000000..7717f57 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ADXRS450_Gyro.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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 "GyroBase.h" +#include "Notifier.h" +#include "SPI.h" +#include "HAL/cpp/priority_mutex.h" + +#include + +/** + * Use a rate gyro to return the robots heading relative to a starting position. + * The Gyro class tracks the robots heading based on the starting position. As + * the robot rotates the new heading is computed by integrating the rate of + * rotation returned by the sensor. When the class is instantiated, it does a + * short calibration routine where it samples the gyro while at rest to + * determine the default offset. This is subtracted from each sample to + * determine the heading. + * + * This class is for the digital ADXRS450 gyro sensor that connects via SPI. + */ +class ADXRS450_Gyro : public GyroBase { + public: + ADXRS450_Gyro(); + explicit ADXRS450_Gyro(SPI::Port port); + virtual ~ADXRS450_Gyro() = default; + + float GetAngle() const override; + double GetRate() const override; + void Reset() override; + void Calibrate() override; + + private: + SPI m_spi; + + uint16_t ReadRegister(uint8_t reg); +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogAccelerometer.h b/Robot2016/wpilib/cpp/current/include/AnalogAccelerometer.h new file mode 100644 index 0000000..86f7019 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogAccelerometer.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "AnalogInput.h" +#include "SensorBase.h" +#include "PIDSource.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * Handle operation of an analog accelerometer. + * The accelerometer reads acceleration directly through the sensor. Many + * sensors have + * multiple axis and can be treated as multiple devices. Each is calibrated by + * finding + * the center value over a period of time. + */ +class AnalogAccelerometer : public SensorBase, + public PIDSource, + public LiveWindowSendable { + public: + explicit AnalogAccelerometer(int32_t channel); + explicit AnalogAccelerometer(AnalogInput *channel); + explicit AnalogAccelerometer(std::shared_ptr channel); + virtual ~AnalogAccelerometer() = default; + + float GetAcceleration() const; + void SetSensitivity(float sensitivity); + void SetZero(float zero); + double PIDGet() override; + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + private: + void InitAccelerometer(); + + std::shared_ptr m_analogInput; + float m_voltsPerG = 1.0; + float m_zeroGVoltage = 2.5; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogGyro.h b/Robot2016/wpilib/cpp/current/include/AnalogGyro.h new file mode 100644 index 0000000..acb5b0f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogGyro.h @@ -0,0 +1,64 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "GyroBase.h" + +class AnalogInput; + +/** + * Use a rate gyro to return the robots heading relative to a starting position. + * The Gyro class tracks the robots heading based on the starting position. As + * the robot + * rotates the new heading is computed by integrating the rate of rotation + * returned + * by the sensor. When the class is instantiated, it does a short calibration + * routine + * where it samples the gyro while at rest to determine the default offset. This + * is + * subtracted from each sample to determine the heading. This gyro class must be + * used + * with a channel that is assigned one of the Analog accumulators from the FPGA. + * See + * AnalogInput for the current accumulator assignments. + * + * This class is for gyro sensors that connect to an analog input. + */ +class AnalogGyro : public GyroBase { + public: + static const uint32_t kOversampleBits = 10; + static const uint32_t kAverageBits = 0; + static constexpr float kSamplesPerSecond = 50.0; + static constexpr float kCalibrationSampleTime = 5.0; + static constexpr float kDefaultVoltsPerDegreePerSecond = 0.007; + + explicit AnalogGyro(int32_t channel); + explicit AnalogGyro(AnalogInput *channel); + explicit AnalogGyro(std::shared_ptr channel); + AnalogGyro(int32_t channel, uint32_t center, float offset); + AnalogGyro(std::shared_ptr channel, uint32_t center, float offset); + virtual ~AnalogGyro() = default; + + float GetAngle() const override; + double GetRate() const override; + virtual uint32_t GetCenter() const; + virtual float GetOffset() const; + void SetSensitivity(float voltsPerDegreePerSecond); + void SetDeadband(float volts); + void Reset() override; + virtual void InitGyro(); + void Calibrate() override; + + protected: + std::shared_ptr m_analog; + + private: + float m_voltsPerDegreePerSecond; + float m_offset; + uint32_t m_center; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogInput.h b/Robot2016/wpilib/cpp/current/include/AnalogInput.h new file mode 100644 index 0000000..6217e2d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogInput.h @@ -0,0 +1,88 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "SensorBase.h" +#include "PIDSource.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * Analog input class. + * + * Connected to each analog channel is an averaging and oversampling engine. + * This engine accumulates + * the specified ( by SetAverageBits() and SetOversampleBits() ) number of + * samples before returning a new + * value. This is not a sliding window average. The only difference between + * the oversampled samples and + * the averaged samples is that the oversampled samples are simply accumulated + * effectively increasing the + * resolution, while the averaged samples are divided by the number of samples + * to retain the resolution, + * but get more stable values. + */ +class AnalogInput : public SensorBase, + public PIDSource, + public LiveWindowSendable { + public: + static const uint8_t kAccumulatorModuleNumber = 1; + static const uint32_t kAccumulatorNumChannels = 2; + static const uint32_t kAccumulatorChannels[kAccumulatorNumChannels]; + + explicit AnalogInput(uint32_t channel); + virtual ~AnalogInput(); + + int16_t GetValue() const; + int32_t GetAverageValue() const; + + float GetVoltage() const; + float GetAverageVoltage() const; + + uint32_t GetChannel() const; + + void SetAverageBits(uint32_t bits); + uint32_t GetAverageBits() const; + void SetOversampleBits(uint32_t bits); + uint32_t GetOversampleBits() const; + + uint32_t GetLSBWeight() const; + int32_t GetOffset() const; + + bool IsAccumulatorChannel() const; + void InitAccumulator(); + void SetAccumulatorInitialValue(int64_t value); + void ResetAccumulator(); + void SetAccumulatorCenter(int32_t center); + void SetAccumulatorDeadband(int32_t deadband); + int64_t GetAccumulatorValue() const; + uint32_t GetAccumulatorCount() const; + void GetAccumulatorOutput(int64_t &value, uint32_t &count) const; + + static void SetSampleRate(float samplesPerSecond); + static float GetSampleRate(); + + double PIDGet() override; + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + private: + uint32_t m_channel; + //TODO: Adjust HAL to avoid use of raw pointers. + void *m_port; + int64_t m_accumulatorOffset; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogOutput.h b/Robot2016/wpilib/cpp/current/include/AnalogOutput.h new file mode 100644 index 0000000..d7bd30e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogOutput.h @@ -0,0 +1,39 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "HAL/HAL.hpp" +#include "SensorBase.h" +#include "LiveWindow/LiveWindowSendable.h" +#include +#include + +/** + * MXP analog output class. + */ +class AnalogOutput : public SensorBase, public LiveWindowSendable { + public: + explicit AnalogOutput(uint32_t channel); + virtual ~AnalogOutput(); + + void SetVoltage(float voltage); + float GetVoltage() const; + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + protected: + uint32_t m_channel; + void *m_port; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogPotentiometer.h b/Robot2016/wpilib/cpp/current/include/AnalogPotentiometer.h new file mode 100644 index 0000000..3c6daa5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogPotentiometer.h @@ -0,0 +1,92 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#include "AnalogInput.h" +#include "interfaces/Potentiometer.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * Class for reading analog potentiometers. Analog potentiometers read + * in an analog voltage that corresponds to a position. The position is + * in whichever units you choose, by way of the scaling and offset + * constants passed to the constructor. + * + * @author Alex Henning + * @author Colby Skeggs (rail voltage) + */ +class AnalogPotentiometer : public Potentiometer, public LiveWindowSendable { + public: + /** + * AnalogPotentiometer constructor. + * + * Use the fullRange and offset values so that the output produces + * meaningful values. I.E: you have a 270 degree potentiometer and + * you want the output to be degrees with the halfway point as 0 + * degrees. The fullRange value is 270.0(degrees) and the offset is + * -135.0 since the halfway point after scaling is 135 degrees. + * + * This will calculate the result from the fullRange times the + * fraction of the supply voltage, plus the offset. + * + * @param channel The analog channel this potentiometer is plugged into. + * @param fullRange The scaling to multiply the voltage by to get a meaningful + * unit. + * @param offset The offset to add to the scaled value for controlling the + * zero value + */ + explicit AnalogPotentiometer(int channel, double fullRange = 1.0, + double offset = 0.0); + + explicit AnalogPotentiometer(AnalogInput *input, double fullRange = 1.0, + double offset = 0.0); + + explicit AnalogPotentiometer(std::shared_ptr input, + double fullRange = 1.0, double offset = 0.0); + + virtual ~AnalogPotentiometer() = default; + + /** + * Get the current reading of the potentiomer. + * + * @return The current position of the potentiometer. + */ + virtual double Get() const override; + + /** + * Implement the PIDSource interface. + * + * @return The current reading. + */ + virtual double PIDGet() override; + + /* + * Live Window code, only does anything if live window is activated. + */ + virtual std::string GetSmartDashboardType() const override; + virtual void InitTable(std::shared_ptr subtable) override; + virtual void UpdateTable() override; + virtual std::shared_ptr GetTable() const override; + + /** + * AnalogPotentiometers don't have to do anything special when entering the + * LiveWindow. + */ + virtual void StartLiveWindowMode() override {} + + /** + * AnalogPotentiometers don't have to do anything special when exiting the + * LiveWindow. + */ + virtual void StopLiveWindowMode() override {} + + private: + std::shared_ptr m_analog_input; + double m_fullRange, m_offset; + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogTrigger.h b/Robot2016/wpilib/cpp/current/include/AnalogTrigger.h new file mode 100644 index 0000000..811cc07 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogTrigger.h @@ -0,0 +1,36 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "AnalogTriggerOutput.h" +#include "SensorBase.h" + +class AnalogInput; + +class AnalogTrigger : public SensorBase { + friend class AnalogTriggerOutput; + + public: + explicit AnalogTrigger(int32_t channel); + explicit AnalogTrigger(AnalogInput *channel); + virtual ~AnalogTrigger(); + + void SetLimitsVoltage(float lower, float upper); + void SetLimitsRaw(int32_t lower, int32_t upper); + void SetAveraged(bool useAveragedValue); + void SetFiltered(bool useFilteredValue); + uint32_t GetIndex() const; + bool GetInWindow(); + bool GetTriggerState(); + std::shared_ptr CreateOutput(AnalogTriggerType type) const; + + private: + uint8_t m_index; + void *m_trigger; +}; diff --git a/Robot2016/wpilib/cpp/current/include/AnalogTriggerOutput.h b/Robot2016/wpilib/cpp/current/include/AnalogTriggerOutput.h new file mode 100644 index 0000000..976d30c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/AnalogTriggerOutput.h @@ -0,0 +1,78 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "DigitalSource.h" + +class AnalogTrigger; + +/** + * Class to represent a specific output from an analog trigger. + * This class is used to get the current output value and also as a + * DigitalSource + * to provide routing of an output to digital subsystems on the FPGA such as + * Counter, Encoder, and Interrupt. + * + * The TriggerState output indicates the primary output value of the trigger. + * If the analog + * signal is less than the lower limit, the output is false. If the analog + * value is greater + * than the upper limit, then the output is true. If the analog value is in + * between, then + * the trigger output state maintains its most recent value. + * + * The InWindow output indicates whether or not the analog signal is inside the + * range defined + * by the limits. + * + * The RisingPulse and FallingPulse outputs detect an instantaneous transition + * from above the + * upper limit to below the lower limit, and vise versa. These pulses represent + * a rollover + * condition of a sensor and can be routed to an up / down couter or to + * interrupts. Because + * the outputs generate a pulse, they cannot be read directly. To help ensure + * that a rollover + * condition is not missed, there is an average rejection filter available that + * operates on the + * upper 8 bits of a 12 bit number and selects the nearest outlyer of 3 samples. + * This will reject + * a sample that is (due to averaging or sampling) errantly between the two + * limits. This filter + * will fail if more than one sample in a row is errantly in between the two + * limits. You may see + * this problem if attempting to use this feature with a mechanical rollover + * sensor, such as a + * 360 degree no-stop potentiometer without signal conditioning, because the + * rollover transition + * is not sharp / clean enough. Using the averaging engine may help with this, + * but rotational speeds of + * the sensor will then be limited. + */ +class AnalogTriggerOutput : public DigitalSource { + friend class AnalogTrigger; + + public: + virtual ~AnalogTriggerOutput(); + bool Get() const; + + // DigitalSource interface + virtual uint32_t GetChannelForRouting() const override; + virtual uint32_t GetModuleForRouting() const override; + virtual bool GetAnalogTriggerForRouting() const override; + + protected: + AnalogTriggerOutput(const AnalogTrigger &trigger, AnalogTriggerType outputType); + + private: + // Uses reference rather than smart pointer because a user can not construct + // an AnalogTriggerOutput themselves and because the AnalogTriggerOutput + // should always be in scope at the same time as an AnalogTrigger. + const AnalogTrigger &m_trigger; + AnalogTriggerType m_outputType; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Base.h b/Robot2016/wpilib/cpp/current/include/Base.h new file mode 100644 index 0000000..8bb8d4c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Base.h @@ -0,0 +1,117 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +// MSVC 2013 doesn't allow "= default" on move constructors, but since we are +// (currently) only actually using the move constructors in non-MSVC situations +// (ie, wpilibC++Devices), we can just ignore it in MSVC. +#if !defined(_MSC_VER) +#define DEFAULT_MOVE_CONSTRUCTOR(ClassName) \ +ClassName(ClassName &&) = default +#else +#define DEFAULT_MOVE_CONSTRUCTOR(ClassName) +#endif + +#if (__cplusplus < 201103L) + #if !defined(_MSC_VER) + #define nullptr NULL + #endif + #define constexpr const +#endif + +#if defined(_MSC_VER) + #define noexcept throw() +#endif + +// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9. +// We provide an equivalent warning implementation for those compilers here. +#if defined(_MSC_VER) + #define DEPRECATED(msg) __declspec(deprecated(msg)) +#elif defined(__GNUC__) + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) + #define DEPRECATED(msg) [[deprecated(msg)]] + #else + #define DEPRECATED(msg) __attribute__((deprecated(msg))) + #endif +#elif __cplusplus > 201103L + #define DEPRECATED(msg) [[deprecated(msg)]] +#else + #define DEPRECATED(msg) /*nothing*/ +#endif + +// Provide std::decay_t when using GCC < 4.9 +#if defined(__GNUC__) + #if __GNUC__ == 4 && __GNUC_MINOR__ < 9 + #include + namespace std { + template using decay_t = typename decay::type; + } + #endif +#endif + +// A struct to use as a deleter when a std::shared_ptr must wrap a raw pointer +// that is being deleted by someone else. +template +struct +NullDeleter { + void operator()(T *) const noexcept {}; +}; + +#include +// Use this for determining whether the default move constructor has been +// called on a containing object. This serves the purpose of allowing us to +// use the default move constructor of an object for moving all the data around +// while being able to use this to, for instance, chose not to de-allocate +// a PWM port in a destructor. +struct HasBeenMoved { + HasBeenMoved(HasBeenMoved&& other) { + other.moved = true; + moved = false; + } + HasBeenMoved() = default; + std::atomic moved{false}; + operator bool() const { return moved; } +}; + +// Define make_unique for C++11-only compilers +#if __cplusplus == 201103L +#include +#include +#include +#include +namespace std { +template +struct _Unique_if { + typedef unique_ptr _Single_object; +}; + +template +struct _Unique_if { + typedef unique_ptr _Unknown_bound; +}; + +template +struct _Unique_if { + typedef void _Known_bound; +}; + +template +typename _Unique_if::_Single_object make_unique(Args &&... args) { + return unique_ptr(new T(std::forward(args)...)); +} + +template +typename _Unique_if::_Unknown_bound make_unique(size_t n) { + typedef typename remove_extent::type U; + return unique_ptr(new U[n]()); +} + +template +typename _Unique_if::_Known_bound make_unique(Args &&...) = delete; +} // namespace std +#endif diff --git a/Robot2016/wpilib/cpp/current/include/BuiltInAccelerometer.h b/Robot2016/wpilib/cpp/current/include/BuiltInAccelerometer.h new file mode 100644 index 0000000..d201b61 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/BuiltInAccelerometer.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "interfaces/Accelerometer.h" +#include "SensorBase.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * Built-in accelerometer. + * + * This class allows access to the RoboRIO's internal accelerometer. + */ +class BuiltInAccelerometer : public Accelerometer, + public SensorBase, + public LiveWindowSendable { + public: + BuiltInAccelerometer(Range range = kRange_8G); + virtual ~BuiltInAccelerometer() = default; + + // Accelerometer interface + virtual void SetRange(Range range) override; + virtual double GetX() override; + virtual double GetY() override; + virtual double GetZ() override; + + virtual std::string GetSmartDashboardType() const override; + virtual void InitTable(std::shared_ptr subtable) override; + virtual void UpdateTable() override; + virtual std::shared_ptr GetTable() const override; + virtual void StartLiveWindowMode() override {} + virtual void StopLiveWindowMode() override {} + + private: + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/Button.h b/Robot2016/wpilib/cpp/current/include/Buttons/Button.h new file mode 100644 index 0000000..3c77886 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/Button.h @@ -0,0 +1,37 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __BUTTON_H__ +#define __BUTTON_H__ + +#include "Buttons/Trigger.h" +#include "Commands/Command.h" + +/** + * This class provides an easy way to link commands to OI inputs. + * + * It is very easy to link a button to a command. For instance, you could + * link the trigger button of a joystick to a "score" command. + * + * This class represents a subclass of Trigger that is specifically aimed at + * buttons on an operator interface as a common use case of the more generalized + * Trigger objects. This is a simple wrapper around Trigger with the method + * names + * renamed to fit the Button object use. + * + * @author brad + */ +class Button : public Trigger { + public: + virtual void WhenPressed(Command *command); + virtual void WhileHeld(Command *command); + virtual void WhenReleased(Command *command); + virtual void CancelWhenPressed(Command *command); + virtual void ToggleWhenPressed(Command *command); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/ButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/ButtonScheduler.h new file mode 100644 index 0000000..f05274d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/ButtonScheduler.h @@ -0,0 +1,27 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __BUTTON_SCHEDULER_H__ +#define __BUTTON_SCHEDULER_H__ + +class Trigger; +class Command; + +class ButtonScheduler { + public: + ButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~ButtonScheduler() = default; + virtual void Execute() = 0; + void Start(); + + protected: + bool m_pressedLast; + Trigger *m_button; + Command *m_command; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/CancelButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/CancelButtonScheduler.h new file mode 100644 index 0000000..1c5d328 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/CancelButtonScheduler.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __CANCEL_BUTTON_SCHEDULER_H__ +#define __CANCEL_BUTTON_SCHEDULER_H__ + +#include "Buttons/ButtonScheduler.h" + +class Trigger; +class Command; + +class CancelButtonScheduler : public ButtonScheduler { + public: + CancelButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~CancelButtonScheduler() = default; + virtual void Execute(); + + private: + bool pressedLast; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/HeldButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/HeldButtonScheduler.h new file mode 100644 index 0000000..0a29105 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/HeldButtonScheduler.h @@ -0,0 +1,23 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __HELD_BUTTON_SCHEDULER_H__ +#define __HELD_BUTTON_SCHEDULER_H__ + +#include "Buttons/ButtonScheduler.h" + +class Trigger; +class Command; + +class HeldButtonScheduler : public ButtonScheduler { + public: + HeldButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~HeldButtonScheduler() = default; + virtual void Execute(); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/InternalButton.h b/Robot2016/wpilib/cpp/current/include/Buttons/InternalButton.h new file mode 100644 index 0000000..6beea7b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/InternalButton.h @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __INTERNAL_BUTTON_H__ +#define __INTERNAL_BUTTON_H__ + +#include "Buttons/Button.h" + +class InternalButton : public Button { + public: + InternalButton() = default; + InternalButton(bool inverted); + virtual ~InternalButton() = default; + + void SetInverted(bool inverted); + void SetPressed(bool pressed); + + virtual bool Get(); + + private: + bool m_pressed = false; + bool m_inverted = false; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/JoystickButton.h b/Robot2016/wpilib/cpp/current/include/Buttons/JoystickButton.h new file mode 100644 index 0000000..b1163f0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/JoystickButton.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __JOYSTICK_BUTTON_H__ +#define __JOYSTICK_BUTTON_H__ + +#include "GenericHID.h" +#include "Buttons/Button.h" + +class JoystickButton : public Button { + public: + JoystickButton(GenericHID *joystick, int buttonNumber); + virtual ~JoystickButton() = default; + + virtual bool Get(); + + private: + GenericHID *m_joystick; + int m_buttonNumber; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/NetworkButton.h b/Robot2016/wpilib/cpp/current/include/Buttons/NetworkButton.h new file mode 100644 index 0000000..b534e00 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/NetworkButton.h @@ -0,0 +1,28 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __NETWORK_BUTTON_H__ +#define __NETWORK_BUTTON_H__ + +#include "Buttons/Button.h" +#include +#include + +class NetworkButton : public Button { + public: + NetworkButton(const std::string &tableName, const std::string &field); + NetworkButton(std::shared_ptr table, const std::string &field); + virtual ~NetworkButton() = default; + + virtual bool Get(); + + private: + std::shared_ptr m_netTable; + std::string m_field; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/PressedButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/PressedButtonScheduler.h new file mode 100644 index 0000000..7a2e477 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/PressedButtonScheduler.h @@ -0,0 +1,23 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __PRESSED_BUTTON_SCHEDULER_H__ +#define __PRESSED_BUTTON_SCHEDULER_H__ + +#include "Buttons/ButtonScheduler.h" + +class Trigger; +class Command; + +class PressedButtonScheduler : public ButtonScheduler { + public: + PressedButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~PressedButtonScheduler() = default; + virtual void Execute(); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/ReleasedButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/ReleasedButtonScheduler.h new file mode 100644 index 0000000..a9ee3c8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/ReleasedButtonScheduler.h @@ -0,0 +1,23 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __RELEASED_BUTTON_SCHEDULER_H__ +#define __RELEASED_BUTTON_SCHEDULER_H__ + +#include "Buttons/ButtonScheduler.h" + +class Trigger; +class Command; + +class ReleasedButtonScheduler : public ButtonScheduler { + public: + ReleasedButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~ReleasedButtonScheduler() = default; + virtual void Execute(); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/ToggleButtonScheduler.h b/Robot2016/wpilib/cpp/current/include/Buttons/ToggleButtonScheduler.h new file mode 100644 index 0000000..4c2b5eb --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/ToggleButtonScheduler.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __TOGGLE_BUTTON_SCHEDULER_H__ +#define __TOGGLE_BUTTON_SCHEDULER_H__ + +#include "Buttons/ButtonScheduler.h" + +class Trigger; +class Command; + +class ToggleButtonScheduler : public ButtonScheduler { + public: + ToggleButtonScheduler(bool last, Trigger *button, Command *orders); + virtual ~ToggleButtonScheduler() = default; + virtual void Execute(); + + private: + bool pressedLast; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Buttons/Trigger.h b/Robot2016/wpilib/cpp/current/include/Buttons/Trigger.h new file mode 100644 index 0000000..719b072 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Buttons/Trigger.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __TRIGGER_H__ +#define __TRIGGER_H__ + +#include "SmartDashboard/Sendable.h" +#include + +class Command; + +/** + * This class provides an easy way to link commands to inputs. + * + * It is very easy to link a polled input to a command. For instance, you could + * link the trigger button of a joystick to a "score" command or an encoder + * reaching + * a particular value. + * + * It is encouraged that teams write a subclass of Trigger if they want to have + * something unusual (for instance, if they want to react to the user holding + * a button while the robot is reading a certain sensor input). For this, they + * only have to write the {@link Trigger#Get()} method to get the full + * functionality + * of the Trigger class. + * + * @author Brad Miller, Joe Grinstead + */ +class Trigger : public Sendable { + public: + Trigger() = default; + virtual ~Trigger() = default; + bool Grab(); + virtual bool Get() = 0; + void WhenActive(Command *command); + void WhileActive(Command *command); + void WhenInactive(Command *command); + void CancelWhenActive(Command *command); + void ToggleWhenActive(Command *command); + + virtual void InitTable(std::shared_ptr table); + virtual std::shared_ptr GetTable() const; + virtual std::string GetSmartDashboardType() const; + + protected: + std::shared_ptr m_table; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/CAN/can_proto.h b/Robot2016/wpilib/cpp/current/include/CAN/can_proto.h new file mode 100644 index 0000000..c2737d7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CAN/can_proto.h @@ -0,0 +1,415 @@ +//***************************************************************************** +// +// can_proto.h - Definitions for the CAN protocol used to communicate with the +// BDC motor controller. +// +// Copyright (c) 2008 Texas Instruments Incorporated. All rights reserved. +// TI Information - Selective Disclosure +// +//***************************************************************************** + +#ifndef __CAN_PROTO_H__ +#define __CAN_PROTO_H__ + +//***************************************************************************** +// +// The masks of the fields that are used in the message identifier. +// +//***************************************************************************** +#define CAN_MSGID_FULL_M 0x1fffffff +#define CAN_MSGID_DEVNO_M 0x0000003f +#define CAN_MSGID_API_M 0x0000ffc0 +#define CAN_MSGID_MFR_M 0x00ff0000 +#define CAN_MSGID_DTYPE_M 0x1f000000 +#define CAN_MSGID_DEVNO_S 0 +#define CAN_MSGID_API_S 6 +#define CAN_MSGID_MFR_S 16 +#define CAN_MSGID_DTYPE_S 24 + +//***************************************************************************** +// +// The Reserved device number values in the Message Id. +// +//***************************************************************************** +#define CAN_MSGID_DEVNO_BCAST 0x00000000 + +//***************************************************************************** +// +// The Reserved system control API numbers in the Message Id. +// +//***************************************************************************** +#define CAN_MSGID_API_SYSHALT 0x00000000 +#define CAN_MSGID_API_SYSRST 0x00000040 +#define CAN_MSGID_API_DEVASSIGN 0x00000080 +#define CAN_MSGID_API_DEVQUERY 0x000000c0 +#define CAN_MSGID_API_HEARTBEAT 0x00000140 +#define CAN_MSGID_API_SYNC 0x00000180 +#define CAN_MSGID_API_UPDATE 0x000001c0 +#define CAN_MSGID_API_FIRMVER 0x00000200 +#define CAN_MSGID_API_ENUMERATE 0x00000240 +#define CAN_MSGID_API_SYSRESUME 0x00000280 + +//***************************************************************************** +// +// The 32 bit values associated with the CAN_MSGID_API_STATUS request. +// +//***************************************************************************** +#define CAN_STATUS_CODE_M 0x0000ffff +#define CAN_STATUS_MFG_M 0x00ff0000 +#define CAN_STATUS_DTYPE_M 0x1f000000 +#define CAN_STATUS_CODE_S 0 +#define CAN_STATUS_MFG_S 16 +#define CAN_STATUS_DTYPE_S 24 + +//***************************************************************************** +// +// The Reserved manufacturer identifiers in the Message Id. +// +//***************************************************************************** +#define CAN_MSGID_MFR_NI 0x00010000 +#define CAN_MSGID_MFR_LM 0x00020000 +#define CAN_MSGID_MFR_DEKA 0x00030000 + +//***************************************************************************** +// +// The Reserved device type identifiers in the Message Id. +// +//***************************************************************************** +#define CAN_MSGID_DTYPE_BCAST 0x00000000 +#define CAN_MSGID_DTYPE_ROBOT 0x01000000 +#define CAN_MSGID_DTYPE_MOTOR 0x02000000 +#define CAN_MSGID_DTYPE_RELAY 0x03000000 +#define CAN_MSGID_DTYPE_GYRO 0x04000000 +#define CAN_MSGID_DTYPE_ACCEL 0x05000000 +#define CAN_MSGID_DTYPE_USONIC 0x06000000 +#define CAN_MSGID_DTYPE_GEART 0x07000000 +#define CAN_MSGID_DTYPE_UPDATE 0x1f000000 + +//***************************************************************************** +// +// LM Motor Control API Classes API Class and ID masks. +// +//***************************************************************************** +#define CAN_MSGID_API_CLASS_M 0x0000fc00 +#define CAN_MSGID_API_ID_M 0x000003c0 + +//***************************************************************************** +// +// LM Motor Control API Classes in the Message Id for non-broadcast. +// These are the upper 6 bits of the API field, the lower 4 bits determine +// the APIId. +// +//***************************************************************************** +#define CAN_API_MC_VOLTAGE 0x00000000 +#define CAN_API_MC_SPD 0x00000400 +#define CAN_API_MC_VCOMP 0x00000800 +#define CAN_API_MC_POS 0x00000c00 +#define CAN_API_MC_ICTRL 0x00001000 +#define CAN_API_MC_STATUS 0x00001400 +#define CAN_API_MC_PSTAT 0x00001800 +#define CAN_API_MC_CFG 0x00001c00 +#define CAN_API_MC_ACK 0x00002000 + +//***************************************************************************** +// +// The Stellaris Motor Class Control Voltage API definitions. +// +//***************************************************************************** +#define LM_API_VOLT \ + (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_VOLTAGE) +#define LM_API_VOLT_EN (LM_API_VOLT | (0 << CAN_MSGID_API_S)) +#define LM_API_VOLT_DIS (LM_API_VOLT | (1 << CAN_MSGID_API_S)) +#define LM_API_VOLT_SET (LM_API_VOLT | (2 << CAN_MSGID_API_S)) +#define LM_API_VOLT_SET_RAMP (LM_API_VOLT | (3 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_VOLT_T_EN (LM_API_VOLT | (4 << CAN_MSGID_API_S)) +#define LM_API_VOLT_T_SET (LM_API_VOLT | (5 << CAN_MSGID_API_S)) +#define LM_API_VOLT_T_SET_NO_ACK (LM_API_VOLT | (7 << CAN_MSGID_API_S)) +//##### FIRST END ##### +#define LM_API_VOLT_SET_NO_ACK (LM_API_VOLT | (8 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris Motor Class Control API definitions for LM_API_VOLT_SET_RAMP. +// +//***************************************************************************** +#define LM_API_VOLT_RAMP_DIS 0 + +//***************************************************************************** +// +// The Stellaris Motor Class Control API definitions for CAN_MSGID_API_SYNC. +// +//***************************************************************************** +#define LM_API_SYNC_PEND_NOW 0 + +//***************************************************************************** +// +// The Stellaris Motor Class Speed Control API definitions. +// +//***************************************************************************** +#define LM_API_SPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_SPD) +#define LM_API_SPD_EN (LM_API_SPD | (0 << CAN_MSGID_API_S)) +#define LM_API_SPD_DIS (LM_API_SPD | (1 << CAN_MSGID_API_S)) +#define LM_API_SPD_SET (LM_API_SPD | (2 << CAN_MSGID_API_S)) +#define LM_API_SPD_PC (LM_API_SPD | (3 << CAN_MSGID_API_S)) +#define LM_API_SPD_IC (LM_API_SPD | (4 << CAN_MSGID_API_S)) +#define LM_API_SPD_DC (LM_API_SPD | (5 << CAN_MSGID_API_S)) +#define LM_API_SPD_REF (LM_API_SPD | (6 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_SPD_T_EN (LM_API_SPD | (7 << CAN_MSGID_API_S)) +#define LM_API_SPD_T_SET (LM_API_SPD | (8 << CAN_MSGID_API_S)) +#define LM_API_SPD_T_SET_NO_ACK (LM_API_SPD | (10 << CAN_MSGID_API_S)) +//##### FIRST END ##### +#define LM_API_SPD_SET_NO_ACK (LM_API_SPD | (11 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris Motor Control Voltage Compensation Control API definitions. +// +//***************************************************************************** +#define LM_API_VCOMP \ + (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_VCOMP) +#define LM_API_VCOMP_EN (LM_API_VCOMP | (0 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_DIS (LM_API_VCOMP | (1 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_SET (LM_API_VCOMP | (2 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_IN_RAMP (LM_API_VCOMP | (3 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_COMP_RAMP (LM_API_VCOMP | (4 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_VCOMP_T_EN (LM_API_VCOMP | (5 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_T_SET (LM_API_VCOMP | (6 << CAN_MSGID_API_S)) +#define LM_API_VCOMP_T_SET_NO_ACK (LM_API_VCOMP | (8 << CAN_MSGID_API_S)) +//##### FIRST END ##### +#define LM_API_VCOMP_SET_NO_ACK (LM_API_VCOMP | (9 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris Motor Class Position Control API definitions. +// +//***************************************************************************** +#define LM_API_POS (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_POS) +#define LM_API_POS_EN (LM_API_POS | (0 << CAN_MSGID_API_S)) +#define LM_API_POS_DIS (LM_API_POS | (1 << CAN_MSGID_API_S)) +#define LM_API_POS_SET (LM_API_POS | (2 << CAN_MSGID_API_S)) +#define LM_API_POS_PC (LM_API_POS | (3 << CAN_MSGID_API_S)) +#define LM_API_POS_IC (LM_API_POS | (4 << CAN_MSGID_API_S)) +#define LM_API_POS_DC (LM_API_POS | (5 << CAN_MSGID_API_S)) +#define LM_API_POS_REF (LM_API_POS | (6 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_POS_T_EN (LM_API_POS | (7 << CAN_MSGID_API_S)) +#define LM_API_POS_T_SET (LM_API_POS | (8 << CAN_MSGID_API_S)) +#define LM_API_POS_T_SET_NO_ACK (LM_API_POS | (10 << CAN_MSGID_API_S)) +//##### FIRST END ##### +#define LM_API_POS_SET_NO_ACK (LM_API_POS | (11 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris Motor Class Current Control API definitions. +// +//***************************************************************************** +#define LM_API_ICTRL \ + (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_ICTRL) +#define LM_API_ICTRL_EN (LM_API_ICTRL | (0 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_DIS (LM_API_ICTRL | (1 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_SET (LM_API_ICTRL | (2 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_PC (LM_API_ICTRL | (3 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_IC (LM_API_ICTRL | (4 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_DC (LM_API_ICTRL | (5 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_ICTRL_T_EN (LM_API_ICTRL | (6 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_T_SET (LM_API_ICTRL | (7 << CAN_MSGID_API_S)) +#define LM_API_ICTRL_T_SET_NO_ACK (LM_API_ICTRL | (9 << CAN_MSGID_API_S)) +//##### FIRST END ##### +#define LM_API_ICTRL_SET_NO_ACK (LM_API_ICTRL | (10 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris Motor Class Firmware Update API definitions. +// +//***************************************************************************** +#define LM_API_UPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_UPDATE) +#define LM_API_UPD_PING (LM_API_UPD | (0 << CAN_MSGID_API_S)) +#define LM_API_UPD_DOWNLOAD (LM_API_UPD | (1 << CAN_MSGID_API_S)) +#define LM_API_UPD_SEND_DATA (LM_API_UPD | (2 << CAN_MSGID_API_S)) +#define LM_API_UPD_RESET (LM_API_UPD | (3 << CAN_MSGID_API_S)) +#define LM_API_UPD_ACK (LM_API_UPD | (4 << CAN_MSGID_API_S)) +#define LM_API_HWVER (LM_API_UPD | (5 << CAN_MSGID_API_S)) +#define LM_API_UPD_REQUEST (LM_API_UPD | (6 << CAN_MSGID_API_S)) +//##### FIRST BEGIN ##### +#define LM_API_UNTRUST_EN (LM_API_UPD | (11 << CAN_MSGID_API_S)) +#define LM_API_TRUST_EN (LM_API_UPD | (12 << CAN_MSGID_API_S)) +#define LM_API_TRUST_HEARTBEAT (LM_API_UPD | (13 << CAN_MSGID_API_S)) +//##### FIRST END ##### + +//***************************************************************************** +// +// The Stellaris Motor Class Status API definitions. +// +//***************************************************************************** +#define LM_API_STATUS \ + (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_STATUS) +#define LM_API_STATUS_VOLTOUT (LM_API_STATUS | (0 << CAN_MSGID_API_S)) +#define LM_API_STATUS_VOLTBUS (LM_API_STATUS | (1 << CAN_MSGID_API_S)) +#define LM_API_STATUS_CURRENT (LM_API_STATUS | (2 << CAN_MSGID_API_S)) +#define LM_API_STATUS_TEMP (LM_API_STATUS | (3 << CAN_MSGID_API_S)) +#define LM_API_STATUS_POS (LM_API_STATUS | (4 << CAN_MSGID_API_S)) +#define LM_API_STATUS_SPD (LM_API_STATUS | (5 << CAN_MSGID_API_S)) +#define LM_API_STATUS_LIMIT (LM_API_STATUS | (6 << CAN_MSGID_API_S)) +#define LM_API_STATUS_FAULT (LM_API_STATUS | (7 << CAN_MSGID_API_S)) +#define LM_API_STATUS_POWER (LM_API_STATUS | (8 << CAN_MSGID_API_S)) +#define LM_API_STATUS_CMODE (LM_API_STATUS | (9 << CAN_MSGID_API_S)) +#define LM_API_STATUS_VOUT (LM_API_STATUS | (10 << CAN_MSGID_API_S)) +#define LM_API_STATUS_STKY_FLT (LM_API_STATUS | (11 << CAN_MSGID_API_S)) +#define LM_API_STATUS_FLT_COUNT (LM_API_STATUS | (12 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// These definitions are used with the byte that is returned from +// the status request for LM_API_STATUS_LIMIT. +// +//***************************************************************************** +#define LM_STATUS_LIMIT_FWD 0x01 +#define LM_STATUS_LIMIT_REV 0x02 +#define LM_STATUS_LIMIT_SFWD 0x04 +#define LM_STATUS_LIMIT_SREV 0x08 +#define LM_STATUS_LIMIT_STKY_FWD 0x10 +#define LM_STATUS_LIMIT_STKY_REV 0x20 +#define LM_STATUS_LIMIT_STKY_SFWD 0x40 +#define LM_STATUS_LIMIT_STKY_SREV 0x80 + +//***************************************************************************** +// +// LM Motor Control status codes returned due to the CAN_STATUS_CODE_M field. +// +//***************************************************************************** +#define LM_STATUS_FAULT_ILIMIT 0x01 +#define LM_STATUS_FAULT_TLIMIT 0x02 +#define LM_STATUS_FAULT_VLIMIT 0x04 + +//***************************************************************************** +// +// The Stellaris Motor Class Configuration API definitions. +// +//***************************************************************************** +#define LM_API_CFG (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_CFG) +#define LM_API_CFG_NUM_BRUSHES (LM_API_CFG | (0 << CAN_MSGID_API_S)) +#define LM_API_CFG_ENC_LINES (LM_API_CFG | (1 << CAN_MSGID_API_S)) +#define LM_API_CFG_POT_TURNS (LM_API_CFG | (2 << CAN_MSGID_API_S)) +#define LM_API_CFG_BRAKE_COAST (LM_API_CFG | (3 << CAN_MSGID_API_S)) +#define LM_API_CFG_LIMIT_MODE (LM_API_CFG | (4 << CAN_MSGID_API_S)) +#define LM_API_CFG_LIMIT_FWD (LM_API_CFG | (5 << CAN_MSGID_API_S)) +#define LM_API_CFG_LIMIT_REV (LM_API_CFG | (6 << CAN_MSGID_API_S)) +#define LM_API_CFG_MAX_VOUT (LM_API_CFG | (7 << CAN_MSGID_API_S)) +#define LM_API_CFG_FAULT_TIME (LM_API_CFG | (8 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The Stellaris ACK API definition. +// +//***************************************************************************** +#define LM_API_ACK (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_ACK) + +//***************************************************************************** +// +// The 8 bit values that can be returned by a call to LM_API_STATUS_HWVER. +// +//***************************************************************************** +#define LM_HWVER_UNKNOWN 0x00 +#define LM_HWVER_JAG_1_0 0x01 +#define LM_HWVER_JAG_2_0 0x02 + +//***************************************************************************** +// +// The 8 bit values that can be returned by a call to LM_API_STATUS_CMODE. +// +//***************************************************************************** +#define LM_STATUS_CMODE_VOLT 0x00 +#define LM_STATUS_CMODE_CURRENT 0x01 +#define LM_STATUS_CMODE_SPEED 0x02 +#define LM_STATUS_CMODE_POS 0x03 +#define LM_STATUS_CMODE_VCOMP 0x04 + +//***************************************************************************** +// +// The values that can specified as the position or speed reference. Not all +// values are valid for each reference; if an invalid reference is set, then +// none will be selected. +// +//***************************************************************************** +#define LM_REF_ENCODER 0x00 +#define LM_REF_POT 0x01 +#define LM_REF_INV_ENCODER 0x02 +#define LM_REF_QUAD_ENCODER 0x03 +#define LM_REF_NONE 0xff + +//***************************************************************************** +// +// The flags that are used to indicate the currently active fault sources. +// +//***************************************************************************** +#define LM_FAULT_CURRENT 0x01 +#define LM_FAULT_TEMP 0x02 +#define LM_FAULT_VBUS 0x04 +#define LM_FAULT_GATE_DRIVE 0x08 +#define LM_FAULT_COMM 0x10 + +//***************************************************************************** +// +// The Stellaris Motor Class Periodic Status API definitions. +// +//***************************************************************************** +#define LM_API_PSTAT \ + (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | CAN_API_MC_PSTAT) +#define LM_API_PSTAT_PER_EN_S0 (LM_API_PSTAT | (0 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_PER_EN_S1 (LM_API_PSTAT | (1 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_PER_EN_S2 (LM_API_PSTAT | (2 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_PER_EN_S3 (LM_API_PSTAT | (3 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_CFG_S0 (LM_API_PSTAT | (4 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_CFG_S1 (LM_API_PSTAT | (5 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_CFG_S2 (LM_API_PSTAT | (6 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_CFG_S3 (LM_API_PSTAT | (7 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_DATA_S0 (LM_API_PSTAT | (8 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_DATA_S1 (LM_API_PSTAT | (9 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_DATA_S2 (LM_API_PSTAT | (10 << CAN_MSGID_API_S)) +#define LM_API_PSTAT_DATA_S3 (LM_API_PSTAT | (11 << CAN_MSGID_API_S)) + +//***************************************************************************** +// +// The values that can be used to configure the data the Periodic Status +// Message bytes. Bytes of a multi-byte data values are encoded as +// little-endian, therefore B0 is the least significant byte. +// +//***************************************************************************** +#define LM_PSTAT_END 0 +#define LM_PSTAT_VOLTOUT_B0 1 +#define LM_PSTAT_VOLTOUT_B1 2 +#define LM_PSTAT_VOLTBUS_B0 3 +#define LM_PSTAT_VOLTBUS_B1 4 +#define LM_PSTAT_CURRENT_B0 5 +#define LM_PSTAT_CURRENT_B1 6 +#define LM_PSTAT_TEMP_B0 7 +#define LM_PSTAT_TEMP_B1 8 +#define LM_PSTAT_POS_B0 9 +#define LM_PSTAT_POS_B1 10 +#define LM_PSTAT_POS_B2 11 +#define LM_PSTAT_POS_B3 12 +#define LM_PSTAT_SPD_B0 13 +#define LM_PSTAT_SPD_B1 14 +#define LM_PSTAT_SPD_B2 15 +#define LM_PSTAT_SPD_B3 16 +#define LM_PSTAT_LIMIT_NCLR 17 +#define LM_PSTAT_LIMIT_CLR 18 +#define LM_PSTAT_FAULT 19 +#define LM_PSTAT_STKY_FLT_NCLR 20 +#define LM_PSTAT_STKY_FLT_CLR 21 +#define LM_PSTAT_VOUT_B0 22 +#define LM_PSTAT_VOUT_B1 23 +#define LM_PSTAT_FLT_COUNT_CURRENT 24 +#define LM_PSTAT_FLT_COUNT_TEMP 25 +#define LM_PSTAT_FLT_COUNT_VOLTBUS 26 +#define LM_PSTAT_FLT_COUNT_GATE 27 +#define LM_PSTAT_FLT_COUNT_COMM 28 +#define LM_PSTAT_CANSTS 29 +#define LM_PSTAT_CANERR_B0 30 +#define LM_PSTAT_CANERR_B1 31 + +#endif // __CAN_PROTO_H__ diff --git a/Robot2016/wpilib/cpp/current/include/CANJaguar.h b/Robot2016/wpilib/cpp/current/include/CANJaguar.h new file mode 100644 index 0000000..03637df --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CANJaguar.h @@ -0,0 +1,252 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2009-2016. 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 "ErrorBase.h" +#include "MotorSafety.h" +#include "Resource.h" +#include "MotorSafetyHelper.h" +#include "PIDOutput.h" +#include "CANSpeedController.h" +#include "HAL/cpp/Semaphore.hpp" +#include "HAL/HAL.hpp" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITableListener.h" +#include "NetworkCommunication/CANSessionMux.h" +#include "CAN/can_proto.h" + +#include +#include "HAL/cpp/priority_mutex.h" +#include +#include +#include + +/** + * Luminary Micro / Vex Robotics Jaguar Speed Control + */ +class CANJaguar : public MotorSafety, + public CANSpeedController, + public ErrorBase, + public LiveWindowSendable, + public ITableListener { + public: + // The internal PID control loop in the Jaguar runs at 1kHz. + static const int32_t kControllerRate = 1000; + static constexpr double kApproxBusVoltage = 12.0; + + // Control mode tags + /** Sets an encoder as the speed reference only.
Passed as the "tag" when + * setting the control mode.*/ + static const struct EncoderStruct { + } Encoder; + /** Sets a quadrature encoder as the position and speed reference.
Passed + * as the "tag" when setting the control mode.*/ + static const struct QuadEncoderStruct { + } QuadEncoder; + /** Sets a potentiometer as the position reference only.
Passed as the + * "tag" when setting the control mode. */ + static const struct PotentiometerStruct { + } Potentiometer; + + explicit CANJaguar(uint8_t deviceNumber); + virtual ~CANJaguar(); + + uint8_t getDeviceNumber() const; + uint8_t GetHardwareVersion() const; + + // PIDOutput interface + virtual void PIDWrite(float output) override; + + // Control mode methods + void EnableControl(double encoderInitialPosition = 0.0); + void DisableControl(); + + void SetPercentMode(); + void SetPercentMode(EncoderStruct, uint16_t codesPerRev); + void SetPercentMode(QuadEncoderStruct, uint16_t codesPerRev); + void SetPercentMode(PotentiometerStruct); + + void SetCurrentMode(double p, double i, double d); + void SetCurrentMode(EncoderStruct, uint16_t codesPerRev, double p, double i, + double d); + void SetCurrentMode(QuadEncoderStruct, uint16_t codesPerRev, double p, + double i, double d); + void SetCurrentMode(PotentiometerStruct, double p, double i, double d); + + void SetSpeedMode(EncoderStruct, uint16_t codesPerRev, double p, double i, + double d); + void SetSpeedMode(QuadEncoderStruct, uint16_t codesPerRev, double p, double i, + double d); + + void SetPositionMode(QuadEncoderStruct, uint16_t codesPerRev, double p, + double i, double d); + void SetPositionMode(PotentiometerStruct, double p, double i, double d); + + void SetVoltageMode(); + void SetVoltageMode(EncoderStruct, uint16_t codesPerRev); + void SetVoltageMode(QuadEncoderStruct, uint16_t codesPerRev); + void SetVoltageMode(PotentiometerStruct); + + // CANSpeedController interface + virtual float Get() const override; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual void Disable() override; + virtual void SetP(double p) override; + virtual void SetI(double i) override; + virtual void SetD(double d) override; + virtual void SetPID(double p, double i, double d) override; + virtual double GetP() const override; + virtual double GetI() const override; + virtual double GetD() const override; + virtual bool IsModePID(CANSpeedController::ControlMode mode) const override; + virtual float GetBusVoltage() const override; + virtual float GetOutputVoltage() const override; + virtual float GetOutputCurrent() const override; + virtual float GetTemperature() const override; + virtual double GetPosition() const override; + virtual double GetSpeed() const override; + virtual bool GetForwardLimitOK() const override; + virtual bool GetReverseLimitOK() const override; + virtual uint16_t GetFaults() const override; + virtual void SetVoltageRampRate(double rampRate) override; + virtual uint32_t GetFirmwareVersion() const override; + virtual void ConfigNeutralMode(NeutralMode mode) override; + virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override; + virtual void ConfigPotentiometerTurns(uint16_t turns) override; + virtual void ConfigSoftPositionLimits(double forwardLimitPosition, + double reverseLimitPosition) override; + virtual void DisableSoftPositionLimits() override; + virtual void ConfigLimitMode(LimitMode mode) override; + virtual void ConfigForwardLimit(double forwardLimitPosition) override; + virtual void ConfigReverseLimit(double reverseLimitPosition) override; + virtual void ConfigMaxOutputVoltage(double voltage) override; + virtual void ConfigFaultTime(float faultTime) override; + virtual void SetControlMode(ControlMode mode); + virtual ControlMode GetControlMode() const; + + static void UpdateSyncGroup(uint8_t syncGroup); + + void SetExpiration(float timeout) override; + float GetExpiration() const override; + bool IsAlive() const override; + void StopMotor() override; + bool IsSafetyEnabled() const override; + void SetSafetyEnabled(bool enabled) override; + void GetDescription(std::ostringstream& desc) const override; + uint8_t GetDeviceID() const; + + // SpeedController overrides + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + protected: + // Control mode helpers + void SetSpeedReference(uint8_t reference); + uint8_t GetSpeedReference() const; + + void SetPositionReference(uint8_t reference); + uint8_t GetPositionReference() const; + + uint8_t packPercentage(uint8_t *buffer, double value); + uint8_t packFXP8_8(uint8_t *buffer, double value); + uint8_t packFXP16_16(uint8_t *buffer, double value); + uint8_t packint16_t(uint8_t *buffer, int16_t value); + uint8_t packint32_t(uint8_t *buffer, int32_t value); + double unpackPercentage(uint8_t *buffer) const; + double unpackFXP8_8(uint8_t *buffer) const; + double unpackFXP16_16(uint8_t *buffer) const; + int16_t unpackint16_t(uint8_t *buffer) const; + int32_t unpackint32_t(uint8_t *buffer) const; + + void sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, + int32_t period = CAN_SEND_PERIOD_NO_REPEAT); + void requestMessage(uint32_t messageID, + int32_t period = CAN_SEND_PERIOD_NO_REPEAT); + bool getMessage(uint32_t messageID, uint32_t mask, uint8_t *data, + uint8_t *dataSize) const; + + void setupPeriodicStatus(); + void updatePeriodicStatus() const; + + mutable priority_recursive_mutex m_mutex; + + uint8_t m_deviceNumber; + float m_value = 0.0f; + + // Parameters/configuration + ControlMode m_controlMode = kPercentVbus; + uint8_t m_speedReference = LM_REF_NONE; + uint8_t m_positionReference = LM_REF_NONE; + double m_p = 0.0; + double m_i = 0.0; + double m_d = 0.0; + NeutralMode m_neutralMode = kNeutralMode_Jumper; + uint16_t m_encoderCodesPerRev = 0; + uint16_t m_potentiometerTurns = 0; + LimitMode m_limitMode = kLimitMode_SwitchInputsOnly; + double m_forwardLimit = 0.0; + double m_reverseLimit = 0.0; + double m_maxOutputVoltage = 30.0; + double m_voltageRampRate = 0.0; + float m_faultTime = 0.0f; + + // Which parameters have been verified since they were last set? + bool m_controlModeVerified = false; // Needs to be verified because it's set in the constructor + bool m_speedRefVerified = true; + bool m_posRefVerified = true; + bool m_pVerified = true; + bool m_iVerified = true; + bool m_dVerified = true; + bool m_neutralModeVerified = true; + bool m_encoderCodesPerRevVerified = true; + bool m_potentiometerTurnsVerified = true; + bool m_forwardLimitVerified = true; + bool m_reverseLimitVerified = true; + bool m_limitModeVerified = true; + bool m_maxOutputVoltageVerified = true; + bool m_voltageRampRateVerified = true; + bool m_faultTimeVerified = true; + + // Status data + mutable float m_busVoltage = 0.0f; + mutable float m_outputVoltage = 0.0f; + mutable float m_outputCurrent = 0.0f; + mutable float m_temperature = 0.0f; + mutable double m_position = 0.0; + mutable double m_speed = 0.0; + mutable uint8_t m_limits = 0x00; + mutable uint16_t m_faults = 0x0000; + uint32_t m_firmwareVersion = 0; + uint8_t m_hardwareVersion = 0; + + // Which periodic status messages have we received at least once? + mutable std::atomic m_receivedStatusMessage0{false}; + mutable std::atomic m_receivedStatusMessage1{false}; + mutable std::atomic m_receivedStatusMessage2{false}; + + bool m_controlEnabled = false; + + void verify(); + + std::unique_ptr m_safetyHelper; + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + std::shared_ptr m_table; + + private: + void InitCANJaguar(); + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/CANSpeedController.h b/Robot2016/wpilib/cpp/current/include/CANSpeedController.h new file mode 100644 index 0000000..773fb99 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CANSpeedController.h @@ -0,0 +1,101 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "SpeedController.h" + +/** + * Interface for "smart" CAN-based speed controllers. + * @see CANJaguar + * @see CANTalon + */ +class CANSpeedController : public SpeedController { + public: + enum ControlMode { + kPercentVbus = 0, + kCurrent = 1, + kSpeed = 2, + kPosition = 3, + kVoltage = 4, + kFollower = 5, // Not supported in Jaguar. + kMotionProfile = 6, // Not supported in Jaguar. + }; + + // Helper function for the ControlMode enum + virtual bool IsModePID(ControlMode mode) const = 0; + + enum Faults { + kCurrentFault = 1, + kTemperatureFault = 2, + kBusVoltageFault = 4, + kGateDriverFault = 8, + /* SRX extensions */ + kFwdLimitSwitch = 0x10, + kRevLimitSwitch = 0x20, + kFwdSoftLimit = 0x40, + kRevSoftLimit = 0x80, + }; + + enum Limits { kForwardLimit = 1, kReverseLimit = 2 }; + + enum NeutralMode { + /** Use the NeutralMode that is set by the jumper wire on the CAN device */ + kNeutralMode_Jumper = 0, + /** Stop the motor's rotation by applying a force. */ + kNeutralMode_Brake = 1, + /** Do not attempt to stop the motor. Instead allow it to coast to a stop + without applying resistance. */ + kNeutralMode_Coast = 2 + }; + + enum LimitMode { + /** Only use switches for limits */ + kLimitMode_SwitchInputsOnly = 0, + /** Use both switches and soft limits */ + kLimitMode_SoftPositionLimits = 1, + /* SRX extensions */ + /** Disable switches and disable soft limits */ + kLimitMode_SrxDisableSwitchInputs = 2, + }; + + virtual float Get() const = 0; + virtual void Set(float value, uint8_t syncGroup = 0) = 0; + virtual void Disable() = 0; + virtual void SetP(double p) = 0; + virtual void SetI(double i) = 0; + virtual void SetD(double d) = 0; + virtual void SetPID(double p, double i, double d) = 0; + virtual double GetP() const = 0; + virtual double GetI() const = 0; + virtual double GetD() const = 0; + virtual float GetBusVoltage() const = 0; + virtual float GetOutputVoltage() const = 0; + virtual float GetOutputCurrent() const = 0; + virtual float GetTemperature() const = 0; + virtual double GetPosition() const = 0; + virtual double GetSpeed() const = 0; + virtual bool GetForwardLimitOK() const = 0; + virtual bool GetReverseLimitOK() const = 0; + virtual uint16_t GetFaults() const = 0; + virtual void SetVoltageRampRate(double rampRate) = 0; + virtual uint32_t GetFirmwareVersion() const = 0; + virtual void ConfigNeutralMode(NeutralMode mode) = 0; + virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) = 0; + virtual void ConfigPotentiometerTurns(uint16_t turns) = 0; + virtual void ConfigSoftPositionLimits(double forwardLimitPosition, + double reverseLimitPosition) = 0; + virtual void DisableSoftPositionLimits() = 0; + virtual void ConfigLimitMode(LimitMode mode) = 0; + virtual void ConfigForwardLimit(double forwardLimitPosition) = 0; + virtual void ConfigReverseLimit(double reverseLimitPosition) = 0; + virtual void ConfigMaxOutputVoltage(double voltage) = 0; + virtual void ConfigFaultTime(float faultTime) = 0; + // Hold off on interface until we figure out ControlMode enums. + // virtual void SetControlMode(ControlMode mode) = 0; + // virtual ControlMode GetControlMode() const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/CANTalon.h b/Robot2016/wpilib/cpp/current/include/CANTalon.h new file mode 100644 index 0000000..b773c63 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CANTalon.h @@ -0,0 +1,528 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "SafePWM.h" +#include "CANSpeedController.h" +#include "PIDOutput.h" +#include "PIDSource.h" +#include "PIDInterface.h" +#include "HAL/CanTalonSRX.h" +#include "MotorSafetyHelper.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITable.h" + +#include + +/** + * CTRE Talon SRX Speed Controller with CAN Control + */ +class CANTalon : public MotorSafety, + public CANSpeedController, + public ErrorBase, + public LiveWindowSendable, + public ITableListener, + public PIDSource, + public PIDInterface { + public: + enum FeedbackDevice { + QuadEncoder = 0, + AnalogPot = 2, + AnalogEncoder = 3, + EncRising = 4, + EncFalling = 5, + CtreMagEncoder_Relative = 6, //!< Cross The Road Electronics Magnetic Encoder in Absolute/PulseWidth Mode + CtreMagEncoder_Absolute = 7, //!< Cross The Road Electronics Magnetic Encoder in Relative/Quadrature Mode + PulseWidth = 8, + }; + /** + * Depending on the sensor type, Talon can determine if sensor is plugged in ot not. + */ + enum FeedbackDeviceStatus { + FeedbackStatusUnknown = 0, //!< Sensor status could not be determined. Not all sensors can do this. + FeedbackStatusPresent = 1, //!< Sensor is present and working okay. + FeedbackStatusNotPresent = 2, //!< Sensor is not present, not plugged in, not powered, etc... + }; + enum StatusFrameRate { + StatusFrameRateGeneral = 0, + StatusFrameRateFeedback = 1, + StatusFrameRateQuadEncoder = 2, + StatusFrameRateAnalogTempVbat = 3, + StatusFrameRatePulseWidthMeas = 4, + }; + /** + * Enumerated types for Motion Control Set Values. + * When in Motion Profile control mode, these constants are paseed + * into set() to manipulate the motion profile executer. + * When changing modes, be sure to read the value back using getMotionProfileStatus() + * to ensure changes in output take effect before performing buffering actions. + * Disable will signal Talon to put motor output into neutral drive. + * Talon will stop processing motion profile points. This means the buffer is + * effectively disconnected from the executer, allowing the robot to gracefully + * clear and push new traj points. isUnderrun will get cleared. + * The active trajectory is also cleared. + * Enable will signal Talon to pop a trajectory point from it's buffer and process it. + * If the active trajectory is empty, Talon will shift in the next point. + * If the active traj is empty, and so is the buffer, the motor drive is neutral and + * isUnderrun is set. When active traj times out, and buffer has at least one point, + * Talon shifts in next one, and isUnderrun is cleared. When active traj times out, + * and buffer is empty, Talon keeps processing active traj and sets IsUnderrun. + * Hold will signal Talon keep processing the active trajectory indefinitely. + * If the active traj is cleared, Talon will neutral motor drive. Otherwise + * Talon will keep processing the active traj but it will not shift in + * points from the buffer. This means the buffer is effectively disconnected + * from the executer, allowing the robot to gracefully clear and push + * new traj points. + * isUnderrun is set if active traj is empty, otherwise it is cleared. + * isLast signal is also cleared. + * + * Typical workflow: + * set(Disable), + * Confirm Disable takes effect, + * clear buffer and push buffer points, + * set(Enable) when enough points have been pushed to ensure no underruns, + * wait for MP to finish or decide abort, + * If MP finished gracefully set(Hold) to hold position servo and disconnect buffer, + * If MP is being aborted set(Disable) to neutral the motor and disconnect buffer, + * Confirm mode takes effect, + * clear buffer and push buffer points, and rinse-repeat. + */ + enum SetValueMotionProfile { + SetValueMotionProfileDisable = 0, + SetValueMotionProfileEnable = 1, + SetValueMotionProfileHold = 2, + }; + /** + * Motion Profile Trajectory Point + * This is simply a data transer object. + */ + struct TrajectoryPoint { + double position; //!< The position to servo to. + double velocity; //!< The velocity to feed-forward. + /** + * Time in milliseconds to process this point. + * Value should be between 1ms and 255ms. If value is zero + * then Talon will default to 1ms. If value exceeds 255ms API will cap it. + */ + unsigned int timeDurMs; + /** + * Which slot to get PIDF gains. + * PID is used for position servo. + * F is used as the Kv constant for velocity feed-forward. + * Typically this is hardcoded to the a particular slot, but you are free + * gain schedule if need be. + */ + unsigned int profileSlotSelect; + /** + * Set to true to only perform the velocity feed-forward and not perform + * position servo. This is useful when learning how the position servo + * changes the motor response. The same could be accomplish by clearing the + * PID gains, however this is synchronous the streaming, and doesn't require restoing + * gains when finished. + * + * Additionaly setting this basically gives you direct control of the motor output + * since motor output = targetVelocity X Kv, where Kv is our Fgain. + * This means you can also scheduling straight-throttle curves without relying on + * a sensor. + */ + bool velocityOnly; + /** + * Set to true to signal Talon that this is the final point, so do not + * attempt to pop another trajectory point from out of the Talon buffer. + * Instead continue processing this way point. Typically the velocity + * member variable should be zero so that the motor doesn't spin indefinitely. + */ + bool isLastPoint; + /** + * Set to true to signal Talon to zero the selected sensor. + * When generating MPs, one simple method is to make the first target position zero, + * and the final target position the target distance from the current position. + * Then when you fire the MP, the current position gets set to zero. + * If this is the intent, you can set zeroPos on the first trajectory point. + * + * Otherwise you can leave this false for all points, and offset the positions + * of all trajectory points so they are correct. + */ + bool zeroPos; + }; + /** + * Motion Profile Status + * This is simply a data transer object. + */ + struct MotionProfileStatus { + /** + * The available empty slots in the trajectory buffer. + * + * The robot API holds a "top buffer" of trajectory points, so your applicaion + * can dump several points at once. The API will then stream them into the Talon's + * low-level buffer, allowing the Talon to act on them. + */ + unsigned int topBufferRem; + /** + * The number of points in the top trajectory buffer. + */ + unsigned int topBufferCnt; + /** + * The number of points in the low level Talon buffer. + */ + unsigned int btmBufferCnt; + /** + * Set if isUnderrun ever gets set. + * Only is cleared by clearMotionProfileHasUnderrun() to ensure + * robot logic can react or instrument it. + * @see clearMotionProfileHasUnderrun() + */ + bool hasUnderrun; + /** + * This is set if Talon needs to shift a point from its buffer into + * the active trajectory point however the buffer is empty. This gets cleared + * automatically when is resolved. + */ + bool isUnderrun; + /** + * True if the active trajectory point has not empty, false otherwise. + * The members in activePoint are only valid if this signal is set. + */ + bool activePointValid; + /** + * The number of points in the low level Talon buffer. + */ + TrajectoryPoint activePoint; + /** + * The current output mode of the motion profile executer (disabled, enabled, or hold). + * When changing the set() value in MP mode, it's important to check this signal to + * confirm the change takes effect before interacting with the top buffer. + */ + SetValueMotionProfile outputEnable; + }; + explicit CANTalon(int deviceNumber); + explicit CANTalon(int deviceNumber, int controlPeriodMs); + DEFAULT_MOVE_CONSTRUCTOR(CANTalon); + virtual ~CANTalon(); + + // PIDOutput interface + virtual void PIDWrite(float output) override; + + // PIDSource interface + virtual double PIDGet() override; + + // MotorSafety interface + virtual void SetExpiration(float timeout) override; + virtual float GetExpiration() const override; + virtual bool IsAlive() const override; + virtual void StopMotor() override; + virtual void SetSafetyEnabled(bool enabled) override; + virtual bool IsSafetyEnabled() const override; + virtual void GetDescription(std::ostringstream& desc) const override; + + // CANSpeedController interface + virtual float Get() const override; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual void Reset() override; + virtual void SetSetpoint(float value) override; + virtual void Disable() override; + virtual void EnableControl(); + virtual void Enable() override; + virtual void SetP(double p) override; + virtual void SetI(double i) override; + virtual void SetD(double d) override; + void SetF(double f); + void SetIzone(unsigned iz); + virtual void SetPID(double p, double i, double d) override; + virtual void SetPID(double p, double i, double d, double f); + virtual double GetP() const override; + virtual double GetI() const override; + virtual double GetD() const override; + virtual double GetF() const; + virtual bool IsModePID(CANSpeedController::ControlMode mode) const override; + virtual float GetBusVoltage() const override; + virtual float GetOutputVoltage() const override; + virtual float GetOutputCurrent() const override; + virtual float GetTemperature() const override; + void SetPosition(double pos); + virtual double GetPosition() const override; + virtual double GetSpeed() const override; + virtual int GetClosedLoopError() const; + virtual void SetAllowableClosedLoopErr(uint32_t allowableCloseLoopError); + virtual int GetAnalogIn() const; + virtual void SetAnalogPosition(int newPosition); + virtual int GetAnalogInRaw() const; + virtual int GetAnalogInVel() const; + virtual int GetEncPosition() const; + virtual void SetEncPosition(int); + virtual int GetEncVel() const; + int GetPinStateQuadA() const; + int GetPinStateQuadB() const; + int GetPinStateQuadIdx() const; + int IsFwdLimitSwitchClosed() const; + int IsRevLimitSwitchClosed() const; + int GetNumberOfQuadIdxRises() const; + void SetNumberOfQuadIdxRises(int rises); + virtual int GetPulseWidthPosition() const; + virtual void SetPulseWidthPosition(int newpos); + virtual int GetPulseWidthVelocity() const; + virtual int GetPulseWidthRiseToFallUs() const; + virtual int GetPulseWidthRiseToRiseUs() const; + virtual FeedbackDeviceStatus IsSensorPresent(FeedbackDevice feedbackDevice)const; + virtual bool GetForwardLimitOK() const override; + virtual bool GetReverseLimitOK() const override; + virtual uint16_t GetFaults() const override; + uint16_t GetStickyFaults() const; + void ClearStickyFaults(); + virtual void SetVoltageRampRate(double rampRate) override; + virtual void SetVoltageCompensationRampRate(double rampRate); + virtual uint32_t GetFirmwareVersion() const override; + virtual void ConfigNeutralMode(NeutralMode mode) override; + virtual void ConfigEncoderCodesPerRev(uint16_t codesPerRev) override; + virtual void ConfigPotentiometerTurns(uint16_t turns) override; + virtual void ConfigSoftPositionLimits(double forwardLimitPosition, + double reverseLimitPosition) override; + virtual void DisableSoftPositionLimits() override; + virtual void ConfigLimitMode(LimitMode mode) override; + virtual void ConfigForwardLimit(double forwardLimitPosition) override; + virtual void ConfigReverseLimit(double reverseLimitPosition) override; + /** + * Change the fwd limit switch setting to normally open or closed. + * Talon will disable momentarilly if the Talon's current setting + * is dissimilar to the caller's requested setting. + * + * Since Talon saves setting to flash this should only affect + * a given Talon initially during robot install. + * + * @param normallyOpen true for normally open. false for normally closed. + */ + void ConfigFwdLimitSwitchNormallyOpen(bool normallyOpen); + /** + * Change the rev limit switch setting to normally open or closed. + * Talon will disable momentarilly if the Talon's current setting + * is dissimilar to the caller's requested setting. + * + * Since Talon saves setting to flash this should only affect + * a given Talon initially during robot install. + * + * @param normallyOpen true for normally open. false for normally closed. + */ + void ConfigRevLimitSwitchNormallyOpen(bool normallyOpen); + virtual void ConfigMaxOutputVoltage(double voltage) override; + void ConfigPeakOutputVoltage(double forwardVoltage,double reverseVoltage); + void ConfigNominalOutputVoltage(double forwardVoltage,double reverseVoltage); + /** + * Enables Talon SRX to automatically zero the Sensor Position whenever an + * edge is detected on the index signal. + * @param enable boolean input, pass true to enable feature or false to disable. + * @param risingEdge boolean input, pass true to clear the position on rising edge, + * pass false to clear the position on falling edge. + */ + void EnableZeroSensorPositionOnIndex(bool enable, bool risingEdge); + void ConfigSetParameter(uint32_t paramEnum, double value); + bool GetParameter(uint32_t paramEnum, double & dvalue) const; + + virtual void ConfigFaultTime(float faultTime) override; + virtual void SetControlMode(ControlMode mode); + void SetFeedbackDevice(FeedbackDevice device); + void SetStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs); + virtual ControlMode GetControlMode() const; + void SetSensorDirection(bool reverseSensor); + void SetClosedLoopOutputDirection(bool reverseOutput); + void SetCloseLoopRampRate(double rampRate); + void SelectProfileSlot(int slotIdx); + int GetIzone() const; + int GetIaccum() const; + void ClearIaccum(); + int GetBrakeEnableDuringNeutral() const; + + bool IsControlEnabled() const; + bool IsEnabled() const override; + double GetSetpoint() const override; + + + /** + * Calling application can opt to speed up the handshaking between the robot API and the Talon to increase the + * download rate of the Talon's Motion Profile. Ideally the period should be no more than half the period + * of a trajectory point. + */ + void ChangeMotionControlFramePeriod(int periodMs); + + /** + * Clear the buffered motion profile in both Talon RAM (bottom), and in the API (top). + * Be sure to check GetMotionProfileStatus() to know when the buffer is actually cleared. + */ + void ClearMotionProfileTrajectories(); + + /** + * Retrieve just the buffer count for the api-level (top) buffer. + * This routine performs no CAN or data structure lookups, so its fast and ideal + * if caller needs to quickly poll the progress of trajectory points being emptied + * into Talon's RAM. Otherwise just use GetMotionProfileStatus. + * @return number of trajectory points in the top buffer. + */ + int GetMotionProfileTopLevelBufferCount(); + + /** + * Push another trajectory point into the top level buffer (which is emptied into + * the Talon's bottom buffer as room allows). + * @param trajPt the trajectory point to insert into buffer. + * @return true if trajectory point push ok. CTR_BufferFull if buffer is full + * due to kMotionProfileTopBufferCapacity. + */ + bool PushMotionProfileTrajectory(const TrajectoryPoint & trajPt); + + /** + * @return true if api-level (top) buffer is full. + */ + bool IsMotionProfileTopLevelBufferFull(); + + /** + * This must be called periodically to funnel the trajectory points from the API's top level buffer to + * the Talon's bottom level buffer. Recommendation is to call this twice as fast as the executation rate of the motion profile. + * So if MP is running with 20ms trajectory points, try calling this routine every 10ms. All motion profile functions are thread-safe + * through the use of a mutex, so there is no harm in having the caller utilize threading. + */ + void ProcessMotionProfileBuffer(); + + /** + * Retrieve all status information. + * Since this all comes from one CAN frame, its ideal to have one routine to retrieve the frame once and decode everything. + * @param [out] motionProfileStatus contains all progress information on the currently running MP. + */ + void GetMotionProfileStatus(MotionProfileStatus & motionProfileStatus); + + /** + * Clear the hasUnderrun flag in Talon's Motion Profile Executer when MPE is ready for another point, + * but the low level buffer is empty. + * + * Once the Motion Profile Executer sets the hasUnderrun flag, it stays set until + * Robot Application clears it with this routine, which ensures Robot Application + * gets a chance to instrument or react. Caller could also check the isUnderrun flag + * which automatically clears when fault condition is removed. + */ + void ClearMotionProfileHasUnderrun(); + + // LiveWindow stuff. + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + // SpeedController overrides + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + // Values for various modes as is sent in the CAN packets for the Talon. + enum TalonControlMode { + kThrottle = 0, + kFollowerMode = 5, + kVoltageMode = 4, + kPositionMode = 1, + kSpeedMode = 2, + kCurrentMode = 3, + kMotionProfileMode = 6, + kDisabled = 15 + }; + + int m_deviceNumber; + std::unique_ptr m_impl; + std::unique_ptr m_safetyHelper; + int m_profile = 0; // Profile from CANTalon to use. Set to zero until we can + // actually test this. + + bool m_controlEnabled = true; + ControlMode m_controlMode = kPercentVbus; + TalonControlMode m_sendMode; + + double m_setPoint = 0; + /** + * Encoder CPR, counts per rotations, also called codes per revoluion. + * Default value of zero means the API behaves as it did during the 2015 season, each position + * unit is a single pulse and there are four pulses per count (4X). + * Caller can use ConfigEncoderCodesPerRev to set the quadrature encoder CPR. + */ + uint32_t m_codesPerRev = 0; + /** + * Number of turns per rotation. For example, a 10-turn pot spins ten full rotations from + * a wiper voltage of zero to 3.3 volts. Therefore knowing the + * number of turns a full voltage sweep represents is necessary for calculating rotations + * and velocity. + * A default value of zero means the API behaves as it did during the 2015 season, there are 1024 + * position units from zero to 3.3V. + */ + uint32_t m_numPotTurns = 0; + /** + * Although the Talon handles feedback selection, caching the feedback selection is helpful at the API level + * for scaling into rotations and RPM. + */ + FeedbackDevice m_feedbackDevice = QuadEncoder; + + static const unsigned int kDelayForSolicitedSignalsUs = 4000; + /** + * @param devToLookup FeedbackDevice to lookup the scalar for. Because Talon + * allows multiple sensors to be attached simultaneously, caller must + * specify which sensor to lookup. + * @return The number of native Talon units per rotation of the selected sensor. + * Zero if the necessary sensor information is not available. + * @see ConfigEncoderCodesPerRev + * @see ConfigPotentiometerTurns + */ + double GetNativeUnitsPerRotationScalar(FeedbackDevice devToLookup)const; + /** + * Fixup the sendMode so Set() serializes the correct demand value. + * Also fills the modeSelecet in the control frame to disabled. + * @param mode Control mode to ultimately enter once user calls Set(). + * @see Set() + */ + void ApplyControlMode(CANSpeedController::ControlMode mode); + /** + * @param fullRotations double precision value representing number of rotations of selected feedback sensor. + * If user has never called the config routine for the selected sensor, then the caller + * is likely passing rotations in engineering units already, in which case it is returned + * as is. + * @see ConfigPotentiometerTurns + * @see ConfigEncoderCodesPerRev + * @return fullRotations in native engineering units of the Talon SRX firmware. + */ + int32_t ScaleRotationsToNativeUnits(FeedbackDevice devToLookup, double fullRotations) const; + /** + * @param rpm double precision value representing number of rotations per minute of selected feedback sensor. + * If user has never called the config routine for the selected sensor, then the caller + * is likely passing rotations in engineering units already, in which case it is returned + * as is. + * @see ConfigPotentiometerTurns + * @see ConfigEncoderCodesPerRev + * @return sensor velocity in native engineering units of the Talon SRX firmware. + */ + int32_t ScaleVelocityToNativeUnits(FeedbackDevice devToLookup, double rpm) const; + /** + * @param nativePos integral position of the feedback sensor in native Talon SRX units. + * If user has never called the config routine for the selected sensor, then the return + * will be in TALON SRX units as well to match the behavior in the 2015 season. + * @see ConfigPotentiometerTurns + * @see ConfigEncoderCodesPerRev + * @return double precision number of rotations, unless config was never performed. + */ + double ScaleNativeUnitsToRotations(FeedbackDevice devToLookup, int32_t nativePos) const; + /** + * @param nativeVel integral velocity of the feedback sensor in native Talon SRX units. + * If user has never called the config routine for the selected sensor, then the return + * will be in TALON SRX units as well to match the behavior in the 2015 season. + * @see ConfigPotentiometerTurns + * @see ConfigEncoderCodesPerRev + * @return double precision of sensor velocity in RPM, unless config was never performed. + */ + double ScaleNativeUnitsToRpm(FeedbackDevice devToLookup, int32_t nativeVel) const; + + // LiveWindow stuff. + std::shared_ptr m_table; + bool m_isInverted; + + HasBeenMoved m_hasBeenMoved; +}; diff --git a/Robot2016/wpilib/cpp/current/include/CameraServer.h b/Robot2016/wpilib/cpp/current/include/CameraServer.h new file mode 100644 index 0000000..bb0c314 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CameraServer.h @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "USBCamera.h" +#include "ErrorBase.h" +#include "nivision.h" +#include "NIIMAQdx.h" + +#include "HAL/cpp/priority_mutex.h" +#include +#include +#include +#include +#include + +class CameraServer : public ErrorBase { + private: + static constexpr uint16_t kPort = 1180; + static constexpr uint8_t kMagicNumber[] = {0x01, 0x00, 0x00, 0x00}; + static constexpr uint32_t kSize640x480 = 0; + static constexpr uint32_t kSize320x240 = 1; + static constexpr uint32_t kSize160x120 = 2; + static constexpr int32_t kHardwareCompression = -1; + static constexpr uint32_t kMaxImageSize = 200000; + + protected: + CameraServer(); + + std::shared_ptr m_camera; + std::thread m_serverThread; + std::thread m_captureThread; + priority_recursive_mutex m_imageMutex; + std::condition_variable_any m_newImageVariable; + std::vector m_dataPool; + unsigned int m_quality; + bool m_autoCaptureStarted; + bool m_hwClient; + std::tuple m_imageData; + + void Serve(); + void AutoCapture(); + void SetImageData(uint8_t* data, unsigned int size, unsigned int start = 0, + bool imaqData = false); + void FreeImageData( + std::tuple imageData); + + struct Request { + uint32_t fps; + int32_t compression; + uint32_t size; + }; + + public: + static CameraServer* GetInstance(); + void SetImage(Image const* image); + + void StartAutomaticCapture( + char const* cameraName = USBCamera::kDefaultCameraName); + + /** + * Start automatically capturing images to send to the dashboard. + * + * You should call this method to just see a camera feed on the + * dashboard without doing any vision processing on the roboRIO. + * {@link #SetImage} should not be called after this is called. + * + * @param camera The camera interface (eg. USBCamera) + */ + void StartAutomaticCapture(std::shared_ptr camera); + + bool IsAutoCaptureStarted(); + + void SetQuality(unsigned int quality); + unsigned int GetQuality(); + + void SetSize(unsigned int size); +}; diff --git a/Robot2016/wpilib/cpp/current/include/ChipObject.h b/Robot2016/wpilib/cpp/current/include/ChipObject.h new file mode 100644 index 0000000..ac0fe71 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ChipObject.h @@ -0,0 +1,45 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" +#pragma GCC diagnostic ignored "-Wignored-qualifiers" + +#include + +#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h" +#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h" +#include "FRC_FPGA_ChipObject/tDMAManager.h" +#include "FRC_FPGA_ChipObject/tInterruptManager.h" +#include "FRC_FPGA_ChipObject/tSystem.h" +#include "FRC_FPGA_ChipObject/tSystemInterface.h" + +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h" +#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h" + +// FIXME: these should not be here! +using namespace nFPGA; +using namespace nRoboRIO_FPGANamespace; +#pragma GCC diagnostic pop diff --git a/Robot2016/wpilib/cpp/current/include/CircularBuffer.h b/Robot2016/wpilib/cpp/current/include/CircularBuffer.h new file mode 100644 index 0000000..e4c7739 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CircularBuffer.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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 +#include + +/** + * This is a simple circular buffer so we don't need to "bucket brigade" copy + * old values. + */ +template +class CircularBuffer { + public: + CircularBuffer(size_t size); + + void PushFront(T value); + void PushBack(T value); + T PopFront(); + T PopBack(); + void Reset(); + + T& operator[](size_t index); + const T& operator[](size_t index) const; + + private: + std::vector m_data; + + // Index of element at front of buffer + size_t m_front = 0; + + // Number of elements used in buffer + size_t m_length = 0; + + size_t ModuloInc(size_t index); + size_t ModuloDec(size_t index); +}; + +#include "CircularBuffer.inc" diff --git a/Robot2016/wpilib/cpp/current/include/CircularBuffer.inc b/Robot2016/wpilib/cpp/current/include/CircularBuffer.inc new file mode 100644 index 0000000..c42dea8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CircularBuffer.inc @@ -0,0 +1,123 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#include + +template +CircularBuffer::CircularBuffer(size_t size) : m_data(size, 0) {} + +/** + * Push new value onto front of the buffer. The value at the back is overwritten + * if the buffer is full. + */ +template +void CircularBuffer::PushFront(T value) { + if (m_data.size() == 0) { + return; + } + + m_front = ModuloDec(m_front); + + m_data[m_front] = value; + + if (m_length < m_data.size()) { + m_length++; + } +} + +/** + * Push new value onto back of the buffer. The value at the front is overwritten + * if the buffer is full. + */ +template +void CircularBuffer::PushBack(T value) { + if (m_data.size() == 0) { + return; + } + + m_data[(m_front + m_length) % m_data.size()] = value; + + if (m_length < m_data.size()) { + m_length++; + } else { + // Increment front if buffer is full to maintain size + m_front = ModuloInc(m_front); + } +} + +/** + * Pop value at front of buffer. + */ +template +T CircularBuffer::PopFront() { + // If there are no elements in the buffer, do nothing + if (m_length == 0) { + return 0; + } + + T& temp = m_data[m_front]; + m_front = ModuloInc(m_front); + m_length--; + return temp; +} + +/** + * Pop value at back of buffer. + */ +template +T CircularBuffer::PopBack() { + // If there are no elements in the buffer, do nothing + if (m_length == 0) { + return 0; + } + + m_length--; + return m_data[(m_front + m_length) % m_data.size()]; +} + +template +void CircularBuffer::Reset() { + std::fill(m_data.begin(), m_data.end(), 0); + m_front = 0; + m_length = 0; +} + +/** + * Returns element at index starting from front of buffer. + */ +template +T& CircularBuffer::operator[](size_t index) { + return m_data[(m_front + index) % m_data.size()]; +} + +/** + * Returns element at index starting from front of buffer. + */ +template +const T& CircularBuffer::operator[](size_t index) const { + return m_data[(m_front + index) % m_data.size()]; +} + +/** + * Increment an index modulo the length of the m_data buffer + */ +template +size_t CircularBuffer::ModuloInc(size_t index) { + return (index + 1) % m_data.size(); +} + +/** + * Decrement an index modulo the length of the m_data buffer + */ +template +size_t CircularBuffer::ModuloDec(size_t index) { + if (index == 0) { + return m_data.size() - 1; + } else { + return index - 1; + } +} diff --git a/Robot2016/wpilib/cpp/current/include/Commands/Command.h b/Robot2016/wpilib/cpp/current/include/Commands/Command.h new file mode 100644 index 0000000..47fe7f1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/Command.h @@ -0,0 +1,190 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __COMMAND_H__ +#define __COMMAND_H__ + +#include "ErrorBase.h" +#include "SmartDashboard/NamedSendable.h" +#include "tables/ITableListener.h" +#include +#include +#include + +class CommandGroup; +class Subsystem; + +/** + * The Command class is at the very core of the entire command framework. + * Every command can be started with a call to {@link Command#Start() Start()}. + * Once a command is started it will call {@link Command#Initialize() + * Initialize()}, and then + * will repeatedly call {@link Command#Execute() Execute()} until the {@link + *Command#IsFinished() IsFinished()} + * returns true. Once it does, {@link Command#End() End()} will be called. + * + *

However, if at any point while it is running {@link Command#Cancel() + * Cancel()} is called, then + * the command will be stopped and {@link Command#Interrupted() Interrupted()} + * will be called.

+ * + *

If a command uses a {@link Subsystem}, then it should specify that it does + * so by + * calling the {@link Command#Requires(Subsystem) Requires(...)} method + * in its constructor. Note that a Command may have multiple requirements, and + * {@link Command#Requires(Subsystem) Requires(...)} should be + * called for each one.

+ * + *

If a command is running and a new command with shared requirements is + * started, + * then one of two things will happen. If the active command is interruptible, + * then {@link Command#Cancel() Cancel()} will be called and the command will be + * removed + * to make way for the new one. If the active command is not interruptible, the + * other one will not even be started, and the active one will continue + * functioning.

+ * + * @see CommandGroup + * @see Subsystem + */ +class Command : public ErrorBase, public NamedSendable, public ITableListener { + friend class CommandGroup; + friend class Scheduler; + + public: + Command(); + Command(const std::string &name); + Command(double timeout); + Command(const std::string &name, double timeout); + virtual ~Command(); + double TimeSinceInitialized() const; + void Requires(Subsystem *s); + bool IsCanceled() const; + void Start(); + bool Run(); + void Cancel(); + bool IsRunning() const; + bool IsInterruptible() const; + void SetInterruptible(bool interruptible); + bool DoesRequire(Subsystem *subsystem) const; + typedef std::set SubsystemSet; + SubsystemSet GetRequirements() const; + CommandGroup *GetGroup() const; + void SetRunWhenDisabled(bool run); + bool WillRunWhenDisabled() const; + int GetID() const; + + protected: + void SetTimeout(double timeout); + bool IsTimedOut() const; + bool AssertUnlocked(const std::string &message); + void SetParent(CommandGroup *parent); + /** + * The initialize method is called the first time this Command is run after + * being started. + */ + virtual void Initialize() = 0; + /** + * The execute method is called repeatedly until this Command either finishes + * or is canceled. + */ + virtual void Execute() = 0; + /** + * Returns whether this command is finished. + * If it is, then the command will be removed + * and {@link Command#end() end()} will be called. + * + *

It may be useful for a team to reference the {@link Command#isTimedOut() + * isTimedOut()} method + * for time-sensitive commands.

+ * @return whether this command is finished. + * @see Command#isTimedOut() isTimedOut() + */ + virtual bool IsFinished() = 0; + /** + * Called when the command ended peacefully. This is where you may want + * to wrap up loose ends, like shutting off a motor that was being used + * in the command. + */ + virtual void End() = 0; + /** + * Called when the command ends because somebody called {@link + *Command#cancel() cancel()} + * or another command shared the same requirements as this one, and booted + * it out. + * + *

This is where you may want + * to wrap up loose ends, like shutting off a motor that was being used + * in the command.

+ * + *

Generally, it is useful to simply call the {@link Command#end() end()} + * method + * within this method

+ */ + virtual void Interrupted() = 0; + virtual void _Initialize(); + virtual void _Interrupted(); + virtual void _Execute(); + virtual void _End(); + virtual void _Cancel(); + + private: + void LockChanges(); + /*synchronized*/ void Removed(); + void StartRunning(); + void StartTiming(); + + /** The name of this command */ + std::string m_name; + + /** The time since this command was initialized */ + double m_startTime = -1; + + /** The time (in seconds) before this command "times out" (or -1 if no + * timeout) */ + double m_timeout; + + /** Whether or not this command has been initialized */ + bool m_initialized = false; + + /** The requirements (or null if no requirements) */ + SubsystemSet m_requirements; + + /** Whether or not it is running */ + bool m_running = false; + + /** Whether or not it is interruptible*/ + bool m_interruptible = true; + + /** Whether or not it has been canceled */ + bool m_canceled = false; + + /** Whether or not it has been locked */ + bool m_locked = false; + + /** Whether this command should run when the robot is disabled */ + bool m_runWhenDisabled = false; + + /** The {@link CommandGroup} this is in */ + CommandGroup *m_parent = nullptr; + + int m_commandID = m_commandCounter++; + static int m_commandCounter; + + public: + virtual std::string GetName() const; + virtual void InitTable(std::shared_ptr table); + virtual std::shared_ptr GetTable() const; + virtual std::string GetSmartDashboardType() const; + virtual void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew); + + protected: + std::shared_ptr m_table; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/CommandGroup.h b/Robot2016/wpilib/cpp/current/include/Commands/CommandGroup.h new file mode 100644 index 0000000..309d591 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/CommandGroup.h @@ -0,0 +1,74 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __COMMAND_GROUP_H__ +#define __COMMAND_GROUP_H__ + +#include "Commands/Command.h" +#include "Commands/CommandGroupEntry.h" +#include +#include + +/** + * A {@link CommandGroup} is a list of commands which are executed in sequence. + * + *

Commands in a {@link CommandGroup} are added using the {@link + * CommandGroup#AddSequential(Command) AddSequential(...)} method + * and are called sequentially. + * {@link CommandGroup CommandGroups} are themselves {@link Command Commands} + * and can be given to other {@link CommandGroup CommandGroups}.

+ * + *

{@link CommandGroup CommandGroups} will carry all of the requirements of + * their {@link Command subcommands}. Additional + * requirements can be specified by calling {@link + *CommandGroup#Requires(Subsystem) Requires(...)} + * normally in the constructor.

+ * + *

CommandGroups can also execute commands in parallel, simply by adding them + * using {@link CommandGroup#AddParallel(Command) AddParallel(...)}.

+ * + * @see Command + * @see Subsystem + */ +class CommandGroup : public Command { + public: + CommandGroup() = default; + CommandGroup(const std::string &name); + virtual ~CommandGroup() = default; + + void AddSequential(Command *command); + void AddSequential(Command *command, double timeout); + void AddParallel(Command *command); + void AddParallel(Command *command, double timeout); + bool IsInterruptible() const; + int GetSize() const; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); + virtual void _Initialize(); + virtual void _Interrupted(); + virtual void _Execute(); + virtual void _End(); + + private: + void CancelConflicts(Command *command); + + /** The commands in this group (stored in entries) */ + std::vector m_commands; + + /** The active children in this group (stored in entries) */ + std::list m_children; + + /** The current command, -1 signifies that none have been run */ + int m_currentCommandIndex = -1; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/CommandGroupEntry.h b/Robot2016/wpilib/cpp/current/include/Commands/CommandGroupEntry.h new file mode 100644 index 0000000..fd9b387 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/CommandGroupEntry.h @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __COMMAND_GROUP_ENTRY_H__ +#define __COMMAND_GROUP_ENTRY_H__ + +class Command; + +class CommandGroupEntry { + public: + typedef enum { + kSequence_InSequence, + kSequence_BranchPeer, + kSequence_BranchChild + } Sequence; + + CommandGroupEntry() = default; + CommandGroupEntry(Command *command, Sequence state, double timeout = -1.0); + bool IsTimedOut() const; + + double m_timeout = -1.0; + Command *m_command = nullptr; + Sequence m_state = kSequence_InSequence; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/PIDCommand.h b/Robot2016/wpilib/cpp/current/include/Commands/PIDCommand.h new file mode 100644 index 0000000..b9fb2ca --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/PIDCommand.h @@ -0,0 +1,58 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __PID_COMMAND_H__ +#define __PID_COMMAND_H__ + +#include "Commands/Command.h" +#include "PIDController.h" +#include "PIDSource.h" +#include "PIDOutput.h" + +#include + +class PIDCommand : public Command, public PIDOutput, public PIDSource { + public: + PIDCommand(const std::string &name, double p, double i, double d); + PIDCommand(const std::string &name, double p, double i, double d, double period); + PIDCommand(const std::string &name, double p, double i, double d, double f, + double period); + PIDCommand(double p, double i, double d); + PIDCommand(double p, double i, double d, double period); + PIDCommand(double p, double i, double d, double f, double period); + virtual ~PIDCommand() = default; + + void SetSetpointRelative(double deltaSetpoint); + + // PIDOutput interface + virtual void PIDWrite(float output); + + // PIDSource interface + virtual double PIDGet(); + + protected: + std::shared_ptr GetPIDController() const; + virtual void _Initialize(); + virtual void _Interrupted(); + virtual void _End(); + void SetSetpoint(double setpoint); + double GetSetpoint() const; + double GetPosition(); + + virtual double ReturnPIDInput() = 0; + virtual void UsePIDOutput(double output) = 0; + + private: + /** The internal {@link PIDController} */ + std::shared_ptr m_controller; + + public: + virtual void InitTable(std::shared_ptr table); + virtual std::string GetSmartDashboardType() const; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/PIDSubsystem.h b/Robot2016/wpilib/cpp/current/include/Commands/PIDSubsystem.h new file mode 100644 index 0000000..fea1847 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/PIDSubsystem.h @@ -0,0 +1,76 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __PID_SUBSYSTEM_H__ +#define __PID_SUBSYSTEM_H__ + +#include "Commands/Subsystem.h" +#include "PIDController.h" +#include "PIDSource.h" +#include "PIDOutput.h" + +#include + +/** + * This class is designed to handle the case where there is a {@link Subsystem} + * which uses a single {@link PIDController} almost constantly (for instance, + * an elevator which attempts to stay at a constant height). + * + *

It provides some convenience methods to run an internal {@link + * PIDController}. + * It also allows access to the internal {@link PIDController} in order to give + * total control + * to the programmer.

+ * + */ +class PIDSubsystem : public Subsystem, public PIDOutput, public PIDSource { + public: + PIDSubsystem(const std::string &name, double p, double i, double d); + PIDSubsystem(const std::string &name, double p, double i, double d, double f); + PIDSubsystem(const std::string &name, double p, double i, double d, double f, + double period); + PIDSubsystem(double p, double i, double d); + PIDSubsystem(double p, double i, double d, double f); + PIDSubsystem(double p, double i, double d, double f, double period); + virtual ~PIDSubsystem() = default; + + void Enable(); + void Disable(); + + // PIDOutput interface + virtual void PIDWrite(float output); + + // PIDSource interface + virtual double PIDGet(); + void SetSetpoint(double setpoint); + void SetSetpointRelative(double deltaSetpoint); + void SetInputRange(float minimumInput, float maximumInput); + void SetOutputRange(float minimumOutput, float maximumOutput); + double GetSetpoint(); + double GetPosition(); + double GetRate(); + + virtual void SetAbsoluteTolerance(float absValue); + virtual void SetPercentTolerance(float percent); + virtual bool OnTarget() const; + + protected: + std::shared_ptr GetPIDController(); + + virtual double ReturnPIDInput() = 0; + virtual void UsePIDOutput(double output) = 0; + + private: + /** The internal {@link PIDController} */ + std::shared_ptr m_controller; + + public: + virtual void InitTable(std::shared_ptr table); + virtual std::string GetSmartDashboardType() const; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/PrintCommand.h b/Robot2016/wpilib/cpp/current/include/Commands/PrintCommand.h new file mode 100644 index 0000000..577252d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/PrintCommand.h @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __PRINT_COMMAND_H__ +#define __PRINT_COMMAND_H__ + +#include "Commands/Command.h" +#include + +class PrintCommand : public Command { + public: + PrintCommand(const std::string &message); + virtual ~PrintCommand() = default; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); + + private: + std::string m_message; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/Scheduler.h b/Robot2016/wpilib/cpp/current/include/Commands/Scheduler.h new file mode 100644 index 0000000..fc55256 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/Scheduler.h @@ -0,0 +1,70 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __SCHEDULER_H__ +#define __SCHEDULER_H__ + +#include "Commands/Command.h" +#include "ErrorBase.h" +#include "SmartDashboard/NamedSendable.h" +#include "networktables/NetworkTable.h" +#include "SmartDashboard/SmartDashboard.h" +#include +#include +#include +#include +#include +#include +#include "HAL/cpp/priority_mutex.h" + +class ButtonScheduler; +class Subsystem; + +class Scheduler : public ErrorBase, public NamedSendable { + public: + static Scheduler *GetInstance(); + + void AddCommand(Command *command); + void AddButton(ButtonScheduler *button); + void RegisterSubsystem(Subsystem *subsystem); + void Run(); + void Remove(Command *command); + void RemoveAll(); + void ResetAll(); + void SetEnabled(bool enabled); + + void UpdateTable(); + std::string GetSmartDashboardType() const; + void InitTable(std::shared_ptr subTable); + std::shared_ptr GetTable() const; + std::string GetName() const; + std::string GetType() const; + + private: + Scheduler(); + virtual ~Scheduler() = default; + + void ProcessCommandAddition(Command *command); + + Command::SubsystemSet m_subsystems; + priority_mutex m_buttonsLock; + typedef std::vector ButtonVector; + ButtonVector m_buttons; + typedef std::vector CommandVector; + priority_mutex m_additionsLock; + CommandVector m_additions; + typedef std::set CommandSet; + CommandSet m_commands; + bool m_adding = false; + bool m_enabled = true; + std::vector commands; + std::vector ids; + std::vector toCancel; + std::shared_ptr m_table; + bool m_runningCommandsChanged = false; +}; +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/StartCommand.h b/Robot2016/wpilib/cpp/current/include/Commands/StartCommand.h new file mode 100644 index 0000000..4f97971 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/StartCommand.h @@ -0,0 +1,29 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __START_COMMAND_H__ +#define __START_COMMAND_H__ + +#include "Commands/Command.h" + +class StartCommand : public Command { + public: + StartCommand(Command *commandToStart); + virtual ~StartCommand() = default; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); + + private: + Command *m_commandToFork; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/Subsystem.h b/Robot2016/wpilib/cpp/current/include/Commands/Subsystem.h new file mode 100644 index 0000000..070af48 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/Subsystem.h @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __SUBSYSTEM_H__ +#define __SUBSYSTEM_H__ + +#include "ErrorBase.h" +#include "SmartDashboard/NamedSendable.h" +#include +#include + +class Command; + +class Subsystem : public ErrorBase, public NamedSendable { + friend class Scheduler; + + public: + Subsystem(const std::string &name); + virtual ~Subsystem() = default; + + void SetDefaultCommand(Command *command); + Command *GetDefaultCommand(); + void SetCurrentCommand(Command *command); + Command *GetCurrentCommand() const; + virtual void InitDefaultCommand(); + + private: + void ConfirmCommand(); + + Command *m_currentCommand = nullptr; + bool m_currentCommandChanged = true; + Command *m_defaultCommand = nullptr; + std::string m_name; + bool m_initializedDefaultCommand = false; + + public: + virtual std::string GetName() const; + virtual void InitTable(std::shared_ptr table); + virtual std::shared_ptr GetTable() const; + virtual std::string GetSmartDashboardType() const; + + protected: + std::shared_ptr m_table; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/WaitCommand.h b/Robot2016/wpilib/cpp/current/include/Commands/WaitCommand.h new file mode 100644 index 0000000..fa64b75 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/WaitCommand.h @@ -0,0 +1,27 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __WAIT_COMMAND_H__ +#define __WAIT_COMMAND_H__ + +#include "Commands/Command.h" + +class WaitCommand : public Command { + public: + WaitCommand(double timeout); + WaitCommand(const std::string &name, double timeout); + virtual ~WaitCommand() = default; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/WaitForChildren.h b/Robot2016/wpilib/cpp/current/include/Commands/WaitForChildren.h new file mode 100644 index 0000000..5028cdb --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/WaitForChildren.h @@ -0,0 +1,27 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __WAIT_FOR_CHILDREN_H__ +#define __WAIT_FOR_CHILDREN_H__ + +#include "Commands/Command.h" + +class WaitForChildren : public Command { + public: + WaitForChildren(double timeout); + WaitForChildren(const std::string &name, double timeout); + virtual ~WaitForChildren() = default; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Commands/WaitUntilCommand.h b/Robot2016/wpilib/cpp/current/include/Commands/WaitUntilCommand.h new file mode 100644 index 0000000..2512a20 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Commands/WaitUntilCommand.h @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __WAIT_UNTIL_COMMAND_H__ +#define __WAIT_UNTIL_COMMAND_H__ + +#include "Commands/Command.h" + +class WaitUntilCommand : public Command { + public: + WaitUntilCommand(double time); + WaitUntilCommand(const std::string &name, double time); + virtual ~WaitUntilCommand() = default; + + protected: + virtual void Initialize(); + virtual void Execute(); + virtual bool IsFinished(); + virtual void End(); + virtual void Interrupted(); + + private: + double m_time; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Compressor.h b/Robot2016/wpilib/cpp/current/include/Compressor.h new file mode 100644 index 0000000..0d56ef7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Compressor.h @@ -0,0 +1,66 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef Compressor_H_ +#define Compressor_H_ + +#include "HAL/HAL.hpp" +#include "SensorBase.h" +#include "tables/ITableListener.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * PCM compressor + */ +class Compressor : public SensorBase, + public LiveWindowSendable, + public ITableListener { + public: + // Default PCM ID is 0 + explicit Compressor(uint8_t pcmID = GetDefaultSolenoidModule()); + virtual ~Compressor() = default; + + void Start(); + void Stop(); + bool Enabled() const; + + bool GetPressureSwitchValue() const; + + float GetCompressorCurrent() const; + + void SetClosedLoopControl(bool on); + bool GetClosedLoopControl() const; + + bool GetCompressorCurrentTooHighFault() const; + bool GetCompressorCurrentTooHighStickyFault() const; + bool GetCompressorShortedStickyFault() const; + bool GetCompressorShortedFault() const; + bool GetCompressorNotConnectedStickyFault() const; + bool GetCompressorNotConnectedFault() const; + void ClearAllPCMStickyFaults(); + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + + protected: + void *m_pcm_pointer; + + private: + void SetCompressor(bool on); + + std::shared_ptr m_table; +}; + +#endif /* Compressor_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/Controller.h b/Robot2016/wpilib/cpp/current/include/Controller.h new file mode 100644 index 0000000..bad16d6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Controller.h @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +/** + * Interface for Controllers + * Common interface for controllers. Controllers run control loops, the most + * common + * are PID controllers and their variants, but this includes anything that is + * controlling + * an actuator in a separate thread. + */ +class Controller { + public: + virtual ~Controller() = default; + + /** + * Allows the control loop to run + */ + virtual void Enable() = 0; + + /** + * Stops the control loop from running until explicitly re-enabled by calling + * enable() + */ + virtual void Disable() = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/ControllerPower.h b/Robot2016/wpilib/cpp/current/include/ControllerPower.h new file mode 100644 index 0000000..18367b5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ControllerPower.h @@ -0,0 +1,28 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __CONTROLLER_POWER_H__ +#define __CONTROLLER_POWER_H__ + +class ControllerPower { + public: + static double GetInputVoltage(); + static double GetInputCurrent(); + static double GetVoltage3V3(); + static double GetCurrent3V3(); + static bool GetEnabled3V3(); + static int GetFaultCount3V3(); + static double GetVoltage5V(); + static double GetCurrent5V(); + static bool GetEnabled5V(); + static int GetFaultCount5V(); + static double GetVoltage6V(); + static double GetCurrent6V(); + static bool GetEnabled6V(); + static int GetFaultCount6V(); +}; +#endif \ No newline at end of file diff --git a/Robot2016/wpilib/cpp/current/include/Counter.h b/Robot2016/wpilib/cpp/current/include/Counter.h new file mode 100644 index 0000000..3cb55b5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Counter.h @@ -0,0 +1,108 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "AnalogTriggerOutput.h" +#include "CounterBase.h" +#include "SensorBase.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +class DigitalGlitchFilter; + +/** + * Class for counting the number of ticks on a digital input channel. + * This is a general purpose class for counting repetitive events. It can return + * the number + * of counts, the period of the most recent cycle, and detect when the signal + * being counted + * has stopped by supplying a maximum cycle time. + * + * All counters will immediately start counting - Reset() them if you need them + * to be zeroed before use. + */ +class Counter : public SensorBase, + public CounterBase, + public LiveWindowSendable { + public: + explicit Counter(Mode mode = kTwoPulse); + explicit Counter(int32_t channel); + explicit Counter(DigitalSource *source); + explicit Counter(std::shared_ptr source); + DEPRECATED("Use pass-by-reference instead.") + explicit Counter(AnalogTrigger *trigger); + explicit Counter(const AnalogTrigger &trigger); + Counter(EncodingType encodingType, DigitalSource *upSource, + DigitalSource *downSource, bool inverted); + Counter(EncodingType encodingType, std::shared_ptr upSource, + std::shared_ptr downSource, bool inverted); + virtual ~Counter(); + + void SetUpSource(int32_t channel); + void SetUpSource(AnalogTrigger *analogTrigger, AnalogTriggerType triggerType); + void SetUpSource(std::shared_ptr analogTrigger, + AnalogTriggerType triggerType); + void SetUpSource(DigitalSource *source); + void SetUpSource(std::shared_ptr source); + void SetUpSource(DigitalSource &source); + void SetUpSourceEdge(bool risingEdge, bool fallingEdge); + void ClearUpSource(); + + void SetDownSource(int32_t channel); + void SetDownSource(AnalogTrigger *analogTrigger, + AnalogTriggerType triggerType); + void SetDownSource(std::shared_ptr analogTrigger, + AnalogTriggerType triggerType); + void SetDownSource(DigitalSource *source); + void SetDownSource(std::shared_ptr source); + void SetDownSource(DigitalSource &source); + void SetDownSourceEdge(bool risingEdge, bool fallingEdge); + void ClearDownSource(); + + void SetUpDownCounterMode(); + void SetExternalDirectionMode(); + void SetSemiPeriodMode(bool highSemiPeriod); + void SetPulseLengthMode(float threshold); + + void SetReverseDirection(bool reverseDirection); + + // CounterBase interface + int32_t Get() const override; + void Reset() override; + double GetPeriod() const override; + void SetMaxPeriod(double maxPeriod) override; + void SetUpdateWhenEmpty(bool enabled); + bool GetStopped() const override; + bool GetDirection() const override; + + void SetSamplesToAverage(int samplesToAverage); + int GetSamplesToAverage() const; + uint32_t GetFPGAIndex() const { return m_index; } + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + virtual std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + protected: + // Makes the counter count up. + std::shared_ptr m_upSource; + // Makes the counter count down. + std::shared_ptr m_downSource; + // The FPGA counter object + void *m_counter = nullptr; ///< The FPGA counter object. + private: + uint32_t m_index = 0; ///< The index of this counter. + + std::shared_ptr m_table; + friend class DigitalGlitchFilter; +}; diff --git a/Robot2016/wpilib/cpp/current/include/CounterBase.h b/Robot2016/wpilib/cpp/current/include/CounterBase.h new file mode 100644 index 0000000..633b795 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/CounterBase.h @@ -0,0 +1,31 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +/** + * Interface for counting the number of ticks on a digital input channel. + * Encoders, Gear tooth sensors, and counters should all subclass this so it can + * be used to build more advanced classes for control and driving. + * + * All counters will immediately start counting - Reset() them if you need them + * to be zeroed before use. + */ +class CounterBase { + public: + enum EncodingType { k1X, k2X, k4X }; + + virtual ~CounterBase() = default; + virtual int32_t Get() const = 0; + virtual void Reset() = 0; + virtual double GetPeriod() const = 0; + virtual void SetMaxPeriod(double maxPeriod) = 0; + virtual bool GetStopped() const = 0; + virtual bool GetDirection() const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DigitalGlitchFilter.h b/Robot2016/wpilib/cpp/current/include/DigitalGlitchFilter.h new file mode 100644 index 0000000..0f9e676 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DigitalGlitchFilter.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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 + +#include "HAL/cpp/priority_mutex.h" +#include "DigitalSource.h" + +class Encoder; +class Counter; + +/** + * Class to enable glitch filtering on a set of digital inputs. + * This class will manage adding and removing digital inputs from a FPGA glitch + * filter. The filter lets the user configure the time that an input must remain + * high or low before it is classified as high or low. + */ +class DigitalGlitchFilter : public SensorBase { + public: + DigitalGlitchFilter(); + ~DigitalGlitchFilter(); + + void Add(DigitalSource *input); + void Add(Encoder *input); + void Add(Counter *input); + + void Remove(DigitalSource *input); + void Remove(Encoder *input); + void Remove(Counter *input); + + void SetPeriodCycles(uint32_t fpga_cycles); + void SetPeriodNanoSeconds(uint64_t nanoseconds); + + uint32_t GetPeriodCycles(); + uint64_t GetPeriodNanoSeconds(); + + private: + // Sets the filter for the input to be the requested index. A value of 0 + // disables the filter, and the filter value must be between 1 and 3, + // inclusive. + void DoAdd(DigitalSource *input, int requested_index); + + int m_channelIndex = -1; + static priority_mutex m_mutex; + static ::std::array m_filterAllocated; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DigitalInput.h b/Robot2016/wpilib/cpp/current/include/DigitalInput.h new file mode 100644 index 0000000..96a70a0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DigitalInput.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "DigitalSource.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include +#include + +class DigitalGlitchFilter; + +/** + * Class to read a digital input. + * This class will read digital inputs and return the current value on the + * channel. Other devices + * such as encoders, gear tooth sensors, etc. that are implemented elsewhere + * will automatically + * allocate digital inputs and outputs as required. This class is only for + * devices like switches + * etc. that aren't implemented anywhere else. + */ +class DigitalInput : public DigitalSource, public LiveWindowSendable { + public: + explicit DigitalInput(uint32_t channel); + virtual ~DigitalInput(); + bool Get() const; + uint32_t GetChannel() const; + + // Digital Source Interface + virtual uint32_t GetChannelForRouting() const; + virtual uint32_t GetModuleForRouting() const; + virtual bool GetAnalogTriggerForRouting() const; + + void UpdateTable(); + void StartLiveWindowMode(); + void StopLiveWindowMode(); + std::string GetSmartDashboardType() const; + void InitTable(std::shared_ptr subTable); + std::shared_ptr GetTable() const; + + private: + uint32_t m_channel; + + std::shared_ptr m_table; + friend class DigitalGlitchFilter; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DigitalOutput.h b/Robot2016/wpilib/cpp/current/include/DigitalOutput.h new file mode 100644 index 0000000..e8bb514 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DigitalOutput.h @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "DigitalSource.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITableListener.h" + +#include + +/** + * Class to write to digital outputs. + * Write values to the digital output channels. Other devices implemented + * elsewhere will allocate + * channels automatically so for those devices it shouldn't be done here. + */ +class DigitalOutput : public DigitalSource, + public ITableListener, + public LiveWindowSendable { + public: + explicit DigitalOutput(uint32_t channel); + virtual ~DigitalOutput(); + void Set(uint32_t value); + uint32_t GetChannel() const; + void Pulse(float length); + bool IsPulsing() const; + void SetPWMRate(float rate); + void EnablePWM(float initialDutyCycle); + void DisablePWM(); + void UpdateDutyCycle(float dutyCycle); + + // Digital Source Interface + virtual uint32_t GetChannelForRouting() const; + virtual uint32_t GetModuleForRouting() const; + virtual bool GetAnalogTriggerForRouting() const; + + virtual void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew); + void UpdateTable(); + void StartLiveWindowMode(); + void StopLiveWindowMode(); + std::string GetSmartDashboardType() const; + void InitTable(std::shared_ptr subTable); + std::shared_ptr GetTable() const; + + private: + uint32_t m_channel; + void *m_pwmGenerator; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DigitalSource.h b/Robot2016/wpilib/cpp/current/include/DigitalSource.h new file mode 100644 index 0000000..d85102b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DigitalSource.h @@ -0,0 +1,28 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "InterruptableSensorBase.h" + +/** + * DigitalSource Interface. + * The DigitalSource represents all the possible inputs for a counter or a + * quadrature encoder. The source may be + * either a digital input or an analog input. If the caller just provides a + * channel, then a digital input will be + * constructed and freed when finished for the source. The source can either be + * a digital input or analog trigger + * but not both. + */ +class DigitalSource : public InterruptableSensorBase { + public: + virtual ~DigitalSource() = default; + virtual uint32_t GetChannelForRouting() const = 0; + virtual uint32_t GetModuleForRouting() const = 0; + virtual bool GetAnalogTriggerForRouting() const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DoubleSolenoid.h b/Robot2016/wpilib/cpp/current/include/DoubleSolenoid.h new file mode 100644 index 0000000..9d1f033 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DoubleSolenoid.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SolenoidBase.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITableListener.h" + +#include + +/** + * DoubleSolenoid class for running 2 channels of high voltage Digital Output + * (PCM). + * + * The DoubleSolenoid class is typically used for pneumatics solenoids that + * have two positions controlled by two separate channels. + */ +class DoubleSolenoid : public SolenoidBase, + public LiveWindowSendable, + public ITableListener { + public: + enum Value { kOff, kForward, kReverse }; + + explicit DoubleSolenoid(uint32_t forwardChannel, uint32_t reverseChannel); + DoubleSolenoid(uint8_t moduleNumber, uint32_t forwardChannel, + uint32_t reverseChannel); + virtual ~DoubleSolenoid(); + virtual void Set(Value value); + virtual Value Get() const; + bool IsFwdSolenoidBlackListed() const; + bool IsRevSolenoidBlackListed() const; + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew); + void UpdateTable(); + void StartLiveWindowMode(); + void StopLiveWindowMode(); + std::string GetSmartDashboardType() const; + void InitTable(std::shared_ptr subTable); + std::shared_ptr GetTable() const; + + private: + uint32_t m_forwardChannel; ///< The forward channel on the module to control. + uint32_t m_reverseChannel; ///< The reverse channel on the module to control. + uint8_t m_forwardMask; ///< The mask for the forward channel. + uint8_t m_reverseMask; ///< The mask for the reverse channel. + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/DriverStation.h b/Robot2016/wpilib/cpp/current/include/DriverStation.h new file mode 100644 index 0000000..cbbbdef --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/DriverStation.h @@ -0,0 +1,118 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SensorBase.h" +#include "RobotState.h" +#include "Task.h" +#include "HAL/HAL.hpp" +#include "HAL/cpp/Semaphore.hpp" +#include "HAL/cpp/priority_mutex.h" +#include "HAL/cpp/priority_condition_variable.h" +#include +#include + +struct HALControlWord; +class AnalogInput; + +/** + * Provide access to the network communication data to / from the Driver + * Station. + */ +class DriverStation : public SensorBase, public RobotStateInterface { + public: + enum Alliance { kRed, kBlue, kInvalid }; + + virtual ~DriverStation(); + static DriverStation &GetInstance(); + static void ReportError(std::string error); + + static const uint32_t kJoystickPorts = 6; + + float GetStickAxis(uint32_t stick, uint32_t axis); + int GetStickPOV(uint32_t stick, uint32_t pov); + uint32_t GetStickButtons(uint32_t stick) const; + bool GetStickButton(uint32_t stick, uint8_t button); + + int GetStickAxisCount(uint32_t stick) const; + int GetStickPOVCount(uint32_t stick) const; + int GetStickButtonCount(uint32_t stick) const; + + bool GetJoystickIsXbox(uint32_t stick) const; + int GetJoystickType(uint32_t stick) const; + std::string GetJoystickName(uint32_t stick) const; + int GetJoystickAxisType(uint32_t stick, uint8_t axis) const; + + bool IsEnabled() const override; + bool IsDisabled() const override; + bool IsAutonomous() const override; + bool IsOperatorControl() const override; + bool IsTest() const override; + bool IsDSAttached() const; + bool IsNewControlData() const; + bool IsFMSAttached() const; + bool IsSysActive() const; + bool IsSysBrownedOut() const; + + Alliance GetAlliance() const; + uint32_t GetLocation() const; + void WaitForData(); + double GetMatchTime() const; + float GetBatteryVoltage() const; + + /** Only to be used to tell the Driver Station what code you claim to be + * executing + * for diagnostic purposes only + * @param entering If true, starting disabled code; if false, leaving disabled + * code */ + void InDisabled(bool entering) { m_userInDisabled = entering; } + /** Only to be used to tell the Driver Station what code you claim to be + * executing + * for diagnostic purposes only + * @param entering If true, starting autonomous code; if false, leaving + * autonomous code */ + void InAutonomous(bool entering) { m_userInAutonomous = entering; } + /** Only to be used to tell the Driver Station what code you claim to be + * executing + * for diagnostic purposes only + * @param entering If true, starting teleop code; if false, leaving teleop + * code */ + void InOperatorControl(bool entering) { m_userInTeleop = entering; } + /** Only to be used to tell the Driver Station what code you claim to be + * executing + * for diagnostic purposes only + * @param entering If true, starting test code; if false, leaving test code */ + void InTest(bool entering) { m_userInTest = entering; } + + protected: + DriverStation(); + + void GetData(); + + private: + static DriverStation *m_instance; + void ReportJoystickUnpluggedError(std::string message); + void Run(); + + HALJoystickAxes m_joystickAxes[kJoystickPorts]; + HALJoystickPOVs m_joystickPOVs[kJoystickPorts]; + HALJoystickButtons m_joystickButtons[kJoystickPorts]; + HALJoystickDescriptor m_joystickDescriptor[kJoystickPorts]; + Task m_task; + std::atomic m_isRunning{false}; + mutable Semaphore m_newControlData{Semaphore::kEmpty}; + mutable priority_condition_variable m_packetDataAvailableCond; + priority_mutex m_packetDataAvailableMutex; + std::condition_variable_any m_waitForDataCond; + priority_mutex m_waitForDataMutex; + bool m_userInDisabled = false; + bool m_userInAutonomous = false; + bool m_userInTeleop = false; + bool m_userInTest = false; + double m_nextMessageTime = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Encoder.h b/Robot2016/wpilib/cpp/current/include/Encoder.h new file mode 100644 index 0000000..5c692f0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Encoder.h @@ -0,0 +1,114 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "CounterBase.h" +#include "SensorBase.h" +#include "Counter.h" +#include "PIDSource.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +class DigitalSource; +class DigitalGlitchFilter; + +/** + * Class to read quad encoders. + * Quadrature encoders are devices that count shaft rotation and can sense + * direction. The output of + * the QuadEncoder class is an integer that can count either up or down, and can + * go negative for + * reverse direction counting. When creating QuadEncoders, a direction is + * supplied that changes the + * sense of the output to make code more readable if the encoder is mounted such + * that forward movement + * generates negative values. Quadrature encoders have two digital outputs, an A + * Channel and a B Channel + * that are out of phase with each other to allow the FPGA to do direction + * sensing. + * + * All encoders will immediately start counting - Reset() them if you need them + * to be zeroed before use. + */ +class Encoder : public SensorBase, + public CounterBase, + public PIDSource, + public LiveWindowSendable { + public: + enum IndexingType { + kResetWhileHigh, + kResetWhileLow, + kResetOnFallingEdge, + kResetOnRisingEdge + }; + + Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection = false, + EncodingType encodingType = k4X); + Encoder(std::shared_ptr aSource, + std::shared_ptr bSource, + bool reverseDirection = false, EncodingType encodingType = k4X); + Encoder(DigitalSource *aSource, DigitalSource *bSource, + bool reverseDirection = false, EncodingType encodingType = k4X); + Encoder(DigitalSource &aSource, DigitalSource &bSource, + bool reverseDirection = false, EncodingType encodingType = k4X); + virtual ~Encoder(); + + // CounterBase interface + int32_t Get() const override; + int32_t GetRaw() const; + int32_t GetEncodingScale() const; + void Reset() override; + double GetPeriod() const override; + void SetMaxPeriod(double maxPeriod) override; + bool GetStopped() const override; + bool GetDirection() const override; + + double GetDistance() const; + double GetRate() const; + void SetMinRate(double minRate); + void SetDistancePerPulse(double distancePerPulse); + void SetReverseDirection(bool reverseDirection); + void SetSamplesToAverage(int samplesToAverage); + int GetSamplesToAverage() const; + double PIDGet() override; + + void SetIndexSource(uint32_t channel, IndexingType type = kResetOnRisingEdge); + DEPRECATED("Use pass-by-reference instead.") + void SetIndexSource(DigitalSource *source, + IndexingType type = kResetOnRisingEdge); + void SetIndexSource(const DigitalSource &source, + IndexingType type = kResetOnRisingEdge); + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + int32_t GetFPGAIndex() const { return m_index; } + + private: + void InitEncoder(bool _reverseDirection, EncodingType encodingType); + double DecodingScaleFactor() const; + + std::shared_ptr m_aSource; // the A phase of the quad encoder + std::shared_ptr m_bSource; // the B phase of the quad encoder + void *m_encoder = nullptr; + int32_t m_index = 0; // The encoder's FPGA index. + double m_distancePerPulse = 1.0; // distance of travel for each encoder tick + std::unique_ptr m_counter = + nullptr; // Counter object for 1x and 2x encoding + EncodingType m_encodingType; // Encoding type + int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType + + std::shared_ptr m_table; + friend class DigitalGlitchFilter; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Error.h b/Robot2016/wpilib/cpp/current/include/Error.h new file mode 100644 index 0000000..a001145 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Error.h @@ -0,0 +1,60 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" + +#ifdef _WIN32 + #include + //Windows.h defines #define GetMessage GetMessageW, which is stupid and we don't want it. + #undef GetMessage +#endif + +#include +#include +#include "llvm/StringRef.h" + +// Forward declarations +class ErrorBase; + +/** + * Error object represents a library error. + */ +class Error { + public: + typedef int32_t Code; + + Error() = default; + + Error(const Error&) = delete; + Error& operator=(const Error&) = delete; + + void Clone(const Error& error); + Code GetCode() const; + std::string GetMessage() const; + std::string GetFilename() const; + std::string GetFunction() const; + uint32_t GetLineNumber() const; + const ErrorBase* GetOriginatingObject() const; + double GetTimestamp() const; + void Clear(); + void Set(Code code, llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber, const ErrorBase* originatingObject); + + private: + void Report(); + + Code m_code = 0; + std::string m_message; + std::string m_filename; + std::string m_function; + uint32_t m_lineNumber = 0; + const ErrorBase* m_originatingObject = nullptr; + double m_timestamp = 0.0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/ErrorBase.h b/Robot2016/wpilib/cpp/current/include/ErrorBase.h new file mode 100644 index 0000000..756442d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ErrorBase.h @@ -0,0 +1,107 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" +#include "Error.h" + +#include "HAL/cpp/priority_mutex.h" +#include "llvm/StringRef.h" + +#define wpi_setErrnoErrorWithContext(context) \ + this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__) +#define wpi_setErrnoError() wpi_setErrnoErrorWithContext("") +#define wpi_setImaqErrorWithContext(code, context) \ + do { \ + if ((code) != 0) \ + this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ + } while (0) +#define wpi_setErrorWithContext(code, context) \ + do { \ + if ((code) != 0) \ + this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ + } while (0) +#define wpi_setError(code) wpi_setErrorWithContext(code, "") +#define wpi_setStaticErrorWithContext(object, code, context) \ + do { \ + if ((code) != 0) \ + object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \ + } while (0) +#define wpi_setStaticError(object, code) \ + wpi_setStaticErrorWithContext(object, code, "") +#define wpi_setGlobalErrorWithContext(code, context) \ + do { \ + if ((code) != 0) \ + ErrorBase::SetGlobalError((code), (context), __FILE__, __FUNCTION__, \ + __LINE__); \ + } while (0) +#define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "") +#define wpi_setWPIErrorWithContext(error, context) \ + this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \ + (context), __FILE__, __FUNCTION__, __LINE__) +#define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, "")) +#define wpi_setStaticWPIErrorWithContext(object, error, context) \ + object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \ + __FUNCTION__, __LINE__) +#define wpi_setStaticWPIError(object, error) \ + wpi_setStaticWPIErrorWithContext(object, error, "") +#define wpi_setGlobalWPIErrorWithContext(error, context) \ + ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), __FILE__, \ + __FUNCTION__, __LINE__) +#define wpi_setGlobalWPIError(error) \ + wpi_setGlobalWPIErrorWithContext(error, "") + +/** + * Base class for most objects. + * ErrorBase is the base class for most objects since it holds the generated + * error + * for that object. In addition, there is a single instance of a global error + * object + */ +class ErrorBase { + // TODO: Consider initializing instance variables and cleanup in destructor + public: + ErrorBase() = default; + virtual ~ErrorBase() = default; + + ErrorBase(const ErrorBase&) = delete; + ErrorBase& operator=(const ErrorBase&) = delete; + + virtual Error& GetError(); + virtual const Error& GetError() const; + virtual void SetErrnoError(llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber) const; + virtual void SetImaqError(int success, llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber) const; + virtual void SetError(Error::Code code, llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber) const; + virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code, + llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber) const; + virtual void CloneError(const ErrorBase& rhs) const; + virtual void ClearError() const; + virtual bool StatusIsFatal() const; + static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage, + llvm::StringRef filename, llvm::StringRef function, + uint32_t lineNumber); + static void SetGlobalWPIError(llvm::StringRef errorMessage, + llvm::StringRef contextMessage, + llvm::StringRef filename, + llvm::StringRef function, uint32_t lineNumber); + static Error& GetGlobalError(); + + protected: + mutable Error m_error; + // TODO: Replace globalError with a global list of all errors. + static priority_mutex _globalErrorMutex; + static Error _globalError; +}; diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/FRC_FPGA_ChipObject_Aliases.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/FRC_FPGA_ChipObject_Aliases.h new file mode 100644 index 0000000..8d46bea --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/FRC_FPGA_ChipObject_Aliases.h @@ -0,0 +1,10 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __FRC_FPGA_ChipObject_Aliases_h__ +#define __FRC_FPGA_ChipObject_Aliases_h__ + +#define nRuntimeFPGANamespace nFRC_2012_1_6_4 +#define nInvariantFPGANamespace nFRC_C0EF_1_1_0 + +#endif // __FRC_FPGA_ChipObject_Aliases_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h new file mode 100644 index 0000000..0af4e70 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h @@ -0,0 +1,9 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__ +#define __RoboRIO_FRC_ChipObject_Aliases_h__ + +#define nRoboRIO_FPGANamespace nFRC_2016_16_1_0 + +#endif // __RoboRIO_FRC_ChipObject_Aliases_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/fpgainterfacecapi/NiFpga.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/fpgainterfacecapi/NiFpga.h new file mode 100644 index 0000000..96492f6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/fpgainterfacecapi/NiFpga.h @@ -0,0 +1,2459 @@ +/* + * FPGA Interface C API 15.0 header file. + * + * Copyright (c) 2015, + * National Instruments Corporation. + * All rights reserved. + */ + +#ifndef __NiFpga_h__ +#define __NiFpga_h__ + +/* + * Determine platform details. + */ +#if defined(_M_IX86) \ + || defined(_M_X64) \ + || defined(_M_AMD64) \ + || defined(i386) \ + || defined(__i386) \ + || defined(__i386__) \ + || defined(__i486__) \ + || defined(__i586__) \ + || defined(__i686__) \ + || defined(__amd64__) \ + || defined(__amd64) \ + || defined(__x86_64__) \ + || defined(__x86_64) \ + || defined(__IA32__) \ + || defined(_X86_) \ + || defined(__THW_INTEL__) \ + || defined(__I86__) \ + || defined(__INTEL__) \ + || defined(__X86__) \ + || defined(__386__) \ + || defined(__I86__) \ + || defined(M_I386) \ + || defined(M_I86) \ + || defined(_M_I386) \ + || defined(_M_I86) + #if defined(_WIN32) \ + || defined(_WIN64) \ + || defined(__WIN32__) \ + || defined(__TOS_WIN__) \ + || defined(__WINDOWS__) \ + || defined(_WINDOWS) \ + || defined(__WINDOWS_386__) \ + || defined(__CYGWIN__) + /* Either Windows or Phar Lap ETS. */ + #define NiFpga_Windows 1 + #elif defined(__linux__) \ + || defined(__linux) \ + || defined(linux) \ + || defined(__gnu_linux__) + #define NiFpga_Linux 1 + #elif defined(__APPLE__) && defined(__MACH__) + #define NiFpga_MacOsX 1 + #else + #error Unsupported OS. + #endif +#elif defined(__powerpc) \ + || defined(__powerpc__) \ + || defined(__POWERPC__) \ + || defined(__ppc__) \ + || defined(__PPC) \ + || defined(_M_PPC) \ + || defined(_ARCH_PPC) \ + || defined(__PPC__) \ + || defined(__ppc) + #if defined(__vxworks) + #define NiFpga_VxWorks 1 + #else + #error Unsupported OS. + #endif +#elif defined(__arm__) \ + || defined(__thumb__) \ + || defined(__TARGET_ARCH_ARM) \ + || defined(__TARGET_ARCH_THUMB) \ + || defined(_ARM) \ + || defined(_M_ARM) \ + || defined(_M_ARMT) +#if defined(__linux__) \ + || defined(__linux) \ + || defined(linux) \ + || defined(__gnu_linux__) + #define NiFpga_Linux 1 +#else + #error Unsupported OS. + #endif +#else + #error Unsupported architecture. +#endif + +/* + * Determine compiler. + */ +#if defined(_MSC_VER) + #define NiFpga_Msvc 1 +#elif defined(__GNUC__) + #define NiFpga_Gcc 1 +#elif defined(_CVI_) && !defined(_TPC_) + #define NiFpga_Cvi 1 + /* Enables CVI Library Protection Errors. */ + #pragma EnableLibraryRuntimeChecking +#else + /* Unknown compiler. */ +#endif + +/* + * Determine compliance with different C/C++ language standards. + */ +#if defined(__cplusplus) + #define NiFpga_Cpp 1 + #if __cplusplus >= 199707L + #define NiFpga_Cpp98 1 + #if __cplusplus >= 201103L + #define NiFpga_Cpp11 1 + #endif + #endif +#endif +#if defined(__STDC__) + #define NiFpga_C89 1 + #if defined(__STDC_VERSION__) + #define NiFpga_C90 1 + #if __STDC_VERSION__ >= 199409L + #define NiFpga_C94 1 + #if __STDC_VERSION__ >= 199901L + #define NiFpga_C99 1 + #if __STDC_VERSION__ >= 201112L + #define NiFpga_C11 1 + #endif + #endif + #endif + #endif +#endif + +/* + * Determine ability to inline functions. + */ +#if NiFpga_Cpp || NiFpga_C99 + /* The inline keyword exists in C++ and C99. */ +#define NiFpga_Inline inline +#elif NiFpga_Msvc + /* Visual C++ (at least since 6.0) also supports an alternate keyword. */ + #define NiFpga_Inline __inline +#elif NiFpga_Gcc + /* GCC (at least since 2.95.2) also supports an alternate keyword. */ + #define NiFpga_Inline __inline__ +#elif !defined(NiFpga_Inline) + /* + * Disable inlining if inline support is unknown. To manually enable + * inlining, #define the following macro before #including NiFpga.h: + * + * #define NiFpga_Inline inline + */ + #define NiFpga_Inline +#endif + +/* + * Define exact-width integer types, if they have not already been defined. + */ +#if NiFpga_ExactWidthIntegerTypesDefined \ + || defined(_STDINT) \ + || defined(_STDINT_H) \ + || defined(_STDINT_H_) \ + || defined(_INTTYPES_H) \ + || defined(_INTTYPES_H_) \ + || defined(_SYS_STDINT_H) \ + || defined(_SYS_STDINT_H_) \ + || defined(_SYS_INTTYPES_H) \ + || defined(_SYS_INTTYPES_H_) \ + || defined(_STDINT_H_INCLUDED) \ + || defined(_MSC_STDINT_H_) \ + || defined(_PSTDINT_H_INCLUDED) + /* Assume that exact-width integer types have already been defined. */ +#elif NiFpga_VxWorks + /* VxWorks (at least 6.3 and earlier) did not have stdint.h. */ + #include +#elif NiFpga_C99 \ + || NiFpga_Gcc /* GCC (at least since 3.0) has a stdint.h. */ \ + || defined(HAVE_STDINT_H) + /* Assume that stdint.h can be included. */ + #include +#elif NiFpga_Msvc \ + || NiFpga_Cvi + /* Manually define exact-width integer types. */ + typedef signed char int8_t; + typedef unsigned char uint8_t; + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +#else + /* + * Exact-width integer types must be defined by the user, and the following + * macro must be #defined, before #including NiFpga.h: + * + * #define NiFpga_ExactWidthIntegerTypesDefined 1 + */ + #error Exact-width integer types must be defined by the user. See comment. +#endif + +/* Included for definition of size_t. */ +#include + +#if NiFpga_Cpp +extern "C" +{ +#endif + +/** + * A boolean value; either NiFpga_False or NiFpga_True. + */ +typedef uint8_t NiFpga_Bool; + +/** + * Represents a false condition. + */ +static const NiFpga_Bool NiFpga_False = 0; + +/** + * Represents a true condition. + */ +static const NiFpga_Bool NiFpga_True = 1; + +/** + * Represents the resulting status of a function call through its return value. + * 0 is success, negative values are errors, and positive values are warnings. + */ +typedef int32_t NiFpga_Status; + +/** + * No errors or warnings. + */ +static const NiFpga_Status NiFpga_Status_Success = 0; + +/** + * The timeout expired before the FIFO operation could complete. + */ +static const NiFpga_Status NiFpga_Status_FifoTimeout = -50400; + +/** + * No transfer is in progress because the transfer was aborted by the client. + * The operation could not be completed as specified. + */ +static const NiFpga_Status NiFpga_Status_TransferAborted = -50405; + +/** + * A memory allocation failed. Try again after rebooting. + */ +static const NiFpga_Status NiFpga_Status_MemoryFull = -52000; + +/** + * An unexpected software error occurred. + */ +static const NiFpga_Status NiFpga_Status_SoftwareFault = -52003; + +/** + * A parameter to a function was not valid. This could be a NULL pointer, a bad + * value, etc. + */ +static const NiFpga_Status NiFpga_Status_InvalidParameter = -52005; + +/** + * A required resource was not found. The NiFpga.* library, the RIO resource, or + * some other resource may be missing. + */ +static const NiFpga_Status NiFpga_Status_ResourceNotFound = -52006; + +/** + * A required resource was not properly initialized. This could occur if + * NiFpga_Initialize was not called or a required NiFpga_IrqContext was not + * reserved. + */ +static const NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010; + +/** + * A hardware failure has occurred. The operation could not be completed as + * specified. + */ +static const NiFpga_Status NiFpga_Status_HardwareFault = -52018; + +/** + * The FPGA is already running. + */ +static const NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003; + +/** + * An error occurred downloading the VI to the FPGA device. Verify that + * the target is connected and powered and that the resource of the target + * is properly configured. + */ +static const NiFpga_Status NiFpga_Status_DownloadError = -61018; + +/** + * The bitfile was not compiled for the specified resource's device type. + */ +static const NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024; + +/** + * An error was detected in the communication between the host computer and the + * FPGA target. + */ +static const NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046; + +/** + * The timeout expired before any of the IRQs were asserted. + */ +static const NiFpga_Status NiFpga_Status_IrqTimeout = -61060; + +/** + * The specified bitfile is invalid or corrupt. + */ +static const NiFpga_Status NiFpga_Status_CorruptBitfile = -61070; + +/** + * The requested FIFO depth is invalid. It is either 0 or an amount not + * supported by the hardware. + */ +static const NiFpga_Status NiFpga_Status_BadDepth = -61072; + +/** + * The number of FIFO elements is invalid. Either the number is greater than the + * depth of the host memory DMA FIFO, or more elements were requested for + * release than had been acquired. + */ +static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073; + +/** + * A hardware clocking error occurred. A derived clock lost lock with its base + * clock during the execution of the LabVIEW FPGA VI. If any base clocks with + * derived clocks are referencing an external source, make sure that the + * external source is connected and within the supported frequency, jitter, + * accuracy, duty cycle, and voltage specifications. Also verify that the + * characteristics of the base clock match the configuration specified in the + * FPGA Base Clock Properties. If all base clocks with derived clocks are + * generated from free-running, on-board sources, please contact National + * Instruments technical support at ni.com/support. + */ +static const NiFpga_Status NiFpga_Status_ClockLostLock = -61083; + +/** + * The operation could not be performed because the FPGA is busy. Stop all + * activities on the FPGA before requesting this operation. If the target is in + * Scan Interface programming mode, put it in FPGA Interface programming mode. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusy = -61141; + +/** + * The operation could not be performed because the FPGA is busy operating in + * FPGA Interface C API mode. Stop all activities on the FPGA before requesting + * this operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200; + +/** + * The chassis is in Scan Interface programming mode. In order to run FPGA VIs, + * you must go to the chassis properties page, select FPGA programming mode, and + * deploy settings. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201; + +/** + * The operation could not be performed because the FPGA is busy operating in + * FPGA Interface mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202; + +/** + * The operation could not be performed because the FPGA is busy operating in + * Interactive mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203; + +/** + * The operation could not be performed because the FPGA is busy operating in + * Emulation mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204; + +/** + * LabVIEW FPGA does not support the Reset method for bitfiles that allow + * removal of implicit enable signals in single-cycle Timed Loops. + */ +static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval = -61211; + +/** + * LabVIEW FPGA does not support the Abort method for bitfiles that allow + * removal of implicit enable signals in single-cycle Timed Loops. + */ +static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval = -61212; + +/** + * LabVIEW FPGA does not support Close and Reset if Last Reference for bitfiles + * that allow removal of implicit enable signals in single-cycle Timed Loops. + * Pass the NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close + * instead of 0. + */ +static const NiFpga_Status NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213; + +/** + * For bitfiles that allow removal of implicit enable signals in single-cycle + * Timed Loops, LabVIEW FPGA does not support this method prior to running the + * bitfile. + */ +static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun = -61214; + +/** + * Bitfiles that allow removal of implicit enable signals in single-cycle Timed + * Loops can run only once. Download the bitfile again before re-running the VI. + */ +static const NiFpga_Status NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215; + +/** + * A gated clock has violated the handshaking protocol. If you are using + * external gated clocks, ensure that they follow the required clock gating + * protocol. If you are generating your clocks internally, please contact + * National Instruments Technical Support. + */ +static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216; + +/** + * The number of elements requested must be less than or equal to the number of + * unacquired elements left in the host memory DMA FIFO. There are currently + * fewer unacquired elements left in the FIFO than are being requested. Release + * some acquired elements before acquiring more elements. + */ +static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired = -61219; + +/** + * The operation could not be performed because the FPGA is in configuration or + * discovery mode. Wait for configuration or discovery to complete and retry + * your operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252; + +/** + * An unexpected internal error occurred. + */ +static const NiFpga_Status NiFpga_Status_InternalError = -61499; + +/** + * The NI-RIO driver was unable to allocate memory for a FIFO. This can happen + * when the combined depth of all DMA FIFOs exceeds the maximum depth for the + * controller, or when the controller runs out of system memory. You may be able + * to reconfigure the controller with a greater maximum FIFO depth. For more + * information, refer to the NI KnowledgeBase article 65OF2ERQ. + */ +static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003; + +/** + * Access to the remote system was denied. Use MAX to check the Remote Device + * Access settings under Software>>NI-RIO>>NI-RIO Settings on the remote system. + */ +static const NiFpga_Status NiFpga_Status_AccessDenied = -63033; + +/** + * The NI-RIO software on the host is not compatible with the software on the + * target. Upgrade the NI-RIO software on the host in order to connect to this + * target. + */ +static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038; + +/** + * A connection could not be established to the specified remote device. Ensure + * that the device is on and accessible over the network, that NI-RIO software + * is installed, and that the RIO server is running and properly configured. + */ +static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040; + +/** + * The RPC session is invalid. The target may have reset or been rebooted. Check + * the network connection and retry the operation. + */ +static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043; + +/** + * The operation could not complete because another session is accessing the + * FIFO. Close the other session and retry. + */ +static const NiFpga_Status NiFpga_Status_FifoReserved = -63082; + +/** + * A Configure FIFO, Stop FIFO, Read FIFO, or Write FIFO function was called + * while the host had acquired elements of the FIFO. Release all acquired + * elements before configuring, stopping, reading, or writing. + */ +static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083; + +/** + * A function was called using a misaligned address. The address must be a + * multiple of the size of the datatype. + */ +static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084; + +/** + * The FPGA Read/Write Control Function is accessing a control or indicator + * with data that exceeds the maximum size supported on the current target. + * Refer to the hardware documentation for the limitations on data types for + * this target. + */ +static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085; + +/** + * A valid .lvbitx bitfile is required. If you are using a valid .lvbitx + * bitfile, the bitfile may not be compatible with the software you are using. + * Determine which version of LabVIEW was used to make the bitfile, update your + * software to that version or later, and try again. + */ +static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101; + +/** + * The specified signature does not match the signature of the bitfile. If the + * bitfile has been recompiled, regenerate the C API and rebuild the + * application. + */ +static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106; + +/** + * The bitfile you are trying to use is incompatible with the version + * of NI-RIO installed on the target and/or host. Update the version + * of NI-RIO on the target and/or host to the same version (or later) + * used to compile the bitfile. Alternatively, recompile the bitfile + * with the same version of NI-RIO that is currently installed on the + * target and/or host. + */ +static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107; + +/** + * Either the supplied resource name is invalid as a RIO resource name, or the + * device was not found. Use MAX to find the proper resource name for the + * intended device. + */ +static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192; + +/** + * The requested feature is not supported. + */ +static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193; + +/** + * The NI-RIO software on the target system is not compatible with this + * software. Upgrade the NI-RIO software on the target system. + */ +static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194; + +/** + * The session is invalid or has been closed. + */ +static const NiFpga_Status NiFpga_Status_InvalidSession = -63195; + +/** + * The maximum number of open FPGA sessions has been reached. Close some open + * sessions. + */ +static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198; + +/** + * Tests whether a status is an error. + * + * @param status status to check for an error + * @return whether the status was an error + */ +static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) +{ + return status < NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +} + +/** + * Tests whether a status is not an error. Success and warnings are not errors. + * + * @param status status to check for an error + * @return whether the status was a success or warning + */ +static NiFpga_Inline NiFpga_Bool NiFpga_IsNotError(const NiFpga_Status status) +{ + return status >= NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +} + +/** + * Conditionally sets the status to a new value. The previous status is + * preserved unless the new status is more of an error, which means that + * warnings and errors overwrite successes, and errors overwrite warnings. New + * errors do not overwrite older errors, and new warnings do not overwrite + * older warnings. + * + * @param status status to conditionally set + * @param newStatus new status value that may be set + * @return the resulting status + */ +static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus( + NiFpga_Status* const status, + const NiFpga_Status newStatus) +{ + if (!status) + return NiFpga_Status_InvalidParameter; + if (NiFpga_IsNotError(*status) + && (*status == NiFpga_Status_Success || NiFpga_IsError(newStatus))) + *status = newStatus; + return *status; +} + +/** + * This macro evaluates the expression only if the status is not an error. The + * expression must evaluate to an NiFpga_Status, such as a call to any NiFpga_* + * function, because the status will be set to the returned status if the + * expression is evaluated. + * + * You can use this macro to mimic status chaining in LabVIEW, where the status + * does not have to be explicitly checked after each call. Such code may look + * like the following example. + * + * NiFpga_Status status = NiFpga_Status_Success; + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * + * @param status status to check for an error + * @param expression expression to call if the incoming status is not an error + */ +#define NiFpga_IfIsNotError(status, expression) \ + if (NiFpga_IsNotError(status)) \ + NiFpga_MergeStatus(&status, (expression)); \ + +/** + * You must call this function before all other function calls. This function + * loads the NiFpga library so that all the other functions will work. If this + * function succeeds, you must call NiFpga_Finalize after all other function + * calls. + * + * @warning This function is not thread safe. + * + * @return result of the call + */ +NiFpga_Status NiFpga_Initialize(void); + +/** + * You must call this function after all other function calls if + * NiFpga_Initialize succeeds. This function unloads the NiFpga library. + * + * @warning This function is not thread safe. + * + * @return result of the call + */ +NiFpga_Status NiFpga_Finalize(void); + +/** + * A handle to an FPGA session. + */ +typedef uint32_t NiFpga_Session; + +/** + * Attributes that NiFpga_Open accepts. + */ +typedef enum +{ + NiFpga_OpenAttribute_NoRun = 1 +} NiFpga_OpenAttribute; + +/** + * Opens a session to the FPGA. This call ensures that the contents of the + * bitfile are programmed to the FPGA. The FPGA runs unless the + * NiFpga_OpenAttribute_NoRun attribute is used. + * + * Because different operating systems have different default current working + * directories for applications, you must pass an absolute path for the bitfile + * parameter. If you pass only the filename instead of an absolute path, the + * operating system may not be able to locate the bitfile. For example, the + * default current working directories are C:\ni-rt\system\ for Phar Lap ETS and + * /c/ for VxWorks. Because the generated *_Bitfile constant is a #define to a + * string literal, you can use C/C++ string-literal concatenation to form an + * absolute path. For example, if the bitfile is in the root directory of a + * Phar Lap ETS system, pass the following for the bitfile parameter. + * + * "C:\\" NiFpga_MyApplication_Bitfile + * + * @param bitfile path to the bitfile + * @param signature signature of the bitfile + * @param resource RIO resource string to open ("RIO0" or "rio://mysystem/RIO") + * @param attribute bitwise OR of any NiFpga_OpenAttributes, or 0 + * @param session outputs the session handle, which must be closed when no + * longer needed + * @return result of the call + */ +NiFpga_Status NiFpga_Open(const char* bitfile, + const char* signature, + const char* resource, + uint32_t attribute, + NiFpga_Session* session); + +/** + * Attributes that NiFpga_Close accepts. + */ +typedef enum +{ + NiFpga_CloseAttribute_NoResetIfLastSession = 1 +} NiFpga_CloseAttribute; + +/** + * Closes the session to the FPGA. The FPGA resets unless either another session + * is still open or you use the NiFpga_CloseAttribute_NoResetIfLastSession + * attribute. + * + * @param session handle to a currently open session + * @param attribute bitwise OR of any NiFpga_CloseAttributes, or 0 + * @return result of the call + */ +NiFpga_Status NiFpga_Close(NiFpga_Session session, + uint32_t attribute); + +/** + * Attributes that NiFpga_Run accepts. + */ +typedef enum +{ + NiFpga_RunAttribute_WaitUntilDone = 1 +} NiFpga_RunAttribute; + +/** + * Runs the FPGA VI on the target. If you use NiFpga_RunAttribute_WaitUntilDone, + * NiFpga_Run blocks the thread until the FPGA finishes running. + * + * @param session handle to a currently open session + * @param attribute bitwise OR of any NiFpga_RunAttributes, or 0 + * @return result of the call + */ +NiFpga_Status NiFpga_Run(NiFpga_Session session, + uint32_t attribute); + +/** + * Aborts the FPGA VI. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Abort(NiFpga_Session session); + +/** + * Resets the FPGA VI. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Reset(NiFpga_Session session); + +/** + * Re-downloads the FPGA bitstream to the target. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Download(NiFpga_Session session); + +/** + * Reads a boolean value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, + uint32_t indicator, + NiFpga_Bool* value); + +/** + * Reads a signed 8-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, + uint32_t indicator, + int8_t* value); + +/** + * Reads an unsigned 8-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, + uint32_t indicator, + uint8_t* value); + +/** + * Reads a signed 16-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, + uint32_t indicator, + int16_t* value); + +/** + * Reads an unsigned 16-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, + uint32_t indicator, + uint16_t* value); + +/** + * Reads a signed 32-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, + uint32_t indicator, + int32_t* value); + +/** + * Reads an unsigned 32-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, + uint32_t indicator, + uint32_t* value); + +/** + * Reads a signed 64-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, + uint32_t indicator, + int64_t* value); + +/** + * Reads an unsigned 64-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, + uint32_t indicator, + uint64_t* value); + +/** + * Writes a boolean value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, + uint32_t control, + NiFpga_Bool value); + +/** + * Writes a signed 8-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, + uint32_t control, + int8_t value); + +/** + * Writes an unsigned 8-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, + uint32_t control, + uint8_t value); + +/** + * Writes a signed 16-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, + uint32_t control, + int16_t value); + +/** + * Writes an unsigned 16-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, + uint32_t control, + uint16_t value); + +/** + * Writes a signed 32-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, + uint32_t control, + int32_t value); + +/** + * Writes an unsigned 32-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, + uint32_t control, + uint32_t value); + +/** + * Writes a signed 64-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, + uint32_t control, + int64_t value); + +/** + * Writes an unsigned 64-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, + uint32_t control, + uint64_t value); + +/** + * Reads an entire array of boolean values from a given array indicator or + * control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, + uint32_t indicator, + NiFpga_Bool* array, + size_t size); + +/** + * Reads an entire array of signed 8-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, + uint32_t indicator, + int8_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 8-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, + uint32_t indicator, + uint8_t* array, + size_t size); + +/** + * Reads an entire array of signed 16-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, + uint32_t indicator, + int16_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 16-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, + uint32_t indicator, + uint16_t* array, + size_t size); + +/** + * Reads an entire array of signed 32-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, + uint32_t indicator, + int32_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 32-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, + uint32_t indicator, + uint32_t* array, + size_t size); + +/** + * Reads an entire array of signed 64-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, + uint32_t indicator, + int64_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 64-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, + uint32_t indicator, + uint64_t* array, + size_t size); + +/** + * Writes an entire array of boolean values to a given array control or + * indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, + uint32_t control, + const NiFpga_Bool* array, + size_t size); + +/** + * Writes an entire array of signed 8-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, + uint32_t control, + const int8_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 8-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, + uint32_t control, + const uint8_t* array, + size_t size); + +/** + * Writes an entire array of signed 16-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, + uint32_t control, + const int16_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 16-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, + uint32_t control, + const uint16_t* array, + size_t size); + +/** + * Writes an entire array of signed 32-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, + uint32_t control, + const int32_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 32-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, + uint32_t control, + const uint32_t* array, + size_t size); + +/** + * Writes an entire array of signed 64-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, + uint32_t control, + const int64_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 64-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, + uint32_t control, + const uint64_t* array, + size_t size); + +/** + * Enumeration of all 32 possible IRQs. Multiple IRQs can be bitwise ORed + * together like this: + * + * NiFpga_Irq_3 | NiFpga_Irq_23 + */ +typedef enum +{ + NiFpga_Irq_0 = 1 << 0, + NiFpga_Irq_1 = 1 << 1, + NiFpga_Irq_2 = 1 << 2, + NiFpga_Irq_3 = 1 << 3, + NiFpga_Irq_4 = 1 << 4, + NiFpga_Irq_5 = 1 << 5, + NiFpga_Irq_6 = 1 << 6, + NiFpga_Irq_7 = 1 << 7, + NiFpga_Irq_8 = 1 << 8, + NiFpga_Irq_9 = 1 << 9, + NiFpga_Irq_10 = 1 << 10, + NiFpga_Irq_11 = 1 << 11, + NiFpga_Irq_12 = 1 << 12, + NiFpga_Irq_13 = 1 << 13, + NiFpga_Irq_14 = 1 << 14, + NiFpga_Irq_15 = 1 << 15, + NiFpga_Irq_16 = 1 << 16, + NiFpga_Irq_17 = 1 << 17, + NiFpga_Irq_18 = 1 << 18, + NiFpga_Irq_19 = 1 << 19, + NiFpga_Irq_20 = 1 << 20, + NiFpga_Irq_21 = 1 << 21, + NiFpga_Irq_22 = 1 << 22, + NiFpga_Irq_23 = 1 << 23, + NiFpga_Irq_24 = 1 << 24, + NiFpga_Irq_25 = 1 << 25, + NiFpga_Irq_26 = 1 << 26, + NiFpga_Irq_27 = 1 << 27, + NiFpga_Irq_28 = 1 << 28, + NiFpga_Irq_29 = 1 << 29, + NiFpga_Irq_30 = 1 << 30, + NiFpga_Irq_31 = 1U << 31 +} NiFpga_Irq; + +/** + * Represents an infinite timeout. + */ +static const uint32_t NiFpga_InfiniteTimeout = 0xFFFFFFFF; + +/** + * See NiFpga_ReserveIrqContext for more information. + */ +typedef void* NiFpga_IrqContext; + +/** + * IRQ contexts are single-threaded; only one thread can wait with a + * particular context at any given time. To minimize jitter when first + * waiting on IRQs, reserve as many contexts as the application + * requires. + * + * If a context is successfully reserved (the returned status is not an error), + * it must be unreserved later. Otherwise a memory leak will occur. + * + * @param session handle to a currently open session + * @param context outputs the IRQ context + * @return result of the call + */ +NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, + NiFpga_IrqContext* context); + +/** + * Unreserves an IRQ context obtained from NiFpga_ReserveIrqContext. + * + * @param session handle to a currently open session + * @param context IRQ context to unreserve + * @return result of the call + */ +NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, + NiFpga_IrqContext context); + +/** + * This is a blocking function that stops the calling thread until the + * FPGA asserts any IRQ in the irqs parameter, or until the function + * call times out. Before calling this function, use + * NiFpga_ReserveIrqContext to reserve an IRQ context. No other + * threads can use the same context when this function is called. + * + * You can use the irqsAsserted parameter to determine which IRQs were asserted + * for each function call. + * + * @param session handle to a currently open session + * @param context IRQ context with which to wait + * @param irqs bitwise OR of NiFpga_Irqs + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param irqsAsserted if non-NULL, outputs bitwise OR of IRQs that were + * asserted + * @param timedOut if non-NULL, outputs whether the timeout expired + * @return result of the call + */ +NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, + NiFpga_IrqContext context, + uint32_t irqs, + uint32_t timeout, + uint32_t* irqsAsserted, + NiFpga_Bool* timedOut); + +/** + * Acknowledges an IRQ or set of IRQs. + * + * @param session handle to a currently open session + * @param irqs bitwise OR of NiFpga_Irqs + * @return result of the call + */ +NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, + uint32_t irqs); + +/** + * Specifies the depth of the host memory part of the DMA FIFO. This method is + * optional. In order to see the actual depth configured, use + * NiFpga_ConfigureFifo2. + * + * @param session handle to a currently open session + * @param fifo FIFO to configure + * @param depth requested number of elements in the host memory part of the + * DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, + uint32_t fifo, + size_t depth); + +/** + * Specifies the depth of the host memory part of the DMA FIFO. This method is + * optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to configure + * @param requestedDepth requested number of elements in the host memory part + * of the DMA FIFO + * @param actualDepth if non-NULL, outputs the actual number of elements in the + * host memory part of the DMA FIFO, which may be more than + * the requested number + * @return result of the call + */ +NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, + uint32_t fifo, + size_t requestedDepth, + size_t* actualDepth); + +/** + * Starts a FIFO. This method is optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to start + * @return result of the call + */ +NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, + uint32_t fifo); + +/** + * Stops a FIFO. This method is optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to stop + * @return result of the call + */ +NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, + uint32_t fifo); + +/** + * Reads from a target-to-host FIFO of booleans. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, + uint32_t fifo, + int8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, + uint32_t fifo, + uint8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, + uint32_t fifo, + int16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, + uint32_t fifo, + uint16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, + uint32_t fifo, + int32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, + uint32_t fifo, + uint32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, + uint32_t fifo, + int64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, + uint32_t fifo, + uint64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Writes to a host-to-target FIFO of booleans. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, + uint32_t fifo, + const NiFpga_Bool* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, + uint32_t fifo, + const int8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, + uint32_t fifo, + const uint8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, + uint32_t fifo, + const int16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, + uint32_t fifo, + const uint16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, + uint32_t fifo, + const int32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, + uint32_t fifo, + const uint32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, + uint32_t fifo, + const int64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, + uint32_t fifo, + const uint64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of booleans. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsBool( + NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 8-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI8( + NiFpga_Session session, + uint32_t fifo, + int8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 8-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU8( + NiFpga_Session session, + uint32_t fifo, + uint8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 16-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI16( + NiFpga_Session session, + uint32_t fifo, + int16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 16-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU16( + NiFpga_Session session, + uint32_t fifo, + uint16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 32-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI32( + NiFpga_Session session, + uint32_t fifo, + int32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 32-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU32( + NiFpga_Session session, + uint32_t fifo, + uint32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 64-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI64( + NiFpga_Session session, + uint32_t fifo, + int64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 64-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU64( + NiFpga_Session session, + uint32_t fifo, + uint64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of booleans. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsBool( + NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 8-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI8( + NiFpga_Session session, + uint32_t fifo, + int8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 8-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU8( + NiFpga_Session session, + uint32_t fifo, + uint8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 16-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI16( + NiFpga_Session session, + uint32_t fifo, + int16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 16-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU16( + NiFpga_Session session, + uint32_t fifo, + uint16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 32-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI32( + NiFpga_Session session, + uint32_t fifo, + int32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 32-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU32( + NiFpga_Session session, + uint32_t fifo, + uint32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 64-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI64( + NiFpga_Session session, + uint32_t fifo, + int64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 64-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU64( + NiFpga_Session session, + uint32_t fifo, + uint64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Releases previously acquired FIFO elements. + * + * The FPGA target cannot read elements acquired by the host. Therefore, the + * host must release elements after acquiring them. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo FIFO from which to release elements + * @param elements number of elements to release + * @return result of the call + */ +NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, + uint32_t fifo, + size_t elements); + +/** + * Gets an endpoint reference to a peer-to-peer FIFO. + * + * @param session handle to a currently open session + * @param fifo peer-to-peer FIFO + * @param endpoint outputs the endpoint reference + * @return result of the call + */ +NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, + uint32_t fifo, + uint32_t* endpoint); + +#if NiFpga_Cpp +} +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..5d8911e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ +#define __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tAI.h new file mode 100644 index 0000000..6d3de2c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tAI.h @@ -0,0 +1,73 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_AI_h__ +#define __nFRC_C0EF_1_1_0_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + + + typedef enum + { + } tCalOK_IfaceConstants; + + virtual bool readCalOK(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDoneTime_IfaceConstants; + + virtual unsigned int readDoneTime(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumOffsetRegisters = 8, + } tOffset_IfaceConstants; + + virtual signed int readOffset(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumLSBWeightRegisters = 8, + } tLSBWeight_IfaceConstants; + + virtual unsigned int readLSBWeight(unsigned char reg_index, tRioStatusCode *status) = 0; + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tGlobal.h new file mode 100644 index 0000000..f938b7e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tGlobal.h @@ -0,0 +1,69 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_Global_h__ +#define __nFRC_C0EF_1_1_0_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReserved_IfaceConstants; + + virtual unsigned char readReserved(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tLoadOut.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tLoadOut.h new file mode 100644 index 0000000..f1ce1e9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nInvariantFPGANamespace/tLoadOut.h @@ -0,0 +1,79 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_LoadOut_h__ +#define __nFRC_C0EF_1_1_0_LoadOut_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tLoadOut +{ +public: + tLoadOut(){} + virtual ~tLoadOut(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tLoadOut* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tReady_IfaceConstants; + + virtual bool readReady(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDoneTime_IfaceConstants; + + virtual unsigned int readDoneTime(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumVendorIDRegisters = 8, + } tVendorID_IfaceConstants; + + virtual unsigned short readVendorID(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumSerialNumberRegisters = 8, + } tSerialNumber_IfaceConstants; + + virtual unsigned int readSerialNumber(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumModuleIDRegisters = 8, + } tModuleID_IfaceConstants; + + virtual unsigned short readModuleID(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tLoadOut(const tLoadOut&); + void operator=(const tLoadOut&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_LoadOut_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..a606b79 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_nInterfaceGlobals_h__ +#define __nFRC_2016_16_1_0_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_2016_16_1_0_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h new file mode 100644 index 0000000..e4901df --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h @@ -0,0 +1,143 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AI_h__ +#define __nFRC_2016_16_1_0_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ScanSize : 3; + unsigned ConvertRate : 26; +#else + unsigned ConvertRate : 26; + unsigned ScanSize : 3; +#endif + }; + struct{ + unsigned value : 29; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Averaged : 1; +#else + unsigned Averaged : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 4; + }; + } tReadSelect; + + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual signed int readOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0; + virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumOversampleBitsElements = 8, + } tOversampleBits_IfaceConstants; + + virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumAverageBitsElements = 8, + } tAverageBits_IfaceConstants; + + virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumScanListElements = 8, + } tScanList_IfaceConstants; + + virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tLatchOutput_IfaceConstants; + + virtual void strobeLatchOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadSelect_IfaceConstants; + + virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0; + virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0; + + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h new file mode 100644 index 0000000..f53c42b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h @@ -0,0 +1,50 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AO_h__ +#define __nFRC_2016_16_1_0_AO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAO +{ +public: + tAO(){} + virtual ~tAO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAO* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + + + typedef enum + { + kNumMXPRegisters = 2, + } tMXP_IfaceConstants; + + virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tAO(const tAO&); + void operator=(const tAO&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h new file mode 100644 index 0000000..45b88e9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h @@ -0,0 +1,102 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Accel_h__ +#define __nFRC_2016_16_1_0_Accel_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAccel +{ +public: + tAccel(){} + virtual ~tAccel(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccel* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tSTAT_IfaceConstants; + + virtual unsigned char readSTAT(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNTR_IfaceConstants; + + virtual void writeCNTR(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNTR(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDATO_IfaceConstants; + + virtual void writeDATO(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDATO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNFG_IfaceConstants; + + virtual void writeCNFG(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNFG(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNTL_IfaceConstants; + + virtual void writeCNTL(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNTL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDATI_IfaceConstants; + + virtual unsigned char readDATI(tRioStatusCode *status) = 0; + + + typedef enum + { + } tGO_IfaceConstants; + + virtual void strobeGO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tADDR_IfaceConstants; + + virtual void writeADDR(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readADDR(tRioStatusCode *status) = 0; + + + + +private: + tAccel(const tAccel&); + void operator=(const tAccel&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Accel_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h new file mode 100644 index 0000000..d6964be --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h @@ -0,0 +1,87 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Accumulator_h__ +#define __nFRC_2016_16_1_0_Accumulator_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAccumulator +{ +public: + tAccumulator(){} + virtual ~tAccumulator(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ + signed long long Value; + unsigned Count : 32; + }; + struct{ + unsigned value : 32; + unsigned value2 : 32; + unsigned value3 : 32; + }; + } tOutput; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual signed long long readOutput_Value(tRioStatusCode *status) = 0; + virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCenter_IfaceConstants; + + virtual void writeCenter(signed int value, tRioStatusCode *status) = 0; + virtual signed int readCenter(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDeadband_IfaceConstants; + + virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0; + virtual signed int readDeadband(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + + + +private: + tAccumulator(const tAccumulator&); + void operator=(const tAccumulator&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Accumulator_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h new file mode 100644 index 0000000..b51c5f8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h @@ -0,0 +1,57 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Alarm_h__ +#define __nFRC_2016_16_1_0_Alarm_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAlarm +{ +public: + tAlarm(){} + virtual ~tAlarm(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAlarm* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTriggerTime_IfaceConstants; + + virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0; + + + + +private: + tAlarm(const tAlarm&); + void operator=(const tAlarm&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Alarm_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h new file mode 100644 index 0000000..06eb352 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h @@ -0,0 +1,129 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AnalogTrigger_h__ +#define __nFRC_2016_16_1_0_AnalogTrigger_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAnalogTrigger +{ +public: + tAnalogTrigger(){} + virtual ~tAnalogTrigger(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned InHysteresis : 1; + unsigned OverLimit : 1; + unsigned Rising : 1; + unsigned Falling : 1; +#else + unsigned Falling : 1; + unsigned Rising : 1; + unsigned OverLimit : 1; + unsigned InHysteresis : 1; +#endif + }; + struct{ + unsigned value : 4; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Averaged : 1; + unsigned Filter : 1; + unsigned FloatingRollover : 1; + signed RolloverLimit : 8; +#else + signed RolloverLimit : 8; + unsigned FloatingRollover : 1; + unsigned Filter : 1; + unsigned Averaged : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 14; + }; + } tSourceSelect; + + + typedef enum + { + } tSourceSelect_IfaceConstants; + + virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0; + virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0; + virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUpperLimit_IfaceConstants; + + virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readUpperLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLowerLimit_IfaceConstants; + + virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readLowerLimit(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumOutputElements = 8, + } tOutput_IfaceConstants; + + virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tAnalogTrigger(const tAnalogTrigger&); + void operator=(const tAnalogTrigger&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AnalogTrigger_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h new file mode 100644 index 0000000..f28c50e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h @@ -0,0 +1,90 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_BIST_h__ +#define __nFRC_2016_16_1_0_BIST_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tBIST +{ +public: + tBIST(){} + virtual ~tBIST(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tBIST* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tDO0SquareTicks_IfaceConstants; + + virtual void writeDO0SquareTicks(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDO0SquareTicks(tRioStatusCode *status) = 0; + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO1SquareEnable_IfaceConstants; + + virtual void writeDO1SquareEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readDO1SquareEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO0SquareEnable_IfaceConstants; + + virtual void writeDO0SquareEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readDO0SquareEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO1SquareTicks_IfaceConstants; + + virtual void writeDO1SquareTicks(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDO1SquareTicks(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumDORegisters = 2, + } tDO_IfaceConstants; + + virtual void writeDO(unsigned char reg_index, bool value, tRioStatusCode *status) = 0; + virtual bool readDO(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tBIST(const tBIST&); + void operator=(const tBIST&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_BIST_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h new file mode 100644 index 0000000..6305714 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h @@ -0,0 +1,219 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Counter_h__ +#define __nFRC_2016_16_1_0_Counter_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tCounter +{ +public: + tCounter(){} + virtual ~tCounter(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tCounter* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned UpSource_Channel : 4; + unsigned UpSource_Module : 1; + unsigned UpSource_AnalogTrigger : 1; + unsigned DownSource_Channel : 4; + unsigned DownSource_Module : 1; + unsigned DownSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexEdgeSensitive : 1; + unsigned UpRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned DownFallingEdge : 1; + unsigned Mode : 2; + unsigned PulseLengthThreshold : 6; +#else + unsigned PulseLengthThreshold : 6; + unsigned Mode : 2; + unsigned DownFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned UpRisingEdge : 1; + unsigned IndexEdgeSensitive : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned DownSource_AnalogTrigger : 1; + unsigned DownSource_Module : 1; + unsigned DownSource_Channel : 4; + unsigned UpSource_AnalogTrigger : 1; + unsigned UpSource_Module : 1; + unsigned UpSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0; + virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tCounter(const tCounter&); + void operator=(const tCounter&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Counter_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h new file mode 100644 index 0000000..fa6ed49 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h @@ -0,0 +1,248 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_DIO_h__ +#define __nFRC_2016_16_1_0_DIO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tDIO +{ +public: + tDIO(){} + virtual ~tDIO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDIO* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tDO; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutputEnable; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tPulse; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tDI; + + + + typedef enum + { + } tDO_IfaceConstants; + + virtual void writeDO(tDO value, tRioStatusCode *status) = 0; + virtual void writeDO_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeDO_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tDO readDO(tRioStatusCode *status) = 0; + virtual unsigned short readDO_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readDO_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readDO_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMDutyCycleAElements = 4, + } tPWMDutyCycleA_IfaceConstants; + + virtual void writePWMDutyCycleA(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMDutyCycleA(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMDutyCycleBElements = 2, + } tPWMDutyCycleB_IfaceConstants; + + virtual void writePWMDutyCycleB(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMDutyCycleB(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterSelectHdrElements = 16, + } tFilterSelectHdr_IfaceConstants; + + virtual void writeFilterSelectHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelectHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tOutputEnable_IfaceConstants; + + virtual void writeOutputEnable(tOutputEnable value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tOutputEnable readOutputEnable(tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readOutputEnable_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMOutputSelectElements = 6, + } tPWMOutputSelect_IfaceConstants; + + virtual void writePWMOutputSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMOutputSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulse_IfaceConstants; + + virtual void writePulse(tPulse value, tRioStatusCode *status) = 0; + virtual void writePulse_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writePulse_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writePulse_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tPulse readPulse(tRioStatusCode *status) = 0; + virtual unsigned short readPulse_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readPulse_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readPulse_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDI_IfaceConstants; + + virtual tDI readDI(tRioStatusCode *status) = 0; + virtual unsigned short readDI_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readDI_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readDI_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + } tEnableMXPSpecialFunction_IfaceConstants; + + virtual void writeEnableMXPSpecialFunction(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readEnableMXPSpecialFunction(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterSelectMXPElements = 16, + } tFilterSelectMXP_IfaceConstants; + + virtual void writeFilterSelectMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelectMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulseLength_IfaceConstants; + + virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPulseLength(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPWMPeriodPower_IfaceConstants; + + virtual void writePWMPeriodPower(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readPWMPeriodPower(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumFilterPeriodMXPRegisters = 3, + } tFilterPeriodMXP_IfaceConstants; + + virtual void writeFilterPeriodMXP(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readFilterPeriodMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterPeriodHdrRegisters = 3, + } tFilterPeriodHdr_IfaceConstants; + + virtual void writeFilterPeriodHdr(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readFilterPeriodHdr(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tDIO(const tDIO&); + void operator=(const tDIO&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_DIO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h new file mode 100644 index 0000000..ea07962 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h @@ -0,0 +1,197 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_DMA_h__ +#define __nFRC_2016_16_1_0_DMA_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tDMA +{ +public: + tDMA(){} + virtual ~tDMA(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDMA* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Pause : 1; + unsigned Enable_AI0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_DI : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_Encoders_Low : 1; + unsigned Enable_Encoders_High : 1; + unsigned Enable_EncoderTimers_Low : 1; + unsigned Enable_EncoderTimers_High : 1; + unsigned ExternalClock : 1; +#else + unsigned ExternalClock : 1; + unsigned Enable_EncoderTimers_High : 1; + unsigned Enable_EncoderTimers_Low : 1; + unsigned Enable_Encoders_High : 1; + unsigned Enable_Encoders_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_DI : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AI0_Low : 1; + unsigned Pause : 1; +#endif + }; + struct{ + unsigned value : 22; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ExternalClockSource_Channel : 4; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; +#else + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tExternalTriggers; + + + + typedef enum + { + } tRate_IfaceConstants; + + virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual bool readConfig_Pause(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumExternalTriggersRegisters = 2, + kNumExternalTriggersElements = 4, + } tExternalTriggers_IfaceConstants; + + virtual void writeExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual tExternalTriggers readExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + + +private: + tDMA(const tDMA&); + void operator=(const tDMA&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_DMA_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h new file mode 100644 index 0000000..611143b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h @@ -0,0 +1,199 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Encoder_h__ +#define __nFRC_2016_16_1_0_Encoder_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tEncoder +{ +public: + tEncoder(){} + virtual ~tEncoder(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tEncoder* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ASource_Channel : 4; + unsigned ASource_Module : 1; + unsigned ASource_AnalogTrigger : 1; + unsigned BSource_Channel : 4; + unsigned BSource_Module : 1; + unsigned BSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexEdgeSensitive : 1; + unsigned Reverse : 1; +#else + unsigned Reverse : 1; + unsigned IndexEdgeSensitive : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned BSource_AnalogTrigger : 1; + unsigned BSource_Module : 1; + unsigned BSource_Channel : 4; + unsigned ASource_AnalogTrigger : 1; + unsigned ASource_Module : 1; + unsigned ASource_Channel : 4; +#endif + }; + struct{ + unsigned value : 21; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0; + virtual bool readConfig_Reverse(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tEncoder(const tEncoder&); + void operator=(const tEncoder&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Encoder_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h new file mode 100644 index 0000000..66f253e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h @@ -0,0 +1,104 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Global_h__ +#define __nFRC_2016_16_1_0_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Radio : 8; + unsigned Comm : 8; + unsigned Mode : 8; + unsigned RSL : 1; +#else + unsigned RSL : 1; + unsigned Mode : 8; + unsigned Comm : 8; + unsigned Radio : 8; +#endif + }; + struct{ + unsigned value : 25; + }; + } tLEDs; + + + + typedef enum + { + } tLEDs_IfaceConstants; + + virtual void writeLEDs(tLEDs value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Radio(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Comm(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_RSL(bool value, tRioStatusCode *status) = 0; + virtual tLEDs readLEDs(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Radio(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Comm(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Mode(tRioStatusCode *status) = 0; + virtual bool readLEDs_RSL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserButton_IfaceConstants; + + virtual bool readUserButton(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h new file mode 100644 index 0000000..1dbd981 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h @@ -0,0 +1,100 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Interrupt_h__ +#define __nFRC_2016_16_1_0_Interrupt_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tInterrupt +{ +public: + tInterrupt(){} + virtual ~tInterrupt(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Source_Channel : 4; + unsigned Source_Module : 1; + unsigned Source_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; + unsigned WaitForAck : 1; +#else + unsigned WaitForAck : 1; + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned Source_AnalogTrigger : 1; + unsigned Source_Module : 1; + unsigned Source_Channel : 4; +#endif + }; + struct{ + unsigned value : 9; + }; + } tConfig; + + + typedef enum + { + } tFallingTimeStamp_IfaceConstants; + + virtual unsigned int readFallingTimeStamp(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRisingTimeStamp_IfaceConstants; + + virtual unsigned int readRisingTimeStamp(tRioStatusCode *status) = 0; + + + + + +private: + tInterrupt(const tInterrupt&); + void operator=(const tInterrupt&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Interrupt_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h new file mode 100644 index 0000000..08143b8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h @@ -0,0 +1,120 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_PWM_h__ +#define __nFRC_2016_16_1_0_PWM_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tPWM +{ +public: + tPWM(){} + virtual ~tPWM(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tPWM* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 16; + unsigned MinHigh : 16; +#else + unsigned MinHigh : 16; + unsigned Period : 16; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Period(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_Period(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_MinHigh(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPeriodScaleMXPElements = 10, + } tPeriodScaleMXP_IfaceConstants; + + virtual void writePeriodScaleMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPeriodScaleMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPeriodScaleHdrElements = 10, + } tPeriodScaleHdr_IfaceConstants; + + virtual void writePeriodScaleHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPeriodScaleHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumZeroLatchElements = 20, + } tZeroLatch_IfaceConstants; + + virtual void writeZeroLatch(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual bool readZeroLatch(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumHdrRegisters = 10, + } tHdr_IfaceConstants; + + virtual void writeHdr(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readHdr(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumMXPRegisters = 10, + } tMXP_IfaceConstants; + + virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tPWM(const tPWM&); + void operator=(const tPWM&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_PWM_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h new file mode 100644 index 0000000..da40d8b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h @@ -0,0 +1,220 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Power_h__ +#define __nFRC_2016_16_1_0_Power_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tPower +{ +public: + tPower(){} + virtual ~tPower(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tPower* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned User3V3 : 8; + unsigned User5V : 8; + unsigned User6V : 8; +#else + unsigned User6V : 8; + unsigned User5V : 8; + unsigned User3V3 : 8; +#endif + }; + struct{ + unsigned value : 24; + }; + } tStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned OverCurrentFaultCount3V3 : 8; + unsigned OverCurrentFaultCount5V : 8; + unsigned OverCurrentFaultCount6V : 8; + unsigned UnderVoltageFaultCount5V : 8; +#else + unsigned UnderVoltageFaultCount5V : 8; + unsigned OverCurrentFaultCount6V : 8; + unsigned OverCurrentFaultCount5V : 8; + unsigned OverCurrentFaultCount3V3 : 8; +#endif + }; + struct{ + unsigned value : 32; + }; + } tFaultCounts; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned User3V3 : 1; + unsigned User5V : 1; + unsigned User6V : 1; +#else + unsigned User6V : 1; + unsigned User5V : 1; + unsigned User3V3 : 1; +#endif + }; + struct{ + unsigned value : 3; + }; + } tDisable; + + + + typedef enum + { + } tUserVoltage3V3_IfaceConstants; + + virtual unsigned short readUserVoltage3V3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User3V3(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User5V(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserVoltage6V_IfaceConstants; + + virtual unsigned short readUserVoltage6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tOnChipTemperature_IfaceConstants; + + virtual unsigned short readOnChipTemperature(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserVoltage5V_IfaceConstants; + + virtual unsigned short readUserVoltage5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tResetFaultCounts_IfaceConstants; + + virtual void strobeResetFaultCounts(tRioStatusCode *status) = 0; + + + typedef enum + { + } tIntegratedIO_IfaceConstants; + + virtual unsigned short readIntegratedIO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tMXP_DIOVoltage_IfaceConstants; + + virtual unsigned short readMXP_DIOVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent3V3_IfaceConstants; + + virtual unsigned short readUserCurrent3V3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVinVoltage_IfaceConstants; + + virtual unsigned short readVinVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent6V_IfaceConstants; + + virtual unsigned short readUserCurrent6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent5V_IfaceConstants; + + virtual unsigned short readUserCurrent5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tAOVoltage_IfaceConstants; + + virtual unsigned short readAOVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFaultCounts_IfaceConstants; + + virtual tFaultCounts readFaultCounts(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount3V3(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount5V(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount6V(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_UnderVoltageFaultCount5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVinCurrent_IfaceConstants; + + virtual unsigned short readVinCurrent(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDisable_IfaceConstants; + + virtual void writeDisable(tDisable value, tRioStatusCode *status) = 0; + virtual void writeDisable_User3V3(bool value, tRioStatusCode *status) = 0; + virtual void writeDisable_User5V(bool value, tRioStatusCode *status) = 0; + virtual void writeDisable_User6V(bool value, tRioStatusCode *status) = 0; + virtual tDisable readDisable(tRioStatusCode *status) = 0; + virtual bool readDisable_User3V3(tRioStatusCode *status) = 0; + virtual bool readDisable_User5V(tRioStatusCode *status) = 0; + virtual bool readDisable_User6V(tRioStatusCode *status) = 0; + + + + +private: + tPower(const tPower&); + void operator=(const tPower&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Power_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h new file mode 100644 index 0000000..e32a3d5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h @@ -0,0 +1,68 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Relay_h__ +#define __nFRC_2016_16_1_0_Relay_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tRelay +{ +public: + tRelay(){} + virtual ~tRelay(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tRelay* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Forward : 4; + unsigned Reverse : 4; +#else + unsigned Reverse : 4; + unsigned Forward : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tValue; + + + + typedef enum + { + } tValue_IfaceConstants; + + virtual void writeValue(tValue value, tRioStatusCode *status) = 0; + virtual void writeValue_Forward(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeValue_Reverse(unsigned char value, tRioStatusCode *status) = 0; + virtual tValue readValue(tRioStatusCode *status) = 0; + virtual unsigned char readValue_Forward(tRioStatusCode *status) = 0; + virtual unsigned char readValue_Reverse(tRioStatusCode *status) = 0; + + + + +private: + tRelay(const tRelay&); + void operator=(const tRelay&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Relay_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h new file mode 100644 index 0000000..e54715f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h @@ -0,0 +1,68 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_SPI_h__ +#define __nFRC_2016_16_1_0_SPI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tSPI +{ +public: + tSPI(){} + virtual ~tSPI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSPI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Hdr : 4; + unsigned MXP : 1; +#else + unsigned MXP : 1; + unsigned Hdr : 4; +#endif + }; + struct{ + unsigned value : 5; + }; + } tChipSelectActiveHigh; + + + + typedef enum + { + } tChipSelectActiveHigh_IfaceConstants; + + virtual void writeChipSelectActiveHigh(tChipSelectActiveHigh value, tRioStatusCode *status) = 0; + virtual void writeChipSelectActiveHigh_Hdr(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChipSelectActiveHigh_MXP(unsigned char value, tRioStatusCode *status) = 0; + virtual tChipSelectActiveHigh readChipSelectActiveHigh(tRioStatusCode *status) = 0; + virtual unsigned char readChipSelectActiveHigh_Hdr(tRioStatusCode *status) = 0; + virtual unsigned char readChipSelectActiveHigh_MXP(tRioStatusCode *status) = 0; + + + + +private: + tSPI(const tSPI&); + void operator=(const tSPI&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_SPI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h new file mode 100644 index 0000000..8c2133e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h @@ -0,0 +1,108 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_SysWatchdog_h__ +#define __nFRC_2016_16_1_0_SysWatchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tSysWatchdog +{ +public: + tSysWatchdog(){} + virtual ~tSysWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSysWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SystemActive : 1; + unsigned PowerAlive : 1; + unsigned SysDisableCount : 15; + unsigned PowerDisableCount : 15; +#else + unsigned PowerDisableCount : 15; + unsigned SysDisableCount : 15; + unsigned PowerAlive : 1; + unsigned SystemActive : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tStatus; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0; + virtual bool readStatus_PowerAlive(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_PowerDisableCount(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCommand_IfaceConstants; + + virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readCommand(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChallenge_IfaceConstants; + + virtual unsigned char readChallenge(tRioStatusCode *status) = 0; + + + typedef enum + { + } tActive_IfaceConstants; + + virtual void writeActive(bool value, tRioStatusCode *status) = 0; + virtual bool readActive(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + typedef enum + { + } tForcedKills_IfaceConstants; + + virtual unsigned short readForcedKills(tRioStatusCode *status) = 0; + + + + +private: + tSysWatchdog(const tSysWatchdog&); + void operator=(const tSysWatchdog&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_SysWatchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..b6c366c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_nInterfaceGlobals_h__ +#define __nFRC_2012_1_6_4_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_2012_1_6_4_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h new file mode 100644 index 0000000..6316af6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h @@ -0,0 +1,149 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_AI_h__ +#define __nFRC_2012_1_6_4_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Module : 1; + unsigned Averaged : 1; +#else + unsigned Averaged : 1; + unsigned Module : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 5; + }; + } tReadSelect; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ScanSize : 3; + unsigned ConvertRate : 26; +#else + unsigned ConvertRate : 26; + unsigned ScanSize : 3; +#endif + }; + struct{ + unsigned value : 29; + }; + } tConfig; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0; + virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumOversampleBitsElements = 8, + } tOversampleBits_IfaceConstants; + + virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumAverageBitsElements = 8, + } tAverageBits_IfaceConstants; + + virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumScanListElements = 8, + } tScanList_IfaceConstants; + + virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual signed int readOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLatchOutput_IfaceConstants; + + virtual void strobeLatchOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadSelect_IfaceConstants; + + virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Module(tRioStatusCode *status) = 0; + virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0; + + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAccumulator.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAccumulator.h new file mode 100644 index 0000000..d182882 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAccumulator.h @@ -0,0 +1,87 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Accumulator_h__ +#define __nFRC_2012_1_6_4_Accumulator_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAccumulator +{ +public: + tAccumulator(){} + virtual ~tAccumulator(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ + signed long long Value; + unsigned Count : 32; + }; + struct{ + unsigned value : 32; + unsigned value2 : 32; + unsigned value3 : 32; + }; + } tOutput; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual signed long long readOutput_Value(tRioStatusCode *status) = 0; + virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCenter_IfaceConstants; + + virtual void writeCenter(signed int value, tRioStatusCode *status) = 0; + virtual signed int readCenter(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDeadband_IfaceConstants; + + virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0; + virtual signed int readDeadband(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + + + +private: + tAccumulator(const tAccumulator&); + void operator=(const tAccumulator&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Accumulator_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAlarm.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAlarm.h new file mode 100644 index 0000000..a1c2f51 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAlarm.h @@ -0,0 +1,57 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Alarm_h__ +#define __nFRC_2012_1_6_4_Alarm_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAlarm +{ +public: + tAlarm(){} + virtual ~tAlarm(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAlarm* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTriggerTime_IfaceConstants; + + virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0; + + + + +private: + tAlarm(const tAlarm&); + void operator=(const tAlarm&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Alarm_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAnalogTrigger.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAnalogTrigger.h new file mode 100644 index 0000000..4fabd9c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAnalogTrigger.h @@ -0,0 +1,133 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_AnalogTrigger_h__ +#define __nFRC_2012_1_6_4_AnalogTrigger_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAnalogTrigger +{ +public: + tAnalogTrigger(){} + virtual ~tAnalogTrigger(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned InHysteresis : 1; + unsigned OverLimit : 1; + unsigned Rising : 1; + unsigned Falling : 1; +#else + unsigned Falling : 1; + unsigned Rising : 1; + unsigned OverLimit : 1; + unsigned InHysteresis : 1; +#endif + }; + struct{ + unsigned value : 4; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Module : 1; + unsigned Averaged : 1; + unsigned Filter : 1; + unsigned FloatingRollover : 1; + signed RolloverLimit : 8; +#else + signed RolloverLimit : 8; + unsigned FloatingRollover : 1; + unsigned Filter : 1; + unsigned Averaged : 1; + unsigned Module : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 15; + }; + } tSourceSelect; + + + typedef enum + { + } tSourceSelect_IfaceConstants; + + virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0; + virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Module(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0; + virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUpperLimit_IfaceConstants; + + virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readUpperLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLowerLimit_IfaceConstants; + + virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readLowerLimit(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumOutputElements = 8, + } tOutput_IfaceConstants; + + virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tAnalogTrigger(const tAnalogTrigger&); + void operator=(const tAnalogTrigger&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_AnalogTrigger_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tCounter.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tCounter.h new file mode 100644 index 0000000..200ffb3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tCounter.h @@ -0,0 +1,219 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Counter_h__ +#define __nFRC_2012_1_6_4_Counter_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tCounter +{ +public: + tCounter(){} + virtual ~tCounter(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tCounter* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned UpSource_Channel : 4; + unsigned UpSource_Module : 1; + unsigned UpSource_AnalogTrigger : 1; + unsigned DownSource_Channel : 4; + unsigned DownSource_Module : 1; + unsigned DownSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned UpRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned DownFallingEdge : 1; + unsigned Mode : 2; + unsigned PulseLengthThreshold : 6; + unsigned Enable : 1; +#else + unsigned Enable : 1; + unsigned PulseLengthThreshold : 6; + unsigned Mode : 2; + unsigned DownFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned UpRisingEdge : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned DownSource_AnalogTrigger : 1; + unsigned DownSource_Module : 1; + unsigned DownSource_Channel : 4; + unsigned UpSource_AnalogTrigger : 1; + unsigned UpSource_Module : 1; + unsigned UpSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tCounter(const tCounter&); + void operator=(const tCounter&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Counter_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h new file mode 100644 index 0000000..d9852c9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h @@ -0,0 +1,330 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_DIO_h__ +#define __nFRC_2012_1_6_4_DIO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tDIO +{ +public: + tDIO(){} + virtual ~tDIO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDIO* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 16; + unsigned MinHigh : 16; +#else + unsigned MinHigh : 16; + unsigned Period : 16; +#endif + }; + struct{ + unsigned value : 32; + }; + } tPWMConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned RelayFwd : 8; + unsigned RelayRev : 8; + unsigned I2CHeader : 4; +#else + unsigned I2CHeader : 4; + unsigned RelayRev : 8; + unsigned RelayFwd : 8; +#endif + }; + struct{ + unsigned value : 20; + }; + } tSlowValue; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Transaction : 1; + unsigned Done : 1; + unsigned Aborted : 1; + unsigned DataReceivedHigh : 24; +#else + unsigned DataReceivedHigh : 24; + unsigned Aborted : 1; + unsigned Done : 1; + unsigned Transaction : 1; +#endif + }; + struct{ + unsigned value : 27; + }; + } tI2CStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Address : 8; + unsigned BytesToRead : 3; + unsigned BytesToWrite : 3; + unsigned DataToSendHigh : 16; + unsigned BitwiseHandshake : 1; +#else + unsigned BitwiseHandshake : 1; + unsigned DataToSendHigh : 16; + unsigned BytesToWrite : 3; + unsigned BytesToRead : 3; + unsigned Address : 8; +#endif + }; + struct{ + unsigned value : 31; + }; + } tI2CConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned PeriodPower : 4; + unsigned OutputSelect_0 : 4; + unsigned OutputSelect_1 : 4; + unsigned OutputSelect_2 : 4; + unsigned OutputSelect_3 : 4; +#else + unsigned OutputSelect_3 : 4; + unsigned OutputSelect_2 : 4; + unsigned OutputSelect_1 : 4; + unsigned OutputSelect_0 : 4; + unsigned PeriodPower : 4; +#endif + }; + struct{ + unsigned value : 20; + }; + } tDO_PWMConfig; + + + typedef enum + { + kNumFilterSelectElements = 16, + } tFilterSelect_IfaceConstants; + + virtual void writeFilterSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CDataToSend_IfaceConstants; + + virtual void writeI2CDataToSend(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readI2CDataToSend(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO_IfaceConstants; + + virtual void writeDO(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readDO(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterPeriodElements = 3, + } tFilterPeriod_IfaceConstants; + + virtual void writeFilterPeriod(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterPeriod(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tOutputEnable_IfaceConstants; + + virtual void writeOutputEnable(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulse_IfaceConstants; + + virtual void writePulse(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readPulse(tRioStatusCode *status) = 0; + + + typedef enum + { + } tSlowValue_IfaceConstants; + + virtual void writeSlowValue(tSlowValue value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_RelayFwd(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_RelayRev(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_I2CHeader(unsigned char value, tRioStatusCode *status) = 0; + virtual tSlowValue readSlowValue(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_RelayFwd(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_RelayRev(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_I2CHeader(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CStatus_IfaceConstants; + + virtual tI2CStatus readI2CStatus(tRioStatusCode *status) = 0; + virtual unsigned char readI2CStatus_Transaction(tRioStatusCode *status) = 0; + virtual bool readI2CStatus_Done(tRioStatusCode *status) = 0; + virtual bool readI2CStatus_Aborted(tRioStatusCode *status) = 0; + virtual unsigned int readI2CStatus_DataReceivedHigh(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CDataReceived_IfaceConstants; + + virtual unsigned int readI2CDataReceived(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDI_IfaceConstants; + + virtual unsigned short readDI(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulseLength_IfaceConstants; + + virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPulseLength(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMPeriodScaleElements = 10, + } tPWMPeriodScale_IfaceConstants; + + virtual void writePWMPeriodScale(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMPeriodScale(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumDO_PWMDutyCycleElements = 4, + } tDO_PWMDutyCycle_IfaceConstants; + + virtual void writeDO_PWMDutyCycle(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMDutyCycle(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tBFL_IfaceConstants; + + virtual void writeBFL(bool value, tRioStatusCode *status) = 0; + virtual bool readBFL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CConfig_IfaceConstants; + + virtual void writeI2CConfig(tI2CConfig value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_Address(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BytesToRead(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BytesToWrite(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_DataToSendHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BitwiseHandshake(bool value, tRioStatusCode *status) = 0; + virtual tI2CConfig readI2CConfig(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_Address(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_BytesToRead(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_BytesToWrite(tRioStatusCode *status) = 0; + virtual unsigned short readI2CConfig_DataToSendHigh(tRioStatusCode *status) = 0; + virtual bool readI2CConfig_BitwiseHandshake(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO_PWMConfig_IfaceConstants; + + virtual void writeDO_PWMConfig(tDO_PWMConfig value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_PeriodPower(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_0(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_1(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_2(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_3(unsigned char value, tRioStatusCode *status) = 0; + virtual tDO_PWMConfig readDO_PWMConfig(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_PeriodPower(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_0(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_1(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_2(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CStart_IfaceConstants; + + virtual void strobeI2CStart(tRioStatusCode *status) = 0; + + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPWMConfig_IfaceConstants; + + virtual void writePWMConfig(tPWMConfig value, tRioStatusCode *status) = 0; + virtual void writePWMConfig_Period(unsigned short value, tRioStatusCode *status) = 0; + virtual void writePWMConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual tPWMConfig readPWMConfig(tRioStatusCode *status) = 0; + virtual unsigned short readPWMConfig_Period(tRioStatusCode *status) = 0; + virtual unsigned short readPWMConfig_MinHigh(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumPWMValueRegisters = 10, + } tPWMValue_IfaceConstants; + + virtual void writePWMValue(unsigned char reg_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMValue(unsigned char reg_index, tRioStatusCode *status) = 0; + + + +private: + tDIO(const tDIO&); + void operator=(const tDIO&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_DIO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h new file mode 100644 index 0000000..c46cad2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h @@ -0,0 +1,188 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_DMA_h__ +#define __nFRC_2012_1_6_4_DMA_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tDMA +{ +public: + tDMA(){} + virtual ~tDMA(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDMA* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Pause : 1; + unsigned Enable_AI0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_DI : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_Encoders : 1; + unsigned Enable_EncoderTimers : 1; + unsigned ExternalClock : 1; +#else + unsigned ExternalClock : 1; + unsigned Enable_EncoderTimers : 1; + unsigned Enable_Encoders : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_DI : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AI0_Low : 1; + unsigned Pause : 1; +#endif + }; + struct{ + unsigned value : 20; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ExternalClockSource_Channel : 4; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; +#else + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tExternalTriggers; + + + + typedef enum + { + } tRate_IfaceConstants; + + virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual bool readConfig_Pause(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers(tRioStatusCode *status) = 0; + virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumExternalTriggersElements = 4, + } tExternalTriggers_IfaceConstants; + + virtual void writeExternalTriggers(unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_RisingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_FallingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual tExternalTriggers readExternalTriggers(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_RisingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_FallingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tDMA(const tDMA&); + void operator=(const tDMA&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_DMA_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tEncoder.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tEncoder.h new file mode 100644 index 0000000..0b68067 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tEncoder.h @@ -0,0 +1,199 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Encoder_h__ +#define __nFRC_2012_1_6_4_Encoder_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tEncoder +{ +public: + tEncoder(){} + virtual ~tEncoder(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tEncoder* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 4, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ASource_Channel : 4; + unsigned ASource_Module : 1; + unsigned ASource_AnalogTrigger : 1; + unsigned BSource_Channel : 4; + unsigned BSource_Module : 1; + unsigned BSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned Reverse : 1; + unsigned Enable : 1; +#else + unsigned Enable : 1; + unsigned Reverse : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned BSource_AnalogTrigger : 1; + unsigned BSource_Module : 1; + unsigned BSource_Channel : 4; + unsigned ASource_AnalogTrigger : 1; + unsigned ASource_Module : 1; + unsigned ASource_Channel : 4; +#endif + }; + struct{ + unsigned value : 21; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_Reverse(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tEncoder(const tEncoder&); + void operator=(const tEncoder&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Encoder_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tGlobal.h new file mode 100644 index 0000000..2dbbbe7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tGlobal.h @@ -0,0 +1,70 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Global_h__ +#define __nFRC_2012_1_6_4_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFPGA_LED_IfaceConstants; + + virtual void writeFPGA_LED(bool value, tRioStatusCode *status) = 0; + virtual bool readFPGA_LED(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tInterrupt.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tInterrupt.h new file mode 100644 index 0000000..519f6b3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tInterrupt.h @@ -0,0 +1,93 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Interrupt_h__ +#define __nFRC_2012_1_6_4_Interrupt_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tInterrupt +{ +public: + tInterrupt(){} + virtual ~tInterrupt(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Source_Channel : 4; + unsigned Source_Module : 1; + unsigned Source_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; + unsigned WaitForAck : 1; +#else + unsigned WaitForAck : 1; + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned Source_AnalogTrigger : 1; + unsigned Source_Module : 1; + unsigned Source_Channel : 4; +#endif + }; + struct{ + unsigned value : 9; + }; + } tConfig; + + + typedef enum + { + } tTimeStamp_IfaceConstants; + + virtual unsigned int readTimeStamp(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0; + + + + + +private: + tInterrupt(const tInterrupt&); + void operator=(const tInterrupt&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Interrupt_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h new file mode 100644 index 0000000..c74ec9b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h @@ -0,0 +1,228 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_SPI_h__ +#define __nFRC_2012_1_6_4_SPI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSPI +{ +public: + tSPI(){} + virtual ~tSPI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSPI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ReceivedDataOverflow : 1; + unsigned Idle : 1; +#else + unsigned Idle : 1; + unsigned ReceivedDataOverflow : 1; +#endif + }; + struct{ + unsigned value : 2; + }; + } tStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned BusBitWidth : 8; + unsigned ClockHalfPeriodDelay : 8; + unsigned MSBfirst : 1; + unsigned DataOnFalling : 1; + unsigned LatchFirst : 1; + unsigned LatchLast : 1; + unsigned FramePolarity : 1; + unsigned WriteOnly : 1; + unsigned ClockPolarity : 1; +#else + unsigned ClockPolarity : 1; + unsigned WriteOnly : 1; + unsigned FramePolarity : 1; + unsigned LatchLast : 1; + unsigned LatchFirst : 1; + unsigned DataOnFalling : 1; + unsigned MSBfirst : 1; + unsigned ClockHalfPeriodDelay : 8; + unsigned BusBitWidth : 8; +#endif + }; + struct{ + unsigned value : 23; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SCLK_Channel : 4; + unsigned SCLK_Module : 1; + unsigned MOSI_Channel : 4; + unsigned MOSI_Module : 1; + unsigned MISO_Channel : 4; + unsigned MISO_Module : 1; + unsigned SS_Channel : 4; + unsigned SS_Module : 1; +#else + unsigned SS_Module : 1; + unsigned SS_Channel : 4; + unsigned MISO_Module : 1; + unsigned MISO_Channel : 4; + unsigned MOSI_Module : 1; + unsigned MOSI_Channel : 4; + unsigned SCLK_Module : 1; + unsigned SCLK_Channel : 4; +#endif + }; + struct{ + unsigned value : 20; + }; + } tChannels; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_ReceivedDataOverflow(tRioStatusCode *status) = 0; + virtual bool readStatus_Idle(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReceivedData_IfaceConstants; + + virtual unsigned int readReceivedData(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDataToLoad_IfaceConstants; + + virtual void writeDataToLoad(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDataToLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_BusBitWidth(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ClockHalfPeriodDelay(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_MSBfirst(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DataOnFalling(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_LatchFirst(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_LatchLast(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FramePolarity(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WriteOnly(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ClockPolarity(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BusBitWidth(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ClockHalfPeriodDelay(tRioStatusCode *status) = 0; + virtual bool readConfig_MSBfirst(tRioStatusCode *status) = 0; + virtual bool readConfig_DataOnFalling(tRioStatusCode *status) = 0; + virtual bool readConfig_LatchFirst(tRioStatusCode *status) = 0; + virtual bool readConfig_LatchLast(tRioStatusCode *status) = 0; + virtual bool readConfig_FramePolarity(tRioStatusCode *status) = 0; + virtual bool readConfig_WriteOnly(tRioStatusCode *status) = 0; + virtual bool readConfig_ClockPolarity(tRioStatusCode *status) = 0; + + + typedef enum + { + } tClearReceivedData_IfaceConstants; + + virtual void strobeClearReceivedData(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReceivedElements_IfaceConstants; + + virtual unsigned short readReceivedElements(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoad_IfaceConstants; + + virtual void strobeLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChannels_IfaceConstants; + + virtual void writeChannels(tChannels value, tRioStatusCode *status) = 0; + virtual void writeChannels_SCLK_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SCLK_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MOSI_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MOSI_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MISO_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MISO_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SS_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SS_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual tChannels readChannels(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SCLK_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SCLK_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MOSI_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MOSI_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MISO_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MISO_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SS_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SS_Module(tRioStatusCode *status) = 0; + + + typedef enum + { + } tAvailableToLoad_IfaceConstants; + + virtual unsigned short readAvailableToLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadReceivedData_IfaceConstants; + + virtual void strobeReadReceivedData(tRioStatusCode *status) = 0; + + + + +private: + tSPI(const tSPI&); + void operator=(const tSPI&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_SPI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSolenoid.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSolenoid.h new file mode 100644 index 0000000..67c9a40 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSolenoid.h @@ -0,0 +1,50 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Solenoid_h__ +#define __nFRC_2012_1_6_4_Solenoid_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSolenoid +{ +public: + tSolenoid(){} + virtual ~tSolenoid(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSolenoid* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + kNumDO7_0Elements = 2, + } tDO7_0_IfaceConstants; + + virtual void writeDO7_0(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDO7_0(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tSolenoid(const tSolenoid&); + void operator=(const tSolenoid&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Solenoid_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSysWatchdog.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSysWatchdog.h new file mode 100644 index 0000000..daca9b6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSysWatchdog.h @@ -0,0 +1,71 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_SysWatchdog_h__ +#define __nFRC_2012_1_6_4_SysWatchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSysWatchdog +{ +public: + tSysWatchdog(){} + virtual ~tSysWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSysWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tCommand_IfaceConstants; + + virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readCommand(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChallenge_IfaceConstants; + + virtual unsigned char readChallenge(tRioStatusCode *status) = 0; + + + typedef enum + { + } tActive_IfaceConstants; + + virtual void writeActive(bool value, tRioStatusCode *status) = 0; + virtual bool readActive(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + + +private: + tSysWatchdog(const tSysWatchdog&); + void operator=(const tSysWatchdog&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_SysWatchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tWatchdog.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tWatchdog.h new file mode 100644 index 0000000..d4a4cba --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tWatchdog.h @@ -0,0 +1,108 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Watchdog_h__ +#define __nFRC_2012_1_6_4_Watchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tWatchdog +{ +public: + tWatchdog(){} + virtual ~tWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SystemActive : 1; + unsigned Alive : 1; + unsigned SysDisableCount : 15; + unsigned DisableCount : 15; +#else + unsigned DisableCount : 15; + unsigned SysDisableCount : 15; + unsigned Alive : 1; + unsigned SystemActive : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tStatus; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0; + virtual bool readStatus_Alive(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_DisableCount(tRioStatusCode *status) = 0; + + + typedef enum + { + } tKill_IfaceConstants; + + virtual void strobeKill(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFeed_IfaceConstants; + + virtual void strobeFeed(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + typedef enum + { + } tExpiration_IfaceConstants; + + virtual void writeExpiration(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readExpiration(tRioStatusCode *status) = 0; + + + typedef enum + { + } tImmortal_IfaceConstants; + + virtual void writeImmortal(bool value, tRioStatusCode *status) = 0; + virtual bool readImmortal(tRioStatusCode *status) = 0; + + + + +private: + tWatchdog(const tWatchdog&); + void operator=(const tWatchdog&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Watchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/printFpgaVersion.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/printFpgaVersion.h new file mode 100644 index 0000000..9ef9bf4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/printFpgaVersion.h @@ -0,0 +1,42 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __printFPGAVersion_h__ +#define __printFPGAVersion_h__ + +namespace nFPGA +{ + +template +inline void printFPGAVersion(ttGlobal &global) +{ + tRioStatusCode cleanStatus=0; + uint32_t hardwareGuid[4]; + tSystemInterface &system = *global.getSystemInterface(); + system.getHardwareFpgaSignature(hardwareGuid, &cleanStatus); + const uint32_t *softwareGuid = system.getExpectedFPGASignature(); + printf("FPGA Hardware GUID: 0x"); + for(int i=0; i<4; i++) + { + printf("%08X", hardwareGuid[i]); + } + printf("\n"); + printf("FPGA Software GUID: 0x"); + for(int i=0; i<4; i++) + { + printf("%08X", softwareGuid[i]); + } + printf("\n"); + uint16_t fpgaHardwareVersion = global.readVersion(&cleanStatus); + uint16_t fpgaSoftwareVersion = system.getExpectedFPGAVersion(); + printf("FPGA Hardware Version: %X\n", fpgaHardwareVersion); + printf("FPGA Software Version: %X\n", fpgaSoftwareVersion); + uint32_t fpgaHardwareRevision = global.readRevision(&cleanStatus); + uint32_t fpgaSoftwareRevision = system.getExpectedFPGARevision(); + printf("FPGA Hardware Revision: %X.%X.%X\n", (fpgaHardwareRevision >> 20) & 0xFFF, (fpgaHardwareRevision >> 12) & 0xFF, fpgaHardwareRevision & 0xFFF); + printf("FPGA Software Revision: %X.%X.%X\n", (fpgaSoftwareRevision >> 20) & 0xFFF, (fpgaSoftwareRevision >> 12) & 0xFF, fpgaSoftwareRevision & 0xFFF); +} + +} + +#endif // __printFPGAVersion_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAChannelDescriptor.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAChannelDescriptor.h new file mode 100644 index 0000000..2c7f54e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAChannelDescriptor.h @@ -0,0 +1,17 @@ +// Describes the information needed to configure a DMA channel. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#include + +#ifndef __tDMAChannelDescriptor_h__ +#define __tDMAChannelDescriptor_h__ + +struct tDMAChannelDescriptor +{ + uint32_t channel; + uint32_t baseAddress; + uint32_t depth; + bool targetToHost; +}; + +#endif // __tDMAChannelDescriptor_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAManager.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAManager.h new file mode 100644 index 0000000..c2ba6b4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tDMAManager.h @@ -0,0 +1,41 @@ +// Class for handling DMA transfers. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tDMAManager_h__ +#define __tDMAManager_h__ + +#include "tSystem.h" +#include + +namespace nFPGA +{ +class tDMAManager : public tSystem +{ +public: + tDMAManager(uint32_t dmaChannel, uint32_t hostBufferSize, tRioStatusCode *status); + ~tDMAManager(); + void start(tRioStatusCode *status); + void stop(tRioStatusCode *status); + bool isStarted() {return _started;} + void read( + uint32_t* buf, + size_t num, + uint32_t timeout, + size_t* remaining, + tRioStatusCode *status); + void write( + uint32_t* buf, + size_t num, + uint32_t timeout, + size_t* remaining, + tRioStatusCode *status); +private: + bool _started; + uint32_t _dmaChannel; + uint32_t _hostBufferSize; + +}; + +} + +#endif // __tDMAManager_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tInterruptManager.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tInterruptManager.h new file mode 100644 index 0000000..6c84b54 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tInterruptManager.h @@ -0,0 +1,61 @@ +// Class for handling interrupts. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tInterruptManager_h__ +#define __tInterruptManager_h__ + +#include "tSystem.h" + +namespace ni +{ + namespace dsc + { + namespace osdep + { + class CriticalSection; + } + } +} + +namespace nFPGA +{ + +typedef void (*tInterruptHandler)(uint32_t interruptAssertedMask, void *param); + +class tInterruptManager : public tSystem +{ +public: + tInterruptManager(uint32_t interruptMask, bool watcher, tRioStatusCode *status); + ~tInterruptManager(); + void registerHandler(tInterruptHandler handler, void *param, tRioStatusCode *status); + uint32_t watch(int32_t timeoutInMs, bool ignorePrevious, tRioStatusCode *status); + void enable(tRioStatusCode *status); + void disable(tRioStatusCode *status); + bool isEnabled(tRioStatusCode *status); +private: + class tInterruptThread; + friend class tInterruptThread; + void handler(); + static int handlerWrapper(tInterruptManager *pInterrupt); + + void acknowledge(tRioStatusCode *status); + void reserve(tRioStatusCode *status); + void unreserve(tRioStatusCode *status); + tInterruptHandler _handler; + uint32_t _interruptMask; + tInterruptThread *_thread; + NiFpga_IrqContext _rioContext; + bool _watcher; + bool _enabled; + void *_userParam; + + // maintain the interrupts that are already dealt with. + static uint32_t _globalInterruptMask; + static ni::dsc::osdep::CriticalSection *_globalInterruptMaskSemaphore; +}; + +} + + +#endif // __tInterruptManager_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystem.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystem.h new file mode 100644 index 0000000..cf54b05 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystem.h @@ -0,0 +1,48 @@ +// Base class for generated chip objects +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tSystem_h__ +#define __tSystem_h__ + +#include "fpgainterfacecapi/NiFpga.h" +typedef NiFpga_Status tRioStatusCode; + +#define FRC_FPGA_PRELOAD_BITFILE + +typedef uint32_t NiFpga_Session; + +namespace nFPGA +{ + +class tSystem +{ +public: + tSystem(tRioStatusCode *status); + ~tSystem(); + void getFpgaGuid(uint32_t *guid_ptr, tRioStatusCode *status); + void reset(tRioStatusCode *status); + +protected: + static NiFpga_Session _DeviceHandle; + +#ifdef FRC_FPGA_PRELOAD_BITFILE + void NiFpga_SharedOpen_common(const char* bitfile); + NiFpga_Status NiFpga_SharedOpen(const char* bitfile, + const char* signature, + const char* resource, + uint32_t attribute, + NiFpga_Session* session); + NiFpga_Status NiFpgaLv_SharedOpen(const char* const bitfile, + const char* const apiSignature, + const char* const resource, + const uint32_t attribute, + NiFpga_Session* const session); +private: + static char *_FileName; + static char *_Bitfile; +#endif +}; + +} + +#endif // __tSystem_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystemInterface.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystemInterface.h new file mode 100644 index 0000000..ee8ca62 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject/tSystemInterface.h @@ -0,0 +1,27 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tSystemInterface_h__ +#define __tSystemInterface_h__ + +namespace nFPGA +{ + +class tSystemInterface +{ +public: + tSystemInterface(){} + virtual ~tSystemInterface(){} + + virtual const uint16_t getExpectedFPGAVersion()=0; + virtual const uint32_t getExpectedFPGARevision()=0; + virtual const uint32_t * const getExpectedFPGASignature()=0; + virtual void getHardwareFpgaSignature(uint32_t *guid_ptr, tRioStatusCode *status)=0; + virtual uint32_t getLVHandle(tRioStatusCode *status)=0; + virtual uint32_t getHandle()=0; + virtual void reset(tRioStatusCode *status)=0; +}; + +} + +#endif // __tSystemInterface_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject_Aliases.h b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject_Aliases.h new file mode 100644 index 0000000..8d46bea --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_FPGA_ChipObject_Aliases.h @@ -0,0 +1,10 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __FRC_FPGA_ChipObject_Aliases_h__ +#define __FRC_FPGA_ChipObject_Aliases_h__ + +#define nRuntimeFPGANamespace nFRC_2012_1_6_4 +#define nInvariantFPGANamespace nFRC_C0EF_1_1_0 + +#endif // __FRC_FPGA_ChipObject_Aliases_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/AICalibration.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/AICalibration.h new file mode 100644 index 0000000..39755bd --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/AICalibration.h @@ -0,0 +1,19 @@ + +#ifndef __AICalibration_h__ +#define __AICalibration_h__ + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); + int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __AICalibration_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANInterfacePlugin.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANInterfacePlugin.h new file mode 100644 index 0000000..f3150fb --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANInterfacePlugin.h @@ -0,0 +1,82 @@ +// CANInterfacePlugin.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANInterfacePlugin_h__ +#define __CANInterfacePlugin_h__ + +#include + +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_IS_FRAME_11BIT 0x40000000 +#define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF +#define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF + +class CANInterfacePlugin +{ +public: + CANInterfacePlugin() {} + virtual ~CANInterfacePlugin() {} + + /** + * This entry-point of the CANInterfacePlugin is passed a message that the driver needs to send to + * a device on the CAN bus. + * + * This function may be called from multiple contexts and must therefore be reentrant. + * + * @param messageID The 29-bit CAN message ID in the lsbs. The msb can indicate a remote frame. + * @param data A pointer to a buffer containing between 0 and 8 bytes to send with the message. May be NULL if dataSize is 0. + * @param dataSize The number of bytes to send with the message. + * @return Return any error code. On success return 0. + */ + virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize) = 0; + + /** + * This entry-point of the CANInterfacePlugin is passed buffers which should be populated with + * any received messages from devices on the CAN bus. + * + * This function is always called by a single task in the Jaguar driver, so it need not be reentrant. + * + * This function is expected to block for some period of time waiting for a message from the CAN bus. + * It may timeout periodically (returning non-zero to indicate no message was populated) to allow for + * shutdown and unloading of the plugin. + * + * @param messageID A reference to be populated with a received 29-bit CAN message ID in the lsbs. + * @param data A pointer to a buffer of 8 bytes to be populated with data received with the message. + * @param dataSize A reference to be populated with the size of the data received (0 - 8 bytes). + * @return This should return 0 if a message was populated, non-0 if no message was not populated. + */ + virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0; + +#if defined(__linux) + /** + * This entry-point of the CANInterfacePlugin returns status of the CAN bus. + * + * This function may be called from multiple contexts and must therefore be reentrant. + * + * This function will return detailed hardware status if available for diagnostics of the CAN interface. + * + * @param busOffCount The number of times that sendMessage failed with a busOff error indicating that messages + * are not successfully transmitted on the bus. + * @param txFullCount The number of times that sendMessage failed with a txFifoFull error indicating that messages + * are not successfully received by any CAN device. + * @param receiveErrorCount The count of receive errors as reported by the CAN driver. + * @param transmitErrorCount The count of transmit errors as reported by the CAN driver. + * @return This should return 0 if all status was retrieved successfully or an error code if not. + */ + virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;} +#endif +}; + +/** + * This function allows you to register a CANInterfacePlugin to provide access a CAN bus. + * + * @param interface A pointer to an object that inherits from CANInterfacePlugin and implements + * the pure virtual interface. If NULL, unregister the current plugin. + */ +void FRC_NetworkCommunication_CANSessionMux_registerInterface(CANInterfacePlugin* interface); + +#endif // __CANInterfacePlugin_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANSessionMux.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANSessionMux.h new file mode 100644 index 0000000..fe4cde0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/CANSessionMux.h @@ -0,0 +1,66 @@ +// CANSessionMux.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANSessionMux_h__ +#define __CANSessionMux_h__ + +#if defined(__vxworks) +#include +#else +#include +#endif + +#define CAN_SEND_PERIOD_NO_REPEAT 0 +#define CAN_SEND_PERIOD_STOP_REPEATING -1 + +/* Flags in the upper bits of the messageID */ +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_IS_FRAME_11BIT 0x40000000 + +#define ERR_CANSessionMux_InvalidBuffer -44086 +#define ERR_CANSessionMux_MessageNotFound -44087 +#define WARN_CANSessionMux_NoToken 44087 +#define ERR_CANSessionMux_NotAllowed -44088 +#define ERR_CANSessionMux_NotInitialized -44089 +#define ERR_CANSessionMux_SessionOverrun 44050 + +struct tCANStreamMessage{ + uint32_t messageID; + uint32_t timeStamp; + uint8_t data[8]; + uint8_t dataSize; +}; + +#ifdef __cplusplus +namespace nCANSessionMux +{ + void sendMessage_wrapper(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t periodMs, int32_t *status); + void receiveMessage_wrapper(uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, uint8_t *dataSize, uint32_t *timeStamp, int32_t *status); + void openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status); + void closeStreamSession(uint32_t sessionHandle); + void readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status); + void getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status); +} +#endif + +#ifdef __cplusplus +extern "C" +{ +#endif + + void FRC_NetworkCommunication_CANSessionMux_sendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize, int32_t periodMs, int32_t *status); + void FRC_NetworkCommunication_CANSessionMux_receiveMessage(uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, uint8_t *dataSize, uint32_t *timeStamp, int32_t *status); + void FRC_NetworkCommunication_CANSessionMux_openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status); + void FRC_NetworkCommunication_CANSessionMux_closeStreamSession(uint32_t sessionHandle); + void FRC_NetworkCommunication_CANSessionMux_readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status); + void FRC_NetworkCommunication_CANSessionMux_getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __CANSessionMux_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/FRCComm.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/FRCComm.h new file mode 100644 index 0000000..3d9ab5b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/FRCComm.h @@ -0,0 +1,111 @@ +/************************************************************* + * NOTICE + * + * These are the only externally exposed functions to the + * NetworkCommunication library + * + * This is an implementation of FRC Spec for Comm Protocol + * Revision 4.5, June 30, 2008 + * + * Copyright (c) National Instruments 2008. All Rights Reserved. + * + *************************************************************/ + +//This file must compile on ALL PLATFORMS. Be very careful what you put in here. + +#ifndef __FRC_COMM_H__ +#define __FRC_COMM_H__ + +#ifdef _WIN32 + #ifdef USE_THRIFT + #define EXPORT_FUNC + #else + #define EXPORT_FUNC __declspec(dllexport) __cdecl + #endif +#else + #include + #include + #define EXPORT_FUNC +#endif + +#define ERR_FRCSystem_NetCommNotResponding -44049 +#define ERR_FRCSystem_NoDSConnection -44018 + +enum AllianceStationID_t { + kAllianceStationID_red1, + kAllianceStationID_red2, + kAllianceStationID_red3, + kAllianceStationID_blue1, + kAllianceStationID_blue2, + kAllianceStationID_blue3, +}; + +enum MatchType_t { + kMatchType_none, + kMatchType_practice, + kMatchType_qualification, + kMatchType_elimination, +}; + +struct ControlWord_t { + uint32_t enabled : 1; + uint32_t autonomous : 1; + uint32_t test :1; + uint32_t eStop : 1; + uint32_t fmsAttached:1; + uint32_t dsAttached:1; + uint32_t control_reserved : 26; +}; + +struct JoystickAxes_t { + uint16_t count; + int16_t axes[1]; +}; + +struct JoystickPOV_t { + uint16_t count; + int16_t povs[1]; +}; + +#ifdef __cplusplus +extern "C" { +#endif + int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance); +#ifndef SIMULATION + void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision); +#endif + int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber, + const char *userDataHigh, int userDataHighLength, + const char *userDataLow, int userDataLowLength, int wait_ms); + int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms); + +#ifdef SIMULATION + void EXPORT_FUNC setNewDataSem(HANDLE); +#else + void EXPORT_FUNC setNewDataSem(pthread_cond_t *); +#endif + + // this uint32_t is really a LVRefNum + int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum); + + int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord); + int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation); + int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime); + int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes); + int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count); + int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs); + int EXPORT_FUNC FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum, uint32_t hidOutputs, uint16_t leftRumble, uint16_t rightRumble); + int EXPORT_FUNC FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox, uint8_t *type, char *name, + uint8_t *axisCount, uint8_t *axisTypes, uint8_t *buttonCount, uint8_t *povCount); + + void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version); + int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void); + void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/LoadOut.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/LoadOut.h new file mode 100644 index 0000000..c7ee1f3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/LoadOut.h @@ -0,0 +1,58 @@ + +#ifndef __LoadOut_h__ +#define __LoadOut_h__ + +#ifdef WIN32 +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#elif defined (__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#define EXPORT_FUNC +#endif + +#define kMaxModuleNumber 2 +namespace nLoadOut +{ +#if defined(__vxworks) || defined(SIMULATION) + typedef enum { + kModuleType_Unknown = 0x00, + kModuleType_Analog = 0x01, + kModuleType_Digital = 0x02, + kModuleType_Solenoid = 0x03, + } tModuleType; + bool EXPORT_FUNC getModulePresence(tModuleType moduleType, uint8_t moduleNumber); +#endif + typedef enum { + kTargetClass_Unknown = 0x00, + kTargetClass_FRC1 = 0x10, + kTargetClass_FRC2 = 0x20, + kTargetClass_FRC3 = 0x30, + kTargetClass_RoboRIO = 0x40, +#if defined(__vxworks) || defined(SIMULATION) + kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog, + kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital, + kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid, +#endif + kTargetClass_FamilyMask = 0xF0, + kTargetClass_ModuleMask = 0x0F, + } tTargetClass; + tTargetClass EXPORT_FUNC getTargetClass(); +} + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__vxworks) || defined(SIMULATION) + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber); +#endif + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass(); + +#ifdef __cplusplus +} +#endif + +#endif // __LoadOut_h__ diff --git a/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/UsageReporting.h b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/UsageReporting.h new file mode 100644 index 0000000..f5368bf --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/FRC_NetworkCommunication/UsageReporting.h @@ -0,0 +1,149 @@ + +#ifndef __UsageReporting_h__ +#define __UsageReporting_h__ + +#ifdef WIN32 +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#elif defined (__vxworks) +#include +#define EXPORT_FUNC +#else +#include +#include +#define EXPORT_FUNC +#endif + +#define kUsageReporting_version 1 + +namespace nUsageReporting +{ + typedef enum + { + kResourceType_Controller, + kResourceType_Module, + kResourceType_Language, + kResourceType_CANPlugin, + kResourceType_Accelerometer, + kResourceType_ADXL345, + kResourceType_AnalogChannel, + kResourceType_AnalogTrigger, + kResourceType_AnalogTriggerOutput, + kResourceType_CANJaguar, + kResourceType_Compressor, + kResourceType_Counter, + kResourceType_Dashboard, + kResourceType_DigitalInput, + kResourceType_DigitalOutput, + kResourceType_DriverStationCIO, + kResourceType_DriverStationEIO, + kResourceType_DriverStationLCD, + kResourceType_Encoder, + kResourceType_GearTooth, + kResourceType_Gyro, + kResourceType_I2C, + kResourceType_Framework, + kResourceType_Jaguar, + kResourceType_Joystick, + kResourceType_Kinect, + kResourceType_KinectStick, + kResourceType_PIDController, + kResourceType_Preferences, + kResourceType_PWM, + kResourceType_Relay, + kResourceType_RobotDrive, + kResourceType_SerialPort, + kResourceType_Servo, + kResourceType_Solenoid, + kResourceType_SPI, + kResourceType_Task, + kResourceType_Ultrasonic, + kResourceType_Victor, + kResourceType_Button, + kResourceType_Command, + kResourceType_AxisCamera, + kResourceType_PCVideoServer, + kResourceType_SmartDashboard, + kResourceType_Talon, + kResourceType_HiTechnicColorSensor, + kResourceType_HiTechnicAccel, + kResourceType_HiTechnicCompass, + kResourceType_SRF08, + kResourceType_AnalogOutput, + kResourceType_VictorSP, + kResourceType_TalonSRX, + kResourceType_CANTalonSRX, + kResourceType_ADXL362, + kResourceType_ADXRS450, + kResourceType_RevSPARK, + kResourceType_MindsensorsSD540, + kResourceType_DigitalFilter, + } tResourceType; + + typedef enum + { + kLanguage_LabVIEW = 1, + kLanguage_CPlusPlus = 2, + kLanguage_Java = 3, + kLanguage_Python = 4, + + kCANPlugin_BlackJagBridge = 1, + kCANPlugin_2CAN = 2, + + kFramework_Iterative = 1, + kFramework_Simple = 2, + kFramework_CommandControl = 3, + + kRobotDrive_ArcadeStandard = 1, + kRobotDrive_ArcadeButtonSpin = 2, + kRobotDrive_ArcadeRatioCurve = 3, + kRobotDrive_Tank = 4, + kRobotDrive_MecanumPolar = 5, + kRobotDrive_MecanumCartesian = 6, + + kDriverStationCIO_Analog = 1, + kDriverStationCIO_DigitalIn = 2, + kDriverStationCIO_DigitalOut = 3, + + kDriverStationEIO_Acceleration = 1, + kDriverStationEIO_AnalogIn = 2, + kDriverStationEIO_AnalogOut = 3, + kDriverStationEIO_Button = 4, + kDriverStationEIO_LED = 5, + kDriverStationEIO_DigitalIn = 6, + kDriverStationEIO_DigitalOut = 7, + kDriverStationEIO_FixedDigitalOut = 8, + kDriverStationEIO_PWM = 9, + kDriverStationEIO_Encoder = 10, + kDriverStationEIO_TouchSlider = 11, + + kADXL345_SPI = 1, + kADXL345_I2C = 2, + + kCommand_Scheduler = 1, + + kSmartDashboard_Instance = 1, + } tInstances; + + /** + * Report the usage of a resource of interest. + * + * @param resource one of the values in the tResourceType above (max value 51). + * @param instanceNumber an index that identifies the resource instance. + * @param context an optional additional context number for some cases (such as module number). Set to 0 to omit. + * @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string. + */ + uint32_t EXPORT_FUNC report(tResourceType resource, uint8_t instanceNumber, uint8_t context = 0, const char *feature = NULL); +} + +#ifdef __cplusplus +extern "C" { +#endif + + uint32_t EXPORT_FUNC FRC_NetworkCommunication_nUsageReporting_report(uint8_t resource, uint8_t instanceNumber, uint8_t context, const char *feature); + +#ifdef __cplusplus +} +#endif + +#endif // __UsageReporting_h__ diff --git a/Robot2016/wpilib/cpp/current/include/Filters/Filter.h b/Robot2016/wpilib/cpp/current/include/Filters/Filter.h new file mode 100644 index 0000000..1ab193b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Filters/Filter.h @@ -0,0 +1,49 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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 +#include "PIDSource.h" + +/** + * Interface for filters + */ +class Filter : public PIDSource { + public: + Filter(std::shared_ptr source); + virtual ~Filter() = default; + + // PIDSource interface + virtual void SetPIDSourceType(PIDSourceType pidSource) override; + PIDSourceType GetPIDSourceType() const; + virtual double PIDGet() override = 0; + + /** + * Returns the current filter estimate without also inserting new data as + * PIDGet() would do. + * + * @return The current filter estimate + */ + virtual double Get() const = 0; + + /** + * Reset the filter state + */ + virtual void Reset() = 0; + + protected: + /** + * Calls PIDGet() of source + * + * @return Current value of source + */ + double PIDGetSource(); + + private: + std::shared_ptr m_source; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Filters/LinearDigitalFilter.h b/Robot2016/wpilib/cpp/current/include/Filters/LinearDigitalFilter.h new file mode 100644 index 0000000..b6dbce7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Filters/LinearDigitalFilter.h @@ -0,0 +1,100 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015-2016. 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 +#include +#include +#include "Filter.h" +#include "CircularBuffer.h" + +/** + * This class implements a linear, digital filter. All types of FIR and IIR + * filters are supported. Static factory methods are provided to create commonly + * used types of filters. + * + * Filters are of the form: + * y[n] = (b0*x[n] + b1*x[n-1] + ... + bP*x[n-P) - (a0*y[n-1] + a2*y[n-2] + ... + aQ*y[n-Q]) + * + * Where: + * y[n] is the output at time "n" + * x[n] is the input at time "n" + * y[n-1] is the output from the LAST time step ("n-1") + * x[n-1] is the input from the LAST time step ("n-1") + * b0...bP are the "feedforward" (FIR) gains + * a0...aQ are the "feedback" (IIR) gains + * IMPORTANT! Note the "-" sign in front of the feedback term! This is a common + * convention in signal processing. + * + * What can linear filters do? Basically, they can filter, or diminish, the + * effects of undesirable input frequencies. High frequencies, or rapid changes, + * can be indicative of sensor noise or be otherwise undesirable. A "low pass" + * filter smooths out the signal, reducing the impact of these high frequency + * components. Likewise, a "high pass" filter gets rid of slow-moving signal + * components, letting you detect large changes more easily. + * + * Example FRC applications of filters: + * - Getting rid of noise from an analog sensor input (note: the roboRIO's FPGA + * can do this faster in hardware) + * - Smoothing out joystick input to prevent the wheels from slipping or the + * robot from tipping + * - Smoothing motor commands so that unnecessary strain isn't put on + * electrical or mechanical components + * - If you use clever gains, you can make a PID controller out of this class! + * + * For more on filters, I highly recommend the following articles: + * http://en.wikipedia.org/wiki/Linear_filter + * http://en.wikipedia.org/wiki/Iir_filter + * http://en.wikipedia.org/wiki/Fir_filter + * + * Note 1: PIDGet() should be called by the user on a known, regular period. + * You can set up a Notifier to do this (look at the WPILib PIDController + * class), or do it "inline" with code in a periodic function. + * + * Note 2: For ALL filters, gains are necessarily a function of frequency. If + * you make a filter that works well for you at, say, 100Hz, you will most + * definitely need to adjust the gains if you then want to run it at 200Hz! + * Combining this with Note 1 - the impetus is on YOU as a developer to make + * sure PIDGet() gets called at the desired, constant frequency! + */ +class LinearDigitalFilter : public Filter { + public: + LinearDigitalFilter(std::shared_ptr source, + std::initializer_list ffGains, + std::initializer_list fbGains); + LinearDigitalFilter(std::shared_ptr source, + std::initializer_list ffGains, + const std::vector& fbGains); + LinearDigitalFilter(std::shared_ptr source, + const std::vector& ffGains, + std::initializer_list fbGains); + LinearDigitalFilter(std::shared_ptr source, + const std::vector& ffGains, + const std::vector& fbGains); + + // Static methods to create commonly used filters + static LinearDigitalFilter SinglePoleIIR(std::shared_ptr source, + double timeConstant, double period); + static LinearDigitalFilter HighPass(std::shared_ptr source, + double timeConstant, double period); + static LinearDigitalFilter MovingAverage(std::shared_ptr source, + unsigned int taps); + + // Filter interface + double Get() const override; + void Reset() override; + + // PIDSource interface + double PIDGet() override; + + private: + CircularBuffer m_inputs; + CircularBuffer m_outputs; + std::vector m_inputGains; + std::vector m_outputGains; +}; diff --git a/Robot2016/wpilib/cpp/current/include/GearTooth.h b/Robot2016/wpilib/cpp/current/include/GearTooth.h new file mode 100644 index 0000000..070f397 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/GearTooth.h @@ -0,0 +1,33 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Counter.h" +#include + +/** + * Alias for counter class. + * Implement the gear tooth sensor supplied by FIRST. Currently there is no + * reverse sensing on + * the gear tooth sensor, but in future versions we might implement the + * necessary timing in the + * FPGA to sense direction. + */ +class GearTooth : public Counter { + public: + /// 55 uSec for threshold + static constexpr double kGearToothThreshold = 55e-6; + GearTooth(uint32_t channel, bool directionSensitive = false); + GearTooth(DigitalSource *source, bool directionSensitive = false); + GearTooth(std::shared_ptr source, + bool directionSensitive = false); + virtual ~GearTooth() = default; + void EnableDirectionSensing(bool directionSensitive); + + virtual std::string GetSmartDashboardType() const override; +}; diff --git a/Robot2016/wpilib/cpp/current/include/GenericHID.h b/Robot2016/wpilib/cpp/current/include/GenericHID.h new file mode 100644 index 0000000..17a959f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/GenericHID.h @@ -0,0 +1,33 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +/** GenericHID Interface + */ +class GenericHID { + public: + enum JoystickHand { kLeftHand = 0, kRightHand = 1 }; + + virtual ~GenericHID() = default; + + virtual float GetX(JoystickHand hand = kRightHand) const = 0; + virtual float GetY(JoystickHand hand = kRightHand) const = 0; + virtual float GetZ() const = 0; + virtual float GetTwist() const = 0; + virtual float GetThrottle() const = 0; + virtual float GetRawAxis(uint32_t axis) const = 0; + + virtual bool GetTrigger(JoystickHand hand = kRightHand) const = 0; + virtual bool GetTop(JoystickHand hand = kRightHand) const = 0; + virtual bool GetBumper(JoystickHand hand = kRightHand) const = 0; + virtual bool GetRawButton(uint32_t button) const = 0; + + virtual int GetPOV(uint32_t pov = 0) const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/GyroBase.h b/Robot2016/wpilib/cpp/current/include/GyroBase.h new file mode 100644 index 0000000..5d93fc4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/GyroBase.h @@ -0,0 +1,37 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SensorBase.h" +#include "PIDSource.h" +#include "interfaces/Gyro.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * GyroBase is the common base class for Gyro implementations such as + * AnalogGyro. + */ +class GyroBase : public Gyro, public SensorBase, public PIDSource, public LiveWindowSendable { + public: + virtual ~GyroBase() = default; + + // PIDSource interface + double PIDGet() override; + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + private: + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Accelerometer.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Accelerometer.hpp new file mode 100644 index 0000000..103fb2a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Accelerometer.hpp @@ -0,0 +1,15 @@ +#pragma once + +enum AccelerometerRange { + kRange_2G = 0, + kRange_4G = 1, + kRange_8G = 2, +}; + +extern "C" { + void setAccelerometerActive(bool); + void setAccelerometerRange(AccelerometerRange); + double getAccelerometerX(); + double getAccelerometerY(); + double getAccelerometerZ(); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Analog.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Analog.hpp new file mode 100644 index 0000000..2aa5e43 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Analog.hpp @@ -0,0 +1,78 @@ +#pragma once + +#include + +enum AnalogTriggerType +{ + kInWindow = 0, + kState = 1, + kRisingPulse = 2, + kFallingPulse = 3 +}; + +extern "C" +{ + // Analog output functions + void* initializeAnalogOutputPort(void* port_pointer, int32_t *status); + void freeAnalogOutputPort(void* analog_port_pointer); + void setAnalogOutput(void* analog_port_pointer, double voltage, int32_t *status); + double getAnalogOutput(void* analog_port_pointer, int32_t *status); + bool checkAnalogOutputChannel(uint32_t pin); + + // Analog input functions + void* initializeAnalogInputPort(void* port_pointer, int32_t *status); + void freeAnalogInputPort(void* analog_port_pointer); + bool checkAnalogModule(uint8_t module); + bool checkAnalogInputChannel(uint32_t pin); + + void setAnalogSampleRate(double samplesPerSecond, int32_t *status); + float getAnalogSampleRate(int32_t *status); + void setAnalogAverageBits(void* analog_port_pointer, uint32_t bits, int32_t *status); + uint32_t getAnalogAverageBits(void* analog_port_pointer, int32_t *status); + void setAnalogOversampleBits(void* analog_port_pointer, uint32_t bits, int32_t *status); + uint32_t getAnalogOversampleBits(void* analog_port_pointer, int32_t *status); + int16_t getAnalogValue(void* analog_port_pointer, int32_t *status); + int32_t getAnalogAverageValue(void* analog_port_pointer, int32_t *status); + int32_t getAnalogVoltsToValue(void* analog_port_pointer, double voltage, int32_t *status); + float getAnalogVoltage(void* analog_port_pointer, int32_t *status); + float getAnalogAverageVoltage(void* analog_port_pointer, int32_t *status); + uint32_t getAnalogLSBWeight(void* analog_port_pointer, int32_t *status); + int32_t getAnalogOffset(void* analog_port_pointer, int32_t *status); + + bool isAccumulatorChannel(void* analog_port_pointer, int32_t *status); + void initAccumulator(void* analog_port_pointer, int32_t *status); + void resetAccumulator(void* analog_port_pointer, int32_t *status); + void setAccumulatorCenter(void* analog_port_pointer, int32_t center, int32_t *status); + void setAccumulatorDeadband(void* analog_port_pointer, int32_t deadband, int32_t *status); + int64_t getAccumulatorValue(void* analog_port_pointer, int32_t *status); + uint32_t getAccumulatorCount(void* analog_port_pointer, int32_t *status); + void getAccumulatorOutput(void* analog_port_pointer, int64_t *value, uint32_t *count, + int32_t *status); + + void* initializeAnalogTrigger(void* port_pointer, uint32_t *index, int32_t *status); + void cleanAnalogTrigger(void* analog_trigger_pointer, int32_t *status); + void setAnalogTriggerLimitsRaw(void* analog_trigger_pointer, int32_t lower, int32_t upper, + int32_t *status); + void setAnalogTriggerLimitsVoltage(void* analog_trigger_pointer, double lower, double upper, + int32_t *status); + void setAnalogTriggerAveraged(void* analog_trigger_pointer, bool useAveragedValue, + int32_t *status); + void setAnalogTriggerFiltered(void* analog_trigger_pointer, bool useFilteredValue, + int32_t *status); + bool getAnalogTriggerInWindow(void* analog_trigger_pointer, int32_t *status); + bool getAnalogTriggerTriggerState(void* analog_trigger_pointer, int32_t *status); + bool getAnalogTriggerOutput(void* analog_trigger_pointer, AnalogTriggerType type, + int32_t *status); + + //// Float JNA Hack + // Float + int getAnalogSampleRateIntHack(int32_t *status); + int getAnalogVoltageIntHack(void* analog_port_pointer, int32_t *status); + int getAnalogAverageVoltageIntHack(void* analog_port_pointer, int32_t *status); + + // Doubles + void setAnalogSampleRateIntHack(int samplesPerSecond, int32_t *status); + int32_t getAnalogVoltsToValueIntHack(void* analog_port_pointer, int voltage, int32_t *status); + void setAnalogTriggerLimitsVoltageIntHack(void* analog_trigger_pointer, int lower, int upper, + int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/CAN.hpp b/Robot2016/wpilib/cpp/current/include/HAL/CAN.hpp new file mode 100644 index 0000000..c10450b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/CAN.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include +#include "FRC_NetworkCommunication/CANSessionMux.h" + +void canTxSend(uint32_t arbID, uint8_t length, int32_t period = CAN_SEND_PERIOD_NO_REPEAT); + +void canTxPackInt8 (uint32_t arbID, uint8_t offset, uint8_t value); +void canTxPackInt16(uint32_t arbID, uint8_t offset, uint16_t value); +void canTxPackInt32(uint32_t arbID, uint8_t offset, uint32_t value); +void canTxPackFXP16(uint32_t arbID, uint8_t offset, double value); +void canTxPackFXP32(uint32_t arbID, uint8_t offset, double value); + +uint8_t canTxUnpackInt8 (uint32_t arbID, uint8_t offset); +uint32_t canTxUnpackInt32(uint32_t arbID, uint8_t offset); +uint16_t canTxUnpackInt16(uint32_t arbID, uint8_t offset); +double canTxUnpackFXP16(uint32_t arbID, uint8_t offset); +double canTxUnpackFXP32(uint32_t arbID, uint8_t offset); + +bool canRxReceive(uint32_t arbID); + +uint8_t canRxUnpackInt8 (uint32_t arbID, uint8_t offset); +uint16_t canRxUnpackInt16(uint32_t arbID, uint8_t offset); +uint32_t canRxUnpackInt32(uint32_t arbID, uint8_t offset); +double canRxUnpackFXP16(uint32_t arbID, uint8_t offset); +double canRxUnpackFXP32(uint32_t arbID, uint8_t offset); diff --git a/Robot2016/wpilib/cpp/current/include/HAL/CanTalonSRX.h b/Robot2016/wpilib/cpp/current/include/HAL/CanTalonSRX.h new file mode 100644 index 0000000..87e2bf0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/CanTalonSRX.h @@ -0,0 +1,829 @@ +/** + * @brief CAN TALON SRX driver. + * + * The TALON SRX is designed to instrument all runtime signals periodically. + * The default periods are chosen to support 16 TALONs with 10ms update rate + * for control (throttle or setpoint). However these can be overridden with + * SetStatusFrameRate. @see SetStatusFrameRate + * The getters for these unsolicited signals are auto generated at the bottom + * of this module. + * + * Likewise most control signals are sent periodically using the fire-and-forget + * CAN API. The setters for these unsolicited signals are auto generated at the + * bottom of this module. + * + * Signals that are not available in an unsolicited fashion are the Close Loop + * gains. For teams that have a single profile for their TALON close loop they + * can use either the webpage to configure their TALONs once or set the PIDF, + * Izone, CloseLoopRampRate, etc... once in the robot application. These + * parameters are saved to flash so once they are loaded in the TALON, they + * will persist through power cycles and mode changes. + * + * For teams that have one or two profiles to switch between, they can use the + * same strategy since there are two slots to choose from and the + * ProfileSlotSelect is periodically sent in the 10 ms control frame. + * + * For teams that require changing gains frequently, they can use the soliciting + * API to get and set those parameters. Most likely they will only need to set + * them in a periodic fashion as a function of what motion the application is + * attempting. If this API is used, be mindful of the CAN utilization reported + * in the driver station. + * + * If calling application has used the config routines to configure the + * selected feedback sensor, then all positions are measured in floating point + * precision rotations. All sensor velocities are specified in floating point + * precision RPM. + * @see ConfigPotentiometerTurns + * @see ConfigEncoderCodesPerRev + * HOWEVER, if calling application has not called the config routine for + * selected feedback sensor, then all getters/setters for position/velocity use + * the native engineering units of the Talon SRX firm (just like in 2015). + * Signals explained below. + * + * Encoder position is measured in encoder edges. Every edge is counted + * (similar to roboRIO 4X mode). Analog position is 10 bits, meaning 1024 + * ticks per rotation (0V => 3.3V). Use SetFeedbackDeviceSelect to select + * which sensor type you need. Once you do that you can use GetSensorPosition() + * and GetSensorVelocity(). These signals are updated on CANBus every 20ms (by + * default). If a relative sensor is selected, you can zero (or change the + * current value) using SetSensorPosition. + * + * Analog Input and quadrature position (and velocity) are also explicitly + * reported in GetEncPosition, GetEncVel, GetAnalogInWithOv, GetAnalogInVel. + * These signals are available all the time, regardless of what sensor is + * selected at a rate of 100ms. This allows easy instrumentation for "in the + * pits" checking of all sensors regardless of modeselect. The 100ms rate is + * overridable for teams who want to acquire sensor data for processing, not + * just instrumentation. Or just select the sensor using + * SetFeedbackDeviceSelect to get it at 20ms. + * + * Velocity is in position ticks / 100ms. + * + * All output units are in respect to duty cycle (throttle) which is -1023(full + * reverse) to +1023 (full forward). This includes demand (which specifies + * duty cycle when in duty cycle mode) and rampRamp, which is in throttle units + * per 10ms (if nonzero). + * + * Pos and velocity close loops are calc'd as + * err = target - posOrVel. + * iErr += err; + * if( (IZone!=0) and abs(err) > IZone) + * ClearIaccum() + * output = P X err + I X iErr + D X dErr + F X target + * dErr = err - lastErr + * P, I, and D gains are always positive. F can be negative. + * Motor direction can be reversed using SetRevMotDuringCloseLoopEn if + * sensor and motor are out of phase. Similarly feedback sensor can also be + * reversed (multiplied by -1) if you prefer the sensor to be inverted. + * + * P gain is specified in throttle per error tick. For example, a value of 102 + * is ~9.9% (which is 102/1023) throttle per 1 ADC unit(10bit) or 1 quadrature + * encoder edge depending on selected sensor. + * + * I gain is specified in throttle per integrated error. For example, a value + * of 10 equates to ~0.99% (which is 10/1023) for each accumulated ADC unit + * (10 bit) or 1 quadrature encoder edge depending on selected sensor. + * Close loop and integral accumulator runs every 1ms. + * + * D gain is specified in throttle per derivative error. For example a value of + * 102 equates to ~9.9% (which is 102/1023) per change of 1 unit (ADC or + * encoder) per ms. + * + * I Zone is specified in the same units as sensor position (ADC units or + * quadrature edges). If pos/vel error is outside of this value, the + * integrated error will auto-clear... + * if( (IZone!=0) and abs(err) > IZone) + * ClearIaccum() + * ...this is very useful in preventing integral windup and is highly + * recommended if using full PID to keep stability low. + * + * CloseLoopRampRate is in throttle units per 1ms. Set to zero to disable + * ramping. Works the same as RampThrottle but only is in effect when a close + * loop mode and profile slot is selected. + * + * auto generated using spreadsheet and wpiclassgen.py + * @link https://docs.google.com/spreadsheets/d/1OU_ZV7fZLGYUQ-Uhc8sVAmUmWTlT8XBFYK8lfjg_tac/edit#gid=1766046967 + */ +#ifndef CanTalonSRX_H_ +#define CanTalonSRX_H_ +#include "ctre/ctre.h" //BIT Defines + Typedefs, TALON_Control_6_MotProfAddTrajPoint_t +#include "ctre/CtreCanNode.h" +#include //CAN Comm +#include +#include +#include +#include +class CanTalonSRX : public CtreCanNode { + private: + // Use this for determining whether the default move constructor has been + // called; this prevents us from calling the destructor twice. + struct HasBeenMoved { + HasBeenMoved(HasBeenMoved &&other) { + other.moved = true; + moved = false; + } + HasBeenMoved() = default; + std::atomic moved{false}; + operator bool() const { return moved; } + } m_hasBeenMoved; + + // Vars for opening a CAN stream if caller needs signals that require + // soliciting + uint32_t _can_h; //!< Session handle for catching response params. + int32_t _can_stat; //!< Session handle status. + struct tCANStreamMessage _msgBuff[20]; + static int const kMsgCapacity = 20; + typedef std::map sigs_t; + // Catches signal updates that are solicited. Expect this to be very few. + sigs_t _sigs; + void OpenSessionIfNeedBe(); + void ProcessStreamMessages(); + /** + * Called in various places to double check we are using the best control + * frame. If the Talon firmware is too old, use control 1 framing, which + * does not allow setting control signals until robot is enabled. If Talon + * firmware can suport control5, use that since that frame can be + * transmitted during robot-disable. If calling application uses setParam + * to set the signal eLegacyControlMode, caller can force using control1 + * if needed for some reason. + */ + void UpdateControlId(); + /** + * @return true if Talon is reporting that it supports control5, and therefore + * RIO can send control5 to update control params (even when + * disabled). + */ + bool IsControl5Supported(); + /** + * Get a copy of the control frame to send. + * @param [out] pointer to eight byte array to fill. + */ + void GetControlFrameCopy(uint8_t *toFill); + /** + * @return the tx task that transmits Control6 (motion profile control). + * If it's not scheduled, then schedule it. This is part + * of making the lazy-framing that only peforms MotionProf framing + * when needed to save bandwidth. + */ + CtreCanNode::txTask GetControl6(); + /** + * Caller is either pushing a new motion profile point, or is + * calling the Process buffer routine. In either case check our + * flow control to see if we need to start sending control6. + */ + void ReactToMotionProfileCall(); + /** + * Update the NextPt signals inside the control frame given the next pt to + * send. + * @param control pointer to the CAN frame payload containing control6. Only + * the signals that serialize the next trajectory point are + * updated from the contents of newPt. + * @param newPt point to the next trajectory that needs to be inserted into + * Talon RAM. + */ + void CopyTrajPtIntoControl( + TALON_Control_6_MotProfAddTrajPoint_t *control, + const TALON_Control_6_MotProfAddTrajPoint_t *newPt); + //---------------------- General Control framing ---------------------------// + /** + * Frame period for control1 or control5, depending on which one we are using. + */ + int _controlPeriodMs = kDefaultControlPeriodMs; + /** + * Frame Period of the motion profile control6 frame. + */ + int _control6PeriodMs = kDefaultControl6PeriodMs; + /** + * When using control5, we still need to send a frame to enable robot. This + * controls the period. This only is used when we are in the control5 state. + * @see ControlFrameSelControl5 + */ + int _enablePeriodMs = kDefaultEnablePeriodMs; + /** + * ArbID to use for control frame. Should be either CONTROL_1 or CONTROL_5. + */ + uint32_t _controlFrameArbId; + /** + * Boolean flag to signal calling applications intent to allow using control5 + * assuming Talon firmware supports it. This can be cleared to force control1 + * framing. + */ + bool _useControl5ifSupported = true; + //--------------------- Buffering Motion Profile ---------------------------// + /** + * Top level Buffer for motion profile trajectory buffering. + * Basically this buffers up the eight byte CAN frame payloads that are + * handshaked into the Talon RAM. + * TODO: Should this be moved into a separate header, and if so where + * logically should it reside? + * TODO: Add compression so that multiple CAN frames can be compressed into + * one exchange. + */ + class TrajectoryBuffer { + public: + void Clear() { _motProfTopBuffer.clear(); } + /** + * push caller's uncompressed simple trajectory point. + */ + void Push(TALON_Control_6_MotProfAddTrajPoint_huff0_t &pt) { + _motProfTopBuffer.push_back(pt); + } + /** + * Get the next trajectory point CAN frame to send. + * Underlying layer may compress the next few points together + * into one control_6 frame. + */ + TALON_Control_6_MotProfAddTrajPoint_t *Front() { + /* TODO : peek ahead and use compression strategies */ + _lastFront = _motProfTopBuffer.front(); + return (TALON_Control_6_MotProfAddTrajPoint_t *)&_lastFront; + } + void Pop() { + /* TODO : pop multiple points if last front'd point was compressed. */ + _motProfTopBuffer.pop_front(); + } + unsigned int GetNumTrajectories() { return _motProfTopBuffer.size(); } + bool IsEmpty() { return _motProfTopBuffer.empty(); } + + private: + std::deque _motProfTopBuffer; + TALON_Control_6_MotProfAddTrajPoint_huff0_t _lastFront; + }; + TrajectoryBuffer _motProfTopBuffer; + /** + * To keep buffers from getting out of control, place a cap on the top level + * buffer. Calling application + * can stream addition points as they are fed to Talon. + * Approx memory footprint is this capacity X 8 bytes. + */ + static const int kMotionProfileTopBufferCapacity = 2048; + /** + * Flow control for streaming trajectories. + */ + int32_t _motProfFlowControl = -1; + /** + * Since we may need the MP pts to be emptied into Talon in the background + * make sure the buffering is thread-safe. + */ + std::mutex _mutMotProf; + /** + * Send a one shot frame to set an arbitrary signal. + * Most signals are in the control frame so avoid using this API unless you + * have to. + * Use this api for... + * -A motor controller profile signal eProfileParam_XXXs. These are backed up + * in flash. If you are gain-scheduling then call this periodically. + * -Default brake and limit switch signals... eOnBoot_XXXs. Avoid doing this, + * use the override signals in the control frame. + * Talon will automatically send a PARAM_RESPONSE after the set, so + * GetParamResponse will catch the latest value after a couple ms. + */ + CTR_Code SetParamRaw(uint32_t paramEnum, int32_t rawBits); + /** + * Checks cached CAN frames and updating solicited signals. + */ + CTR_Code GetParamResponseRaw(uint32_t paramEnum, int32_t &rawBits); + + public: + // default control update rate is 10ms. + static const int kDefaultControlPeriodMs = 10; + // default enable update rate is 50ms (when using the new control5 frame). + static const int kDefaultEnablePeriodMs = 50; + // Default update rate for motion profile control 6. This only takes effect + // when calling uses MP functions. + static const int kDefaultControl6PeriodMs = 10; + explicit CanTalonSRX(int deviceNumber = 0, + int controlPeriodMs = kDefaultControlPeriodMs, + int enablePeriodMs = kDefaultEnablePeriodMs); + ~CanTalonSRX(); + void Set(double value); + /* mode select enumerations */ + // Demand is 11bit signed duty cycle [-1023,1023]. + static const int kMode_DutyCycle = 0; + // Position PIDF. + static const int kMode_PositionCloseLoop = 1; + // Velocity PIDF. + static const int kMode_VelocityCloseLoop = 2; + // Current close loop - not done. + static const int kMode_CurrentCloseLoop = 3; + // Voltage Compensation Mode - not done. Demand is fixed pt target 8.8 volts. + static const int kMode_VoltCompen = 4; + // Demand is the 6 bit Device ID of the 'master' TALON SRX. + static const int kMode_SlaveFollower = 5; + // Demand is '0' (Disabled), '1' (Enabled), or '2' (Hold). + static const int kMode_MotionProfile = 6; + // Zero the output (honors brake/coast) regardless of demand. + // Might be useful if we need to change modes but can't atomically + // change all the signals we want in between. + static const int kMode_NoDrive = 15; + /* limit switch enumerations */ + static const int kLimitSwitchOverride_UseDefaultsFromFlash = 1; + static const int kLimitSwitchOverride_DisableFwd_DisableRev = 4; + static const int kLimitSwitchOverride_DisableFwd_EnableRev = 5; + static const int kLimitSwitchOverride_EnableFwd_DisableRev = 6; + static const int kLimitSwitchOverride_EnableFwd_EnableRev = 7; + /* brake override enumerations */ + static const int kBrakeOverride_UseDefaultsFromFlash = 0; + static const int kBrakeOverride_OverrideCoast = 1; + static const int kBrakeOverride_OverrideBrake = 2; + /* feedback device enumerations */ + static const int kFeedbackDev_DigitalQuadEnc = 0; + static const int kFeedbackDev_AnalogPot = 2; + static const int kFeedbackDev_AnalogEncoder = 3; + static const int kFeedbackDev_CountEveryRisingEdge = 4; + static const int kFeedbackDev_CountEveryFallingEdge = 5; + static const int kFeedbackDev_PosIsPulseWidth = 8; + /* ProfileSlotSelect enumerations*/ + static const int kProfileSlotSelect_Slot0 = 0; + static const int kProfileSlotSelect_Slot1 = 1; + /* status frame rate types */ + static const int kStatusFrame_General = 0; + static const int kStatusFrame_Feedback = 1; + static const int kStatusFrame_Encoder = 2; + static const int kStatusFrame_AnalogTempVbat = 3; + static const int kStatusFrame_PulseWidthMeas = 4; + static const int kStatusFrame_MotionProfile = 5; + /* Motion Profile status bits */ + static const int kMotionProfileFlag_ActTraj_IsValid = 0x1; + static const int kMotionProfileFlag_HasUnderrun = 0x2; + static const int kMotionProfileFlag_IsUnderrun = 0x4; + static const int kMotionProfileFlag_ActTraj_IsLast = 0x8; + static const int kMotionProfileFlag_ActTraj_VelOnly = 0x10; + /* Motion Profile Set Output */ + // Motor output is neutral, Motion Profile Executer is not running. + static const int kMotionProf_Disabled = 0; + // Motor output is updated from Motion Profile Executer, MPE will + // process the buffered points. + static const int kMotionProf_Enable = 1; + // Motor output is updated from Motion Profile Executer, MPE will + // stay processing current trajectory point. + static const int kMotionProf_Hold = 2; + /** + * Signal enumeration for generic signal access. + * Although every signal is enumerated, only use this for traffic that must + * be solicited. + * Use the auto generated getters/setters at bottom of this header as much as + * possible. + */ + enum param_t { + eProfileParamSlot0_P = 1, + eProfileParamSlot0_I = 2, + eProfileParamSlot0_D = 3, + eProfileParamSlot0_F = 4, + eProfileParamSlot0_IZone = 5, + eProfileParamSlot0_CloseLoopRampRate = 6, + eProfileParamSlot1_P = 11, + eProfileParamSlot1_I = 12, + eProfileParamSlot1_D = 13, + eProfileParamSlot1_F = 14, + eProfileParamSlot1_IZone = 15, + eProfileParamSlot1_CloseLoopRampRate = 16, + eProfileParamSoftLimitForThreshold = 21, + eProfileParamSoftLimitRevThreshold = 22, + eProfileParamSoftLimitForEnable = 23, + eProfileParamSoftLimitRevEnable = 24, + eOnBoot_BrakeMode = 31, + eOnBoot_LimitSwitch_Forward_NormallyClosed = 32, + eOnBoot_LimitSwitch_Reverse_NormallyClosed = 33, + eOnBoot_LimitSwitch_Forward_Disable = 34, + eOnBoot_LimitSwitch_Reverse_Disable = 35, + eFault_OverTemp = 41, + eFault_UnderVoltage = 42, + eFault_ForLim = 43, + eFault_RevLim = 44, + eFault_HardwareFailure = 45, + eFault_ForSoftLim = 46, + eFault_RevSoftLim = 47, + eStckyFault_OverTemp = 48, + eStckyFault_UnderVoltage = 49, + eStckyFault_ForLim = 50, + eStckyFault_RevLim = 51, + eStckyFault_ForSoftLim = 52, + eStckyFault_RevSoftLim = 53, + eAppliedThrottle = 61, + eCloseLoopErr = 62, + eFeedbackDeviceSelect = 63, + eRevMotDuringCloseLoopEn = 64, + eModeSelect = 65, + eProfileSlotSelect = 66, + eRampThrottle = 67, + eRevFeedbackSensor = 68, + eLimitSwitchEn = 69, + eLimitSwitchClosedFor = 70, + eLimitSwitchClosedRev = 71, + eSensorPosition = 73, + eSensorVelocity = 74, + eCurrent = 75, + eBrakeIsEnabled = 76, + eEncPosition = 77, + eEncVel = 78, + eEncIndexRiseEvents = 79, + eQuadApin = 80, + eQuadBpin = 81, + eQuadIdxpin = 82, + eAnalogInWithOv = 83, + eAnalogInVel = 84, + eTemp = 85, + eBatteryV = 86, + eResetCount = 87, + eResetFlags = 88, + eFirmVers = 89, + eSettingsChanged = 90, + eQuadFilterEn = 91, + ePidIaccum = 93, + eStatus1FrameRate = 94, // TALON_Status_1_General_10ms_t + eStatus2FrameRate = 95, // TALON_Status_2_Feedback_20ms_t + eStatus3FrameRate = 96, // TALON_Status_3_Enc_100ms_t + eStatus4FrameRate = 97, // TALON_Status_4_AinTempVbat_100ms_t + eStatus6FrameRate = 98, // TALON_Status_6_Eol_t + eStatus7FrameRate = 99, // TALON_Status_7_Debug_200ms_t + eClearPositionOnIdx = 100, + // reserved, + // reserved, + // reserved, + ePeakPosOutput = 104, + eNominalPosOutput = 105, + ePeakNegOutput = 106, + eNominalNegOutput = 107, + eQuadIdxPolarity = 108, + eStatus8FrameRate = 109, // TALON_Status_8_PulseWid_100ms_t + eAllowPosOverflow = 110, + eProfileParamSlot0_AllowableClosedLoopErr = 111, + eNumberPotTurns = 112, + eNumberEncoderCPR = 113, + ePwdPosition = 114, + eAinPosition = 115, + eProfileParamVcompRate = 116, + eProfileParamSlot1_AllowableClosedLoopErr = 117, + eStatus9FrameRate = 118, // TALON_Status_9_MotProfBuffer_100ms_t + eMotionProfileHasUnderrunErr = 119, + eReserved120 = 120, + eLegacyControlMode = 121, + }; + //---- setters and getters that use the solicated param request/response ---// + /** + * Send a one shot frame to set an arbitrary signal. + * Most signals are in the control frame so avoid using this API unless you + * have to. + * Use this api for... + * -A motor controller profile signal eProfileParam_XXXs. These are backed + * up in flash. If you are gain-scheduling then call this periodically. + * -Default brake and limit switch signals... eOnBoot_XXXs. Avoid doing + * this, use the override signals in the control frame. + * Talon will automatically send a PARAM_RESPONSE after the set, so + * GetParamResponse will catch the latest value after a couple ms. + */ + CTR_Code SetParam(param_t paramEnum, double value); + /** + * Asks TALON to immedietely respond with signal value. This API is only used + * for signals that are not sent periodically. + * This can be useful for reading params that rarely change like Limit Switch + * settings and PIDF values. + * @param param to request. + */ + CTR_Code RequestParam(param_t paramEnum); + CTR_Code GetParamResponse(param_t paramEnum, double &value); + CTR_Code GetParamResponseInt32(param_t paramEnum, int &value); + //----------- getters and setters that use param request/response ----------// + /** + * These signals are backed up in flash and will survive a power cycle. + * If your application requires changing these values consider using both + * slots and switch between slot0 <=> slot1. + * If your application requires changing these signals frequently then it + * makes sense to leverage this API. + * Getters don't block, so it may require several calls to get the latest + * value. + */ + CTR_Code SetPgain(unsigned slotIdx, double gain); + CTR_Code SetIgain(unsigned slotIdx, double gain); + CTR_Code SetDgain(unsigned slotIdx, double gain); + CTR_Code SetFgain(unsigned slotIdx, double gain); + CTR_Code SetIzone(unsigned slotIdx, int zone); + CTR_Code SetCloseLoopRampRate(unsigned slotIdx, int closeLoopRampRate); + CTR_Code SetVoltageCompensationRate(double voltagePerMs); + CTR_Code SetSensorPosition(int pos); + CTR_Code SetForwardSoftLimit(int forwardLimit); + CTR_Code SetReverseSoftLimit(int reverseLimit); + CTR_Code SetForwardSoftEnable(int enable); + CTR_Code SetReverseSoftEnable(int enable); + CTR_Code GetPgain(unsigned slotIdx, double &gain); + CTR_Code GetIgain(unsigned slotIdx, double &gain); + CTR_Code GetDgain(unsigned slotIdx, double &gain); + CTR_Code GetFgain(unsigned slotIdx, double &gain); + CTR_Code GetIzone(unsigned slotIdx, int &zone); + CTR_Code GetCloseLoopRampRate(unsigned slotIdx, int &closeLoopRampRate); + CTR_Code GetVoltageCompensationRate(double &voltagePerMs); + CTR_Code GetForwardSoftLimit(int &forwardLimit); + CTR_Code GetReverseSoftLimit(int &reverseLimit); + CTR_Code GetForwardSoftEnable(int &enable); + CTR_Code GetReverseSoftEnable(int &enable); + CTR_Code GetPulseWidthRiseToFallUs(int ¶m); + CTR_Code IsPulseWidthSensorPresent(int ¶m); + CTR_Code SetModeSelect(int modeSelect, int demand); + /** + * Change the periodMs of a TALON's status frame. See kStatusFrame_* enums + * for what's available. + */ + CTR_Code SetStatusFrameRate(unsigned frameEnum, unsigned periodMs); + /** + * Clear all sticky faults in TALON. + */ + CTR_Code ClearStickyFaults(); + /** + * Calling application can opt to speed up the handshaking between the robot + * API and the Talon to increase the + * download rate of the Talon's Motion Profile. Ideally the period should be + * no more than half the period + * of a trajectory point. + */ + void ChangeMotionControlFramePeriod(uint32_t periodMs); + /** + * Clear the buffered motion profile in both Talon RAM (bottom), and in the + * API (top). + */ + void ClearMotionProfileTrajectories(); + /** + * Retrieve just the buffer count for the api-level (top) buffer. + * This routine performs no CAN or data structure lookups, so its fast and + * ideal if caller needs to quickly poll the progress of trajectory points + * being emptied into Talon's RAM. Otherwise just use GetMotionProfileStatus. + * @return number of trajectory points in the top buffer. + */ + uint32_t GetMotionProfileTopLevelBufferCount(); + /** + * Retrieve just the buffer full for the api-level (top) buffer. + * This routine performs no CAN or data structure lookups, so its fast and + * ideal if caller needs to quickly poll. Otherwise just use + * GetMotionProfileStatus. + * @return number of trajectory points in the top buffer. + */ + bool IsMotionProfileTopLevelBufferFull(); + /** + * Push another trajectory point into the top level buffer (which is emptied + * into the Talon's bottom buffer as room allows). + * @param targPos servo position in native Talon units (sensor units). + * @param targVel velocity to feed-forward in native Talon units (sensor + * units per 100ms). + * @param profileSlotSelect which slot to pull PIDF gains from. Currently + * supports 0 or 1. + * @param timeDurMs time in milliseconds of how long to apply this point. + * @param velOnly set to nonzero to signal Talon that only the feed-foward + * velocity should be used, i.e. do not perform PID on + * position. This is equivalent to setting PID gains to zero, + * but much more efficient and synchronized to MP. + * @param isLastPoint set to nonzero to signal Talon to keep processing this + * trajectory point, instead of jumping to the next one + * when timeDurMs expires. Otherwise MP executer will + * eventually see an empty buffer after the last point + * expires, causing it to assert the IsUnderRun flag. + * However this may be desired if calling application + * nevers wants to terminate the MP. + * @param zeroPos set to nonzero to signal Talon to "zero" the selected + * position sensor before executing this trajectory point. + * Typically the first point should have this set only thus + * allowing the remainder of the MP positions to be relative + * to zero. + * @return CTR_OKAY if trajectory point push ok. CTR_BufferFull if buffer is + * full due to kMotionProfileTopBufferCapacity. + */ + CTR_Code PushMotionProfileTrajectory(int targPos, int targVel, + int profileSlotSelect, int timeDurMs, + int velOnly, int isLastPoint, + int zeroPos); + /** + * This must be called periodically to funnel the trajectory points from the + * API's top level buffer to the Talon's bottom level buffer. Recommendation + * is to call this twice as fast as the executation rate of the motion + * profile. So if MP is running with 20ms trajectory points, try calling + * this routine every 10ms. All motion profile functions are thread-safe + * through the use of a mutex, so there is no harm in having the caller + * utilize threading. + */ + void ProcessMotionProfileBuffer(); + /** + * Retrieve all status information. + * Since this all comes from one CAN frame, its ideal to have one routine to + * retrieve the frame once and decode everything. + * @param [out] flags bitfield for status bools. Starting with least + * significant bit: IsValid, HasUnderrun, IsUnderrun, IsLast, VelOnly. + * + * IsValid set when MP executer is processing a trajectory point, + * and that point's status is instrumented with IsLast, + * VelOnly, targPos, targVel. However if MP executor is + * not processing a trajectory point, then this flag is + * false, and the instrumented signals will be zero. + * HasUnderrun is set anytime the MP executer is ready to pop + * another trajectory point from the Talon's RAM, + * but the buffer is empty. It can only be cleared + * by using SetParam(eMotionProfileHasUnderrunErr,0); + * IsUnderrun is set when the MP executer is ready for another + * point, but the buffer is empty, and cleared when + * the MP executer does not need another point. + * HasUnderrun shadows this registor when this + * register gets set, however HasUnderrun stays + * asserted until application has process it, and + * IsUnderrun auto-clears when the condition is + * resolved. + * IsLast is set/cleared based on the MP executer's current + * trajectory point's IsLast value. This assumes + * IsLast was set when PushMotionProfileTrajectory + * was used to insert the currently processed trajectory + * point. + * VelOnly is set/cleared based on the MP executer's current + * trajectory point's VelOnly value. + * + * @param [out] profileSlotSelect The currently processed trajectory point's + * selected slot. This can differ in the currently selected slot used + * for Position and Velocity servo modes. + * @param [out] targPos The currently processed trajectory point's position + * in native units. This param is zero if IsValid is zero. + * @param [out] targVel The currently processed trajectory point's velocity + * in native units. This param is zero if IsValid is zero. + * @param [out] topBufferRem The remaining number of points in the top level + * buffer. + * @param [out] topBufferCnt The number of points in the top level buffer to + * be sent to Talon. + * @param [out] btmBufferCnt The number of points in the bottom level buffer + * inside Talon. + * @return CTR error code + */ + CTR_Code GetMotionProfileStatus(uint32_t &flags, uint32_t &profileSlotSelect, + int32_t &targPos, int32_t &targVel, + uint32_t &topBufferRemaining, + uint32_t &topBufferCnt, + uint32_t &btmBufferCnt, + uint32_t &outputEnable); +//------------------------ auto generated ------------------------------------// +/* This API is optimal since it uses the fire-and-forget CAN interface. + * These signals should cover the majority of all use cases. + */ + CTR_Code GetFault_OverTemp(int ¶m); + CTR_Code GetFault_UnderVoltage(int ¶m); + CTR_Code GetFault_ForLim(int ¶m); + CTR_Code GetFault_RevLim(int ¶m); + CTR_Code GetFault_HardwareFailure(int ¶m); + CTR_Code GetFault_ForSoftLim(int ¶m); + CTR_Code GetFault_RevSoftLim(int ¶m); + CTR_Code GetStckyFault_OverTemp(int ¶m); + CTR_Code GetStckyFault_UnderVoltage(int ¶m); + CTR_Code GetStckyFault_ForLim(int ¶m); + CTR_Code GetStckyFault_RevLim(int ¶m); + CTR_Code GetStckyFault_ForSoftLim(int ¶m); + CTR_Code GetStckyFault_RevSoftLim(int ¶m); + CTR_Code GetAppliedThrottle(int ¶m); + CTR_Code GetCloseLoopErr(int ¶m); + CTR_Code GetFeedbackDeviceSelect(int ¶m); + CTR_Code GetModeSelect(int ¶m); + CTR_Code GetLimitSwitchEn(int ¶m); + CTR_Code GetLimitSwitchClosedFor(int ¶m); + CTR_Code GetLimitSwitchClosedRev(int ¶m); + CTR_Code GetSensorPosition(int ¶m); + CTR_Code GetSensorVelocity(int ¶m); + CTR_Code GetCurrent(double ¶m); + CTR_Code GetBrakeIsEnabled(int ¶m); + CTR_Code GetEncPosition(int ¶m); + CTR_Code GetEncVel(int ¶m); + CTR_Code GetEncIndexRiseEvents(int ¶m); + CTR_Code GetQuadApin(int ¶m); + CTR_Code GetQuadBpin(int ¶m); + CTR_Code GetQuadIdxpin(int ¶m); + CTR_Code GetAnalogInWithOv(int ¶m); + CTR_Code GetAnalogInVel(int ¶m); + CTR_Code GetTemp(double ¶m); + CTR_Code GetBatteryV(double ¶m); + CTR_Code GetResetCount(int ¶m); + CTR_Code GetResetFlags(int ¶m); + CTR_Code GetFirmVers(int ¶m); + CTR_Code GetPulseWidthPosition(int ¶m); + CTR_Code GetPulseWidthVelocity(int ¶m); + CTR_Code GetPulseWidthRiseToRiseUs(int ¶m); + CTR_Code GetActTraj_IsValid(int ¶m); + CTR_Code GetActTraj_ProfileSlotSelect(int ¶m); + CTR_Code GetActTraj_VelOnly(int ¶m); + CTR_Code GetActTraj_IsLast(int ¶m); + CTR_Code GetOutputType(int ¶m); + CTR_Code GetHasUnderrun(int ¶m); + CTR_Code GetIsUnderrun(int ¶m); + CTR_Code GetNextID(int ¶m); + CTR_Code GetBufferIsFull(int ¶m); + CTR_Code GetCount(int ¶m); + CTR_Code GetActTraj_Velocity(int ¶m); + CTR_Code GetActTraj_Position(int ¶m); + CTR_Code SetDemand(int param); + CTR_Code SetOverrideLimitSwitchEn(int param); + CTR_Code SetFeedbackDeviceSelect(int param); + CTR_Code SetRevMotDuringCloseLoopEn(int param); + CTR_Code SetOverrideBrakeType(int param); + CTR_Code SetModeSelect(int param); + CTR_Code SetProfileSlotSelect(int param); + CTR_Code SetRampThrottle(int param); + CTR_Code SetRevFeedbackSensor(int param); +}; +extern "C" { + void *c_TalonSRX_Create3(int deviceNumber, int controlPeriodMs, int enablePeriodMs); + void *c_TalonSRX_Create2(int deviceNumber, int controlPeriodMs); + void *c_TalonSRX_Create1(int deviceNumber); + void c_TalonSRX_Destroy(void *handle); + void c_TalonSRX_Set(void *handle, double value); + CTR_Code c_TalonSRX_SetParam(void *handle, int paramEnum, double value); + CTR_Code c_TalonSRX_RequestParam(void *handle, int paramEnum); + CTR_Code c_TalonSRX_GetParamResponse(void *handle, int paramEnum, double *value); + CTR_Code c_TalonSRX_GetParamResponseInt32(void *handle, int paramEnum, int *value); + CTR_Code c_TalonSRX_SetPgain(void *handle, int slotIdx, double gain); + CTR_Code c_TalonSRX_SetIgain(void *handle, int slotIdx, double gain); + CTR_Code c_TalonSRX_SetDgain(void *handle, int slotIdx, double gain); + CTR_Code c_TalonSRX_SetFgain(void *handle, int slotIdx, double gain); + CTR_Code c_TalonSRX_SetIzone(void *handle, int slotIdx, int zone); + CTR_Code c_TalonSRX_SetCloseLoopRampRate(void *handle, int slotIdx, int closeLoopRampRate); + CTR_Code c_TalonSRX_SetVoltageCompensationRate(void *handle, double voltagePerMs); + CTR_Code c_TalonSRX_SetSensorPosition(void *handle, int pos); + CTR_Code c_TalonSRX_SetForwardSoftLimit(void *handle, int forwardLimit); + CTR_Code c_TalonSRX_SetReverseSoftLimit(void *handle, int reverseLimit); + CTR_Code c_TalonSRX_SetForwardSoftEnable(void *handle, int enable); + CTR_Code c_TalonSRX_SetReverseSoftEnable(void *handle, int enable); + CTR_Code c_TalonSRX_GetPgain(void *handle, int slotIdx, double *gain); + CTR_Code c_TalonSRX_GetIgain(void *handle, int slotIdx, double *gain); + CTR_Code c_TalonSRX_GetDgain(void *handle, int slotIdx, double *gain); + CTR_Code c_TalonSRX_GetFgain(void *handle, int slotIdx, double *gain); + CTR_Code c_TalonSRX_GetIzone(void *handle, int slotIdx, int *zone); + CTR_Code c_TalonSRX_GetCloseLoopRampRate(void *handle, int slotIdx, int *closeLoopRampRate); + CTR_Code c_TalonSRX_GetVoltageCompensationRate(void *handle, double *voltagePerMs); + CTR_Code c_TalonSRX_GetForwardSoftLimit(void *handle, int *forwardLimit); + CTR_Code c_TalonSRX_GetReverseSoftLimit(void *handle, int *reverseLimit); + CTR_Code c_TalonSRX_GetForwardSoftEnable(void *handle, int *enable); + CTR_Code c_TalonSRX_GetReverseSoftEnable(void *handle, int *enable); + CTR_Code c_TalonSRX_GetPulseWidthRiseToFallUs(void *handle, int *param); + CTR_Code c_TalonSRX_IsPulseWidthSensorPresent(void *handle, int *param); + CTR_Code c_TalonSRX_SetModeSelect2(void *handle, int modeSelect, int demand); + CTR_Code c_TalonSRX_SetStatusFrameRate(void *handle, int frameEnum, int periodMs); + CTR_Code c_TalonSRX_ClearStickyFaults(void *handle); + void c_TalonSRX_ChangeMotionControlFramePeriod(void *handle, int periodMs); + void c_TalonSRX_ClearMotionProfileTrajectories(void *handle); + int c_TalonSRX_GetMotionProfileTopLevelBufferCount(void *handle); + int c_TalonSRX_IsMotionProfileTopLevelBufferFull(void *handle); + CTR_Code c_TalonSRX_PushMotionProfileTrajectory(void *handle, int targPos, int targVel, int profileSlotSelect, int timeDurMs, int velOnly, int isLastPoint, int zeroPos); + void c_TalonSRX_ProcessMotionProfileBuffer(void *handle); + CTR_Code c_TalonSRX_GetMotionProfileStatus(void *handle, int *flags, int *profileSlotSelect, int *targPos, int *targVel, int *topBufferRemaining, int *topBufferCnt, int *btmBufferCnt, int *outputEnable); + CTR_Code c_TalonSRX_GetFault_OverTemp(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_UnderVoltage(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_ForLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_RevLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_HardwareFailure(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_ForSoftLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetFault_RevSoftLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_OverTemp(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_UnderVoltage(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_ForLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_RevLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_ForSoftLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetStckyFault_RevSoftLim(void *handle, int *param); + CTR_Code c_TalonSRX_GetAppliedThrottle(void *handle, int *param); + CTR_Code c_TalonSRX_GetCloseLoopErr(void *handle, int *param); + CTR_Code c_TalonSRX_GetFeedbackDeviceSelect(void *handle, int *param); + CTR_Code c_TalonSRX_GetModeSelect(void *handle, int *param); + CTR_Code c_TalonSRX_GetLimitSwitchEn(void *handle, int *param); + CTR_Code c_TalonSRX_GetLimitSwitchClosedFor(void *handle, int *param); + CTR_Code c_TalonSRX_GetLimitSwitchClosedRev(void *handle, int *param); + CTR_Code c_TalonSRX_GetSensorPosition(void *handle, int *param); + CTR_Code c_TalonSRX_GetSensorVelocity(void *handle, int *param); + CTR_Code c_TalonSRX_GetCurrent(void *handle, double *param); + CTR_Code c_TalonSRX_GetBrakeIsEnabled(void *handle, int *param); + CTR_Code c_TalonSRX_GetEncPosition(void *handle, int *param); + CTR_Code c_TalonSRX_GetEncVel(void *handle, int *param); + CTR_Code c_TalonSRX_GetEncIndexRiseEvents(void *handle, int *param); + CTR_Code c_TalonSRX_GetQuadApin(void *handle, int *param); + CTR_Code c_TalonSRX_GetQuadBpin(void *handle, int *param); + CTR_Code c_TalonSRX_GetQuadIdxpin(void *handle, int *param); + CTR_Code c_TalonSRX_GetAnalogInWithOv(void *handle, int *param); + CTR_Code c_TalonSRX_GetAnalogInVel(void *handle, int *param); + CTR_Code c_TalonSRX_GetTemp(void *handle, double *param); + CTR_Code c_TalonSRX_GetBatteryV(void *handle, double *param); + CTR_Code c_TalonSRX_GetResetCount(void *handle, int *param); + CTR_Code c_TalonSRX_GetResetFlags(void *handle, int *param); + CTR_Code c_TalonSRX_GetFirmVers(void *handle, int *param); + CTR_Code c_TalonSRX_GetPulseWidthPosition(void *handle, int *param); + CTR_Code c_TalonSRX_GetPulseWidthVelocity(void *handle, int *param); + CTR_Code c_TalonSRX_GetPulseWidthRiseToRiseUs(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_IsValid(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_ProfileSlotSelect(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_VelOnly(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_IsLast(void *handle, int *param); + CTR_Code c_TalonSRX_GetOutputType(void *handle, int *param); + CTR_Code c_TalonSRX_GetHasUnderrun(void *handle, int *param); + CTR_Code c_TalonSRX_GetIsUnderrun(void *handle, int *param); + CTR_Code c_TalonSRX_GetNextID(void *handle, int *param); + CTR_Code c_TalonSRX_GetBufferIsFull(void *handle, int *param); + CTR_Code c_TalonSRX_GetCount(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_Velocity(void *handle, int *param); + CTR_Code c_TalonSRX_GetActTraj_Position(void *handle, int *param); + CTR_Code c_TalonSRX_SetDemand(void *handle, int param); + CTR_Code c_TalonSRX_SetOverrideLimitSwitchEn(void *handle, int param); + CTR_Code c_TalonSRX_SetFeedbackDeviceSelect(void *handle, int param); + CTR_Code c_TalonSRX_SetRevMotDuringCloseLoopEn(void *handle, int param); + CTR_Code c_TalonSRX_SetOverrideBrakeType(void *handle, int param); + CTR_Code c_TalonSRX_SetModeSelect(void *handle, int param); + CTR_Code c_TalonSRX_SetProfileSlotSelect(void *handle, int param); + CTR_Code c_TalonSRX_SetRampThrottle(void *handle, int param); + CTR_Code c_TalonSRX_SetRevFeedbackSensor(void *handle, int param); +} +#endif diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Compressor.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Compressor.hpp new file mode 100644 index 0000000..465a63b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Compressor.hpp @@ -0,0 +1,33 @@ +/** + * Compressor.h + * Methods for interacting with a compressor with the CAN PCM device + */ + +#include + +#ifndef __HAL_COMPRESSOR_H__ +#define __HAL_COMPRESSOR_H__ + +extern "C" { + void *initializeCompressor(uint8_t module); + bool checkCompressorModule(uint8_t module); + + bool getCompressor(void *pcm_pointer, int32_t *status); + + void setClosedLoopControl(void *pcm_pointer, bool value, int32_t *status); + bool getClosedLoopControl(void *pcm_pointer, int32_t *status); + + bool getPressureSwitch(void *pcm_pointer, int32_t *status); + float getCompressorCurrent(void *pcm_pointer, int32_t *status); + + bool getCompressorCurrentTooHighFault(void *pcm_pointer, int32_t *status); + bool getCompressorCurrentTooHighStickyFault(void *pcm_pointer, int32_t *status); + bool getCompressorShortedStickyFault(void *pcm_pointer, int32_t *status); + bool getCompressorShortedFault(void *pcm_pointer, int32_t *status); + bool getCompressorNotConnectedStickyFault(void *pcm_pointer, int32_t *status); + bool getCompressorNotConnectedFault(void *pcm_pointer, int32_t *status); + void clearAllPCMStickyFaults(void *pcm_pointer, int32_t *status); +} + +#endif + diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Digital.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Digital.hpp new file mode 100644 index 0000000..64851f1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Digital.hpp @@ -0,0 +1,139 @@ +#pragma once +#include + +#include "HAL/cpp/priority_mutex.h" + +enum Mode +{ + kTwoPulse = 0, + kSemiperiod = 1, + kPulseLength = 2, + kExternalDirection = 3 +}; + +priority_recursive_mutex& spiGetSemaphore(uint8_t port); + +extern "C" +{ + void* initializeDigitalPort(void* port_pointer, int32_t *status); + void freeDigitalPort(void* digital_port_pointer); + bool checkPWMChannel(void* digital_port_pointer); + bool checkRelayChannel(void* digital_port_pointer); + + void setPWM(void* digital_port_pointer, unsigned short value, int32_t *status); + bool allocatePWMChannel(void* digital_port_pointer, int32_t *status); + void freePWMChannel(void* digital_port_pointer, int32_t *status); + unsigned short getPWM(void* digital_port_pointer, int32_t *status); + void latchPWMZero(void* digital_port_pointer, int32_t *status); + void setPWMPeriodScale(void* digital_port_pointer, uint32_t squelchMask, int32_t *status); + void* allocatePWM(int32_t *status); + void freePWM(void* pwmGenerator, int32_t *status); + void setPWMRate(double rate, int32_t *status); + void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status); + void setPWMOutputChannel(void* pwmGenerator, uint32_t pin, int32_t *status); + + void setRelayForward(void* digital_port_pointer, bool on, int32_t *status); + void setRelayReverse(void* digital_port_pointer, bool on, int32_t *status); + bool getRelayForward(void* digital_port_pointer, int32_t *status); + bool getRelayReverse(void* digital_port_pointer, int32_t *status); + + bool allocateDIO(void* digital_port_pointer, bool input, int32_t *status); + void freeDIO(void* digital_port_pointer, int32_t *status); + void setDIO(void* digital_port_pointer, short value, int32_t *status); + bool getDIO(void* digital_port_pointer, int32_t *status); + bool getDIODirection(void* digital_port_pointer, int32_t *status); + void pulse(void* digital_port_pointer, double pulseLength, int32_t *status); + bool isPulsing(void* digital_port_pointer, int32_t *status); + bool isAnyPulsing(int32_t *status); + + void setFilterSelect(void* digital_port_pointer, int filter_index, + int32_t* status); + int getFilterSelect(void* digital_port_pointer, int32_t* status); + + void setFilterPeriod(int filter_index, uint32_t value, int32_t* status); + uint32_t getFilterPeriod(int filter_index, int32_t* status); + + void* initializeCounter(Mode mode, uint32_t *index, int32_t *status); + void freeCounter(void* counter_pointer, int32_t *status); + void setCounterAverageSize(void* counter_pointer, int32_t size, int32_t *status); + void setCounterUpSource(void* counter_pointer, uint32_t pin, bool analogTrigger, int32_t *status); + void setCounterUpSourceEdge(void* counter_pointer, bool risingEdge, bool fallingEdge, + int32_t *status); + void clearCounterUpSource(void* counter_pointer, int32_t *status); + void setCounterDownSource(void* counter_pointer, uint32_t pin, bool analogTrigger, int32_t *status); + void setCounterDownSourceEdge(void* counter_pointer, bool risingEdge, bool fallingEdge, + int32_t *status); + void clearCounterDownSource(void* counter_pointer, int32_t *status); + void setCounterUpDownMode(void* counter_pointer, int32_t *status); + void setCounterExternalDirectionMode(void* counter_pointer, int32_t *status); + void setCounterSemiPeriodMode(void* counter_pointer, bool highSemiPeriod, int32_t *status); + void setCounterPulseLengthMode(void* counter_pointer, double threshold, int32_t *status); + int32_t getCounterSamplesToAverage(void* counter_pointer, int32_t *status); + void setCounterSamplesToAverage(void* counter_pointer, int samplesToAverage, int32_t *status); + void resetCounter(void* counter_pointer, int32_t *status); + int32_t getCounter(void* counter_pointer, int32_t *status); + double getCounterPeriod(void* counter_pointer, int32_t *status); + void setCounterMaxPeriod(void* counter_pointer, double maxPeriod, int32_t *status); + void setCounterUpdateWhenEmpty(void* counter_pointer, bool enabled, int32_t *status); + bool getCounterStopped(void* counter_pointer, int32_t *status); + bool getCounterDirection(void* counter_pointer, int32_t *status); + void setCounterReverseDirection(void* counter_pointer, bool reverseDirection, int32_t *status); + + void* initializeEncoder(uint8_t port_a_module, uint32_t port_a_pin, bool port_a_analog_trigger, + uint8_t port_b_module, uint32_t port_b_pin, bool port_b_analog_trigger, + bool reverseDirection, int32_t *index, int32_t *status); // TODO: fix routing + void freeEncoder(void* encoder_pointer, int32_t *status); + void resetEncoder(void* encoder_pointer, int32_t *status); + int32_t getEncoder(void* encoder_pointer, int32_t *status); // Raw value + double getEncoderPeriod(void* encoder_pointer, int32_t *status); + void setEncoderMaxPeriod(void* encoder_pointer, double maxPeriod, int32_t *status); + bool getEncoderStopped(void* encoder_pointer, int32_t *status); + bool getEncoderDirection(void* encoder_pointer, int32_t *status); + void setEncoderReverseDirection(void* encoder_pointer, bool reverseDirection, int32_t *status); + void setEncoderSamplesToAverage(void* encoder_pointer, uint32_t samplesToAverage, + int32_t *status); + uint32_t getEncoderSamplesToAverage(void* encoder_pointer, int32_t *status); + void setEncoderIndexSource(void *encoder_pointer, uint32_t pin, bool analogTrigger, bool activeHigh, + bool edgeSensitive, int32_t *status); + + uint16_t getLoopTiming(int32_t *status); + + void spiInitialize(uint8_t port, int32_t *status); + int32_t spiTransaction(uint8_t port, uint8_t *dataToSend, uint8_t *dataReceived, uint8_t size); + int32_t spiWrite(uint8_t port, uint8_t* dataToSend, uint8_t sendSize); + int32_t spiRead(uint8_t port, uint8_t *buffer, uint8_t count); + void spiClose(uint8_t port); + void spiSetSpeed(uint8_t port, uint32_t speed); + void spiSetOpts(uint8_t port, int msb_first, int sample_on_trailing, int clk_idle_high); + void spiSetChipSelectActiveHigh(uint8_t port, int32_t *status); + void spiSetChipSelectActiveLow(uint8_t port, int32_t *status); + int32_t spiGetHandle(uint8_t port); + void spiSetHandle(uint8_t port, int32_t handle); + + void spiInitAccumulator(uint8_t port, uint32_t period, uint32_t cmd, + uint8_t xfer_size, uint32_t valid_mask, + uint32_t valid_value, uint8_t data_shift, + uint8_t data_size, bool is_signed, bool big_endian, + int32_t *status); + void spiFreeAccumulator(uint8_t port, int32_t *status); + void spiResetAccumulator(uint8_t port, int32_t *status); + void spiSetAccumulatorCenter(uint8_t port, int32_t center, int32_t *status); + void spiSetAccumulatorDeadband(uint8_t port, int32_t deadband, int32_t *status); + int32_t spiGetAccumulatorLastValue(uint8_t port, int32_t *status); + int64_t spiGetAccumulatorValue(uint8_t port, int32_t *status); + uint32_t spiGetAccumulatorCount(uint8_t port, int32_t *status); + double spiGetAccumulatorAverage(uint8_t port, int32_t *status); + void spiGetAccumulatorOutput(uint8_t port, int64_t *value, uint32_t *count, + int32_t *status); + + void i2CInitialize(uint8_t port, int32_t *status); + int32_t i2CTransaction(uint8_t port, uint8_t deviceAddress, uint8_t *dataToSend, uint8_t sendSize, uint8_t *dataReceived, uint8_t receiveSize); + int32_t i2CWrite(uint8_t port, uint8_t deviceAddress, uint8_t *dataToSend, uint8_t sendSize); + int32_t i2CRead(uint8_t port, uint8_t deviceAddress, uint8_t *buffer, uint8_t count); + void i2CClose(uint8_t port); + + //// Float JNA Hack + // double + void setPWMRateIntHack(int rate, int32_t *status); + void setPWMDutyCycleIntHack(void* pwmGenerator, int32_t dutyCycle, int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Errors.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Errors.hpp new file mode 100644 index 0000000..35ed961 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Errors.hpp @@ -0,0 +1,64 @@ +#pragma once + +#define CTR_RxTimeout_MESSAGE "CTRE CAN Recieve Timeout" +#define CTR_TxTimeout_MESSAGE "CTRE CAN Transmit Timeout" +#define CTR_InvalidParamValue_MESSAGE "CTRE CAN Invalid Parameter" +#define CTR_UnexpectedArbId_MESSAGE "CTRE Unexpected Arbitration ID (CAN Node ID)" +#define CTR_TxFailed_MESSAGE "CTRE CAN Transmit Error" +#define CTR_SigNotUpdated_MESSAGE "CTRE CAN Signal Not Updated" + +#define NiFpga_Status_FifoTimeout_MESSAGE "NIFPGA: FIFO timeout error" +#define NiFpga_Status_TransferAborted_MESSAGE "NIFPGA: Transfer aborted error" +#define NiFpga_Status_MemoryFull_MESSAGE "NIFPGA: Memory Allocation failed, memory full" +#define NiFpga_Status_SoftwareFault_MESSAGE "NIFPGA: Unexepected software error" +#define NiFpga_Status_InvalidParameter_MESSAGE "NIFPGA: Invalid Parameter" +#define NiFpga_Status_ResourceNotFound_MESSAGE "NIFPGA: Resource not found" +#define NiFpga_Status_ResourceNotInitialized_MESSAGE "NIFPGA: Resource not initialized" +#define NiFpga_Status_HardwareFault_MESSAGE "NIFPGA: Hardware Fault" +#define NiFpga_Status_IrqTimeout_MESSAGE "NIFPGA: Interrupt timeout" + +#define ERR_CANSessionMux_InvalidBuffer_MESSAGE "CAN: Invalid Buffer" +#define ERR_CANSessionMux_MessageNotFound_MESSAGE "CAN: Message not found" +#define WARN_CANSessionMux_NoToken_MESSAGE "CAN: No token" +#define ERR_CANSessionMux_NotAllowed_MESSAGE "CAN: Not allowed" +#define ERR_CANSessionMux_NotInitialized_MESSAGE "CAN: Not initialized" + +#define SAMPLE_RATE_TOO_HIGH 1001 +#define SAMPLE_RATE_TOO_HIGH_MESSAGE "HAL: Analog module sample rate is too high" +#define VOLTAGE_OUT_OF_RANGE 1002 +#define VOLTAGE_OUT_OF_RANGE_MESSAGE "HAL: Voltage to convert to raw value is out of range [0; 5]" +#define LOOP_TIMING_ERROR 1004 +#define LOOP_TIMING_ERROR_MESSAGE "HAL: Digital module loop timing is not the expected value" +#define SPI_WRITE_NO_MOSI 1012 +#define SPI_WRITE_NO_MOSI_MESSAGE "HAL: Cannot write to SPI port with no MOSI output" +#define SPI_READ_NO_MISO 1013 +#define SPI_READ_NO_MISO_MESSAGE "HAL: Cannot read from SPI port with no MISO input" +#define SPI_READ_NO_DATA 1014 +#define SPI_READ_NO_DATA_MESSAGE "HAL: No data available to read from SPI" +#define INCOMPATIBLE_STATE 1015 +#define INCOMPATIBLE_STATE_MESSAGE "HAL: Incompatible State: The operation cannot be completed" +#define NO_AVAILABLE_RESOURCES -1004 +#define NO_AVAILABLE_RESOURCES_MESSAGE "HAL: No available resources to allocate" +#define NULL_PARAMETER -1005 +#define NULL_PARAMETER_MESSAGE "HAL: A pointer parameter to a method is NULL" +#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR -1010 +#define ANALOG_TRIGGER_LIMIT_ORDER_ERROR_MESSAGE "HAL: AnalogTrigger limits error. Lower limit > Upper Limit" +#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR -1011 +#define ANALOG_TRIGGER_PULSE_OUTPUT_ERROR_MESSAGE "HAL: Attempted to read AnalogTrigger pulse output." +#define PARAMETER_OUT_OF_RANGE -1028 +#define PARAMETER_OUT_OF_RANGE_MESSAGE "HAL: A parameter is out of range." +#define RESOURCE_IS_ALLOCATED -1029 +#define RESOURCE_IS_ALLOCATED_MESSAGE "HAL: Resource already allocated" + +#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error"; +#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object" +#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked" +#define VI_ERROR_RSRC_NFOUND_MESSAGE "HAL - VISA: Resource Not Found" +#define VI_ERROR_INV_RSRC_NAME_MESSAGE "HAL - VISA: Invalid Resource Name" +#define VI_ERROR_QUEUE_OVERFLOW_MESSAGE "HAL - VISA: Queue Overflow" +#define VI_ERROR_IO_MESSAGE "HAL - VISA: General IO Error" +#define VI_ERROR_ASRL_PARITY_MESSAGE "HAL - VISA: Parity Error" +#define VI_ERROR_ASRL_FRAMING_MESSAGE "HAL - VISA: Framing Error" +#define VI_ERROR_ASRL_OVERRUN_MESSAGE "HAL - VISA: Buffer Overrun Error" +#define VI_ERROR_RSRC_BUSY_MESSAGE "HAL - VISA: Resource Busy" +#define VI_ERROR_INV_PARAMETER_MESSAGE "HAL - VISA: Invalid Parameter" diff --git a/Robot2016/wpilib/cpp/current/include/HAL/HAL.hpp b/Robot2016/wpilib/cpp/current/include/HAL/HAL.hpp new file mode 100644 index 0000000..75c72e3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/HAL.hpp @@ -0,0 +1,268 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2013. 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 $(WIND_BASE)/WPILib. */ +/*----------------------------------------------------------------------------*/ +#pragma once + +#include +#include + +#include "Accelerometer.hpp" +#include "Analog.hpp" +#include "Compressor.hpp" +#include "Digital.hpp" +#include "Solenoid.hpp" +#include "Notifier.hpp" +#include "Interrupts.hpp" +#include "Errors.hpp" +#include "PDP.hpp" +#include "Power.hpp" +#include "SerialPort.hpp" + +#include "Utilities.hpp" +#include "Semaphore.hpp" +#include "Task.hpp" + +#define HAL_IO_CONFIG_DATA_SIZE 32 +#define HAL_SYS_STATUS_DATA_SIZE 44 +#define HAL_USER_STATUS_DATA_SIZE (984 - HAL_IO_CONFIG_DATA_SIZE - HAL_SYS_STATUS_DATA_SIZE) + +#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17 +#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Header 19 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24 +#define HALFRC_NetworkCommunication_DynamicType_Kinect_Custom 25 + +namespace HALUsageReporting +{ + enum tResourceType + { + kResourceType_Controller, + kResourceType_Module, + kResourceType_Language, + kResourceType_CANPlugin, + kResourceType_Accelerometer, + kResourceType_ADXL345, + kResourceType_AnalogChannel, + kResourceType_AnalogTrigger, + kResourceType_AnalogTriggerOutput, + kResourceType_CANJaguar, + kResourceType_Compressor, + kResourceType_Counter, + kResourceType_Dashboard, + kResourceType_DigitalInput, + kResourceType_DigitalOutput, + kResourceType_DriverStationCIO, + kResourceType_DriverStationEIO, + kResourceType_DriverStationLCD, + kResourceType_Encoder, + kResourceType_GearTooth, + kResourceType_Gyro, + kResourceType_I2C, + kResourceType_Framework, + kResourceType_Jaguar, + kResourceType_Joystick, + kResourceType_Kinect, + kResourceType_KinectStick, + kResourceType_PIDController, + kResourceType_Preferences, + kResourceType_PWM, + kResourceType_Relay, + kResourceType_RobotDrive, + kResourceType_SerialPort, + kResourceType_Servo, + kResourceType_Solenoid, + kResourceType_SPI, + kResourceType_Task, + kResourceType_Ultrasonic, + kResourceType_Victor, + kResourceType_Button, + kResourceType_Command, + kResourceType_AxisCamera, + kResourceType_PCVideoServer, + kResourceType_SmartDashboard, + kResourceType_Talon, + kResourceType_HiTechnicColorSensor, + kResourceType_HiTechnicAccel, + kResourceType_HiTechnicCompass, + kResourceType_SRF08, + kResourceType_AnalogOutput, + kResourceType_VictorSP, + kResourceType_TalonSRX, + kResourceType_CANTalonSRX, + kResourceType_ADXL362, + kResourceType_ADXRS450, + kResourceType_RevSPARK, + kResourceType_MindsensorsSD540, + kResourceType_DigitalFilter, + }; + + enum tInstances + { + kLanguage_LabVIEW = 1, + kLanguage_CPlusPlus = 2, + kLanguage_Java = 3, + kLanguage_Python = 4, + + kCANPlugin_BlackJagBridge = 1, + kCANPlugin_2CAN = 2, + + kFramework_Iterative = 1, + kFramework_Sample = 2, + kFramework_CommandControl = 3, + + kRobotDrive_ArcadeStandard = 1, + kRobotDrive_ArcadeButtonSpin = 2, + kRobotDrive_ArcadeRatioCurve = 3, + kRobotDrive_Tank = 4, + kRobotDrive_MecanumPolar = 5, + kRobotDrive_MecanumCartesian = 6, + + kDriverStationCIO_Analog = 1, + kDriverStationCIO_DigitalIn = 2, + kDriverStationCIO_DigitalOut = 3, + + kDriverStationEIO_Acceleration = 1, + kDriverStationEIO_AnalogIn = 2, + kDriverStationEIO_AnalogOut = 3, + kDriverStationEIO_Button = 4, + kDriverStationEIO_LED = 5, + kDriverStationEIO_DigitalIn = 6, + kDriverStationEIO_DigitalOut = 7, + kDriverStationEIO_FixedDigitalOut = 8, + kDriverStationEIO_PWM = 9, + kDriverStationEIO_Encoder = 10, + kDriverStationEIO_TouchSlider = 11, + + kADXL345_SPI = 1, + kADXL345_I2C = 2, + + kCommand_Scheduler = 1, + + kSmartDashboard_Instance = 1, + }; +} + +struct HALControlWord { + uint32_t enabled : 1; + uint32_t autonomous : 1; + uint32_t test :1; + uint32_t eStop : 1; + uint32_t fmsAttached:1; + uint32_t dsAttached:1; + uint32_t control_reserved : 26; +}; + +enum HALAllianceStationID { + kHALAllianceStationID_red1, + kHALAllianceStationID_red2, + kHALAllianceStationID_red3, + kHALAllianceStationID_blue1, + kHALAllianceStationID_blue2, + kHALAllianceStationID_blue3, +}; + +/* The maximum number of axes that will be stored in a single HALJoystickAxes + struct. This is used for allocating buffers, not bounds checking, since + there are usually less axes in practice. */ +static const size_t kMaxJoystickAxes = 12; +static const size_t kMaxJoystickPOVs = 12; + +struct HALJoystickAxes { + uint16_t count; + int16_t axes[kMaxJoystickAxes]; +}; + +struct HALJoystickPOVs { + uint16_t count; + int16_t povs[kMaxJoystickPOVs]; +}; + +struct HALJoystickButtons { + uint32_t buttons; + uint8_t count; +}; + +struct HALJoystickDescriptor { + uint8_t isXbox; + uint8_t type; + char name[256]; + uint8_t axisCount; + uint8_t axisTypes[kMaxJoystickAxes]; + uint8_t buttonCount; + uint8_t povCount; +}; + +inline float intToFloat(int value) +{ + return (float)value; +} + +inline int floatToInt(float value) +{ + return round(value); +} + +extern "C" +{ + extern const uint32_t dio_kNumSystems; + extern const uint32_t solenoid_kNumDO7_0Elements; + extern const uint32_t interrupt_kNumSystems; + extern const uint32_t kSystemClockTicksPerMicrosecond; + + void* getPort(uint8_t pin); + void* getPortWithModule(uint8_t module, uint8_t pin); + void freePort(void* port); + const char* getHALErrorMessage(int32_t code); + + uint16_t getFPGAVersion(int32_t *status); + uint32_t getFPGARevision(int32_t *status); + uint64_t getFPGATime(int32_t *status); + + bool getFPGAButton(int32_t *status); + + int HALSetErrorData(const char *errors, int errorsLength, int wait_ms); + + int HALGetControlWord(HALControlWord *data); + int HALGetAllianceStation(enum HALAllianceStationID *allianceStation); + int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes); + int HALGetJoystickPOVs(uint8_t joystickNum, HALJoystickPOVs *povs); + int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons); + int HALGetJoystickDescriptor(uint8_t joystickNum, HALJoystickDescriptor *desc); + int HALGetJoystickIsXbox(uint8_t joystickNum); + int HALGetJoystickType(uint8_t joystickNum); + char* HALGetJoystickName(uint8_t joystickNum); + int HALGetJoystickAxisType(uint8_t joystickNum, uint8_t axis); + int HALSetJoystickOutputs(uint8_t joystickNum, uint32_t outputs, uint16_t leftRumble, uint16_t rightRumble); + int HALGetMatchTime(float *matchTime); + + void HALSetNewDataSem(MULTIWAIT_ID sem); + + bool HALGetSystemActive(int32_t *status); + bool HALGetBrownedOut(int32_t *status); + + int HALInitialize(int mode = 0); + void HALNetworkCommunicationObserveUserProgramStarting(); + void HALNetworkCommunicationObserveUserProgramDisabled(); + void HALNetworkCommunicationObserveUserProgramAutonomous(); + void HALNetworkCommunicationObserveUserProgramTeleop(); + void HALNetworkCommunicationObserveUserProgramTest(); + + uint32_t HALReport(uint8_t resource, uint8_t instanceNumber, uint8_t context = 0, + const char *feature = NULL); +} + +// TODO: HACKS for now... +extern "C" +{ + + void NumericArrayResize(); + void RTSetCleanupProc(); + void EDVR_CreateReference(); + void Occur(); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Interrupts.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Interrupts.hpp new file mode 100644 index 0000000..a41ca6b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Interrupts.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +#include +#include "errno.h" + +extern "C" +{ + typedef void (*InterruptHandlerFunction)(uint32_t interruptAssertedMask, void *param); + + void* initializeInterrupts(uint32_t interruptIndex, bool watcher, int32_t *status); + void cleanInterrupts(void* interrupt_pointer, int32_t *status); + + uint32_t waitForInterrupt(void* interrupt_pointer, double timeout, bool ignorePrevious, int32_t *status); + void enableInterrupts(void* interrupt_pointer, int32_t *status); + void disableInterrupts(void* interrupt_pointer, int32_t *status); + double readRisingTimestamp(void* interrupt_pointer, int32_t *status); + double readFallingTimestamp(void* interrupt_pointer, int32_t *status); + void requestInterrupts(void* interrupt_pointer, uint8_t routing_module, uint32_t routing_pin, + bool routing_analog_trigger, int32_t *status); + void attachInterruptHandler(void* interrupt_pointer, InterruptHandlerFunction handler, + void* param, int32_t *status); + void setInterruptUpSourceEdge(void* interrupt_pointer, bool risingEdge, bool fallingEdge, + int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Notifier.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Notifier.hpp new file mode 100644 index 0000000..e8cb381 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Notifier.hpp @@ -0,0 +1,12 @@ +#pragma once + +#include + +extern "C" +{ + void* initializeNotifier(void (*process)(uint64_t, void*), void* param, int32_t *status); + void cleanNotifier(void* notifier_pointer, int32_t *status); + void* getNotifierParam(void* notifier_pointer, int32_t *status); + void updateNotifierAlarm(void* notifier_pointer, uint64_t triggerTime, int32_t *status); + void stopNotifierAlarm(void* notifier_pointer, int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/PDP.hpp b/Robot2016/wpilib/cpp/current/include/HAL/PDP.hpp new file mode 100644 index 0000000..54ab6fa --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/PDP.hpp @@ -0,0 +1,16 @@ +#pragma once + +#include + +extern "C" +{ + void initializePDP(uint8_t module); + double getPDPTemperature(uint8_t module, int32_t *status); + double getPDPVoltage(uint8_t module, int32_t *status); + double getPDPChannelCurrent(uint8_t module, uint8_t channel, int32_t *status); + double getPDPTotalCurrent(uint8_t module, int32_t *status); + double getPDPTotalPower(uint8_t module, int32_t *status); + double getPDPTotalEnergy(uint8_t module, int32_t *status); + void resetPDPTotalEnergy(uint8_t module, int32_t *status); + void clearPDPStickyFaults(uint8_t module, int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Port.h b/Robot2016/wpilib/cpp/current/include/HAL/Port.h new file mode 100644 index 0000000..b2e97c2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Port.h @@ -0,0 +1,14 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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 + +typedef struct port_t +{ + uint8_t pin; + uint8_t module; +} Port; diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Power.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Power.hpp new file mode 100644 index 0000000..b430c1e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Power.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +extern "C" +{ + float getVinVoltage(int32_t *status); + float getVinCurrent(int32_t *status); + float getUserVoltage6V(int32_t *status); + float getUserCurrent6V(int32_t *status); + bool getUserActive6V(int32_t *status); + int getUserCurrentFaults6V(int32_t *status); + float getUserVoltage5V(int32_t *status); + float getUserCurrent5V(int32_t *status); + bool getUserActive5V(int32_t *status); + int getUserCurrentFaults5V(int32_t *status); + float getUserVoltage3V3(int32_t *status); + float getUserCurrent3V3(int32_t *status); + bool getUserActive3V3(int32_t *status); + int getUserCurrentFaults3V3(int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Semaphore.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Semaphore.hpp new file mode 100644 index 0000000..6b9c9e3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Semaphore.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include "cpp/priority_condition_variable.h" +#include "cpp/priority_mutex.h" + +typedef priority_mutex* MUTEX_ID; +typedef priority_condition_variable* MULTIWAIT_ID; +typedef priority_condition_variable::native_handle_type NATIVE_MULTIWAIT_ID; + +extern "C" { + MUTEX_ID initializeMutexNormal(); + void deleteMutex(MUTEX_ID sem); + void takeMutex(MUTEX_ID sem); + bool tryTakeMutex(MUTEX_ID sem); + void giveMutex(MUTEX_ID sem); + + MULTIWAIT_ID initializeMultiWait(); + void deleteMultiWait(MULTIWAIT_ID sem); + void takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m); + void giveMultiWait(MULTIWAIT_ID sem); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/SerialPort.hpp b/Robot2016/wpilib/cpp/current/include/HAL/SerialPort.hpp new file mode 100644 index 0000000..89f1817 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/SerialPort.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include + +extern "C" +{ + void serialInitializePort(uint8_t port, int32_t *status); + void serialSetBaudRate(uint8_t port, uint32_t baud, int32_t *status); + void serialSetDataBits(uint8_t port, uint8_t bits, int32_t *status); + void serialSetParity(uint8_t port, uint8_t parity, int32_t *status); + void serialSetStopBits(uint8_t port, uint8_t stopBits, int32_t *status); + void serialSetWriteMode(uint8_t port, uint8_t mode, int32_t *status); + void serialSetFlowControl(uint8_t port, uint8_t flow, int32_t *status); + void serialSetTimeout(uint8_t port, float timeout, int32_t *status); + void serialEnableTermination(uint8_t port, char terminator, int32_t *status); + void serialDisableTermination(uint8_t port, int32_t *status); + void serialSetReadBufferSize(uint8_t port, uint32_t size, int32_t *status); + void serialSetWriteBufferSize(uint8_t port, uint32_t size, int32_t *status); + int32_t serialGetBytesReceived(uint8_t port, int32_t *status); + uint32_t serialRead(uint8_t port, char* buffer, int32_t count, int32_t *status); + uint32_t serialWrite(uint8_t port, const char *buffer, int32_t count, int32_t *status); + void serialFlush(uint8_t port, int32_t *status); + void serialClear(uint8_t port, int32_t *status); + void serialClose(uint8_t port, int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Solenoid.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Solenoid.hpp new file mode 100644 index 0000000..3b51f21 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Solenoid.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include + +extern "C" +{ + void* initializeSolenoidPort(void* port_pointer, int32_t *status); + void freeSolenoidPort(void* solenoid_port_pointer); + bool checkSolenoidModule(uint8_t module); + + bool getSolenoid(void* solenoid_port_pointer, int32_t *status); + uint8_t getAllSolenoids(void* solenoid_port_pointer, int32_t *status); + void setSolenoid(void* solenoid_port_pointer, bool value, int32_t *status); + + int getPCMSolenoidBlackList(void* solenoid_port_pointer, int32_t *status); + bool getPCMSolenoidVoltageStickyFault(void* solenoid_port_pointer, int32_t *status); + bool getPCMSolenoidVoltageFault(void* solenoid_port_pointer, int32_t *status); + void clearAllPCMStickyFaults_sol(void *solenoid_port_pointer, int32_t *status); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Task.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Task.hpp new file mode 100644 index 0000000..3feeec8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Task.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include + +#ifndef _FUNCPTR_DEFINED +#define _FUNCPTR_DEFINED +#ifdef __cplusplus +typedef int (*FUNCPTR)(...); +/* ptr to function returning int */ +#else +typedef int (*FUNCPTR) (); /* ptr to function returning int */ +#endif /* __cplusplus */ +#endif /* _FUNCPTR_DEFINED */ + +#ifndef _STATUS_DEFINED +#define _STATUS_DEFINED +typedef int STATUS; +#endif /* _STATUS_DEFINED */ + +#ifndef OK +#define OK 0 +#endif /* OK */ +#ifndef ERROR +#define ERROR (-1) +#endif /* ERROR */ + +#define NULL_TASK NULL +typedef pthread_t* TASK; + +extern "C" { + // Note: These constants used to be declared extern and were defined in + // Task.cpp. This caused issues with the JNI bindings for java, and so the + // instantiations were moved here. + const int32_t HAL_taskLib_ILLEGAL_PRIORITY = 22; // 22 is EINVAL + + STATUS verifyTaskID(TASK task); + STATUS setTaskPriority(TASK task, int priority); // valid priority [1..99] + STATUS getTaskPriority(TASK task, int* priority); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/Utilities.hpp b/Robot2016/wpilib/cpp/current/include/HAL/Utilities.hpp new file mode 100644 index 0000000..df8ff5e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/Utilities.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include + +extern "C" +{ + extern const int32_t HAL_NO_WAIT; + extern const int32_t HAL_WAIT_FOREVER; + + void delayTicks(int32_t ticks); + void delayMillis(double ms); + void delaySeconds(double s); +} diff --git a/Robot2016/wpilib/cpp/current/include/HAL/cpp/Resource.hpp b/Robot2016/wpilib/cpp/current/include/HAL/cpp/Resource.hpp new file mode 100644 index 0000000..ae31996 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/cpp/Resource.hpp @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */ +/*----------------------------------------------------------------------------*/ +#pragma once + +#include "../Errors.hpp" +#include "HAL/cpp/priority_mutex.h" +#include + +#include + +// TODO: Replace this with something appropriate to avoid conflicts with +// wpilibC++ Resource class (which performs an essentially identical function). +namespace hal { + +/** + * The Resource class is a convenient way to track allocated resources. + * It tracks them as indicies in the range [0 .. elements - 1]. + * E.g. the library uses this to track hardware channel allocation. + * + * The Resource class does not allocate the hardware channels or other + * resources; it just tracks which indices were marked in use by + * Allocate and not yet freed by Free. + */ +class Resource +{ +public: + Resource(const Resource&) = delete; + Resource& operator=(const Resource&) = delete; + explicit Resource(uint32_t size); + virtual ~Resource() = default; + static void CreateResourceObject(Resource **r, uint32_t elements); + uint32_t Allocate(const char *resourceDesc); + uint32_t Allocate(uint32_t index, const char *resourceDesc); + void Free(uint32_t index); + +private: + std::vector m_isAllocated; + priority_recursive_mutex m_allocateLock; + + static priority_recursive_mutex m_createLock; +}; + +} // namespace hal diff --git a/Robot2016/wpilib/cpp/current/include/HAL/cpp/Semaphore.hpp b/Robot2016/wpilib/cpp/current/include/HAL/cpp/Semaphore.hpp new file mode 100644 index 0000000..6a6374b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/cpp/Semaphore.hpp @@ -0,0 +1,30 @@ +#pragma once + +#include +#include + +#include "HAL/cpp/priority_mutex.h" + +class Semaphore { + public: + explicit Semaphore(uint32_t count = 0); + Semaphore(Semaphore&&); + Semaphore& operator=(Semaphore&&); + + void give(); + void take(); + + // @return true if semaphore was locked successfully. false if not. + bool tryTake(); + + static const int32_t kNoWait = 0; + static const int32_t kWaitForever = -1; + + static const uint32_t kEmpty = 0; + static const uint32_t kFull = 1; + + private: + priority_mutex m_mutex; + std::condition_variable_any m_condition; + uint32_t m_count = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_condition_variable.h b/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_condition_variable.h new file mode 100644 index 0000000..cd02ce4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_condition_variable.h @@ -0,0 +1,124 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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 + +/* std::condition_variable provides the native_handle() method to return its + * underlying pthread_cond_t*. WPILib uses this to interface with the FRC + * network communication library. Since WPILib uses a custom mutex class and + * not std::mutex, std::condition_variable_any must be used instead. + * std::condition_variable_any doesn't expose its internal handle, so this + * class provides the same interface and implementation in addition to a + * native_handle() method. + */ + +#include +#include +#include "priority_mutex.h" + +class priority_condition_variable { + typedef std::chrono::system_clock clock_t; + + public: + typedef std::condition_variable::native_handle_type native_handle_type; + + priority_condition_variable() : m_mutex(std::make_shared()) {} + ~priority_condition_variable() = default; + + priority_condition_variable(const priority_condition_variable&) = delete; + priority_condition_variable& operator=(const priority_condition_variable&) = delete; + + void notify_one() noexcept { + std::lock_guard lock(*m_mutex); + m_cond.notify_one(); + } + + void notify_all() noexcept { + std::lock_guard lock(*m_mutex); + m_cond.notify_all(); + } + + template + void wait(Lock& _lock) { + std::shared_ptr _mutex = m_mutex; + std::unique_lock my_lock(*_mutex); + Unlock unlock(_lock); + + // *mutex must be unlocked before re-locking _lock so move + // ownership of *_mutex lock to an object with shorter lifetime. + std::unique_lock my_lock2(std::move(my_lock)); + m_cond.wait(my_lock2); + } + + template + void wait(Lock& lock, Predicate p) { + while (!p()) { wait(lock); } + } + + template + std::cv_status wait_until(Lock& _lock, + const std::chrono::time_point& atime) { + std::shared_ptr _mutex = m_mutex; + std::unique_lock my_lock(*_mutex); + Unlock unlock(_lock); + + // *_mutex must be unlocked before re-locking _lock so move + // ownership of *_mutex lock to an object with shorter lifetime. + std::unique_lock my_lock2(std::move(my_lock)); + return m_cond.wait_until(my_lock2, atime); + } + + template + bool wait_until(Lock& lock, + const std::chrono::time_point& atime, Predicate p) { + while (!p()) { + if (wait_until(lock, atime) == std::cv_status::timeout) { + return p(); + } + } + return true; + } + + template + std::cv_status wait_for(Lock& lock, const std::chrono::duration& rtime) { + return wait_until(lock, clock_t::now() + rtime); + } + + template + bool wait_for(Lock& lock, const std::chrono::duration& rtime, + Predicate p) { + return wait_until(lock, clock_t::now() + rtime, std::move(p)); + } + + native_handle_type native_handle() { + return m_cond.native_handle(); + } + + private: + std::condition_variable m_cond; + std::shared_ptr m_mutex; + + // scoped unlock - unlocks in ctor, re-locks in dtor + template + struct Unlock { + explicit Unlock(Lock& lk) : m_lock(lk) { lk.unlock(); } + + ~Unlock() /*noexcept(false)*/ { + if (std::uncaught_exception()) { + try { m_lock.lock(); } catch(...) {} + } + else { + m_lock.lock(); + } + } + + Unlock(const Unlock&) = delete; + Unlock& operator=(const Unlock&) = delete; + + Lock& m_lock; + }; +}; diff --git a/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_mutex.h b/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_mutex.h new file mode 100644 index 0000000..b03f012 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HAL/cpp/priority_mutex.h @@ -0,0 +1,83 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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 + +// Allows usage with std::lock_guard without including separately +#include + +#ifdef FRC_SIMULATOR +// We do not want to use pthreads if in the simulator; however, in the +// simulator, we do not care about priority inversion. +typedef std::mutex priority_mutex; +typedef std::recursive_mutex priority_recursive_mutex; +#else // Covers rest of file. + +#include + +class priority_recursive_mutex { + public: + typedef pthread_mutex_t *native_handle_type; + + constexpr priority_recursive_mutex() noexcept = default; + priority_recursive_mutex(const priority_recursive_mutex &) = delete; + priority_recursive_mutex &operator=(const priority_recursive_mutex &) = delete; + + // Lock the mutex, blocking until it's available. + void lock(); + + // Unlock the mutex. + void unlock(); + + // Tries to lock the mutex. + bool try_lock() noexcept; + + pthread_mutex_t *native_handle(); + + private: + // Do the equivalent of setting PTHREAD_PRIO_INHERIT and + // PTHREAD_MUTEX_RECURSIVE_NP. +#if __WORDSIZE == 64 + pthread_mutex_t m_mutex = { + {0, 0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, 0, {0, 0}}}; +#else + pthread_mutex_t m_mutex = { + {0, 0, 0, 0x20 | PTHREAD_MUTEX_RECURSIVE_NP, 0, {0}}}; +#endif +}; + +class priority_mutex { + public: + typedef pthread_mutex_t *native_handle_type; + + constexpr priority_mutex() noexcept = default; + priority_mutex(const priority_mutex &) = delete; + priority_mutex &operator=(const priority_mutex &) = delete; + + // Lock the mutex, blocking until it's available. + void lock(); + + // Unlock the mutex. + void unlock(); + + // Tries to lock the mutex. + bool try_lock() noexcept; + + pthread_mutex_t *native_handle(); + + private: + // Do the equivalent of setting PTHREAD_PRIO_INHERIT. +#if __WORDSIZE == 64 + pthread_mutex_t m_mutex = { + {0, 0, 0, 0, 0x20, 0, 0, {0, 0}}}; +#else + pthread_mutex_t m_mutex = { + {0, 0, 0, 0x20, 0, {0}}}; +#endif +}; + +#endif // FRC_SIMULATOR diff --git a/Robot2016/wpilib/cpp/current/include/HLUsageReporting.h b/Robot2016/wpilib/cpp/current/include/HLUsageReporting.h new file mode 100644 index 0000000..0da2b5c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/HLUsageReporting.h @@ -0,0 +1,25 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +class HLUsageReportingInterface { + public: + virtual ~HLUsageReportingInterface() = default; + virtual void ReportScheduler() = 0; + virtual void ReportSmartDashboard() = 0; +}; + +class HLUsageReporting { + private: + static HLUsageReportingInterface* impl; + + public: + static void SetImplementation(HLUsageReportingInterface* i); + static void ReportScheduler(); + static void ReportSmartDashboard(); +}; diff --git a/Robot2016/wpilib/cpp/current/include/I2C.h b/Robot2016/wpilib/cpp/current/include/I2C.h new file mode 100644 index 0000000..3267032 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/I2C.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SensorBase.h" + +/** + * I2C bus interface class. + * + * This class is intended to be used by sensor (and other I2C device) drivers. + * It probably should not be used directly. + * + */ +class I2C : SensorBase { + public: + enum Port { kOnboard, kMXP }; + + I2C(Port port, uint8_t deviceAddress); + virtual ~I2C(); + + I2C(const I2C&) = delete; + I2C& operator=(const I2C&) = delete; + + bool Transaction(uint8_t *dataToSend, uint8_t sendSize, uint8_t *dataReceived, + uint8_t receiveSize); + bool AddressOnly(); + bool Write(uint8_t registerAddress, uint8_t data); + bool WriteBulk(uint8_t *data, uint8_t count); + bool Read(uint8_t registerAddress, uint8_t count, uint8_t *data); + bool ReadOnly(uint8_t count, uint8_t *buffer); + void Broadcast(uint8_t registerAddress, uint8_t data); + bool VerifySensor(uint8_t registerAddress, uint8_t count, + const uint8_t *expected); + + private: + Port m_port; + uint8_t m_deviceAddress; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Internal/HardwareHLReporting.h b/Robot2016/wpilib/cpp/current/include/Internal/HardwareHLReporting.h new file mode 100644 index 0000000..b411ecf --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Internal/HardwareHLReporting.h @@ -0,0 +1,14 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#include "HLUsageReporting.h" + +class HardwareHLReporting : public HLUsageReportingInterface { + public: + virtual void ReportScheduler(); + virtual void ReportSmartDashboard(); +}; diff --git a/Robot2016/wpilib/cpp/current/include/InterruptableSensorBase.h b/Robot2016/wpilib/cpp/current/include/InterruptableSensorBase.h new file mode 100644 index 0000000..708089b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/InterruptableSensorBase.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "SensorBase.h" +#include "Resource.h" + +#include + +class InterruptableSensorBase : public SensorBase { + public: + enum WaitResult { + kTimeout = 0x0, + kRisingEdge = 0x1, + kFallingEdge = 0x100, + kBoth = 0x101, + }; + + InterruptableSensorBase(); + virtual ~InterruptableSensorBase() = default; + virtual uint32_t GetChannelForRouting() const = 0; + virtual uint32_t GetModuleForRouting() const = 0; + virtual bool GetAnalogTriggerForRouting() const = 0; + virtual void RequestInterrupts( + InterruptHandlerFunction handler, + void *param); ///< Asynchronus handler version. + virtual void RequestInterrupts(); ///< Synchronus Wait version. + virtual void + CancelInterrupts(); ///< Free up the underlying chipobject functions. + virtual WaitResult WaitForInterrupt( + float timeout, bool ignorePrevious = true); ///< Synchronus version. + virtual void + EnableInterrupts(); ///< Enable interrupts - after finishing setup. + virtual void DisableInterrupts(); ///< Disable, but don't deallocate. + virtual double ReadRisingTimestamp(); ///< Return the timestamp for the + ///rising interrupt that occurred. + virtual double ReadFallingTimestamp(); ///< Return the timestamp for the + ///falling interrupt that occurred. + virtual void SetUpSourceEdge(bool risingEdge, bool fallingEdge); + + protected: + void *m_interrupt = nullptr; + uint32_t m_interruptIndex = std::numeric_limits::max(); + void AllocateInterrupts(bool watcher); + + static std::unique_ptr m_interrupts; +}; diff --git a/Robot2016/wpilib/cpp/current/include/IterativeRobot.h b/Robot2016/wpilib/cpp/current/include/IterativeRobot.h new file mode 100644 index 0000000..acba235 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/IterativeRobot.h @@ -0,0 +1,82 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Timer.h" +#include "RobotBase.h" + +/** + * IterativeRobot implements a specific type of Robot Program framework, + * extending the RobotBase class. + * + * The IterativeRobot class is intended to be subclassed by a user creating a + * robot program. + * + * This class is intended to implement the "old style" default code, by + * providing + * the following functions which are called by the main loop, + * StartCompetition(), at the appropriate times: + * + * RobotInit() -- provide for initialization at robot power-on + * + * Init() functions -- each of the following functions is called once when the + * appropriate mode is entered: + * - DisabledInit() -- called only when first disabled + * - AutonomousInit() -- called each and every time autonomous is entered from + * another mode + * - TeleopInit() -- called each and every time teleop is entered from + * another mode + * - TestInit() -- called each and every time test is entered from + * another mode + * + * Periodic() functions -- each of these functions is called iteratively at the + * appropriate periodic rate (aka the "slow loop"). The + * default period of + * the iterative robot is synced to the driver station + * control packets, + * giving a periodic frequency of about 50Hz (50 times + * per second). + * - DisabledPeriodic() + * - AutonomousPeriodic() + * - TeleopPeriodic() + * - TestPeriodic() + * + */ + +class IterativeRobot : public RobotBase { + public: + /* + * The default period for the periodic function calls (seconds) + * Setting the period to 0.0 will cause the periodic functions to follow + * the Driver Station packet rate of about 50Hz. + */ + static constexpr double kDefaultPeriod = 0.0; + + virtual void StartCompetition(); + + virtual void RobotInit(); + virtual void DisabledInit(); + virtual void AutonomousInit(); + virtual void TeleopInit(); + virtual void TestInit(); + + virtual void DisabledPeriodic(); + virtual void AutonomousPeriodic(); + virtual void TeleopPeriodic(); + virtual void TestPeriodic(); + + protected: + virtual ~IterativeRobot() = default; + IterativeRobot() = default; + + private: + bool m_disabledInitialized = false; + bool m_autonomousInitialized = false; + bool m_teleopInitialized = false; + bool m_testInitialized = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Jaguar.h b/Robot2016/wpilib/cpp/current/include/Jaguar.h new file mode 100644 index 0000000..7e25b9b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Jaguar.h @@ -0,0 +1,31 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Luminary Micro / Vex Robotics Jaguar Speed Controller with PWM control + */ +class Jaguar : public SafePWM, public SpeedController { + public: + explicit Jaguar(uint32_t channel); + virtual ~Jaguar() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Joystick.h b/Robot2016/wpilib/cpp/current/include/Joystick.h new file mode 100644 index 0000000..fdd4d7d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Joystick.h @@ -0,0 +1,118 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef JOYSTICK_H_ +#define JOYSTICK_H_ + +#include +#include +#include +#include "GenericHID.h" +#include "ErrorBase.h" + +class DriverStation; + +/** + * Handle input from standard Joysticks connected to the Driver Station. + * This class handles standard input that comes from the Driver Station. Each + * time a value is requested + * the most recent value is returned. There is a single class instance for each + * joystick and the mapping + * of ports to hardware buttons depends on the code in the driver station. + */ +class Joystick : public GenericHID, public ErrorBase { + public: + static const uint32_t kDefaultXAxis = 0; + static const uint32_t kDefaultYAxis = 1; + static const uint32_t kDefaultZAxis = 2; + static const uint32_t kDefaultTwistAxis = 2; + static const uint32_t kDefaultThrottleAxis = 3; + typedef enum { + kXAxis, + kYAxis, + kZAxis, + kTwistAxis, + kThrottleAxis, + kNumAxisTypes + } AxisType; + static const uint32_t kDefaultTriggerButton = 1; + static const uint32_t kDefaultTopButton = 2; + typedef enum { kTriggerButton, kTopButton, kNumButtonTypes } ButtonType; + typedef enum { kLeftRumble, kRightRumble } RumbleType; + typedef enum { + kUnknown = -1, + kXInputUnknown = 0, + kXInputGamepad = 1, + kXInputWheel = 2, + kXInputArcadeStick = 3, + kXInputFlightStick = 4, + kXInputDancePad = 5, + kXInputGuitar = 6, + kXInputGuitar2 = 7, + kXInputDrumKit = 8, + kXInputGuitar3 = 11, + kXInputArcadePad = 19, + kHIDJoystick = 20, + kHIDGamepad = 21, + kHIDDriving = 22, + kHIDFlight = 23, + kHID1stPerson = 24 + } HIDType; + explicit Joystick(uint32_t port); + Joystick(uint32_t port, uint32_t numAxisTypes, uint32_t numButtonTypes); + virtual ~Joystick() = default; + + Joystick(const Joystick&) = delete; + Joystick& operator=(const Joystick&) = delete; + + uint32_t GetAxisChannel(AxisType axis) const; + void SetAxisChannel(AxisType axis, uint32_t channel); + + virtual float GetX(JoystickHand hand = kRightHand) const override; + virtual float GetY(JoystickHand hand = kRightHand) const override; + virtual float GetZ() const override; + virtual float GetTwist() const override; + virtual float GetThrottle() const override; + virtual float GetAxis(AxisType axis) const; + float GetRawAxis(uint32_t axis) const override; + + virtual bool GetTrigger(JoystickHand hand = kRightHand) const override; + virtual bool GetTop(JoystickHand hand = kRightHand) const override; + virtual bool GetBumper(JoystickHand hand = kRightHand) const override; + virtual bool GetRawButton(uint32_t button) const override; + virtual int GetPOV(uint32_t pov = 0) const override; + bool GetButton(ButtonType button) const; + static Joystick *GetStickForPort(uint32_t port); + + virtual float GetMagnitude() const; + virtual float GetDirectionRadians() const; + virtual float GetDirectionDegrees() const; + + bool GetIsXbox() const; + Joystick::HIDType GetType() const; + std::string GetName() const; + int GetAxisType(uint8_t axis) const; + + int GetAxisCount() const; + int GetButtonCount() const; + int GetPOVCount() const; + + void SetRumble(RumbleType type, float value); + void SetOutput(uint8_t outputNumber, bool value); + void SetOutputs(uint32_t value); + + private: + DriverStation &m_ds; + uint32_t m_port; + std::vector m_axes; + std::vector m_buttons; + uint32_t m_outputs = 0; + uint16_t m_leftRumble = 0; + uint16_t m_rightRumble = 0; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindow.h b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindow.h new file mode 100644 index 0000000..17817a9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindow.h @@ -0,0 +1,85 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2012-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef _LIVE_WINDOW_H +#define _LIVE_WINDOW_H + +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITable.h" +#include "Commands/Scheduler.h" +#include +#include +#include + +struct LiveWindowComponent { + std::string subsystem; + std::string name; + bool isSensor = false; + + LiveWindowComponent() = default; + LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) { + this->subsystem = subsystem; + this->name = name; + this->isSensor = isSensor; + } +}; + +/** + * The LiveWindow class is the public interface for putting sensors and + * actuators + * on the LiveWindow. + * + * @author Brad Miller + */ +class LiveWindow { + public: + static LiveWindow *GetInstance(); + void Run(); + void AddSensor(const std::string &subsystem, const std::string &name, + LiveWindowSendable *component); + void AddSensor(const std::string &subsystem, const std::string &name, + LiveWindowSendable &component); + void AddSensor(const std::string &subsystem, const std::string &name, + std::shared_ptr component); + void AddActuator(const std::string &subsystem, const std::string &name, + LiveWindowSendable *component); + void AddActuator(const std::string &subsystem, const std::string &name, + LiveWindowSendable &component); + void AddActuator(const std::string &subsystem, const std::string &name, + std::shared_ptr component); + + void AddSensor(std::string type, int channel, LiveWindowSendable *component); + void AddActuator(std::string type, int channel, + LiveWindowSendable *component); + void AddActuator(std::string type, int module, int channel, + LiveWindowSendable *component); + + bool IsEnabled() const { return m_enabled; } + void SetEnabled(bool enabled); + + protected: + LiveWindow(); + virtual ~LiveWindow() = default; + + private: + void UpdateValues(); + void Initialize(); + void InitializeLiveWindowComponents(); + + std::vector> m_sensors; + std::map, LiveWindowComponent> m_components; + + std::shared_ptr m_liveWindowTable; + std::shared_ptr m_statusTable; + + Scheduler *m_scheduler; + + bool m_enabled = false; + bool m_firstTime = true; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowSendable.h b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowSendable.h new file mode 100644 index 0000000..16debcc --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowSendable.h @@ -0,0 +1,39 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2012-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef LIVEWINDOWSENDABLE_H_ +#define LIVEWINDOWSENDABLE_H_ + +#include "SmartDashboard/Sendable.h" + +/** + * Live Window Sendable is a special type of object sendable to the live window. + * + * @author Patrick Plenefisch + */ +class LiveWindowSendable : public Sendable { + public: + /** + * Update the table for this sendable object with the latest + * values. + */ + virtual void UpdateTable() = 0; + + /** + * Start having this sendable object automatically respond to + * value changes reflect the value on the table. + */ + virtual void StartLiveWindowMode() = 0; + + /** + * Stop having this sendable object automatically respond to value + * changes. + */ + virtual void StopLiveWindowMode() = 0; +}; + +#endif /* LIVEWINDOWSENDABLE_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowStatusListener.h b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowStatusListener.h new file mode 100644 index 0000000..88b373b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/LiveWindow/LiveWindowStatusListener.h @@ -0,0 +1,20 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2012-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef _LIVE_WINDOW_STATUS_LISTENER_H +#define _LIVE_WINDOW_STATUS_LISTENER_H + +#include "tables/ITable.h" +#include "tables/ITableListener.h" + +class LiveWindowStatusListener : public ITableListener { + public: + virtual void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew); +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Log.hpp b/Robot2016/wpilib/cpp/current/include/Log.hpp new file mode 100644 index 0000000..81b7b84 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Log.hpp @@ -0,0 +1,119 @@ +#pragma once + +#include +#include +#include +#include +#ifdef _WIN32 + #include +#else + #include +#endif + +inline std::string NowTime(); + +enum TLogLevel {logNONE, logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4}; + +class Log +{ +public: + Log(); + virtual ~Log(); + std::ostringstream& Get(TLogLevel level = logINFO); +public: + static TLogLevel& ReportingLevel(); + static std::string ToString(TLogLevel level); + static TLogLevel FromString(const std::string& level); +protected: + std::ostringstream os; +private: + Log(const Log&); + Log& operator =(const Log&); +}; + +inline Log::Log() +{ +} + +inline std::ostringstream& Log::Get(TLogLevel level) +{ + os << "- " << NowTime(); + os << " " << ToString(level) << ": "; + os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t'); + return os; +} + +inline Log::~Log() +{ + os << std::endl; + fprintf(stderr, "%s", os.str().c_str()); + fflush(stderr); +} + +inline TLogLevel& Log::ReportingLevel() +{ + static TLogLevel reportingLevel = logDEBUG4; + return reportingLevel; +} + +inline std::string Log::ToString(TLogLevel level) +{ + static const char* const buffer[] = {"NONE", "ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4"}; + return buffer[level]; +} + +inline TLogLevel Log::FromString(const std::string& level) +{ + if (level == "DEBUG4") + return logDEBUG4; + if (level == "DEBUG3") + return logDEBUG3; + if (level == "DEBUG2") + return logDEBUG2; + if (level == "DEBUG1") + return logDEBUG1; + if (level == "DEBUG") + return logDEBUG; + if (level == "INFO") + return logINFO; + if (level == "WARNING") + return logWARNING; + if (level == "ERROR") + return logERROR; + if (level == "NONE") + return logNONE; + Log().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default."; + return logINFO; +} + +typedef Log FILELog; + +#define FILE_LOG(level) \ + if (level > FILELog::ReportingLevel()) ; \ + else Log().Get(level) + + +#ifdef _WIN32 +inline std::string NowTime() +{ + SYSTEMTIME st; + GetLocalTime(&st); + char result[100] = {0}; + sprintf(result, "%d:%d:%d.%d", st.wHour , st.wMinute , st.wSecond , st.wMilliseconds); + return result; +} +#else +inline std::string NowTime() +{ + char buffer[11]; + time_t t; + time(&t); + tm * r = gmtime(&t); + strftime(buffer, sizeof(buffer), "%H:%M:%S", r); + struct timeval tv; + gettimeofday(&tv, 0); + char result[100] = {0}; + sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000); + return result; +} +#endif diff --git a/Robot2016/wpilib/cpp/current/include/MotorSafety.h b/Robot2016/wpilib/cpp/current/include/MotorSafety.h new file mode 100644 index 0000000..373fddf --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/MotorSafety.h @@ -0,0 +1,23 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +#define DEFAULT_SAFETY_EXPIRATION 0.1 + +#include + +class MotorSafety { + public: + virtual void SetExpiration(float timeout) = 0; + virtual float GetExpiration() const = 0; + virtual bool IsAlive() const = 0; + virtual void StopMotor() = 0; + virtual void SetSafetyEnabled(bool enabled) = 0; + virtual bool IsSafetyEnabled() const = 0; + virtual void GetDescription(std::ostringstream& desc) const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/MotorSafetyHelper.h b/Robot2016/wpilib/cpp/current/include/MotorSafetyHelper.h new file mode 100644 index 0000000..f124605 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/MotorSafetyHelper.h @@ -0,0 +1,41 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include "HAL/cpp/priority_mutex.h" + +#include + +class MotorSafety; + +class MotorSafetyHelper : public ErrorBase { + public: + MotorSafetyHelper(MotorSafety *safeObject); + ~MotorSafetyHelper(); + void Feed(); + void SetExpiration(float expirationTime); + float GetExpiration() const; + bool IsAlive() const; + void Check(); + void SetSafetyEnabled(bool enabled); + bool IsSafetyEnabled() const; + static void CheckMotors(); + + private: + double m_expiration; // the expiration time for this object + bool m_enabled; // true if motor safety is enabled for this motor + double m_stopTime; // the FPGA clock value when this motor has expired + mutable priority_recursive_mutex + m_syncMutex; // protect accesses to the state for this object + MotorSafety *m_safeObject; // the object that is using the helper + // List of all existing MotorSafetyHelper objects. + static std::set m_helperList; + static priority_recursive_mutex + m_listMutex; // protect accesses to the list of helpers +}; diff --git a/Robot2016/wpilib/cpp/current/include/NIIMAQdx.h b/Robot2016/wpilib/cpp/current/include/NIIMAQdx.h new file mode 100644 index 0000000..87be7f6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NIIMAQdx.h @@ -0,0 +1,950 @@ +//============================================================================== +// +// Title : NIIMAQdx.h +// Created : 1403685834 seconds after 1/1/1970 12:00:00 UTC +// Copyright : © Copyright 2006, National Instruments Corporation, All rights +// reserved +// Purpose : Include file for NI-IMAQdx library support. +// +//============================================================================== +#ifndef ___niimaqdx_h___ +#define ___niimaqdx_h___ + +#ifdef __cplusplus +extern "C" { +#endif + +#if !defined(niimaqdx_types) +#define niimaqdx_types + +#ifdef _CVI_ +#pragma EnableLibraryRuntimeChecking +#endif + +//============================================================================== +// Typedefs +//============================================================================== +#ifndef _NI_uInt8_DEFINED_ +#define _NI_uInt8_DEFINED_ +typedef unsigned char uInt8; +#endif + +#ifndef _NI_uInt16_DEFINED_ +#define _NI_uInt16_DEFINED_ +typedef unsigned short int uInt16; +#endif + +#ifndef _NI_uInt32_DEFINED_ +#define _NI_uInt32_DEFINED_ +#if defined(_MSC_VER) +typedef unsigned long uInt32; +#elif __GNUC__ +#if __x86_64__ +typedef unsigned int uInt32; +#else +typedef unsigned long uInt32; +#endif +#endif +#endif + +#ifndef _NI_uInt64_DEFINED_ +#define _NI_uInt64_DEFINED_ +#if defined(_MSC_VER) || _CVI_ >= 700 +typedef unsigned __int64 uInt64; +#elif __GNUC__ +typedef unsigned long long uInt64; +#endif +#endif + +#ifndef _NI_Int8_DEFINED_ +#define _NI_Int8_DEFINED_ +typedef char Int8; +#endif + +#ifndef _NI_Int16_DEFINED_ +#define _NI_Int16_DEFINED_ +typedef short int Int16; +#endif + +#ifndef _NI_Int32_DEFINED_ +#define _NI_Int32_DEFINED_ +#if defined(_MSC_VER) +typedef long Int32; +#elif __GNUC__ +#if __x86_64__ +typedef int Int32; +#else +typedef long Int32; +#endif +#endif +#endif + +#ifndef _NI_Int64_DEFINED_ +#define _NI_Int64_DEFINED_ +#if defined(_MSC_VER) || _CVI_ >= 700 +typedef __int64 Int64; +#elif __GNUC__ +typedef long long int Int64; +#endif +#endif + +#ifndef _NI_float32_DEFINED_ +#define _NI_float32_DEFINED_ +typedef float float32; +#endif + +#ifndef _NI_float64_DEFINED_ +#define _NI_float64_DEFINED_ +typedef double float64; +#endif + +#ifndef TRUE +#define TRUE (1L) +#endif + +#ifndef FALSE +#define FALSE (0L) +#endif + +#ifndef _NI_GUIDHNDL_DEFINED +typedef uInt32 GUIHNDL; +#endif + +#if (defined(_MSC_VER) || defined(_CVI_)) +#ifndef _NI_FUNC_DEFINED +#define NI_FUNC __stdcall +#endif + +#ifndef _NI_FUNCC_DEFINED +#define NI_FUNCC __cdecl +#endif +#elif defined(__GNUC__) +#ifndef _NI_FUNC_DEFINED +#define NI_FUNC +#endif + +#ifndef _NI_FUNCC_DEFINED +#define NI_FUNCC +#endif +#endif + +#ifndef _NI_bool32_DEFINED_ +#define _NI_bool32_DEFINED_ +typedef uInt32 bool32; +#endif + +#ifndef _NI_IMAQdxSession_DEFINED_ +#define _NI_IMAQdxSession_DEFINED_ +typedef uInt32 IMAQdxSession; +#endif + +#define IMAQDX_MAX_API_STRING_LENGTH 512 + +//============================================================================== +// Forward Declare Data Structures +//============================================================================== +typedef struct Image_struct Image; + +//============================================================================== +// Error Codes Enumeration +//============================================================================== +typedef enum IMAQdxError_enum { + IMAQdxErrorSuccess = 0x0, // Success + IMAQdxErrorSystemMemoryFull = 0xBFF69000, // Not enough memory + IMAQdxErrorInternal, // Internal error + IMAQdxErrorInvalidParameter, // Invalid parameter + IMAQdxErrorInvalidPointer, // Invalid pointer + IMAQdxErrorInvalidInterface, // Invalid camera session + IMAQdxErrorInvalidRegistryKey, // Invalid registry key + IMAQdxErrorInvalidAddress, // Invalid address + IMAQdxErrorInvalidDeviceType, // Invalid device type + IMAQdxErrorNotImplemented, // Not implemented + IMAQdxErrorCameraNotFound, // Camera not found + IMAQdxErrorCameraInUse, // Camera is already in use. + IMAQdxErrorCameraNotInitialized, // Camera is not initialized. + IMAQdxErrorCameraRemoved, // Camera has been removed. + IMAQdxErrorCameraRunning, // Acquisition in progress. + IMAQdxErrorCameraNotRunning, // No acquisition in progress. + IMAQdxErrorAttributeNotSupported, // Attribute not supported by the camera. + IMAQdxErrorAttributeNotSettable, // Unable to set attribute. + IMAQdxErrorAttributeNotReadable, // Unable to get attribute. + IMAQdxErrorAttributeOutOfRange, // Attribute value is out of range. + IMAQdxErrorBufferNotAvailable, // Requested buffer is unavailable. + IMAQdxErrorBufferListEmpty, // Buffer list is empty. Add one or more buffers. + IMAQdxErrorBufferListLocked, // Buffer list is already locked. Reconfigure + // acquisition and try again. + IMAQdxErrorBufferListNotLocked, // No buffer list. Reconfigure acquisition + // and try again. + IMAQdxErrorResourcesAllocated, // Transfer engine resources already + // allocated. Reconfigure acquisition and try + // again. + IMAQdxErrorResourcesUnavailable, // Insufficient transfer engine resources. + IMAQdxErrorAsyncWrite, // Unable to perform asychronous register write. + IMAQdxErrorAsyncRead, // Unable to perform asychronous register read. + IMAQdxErrorTimeout, // Timeout. + IMAQdxErrorBusReset, // Bus reset occurred during a transaction. + IMAQdxErrorInvalidXML, // Unable to load camera's XML file. + IMAQdxErrorFileAccess, // Unable to read/write to file. + IMAQdxErrorInvalidCameraURLString, // Camera has malformed URL string. + IMAQdxErrorInvalidCameraFile, // Invalid camera file. + IMAQdxErrorGenICamError, // Unknown Genicam error. + IMAQdxErrorFormat7Parameters, // For format 7: The combination of speed, + // image position, image size, and color coding + // is incorrect. + IMAQdxErrorInvalidAttributeType, // The attribute type is not compatible with + // the passed variable type. + IMAQdxErrorDLLNotFound, // The DLL could not be found. + IMAQdxErrorFunctionNotFound, // The function could not be found. + IMAQdxErrorLicenseNotActivated, // License not activated. + IMAQdxErrorCameraNotConfiguredForListener, // The camera is not configured + // properly to support a listener. + IMAQdxErrorCameraMulticastNotAvailable, // Unable to configure the system for + // multicast support. + IMAQdxErrorBufferHasLostPackets, // The requested buffer has lost packets and + // the user requested an error to be + // generated. + IMAQdxErrorGiGEVisionError, // Unknown GiGE Vision error. + IMAQdxErrorNetworkError, // Unknown network error. + IMAQdxErrorCameraUnreachable, // Unable to connect to the camera. + IMAQdxErrorHighPerformanceNotSupported, // High performance acquisition is + // not supported on the specified + // network interface. Connect the + // camera to a network interface + // running the high performance + // driver. + IMAQdxErrorInterfaceNotRenamed, // Unable to rename interface. Invalid or + // duplicate name specified. + IMAQdxErrorNoSupportedVideoModes, // The camera does not have any video modes + // which are supported. + IMAQdxErrorSoftwareTriggerOverrun, // Software trigger overrun. + IMAQdxErrorTestPacketNotReceived, // The system did not receive a test packet + // from the camera. The packet size may be + // too large for the network configuration + // or a firewall may be enabled. + IMAQdxErrorCorruptedImageReceived, // The camera returned a corrupted image. + IMAQdxErrorCameraConfigurationHasChanged, // The camera did not return an + // image of the correct type it was + // configured for previously. + IMAQdxErrorCameraInvalidAuthentication, // The camera is configured with + // password authentication and either + // the user name and password were + // not configured or they are + // incorrect. + IMAQdxErrorUnknownHTTPError, // The camera returned an unknown HTTP error. + IMAQdxErrorKernelDriverUnavailable, // Unable to attach to the kernel mode + // driver. + IMAQdxErrorPixelFormatDecoderUnavailable, // No decoder available for + // selected pixel format. + IMAQdxErrorFirmwareUpdateNeeded, // The acquisition hardware needs a firmware + // update before it can be used. + IMAQdxErrorFirmwareUpdateRebootNeeded, // The firmware on the acquisition + // hardware has been updated and the + // system must be rebooted before use. + IMAQdxErrorLightingCurrentOutOfRange, // The requested current level from the + // lighting controller is not possible. + IMAQdxErrorUSB3VisionError, // Unknown USB3 Vision error. + IMAQdxErrorInvalidU3VUSBDescriptor, // The camera has a USB descriptor that + // is incompatible with the USB3 Vision + // specification. + IMAQdxErrorU3VInvalidControlInterface, // The USB3 Vision control interface + // is not implemented or is invalid on + // this camera. + IMAQdxErrorU3VControlInterfaceError, // There was an error from the control + // interface of the USB3 Vision camera. + IMAQdxErrorU3VInvalidEventInterface, // The USB3 Vision event interface is + // not implemented or is invalid on this + // camera. + IMAQdxErrorU3VEventInterfaceError, // There was an error from the event + // interface of the USB3 Vision camera. + IMAQdxErrorU3VInvalidStreamInterface, // The USB3 Vision stream interface is + // not implemented or is invalid on + // this camera. + IMAQdxErrorU3VStreamInterfaceError, // There was an error from the stream + // interface of the USB3 Vision camera. + IMAQdxErrorU3VUnsupportedConnectionSpeed, // The USB connection speed is not + // supported by the camera. Check + // whether the camera is plugged + // into a USB 2.0 port instead of a + // USB 3.0 port. If so, verify + // that the camera supports this + // use case. + IMAQdxErrorU3VInsufficientPower, // The USB3 Vision camera requires more + // current than can be supplied by the USB + // port in use. + IMAQdxErrorU3VInvalidMaxCurrent, // The U3V_MaximumCurrentUSB20_mA registry + // value is not valid for the connected USB3 + // Vision camera. + IMAQdxErrorBufferIncompleteData, // The requested buffer has incomplete data + // and the user requested an error to be + // generated. + IMAQdxErrorCameraAcquisitionConfigFailed, // The camera returned an error + // starting the acquisition. + IMAQdxErrorCameraClosePending, // The camera still has outstanding references + // and will be closed when these operations + // complete. + IMAQdxErrorSoftwareFault, // An unexpected software error occurred. + IMAQdxErrorCameraPropertyInvalid, // The value for an invalid camera property + // was requested. + IMAQdxErrorJumboFramesNotEnabled, // Jumbo frames are not enabled on the + // host. Maximum packet size is 1500 + // bytes. + IMAQdxErrorBayerPixelFormatNotSelected, // This operation requires that the + // camera has a Bayer pixel format + // selected. + IMAQdxErrorGuard = 0xFFFFFFFF, +} IMAQdxError; + +//============================================================================== +// Bus Type Enumeration +//============================================================================== +typedef enum IMAQdxBusType_enum { + IMAQdxBusTypeFireWire = 0x31333934, + IMAQdxBusTypeEthernet = 0x69707634, + IMAQdxBusTypeSimulator = 0x2073696D, + IMAQdxBusTypeDirectShow = 0x64736877, + IMAQdxBusTypeIP = 0x4950636D, + IMAQdxBusTypeSmartCam2 = 0x53436132, + IMAQdxBusTypeUSB3Vision = 0x55534233, + IMAQdxBusTypeUVC = 0x55564320, + IMAQdxBusTypeGuard = 0xFFFFFFFF, +} IMAQdxBusType; + +//============================================================================== +// Camera Control Mode Enumeration +//============================================================================== +typedef enum IMAQdxCameraControlMode_enum { + IMAQdxCameraControlModeController, + IMAQdxCameraControlModeListener, + IMAQdxCameraControlModeGuard = 0xFFFFFFFF, +} IMAQdxCameraControlMode; + +//============================================================================== +// Buffer Number Mode Enumeration +//============================================================================== +typedef enum IMAQdxBufferNumberMode_enum { + IMAQdxBufferNumberModeNext, + IMAQdxBufferNumberModeLast, + IMAQdxBufferNumberModeBufferNumber, + IMAQdxBufferNumberModeGuard = 0xFFFFFFFF, +} IMAQdxBufferNumberMode; + +//============================================================================== +// Plug n Play Event Enumeration +//============================================================================== +typedef enum IMAQdxPnpEvent_enum { + IMAQdxPnpEventCameraAttached, + IMAQdxPnpEventCameraDetached, + IMAQdxPnpEventBusReset, + IMAQdxPnpEventGuard = 0xFFFFFFFF, +} IMAQdxPnpEvent; + +//============================================================================== +// Bayer Pattern Enumeration +//============================================================================== +typedef enum IMAQdxBayerPattern_enum { + IMAQdxBayerPatternNone, + IMAQdxBayerPatternGB, + IMAQdxBayerPatternGR, + IMAQdxBayerPatternBG, + IMAQdxBayerPatternRG, + IMAQdxBayerPatternHardware, + IMAQdxBayerPatternGuard = 0xFFFFFFFF, +} IMAQdxBayerPattern; + +//============================================================================== +// Bayer Decode Algorithm Enumeration +//============================================================================== +typedef enum IMAQdxBayerAlgorithm_enum { + IMAQdxBayerAlgorithmBilinear, + IMAQdxBayerAlgorithmVNG, + IMAQdxBayerAlgorithmGuard = 0xFFFFFFFF, +} IMAQdxBayerAlgorithm; + +//============================================================================== +// Output Image Types -- Values match Vision Development Module image types +//============================================================================== +typedef enum IMAQdxOutputImageType_enum { + IMAQdxOutputImageTypeU8 = 0, + IMAQdxOutputImageTypeI16 = 1, + IMAQdxOutputImageTypeU16 = 7, + IMAQdxOutputImageTypeRGB32 = 4, + IMAQdxOutputImageTypeRGB64 = 6, + IMAQdxOutputImageTypeAuto = 0x7FFFFFFF, + IMAQdxOutputImageTypeGuard = 0xFFFFFFFF, +} IMAQdxOutputImageType; + +//============================================================================== +// Controller Destination Mode Enumeration +//============================================================================== +typedef enum IMAQdxDestinationMode_enum { + IMAQdxDestinationModeUnicast, + IMAQdxDestinationModeBroadcast, + IMAQdxDestinationModeMulticast, + IMAQdxDestinationModeGuard = 0xFFFFFFFF, +} IMAQdxDestinationMode; + +//============================================================================== +// Attribute Type Enumeration +//============================================================================== +typedef enum IMAQdxAttributeType_enum { + IMAQdxAttributeTypeU32, + IMAQdxAttributeTypeI64, + IMAQdxAttributeTypeF64, + IMAQdxAttributeTypeString, + IMAQdxAttributeTypeEnum, + IMAQdxAttributeTypeBool, + IMAQdxAttributeTypeCommand, + IMAQdxAttributeTypeBlob, + IMAQdxAttributeTypeGuard = 0xFFFFFFFF, +} IMAQdxAttributeType; + +//============================================================================== +// Value Type Enumeration +//============================================================================== +typedef enum IMAQdxValueType_enum { + IMAQdxValueTypeU32, + IMAQdxValueTypeI64, + IMAQdxValueTypeF64, + IMAQdxValueTypeString, + IMAQdxValueTypeEnumItem, + IMAQdxValueTypeBool, + IMAQdxValueTypeDisposableString, + IMAQdxValueTypeGuard = 0xFFFFFFFF, +} IMAQdxValueType; + +//============================================================================== +// Interface File Flags Enumeration +//============================================================================== +typedef enum IMAQdxInterfaceFileFlags_enum { + IMAQdxInterfaceFileFlagsConnected = 0x1, + IMAQdxInterfaceFileFlagsDirty = 0x2, + IMAQdxInterfaceFileFlagsGuard = 0xFFFFFFFF, +} IMAQdxInterfaceFileFlags; + +//============================================================================== +// Overwrite Mode Enumeration +//============================================================================== +typedef enum IMAQdxOverwriteMode_enum { + IMAQdxOverwriteModeGetOldest = 0x0, + IMAQdxOverwriteModeFail = 0x2, + IMAQdxOverwriteModeGetNewest = 0x3, + IMAQdxOverwriteModeGuard = 0xFFFFFFFF, +} IMAQdxOverwriteMode; + +//============================================================================== +// Incomplete Buffer Mode Enumeration +//============================================================================== +typedef enum IMAQdxIncompleteBufferMode_enum { + IMAQdxIncompleteBufferModeIgnore, + IMAQdxIncompleteBufferModeFail, + IMAQdxIncompleteBufferModeGuard = 0xFFFFFFFF, +} IMAQdxIncompleteBufferMode; + +//============================================================================== +// Lost Packet Mode Enumeration +//============================================================================== +typedef enum IMAQdxLostPacketMode_enum { + IMAQdxLostPacketModeIgnore, + IMAQdxLostPacketModeFail, + IMAQdxLostPacketModeGuard = 0xFFFFFFFF, +} IMAQdxLostPacketMode; + +//============================================================================== +// Attribute Visibility Enumeration +//============================================================================== +typedef enum IMAQdxAttributeVisibility_enum { + IMAQdxAttributeVisibilitySimple = 0x00001000, + IMAQdxAttributeVisibilityIntermediate = 0x00002000, + IMAQdxAttributeVisibilityAdvanced = 0x00004000, + IMAQdxAttributeVisibilityGuard = 0xFFFFFFFF, +} IMAQdxAttributeVisibility; + +//============================================================================== +// Stream Channel Mode Enumeration +//============================================================================== +typedef enum IMAQdxStreamChannelMode_enum { + IMAQdxStreamChannelModeAutomatic, + IMAQdxStreamChannelModeManual, + IMAQdxStreamChannelModeGuard = 0xFFFFFFFF, +} IMAQdxStreamChannelMode; + +//============================================================================== +// Pixel Signedness Enumeration +//============================================================================== +typedef enum IMAQdxPixelSignedness_enum { + IMAQdxPixelSignednessUnsigned, + IMAQdxPixelSignednessSigned, + IMAQdxPixelSignednessHardware, + IMAQdxPixelSignednessGuard = 0xFFFFFFFF, +} IMAQdxPixelSignedness; + +//============================================================================== +// USB Connection Speed Enumeration +//============================================================================== +typedef enum IMAQdxUSBConnectionSpeed_enum { + IMAQdxUSBConnectionSpeedLow = 1, + IMAQdxUSBConnectionSpeedFull = 2, + IMAQdxUSBConnectionSpeedHigh = 4, + IMAQdxUSBConnectionSpeedSuper = 8, + IMAQdxUSBConnectionSpeedGuard = 0xFFFFFFFF, +} IMAQdxUSBConnectionSpeed; + +//============================================================================== +// CVI Structures +//============================================================================== +#pragma pack(push, 4) + +//============================================================================== +// Camera Information Structure +//============================================================================== +typedef struct IMAQdxCameraInformation_struct { + uInt32 Type; + uInt32 Version; + uInt32 Flags; + uInt32 SerialNumberHi; + uInt32 SerialNumberLo; + IMAQdxBusType BusType; + char InterfaceName[IMAQDX_MAX_API_STRING_LENGTH]; + char VendorName[IMAQDX_MAX_API_STRING_LENGTH]; + char ModelName[IMAQDX_MAX_API_STRING_LENGTH]; + char CameraFileName[IMAQDX_MAX_API_STRING_LENGTH]; + char CameraAttributeURL[IMAQDX_MAX_API_STRING_LENGTH]; +} IMAQdxCameraInformation; + +//============================================================================== +// Camera File Structure +//============================================================================== +typedef struct IMAQdxCameraFile_struct { + uInt32 Type; + uInt32 Version; + char FileName[IMAQDX_MAX_API_STRING_LENGTH]; +} IMAQdxCameraFile; + +//============================================================================== +// Attribute Information Structure +//============================================================================== +typedef struct IMAQdxAttributeInformation_struct { + IMAQdxAttributeType Type; + bool32 Readable; + bool32 Writable; + char Name[IMAQDX_MAX_API_STRING_LENGTH]; +} IMAQdxAttributeInformation; + +//============================================================================== +// Enumeration Item Structure +//============================================================================== +typedef struct IMAQdxEnumItem_struct { + uInt32 Value; + uInt32 Reserved; + char Name[IMAQDX_MAX_API_STRING_LENGTH]; +} IMAQdxEnumItem; + +//============================================================================== +// Camera Information Structure +//============================================================================== +typedef IMAQdxEnumItem IMAQdxVideoMode; + +#pragma pack(pop) + +//============================================================================== +// Callbacks +//============================================================================== +typedef uInt32(NI_FUNC* FrameDoneEventCallbackPtr)(IMAQdxSession id, + uInt32 bufferNumber, + void* callbackData); +typedef uInt32(NI_FUNC* PnpEventCallbackPtr)(IMAQdxSession id, + IMAQdxPnpEvent pnpEvent, + void* callbackData); +typedef void(NI_FUNC* AttributeUpdatedEventCallbackPtr)(IMAQdxSession id, + const char* name, + void* callbackData); + +#endif // niimaqdx_types +//============================================================================== +// Attributes +//============================================================================== +#define IMAQdxAttributeBaseAddress \ + "CameraInformation::BaseAddress" // Read only. Gets the base address of the + // camera registers. +#define IMAQdxAttributeBusType \ + "CameraInformation::BusType" // Read only. Gets the bus type of the camera. +#define IMAQdxAttributeModelName \ + "CameraInformation::ModelName" // Read only. Returns the model name. +#define IMAQdxAttributeSerialNumberHigh \ + "CameraInformation::SerialNumberHigh" // Read only. Gets the upper 32-bits of + // the camera 64-bit serial number. +#define IMAQdxAttributeSerialNumberLow \ + "CameraInformation::SerialNumberLow" // Read only. Gets the lower 32-bits of + // the camera 64-bit serial number. +#define IMAQdxAttributeVendorName \ + "CameraInformation::VendorName" // Read only. Returns the vendor name. +#define IMAQdxAttributeHostIPAddress \ + "CameraInformation::HostIPAddress" // Read only. Returns the host adapter IP + // address. +#define IMAQdxAttributeIPAddress \ + "CameraInformation::IPAddress" // Read only. Returns the IP address. +#define IMAQdxAttributePrimaryURLString \ + "CameraInformation::PrimaryURLString" // Read only. Gets the camera's primary + // URL string. +#define IMAQdxAttributeSecondaryURLString \ + "CameraInformation::SecondaryURLString" // Read only. Gets the camera's + // secondary URL string. +#define IMAQdxAttributeAcqInProgress \ + "StatusInformation::AcqInProgress" // Read only. Gets the current state of + // the acquisition. TRUE if acquiring; + // otherwise FALSE. +#define IMAQdxAttributeLastBufferCount \ + "StatusInformation::LastBufferCount" // Read only. Gets the number of + // transferred buffers. +#define IMAQdxAttributeLastBufferNumber \ + "StatusInformation::LastBufferNumber" // Read only. Gets the last cumulative + // buffer number transferred. +#define IMAQdxAttributeLostBufferCount \ + "StatusInformation::LostBufferCount" // Read only. Gets the number of lost + // buffers during an acquisition + // session. +#define IMAQdxAttributeLostPacketCount \ + "StatusInformation::LostPacketCount" // Read only. Gets the number of lost + // packets during an acquisition + // session. +#define IMAQdxAttributeRequestedResendPackets \ + "StatusInformation::RequestedResendPacketCount" // Read only. Gets the number + // of packets requested to be + // resent during an + // acquisition session. +#define IMAQdxAttributeReceivedResendPackets \ + "StatusInformation::ReceivedResendPackets" // Read only. Gets the number of + // packets that were requested to + // be resent during an acquisition + // session and were completed. +#define IMAQdxAttributeHandledEventCount \ + "StatusInformation::HandledEventCount" // Read only. Gets the number of + // handled events during an + // acquisition session. +#define IMAQdxAttributeLostEventCount \ + "StatusInformation::LostEventCount" // Read only. Gets the number of lost + // events during an acquisition session. +#define IMAQdxAttributeBayerGainB \ + "AcquisitionAttributes::Bayer::GainB" // Sets/gets the white balance gain for + // the blue component of the Bayer + // conversion. +#define IMAQdxAttributeBayerGainG \ + "AcquisitionAttributes::Bayer::GainG" // Sets/gets the white balance gain for + // the green component of the Bayer + // conversion. +#define IMAQdxAttributeBayerGainR \ + "AcquisitionAttributes::Bayer::GainR" // Sets/gets the white balance gain for + // the red component of the Bayer + // conversion. +#define IMAQdxAttributeBayerPattern \ + "AcquisitionAttributes::Bayer::Pattern" // Sets/gets the Bayer pattern to + // use. +#define IMAQdxAttributeStreamChannelMode \ + "AcquisitionAttributes::Controller::StreamChannelMode" // Gets/sets the mode + // for allocating a + // FireWire stream + // channel. +#define IMAQdxAttributeDesiredStreamChannel \ + "AcquisitionAttributes::Controller::DesiredStreamChannel" // Gets/sets the + // stream channel + // to manually + // allocate. +#define IMAQdxAttributeFrameInterval \ + "AcquisitionAttributes::FrameInterval" // Read only. Gets the duration in + // milliseconds between successive + // frames. +#define IMAQdxAttributeIgnoreFirstFrame \ + "AcquisitionAttributes::IgnoreFirstFrame" // Gets/sets the video delay of one + // frame between starting the + // camera and receiving the video + // feed. +#define IMAQdxAttributeOffsetX \ + "OffsetX" // Gets/sets the left offset of the image. +#define IMAQdxAttributeOffsetY \ + "OffsetY" // Gets/sets the top offset of the image. +#define IMAQdxAttributeWidth "Width" // Gets/sets the width of the image. +#define IMAQdxAttributeHeight "Height" // Gets/sets the height of the image. +#define IMAQdxAttributePixelFormat \ + "PixelFormat" // Gets/sets the pixel format of the source sensor. +#define IMAQdxAttributePacketSize \ + "PacketSize" // Gets/sets the packet size in bytes. +#define IMAQdxAttributePayloadSize \ + "PayloadSize" // Gets/sets the frame size in bytes. +#define IMAQdxAttributeSpeed \ + "AcquisitionAttributes::Speed" // Gets/sets the transfer speed in Mbps for a + // FireWire packet. +#define IMAQdxAttributeShiftPixelBits \ + "AcquisitionAttributes::ShiftPixelBits" // Gets/sets the alignment of 16-bit + // cameras. Downshift the pixel bits + // if the camera returns most + // significant bit-aligned data. +#define IMAQdxAttributeSwapPixelBytes \ + "AcquisitionAttributes::SwapPixelBytes" // Gets/sets the endianness of 16-bit + // cameras. Swap the pixel bytes if + // the camera returns little endian + // data. +#define IMAQdxAttributeOverwriteMode \ + "AcquisitionAttributes::OverwriteMode" // Gets/sets the overwrite mode, used + // to determine acquisition when an + // image transfer cannot be completed + // due to an overwritten internal + // buffer. +#define IMAQdxAttributeTimeout \ + "AcquisitionAttributes::Timeout" // Gets/sets the timeout value in + // milliseconds, used to abort an + // acquisition when the image transfer + // cannot be completed within the delay. +#define IMAQdxAttributeVideoMode \ + "AcquisitionAttributes::VideoMode" // Gets/sets the video mode for a camera. +#define IMAQdxAttributeBitsPerPixel \ + "AcquisitionAttributes::BitsPerPixel" // Gets/sets the actual bits per pixel. + // For 16-bit components, this + // represents the actual bit depth + // (10-, 12-, 14-, or 16-bit). +#define IMAQdxAttributePixelSignedness \ + "AcquisitionAttributes::PixelSignedness" // Gets/sets the signedness of the + // pixel. For 16-bit components, + // this represents the actual pixel + // signedness (Signed, or Unsigned). +#define IMAQdxAttributeReserveDualPackets \ + "AcquisitionAttributes::ReserveDualPackets" // Gets/sets if dual packets will + // be reserved for a very large + // FireWire packet. +#define IMAQdxAttributeReceiveTimestampMode \ + "AcquisitionAttributes::ReceiveTimestampMode" // Gets/sets the mode for + // timestamping images received + // by the driver. +#define IMAQdxAttributeActualPeakBandwidth \ + "AcquisitionAttributes::AdvancedEthernet::BandwidthControl::" \ + "ActualPeakBandwidth" // Read only. Returns the actual maximum peak bandwidth + // the camera will be configured to use. +#define IMAQdxAttributeDesiredPeakBandwidth \ + "AcquisitionAttributes::AdvancedEthernet::BandwidthControl::" \ + "DesiredPeakBandwidth" // Gets/sets the desired maximum peak bandwidth the + // camera should use. +#define IMAQdxAttributeDestinationMode \ + "AcquisitionAttributes::AdvancedEthernet::Controller::DestinationMode" // Gets/Sets + // where + // the + // camera + // is + // instructed + // to + // send + // the + // image + // stream. +#define IMAQdxAttributeDestinationMulticastAddress \ + "AcquisitionAttributes::AdvancedEthernet::Controller::" \ + "DestinationMulticastAddress" // Gets/Sets the multicast address the camera + // should send data in multicast mode. +#define IMAQdxAttributeEventsEnabled \ + "AcquisitionAttributes::AdvancedEthernet::EventParameters::EventsEnabled" // Gets/Sets if events will be handled. +#define IMAQdxAttributeMaxOutstandingEvents \ + "AcquisitionAttributes::AdvancedEthernet::EventParameters::" \ + "MaxOutstandingEvents" // Gets/Sets the maximum number of outstanding events + // to queue. +#define IMAQdxAttributeTestPacketEnabled \ + "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::" \ + "TestPacketEnabled" // Gets/Sets whether the driver will validate the image + // streaming settings using test packets prior to an + // acquisition +#define IMAQdxAttributeTestPacketTimeout \ + "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::" \ + "TestPacketTimeout" // Gets/Sets the timeout for validating test packet + // reception (if enabled) +#define IMAQdxAttributeMaxTestPacketRetries \ + "AcquisitionAttributes::AdvancedEthernet::TestPacketParameters::" \ + "MaxTestPacketRetries" // Gets/Sets the number of retries for validating test + // packet reception (if enabled) +#define IMAQdxAttributeChunkDataDecodingEnabled \ + "AcquisitionAttributes::ChunkDataDecoding::ChunkDataDecodingEnabled" // Gets/Sets + // whether + // the + // driver + // will + // decode + // any + // chunk + // data + // in + // the + // image + // stream +#define IMAQdxAttributeChunkDataDecodingMaxElementSize \ + "AcquisitionAttributes::ChunkDataDecoding::MaximumChunkCopySize" // Gets/Sets + // the + // maximum + // size of + // any + // single + // chunk + // data + // element + // that will + // be made + // available +#define IMAQdxAttributeLostPacketMode \ + "AcquisitionAttributes::AdvancedEthernet::LostPacketMode" // Gets/sets the + // behavior when + // the user + // extracts a + // buffer that has + // missing packets. +#define IMAQdxAttributeMemoryWindowSize \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "MemoryWindowSize" // Gets/sets the size of the memory window of the camera + // in kilobytes. Should match the camera's internal buffer + // size. +#define IMAQdxAttributeResendsEnabled \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::ResendsEnabled" // Gets/sets if resends will be issued for missing packets. +#define IMAQdxAttributeResendThresholdPercentage \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "ResendThresholdPercentage" // Gets/sets the threshold of the packet + // processing window that will trigger packets to + // be resent. +#define IMAQdxAttributeResendBatchingPercentage \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "ResendBatchingPercentage" // Gets/sets the percent of the packet resend + // threshold that will be issued as one group past + // the initial threshold sent in a single request. +#define IMAQdxAttributeMaxResendsPerPacket \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "MaxResendsPerPacket" // Gets/sets the maximum number of resend requests that + // will be issued for a missing packet. +#define IMAQdxAttributeResendResponseTimeout \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "ResendResponseTimeout" // Gets/sets the time to wait for a resend request to + // be satisfied before sending another. +#define IMAQdxAttributeNewPacketTimeout \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "NewPacketTimeout" // Gets/sets the time to wait for new packets to arrive in + // a partially completed image before assuming the rest of + // the image was lost. +#define IMAQdxAttributeMissingPacketTimeout \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "MissingPacketTimeout" // Gets/sets the time to wait for a missing packet + // before issuing a resend. +#define IMAQdxAttributeResendTimerResolution \ + "AcquisitionAttributes::AdvancedEthernet::ResendParameters::" \ + "ResendTimerResolution" // Gets/sets the resolution of the packet processing + // system that is used for all packet-related + // timeouts. + +//============================================================================== +// Functions +//============================================================================== +IMAQdxError NI_FUNC IMAQdxSnap(IMAQdxSession id, Image* image); +IMAQdxError NI_FUNC IMAQdxConfigureGrab(IMAQdxSession id); +IMAQdxError NI_FUNC IMAQdxGrab(IMAQdxSession id, Image* image, + bool32 waitForNextBuffer, + uInt32* actualBufferNumber); +IMAQdxError NI_FUNC +IMAQdxSequence(IMAQdxSession id, Image* images[], uInt32 count); +IMAQdxError NI_FUNC +IMAQdxDiscoverEthernetCameras(const char* address, uInt32 timeout); +IMAQdxError NI_FUNC +IMAQdxEnumerateCameras(IMAQdxCameraInformation cameraInformationArray[], + uInt32* count, bool32 connectedOnly); +IMAQdxError NI_FUNC IMAQdxResetCamera(const char* name, bool32 resetAll); +IMAQdxError NI_FUNC IMAQdxOpenCamera(const char* name, + IMAQdxCameraControlMode mode, + IMAQdxSession* id); +IMAQdxError NI_FUNC IMAQdxCloseCamera(IMAQdxSession id); +IMAQdxError NI_FUNC IMAQdxConfigureAcquisition(IMAQdxSession id, + bool32 continuous, + uInt32 bufferCount); +IMAQdxError NI_FUNC IMAQdxStartAcquisition(IMAQdxSession id); +IMAQdxError NI_FUNC +IMAQdxGetImage(IMAQdxSession id, Image* image, IMAQdxBufferNumberMode mode, + uInt32 desiredBufferNumber, uInt32* actualBufferNumber); +IMAQdxError NI_FUNC +IMAQdxGetImageData(IMAQdxSession id, void* buffer, uInt32 bufferSize, + IMAQdxBufferNumberMode mode, uInt32 desiredBufferNumber, + uInt32* actualBufferNumber); +IMAQdxError NI_FUNC IMAQdxStopAcquisition(IMAQdxSession id); +IMAQdxError NI_FUNC IMAQdxUnconfigureAcquisition(IMAQdxSession id); +IMAQdxError NI_FUNC +IMAQdxEnumerateVideoModes(IMAQdxSession id, IMAQdxVideoMode videoModeArray[], + uInt32* count, uInt32* currentMode); +IMAQdxError NI_FUNC IMAQdxEnumerateAttributes( + IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], + uInt32* count, const char* root); +IMAQdxError NI_FUNC IMAQdxGetAttribute(IMAQdxSession id, const char* name, + IMAQdxValueType type, void* value); +IMAQdxError NI_FUNCC IMAQdxSetAttribute(IMAQdxSession id, const char* name, + IMAQdxValueType type, ...); +IMAQdxError NI_FUNC +IMAQdxGetAttributeMinimum(IMAQdxSession id, const char* name, + IMAQdxValueType type, void* value); +IMAQdxError NI_FUNC +IMAQdxGetAttributeMaximum(IMAQdxSession id, const char* name, + IMAQdxValueType type, void* value); +IMAQdxError NI_FUNC +IMAQdxGetAttributeIncrement(IMAQdxSession id, const char* name, + IMAQdxValueType type, void* value); +IMAQdxError NI_FUNC IMAQdxGetAttributeType(IMAQdxSession id, const char* name, + IMAQdxAttributeType* type); +IMAQdxError NI_FUNC +IMAQdxIsAttributeReadable(IMAQdxSession id, const char* name, bool32* readable); +IMAQdxError NI_FUNC +IMAQdxIsAttributeWritable(IMAQdxSession id, const char* name, bool32* writable); +IMAQdxError NI_FUNC +IMAQdxEnumerateAttributeValues(IMAQdxSession id, const char* name, + IMAQdxEnumItem list[], uInt32* size); +IMAQdxError NI_FUNC IMAQdxGetAttributeTooltip(IMAQdxSession id, + const char* name, char* tooltip, + uInt32 length); +IMAQdxError NI_FUNC IMAQdxGetAttributeUnits(IMAQdxSession id, const char* name, + char* units, uInt32 length); +IMAQdxError NI_FUNC +IMAQdxRegisterFrameDoneEvent(IMAQdxSession id, uInt32 bufferInterval, + FrameDoneEventCallbackPtr callbackFunction, + void* callbackData); +IMAQdxError NI_FUNC IMAQdxRegisterPnpEvent(IMAQdxSession id, + IMAQdxPnpEvent event, + PnpEventCallbackPtr callbackFunction, + void* callbackData); +IMAQdxError NI_FUNC +IMAQdxWriteRegister(IMAQdxSession id, uInt32 offset, uInt32 value); +IMAQdxError NI_FUNC +IMAQdxReadRegister(IMAQdxSession id, uInt32 offset, uInt32* value); +IMAQdxError NI_FUNC IMAQdxWriteMemory(IMAQdxSession id, uInt32 offset, + const char* values, uInt32 count); +IMAQdxError NI_FUNC +IMAQdxReadMemory(IMAQdxSession id, uInt32 offset, char* values, uInt32 count); +IMAQdxError NI_FUNC +IMAQdxGetErrorString(IMAQdxError error, char* message, uInt32 messageLength); +IMAQdxError NI_FUNC +IMAQdxWriteAttributes(IMAQdxSession id, const char* filename); +IMAQdxError NI_FUNC +IMAQdxReadAttributes(IMAQdxSession id, const char* filename); +IMAQdxError NI_FUNC +IMAQdxResetEthernetCameraAddress(const char* name, const char* address, + const char* subnet, const char* gateway, + uInt32 timeout); +IMAQdxError NI_FUNC IMAQdxEnumerateAttributes2( + IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], + uInt32* count, const char* root, IMAQdxAttributeVisibility visibility); +IMAQdxError NI_FUNC +IMAQdxGetAttributeVisibility(IMAQdxSession id, const char* name, + IMAQdxAttributeVisibility* visibility); +IMAQdxError NI_FUNC +IMAQdxGetAttributeDescription(IMAQdxSession id, const char* name, + char* description, uInt32 length); +IMAQdxError NI_FUNC +IMAQdxGetAttributeDisplayName(IMAQdxSession id, const char* name, + char* displayName, uInt32 length); +IMAQdxError NI_FUNC IMAQdxDispose(void* buffer); +IMAQdxError NI_FUNC IMAQdxRegisterAttributeUpdatedEvent( + IMAQdxSession id, const char* name, + AttributeUpdatedEventCallbackPtr callbackFunction, void* callbackData); +IMAQdxError NI_FUNC IMAQdxEnumerateAttributes3( + IMAQdxSession id, IMAQdxAttributeInformation attributeInformationArray[], + uInt32* count, const char* root, IMAQdxAttributeVisibility visibility); + +#ifdef __cplusplus +} +#endif + +#endif // ___niimaqdx_h___ diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/AICalibration.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/AICalibration.h new file mode 100644 index 0000000..c4a8f75 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/AICalibration.h @@ -0,0 +1,20 @@ + +#ifndef __AICalibration_h__ +#define __AICalibration_h__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight( + const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); +int32_t FRC_NetworkCommunication_nAICalibration_getOffset( + const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __AICalibration_h__ diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANInterfacePlugin.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANInterfacePlugin.h new file mode 100644 index 0000000..1875980 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANInterfacePlugin.h @@ -0,0 +1,109 @@ +// CANInterfacePlugin.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANInterfacePlugin_h__ +#define __CANInterfacePlugin_h__ + +#include + +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_IS_FRAME_11BIT 0x40000000 +#define CAN_29BIT_MESSAGE_ID_MASK 0x1FFFFFFF +#define CAN_11BIT_MESSAGE_ID_MASK 0x000007FF + +class CANInterfacePlugin { + public: + CANInterfacePlugin() {} + virtual ~CANInterfacePlugin() {} + + /** + * This entry-point of the CANInterfacePlugin is passed a message that the + * driver needs to send to + * a device on the CAN bus. + * + * This function may be called from multiple contexts and must therefore be + * reentrant. + * + * @param messageID The 29-bit CAN message ID in the lsbs. The msb can + * indicate a remote frame. + * @param data A pointer to a buffer containing between 0 and 8 bytes to send + * with the message. May be nullptr if dataSize is 0. + * @param dataSize The number of bytes to send with the message. + * @return Return any error code. On success return 0. + */ + virtual int32_t sendMessage(uint32_t messageID, const uint8_t *data, + uint8_t dataSize) = 0; + + /** + * This entry-point of the CANInterfacePlugin is passed buffers which should + * be populated with + * any received messages from devices on the CAN bus. + * + * This function is always called by a single task in the Jaguar driver, so it + * need not be reentrant. + * + * This function is expected to block for some period of time waiting for a + * message from the CAN bus. + * It may timeout periodically (returning non-zero to indicate no message was + * populated) to allow for + * shutdown and unloading of the plugin. + * + * @param messageID A reference to be populated with a received 29-bit CAN + * message ID in the lsbs. + * @param data A pointer to a buffer of 8 bytes to be populated with data + * received with the message. + * @param dataSize A reference to be populated with the size of the data + * received (0 - 8 bytes). + * @return This should return 0 if a message was populated, non-0 if no + * message was not populated. + */ + virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, + uint8_t &dataSize) = 0; + +#if defined(__linux) + /** + * This entry-point of the CANInterfacePlugin returns status of the CAN bus. + * + * This function may be called from multiple contexts and must therefore be + * reentrant. + * + * This function will return detailed hardware status if available for + * diagnostics of the CAN interface. + * + * @param busOffCount The number of times that sendMessage failed with a + * busOff error indicating that messages + * are not successfully transmitted on the bus. + * @param txFullCount The number of times that sendMessage failed with a + * txFifoFull error indicating that messages + * are not successfully received by any CAN device. + * @param receiveErrorCount The count of receive errors as reported by the CAN + * driver. + * @param transmitErrorCount The count of transmit errors as reported by the + * CAN driver. + * @return This should return 0 if all status was retrieved successfully or an + * error code if not. + */ + virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, + uint32_t &receiveErrorCount, + uint32_t &transmitErrorCount) { + return 0; + } +#endif +}; + +/** + * This function allows you to register a CANInterfacePlugin to provide access a + * CAN bus. + * + * @param interface A pointer to an object that inherits from CANInterfacePlugin + * and implements + * the pure virtual interface. If nullptr, unregister the current plugin. + */ +void FRC_NetworkCommunication_CANSessionMux_registerInterface( + CANInterfacePlugin *interface); + +#endif // __CANInterfacePlugin_h__ diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANSessionMux.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANSessionMux.h new file mode 100644 index 0000000..9cd9a3f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/CANSessionMux.h @@ -0,0 +1,81 @@ +// CANSessionMux.h +// +// Defines the API for building a CAN Interface Plugin to support +// PWM-cable-free CAN motor control on FRC robots. This allows you +// to connect any CAN interface to the secure Jaguar CAN driver. +// + +#ifndef __CANSessionMux_h__ +#define __CANSessionMux_h__ + +#include + +#define CAN_SEND_PERIOD_NO_REPEAT 0 +#define CAN_SEND_PERIOD_STOP_REPEATING -1 + +/* Flags in the upper bits of the messageID */ +#define CAN_IS_FRAME_REMOTE 0x80000000 +#define CAN_IS_FRAME_11BIT 0x40000000 + +#define ERR_CANSessionMux_InvalidBuffer -44086 +#define ERR_CANSessionMux_MessageNotFound -44087 +#define WARN_CANSessionMux_NoToken 44087 +#define ERR_CANSessionMux_NotAllowed -44088 +#define ERR_CANSessionMux_NotInitialized -44089 +#define ERR_CANSessionMux_SessionOverrun 44050 + +struct tCANStreamMessage { + uint32_t messageID; + uint32_t timeStamp; + uint8_t data[8]; + uint8_t dataSize; +}; + +namespace nCANSessionMux { +void sendMessage_wrapper(uint32_t messageID, const uint8_t *data, + uint8_t dataSize, int32_t periodMs, int32_t *status); +void receiveMessage_wrapper(uint32_t *messageID, uint32_t messageIDMask, + uint8_t *data, uint8_t *dataSize, + uint32_t *timeStamp, int32_t *status); +void openStreamSession(uint32_t *sessionHandle, uint32_t messageID, + uint32_t messageIDMask, uint32_t maxMessages, + int32_t *status); +void closeStreamSession(uint32_t sessionHandle); +void readStreamSession(uint32_t sessionHandle, + struct tCANStreamMessage *messages, + uint32_t messagesToRead, uint32_t *messagesRead, + int32_t *status); +void getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, + uint32_t *txFullCount, uint32_t *receiveErrorCount, + uint32_t *transmitErrorCount, int32_t *status); +} + +#ifdef __cplusplus +extern "C" { +#endif + +void FRC_NetworkCommunication_CANSessionMux_sendMessage(uint32_t messageID, + const uint8_t *data, + uint8_t dataSize, + int32_t periodMs, + int32_t *status); +void FRC_NetworkCommunication_CANSessionMux_receiveMessage( + uint32_t *messageID, uint32_t messageIDMask, uint8_t *data, + uint8_t *dataSize, uint32_t *timeStamp, int32_t *status); +void FRC_NetworkCommunication_CANSessionMux_openStreamSession( + uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, + uint32_t maxMessages, int32_t *status); +void FRC_NetworkCommunication_CANSessionMux_closeStreamSession( + uint32_t sessionHandle); +void FRC_NetworkCommunication_CANSessionMux_readStreamSession( + uint32_t sessionHandle, struct tCANStreamMessage *messages, + uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status); +void FRC_NetworkCommunication_CANSessionMux_getCANStatus( + float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, + uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status); + +#ifdef __cplusplus +} +#endif + +#endif // __CANSessionMux_h__ diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/FRCComm.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/FRCComm.h new file mode 100644 index 0000000..588c8ca --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/FRCComm.h @@ -0,0 +1,130 @@ +/************************************************************* + * NOTICE + * + * These are the only externally exposed functions to the + * NetworkCommunication library + * + * This is an implementation of FRC Spec for Comm Protocol + * Revision 4.5, June 30, 2008 + * + * Copyright (c) National Instruments 2008. All Rights Reserved. + * + *************************************************************/ + +#ifndef __FRC_COMM_H__ +#define __FRC_COMM_H__ + +#ifdef SIMULATION +#include +#ifdef USE_THRIFT +#define EXPORT_FUNC +#else +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#endif +#else +#include +#include +#define EXPORT_FUNC +#endif + +#define ERR_FRCSystem_NetCommNotResponding -44049 +#define ERR_FRCSystem_NoDSConnection -44018 + +enum AllianceStationID_t { + kAllianceStationID_red1, + kAllianceStationID_red2, + kAllianceStationID_red3, + kAllianceStationID_blue1, + kAllianceStationID_blue2, + kAllianceStationID_blue3, +}; + +enum MatchType_t { + kMatchType_none, + kMatchType_practice, + kMatchType_qualification, + kMatchType_elimination, +}; + +struct ControlWord_t { + uint32_t enabled : 1; + uint32_t autonomous : 1; + uint32_t test : 1; + uint32_t eStop : 1; + uint32_t fmsAttached : 1; + uint32_t dsAttached : 1; + uint32_t control_reserved : 26; +}; + +struct JoystickAxes_t { + uint16_t count; + int16_t axes[1]; +}; + +struct JoystickPOV_t { + uint16_t count; + int16_t povs[1]; +}; + +#ifdef __cplusplus +extern "C" { +#endif +int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance); +#ifndef SIMULATION +void EXPORT_FUNC +getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision); +#endif +int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, + uint8_t updateNumber, const char *userDataHigh, + int userDataHighLength, const char *userDataLow, + int userDataLowLength, int wait_ms); +int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms); + +#ifdef SIMULATION +void EXPORT_FUNC setNewDataSem(HANDLE); +#else +void EXPORT_FUNC setNewDataSem(pthread_cond_t *); +#endif + +// this uint32_t is really a LVRefNum +int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum); + +int EXPORT_FUNC +FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord); +int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation( + enum AllianceStationID_t *allianceStation); +int EXPORT_FUNC FRC_NetworkCommunication_getMatchTime(float *matchTime); +int EXPORT_FUNC +FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, + struct JoystickAxes_t *axes, + uint8_t maxAxes); +int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, + uint32_t *buttons, + uint8_t *count); +int EXPORT_FUNC +FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, + struct JoystickPOV_t *povs, + uint8_t maxPOVs); +int EXPORT_FUNC +FRC_NetworkCommunication_setJoystickOutputs(uint8_t joystickNum, + uint32_t hidOutputs, + uint16_t leftRumble, + uint16_t rightRumble); +int EXPORT_FUNC +FRC_NetworkCommunication_getJoystickDesc(uint8_t joystickNum, uint8_t *isXBox, + uint8_t *type, char *name, + uint8_t *axisCount, uint8_t *axisTypes, + uint8_t *buttonCount, + uint8_t *povCount); + +void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version); +int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void); +void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void); +void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void); +void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void); +void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/LoadOut.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/LoadOut.h new file mode 100644 index 0000000..5a11749 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/LoadOut.h @@ -0,0 +1,57 @@ + +#ifndef __LoadOut_h__ +#define __LoadOut_h__ + +#ifdef SIMULATION +#include +#define EXPORT_FUNC __declspec(dllexport) __cdecl +#else +#include +#define EXPORT_FUNC +#endif + +#define kMaxModuleNumber 2 +namespace nLoadOut { +#if defined(SIMULATION) +typedef enum { + kModuleType_Unknown = 0x00, + kModuleType_Analog = 0x01, + kModuleType_Digital = 0x02, + kModuleType_Solenoid = 0x03, +} tModuleType; +bool EXPORT_FUNC +getModulePresence(tModuleType moduleType, uint8_t moduleNumber); +#endif +typedef enum { + kTargetClass_Unknown = 0x00, + kTargetClass_FRC1 = 0x10, + kTargetClass_FRC2 = 0x20, + kTargetClass_FRC3 = 0x30, + kTargetClass_RoboRIO = 0x40, +#if defined(SIMULATION) + kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog, + kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital, + kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid, +#endif + kTargetClass_FamilyMask = 0xF0, + kTargetClass_ModuleMask = 0x0F, +} tTargetClass; +tTargetClass EXPORT_FUNC getTargetClass(); +} + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(SIMULATION) +uint32_t EXPORT_FUNC +FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, + uint8_t moduleNumber); +#endif +uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass(); + +#ifdef __cplusplus +} +#endif + +#endif // __LoadOut_h__ diff --git a/Robot2016/wpilib/cpp/current/include/NetworkCommunication/symModuleLink.h b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/symModuleLink.h new file mode 100644 index 0000000..621cbb6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/NetworkCommunication/symModuleLink.h @@ -0,0 +1,19 @@ +#ifndef __SYM_MODULE_LINK_H__ +#define __SYM_MODULE_LINK_H__ + +#include "HAL/HAL.hpp" + +#ifdef __cplusplus +extern "C" { +#endif + +extern STATUS moduleNameFindBySymbolName( + const char* symbol, /* symbol name to look for */ + char* module /* where to return module name */ + ); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Notifier.h b/Robot2016/wpilib/cpp/current/include/Notifier.h new file mode 100644 index 0000000..070853f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Notifier.h @@ -0,0 +1,57 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +#include "ErrorBase.h" +#include "HAL/cpp/priority_mutex.h" + +typedef std::function TimerEventHandler; + +class Notifier : public ErrorBase { + public: + explicit Notifier(TimerEventHandler handler); + + template + Notifier(Callable&& f, Arg&& arg, Args&&... args) + : Notifier(std::bind(std::forward(f), + std::forward(arg), + std::forward(args)...)) {} + + virtual ~Notifier(); + + Notifier(const Notifier&) = delete; + Notifier& operator=(const Notifier&) = delete; + + void StartSingle(double delay); + void StartPeriodic(double period); + void Stop(); + + private: + // update the HAL alarm + void UpdateAlarm(); + // HAL callback + static void Notify(uint64_t currentTimeInt, void *param); + + // held while updating process information + priority_mutex m_processMutex; + // HAL handle + void *m_notifier; + // address of the handler + TimerEventHandler m_handler; + // the absolute expiration time + double m_expirationTime = 0; + // the relative time (either periodic or single) + double m_period = 0; + // true if this is a periodic event + bool m_periodic = false; + + // held by interrupt manager task while handler call is in progress + priority_mutex m_handlerMutex; +}; diff --git a/Robot2016/wpilib/cpp/current/include/PIDController.h b/Robot2016/wpilib/cpp/current/include/PIDController.h new file mode 100644 index 0000000..5e74389 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PIDController.h @@ -0,0 +1,137 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" +#include "Controller.h" +#include "LiveWindow/LiveWindow.h" +#include "PIDInterface.h" +#include "PIDSource.h" +#include "Notifier.h" +#include "HAL/cpp/priority_mutex.h" +#include "Timer.h" + +#include + +#include +#include + +class PIDOutput; + +/** + * Class implements a PID Control Loop. + * + * Creates a separate thread which reads the given PIDSource and takes + * care of the integral calculations, as well as writing the given + * PIDOutput + */ +class PIDController : public LiveWindowSendable, + public PIDInterface, + public ITableListener { + public: + PIDController(float p, float i, float d, PIDSource *source, PIDOutput *output, + float period = 0.05); + PIDController(float p, float i, float d, float f, PIDSource *source, + PIDOutput *output, float period = 0.05); + virtual ~PIDController(); + + PIDController(const PIDController&) = delete; + PIDController& operator=(const PIDController) = delete; + + virtual float Get() const; + virtual void SetContinuous(bool continuous = true); + virtual void SetInputRange(float minimumInput, float maximumInput); + virtual void SetOutputRange(float minimumOutput, float maximumOutput); + virtual void SetPID(double p, double i, double d) override; + virtual void SetPID(double p, double i, double d, double f); + virtual double GetP() const override; + virtual double GetI() const override; + virtual double GetD() const override; + virtual double GetF() const; + + virtual void SetSetpoint(float setpoint) override; + virtual double GetSetpoint() const override; + double GetDeltaSetpoint() const; + + virtual float GetError() const; + virtual float GetAvgError() const; + + virtual void SetPIDSourceType(PIDSourceType pidSource); + virtual PIDSourceType GetPIDSourceType() const; + + virtual void SetTolerance(float percent); + virtual void SetAbsoluteTolerance(float absValue); + virtual void SetPercentTolerance(float percentValue); + virtual void SetToleranceBuffer(unsigned buf = 1); + virtual bool OnTarget() const; + + virtual void Enable() override; + virtual void Disable() override; + virtual bool IsEnabled() const override; + + virtual void Reset() override; + + virtual void InitTable(std::shared_ptr table) override; + + protected: + PIDSource *m_pidInput; + PIDOutput *m_pidOutput; + + std::shared_ptr m_table; + virtual void Calculate(); + virtual double CalculateFeedForward(); + + private: + float m_P; // factor for "proportional" control + float m_I; // factor for "integral" control + float m_D; // factor for "derivative" control + float m_F; // factor for "feed forward" control + float m_maximumOutput = 1.0; // |maximum output| + float m_minimumOutput = -1.0; // |minimum output| + float m_maximumInput = 0; // maximum input - limit setpoint to this + float m_minimumInput = 0; // minimum input - limit setpoint to this + bool m_continuous = false; // do the endpoints wrap around? eg. Absolute encoder + bool m_enabled = false; // is the pid controller enabled + float m_prevError = 0; // the prior error (used to compute velocity) + double m_totalError = 0; // the sum of the errors for use in the integral calc + enum { + kAbsoluteTolerance, + kPercentTolerance, + kNoTolerance + } m_toleranceType = kNoTolerance; + + // the percetage or absolute error that is considered on target. + float m_tolerance = 0.05; + float m_setpoint = 0; + float m_prevSetpoint = 0; + float m_error = 0; + float m_result = 0; + float m_period; + + // Length of buffer for averaging for tolerances. + std::atomic m_bufLength{1}; + std::queue m_buf; + double m_bufTotal = 0; + + mutable priority_recursive_mutex m_mutex; + + std::unique_ptr m_controlLoop; + Timer m_setpointTimer; + + void Initialize(float p, float i, float d, float f, PIDSource *source, + PIDOutput *output, float period = 0.05); + + virtual std::shared_ptr GetTable() const override; + virtual std::string GetSmartDashboardType() const override; + virtual void ValueChanged(ITable *source, llvm::StringRef key, + std::shared_ptr value, + bool isNew) override; + virtual void UpdateTable() override; + virtual void StartLiveWindowMode() override; + virtual void StopLiveWindowMode() override; +}; diff --git a/Robot2016/wpilib/cpp/current/include/PIDInterface.h b/Robot2016/wpilib/cpp/current/include/PIDInterface.h new file mode 100644 index 0000000..efcc184 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PIDInterface.h @@ -0,0 +1,28 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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 "Base.h" +#include "Controller.h" +#include "LiveWindow/LiveWindow.h" + +class PIDInterface : public Controller { + virtual void SetPID(double p, double i, double d) = 0; + virtual double GetP() const = 0; + virtual double GetI() const = 0; + virtual double GetD() const = 0; + + virtual void SetSetpoint(float setpoint) = 0; + virtual double GetSetpoint() const = 0; + + virtual void Enable() = 0; + virtual void Disable() = 0; + virtual bool IsEnabled() const = 0; + + virtual void Reset() = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/PIDOutput.h b/Robot2016/wpilib/cpp/current/include/PIDOutput.h new file mode 100644 index 0000000..ad720dc --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PIDOutput.h @@ -0,0 +1,21 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" + +/** + * PIDOutput interface is a generic output for the PID class. + * PWMs use this class. + * Users implement this interface to allow for a PIDController to + * read directly from the inputs + */ +class PIDOutput { + public: + virtual void PIDWrite(float output) = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/PIDSource.h b/Robot2016/wpilib/cpp/current/include/PIDSource.h new file mode 100644 index 0000000..1a2be9c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PIDSource.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +enum class PIDSourceType { kDisplacement, kRate }; + +/** + * PIDSource interface is a generic sensor source for the PID class. + * All sensors that can be used with the PID class will implement the PIDSource + * that + * returns a standard value that will be used in the PID code. + */ +class PIDSource { + public: + virtual void SetPIDSourceType(PIDSourceType pidSource); + PIDSourceType GetPIDSourceType() const; + virtual double PIDGet() = 0; + + protected: + PIDSourceType m_pidSource = PIDSourceType::kDisplacement; +}; diff --git a/Robot2016/wpilib/cpp/current/include/PWM.h b/Robot2016/wpilib/cpp/current/include/PWM.h new file mode 100644 index 0000000..8f9976a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PWM.h @@ -0,0 +1,134 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SensorBase.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITableListener.h" + +#include + +/** + * Class implements the PWM generation in the FPGA. + * + * The values supplied as arguments for PWM outputs range from -1.0 to 1.0. They + * are mapped + * to the hardware dependent values, in this case 0-2000 for the FPGA. + * Changes are immediately sent to the FPGA, and the update occurs at the next + * FPGA cycle. There is no delay. + * + * As of revision 0.1.10 of the FPGA, the FPGA interprets the 0-2000 values as + * follows: + * - 2000 = maximum pulse width + * - 1999 to 1001 = linear scaling from "full forward" to "center" + * - 1000 = center value + * - 999 to 2 = linear scaling from "center" to "full reverse" + * - 1 = minimum pulse width (currently .5ms) + * - 0 = disabled (i.e. PWM output is held low) + */ +class PWM : public SensorBase, + public ITableListener, + public LiveWindowSendable { + public: + enum PeriodMultiplier { + kPeriodMultiplier_1X = 1, + kPeriodMultiplier_2X = 2, + kPeriodMultiplier_4X = 4 + }; + + explicit PWM(uint32_t channel); + virtual ~PWM(); + virtual void SetRaw(unsigned short value); + virtual unsigned short GetRaw() const; + void SetPeriodMultiplier(PeriodMultiplier mult); + void SetZeroLatch(); + void EnableDeadbandElimination(bool eliminateDeadband); + void SetBounds(int32_t max, int32_t deadbandMax, int32_t center, + int32_t deadbandMin, int32_t min); + void SetBounds(double max, double deadbandMax, double center, + double deadbandMin, double min); + uint32_t GetChannel() const { return m_channel; } + + protected: + /** + * kDefaultPwmPeriod is in ms + * + * - 20ms periods (50 Hz) are the "safest" setting in that this works for all + * devices + * - 20ms periods seem to be desirable for Vex Motors + * - 20ms periods are the specified period for HS-322HD servos, but work + * reliably down + * to 10.0 ms; starting at about 8.5ms, the servo sometimes hums and get + *hot; + * by 5.0ms the hum is nearly continuous + * - 10ms periods work well for Victor 884 + * - 5ms periods allows higher update rates for Luminary Micro Jaguar speed + * controllers. + * Due to the shipping firmware on the Jaguar, we can't run the update + * period less + * than 5.05 ms. + * + * kDefaultPwmPeriod is the 1x period (5.05 ms). In hardware, the period + * scaling is implemented as an + * output squelch to get longer periods for old devices. + */ + static constexpr float kDefaultPwmPeriod = 5.05; + /** + * kDefaultPwmCenter is the PWM range center in ms + */ + static constexpr float kDefaultPwmCenter = 1.5; + /** + * kDefaultPWMStepsDown is the number of PWM steps below the centerpoint + */ + static const int32_t kDefaultPwmStepsDown = 1000; + static const int32_t kPwmDisabled = 0; + + virtual void SetPosition(float pos); + virtual float GetPosition() const; + virtual void SetSpeed(float speed); + virtual float GetSpeed() const; + + bool m_eliminateDeadband; + int32_t m_maxPwm; + int32_t m_deadbandMaxPwm; + int32_t m_centerPwm; + int32_t m_deadbandMinPwm; + int32_t m_minPwm; + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + std::shared_ptr m_table; + + private: + uint32_t m_channel; + int32_t GetMaxPositivePwm() const { return m_maxPwm; } + int32_t GetMinPositivePwm() const { + return m_eliminateDeadband ? m_deadbandMaxPwm : m_centerPwm + 1; + } + int32_t GetCenterPwm() const { return m_centerPwm; } + int32_t GetMaxNegativePwm() const { + return m_eliminateDeadband ? m_deadbandMinPwm : m_centerPwm - 1; + } + int32_t GetMinNegativePwm() const { return m_minPwm; } + int32_t GetPositiveScaleFactor() const { + return GetMaxPositivePwm() - GetMinPositivePwm(); + } ///< The scale for positive speeds. + int32_t GetNegativeScaleFactor() const { + return GetMaxNegativePwm() - GetMinNegativePwm(); + } ///< The scale for negative speeds. + int32_t GetFullRangeScaleFactor() const { + return GetMaxPositivePwm() - GetMinNegativePwm(); + } ///< The scale for positions. +}; diff --git a/Robot2016/wpilib/cpp/current/include/PowerDistributionPanel.h b/Robot2016/wpilib/cpp/current/include/PowerDistributionPanel.h new file mode 100644 index 0000000..b9769ec --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/PowerDistributionPanel.h @@ -0,0 +1,48 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 +#ifndef __WPILIB_POWER_DISTRIBUTION_PANEL_H__ +#define __WPILIB_POWER_DISTRIBUTION_PANEL_H__ + +#include "SensorBase.h" +#include "LiveWindow/LiveWindowSendable.h" + +#include + +/** + * Class for getting voltage, current, temperature, power and energy from the + * CAN PDP. + * @author Thomas Clark + */ +class PowerDistributionPanel : public SensorBase, public LiveWindowSendable { + public: + PowerDistributionPanel(); + PowerDistributionPanel(uint8_t module); + + double GetVoltage() const; + double GetTemperature() const; + double GetCurrent(uint8_t channel) const; + double GetTotalCurrent() const; + double GetTotalPower() const; + double GetTotalEnergy() const; + void ResetTotalEnergy(); + void ClearStickyFaults(); + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + private: + std::shared_ptr m_table; + uint8_t m_module; +}; + +#endif /* __WPILIB_POWER_DISTRIBUTION_PANEL_H__ */ diff --git a/Robot2016/wpilib/cpp/current/include/Preferences.h b/Robot2016/wpilib/cpp/current/include/Preferences.h new file mode 100644 index 0000000..1e1beff --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Preferences.h @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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 "ErrorBase.h" +#include "Task.h" +#include +#include +#include +#include "HAL/cpp/Semaphore.hpp" +#include "tables/ITableListener.h" +#include "networktables/NetworkTable.h" + +/** + * The preferences class provides a relatively simple way to save important + * values to + * the RoboRIO to access the next time the RoboRIO is booted. + * + *

This class loads and saves from a file + * inside the RoboRIO. The user can not access the file directly, but may + * modify values at specific + * fields which will then be automatically periodically saved to the file + * by the NetworkTable server.

+ * + *

This class is thread safe.

+ * + *

This will also interact with {@link NetworkTable} by creating a table + * called "Preferences" with all the key-value pairs.

+ */ +class Preferences : public ErrorBase { + public: + static Preferences *GetInstance(); + + std::vector GetKeys(); + std::string GetString(llvm::StringRef key, llvm::StringRef defaultValue = ""); + int GetInt(llvm::StringRef key, int defaultValue = 0); + double GetDouble(llvm::StringRef key, double defaultValue = 0.0); + float GetFloat(llvm::StringRef key, float defaultValue = 0.0); + bool GetBoolean(llvm::StringRef key, bool defaultValue = false); + int64_t GetLong(llvm::StringRef key, int64_t defaultValue = 0); + void PutString(llvm::StringRef key, llvm::StringRef value); + void PutInt(llvm::StringRef key, int value); + void PutDouble(llvm::StringRef key, double value); + void PutFloat(llvm::StringRef key, float value); + void PutBoolean(llvm::StringRef key, bool value); + void PutLong(llvm::StringRef key, int64_t value); + DEPRECATED( + "Saving is now automatically performed by the NetworkTables server.") + void Save(); + bool ContainsKey(llvm::StringRef key); + void Remove(llvm::StringRef key); + + protected: + Preferences(); + virtual ~Preferences() = default; + + private: + std::shared_ptr m_table; + class Listener : public ITableListener { + public: + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void ValueChangedEx(ITable* source, llvm::StringRef key, + std::shared_ptr value, + unsigned int flags) override; + }; + Listener m_listener; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Relay.h b/Robot2016/wpilib/cpp/current/include/Relay.h new file mode 100644 index 0000000..a9bd26a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Relay.h @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "MotorSafety.h" +#include "SensorBase.h" +#include "tables/ITableListener.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITable.h" + +#include + +class MotorSafetyHelper; + +/** + * Class for Spike style relay outputs. + * Relays are intended to be connected to spikes or similar relays. The relay + * channels controls + * a pair of pins that are either both off, one on, the other on, or both on. + * This translates into + * two spike outputs at 0v, one at 12v and one at 0v, one at 0v and the other at + * 12v, or two + * spike outputs at 12V. This allows off, full forward, or full reverse control + * of motors without + * variable speed. It also allows the two channels (forward and reverse) to be + * used independently + * for something that does not care about voltage polatiry (like a solenoid). + */ +class Relay : public MotorSafety, + public SensorBase, + public ITableListener, + public LiveWindowSendable { + public: + enum Value { kOff, kOn, kForward, kReverse }; + enum Direction { kBothDirections, kForwardOnly, kReverseOnly }; + + Relay(uint32_t channel, Direction direction = kBothDirections); + virtual ~Relay(); + + void Set(Value value); + Value Get() const; + uint32_t GetChannel() const; + + void SetExpiration(float timeout) override; + float GetExpiration() const override; + bool IsAlive() const override; + void StopMotor() override; + bool IsSafetyEnabled() const override; + void SetSafetyEnabled(bool enabled) override; + void GetDescription(std::ostringstream& desc) const override; + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + std::shared_ptr m_table; + + private: + uint32_t m_channel; + Direction m_direction; + + std::unique_ptr m_safetyHelper; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Resource.h b/Robot2016/wpilib/cpp/current/include/Resource.h new file mode 100644 index 0000000..8d26442 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Resource.h @@ -0,0 +1,44 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include +#include +#include + +#include "HAL/cpp/priority_mutex.h" + +/** + * The Resource class is a convenient way to track allocated resources. + * It tracks them as indicies in the range [0 .. elements - 1]. + * E.g. the library uses this to track hardware channel allocation. + * + * The Resource class does not allocate the hardware channels or other + * resources; it just tracks which indices were marked in use by + * Allocate and not yet freed by Free. + */ +class Resource : public ErrorBase { + public: + virtual ~Resource() = default; + + Resource(const Resource&) = delete; + Resource& operator=(const Resource&) = delete; + + static void CreateResourceObject(std::unique_ptr& r, uint32_t elements); + explicit Resource(uint32_t size); + uint32_t Allocate(const std::string &resourceDesc); + uint32_t Allocate(uint32_t index, const std::string &resourceDesc); + void Free(uint32_t index); + + private: + std::vector m_isAllocated; + priority_recursive_mutex m_allocateLock; + + static priority_recursive_mutex m_createLock; +}; diff --git a/Robot2016/wpilib/cpp/current/include/RoboRIO_FRC_ChipObject_Aliases.h b/Robot2016/wpilib/cpp/current/include/RoboRIO_FRC_ChipObject_Aliases.h new file mode 100644 index 0000000..0af4e70 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/RoboRIO_FRC_ChipObject_Aliases.h @@ -0,0 +1,9 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__ +#define __RoboRIO_FRC_ChipObject_Aliases_h__ + +#define nRoboRIO_FPGANamespace nFRC_2016_16_1_0 + +#endif // __RoboRIO_FRC_ChipObject_Aliases_h__ diff --git a/Robot2016/wpilib/cpp/current/include/RobotBase.h b/Robot2016/wpilib/cpp/current/include/RobotBase.h new file mode 100644 index 0000000..b6626b9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/RobotBase.h @@ -0,0 +1,71 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" +#include "Task.h" + +class DriverStation; + +#define START_ROBOT_CLASS(_ClassName_) \ + int main() { \ + if (!HALInitialize()) { \ + std::cerr << "FATAL ERROR: HAL could not be initialized" << std::endl; \ + return -1; \ + } \ + HALReport(HALUsageReporting::kResourceType_Language, \ + HALUsageReporting::kLanguage_CPlusPlus); \ + _ClassName_ *robot = new _ClassName_(); \ + RobotBase::robotSetup(robot); \ + return 0; \ + } + +/** + * Implement a Robot Program framework. + * The RobotBase class is intended to be subclassed by a user creating a robot + * program. + * Overridden Autonomous() and OperatorControl() methods are called at the + * appropriate time + * as the match proceeds. In the current implementation, the Autonomous code + * will run to + * completion before the OperatorControl code could start. In the future the + * Autonomous code + * might be spawned as a task, then killed at the end of the Autonomous period. + */ +class RobotBase { + friend class RobotDeleter; + + public: + static RobotBase &getInstance(); + static void setInstance(RobotBase *robot); + + bool IsEnabled() const; + bool IsDisabled() const; + bool IsAutonomous() const; + bool IsOperatorControl() const; + bool IsTest() const; + bool IsNewDataAvailable() const; + static void startRobotTask(FUNCPTR factory); + static void robotTask(FUNCPTR factory, Task *task); + virtual void StartCompetition() = 0; + + static void robotSetup(RobotBase *robot); + + protected: + RobotBase(); + virtual ~RobotBase(); + + RobotBase(const RobotBase&) = delete; + RobotBase& operator=(const RobotBase&) = delete; + + Task *m_task = nullptr; + DriverStation &m_ds; + + private: + static RobotBase *m_instance; +}; diff --git a/Robot2016/wpilib/cpp/current/include/RobotDrive.h b/Robot2016/wpilib/cpp/current/include/RobotDrive.h new file mode 100644 index 0000000..547d06a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/RobotDrive.h @@ -0,0 +1,130 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include +#include +#include +#include "HAL/HAL.hpp" +#include "MotorSafety.h" +#include "MotorSafetyHelper.h" + +class SpeedController; +class GenericHID; + +/** + * Utility class for handling Robot drive based on a definition of the motor + * configuration. + * The robot drive class handles basic driving for a robot. Currently, 2 and 4 + * motor tank and + * mecanum drive trains are supported. In the future other drive types like + * swerve might be + * implemented. Motor channel numbers are passed supplied on creation of the + * class. Those + * are used for either the Drive function (intended for hand created drive code, + * such as + * autonomous) or with the Tank/Arcade functions intended to be used for + * Operator Control + * driving. + */ +class RobotDrive : public MotorSafety, public ErrorBase { + public: + enum MotorType { + kFrontLeftMotor = 0, + kFrontRightMotor = 1, + kRearLeftMotor = 2, + kRearRightMotor = 3 + }; + + RobotDrive(uint32_t leftMotorChannel, uint32_t rightMotorChannel); + RobotDrive(uint32_t frontLeftMotorChannel, uint32_t rearLeftMotorChannel, + uint32_t frontRightMotorChannel, uint32_t rearRightMotorChannel); + RobotDrive(SpeedController *leftMotor, SpeedController *rightMotor); + RobotDrive(SpeedController &leftMotor, SpeedController &rightMotor); + RobotDrive(std::shared_ptr leftMotor, + std::shared_ptr rightMotor); + RobotDrive(SpeedController *frontLeftMotor, SpeedController *rearLeftMotor, + SpeedController *frontRightMotor, SpeedController *rearRightMotor); + RobotDrive(SpeedController &frontLeftMotor, SpeedController &rearLeftMotor, + SpeedController &frontRightMotor, SpeedController &rearRightMotor); + RobotDrive(std::shared_ptr frontLeftMotor, + std::shared_ptr rearLeftMotor, + std::shared_ptr frontRightMotor, + std::shared_ptr rearRightMotor); + virtual ~RobotDrive() = default; + + RobotDrive(const RobotDrive&) = delete; + RobotDrive& operator=(const RobotDrive&) = delete; + + void Drive(float outputMagnitude, float curve); + void TankDrive(GenericHID *leftStick, GenericHID *rightStick, + bool squaredInputs = true); + void TankDrive(GenericHID &leftStick, GenericHID &rightStick, + bool squaredInputs = true); + void TankDrive(GenericHID *leftStick, uint32_t leftAxis, + GenericHID *rightStick, uint32_t rightAxis, + bool squaredInputs = true); + void TankDrive(GenericHID &leftStick, uint32_t leftAxis, + GenericHID &rightStick, uint32_t rightAxis, + bool squaredInputs = true); + void TankDrive(float leftValue, float rightValue, bool squaredInputs = true); + void ArcadeDrive(GenericHID *stick, bool squaredInputs = true); + void ArcadeDrive(GenericHID &stick, bool squaredInputs = true); + void ArcadeDrive(GenericHID *moveStick, uint32_t moveChannel, + GenericHID *rotateStick, uint32_t rotateChannel, + bool squaredInputs = true); + void ArcadeDrive(GenericHID &moveStick, uint32_t moveChannel, + GenericHID &rotateStick, uint32_t rotateChannel, + bool squaredInputs = true); + void ArcadeDrive(float moveValue, float rotateValue, + bool squaredInputs = true); + void MecanumDrive_Cartesian(float x, float y, float rotation, + float gyroAngle = 0.0); + void MecanumDrive_Polar(float magnitude, float direction, float rotation); + void HolonomicDrive(float magnitude, float direction, float rotation); + virtual void SetLeftRightMotorOutputs(float leftOutput, float rightOutput); + void SetInvertedMotor(MotorType motor, bool isInverted); + void SetSensitivity(float sensitivity); + void SetMaxOutput(double maxOutput); + void SetCANJaguarSyncGroup(uint8_t syncGroup); + + void SetExpiration(float timeout) override; + float GetExpiration() const override; + bool IsAlive() const override; + void StopMotor() override; + bool IsSafetyEnabled() const override; + void SetSafetyEnabled(bool enabled) override; + void GetDescription(std::ostringstream& desc) const override; + + protected: + void InitRobotDrive(); + float Limit(float num); + void Normalize(double *wheelSpeeds); + void RotateVector(double &x, double &y, double angle); + + static const int32_t kMaxNumberOfMotors = 4; + float m_sensitivity = 0.5; + double m_maxOutput = 1.0; + std::shared_ptr m_frontLeftMotor; + std::shared_ptr m_frontRightMotor; + std::shared_ptr m_rearLeftMotor; + std::shared_ptr m_rearRightMotor; + std::unique_ptr m_safetyHelper; + uint8_t m_syncGroup = 0; + + private: + int32_t GetNumMotors() { + int motors = 0; + if (m_frontLeftMotor) motors++; + if (m_frontRightMotor) motors++; + if (m_rearLeftMotor) motors++; + if (m_rearRightMotor) motors++; + return motors; + } +}; diff --git a/Robot2016/wpilib/cpp/current/include/RobotState.h b/Robot2016/wpilib/cpp/current/include/RobotState.h new file mode 100644 index 0000000..ce48ca0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/RobotState.h @@ -0,0 +1,34 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +class RobotStateInterface { + public: + virtual ~RobotStateInterface() = default; + virtual bool IsDisabled() const = 0; + virtual bool IsEnabled() const = 0; + virtual bool IsOperatorControl() const = 0; + virtual bool IsAutonomous() const = 0; + virtual bool IsTest() const = 0; +}; + +class RobotState { + private: + static std::shared_ptr impl; + + public: + static void SetImplementation(RobotStateInterface& i); + static void SetImplementation(std::shared_ptr i); + static bool IsDisabled(); + static bool IsEnabled(); + static bool IsOperatorControl(); + static bool IsAutonomous(); + static bool IsTest(); +}; diff --git a/Robot2016/wpilib/cpp/current/include/SD540.h b/Robot2016/wpilib/cpp/current/include/SD540.h new file mode 100644 index 0000000..e2c98e9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SD540.h @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Mindsensors SD540 Speed Controller + */ +class SD540 : public SafePWM, public SpeedController { + public: + explicit SD540(uint32_t channel); + virtual ~SD540() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SPI.h b/Robot2016/wpilib/cpp/current/include/SPI.h new file mode 100644 index 0000000..b6d68f3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SPI.h @@ -0,0 +1,73 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "SensorBase.h" + +class DigitalOutput; +class DigitalInput; + +/** + * SPI bus interface class. + * + * This class is intended to be used by sensor (and other SPI device) drivers. + * It probably should not be used directly. + * + */ +class SPI : public SensorBase { + public: + enum Port { kOnboardCS0, kOnboardCS1, kOnboardCS2, kOnboardCS3, kMXP }; + SPI(Port SPIport); + virtual ~SPI(); + + SPI(const SPI&) = delete; + SPI& operator=(const SPI&) = delete; + + void SetClockRate(double hz); + + void SetMSBFirst(); + void SetLSBFirst(); + + void SetSampleDataOnFalling(); + void SetSampleDataOnRising(); + + void SetClockActiveLow(); + void SetClockActiveHigh(); + + void SetChipSelectActiveHigh(); + void SetChipSelectActiveLow(); + + virtual int32_t Write(uint8_t* data, uint8_t size); + virtual int32_t Read(bool initiate, uint8_t* dataReceived, uint8_t size); + virtual int32_t Transaction(uint8_t* dataToSend, uint8_t* dataReceived, + uint8_t size); + + void InitAccumulator(double period, uint32_t cmd, uint8_t xfer_size, + uint32_t valid_mask, uint32_t valid_value, + uint8_t data_shift, uint8_t data_size, bool is_signed, + bool big_endian); + void FreeAccumulator(); + void ResetAccumulator(); + void SetAccumulatorCenter(int32_t center); + void SetAccumulatorDeadband(int32_t deadband); + int32_t GetAccumulatorLastValue() const; + int64_t GetAccumulatorValue() const; + uint32_t GetAccumulatorCount() const; + double GetAccumulatorAverage() const; + void GetAccumulatorOutput(int64_t &value, uint32_t &count) const; + + protected: + uint8_t m_port; + bool m_msbFirst = false; // default little-endian + bool m_sampleOnTrailing = false; // default data updated on falling edge + bool m_clk_idle_high = false; // default clock active high + + private: + void Init(); +}; diff --git a/Robot2016/wpilib/cpp/current/include/SafePWM.h b/Robot2016/wpilib/cpp/current/include/SafePWM.h new file mode 100644 index 0000000..3c908c7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SafePWM.h @@ -0,0 +1,42 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "MotorSafety.h" +#include "PWM.h" +#include "MotorSafetyHelper.h" +#include +#include + +/** + * A safe version of the PWM class. + * It is safe because it implements the MotorSafety interface that provides + * timeouts + * in the event that the motor value is not updated before the expiration time. + * This delegates the actual work to a MotorSafetyHelper object that is used for + * all + * objects that implement MotorSafety. + */ +class SafePWM : public PWM, public MotorSafety { + public: + explicit SafePWM(uint32_t channel); + virtual ~SafePWM() = default; + + void SetExpiration(float timeout); + float GetExpiration() const; + bool IsAlive() const; + void StopMotor(); + bool IsSafetyEnabled() const; + void SetSafetyEnabled(bool enabled); + void GetDescription(std::ostringstream& desc) const; + + virtual void SetSpeed(float speed); + + private: + std::unique_ptr m_safetyHelper; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SampleRobot.h b/Robot2016/wpilib/cpp/current/include/SampleRobot.h new file mode 100644 index 0000000..61f8bc0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SampleRobot.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "RobotBase.h" + +class SampleRobot : public RobotBase { + public: + SampleRobot(); + virtual ~SampleRobot() = default; + virtual void RobotInit(); + virtual void Disabled(); + virtual void Autonomous(); + virtual void OperatorControl(); + virtual void Test(); + virtual void RobotMain(); + void StartCompetition(); + + private: + bool m_robotMainOverridden; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SensorBase.h b/Robot2016/wpilib/cpp/current/include/SensorBase.h new file mode 100644 index 0000000..51fd94c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SensorBase.h @@ -0,0 +1,61 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include +#include "Base.h" + +/** + * Base class for all sensors. + * Stores most recent status information as well as containing utility functions + * for checking + * channels and error processing. + */ +class SensorBase : public ErrorBase { + public: + SensorBase(); + virtual ~SensorBase() = default; + + SensorBase(const SensorBase&) = delete; + SensorBase& operator=(const SensorBase&) = delete; + + static void DeleteSingletons(); + + static uint32_t GetDefaultSolenoidModule() { return 0; } + + static bool CheckSolenoidModule(uint8_t moduleNumber); + static bool CheckDigitalChannel(uint32_t channel); + static bool CheckRelayChannel(uint32_t channel); + static bool CheckPWMChannel(uint32_t channel); + static bool CheckAnalogInput(uint32_t channel); + static bool CheckAnalogOutput(uint32_t channel); + static bool CheckSolenoidChannel(uint32_t channel); + static bool CheckPDPChannel(uint32_t channel); + + static const uint32_t kDigitalChannels = 26; + static const uint32_t kAnalogInputs = 8; + static const uint32_t kAnalogOutputs = 2; + static const uint32_t kSolenoidChannels = 8; + static const uint32_t kSolenoidModules = 2; + static const uint32_t kPwmChannels = 20; + static const uint32_t kRelayChannels = 8; + static const uint32_t kPDPChannels = 16; + static const uint32_t kChassisSlots = 8; + + protected: + void AddToSingletonList(); + + static void* m_digital_ports[kDigitalChannels]; + static void* m_relay_ports[kRelayChannels]; + static void* m_pwm_ports[kPwmChannels]; + + private: + static SensorBase* m_singletonList; + SensorBase* m_nextSingleton = nullptr; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SerialPort.h b/Robot2016/wpilib/cpp/current/include/SerialPort.h new file mode 100644 index 0000000..e94af87 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SerialPort.h @@ -0,0 +1,74 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include "HAL/HAL.hpp" + +/** + * 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 }; + + SerialPort(uint32_t baudRate, Port port = kOnboard, uint8_t 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(); + int32_t GetBytesReceived(); + uint32_t Read(char *buffer, int32_t count); + uint32_t Write(const std::string &buffer, int32_t count); + void SetTimeout(float timeout); + void SetReadBufferSize(uint32_t size); + void SetWriteBufferSize(uint32_t size); + void SetWriteBufferMode(WriteBufferMode mode); + void Flush(); + void Reset(); + + private: + uint32_t m_resourceManagerHandle = 0; + uint32_t m_portHandle = 0; + bool m_consoleModeEnabled = false; + uint8_t m_port; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Servo.h b/Robot2016/wpilib/cpp/current/include/Servo.h new file mode 100644 index 0000000..f33a82e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Servo.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" + +#include + +/** + * Standard hobby style servo. + * + * The range parameters default to the appropriate values for the Hitec HS-322HD + * servo provided + * in the FIRST Kit of Parts in 2008. + */ +class Servo : public SafePWM { + public: + explicit Servo(uint32_t channel); + virtual ~Servo(); + void Set(float value); + void SetOffline(); + float Get() const; + void SetAngle(float angle); + float GetAngle() const; + static float GetMaxAngle() { return kMaxServoAngle; } + static float GetMinAngle() { return kMinServoAngle; } + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew) override; + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + std::shared_ptr m_table; + + private: + float GetServoAngleRange() const { return kMaxServoAngle - kMinServoAngle; } + + static constexpr float kMaxServoAngle = 180.0; + static constexpr float kMinServoAngle = 0.0; + + static constexpr float kDefaultMaxServoPWM = 2.4; + static constexpr float kDefaultMinServoPWM = .6; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SmartDashboard/NamedSendable.h b/Robot2016/wpilib/cpp/current/include/SmartDashboard/NamedSendable.h new file mode 100644 index 0000000..0dd1b24 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SmartDashboard/NamedSendable.h @@ -0,0 +1,28 @@ +/* + * NamedSendable.h + * + * Created on: Oct 19, 2012 + * Author: Mitchell Wills + */ + +#ifndef NAMEDSENDABLE_H_ +#define NAMEDSENDABLE_H_ + +#include +#include "SmartDashboard/Sendable.h" + +/** + * The interface for sendable objects that gives the sendable a default name in + * the Smart Dashboard + * + */ +class NamedSendable : public Sendable { + public: + /** + * @return the name of the subtable of SmartDashboard that the Sendable object + * will use + */ + virtual std::string GetName() const = 0; +}; + +#endif /* NAMEDSENDABLE_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/SmartDashboard/Sendable.h b/Robot2016/wpilib/cpp/current/include/SmartDashboard/Sendable.h new file mode 100644 index 0000000..78206d0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SmartDashboard/Sendable.h @@ -0,0 +1,35 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __SMART_DASHBOARD_DATA__ +#define __SMART_DASHBOARD_DATA__ + +#include +#include +#include "tables/ITable.h" + +class Sendable { + public: + /** + * Initializes a table for this sendable object. + * @param subtable The table to put the values in. + */ + virtual void InitTable(std::shared_ptr subtable) = 0; + + /** + * @return the table that is currently associated with the sendable + */ + virtual std::shared_ptr GetTable() const = 0; + + /** + * @return the string representation of the named data type that will be used + * by the smart dashboard for this sendable + */ + virtual std::string GetSmartDashboardType() const = 0; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/SmartDashboard/SendableChooser.h b/Robot2016/wpilib/cpp/current/include/SmartDashboard/SendableChooser.h new file mode 100644 index 0000000..9560746 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SmartDashboard/SendableChooser.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __SENDABLE_CHOOSER_H__ +#define __SENDABLE_CHOOSER_H__ + +#include "SmartDashboard/Sendable.h" +#include "tables/ITable.h" +#include +#include +#include + +/** + * The {@link SendableChooser} class is a useful tool for presenting a selection + * of options + * to the {@link SmartDashboard}. + * + *

For instance, you may wish to be able to select between multiple + * autonomous modes. + * You can do this by putting every possible {@link Command} you want to run as + * an autonomous into + * a {@link SendableChooser} and then put it into the {@link SmartDashboard} to + * have a list of options + * appear on the laptop. Once autonomous starts, simply ask the {@link + * SendableChooser} what the selected + * value is.

+ * + * @see SmartDashboard + */ +class SendableChooser : public Sendable { + public: + virtual ~SendableChooser() = default; + + void AddObject(const std::string &name, void *object); + void AddDefault(const std::string &name, void *object); + void *GetSelected(); + + virtual void InitTable(std::shared_ptr subtable); + virtual std::shared_ptr GetTable() const; + virtual std::string GetSmartDashboardType() const; + + private: + std::string m_defaultChoice; + std::map m_choices; + std::shared_ptr m_table; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/SmartDashboard/SmartDashboard.h b/Robot2016/wpilib/cpp/current/include/SmartDashboard/SmartDashboard.h new file mode 100644 index 0000000..51e51d1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SmartDashboard/SmartDashboard.h @@ -0,0 +1,54 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2011-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef __SMART_DASHBOARD_H__ +#define __SMART_DASHBOARD_H__ + +#include "SensorBase.h" +#include +#include +#include "SmartDashboard/Sendable.h" +#include "SmartDashboard/NamedSendable.h" +#include "tables/ITable.h" + +class SmartDashboard : public SensorBase { + public: + static void init(); + + static void PutData(llvm::StringRef key, Sendable *data); + static void PutData(NamedSendable *value); + static Sendable *GetData(llvm::StringRef keyName); + + static void PutBoolean(llvm::StringRef keyName, bool value); + static bool GetBoolean(llvm::StringRef keyName, bool defaultValue); + + static void PutNumber(llvm::StringRef keyName, double value); + static double GetNumber(llvm::StringRef keyName, double defaultValue); + + static void PutString(llvm::StringRef keyName, llvm::StringRef value); + static std::string GetString(llvm::StringRef keyName, + llvm::StringRef defaultValue); + + static void PutValue(llvm::StringRef keyName, + std::shared_ptr value); + static std::shared_ptr GetValue(llvm::StringRef keyName); + + private: + virtual ~SmartDashboard() = default; + + /** The {@link NetworkTable} used by {@link SmartDashboard} */ + static std::shared_ptr m_table; + + /** + * A map linking tables in the SmartDashboard to the {@link + * SmartDashboardData} objects + * they came from. + */ + static std::map , Sendable *> m_tablesToData; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/Solenoid.h b/Robot2016/wpilib/cpp/current/include/Solenoid.h new file mode 100644 index 0000000..d032930 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Solenoid.h @@ -0,0 +1,46 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SolenoidBase.h" +#include "LiveWindow/LiveWindowSendable.h" +#include "tables/ITableListener.h" + +#include + +/** + * Solenoid class for running high voltage Digital Output (PCM). + * + * The Solenoid class is typically used for pneumatics solenoids, but could be + * used + * for any device within the current spec of the PCM. + */ +class Solenoid : public SolenoidBase, + public LiveWindowSendable, + public ITableListener { + public: + explicit Solenoid(uint32_t channel); + Solenoid(uint8_t moduleNumber, uint32_t channel); + virtual ~Solenoid(); + virtual void Set(bool on); + virtual bool Get() const; + bool IsBlackListed() const; + + void ValueChanged(ITable* source, llvm::StringRef key, + std::shared_ptr value, bool isNew); + void UpdateTable(); + void StartLiveWindowMode(); + void StopLiveWindowMode(); + std::string GetSmartDashboardType() const; + void InitTable(std::shared_ptr subTable); + std::shared_ptr GetTable() const; + + private: + uint32_t m_channel; ///< The channel on the module to control. + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SolenoidBase.h b/Robot2016/wpilib/cpp/current/include/SolenoidBase.h new file mode 100644 index 0000000..0a71de2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SolenoidBase.h @@ -0,0 +1,40 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Resource.h" +#include "SensorBase.h" +#include "HAL/HAL.hpp" +#include "HAL/Port.h" + +#include + +/** + * SolenoidBase class is the common base class for the Solenoid and + * DoubleSolenoid classes. + */ +class SolenoidBase : public SensorBase { + public: + virtual ~SolenoidBase() = default; + uint8_t GetAll(int module = 0) const; + + uint8_t GetPCMSolenoidBlackList(int module) const; + bool GetPCMSolenoidVoltageStickyFault(int module) const; + bool GetPCMSolenoidVoltageFault(int module) const; + void ClearAllPCMStickyFaults(int module); + + protected: + explicit SolenoidBase(uint8_t pcmID); + void Set(uint8_t value, uint8_t mask, int module); + const static int m_maxModules = 63; + const static int m_maxPorts = 8; + static void* m_ports[m_maxModules][m_maxPorts]; + uint32_t m_moduleNumber; ///< Slot number where the module is plugged into + ///the chassis. + static std::unique_ptr m_allocated; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Spark.h b/Robot2016/wpilib/cpp/current/include/Spark.h new file mode 100644 index 0000000..65d5c6a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Spark.h @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * REV Robotics Speed Controller + */ +class Spark : public SafePWM, public SpeedController { + public: + explicit Spark(uint32_t channel); + virtual ~Spark() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/SpeedController.h b/Robot2016/wpilib/cpp/current/include/SpeedController.h new file mode 100644 index 0000000..6adba5d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/SpeedController.h @@ -0,0 +1,51 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "HAL/HAL.hpp" +#include "PIDOutput.h" + +/** + * Interface for speed controlling devices. + */ +class SpeedController : public PIDOutput { + public: + virtual ~SpeedController() = default; + /** + * Common interface for setting the speed of a speed controller. + * + * @param speed The speed to set. Value should be between -1.0 and 1.0. + * @param syncGroup The update group to add this Set() to, pending + * UpdateSyncGroup(). If 0, update immediately. + */ + virtual void Set(float speed, uint8_t syncGroup = 0) = 0; + + /** + * Common interface for getting the current set speed of a speed controller. + * + * @return The current set speed. Value is between -1.0 and 1.0. + */ + virtual float Get() const = 0; + + /** + * Common interface for inverting direction of a speed controller. + * @param isInverted The state of inversion, true is inverted. + */ + virtual void SetInverted(bool isInverted) = 0; + /** + + * Common interface for disabling a motor. + */ + virtual void Disable() = 0; + + /** + * Common interface for returning the inversion state of a speed controller. + * @return isInverted The state of inversion, true is inverted. + */ + virtual bool GetInverted() const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Talon.h b/Robot2016/wpilib/cpp/current/include/Talon.h new file mode 100644 index 0000000..1908d19 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Talon.h @@ -0,0 +1,31 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller + */ +class Talon : public SafePWM, public SpeedController { + public: + explicit Talon(uint32_t channel); + virtual ~Talon() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/TalonSRX.h b/Robot2016/wpilib/cpp/current/include/TalonSRX.h new file mode 100644 index 0000000..b64324e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/TalonSRX.h @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Cross the Road Electronics (CTRE) Talon SRX Speed Controller with PWM control + * @see CANTalon for CAN control + */ +class TalonSRX : public SafePWM, public SpeedController { + public: + explicit TalonSRX(uint32_t channel); + virtual ~TalonSRX() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Task.h b/Robot2016/wpilib/cpp/current/include/Task.h new file mode 100644 index 0000000..2735f48 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Task.h @@ -0,0 +1,53 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "ErrorBase.h" +#include "HAL/Task.hpp" +#include +#include +#include + +/** + * Wrapper class around std::thread that allows changing thread priority + */ +class Task : public ErrorBase { + public: + static const uint32_t kDefaultPriority = 60; + + Task() = default; + Task(const Task&) = delete; + Task& operator=(const Task&) = delete; + Task& operator=(Task&& task); + + template + Task(const std::string& name, Function&& function, Args&&... args); + + virtual ~Task(); + + bool joinable() const noexcept; + void join(); + void detach(); + std::thread::id get_id() const noexcept; + std::thread::native_handle_type native_handle(); + + bool Verify(); + + int32_t GetPriority(); + + bool SetPriority(int32_t priority); + + std::string GetName() const; + + private: + std::thread m_thread; + std::string m_taskName; + bool HandleError(STATUS results); +}; + +#include "Task.inc" diff --git a/Robot2016/wpilib/cpp/current/include/Task.inc b/Robot2016/wpilib/cpp/current/include/Task.inc new file mode 100644 index 0000000..3c90aba --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Task.inc @@ -0,0 +1,33 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#include "HAL/HAL.hpp" +#include + +/** + * Create and launch a task. + * + * @param name The name of the task. "FRC_" will be prepended to the task name. + * @param function The address of the function to run as the new task. + * @param args A parameter pack of arguments to pass to the function. + */ +template +Task::Task(const std::string& name, Function&& function, Args&&... args) { + m_taskName = "FRC_"; + m_taskName += name; + + std::cout << "[HAL] Starting task " << m_taskName << "..." << std::endl; + + m_thread = std::thread(std::forward>(function), + std::forward(args)...); + //TODO: lvuser does not currently have permissions to set the priority. + //SetPriority(kDefaultPriority); + + static std::atomic instances{0}; + instances++; + HALReport(HALUsageReporting::kResourceType_Task, instances, 0, m_taskName.c_str()); +} diff --git a/Robot2016/wpilib/cpp/current/include/Timer.h b/Robot2016/wpilib/cpp/current/include/Timer.h new file mode 100644 index 0000000..b3fe77d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Timer.h @@ -0,0 +1,55 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "Base.h" +#include "HAL/cpp/priority_mutex.h" + +typedef void (*TimerInterruptHandler)(void *param); + +void Wait(double seconds); +double GetClock(); +double GetTime(); + +/** + * Timer objects measure accumulated time in seconds. + * The timer object functions like a stopwatch. It can be started, stopped, and + * cleared. When the + * timer is running its value counts up in seconds. When stopped, the timer + * holds the current + * value. The implementation simply records the time when started and subtracts + * the current time + * whenever the value is requested. + */ +class Timer { + public: + Timer(); + virtual ~Timer() = default; + + Timer(const Timer&) = delete; + Timer& operator=(const Timer&) = delete; + + double Get() const; + void Reset(); + void Start(); + void Stop(); + bool HasPeriodPassed(double period); + + static double GetFPGATimestamp(); + static double GetPPCTimestamp(); + static double GetMatchTime(); + + // The time, in seconds, at which the 32-bit FPGA timestamp rolls over to 0 + static const double kRolloverTime; + + private: + double m_startTime = 0.0; + double m_accumulatedTime = 0.0; + bool m_running = false; + mutable priority_mutex m_mutex; +}; diff --git a/Robot2016/wpilib/cpp/current/include/USBCamera.h b/Robot2016/wpilib/cpp/current/include/USBCamera.h new file mode 100644 index 0000000..522e889 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/USBCamera.h @@ -0,0 +1,122 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "ErrorBase.h" +#include "nivision.h" +#include "NIIMAQdx.h" +#include "HAL/cpp/priority_mutex.h" + +#include + +typedef enum whiteBalance_enum { + kFixedIndoor = 3000, + kFixedOutdoor1 = 4000, + kFixedOutdoor2 = 5000, + kFixedFluorescent1 = 5100, + kFixedFlourescent2 = 5200 +} whiteBalance; + +class USBCamera : public ErrorBase { + private: + static constexpr char const *ATTR_WB_MODE = + "CameraAttributes::WhiteBalance::Mode"; + static constexpr char const *ATTR_WB_VALUE = + "CameraAttributes::WhiteBalance::Value"; + static constexpr char const *ATTR_EX_MODE = + "CameraAttributes::Exposure::Mode"; + static constexpr char const *ATTR_EX_VALUE = + "CameraAttributes::Exposure::Value"; + static constexpr char const *ATTR_BR_MODE = + "CameraAttributes::Brightness::Mode"; + static constexpr char const *ATTR_BR_VALUE = + "CameraAttributes::Brightness::Value"; + + // Constants for the manual and auto types + static constexpr char const* AUTO = "Auto"; + static constexpr char const* MANUAL = "Manual"; + + protected: + IMAQdxSession m_id = 0; + std::string m_name; + bool m_useJpeg; + bool m_active = false; + bool m_open = false; + + priority_recursive_mutex m_mutex; + + unsigned int m_width = 320; + unsigned int m_height = 240; + double m_fps = 30; + std::string m_whiteBalance = AUTO; + unsigned int m_whiteBalanceValue = 0; + bool m_whiteBalanceValuePresent = false; + std::string m_exposure = MANUAL; + unsigned int m_exposureValue = 50; + bool m_exposureValuePresent = false; + unsigned int m_brightness = 80; + bool m_needSettingsUpdate = true; + + unsigned int GetJpegSize(void *buffer, unsigned int buffSize); + + public: + static constexpr char const *kDefaultCameraName = "cam0"; + + USBCamera(std::string name, bool useJpeg); + + void OpenCamera(); + void CloseCamera(); + void StartCapture(); + void StopCapture(); + void SetFPS(double fps); + void SetSize(unsigned int width, unsigned int height); + + void UpdateSettings(); + /** + * Set the brightness, as a percentage (0-100). + */ + void SetBrightness(unsigned int brightness); + + /** + * Get the brightness, as a percentage (0-100). + */ + unsigned int GetBrightness(); + + /** + * Set the white balance to auto + */ + void SetWhiteBalanceAuto(); + + /** + * Set the white balance to hold current + */ + void SetWhiteBalanceHoldCurrent(); + + /** + * Set the white balance to manual, with specified color temperature + */ + void SetWhiteBalanceManual(unsigned int wbValue); + + /** + * Set the exposure to auto exposure + */ + void SetExposureAuto(); + + /** + * Set the exposure to hold current + */ + void SetExposureHoldCurrent(); + + /** + * Set the exposure to manual, with a given percentage (0-100) + */ + void SetExposureManual(unsigned int expValue); + + void GetImage(Image *image); + unsigned int GetImageData(void *buffer, unsigned int bufferSize); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Ultrasonic.h b/Robot2016/wpilib/cpp/current/include/Ultrasonic.h new file mode 100644 index 0000000..d586173 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Ultrasonic.h @@ -0,0 +1,101 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SensorBase.h" +#include "Counter.h" +#include "Task.h" +#include "PIDSource.h" +#include "LiveWindow/LiveWindowSendable.h" +#include +#include +#include + +class DigitalInput; +class DigitalOutput; + +/** + * Ultrasonic rangefinder class. + * The Ultrasonic rangefinder measures absolute distance based on the round-trip + * time + * of a ping generated by the controller. These sensors use two transducers, a + * speaker and + * a microphone both tuned to the ultrasonic range. A common ultrasonic sensor, + * the Daventech SRF04 + * requires a short pulse to be generated on a digital channel. This causes the + * chirp to be + * emmitted. A second line becomes high as the ping is transmitted and goes low + * when + * the echo is received. The time that the line is high determines the round + * trip distance + * (time of flight). + */ +class Ultrasonic : public SensorBase, + public PIDSource, + public LiveWindowSendable { + public: + enum DistanceUnit { kInches = 0, kMilliMeters = 1 }; + + Ultrasonic(DigitalOutput *pingChannel, DigitalInput *echoChannel, + DistanceUnit units = kInches); + + Ultrasonic(DigitalOutput &pingChannel, DigitalInput &echoChannel, + DistanceUnit units = kInches); + + Ultrasonic(std::shared_ptr pingChannel, + std::shared_ptr echoChannel, + DistanceUnit units = kInches); + Ultrasonic(uint32_t pingChannel, uint32_t echoChannel, + DistanceUnit units = kInches); + virtual ~Ultrasonic(); + + void Ping(); + bool IsRangeValid() const; + static void SetAutomaticMode(bool enabling); + double GetRangeInches() const; + double GetRangeMM() const; + bool IsEnabled() const { return m_enabled; } + void SetEnabled(bool enable) { m_enabled = enable; } + + double PIDGet() override; + void SetPIDSourceType(PIDSourceType pidSource) override; + void SetDistanceUnits(DistanceUnit units); + DistanceUnit GetDistanceUnits() const; + + void UpdateTable() override; + void StartLiveWindowMode() override; + void StopLiveWindowMode() override; + std::string GetSmartDashboardType() const override; + void InitTable(std::shared_ptr subTable) override; + std::shared_ptr GetTable() const override; + + private: + void Initialize(); + + static void UltrasonicChecker(); + + // Time (sec) for the ping trigger pulse. + static constexpr double kPingTime = 10 * 1e-6; + // Priority that the ultrasonic round robin task runs. + static const uint32_t kPriority = 64; + // Max time (ms) between readings. + static constexpr double kMaxUltrasonicTime = 0.1; + static constexpr double kSpeedOfSoundInchesPerSec = 1130.0 * 12.0; + + static Task m_task; // task doing the round-robin automatic sensing + static std::set m_sensors; // ultrasonic sensors + static std::atomic m_automaticEnabled; // automatic round robin mode + + std::shared_ptr m_pingChannel; + std::shared_ptr m_echoChannel; + bool m_enabled = false; + Counter m_counter; + DistanceUnit m_units; + + std::shared_ptr m_table; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Utility.h b/Robot2016/wpilib/cpp/current/include/Utility.h new file mode 100644 index 0000000..89b9729 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Utility.h @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +/** @file + * Contains global utility functions + */ + +#include +#include + +#define wpi_assert(condition) \ + wpi_assert_impl(condition, #condition, "", __FILE__, __LINE__, __FUNCTION__) +#define wpi_assertWithMessage(condition, message) \ + wpi_assert_impl(condition, #condition, message, __FILE__, __LINE__, \ + __FUNCTION__) + +#define wpi_assertEqual(a, b) \ + wpi_assertEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__) +#define wpi_assertEqualWithMessage(a, b, message) \ + wpi_assertEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, __FUNCTION__) + +#define wpi_assertNotEqual(a, b) \ + wpi_assertNotEqual_impl(a, b, #a, #b, "", __FILE__, __LINE__, __FUNCTION__) +#define wpi_assertNotEqualWithMessage(a, b, message) \ + wpi_assertNotEqual_impl(a, b, #a, #b, message, __FILE__, __LINE__, \ + __FUNCTION__) + +bool wpi_assert_impl(bool conditionValue, const char *conditionText, + const char *message, const char *fileName, + uint32_t lineNumber, const char *funcName); +bool wpi_assertEqual_impl(int valueA, int valueB, const char *valueAString, + const char *valueBString, const char *message, + const char *fileName, uint32_t lineNumber, + const char *funcName); +bool wpi_assertNotEqual_impl(int valueA, int valueB, const char *valueAString, + const char *valueBString, const char *message, + const char *fileName, uint32_t lineNumber, + const char *funcName); + +void wpi_suspendOnAssertEnabled(bool enabled); + +uint16_t GetFPGAVersion(); +uint32_t GetFPGARevision(); +uint64_t GetFPGATime(); +bool GetUserButton(); +std::string GetStackTrace(uint32_t offset); diff --git a/Robot2016/wpilib/cpp/current/include/Victor.h b/Robot2016/wpilib/cpp/current/include/Victor.h new file mode 100644 index 0000000..eddc2e2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Victor.h @@ -0,0 +1,35 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Vex Robotics Victor 888 Speed Controller + * + * The Vex Robotics Victor 884 Speed Controller can also be used with this + * class but may need to be calibrated per the Victor 884 user manual. + */ +class Victor : public SafePWM, public SpeedController { + public: + explicit Victor(uint32_t channel); + virtual ~Victor() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/VictorSP.h b/Robot2016/wpilib/cpp/current/include/VictorSP.h new file mode 100644 index 0000000..e90a293 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/VictorSP.h @@ -0,0 +1,32 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "SafePWM.h" +#include "SpeedController.h" +#include "PIDOutput.h" + +/** + * Vex Robotics Victor SP Speed Controller + */ +class VictorSP : public SafePWM, public SpeedController { + public: + explicit VictorSP(uint32_t channel); + virtual ~VictorSP() = default; + virtual void Set(float value, uint8_t syncGroup = 0) override; + virtual float Get() const override; + virtual void Disable() override; + + virtual void PIDWrite(float output) override; + + virtual void SetInverted(bool isInverted) override; + virtual bool GetInverted() const override; + + private: + bool m_isInverted = false; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/AxisCamera.h b/Robot2016/wpilib/cpp/current/include/Vision/AxisCamera.h new file mode 100644 index 0000000..9252442 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/AxisCamera.h @@ -0,0 +1,123 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 +#include +#include "HAL/cpp/priority_mutex.h" + +#include "ErrorBase.h" +#include "Vision/ColorImage.h" +#include "Vision/HSLImage.h" +#include "nivision.h" + +/** + * Axis M1011 network camera + */ +class AxisCamera : public ErrorBase { + public: + enum WhiteBalance { + kWhiteBalance_Automatic, + kWhiteBalance_Hold, + kWhiteBalance_FixedOutdoor1, + kWhiteBalance_FixedOutdoor2, + kWhiteBalance_FixedIndoor, + kWhiteBalance_FixedFluorescent1, + kWhiteBalance_FixedFluorescent2 + }; + + enum ExposureControl { + kExposureControl_Automatic, + kExposureControl_Hold, + kExposureControl_FlickerFree50Hz, + kExposureControl_FlickerFree60Hz + }; + + enum Resolution { + kResolution_640x480, + kResolution_480x360, + kResolution_320x240, + kResolution_240x180, + kResolution_176x144, + kResolution_160x120, + }; + + enum Rotation { kRotation_0, kRotation_180 }; + + explicit AxisCamera(std::string const &cameraHost); + virtual ~AxisCamera(); + + AxisCamera(const AxisCamera&) = delete; + AxisCamera& operator=(const AxisCamera&) = delete; + + bool IsFreshImage() const; + + int GetImage(Image *image); + int GetImage(ColorImage *image); + HSLImage *GetImage(); + int CopyJPEG(char **destImage, unsigned int &destImageSize, + unsigned int &destImageBufferSize); + + void WriteBrightness(int brightness); + int GetBrightness(); + + void WriteWhiteBalance(WhiteBalance whiteBalance); + WhiteBalance GetWhiteBalance(); + + void WriteColorLevel(int colorLevel); + int GetColorLevel(); + + void WriteExposureControl(ExposureControl exposureControl); + ExposureControl GetExposureControl(); + + void WriteExposurePriority(int exposurePriority); + int GetExposurePriority(); + + void WriteMaxFPS(int maxFPS); + int GetMaxFPS(); + + void WriteResolution(Resolution resolution); + Resolution GetResolution(); + + void WriteCompression(int compression); + int GetCompression(); + + void WriteRotation(Rotation rotation); + Rotation GetRotation(); + + private: + std::thread m_captureThread; + std::string m_cameraHost; + int m_cameraSocket = -1; + priority_mutex m_captureMutex; + + priority_mutex m_imageDataMutex; + std::vector m_imageData; + bool m_freshImage = false; + + int m_brightness = 50; + WhiteBalance m_whiteBalance = kWhiteBalance_Automatic; + int m_colorLevel = 50; + ExposureControl m_exposureControl = kExposureControl_Automatic; + int m_exposurePriority = 50; + int m_maxFPS = 0; + Resolution m_resolution = kResolution_640x480; + int m_compression = 50; + Rotation m_rotation = kRotation_0; + bool m_parametersDirty = true; + bool m_streamDirty = true; + priority_mutex m_parametersMutex; + + bool m_done = false; + + void Capture(); + void ReadImagesFromCamera(); + bool WriteParameters(); + + int CreateCameraSocket(std::string const &requestString, bool setError); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/BaeUtilities.h b/Robot2016/wpilib/cpp/current/include/Vision/BaeUtilities.h new file mode 100644 index 0000000..5a1270b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/BaeUtilities.h @@ -0,0 +1,67 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 + +/* Constants */ +#define LOG_DEBUG __FILE__, __FUNCTION__, __LINE__, DEBUG_TYPE +#define LOG_INFO __FILE__, __FUNCTION__, __LINE__, INFO_TYPE +#define LOG_ERROR __FILE__, __FUNCTION__, __LINE__, ERROR_TYPE +#define LOG_CRITICAL __FILE__, __FUNCTION__, __LINE__, CRITICAL_TYPE +#define LOG_FATAL __FILE__, __FUNCTION__, __LINE__, FATAL_TYPE +#define LOG_DEBUG __FILE__, __FUNCTION__, __LINE__, DEBUG_TYPE + +/* Enumerated Types */ + +/** debug levels */ +enum dprint_type { + DEBUG_TYPE, + INFO_TYPE, + ERROR_TYPE, + CRITICAL_TYPE, + FATAL_TYPE +}; + +/** debug output setting */ +typedef enum DebugOutputType_enum { + DEBUG_OFF, + DEBUG_MOSTLY_OFF, + DEBUG_SCREEN_ONLY, + DEBUG_FILE_ONLY, + DEBUG_SCREEN_AND_FILE +} DebugOutputType; + +/* Enumerated Types */ + +/* Utility functions */ + +/* debug */ +void SetDebugFlag(DebugOutputType flag); +void dprintf(const char *tempString, ...); /* Variable argument list */ + +/* set FRC ranges for drive */ +double RangeToNormalized(double pixel, int range); +/* change normalized value to any range - used for servo */ +float NormalizeToRange(float normalizedValue, float minRange, float maxRange); +float NormalizeToRange(float normalizedValue); + +/* system utilities */ +void ShowActivity(char *fmt, ...); +double ElapsedTime(double startTime); + +/* servo panning utilities */ +class Servo; +double SinPosition(double *period, double sinStart); +void panInit(); +void panInit(double period); +void panForTarget(Servo *panServo); +void panForTarget(Servo *panServo, double sinStart); + +/* config file read utilities */ +int processFile(char *inputFile, char *outputString, int lineNumber); +int emptyString(char *string); +void stripString(char *string); diff --git a/Robot2016/wpilib/cpp/current/include/Vision/BinaryImage.h b/Robot2016/wpilib/cpp/current/include/Vision/BinaryImage.h new file mode 100644 index 0000000..d9a24c5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/BinaryImage.h @@ -0,0 +1,43 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "MonoImage.h" +/** + * Included for ParticleAnalysisReport definition + * TODO: Eliminate this dependency! + */ +#include "Vision/VisionAPI.h" + +#include +#include + +class BinaryImage : public MonoImage { + public: + virtual ~BinaryImage() = default; + int GetNumberParticles(); + ParticleAnalysisReport GetParticleAnalysisReport(int particleNumber); + void GetParticleAnalysisReport(int particleNumber, + ParticleAnalysisReport *par); + std::vector *GetOrderedParticleAnalysisReports(); + BinaryImage *RemoveSmallObjects(bool connectivity8, int erosions); + BinaryImage *RemoveLargeObjects(bool connectivity8, int erosions); + BinaryImage *ConvexHull(bool connectivity8); + BinaryImage *ParticleFilter(ParticleFilterCriteria2 *criteria, + int criteriaCount); + virtual void Write(const char *fileName); + + private: + bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure, + int *result); + bool ParticleMeasurement(int particleNumber, MeasurementType whatToMeasure, + double *result); + static double NormalizeFromRange(double position, int range); + static bool CompareParticleSizes(ParticleAnalysisReport particle1, + ParticleAnalysisReport particle2); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/ColorImage.h b/Robot2016/wpilib/cpp/current/include/Vision/ColorImage.h new file mode 100644 index 0000000..493c541 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/ColorImage.h @@ -0,0 +1,71 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "ImageBase.h" +#include "BinaryImage.h" +#include "Threshold.h" + +class ColorImage : public ImageBase { + public: + ColorImage(ImageType type); + virtual ~ColorImage() = default; + BinaryImage *ThresholdRGB(int redLow, int redHigh, int greenLow, + int greenHigh, int blueLow, int blueHigh); + BinaryImage *ThresholdHSL(int hueLow, int hueHigh, int saturationLow, + int saturationHigh, int luminenceLow, + int luminenceHigh); + BinaryImage *ThresholdHSV(int hueLow, int hueHigh, int saturationLow, + int saturationHigh, int valueHigh, int valueLow); + BinaryImage *ThresholdHSI(int hueLow, int hueHigh, int saturationLow, + int saturationHigh, int intensityLow, + int intensityHigh); + BinaryImage *ThresholdRGB(Threshold &threshold); + BinaryImage *ThresholdHSL(Threshold &threshold); + BinaryImage *ThresholdHSV(Threshold &threshold); + BinaryImage *ThresholdHSI(Threshold &threshold); + MonoImage *GetRedPlane(); + MonoImage *GetGreenPlane(); + MonoImage *GetBluePlane(); + MonoImage *GetHSLHuePlane(); + MonoImage *GetHSVHuePlane(); + MonoImage *GetHSIHuePlane(); + MonoImage *GetHSLSaturationPlane(); + MonoImage *GetHSVSaturationPlane(); + MonoImage *GetHSISaturationPlane(); + MonoImage *GetLuminancePlane(); + MonoImage *GetValuePlane(); + MonoImage *GetIntensityPlane(); + void ReplaceRedPlane(MonoImage *plane); + void ReplaceGreenPlane(MonoImage *plane); + void ReplaceBluePlane(MonoImage *plane); + void ReplaceHSLHuePlane(MonoImage *plane); + void ReplaceHSVHuePlane(MonoImage *plane); + void ReplaceHSIHuePlane(MonoImage *plane); + void ReplaceHSLSaturationPlane(MonoImage *plane); + void ReplaceHSVSaturationPlane(MonoImage *plane); + void ReplaceHSISaturationPlane(MonoImage *plane); + void ReplaceLuminancePlane(MonoImage *plane); + void ReplaceValuePlane(MonoImage *plane); + void ReplaceIntensityPlane(MonoImage *plane); + void ColorEqualize(); + void LuminanceEqualize(); + + private: + BinaryImage *ComputeThreshold(ColorMode colorMode, int low1, int high1, + int low2, int high2, int low3, int high3); + void Equalize(bool allPlanes); + MonoImage *ExtractColorPlane(ColorMode mode, int planeNumber); + MonoImage *ExtractFirstColorPlane(ColorMode mode); + MonoImage *ExtractSecondColorPlane(ColorMode mode); + MonoImage *ExtractThirdColorPlane(ColorMode mode); + void ReplacePlane(ColorMode mode, MonoImage *plane, int planeNumber); + void ReplaceFirstColorPlane(ColorMode mode, MonoImage *plane); + void ReplaceSecondColorPlane(ColorMode mode, MonoImage *plane); + void ReplaceThirdColorPlane(ColorMode mode, MonoImage *plane); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/FrcError.h b/Robot2016/wpilib/cpp/current/include/Vision/FrcError.h new file mode 100644 index 0000000..bfe0748 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/FrcError.h @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 + +/* Error Codes */ +#define ERR_VISION_GENERAL_ERROR 166000 // +#define ERR_COLOR_NOT_FOUND 166100 // TrackAPI.cpp +#define ERR_PARTICLE_TOO_SMALL 166101 // TrackAPI.cpp + +#define ERR_CAMERA_FAILURE 166200 // AxisCamera.cpp +#define ERR_CAMERA_SOCKET_CREATE_FAILED 166201 // AxisCamera.cpp +#define ERR_CAMERA_CONNECT_FAILED 166202 // AxisCamera.cpp +#define ERR_CAMERA_STALE_IMAGE 166203 // AxisCamera.cpp +#define ERR_CAMERA_NOT_INITIALIZED 166204 // AxisCamera.cpp +#define ERR_CAMERA_NO_BUFFER_AVAILABLE 166205 // AxisCamera.cpp +#define ERR_CAMERA_HEADER_ERROR 166206 // AxisCamera.cpp +#define ERR_CAMERA_BLOCKING_TIMEOUT 166207 // AxisCamera.cpp +#define ERR_CAMERA_AUTHORIZATION_FAILED 166208 // AxisCamera.cpp +#define ERR_CAMERA_TASK_SPAWN_FAILED 166209 // AxisCamera.cpp +#define ERR_CAMERA_TASK_INPUT_OUT_OF_RANGE 166210 // AxisCamera.cpp +#define ERR_CAMERA_COMMAND_FAILURE 166211 // AxisCamera.cpp + +/* error handling functions */ +int GetLastVisionError(); +const char* GetVisionErrorText(int errorCode); diff --git a/Robot2016/wpilib/cpp/current/include/Vision/HSLImage.h b/Robot2016/wpilib/cpp/current/include/Vision/HSLImage.h new file mode 100644 index 0000000..057a8c7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/HSLImage.h @@ -0,0 +1,20 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "ColorImage.h" + +/** + * A color image represented in HSL color space at 3 bytes per pixel. + */ +class HSLImage : public ColorImage { + public: + HSLImage(); + HSLImage(const char *fileName); + virtual ~HSLImage() = default; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/ImageBase.h b/Robot2016/wpilib/cpp/current/include/Vision/ImageBase.h new file mode 100644 index 0000000..5fc0470 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/ImageBase.h @@ -0,0 +1,27 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 +#include "nivision.h" +#include "ErrorBase.h" + +#define DEFAULT_BORDER_SIZE 3 + +class ImageBase : public ErrorBase { + public: + ImageBase(ImageType type); + virtual ~ImageBase(); + virtual void Write(const char *fileName); + int GetHeight(); + int GetWidth(); + Image *GetImaqImage(); + + protected: + Image *m_imaqImage; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/MonoImage.h b/Robot2016/wpilib/cpp/current/include/Vision/MonoImage.h new file mode 100644 index 0000000..856d891 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/MonoImage.h @@ -0,0 +1,24 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "ImageBase.h" + +#include + +class MonoImage : public ImageBase { + public: + MonoImage(); + virtual ~MonoImage() = default; + + std::vector *DetectEllipses( + EllipseDescriptor *ellipseDescriptor, CurveOptions *curveOptions, + ShapeDetectionOptions *shapeDetectionOptions, ROI *roi); + std::vector *DetectEllipses( + EllipseDescriptor *ellipseDescriptor); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/RGBImage.h b/Robot2016/wpilib/cpp/current/include/Vision/RGBImage.h new file mode 100644 index 0000000..eeed545 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/RGBImage.h @@ -0,0 +1,20 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "ColorImage.h" + +/** + * A color image represented in RGB color space at 3 bytes per pixel. + */ +class RGBImage : public ColorImage { + public: + RGBImage(); + RGBImage(const char *fileName); + virtual ~RGBImage() = default; +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/Threshold.h b/Robot2016/wpilib/cpp/current/include/Vision/Threshold.h new file mode 100644 index 0000000..78d82b4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/Threshold.h @@ -0,0 +1,26 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 + +/** + * Color threshold values. + * This object represnts the threshold values for any type of color object + * that is used in a threshhold operation. It simplifies passing values + * around in a program for color detection. + */ +class Threshold { + public: + int plane1Low; + int plane1High; + int plane2Low; + int plane2High; + int plane3Low; + int plane3High; + Threshold(int plane1Low, int plane1High, int plane2Low, int plane2High, + int plane3Low, int plane3High); +}; diff --git a/Robot2016/wpilib/cpp/current/include/Vision/VisionAPI.h b/Robot2016/wpilib/cpp/current/include/Vision/VisionAPI.h new file mode 100644 index 0000000..7c7b5c1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/Vision/VisionAPI.h @@ -0,0 +1,173 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 "nivision.h" + +/* Constants */ + +#define DEFAULT_BORDER_SIZE 3 // VisionAPI.frcCreateImage +#define DEFAULT_SATURATION_THRESHOLD 40 // TrackAPI.FindColor + +/* Forward Declare Data Structures */ +typedef struct FindEdgeOptions_struct FindEdgeOptions; +typedef struct CircularEdgeReport_struct CircularEdgeReport; + +/* Data Structures */ + +/** frcParticleAnalysis returns this structure */ +typedef struct ParticleAnalysisReport_struct { + int imageHeight; + int imageWidth; + double imageTimestamp; + int particleIndex; // the particle index analyzed + /* X-coordinate of the point representing the average position of the + * total particle mass, assuming every point in the particle has a constant + * density */ + int center_mass_x; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_X + /* Y-coordinate of the point representing the average position of the + * total particle mass, assuming every point in the particle has a constant + * density */ + int center_mass_y; // MeasurementType: IMAQ_MT_CENTER_OF_MASS_Y + double center_mass_x_normalized; // Center of mass x value normalized to -1.0 + // to +1.0 range + double center_mass_y_normalized; // Center of mass y value normalized to -1.0 + // to +1.0 range + /* Area of the particle */ + double particleArea; // MeasurementType: IMAQ_MT_AREA + /* Bounding Rectangle */ + Rect boundingRect; // left/top/width/height + /* Percentage of the particle Area covering the Image Area. */ + double particleToImagePercent; // MeasurementType: IMAQ_MT_AREA_BY_IMAGE_AREA + /* Percentage of the particle Area in relation to its Particle and Holes Area + */ + double particleQuality; // MeasurementType: + // IMAQ_MT_AREA_BY_PARTICLE_AND_HOLES_AREA +} ParticleAnalysisReport; + +/** Tracking functions return this structure */ +typedef struct ColorReport_struct { + int numberParticlesFound; // Number of particles found for this color + int largestParticleNumber; // The particle index of the largest particle + /* Color information */ + float particleHueMax; // HistogramReport: hue max + float particleHueMin; // HistogramReport: hue max + float particleHueMean; // HistogramReport: hue mean + float particleSatMax; // HistogramReport: saturation max + float particleSatMin; // HistogramReport: saturation max + float particleSatMean; // HistogramReport: saturation mean + float particleLumMax; // HistogramReport: luminance max + float particleLumMin; // HistogramReport: luminance max + float particleLumMean; // HistogramReport: luminance mean +} ColorReport; + +/* Image Management functions */ + +/* Create: calls imaqCreateImage. Border size is set to some default value */ +Image* frcCreateImage(ImageType type); + +/* Dispose: calls imaqDispose */ +int frcDispose(void* object); +int frcDispose(const char* filename, ...); + +/* Copy: calls imaqDuplicateImage */ +int frcCopyImage(Image* dest, const Image* source); + +/* Image Extraction: Crop: calls imaqScale */ +int frcCrop(Image* dest, const Image* source, Rect rect); + +/* Image Extraction: Scale: calls imaqScale. Scales entire image */ +int frcScale(Image* dest, const Image* source, int xScale, int yScale, + ScalingMode scaleMode); + +/* Read Image : calls imaqReadFile */ +int frcReadImage(Image* image, const char* fileName); +/* Write Image : calls imaqWriteFile */ +int frcWriteImage(const Image* image, const char* fileName); + +/* Measure Intensity functions */ + +/* Histogram: calls imaqHistogram */ +HistogramReport* frcHistogram(const Image* image, int numClasses, float min, + float max, Rect rect); +/* Color Histogram: calls imaqColorHistogram2 */ +ColorHistogramReport* frcColorHistogram(const Image* image, int numClasses, + ColorMode mode, Image* mask); + +/* Get Pixel Value: calls imaqGetPixel */ +int frcGetPixelValue(const Image* image, Point pixel, PixelValue* value); + +/* Particle Analysis functions */ + +/* Particle Filter: calls imaqParticleFilter3 */ +int frcParticleFilter(Image* dest, Image* source, + const ParticleFilterCriteria2* criteria, + int criteriaCount, const ParticleFilterOptions* options, + Rect rect, int* numParticles); +int frcParticleFilter(Image* dest, Image* source, + const ParticleFilterCriteria2* criteria, + int criteriaCount, const ParticleFilterOptions* options, + int* numParticles); +/* Morphology: calls imaqMorphology */ +int frcMorphology(Image* dest, Image* source, MorphologyMethod method); +int frcMorphology(Image* dest, Image* source, MorphologyMethod method, + const StructuringElement* structuringElement); +/* Reject Border: calls imaqRejectBorder */ +int frcRejectBorder(Image* dest, Image* source); +int frcRejectBorder(Image* dest, Image* source, int connectivity8); +/* Count Particles: calls imaqCountParticles */ +int frcCountParticles(Image* image, int* numParticles); +/* Particle Analysis Report: calls imaqMeasureParticle */ +int frcParticleAnalysis(Image* image, int particleNumber, + ParticleAnalysisReport* par); + +/* Image Enhancement functions */ + +/* Equalize: calls imaqEqualize */ +int frcEqualize(Image* dest, const Image* source, float min, float max); +int frcEqualize(Image* dest, const Image* source, float min, float max, + const Image* mask); + +/* Color Equalize: calls imaqColorEqualize */ +int frcColorEqualize(Image* dest, const Image* source); +int frcColorEqualize(Image* dest, const Image* source, int colorEqualization); + +/* Image Thresholding & Conversion functions */ + +/* Smart Threshold: calls imaqLocalThreshold */ +int frcSmartThreshold(Image* dest, const Image* source, + unsigned int windowWidth, unsigned int windowHeight, + LocalThresholdMethod method, double deviationWeight, + ObjectType type); +int frcSmartThreshold(Image* dest, const Image* source, + unsigned int windowWidth, unsigned int windowHeight, + LocalThresholdMethod method, double deviationWeight, + ObjectType type, float replaceValue); + +/* Simple Threshold: calls imaqThreshold */ +int frcSimpleThreshold(Image* dest, const Image* source, float rangeMin, + float rangeMax, float newValue); +int frcSimpleThreshold(Image* dest, const Image* source, float rangeMin, + float rangeMax); + +/* Color/Hue Threshold: calls imaqColorThreshold */ +int frcColorThreshold(Image* dest, const Image* source, ColorMode mode, + const Range* plane1Range, const Range* plane2Range, + const Range* plane3Range); +int frcColorThreshold(Image* dest, const Image* source, int replaceValue, + ColorMode mode, const Range* plane1Range, + const Range* plane2Range, const Range* plane3Range); +int frcHueThreshold(Image* dest, const Image* source, const Range* hueRange); +int frcHueThreshold(Image* dest, const Image* source, const Range* hueRange, + int minSaturation); + +/* Extract ColorHue Plane: calls imaqExtractColorPlanes */ +int frcExtractColorPlanes(const Image* image, ColorMode mode, Image* plane1, + Image* plane2, Image* plane3); +int frcExtractHuePlane(const Image* image, Image* huePlane); +int frcExtractHuePlane(const Image* image, Image* huePlane, int minSaturation); diff --git a/Robot2016/wpilib/cpp/current/include/WPIErrors.h b/Robot2016/wpilib/cpp/current/include/WPIErrors.h new file mode 100644 index 0000000..ccf6dae --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/WPIErrors.h @@ -0,0 +1,103 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 "stdint.h" + +#ifdef WPI_ERRORS_DEFINE_STRINGS +#define S(label, offset, message) \ + const char * wpi_error_s_##label = message; \ + const int32_t wpi_error_value_##label = offset +#else +#define S(label, offset, message) \ + extern const char * wpi_error_s_##label; \ + const int32_t wpi_error_value_##label = offset +#endif + +/* + * Fatal errors + */ +S(ModuleIndexOutOfRange, -1, + "Allocating module that is out of range or not found"); +S(ChannelIndexOutOfRange, -1, "Allocating channel that is out of range"); +S(NotAllocated, -2, "Attempting to free unallocated resource"); +S(ResourceAlreadyAllocated, -3, "Attempted to reuse an allocated resource"); +S(NoAvailableResources, -4, "No available resources to allocate"); +S(NullParameter, -5, "A pointer parameter to a method is nullptr"); +S(Timeout, -6, "A timeout has been exceeded"); +S(CompassManufacturerError, -7, "Compass manufacturer doesn't match HiTechnic"); +S(CompassTypeError, -8, + "Compass type doesn't match expected type for HiTechnic compass"); +S(IncompatibleMode, -9, "The object is in an incompatible mode"); +S(AnalogTriggerLimitOrderError, -10, + "AnalogTrigger limits error. Lower limit > Upper Limit"); +S(AnalogTriggerPulseOutputError, -11, + "Attempted to read AnalogTrigger pulse output."); +S(TaskError, -12, "Task can't be started"); +S(TaskIDError, -13, "Task error: Invalid ID."); +S(TaskDeletedError, -14, "Task error: Task already deleted."); +S(TaskOptionsError, -15, "Task error: Invalid options."); +S(TaskMemoryError, -16, "Task can't be started due to insufficient memory."); +S(TaskPriorityError, -17, "Task error: Invalid priority [1-255]."); +S(DriveUninitialized, -18, "RobotDrive not initialized for the C interface"); +S(CompressorNonMatching, -19, + "Compressor slot/channel doesn't match previous instance"); +S(CompressorAlreadyDefined, -20, "Creating a second compressor instance"); +S(CompressorUndefined, -21, + "Using compressor functions without defining compressor"); +S(InconsistentArrayValueAdded, -22, + "When packing data into an array to the dashboard, not all values added were " + "of the same type."); +S(MismatchedComplexTypeClose, -23, + "When packing data to the dashboard, a Close for a complex type was called " + "without a matching Open."); +S(DashboardDataOverflow, -24, + "When packing data to the dashboard, too much data was packed and the buffer " + "overflowed."); +S(DashboardDataCollision, -25, + "The same buffer was used for packing data and for printing."); +S(EnhancedIOMissing, -26, "IO is not attached or Enhanced IO is not enabled."); +S(LineNotOutput, -27, + "Cannot SetDigitalOutput for a line not configured for output."); +S(ParameterOutOfRange, -28, "A parameter is out of range."); +S(SPIClockRateTooLow, -29, "SPI clock rate was below the minimum supported"); +S(JaguarVersionError, -30, "Jaguar firmware version error"); +S(JaguarMessageNotFound, -31, "Jaguar message not found"); +S(NetworkTablesReadError, -40, "Error reading NetworkTables socket"); +S(NetworkTablesBufferFull, -41, "Buffer full writing to NetworkTables socket"); +S(NetworkTablesWrongType, -42, + "The wrong type was read from the NetworkTables entry"); +S(NetworkTablesCorrupt, -43, "NetworkTables data stream is corrupt"); +S(SmartDashboardMissingKey, -43, "SmartDashboard data does not exist"); +S(CommandIllegalUse, -50, "Illegal use of Command"); +S(UnsupportedInSimulation, -80, "Unsupported in simulation"); + +/* + * Warnings + */ +S(SampleRateTooHigh, 1, "Analog module sample rate is too high"); +S(VoltageOutOfRange, 2, + "Voltage to convert to raw value is out of range [-10; 10]"); +S(CompressorTaskError, 3, "Compressor task won't start"); +S(LoopTimingError, 4, "Digital module loop timing is not the expected value"); +S(NonBinaryDigitalValue, 5, "Digital output value is not 0 or 1"); +S(IncorrectBatteryChannel, 6, + "Battery measurement channel is not correct value"); +S(BadJoystickIndex, 7, "Joystick index is out of range, should be 0-3"); +S(BadJoystickAxis, 8, "Joystick axis or POV is out of range"); +S(InvalidMotorIndex, 9, "Motor index is out of range, should be 0-3"); +S(DriverStationTaskError, 10, "Driver Station task won't start"); +S(EnhancedIOPWMPeriodOutOfRange, 11, + "Driver Station Enhanced IO PWM Output period out of range."); +S(SPIWriteNoMOSI, 12, "Cannot write to SPI port with no MOSI output"); +S(SPIReadNoMISO, 13, "Cannot read from SPI port with no MISO input"); +S(SPIReadNoData, 14, "No data available to read from SPI"); +S(IncompatibleState, 15, + "Incompatible State: The operation cannot be completed"); + +#undef S diff --git a/Robot2016/wpilib/cpp/current/include/WPILib.h b/Robot2016/wpilib/cpp/current/include/WPILib.h new file mode 100644 index 0000000..8780c85 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/WPILib.h @@ -0,0 +1,104 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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 + +#define REAL + +#include "string.h" +#include + +#include "ADXL345_I2C.h" +#include "ADXL345_SPI.h" +#include "ADXL362.h" +#include "ADXRS450_Gyro.h" +#include "AnalogAccelerometer.h" +#include "AnalogGyro.h" +#include "AnalogInput.h" +#include "AnalogOutput.h" +#include "AnalogPotentiometer.h" +#include "AnalogTrigger.h" +#include "AnalogTriggerOutput.h" +#include "BuiltInAccelerometer.h" +#include "Buttons/InternalButton.h" +#include "Buttons/JoystickButton.h" +#include "Buttons/NetworkButton.h" +#include "CameraServer.h" +#include "CANJaguar.h" +#include "CANTalon.h" +#include "Commands/Command.h" +#include "Commands/CommandGroup.h" +#include "Commands/PIDCommand.h" +#include "Commands/PIDSubsystem.h" +#include "Commands/PrintCommand.h" +#include "Commands/Scheduler.h" +#include "Commands/StartCommand.h" +#include "Commands/Subsystem.h" +#include "Commands/WaitCommand.h" +#include "Commands/WaitForChildren.h" +#include "Commands/WaitUntilCommand.h" +#include "Compressor.h" +#include "ControllerPower.h" +#include "Counter.h" +#include "DigitalInput.h" +#include "DigitalOutput.h" +#include "DigitalSource.h" +#include "DoubleSolenoid.h" +#include "DriverStation.h" +#include "Encoder.h" +#include "ErrorBase.h" +#include "Filters/LinearDigitalFilter.h" +#include "GearTooth.h" +#include "GenericHID.h" +#include "interfaces/Accelerometer.h" +#include "interfaces/Gyro.h" +#include "interfaces/Potentiometer.h" +#include "I2C.h" +#include "IterativeRobot.h" +#include "InterruptableSensorBase.h" +#include "Jaguar.h" +#include "Joystick.h" +#include "Notifier.h" +#include "PIDController.h" +#include "PIDOutput.h" +#include "PIDSource.h" +#include "Preferences.h" +#include "PowerDistributionPanel.h" +#include "PWM.h" +#include "Relay.h" +#include "Resource.h" +#include "RobotBase.h" +#include "RobotDrive.h" +#include "SD540.h" +#include "SensorBase.h" +#include "SerialPort.h" +#include "Servo.h" +#include "SampleRobot.h" +#include "SmartDashboard/SendableChooser.h" +#include "SmartDashboard/SmartDashboard.h" +#include "Solenoid.h" +#include "Spark.h" +#include "SpeedController.h" +#include "SPI.h" +#include "Talon.h" +#include "TalonSRX.h" +#include "Task.h" +#include "Timer.h" +#include "Ultrasonic.h" +#include "Utility.h" +#include "Victor.h" +#include "VictorSP.h" +#include "Vision/AxisCamera.h" +#include "Vision/BinaryImage.h" +#include "Vision/ColorImage.h" +#include "Vision/HSLImage.h" +#include "Vision/ImageBase.h" +#include "Vision/MonoImage.h" +#include "Vision/RGBImage.h" +#include "Vision/Threshold.h" +// XXX: #include "Vision/AxisCamera.h" +#include "WPIErrors.h" diff --git a/Robot2016/wpilib/cpp/current/include/ctre/CtreCanNode.h b/Robot2016/wpilib/cpp/current/include/ctre/CtreCanNode.h new file mode 100644 index 0000000..caa5f20 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ctre/CtreCanNode.h @@ -0,0 +1,131 @@ +#ifndef CtreCanNode_H_ +#define CtreCanNode_H_ +#include "ctre.h" //BIT Defines + Typedefs +#include +#include // memcpy +#include +class CtreCanNode +{ +public: + CtreCanNode(UINT8 deviceNumber); + ~CtreCanNode(); + + UINT8 GetDeviceNumber() + { + return _deviceNumber; + } +protected: + + + template class txTask{ + public: + uint32_t arbId; + T * toSend; + T * operator -> () + { + return toSend; + } + T & operator*() + { + return *toSend; + } + bool IsEmpty() + { + if(toSend == 0) + return true; + return false; + } + }; + template class recMsg{ + public: + uint32_t arbId; + uint8_t bytes[8]; + CTR_Code err; + T * operator -> () + { + return (T *)bytes; + } + T & operator*() + { + return *(T *)bytes; + } + }; + UINT8 _deviceNumber; + void RegisterRx(uint32_t arbId); + /** + * Schedule a CAN Frame for periodic transmit. Assume eight byte DLC and zero value for initial transmission. + * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids. + * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit. + */ + void RegisterTx(uint32_t arbId, uint32_t periodMs); + /** + * Schedule a CAN Frame for periodic transmit. + * @param arbId CAN Frame Arbitration ID. Set BIT31 for 11bit ids, otherwise we use 29bit ids. + * @param periodMs Period to transmit CAN frame. Pass 0 for one-shot, which also disables that ArbID's preceding periodic transmit. + * @param dlc Number of bytes to transmit (0 to 8). + * @param initialFrame Ptr to the frame data to schedule for transmitting. Passing null will result + * in defaulting to zero data value. + */ + void RegisterTx(uint32_t arbId, uint32_t periodMs, uint32_t dlc, const uint8_t * initialFrame); + void UnregisterTx(uint32_t arbId); + + CTR_Code GetRx(uint32_t arbId,uint8_t * dataBytes,uint32_t timeoutMs); + void FlushTx(uint32_t arbId); + bool ChangeTxPeriod(uint32_t arbId, uint32_t periodMs); + + template txTask GetTx(uint32_t arbId) + { + txTask retval = {0, nullptr}; + txJobs_t::iterator i = _txJobs.find(arbId); + if(i != _txJobs.end()){ + retval.arbId = i->second.arbId; + retval.toSend = (T*)i->second.toSend; + } + return retval; + } + template void FlushTx(T & par) + { + FlushTx(par.arbId); + } + + template recMsg GetRx(uint32_t arbId, uint32_t timeoutMs) + { + recMsg retval; + retval.err = GetRx(arbId,retval.bytes, timeoutMs); + return retval; + } + +private: + + class txJob_t { + public: + uint32_t arbId; + uint8_t toSend[8]; + uint32_t periodMs; + uint8_t dlc; + }; + + class rxEvent_t{ + public: + uint8_t bytes[8]; + struct timespec time; + rxEvent_t() + { + bytes[0] = 0; + bytes[1] = 0; + bytes[2] = 0; + bytes[3] = 0; + bytes[4] = 0; + bytes[5] = 0; + bytes[6] = 0; + bytes[7] = 0; + } + }; + + typedef std::map txJobs_t; + txJobs_t _txJobs; + + typedef std::map rxRxEvents_t; + rxRxEvents_t _rxRxEvents; +}; +#endif diff --git a/Robot2016/wpilib/cpp/current/include/ctre/PCM.h b/Robot2016/wpilib/cpp/current/include/ctre/PCM.h new file mode 100644 index 0000000..c78b193 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ctre/PCM.h @@ -0,0 +1,218 @@ +#ifndef PCM_H_ +#define PCM_H_ +#include "ctre.h" //BIT Defines + Typedefs +#include "CtreCanNode.h" +class PCM : public CtreCanNode +{ +public: + PCM(UINT8 deviceNumber=0); + ~PCM(); + + /* Set PCM solenoid state + * + * @Return - CTR_Code - Error code (if any) for setting solenoid + * @Param - idx - ID of solenoid (0-7) + * @Param - en - Enable / Disable identified solenoid + */ + CTR_Code SetSolenoid(unsigned char idx, bool en); + + /* Enables PCM Closed Loop Control of Compressor via pressure switch + * @Return - CTR_Code - Error code (if any) for setting solenoid + * @Param - en - Enable / Disable Closed Loop Control + */ + CTR_Code SetClosedLoopControl(bool en); + + /* Clears PCM sticky faults (indicators of past faults + * @Return - CTR_Code - Error code (if any) for setting solenoid + */ + CTR_Code ClearStickyFaults(); + + /* Get solenoid state + * + * @Return - CTR_Code - Error code (if any) + * @Param - idx - ID of solenoid (0-7) to return if solenoid is on. + * @Param - status - true if solenoid enabled, false otherwise + */ + CTR_Code GetSolenoid(UINT8 idx, bool &status); + + /* Get state of all solenoids + * + * @Return - CTR_Code - Error code (if any) + * @Param - status - bitfield of solenoid states + */ + CTR_Code GetAllSolenoids(UINT8 &status); + + /* Get pressure switch state + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if pressure adequate, false if low + */ + CTR_Code GetPressure(bool &status); + + /* Get compressor state + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compress ouput is on, false if otherwise + */ + CTR_Code GetCompressor(bool &status); + + /* Get closed loop control state + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if closed loop enabled, false if otherwise + */ + CTR_Code GetClosedLoopControl(bool &status); + + /* Get compressor current draw + * @Return - CTR_Code - Error code (if any) + * @Param - status - Compressor current returned in Amperes (A) + */ + CTR_Code GetCompressorCurrent(float &status); + + /* Get voltage across solenoid rail + * @Return - CTR_Code - Error code (if any) + * @Param - status - Voltage across solenoid rail in Volts (V) + */ + CTR_Code GetSolenoidVoltage(float &status); + + /* Get hardware fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if hardware failure detected, false if otherwise + */ + CTR_Code GetHardwareFault(bool &status); + + /* Get compressor fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if abnormally high compressor current detected, false if otherwise + */ + CTR_Code GetCompressorCurrentTooHighFault(bool &status); + + /* Get solenoid fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if shorted solenoid detected, false if otherwise + */ + CTR_Code GetSolenoidFault(bool &status); + + /* Get compressor sticky fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if solenoid had previously been shorted + * (and sticky fault was not cleared), false if otherwise + */ + CTR_Code GetCompressorCurrentTooHighStickyFault(bool &status); + /* Get compressor shorted sticky fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compressor output is shorted, false if otherwise + */ + CTR_Code GetCompressorShortedStickyFault(bool &status); + /* Get compressor shorted fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compressor output is shorted, false if otherwise + */ + CTR_Code GetCompressorShortedFault(bool &status); + /* Get compressor is not connected sticky fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compressor current is too low, + * indicating compressor is not connected, false if otherwise + */ + CTR_Code GetCompressorNotConnectedStickyFault(bool &status); + /* Get compressor is not connected fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compressor current is too low, + * indicating compressor is not connected, false if otherwise + */ + CTR_Code GetCompressorNotConnectedFault(bool &status); + + /* Get solenoid sticky fault value + * @Return - CTR_Code - Error code (if any) + * @Param - status - True if compressor had previously been shorted + * (and sticky fault was not cleared), false if otherwise + */ + CTR_Code GetSolenoidStickyFault(bool &status); + + /* Get battery voltage + * @Return - CTR_Code - Error code (if any) + * @Param - status - Voltage across PCM power ports in Volts (V) + */ + CTR_Code GetBatteryVoltage(float &status); + + /* Set PCM Device Number and according CAN frame IDs + * @Return - void + * @Param - deviceNumber - Device number of PCM to control + */ + void SetDeviceNumber(UINT8 deviceNumber); + /* Get number of total failed PCM Control Frame + * @Return - CTR_Code - Error code (if any) + * @Param - status - Number of failed control frames (tokenization fails) + * @WARNING - Return only valid if [SeekDebugFrames] is enabled + * See function SeekDebugFrames + * See function EnableSeekDebugFrames + */ + CTR_Code GetNumberOfFailedControlFrames(UINT16 &status); + + /* Get raw Solenoid Blacklist + * @Return - CTR_Code - Error code (if any) + * @Param - status - Raw binary breakdown of Solenoid Blacklist + * BIT7 = Solenoid 1, BIT6 = Solenoid 2, etc. + * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled + * See function SeekStatusFaultFrames + * See function EnableSeekStatusFaultFrames + */ + CTR_Code GetSolenoidBlackList(UINT8 &status); + + /* Get solenoid Blacklist status + * - Blacklisted solenoids cannot be enabled until PCM is power cycled + * @Return - CTR_Code - Error code (if any) + * @Param - idx - ID of solenoid [0,7] + * @Param - status - True if Solenoid is blacklisted, false if otherwise + * @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled + * See function SeekStatusFaultFrames + * See function EnableSeekStatusFaultFrames + */ + CTR_Code IsSolenoidBlacklisted(UINT8 idx, bool &status); + + /* Return status of module enable/disable + * @Return - CTR_Code - Error code (if any) + * @Param - status - Returns TRUE if PCM is enabled, FALSE if disabled + */ + CTR_Code isModuleEnabled(bool &status); + + /* Get solenoid Blacklist status + * @Return - CTR_Code - Error code (if any) + * @Param - idx - ID of solenoid [0,7] to fire one shot pulse. + */ + CTR_Code FireOneShotSolenoid(UINT8 idx); + + /* Configure the pulse width of a solenoid channel for one-shot pulse. + * Preprogrammed pulsewidth is 10ms resolute and can be between 20ms and 5.1s. + * @Return - CTR_Code - Error code (if any) + * @Param - idx - ID of solenoid [0,7] to configure. + * @Param - durMs - pulse width in ms. + */ + CTR_Code SetOneShotDurationMs(UINT8 idx,uint32_t durMs); + +}; +//------------------ C interface --------------------------------------------// +extern "C" { + void * c_PCM_Init(void); + CTR_Code c_SetSolenoid(void * handle,unsigned char idx,INT8 param); + CTR_Code c_SetClosedLoopControl(void * handle,INT8 param); + CTR_Code c_ClearStickyFaults(void * handle,INT8 param); + CTR_Code c_GetSolenoid(void * handle,UINT8 idx,INT8 * status); + CTR_Code c_GetAllSolenoids(void * handle,UINT8 * status); + CTR_Code c_GetPressure(void * handle,INT8 * status); + CTR_Code c_GetCompressor(void * handle,INT8 * status); + CTR_Code c_GetClosedLoopControl(void * handle,INT8 * status); + CTR_Code c_GetCompressorCurrent(void * handle,float * status); + CTR_Code c_GetSolenoidVoltage(void * handle,float*status); + CTR_Code c_GetHardwareFault(void * handle,INT8*status); + CTR_Code c_GetCompressorFault(void * handle,INT8*status); + CTR_Code c_GetSolenoidFault(void * handle,INT8*status); + CTR_Code c_GetCompressorStickyFault(void * handle,INT8*status); + CTR_Code c_GetSolenoidStickyFault(void * handle,INT8*status); + CTR_Code c_GetBatteryVoltage(void * handle,float*status); + void c_SetDeviceNumber_PCM(void * handle,UINT8 deviceNumber); + void c_EnableSeekStatusFrames(void * handle,INT8 enable); + void c_EnableSeekStatusFaultFrames(void * handle,INT8 enable); + void c_EnableSeekDebugFrames(void * handle,INT8 enable); + CTR_Code c_GetNumberOfFailedControlFrames(void * handle,UINT16*status); + CTR_Code c_GetSolenoidBlackList(void * handle,UINT8 *status); + CTR_Code c_IsSolenoidBlacklisted(void * handle,UINT8 idx,INT8*status); +} +#endif diff --git a/Robot2016/wpilib/cpp/current/include/ctre/PDP.h b/Robot2016/wpilib/cpp/current/include/ctre/PDP.h new file mode 100644 index 0000000..e20c629 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ctre/PDP.h @@ -0,0 +1,62 @@ +#ifndef PDP_H_ +#define PDP_H_ +#include "ctre.h" //BIT Defines + Typedefs +#include "CtreCanNode.h" +class PDP : public CtreCanNode +{ +public: + /* Get PDP Channel Current + * + * @Param - deviceNumber - Device ID for PDP. Factory default is 60. Function defaults to 60. + */ + PDP(UINT8 deviceNumber=0); + ~PDP(); + /* Get PDP Channel Current + * + * @Return - CTR_Code - Error code (if any) + * + * @Param - idx - ID of channel to return current for (channels 1-16) + * + * @Param - status - Current of channel 'idx' in Amps (A) + */ + CTR_Code GetChannelCurrent(UINT8 idx, double &status); + + /* Get Bus Voltage of PDP + * + * @Return - CTR_Code - Error code (if any) + * + * @Param - status - Voltage (V) across PDP + */ + CTR_Code GetVoltage(double &status); + + /* Get Temperature of PDP + * + * @Return - CTR_Code - Error code (if any) + * + * @Param - status - Temperature of PDP in Centigrade / Celcius (C) + */ + CTR_Code GetTemperature(double &status); + + CTR_Code GetTotalCurrent(double ¤tAmps); + CTR_Code GetTotalPower(double &powerWatts); + CTR_Code GetTotalEnergy(double &energyJoules); + /* Clear sticky faults. + * @Return - CTR_Code - Error code (if any) + */ + CTR_Code ClearStickyFaults(); + + /* Reset Energy Signals + * @Return - CTR_Code - Error code (if any) + */ + CTR_Code ResetEnergy(); +private: + uint64_t ReadCurrents(uint8_t api); +}; +extern "C" { + void * c_PDP_Init(); + CTR_Code c_GetChannelCurrent(void * handle,UINT8 idx, double *status); + CTR_Code c_GetVoltage(void * handle,double *status); + CTR_Code c_GetTemperature(void * handle,double *status); + void c_SetDeviceNumber_PDP(void * handle,UINT8 deviceNumber); +} +#endif /* PDP_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/ctre/ctre.h b/Robot2016/wpilib/cpp/current/include/ctre/ctre.h new file mode 100644 index 0000000..6e27f54 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ctre/ctre.h @@ -0,0 +1,57 @@ +/** + * @file ctre.h + * Common header for all CTRE HAL modules. + */ +#ifndef CTRE_H +#define CTRE_H + +//Bit Defines +#define BIT0 0x01 +#define BIT1 0x02 +#define BIT2 0x04 +#define BIT3 0x08 +#define BIT4 0x10 +#define BIT5 0x20 +#define BIT6 0x40 +#define BIT7 0x80 +#define BIT8 0x0100 +#define BIT9 0x0200 +#define BIT10 0x0400 +#define BIT11 0x0800 +#define BIT12 0x1000 +#define BIT13 0x2000 +#define BIT14 0x4000 +#define BIT15 0x8000 + +//Signed +typedef signed char INT8; +typedef signed short INT16; +typedef signed int INT32; +typedef signed long long INT64; + +//Unsigned +typedef unsigned char UINT8; +typedef unsigned short UINT16; +typedef unsigned int UINT32; +typedef unsigned long long UINT64; + +//Other +typedef unsigned char UCHAR; +typedef unsigned short USHORT; +typedef unsigned int UINT; +typedef unsigned long ULONG; + +typedef enum { + CTR_OKAY, //!< No Error - Function executed as expected + CTR_RxTimeout, //!< CAN frame has not been received within specified period of time. + CTR_TxTimeout, //!< Not used. + CTR_InvalidParamValue, //!< Caller passed an invalid param + CTR_UnexpectedArbId, //!< Specified CAN Id is invalid. + CTR_TxFailed, //!< Could not transmit the CAN frame. + CTR_SigNotUpdated, //!< Have not received an value response for signal. + CTR_BufferFull, //!< Caller attempted to insert data into a buffer that is full. +}CTR_Code; + +#include "ctre_frames.h" + +#endif /* CTRE_H */ diff --git a/Robot2016/wpilib/cpp/current/include/ctre/ctre_frames.h b/Robot2016/wpilib/cpp/current/include/ctre/ctre_frames.h new file mode 100644 index 0000000..f131538 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ctre/ctre_frames.h @@ -0,0 +1,243 @@ +/** + * @file ctre_frames.h + * CAN Encoder/Decoder Structures for CTRE devices. + */ +#ifndef CTRE_FRAMES_H +#define CTRE_FRAMES_H + +/** control */ +typedef struct _TALON_Control_1_General_10ms_t { + unsigned TokenH:8; + unsigned TokenL:8; + unsigned DemandH:8; + unsigned DemandM:8; + unsigned DemandL:8; + unsigned ProfileSlotSelect:1; + unsigned FeedbackDeviceSelect:4; + unsigned OverrideLimitSwitchEn:3; + unsigned RevFeedbackSensor:1; + unsigned RevMotDuringCloseLoopEn:1; + unsigned OverrideBrakeType:2; + unsigned ModeSelect:4; + unsigned RampThrottle:8; +} TALON_Control_1_General_10ms_t ; + +/* TALON_Control_2_Rates_OneShot_t removed since it has been deprecated */ + +typedef struct _TALON_Control_3_ClearFlags_OneShot_t { + unsigned ZeroFeedbackSensor:1; + unsigned ClearStickyFaults:1; +} TALON_Control_3_ClearFlags_OneShot_t ; + +typedef struct _TALON_Control_5_General_10ms_t { + unsigned ThrottleBump_h3:3; + unsigned ReservedZero:5; + unsigned ThrottleBump_l8:8; + unsigned DemandH:8; + unsigned DemandM:8; + unsigned DemandL:8; + unsigned ProfileSlotSelect:1; + unsigned FeedbackDeviceSelect:4; + unsigned OverrideLimitSwitchEn:3; + unsigned RevFeedbackSensor:1; + unsigned RevMotDuringCloseLoopEn:1; + unsigned OverrideBrakeType:2; + unsigned ModeSelect:4; + unsigned RampThrottle:8; +} TALON_Control_5_General_10ms_t ; + +typedef struct _TALON_Control_6_MotProfAddTrajPoint_t { + unsigned huffCode:2; //!< Compression coding + unsigned NextPt_VelOnly:1; + unsigned NextPt_IsLast:1; + unsigned reserved0:2; + unsigned NextPt_ZeroPosition:1; + unsigned NextPt_ProfileSlotSelect:1; + unsigned Idx:4; + unsigned reserved1:4; + unsigned restOfFrame0:8; + unsigned restOfFrame1:8; + unsigned restOfFrame2:8; + unsigned restOfFrame3:8; + unsigned restOfFrame4:8; + unsigned restOfFrame5:8; +} TALON_Control_6_MotProfAddTrajPoint_t; + +typedef struct _TALON_Control_6_MotProfAddTrajPoint_huff0_t { + unsigned huffCode_expect_0:2; //!< Compression coding + unsigned NextPt_VelOnly:1; + unsigned NextPt_IsLast:1; + unsigned reserved0:2; + unsigned NextPt_ZeroPosition:1; + unsigned NextPt_ProfileSlotSelect:1; + unsigned Idx:4; + unsigned reserved1:4; + unsigned NextPt_DurationMs:8; + unsigned NextPt_VelocityH:8; + unsigned NextPt_VelocityL:8; + unsigned NextPt_PositionH:8; + unsigned NextPt_PositionM:8; + unsigned NextPt_PositionL:8; +} TALON_Control_6_MotProfAddTrajPoint_huff0_t; + +typedef struct _TALON_Control_6_MotProfAddTrajPoint_huff1_t { + unsigned huffCode_expect_1:2; //!< Compression coding + unsigned NextPt_VelOnly:1; + unsigned NextPt_IsLast:1; + unsigned reserved0:2; + unsigned NextPt_ZeroPosition:1; + unsigned NextPt_ProfileSlotSelect:1; + unsigned Idx:4; + unsigned reserved1:4; + unsigned NextPt_DurationMs:8; + unsigned NextPt_SameVelocityH:8; + unsigned NextPt_SameVelocityL:8; + unsigned NextPt_DeltaPositionH:8; + unsigned NextPt_DeltaPositionL:8; + unsigned NextPt_Count:8; +} TALON_Control_6_MotProfAddTrajPoint_huff1_t; + +/** status */ +typedef struct _TALON_Status_1_General_10ms_t { + unsigned CloseLoopErrH:8; + unsigned CloseLoopErrM:8; + unsigned CloseLoopErrL:8; + unsigned AppliedThrottle_h3:3; + unsigned Fault_RevSoftLim:1; + unsigned Fault_ForSoftLim:1; + unsigned TokLocked:1; + unsigned LimitSwitchClosedRev:1; + unsigned LimitSwitchClosedFor:1; + unsigned AppliedThrottle_l8:8; + unsigned ModeSelect_h1:1; + unsigned FeedbackDeviceSelect:4; + unsigned LimitSwitchEn:3; + unsigned Fault_HardwareFailure:1; + unsigned Fault_RevLim:1; + unsigned Fault_ForLim:1; + unsigned Fault_UnderVoltage:1; + unsigned Fault_OverTemp:1; + unsigned ModeSelect_b3:3; + unsigned TokenSeed:8; +} TALON_Status_1_General_10ms_t ; +typedef struct _TALON_Status_2_Feedback_20ms_t { + unsigned SensorPositionH:8; + unsigned SensorPositionM:8; + unsigned SensorPositionL:8; + unsigned SensorVelocityH:8; + unsigned SensorVelocityL:8; + unsigned Current_h8:8; + unsigned StckyFault_RevSoftLim:1; + unsigned StckyFault_ForSoftLim:1; + unsigned StckyFault_RevLim:1; + unsigned StckyFault_ForLim:1; + unsigned StckyFault_UnderVoltage:1; + unsigned StckyFault_OverTemp:1; + unsigned Current_l2:2; + unsigned reserved:3; + unsigned Cmd5Allowed:1; + unsigned VelDiv4:1; + unsigned PosDiv8:1; + unsigned ProfileSlotSelect:1; + unsigned BrakeIsEnabled:1; +} TALON_Status_2_Feedback_20ms_t ; +typedef struct _TALON_Status_3_Enc_100ms_t { + unsigned EncPositionH:8; + unsigned EncPositionM:8; + unsigned EncPositionL:8; + unsigned EncVelH:8; + unsigned EncVelL:8; + unsigned EncIndexRiseEventsH:8; + unsigned EncIndexRiseEventsL:8; + unsigned reserved:3; + unsigned VelDiv4:1; + unsigned PosDiv8:1; + unsigned QuadIdxpin:1; + unsigned QuadBpin:1; + unsigned QuadApin:1; +} TALON_Status_3_Enc_100ms_t ; +typedef struct _TALON_Status_4_AinTempVbat_100ms_t { + unsigned AnalogInWithOvH:8; + unsigned AnalogInWithOvM:8; + unsigned AnalogInWithOvL:8; + unsigned AnalogInVelH:8; + unsigned AnalogInVelL:8; + unsigned Temp:8; + unsigned BatteryV:8; + unsigned reserved:6; + unsigned VelDiv4:1; + unsigned PosDiv8:1; +} TALON_Status_4_AinTempVbat_100ms_t ; +typedef struct _TALON_Status_5_Startup_OneShot_t { + unsigned ResetCountH:8; + unsigned ResetCountL:8; + unsigned ResetFlagsH:8; + unsigned ResetFlagsL:8; + unsigned FirmVersH:8; + unsigned FirmVersL:8; +} TALON_Status_5_Startup_OneShot_t ; +typedef struct _TALON_Status_6_Eol_t { + unsigned currentAdcUncal_h2:2; + unsigned reserved1:5; + unsigned SpiCsPin_GadgeteerPin6:1; + unsigned currentAdcUncal_l8:8; + unsigned tempAdcUncal_h2:2; + unsigned reserved2:6; + unsigned tempAdcUncal_l8:8; + unsigned vbatAdcUncal_h2:2; + unsigned reserved3:6; + unsigned vbatAdcUncal_l8:8; + unsigned analogAdcUncal_h2:2; + unsigned reserved4:6; + unsigned analogAdcUncal_l8:8; +} TALON_Status_6_Eol_t ; +typedef struct _TALON_Status_7_Debug_200ms_t { + unsigned TokenizationFails_h8:8; + unsigned TokenizationFails_l8:8; + unsigned LastFailedToken_h8:8; + unsigned LastFailedToken_l8:8; + unsigned TokenizationSucceses_h8:8; + unsigned TokenizationSucceses_l8:8; +} TALON_Status_7_Debug_200ms_t ; +typedef struct _TALON_Status_8_PulseWid_100ms_t { + unsigned PulseWidPositionH:8; + unsigned PulseWidPositionM:8; + unsigned PulseWidPositionL:8; + unsigned reserved:6; + unsigned VelDiv4:1; + unsigned PosDiv8:1; + unsigned PeriodUsM8:8; + unsigned PeriodUsL8:8; + unsigned PulseWidVelH:8; + unsigned PulseWidVelL:8; +} TALON_Status_8_PulseWid_100ms_t ; +typedef struct _TALON_Status_9_MotProfBuffer_100ms_t { + unsigned ActTraj_IsValid:1; //!< '1' if other ActTraj_* signals are valid. '0' if there is no active trajectory pt. + unsigned ActTraj_ProfileSlotSelect:1; + unsigned ActTraj_VelOnly:1; + unsigned ActTraj_IsLast:1; + unsigned OutputType:2; + unsigned HasUnderrun:1; + unsigned IsUnderrun:1; + unsigned NextID:4; + unsigned reserved1:3; + unsigned BufferIsFull:1; + unsigned Count:8; + unsigned ActTraj_VelocityH:8; + unsigned ActTraj_VelocityL:8; + unsigned ActTraj_PositionH:8; + unsigned ActTraj_PositionM:8; + unsigned ActTraj_PositionL:8; +} TALON_Status_9_MotProfBuffer_100ms_t ; +typedef struct _TALON_Param_Request_t { + unsigned ParamEnum:8; +} TALON_Param_Request_t ; +typedef struct _TALON_Param_Response_t { + unsigned ParamEnum:8; + unsigned ParamValueL:8; + unsigned ParamValueML:8; + unsigned ParamValueMH:8; + unsigned ParamValueH:8; +} TALON_Param_Response_t ; + +#endif /* CTRE_FRAMES_H */ diff --git a/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h new file mode 100644 index 0000000..3df0e3b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI.h @@ -0,0 +1,485 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class edu_wpi_first_wpilibj_networktables_NetworkTablesJNI */ + +#ifndef _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI +#define _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: containsKey + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_containsKey + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getType + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getType + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putBoolean + * Signature: (Ljava/lang/String;Z)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBoolean + (JNIEnv *, jclass, jstring, jboolean); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putDouble + * Signature: (Ljava/lang/String;D)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDouble + (JNIEnv *, jclass, jstring, jdouble); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putString + * Signature: (Ljava/lang/String;Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putString + (JNIEnv *, jclass, jstring, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putRaw + * Signature: (Ljava/lang/String;[B)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2_3B + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putRaw + * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I + (JNIEnv *, jclass, jstring, jobject, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putBooleanArray + * Signature: (Ljava/lang/String;[Z)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putBooleanArray + (JNIEnv *, jclass, jstring, jbooleanArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putDoubleArray + * Signature: (Ljava/lang/String;[D)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putDoubleArray + (JNIEnv *, jclass, jstring, jdoubleArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: putStringArray + * Signature: (Ljava/lang/String;[Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_putStringArray + (JNIEnv *, jclass, jstring, jobjectArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutBoolean + * Signature: (Ljava/lang/String;Z)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBoolean + (JNIEnv *, jclass, jstring, jboolean); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutDouble + * Signature: (Ljava/lang/String;D)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDouble + (JNIEnv *, jclass, jstring, jdouble); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutString + * Signature: (Ljava/lang/String;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutString + (JNIEnv *, jclass, jstring, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutRaw + * Signature: (Ljava/lang/String;[B)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2_3B + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutRaw + * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutRaw__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I + (JNIEnv *, jclass, jstring, jobject, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutBooleanArray + * Signature: (Ljava/lang/String;[Z)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutBooleanArray + (JNIEnv *, jclass, jstring, jbooleanArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutDoubleArray + * Signature: (Ljava/lang/String;[D)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutDoubleArray + (JNIEnv *, jclass, jstring, jdoubleArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: forcePutStringArray + * Signature: (Ljava/lang/String;[Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_forcePutStringArray + (JNIEnv *, jclass, jstring, jobjectArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getValue + * Signature: (Ljava/lang/String;)Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getBoolean + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getDouble + * Signature: (Ljava/lang/String;)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getString + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getRaw + * Signature: (Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getBooleanArray + * Signature: (Ljava/lang/String;)[Z + */ +JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getDoubleArray + * Signature: (Ljava/lang/String;)[D + */ +JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getStringArray + * Signature: (Ljava/lang/String;)[Ljava/lang/String; + */ +JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getValue + * Signature: (Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getValue__Ljava_lang_String_2Ljava_lang_Object_2 + (JNIEnv *, jclass, jstring, jobject); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getBoolean + * Signature: (Ljava/lang/String;Z)Z + */ +JNIEXPORT jboolean JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBoolean__Ljava_lang_String_2Z + (JNIEnv *, jclass, jstring, jboolean); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getDouble + * Signature: (Ljava/lang/String;D)D + */ +JNIEXPORT jdouble JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDouble__Ljava_lang_String_2D + (JNIEnv *, jclass, jstring, jdouble); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getString + * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getString__Ljava_lang_String_2Ljava_lang_String_2 + (JNIEnv *, jclass, jstring, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getRaw + * Signature: (Ljava/lang/String;[B)[B + */ +JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRaw__Ljava_lang_String_2_3B + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getBooleanArray + * Signature: (Ljava/lang/String;[Z)[Z + */ +JNIEXPORT jbooleanArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getBooleanArray__Ljava_lang_String_2_3Z + (JNIEnv *, jclass, jstring, jbooleanArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getDoubleArray + * Signature: (Ljava/lang/String;[D)[D + */ +JNIEXPORT jdoubleArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getDoubleArray__Ljava_lang_String_2_3D + (JNIEnv *, jclass, jstring, jdoubleArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getStringArray + * Signature: (Ljava/lang/String;[Ljava/lang/String;)[Ljava/lang/String; + */ +JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getStringArray__Ljava_lang_String_2_3Ljava_lang_String_2 + (JNIEnv *, jclass, jstring, jobjectArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: setEntryFlags + * Signature: (Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setEntryFlags + (JNIEnv *, jclass, jstring, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getEntryFlags + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntryFlags + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: deleteEntry + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteEntry + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: deleteAllEntries + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_deleteAllEntries + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getEntries + * Signature: (Ljava/lang/String;I)[Ledu/wpi/first/wpilibj/networktables/EntryInfo; + */ +JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getEntries + (JNIEnv *, jclass, jstring, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: flush + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_flush + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: addEntryListener + * Signature: (Ljava/lang/String;Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/EntryListenerFunction;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addEntryListener + (JNIEnv *, jclass, jstring, jobject, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: removeEntryListener + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeEntryListener + (JNIEnv *, jclass, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: addConnectionListener + * Signature: (Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/ConnectionListenerFunction;Z)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_addConnectionListener + (JNIEnv *, jclass, jobject, jboolean); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: removeConnectionListener + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_removeConnectionListener + (JNIEnv *, jclass, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getRpc + * Signature: (Ljava/lang/String;)[B + */ +JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2 + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getRpc + * Signature: (Ljava/lang/String;[B)[B + */ +JNIEXPORT jbyteArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getRpc__Ljava_lang_String_2_3B + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: callRpc + * Signature: (Ljava/lang/String;[B)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2_3B + (JNIEnv *, jclass, jstring, jbyteArray); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: callRpc + * Signature: (Ljava/lang/String;Ljava/nio/ByteBuffer;I)I + */ +JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_callRpc__Ljava_lang_String_2Ljava_nio_ByteBuffer_2I + (JNIEnv *, jclass, jstring, jobject, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: setNetworkIdentity + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setNetworkIdentity + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: startServer + * Signature: (Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startServer + (JNIEnv *, jclass, jstring, jstring, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: stopServer + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopServer + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: startClient + * Signature: (Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_startClient + (JNIEnv *, jclass, jstring, jint); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: stopClient + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_stopClient + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: setUpdateRate + * Signature: (D)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setUpdateRate + (JNIEnv *, jclass, jdouble); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: getConnections + * Signature: ()[Ledu/wpi/first/wpilibj/networktables/ConnectionInfo; + */ +JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_getConnections + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: savePersistent + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_savePersistent + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: loadPersistent + * Signature: (Ljava/lang/String;)[Ljava/lang/String; + */ +JNIEXPORT jobjectArray JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_loadPersistent + (JNIEnv *, jclass, jstring); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: now + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_now + (JNIEnv *, jclass); + +/* + * Class: edu_wpi_first_wpilibj_networktables_NetworkTablesJNI + * Method: setLogger + * Signature: (Ledu/wpi/first/wpilibj/networktables/NetworkTablesJNI/LoggerFunction;I)V + */ +JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_setLogger + (JNIEnv *, jclass, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction.h b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction.h new file mode 100644 index 0000000..5793699 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction.h @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction */ + +#ifndef _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction +#define _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_ConnectionListenerFunction +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction.h b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction.h new file mode 100644 index 0000000..70b69c3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction.h @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction */ + +#ifndef _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction +#define _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_EntryListenerFunction +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction.h b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction.h new file mode 100644 index 0000000..529d0a9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction.h @@ -0,0 +1,13 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction */ + +#ifndef _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction +#define _Included_edu_wpi_first_wpilibj_networktables_NetworkTablesJNI_LoggerFunction +#ifdef __cplusplus +extern "C" { +#endif +#ifdef __cplusplus +} +#endif +#endif diff --git a/Robot2016/wpilib/cpp/current/include/fpgainterfacecapi/NiFpga.h b/Robot2016/wpilib/cpp/current/include/fpgainterfacecapi/NiFpga.h new file mode 100644 index 0000000..96492f6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/fpgainterfacecapi/NiFpga.h @@ -0,0 +1,2459 @@ +/* + * FPGA Interface C API 15.0 header file. + * + * Copyright (c) 2015, + * National Instruments Corporation. + * All rights reserved. + */ + +#ifndef __NiFpga_h__ +#define __NiFpga_h__ + +/* + * Determine platform details. + */ +#if defined(_M_IX86) \ + || defined(_M_X64) \ + || defined(_M_AMD64) \ + || defined(i386) \ + || defined(__i386) \ + || defined(__i386__) \ + || defined(__i486__) \ + || defined(__i586__) \ + || defined(__i686__) \ + || defined(__amd64__) \ + || defined(__amd64) \ + || defined(__x86_64__) \ + || defined(__x86_64) \ + || defined(__IA32__) \ + || defined(_X86_) \ + || defined(__THW_INTEL__) \ + || defined(__I86__) \ + || defined(__INTEL__) \ + || defined(__X86__) \ + || defined(__386__) \ + || defined(__I86__) \ + || defined(M_I386) \ + || defined(M_I86) \ + || defined(_M_I386) \ + || defined(_M_I86) + #if defined(_WIN32) \ + || defined(_WIN64) \ + || defined(__WIN32__) \ + || defined(__TOS_WIN__) \ + || defined(__WINDOWS__) \ + || defined(_WINDOWS) \ + || defined(__WINDOWS_386__) \ + || defined(__CYGWIN__) + /* Either Windows or Phar Lap ETS. */ + #define NiFpga_Windows 1 + #elif defined(__linux__) \ + || defined(__linux) \ + || defined(linux) \ + || defined(__gnu_linux__) + #define NiFpga_Linux 1 + #elif defined(__APPLE__) && defined(__MACH__) + #define NiFpga_MacOsX 1 + #else + #error Unsupported OS. + #endif +#elif defined(__powerpc) \ + || defined(__powerpc__) \ + || defined(__POWERPC__) \ + || defined(__ppc__) \ + || defined(__PPC) \ + || defined(_M_PPC) \ + || defined(_ARCH_PPC) \ + || defined(__PPC__) \ + || defined(__ppc) + #if defined(__vxworks) + #define NiFpga_VxWorks 1 + #else + #error Unsupported OS. + #endif +#elif defined(__arm__) \ + || defined(__thumb__) \ + || defined(__TARGET_ARCH_ARM) \ + || defined(__TARGET_ARCH_THUMB) \ + || defined(_ARM) \ + || defined(_M_ARM) \ + || defined(_M_ARMT) +#if defined(__linux__) \ + || defined(__linux) \ + || defined(linux) \ + || defined(__gnu_linux__) + #define NiFpga_Linux 1 +#else + #error Unsupported OS. + #endif +#else + #error Unsupported architecture. +#endif + +/* + * Determine compiler. + */ +#if defined(_MSC_VER) + #define NiFpga_Msvc 1 +#elif defined(__GNUC__) + #define NiFpga_Gcc 1 +#elif defined(_CVI_) && !defined(_TPC_) + #define NiFpga_Cvi 1 + /* Enables CVI Library Protection Errors. */ + #pragma EnableLibraryRuntimeChecking +#else + /* Unknown compiler. */ +#endif + +/* + * Determine compliance with different C/C++ language standards. + */ +#if defined(__cplusplus) + #define NiFpga_Cpp 1 + #if __cplusplus >= 199707L + #define NiFpga_Cpp98 1 + #if __cplusplus >= 201103L + #define NiFpga_Cpp11 1 + #endif + #endif +#endif +#if defined(__STDC__) + #define NiFpga_C89 1 + #if defined(__STDC_VERSION__) + #define NiFpga_C90 1 + #if __STDC_VERSION__ >= 199409L + #define NiFpga_C94 1 + #if __STDC_VERSION__ >= 199901L + #define NiFpga_C99 1 + #if __STDC_VERSION__ >= 201112L + #define NiFpga_C11 1 + #endif + #endif + #endif + #endif +#endif + +/* + * Determine ability to inline functions. + */ +#if NiFpga_Cpp || NiFpga_C99 + /* The inline keyword exists in C++ and C99. */ +#define NiFpga_Inline inline +#elif NiFpga_Msvc + /* Visual C++ (at least since 6.0) also supports an alternate keyword. */ + #define NiFpga_Inline __inline +#elif NiFpga_Gcc + /* GCC (at least since 2.95.2) also supports an alternate keyword. */ + #define NiFpga_Inline __inline__ +#elif !defined(NiFpga_Inline) + /* + * Disable inlining if inline support is unknown. To manually enable + * inlining, #define the following macro before #including NiFpga.h: + * + * #define NiFpga_Inline inline + */ + #define NiFpga_Inline +#endif + +/* + * Define exact-width integer types, if they have not already been defined. + */ +#if NiFpga_ExactWidthIntegerTypesDefined \ + || defined(_STDINT) \ + || defined(_STDINT_H) \ + || defined(_STDINT_H_) \ + || defined(_INTTYPES_H) \ + || defined(_INTTYPES_H_) \ + || defined(_SYS_STDINT_H) \ + || defined(_SYS_STDINT_H_) \ + || defined(_SYS_INTTYPES_H) \ + || defined(_SYS_INTTYPES_H_) \ + || defined(_STDINT_H_INCLUDED) \ + || defined(_MSC_STDINT_H_) \ + || defined(_PSTDINT_H_INCLUDED) + /* Assume that exact-width integer types have already been defined. */ +#elif NiFpga_VxWorks + /* VxWorks (at least 6.3 and earlier) did not have stdint.h. */ + #include +#elif NiFpga_C99 \ + || NiFpga_Gcc /* GCC (at least since 3.0) has a stdint.h. */ \ + || defined(HAVE_STDINT_H) + /* Assume that stdint.h can be included. */ + #include +#elif NiFpga_Msvc \ + || NiFpga_Cvi + /* Manually define exact-width integer types. */ + typedef signed char int8_t; + typedef unsigned char uint8_t; + typedef short int16_t; + typedef unsigned short uint16_t; + typedef int int32_t; + typedef unsigned int uint32_t; + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +#else + /* + * Exact-width integer types must be defined by the user, and the following + * macro must be #defined, before #including NiFpga.h: + * + * #define NiFpga_ExactWidthIntegerTypesDefined 1 + */ + #error Exact-width integer types must be defined by the user. See comment. +#endif + +/* Included for definition of size_t. */ +#include + +#if NiFpga_Cpp +extern "C" +{ +#endif + +/** + * A boolean value; either NiFpga_False or NiFpga_True. + */ +typedef uint8_t NiFpga_Bool; + +/** + * Represents a false condition. + */ +static const NiFpga_Bool NiFpga_False = 0; + +/** + * Represents a true condition. + */ +static const NiFpga_Bool NiFpga_True = 1; + +/** + * Represents the resulting status of a function call through its return value. + * 0 is success, negative values are errors, and positive values are warnings. + */ +typedef int32_t NiFpga_Status; + +/** + * No errors or warnings. + */ +static const NiFpga_Status NiFpga_Status_Success = 0; + +/** + * The timeout expired before the FIFO operation could complete. + */ +static const NiFpga_Status NiFpga_Status_FifoTimeout = -50400; + +/** + * No transfer is in progress because the transfer was aborted by the client. + * The operation could not be completed as specified. + */ +static const NiFpga_Status NiFpga_Status_TransferAborted = -50405; + +/** + * A memory allocation failed. Try again after rebooting. + */ +static const NiFpga_Status NiFpga_Status_MemoryFull = -52000; + +/** + * An unexpected software error occurred. + */ +static const NiFpga_Status NiFpga_Status_SoftwareFault = -52003; + +/** + * A parameter to a function was not valid. This could be a NULL pointer, a bad + * value, etc. + */ +static const NiFpga_Status NiFpga_Status_InvalidParameter = -52005; + +/** + * A required resource was not found. The NiFpga.* library, the RIO resource, or + * some other resource may be missing. + */ +static const NiFpga_Status NiFpga_Status_ResourceNotFound = -52006; + +/** + * A required resource was not properly initialized. This could occur if + * NiFpga_Initialize was not called or a required NiFpga_IrqContext was not + * reserved. + */ +static const NiFpga_Status NiFpga_Status_ResourceNotInitialized = -52010; + +/** + * A hardware failure has occurred. The operation could not be completed as + * specified. + */ +static const NiFpga_Status NiFpga_Status_HardwareFault = -52018; + +/** + * The FPGA is already running. + */ +static const NiFpga_Status NiFpga_Status_FpgaAlreadyRunning = -61003; + +/** + * An error occurred downloading the VI to the FPGA device. Verify that + * the target is connected and powered and that the resource of the target + * is properly configured. + */ +static const NiFpga_Status NiFpga_Status_DownloadError = -61018; + +/** + * The bitfile was not compiled for the specified resource's device type. + */ +static const NiFpga_Status NiFpga_Status_DeviceTypeMismatch = -61024; + +/** + * An error was detected in the communication between the host computer and the + * FPGA target. + */ +static const NiFpga_Status NiFpga_Status_CommunicationTimeout = -61046; + +/** + * The timeout expired before any of the IRQs were asserted. + */ +static const NiFpga_Status NiFpga_Status_IrqTimeout = -61060; + +/** + * The specified bitfile is invalid or corrupt. + */ +static const NiFpga_Status NiFpga_Status_CorruptBitfile = -61070; + +/** + * The requested FIFO depth is invalid. It is either 0 or an amount not + * supported by the hardware. + */ +static const NiFpga_Status NiFpga_Status_BadDepth = -61072; + +/** + * The number of FIFO elements is invalid. Either the number is greater than the + * depth of the host memory DMA FIFO, or more elements were requested for + * release than had been acquired. + */ +static const NiFpga_Status NiFpga_Status_BadReadWriteCount = -61073; + +/** + * A hardware clocking error occurred. A derived clock lost lock with its base + * clock during the execution of the LabVIEW FPGA VI. If any base clocks with + * derived clocks are referencing an external source, make sure that the + * external source is connected and within the supported frequency, jitter, + * accuracy, duty cycle, and voltage specifications. Also verify that the + * characteristics of the base clock match the configuration specified in the + * FPGA Base Clock Properties. If all base clocks with derived clocks are + * generated from free-running, on-board sources, please contact National + * Instruments technical support at ni.com/support. + */ +static const NiFpga_Status NiFpga_Status_ClockLostLock = -61083; + +/** + * The operation could not be performed because the FPGA is busy. Stop all + * activities on the FPGA before requesting this operation. If the target is in + * Scan Interface programming mode, put it in FPGA Interface programming mode. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusy = -61141; + +/** + * The operation could not be performed because the FPGA is busy operating in + * FPGA Interface C API mode. Stop all activities on the FPGA before requesting + * this operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterfaceCApi = -61200; + +/** + * The chassis is in Scan Interface programming mode. In order to run FPGA VIs, + * you must go to the chassis properties page, select FPGA programming mode, and + * deploy settings. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyScanInterface = -61201; + +/** + * The operation could not be performed because the FPGA is busy operating in + * FPGA Interface mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyFpgaInterface = -61202; + +/** + * The operation could not be performed because the FPGA is busy operating in + * Interactive mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyInteractive = -61203; + +/** + * The operation could not be performed because the FPGA is busy operating in + * Emulation mode. Stop all activities on the FPGA before requesting this + * operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyEmulation = -61204; + +/** + * LabVIEW FPGA does not support the Reset method for bitfiles that allow + * removal of implicit enable signals in single-cycle Timed Loops. + */ +static const NiFpga_Status NiFpga_Status_ResetCalledWithImplicitEnableRemoval = -61211; + +/** + * LabVIEW FPGA does not support the Abort method for bitfiles that allow + * removal of implicit enable signals in single-cycle Timed Loops. + */ +static const NiFpga_Status NiFpga_Status_AbortCalledWithImplicitEnableRemoval = -61212; + +/** + * LabVIEW FPGA does not support Close and Reset if Last Reference for bitfiles + * that allow removal of implicit enable signals in single-cycle Timed Loops. + * Pass the NiFpga_CloseAttribute_NoResetIfLastSession attribute to NiFpga_Close + * instead of 0. + */ +static const NiFpga_Status NiFpga_Status_CloseAndResetCalledWithImplicitEnableRemoval = -61213; + +/** + * For bitfiles that allow removal of implicit enable signals in single-cycle + * Timed Loops, LabVIEW FPGA does not support this method prior to running the + * bitfile. + */ +static const NiFpga_Status NiFpga_Status_ImplicitEnableRemovalButNotYetRun = -61214; + +/** + * Bitfiles that allow removal of implicit enable signals in single-cycle Timed + * Loops can run only once. Download the bitfile again before re-running the VI. + */ +static const NiFpga_Status NiFpga_Status_RunAfterStoppedCalledWithImplicitEnableRemoval = -61215; + +/** + * A gated clock has violated the handshaking protocol. If you are using + * external gated clocks, ensure that they follow the required clock gating + * protocol. If you are generating your clocks internally, please contact + * National Instruments Technical Support. + */ +static const NiFpga_Status NiFpga_Status_GatedClockHandshakingViolation = -61216; + +/** + * The number of elements requested must be less than or equal to the number of + * unacquired elements left in the host memory DMA FIFO. There are currently + * fewer unacquired elements left in the FIFO than are being requested. Release + * some acquired elements before acquiring more elements. + */ +static const NiFpga_Status NiFpga_Status_ElementsNotPermissibleToBeAcquired = -61219; + +/** + * The operation could not be performed because the FPGA is in configuration or + * discovery mode. Wait for configuration or discovery to complete and retry + * your operation. + */ +static const NiFpga_Status NiFpga_Status_FpgaBusyConfiguration = -61252; + +/** + * An unexpected internal error occurred. + */ +static const NiFpga_Status NiFpga_Status_InternalError = -61499; + +/** + * The NI-RIO driver was unable to allocate memory for a FIFO. This can happen + * when the combined depth of all DMA FIFOs exceeds the maximum depth for the + * controller, or when the controller runs out of system memory. You may be able + * to reconfigure the controller with a greater maximum FIFO depth. For more + * information, refer to the NI KnowledgeBase article 65OF2ERQ. + */ +static const NiFpga_Status NiFpga_Status_TotalDmaFifoDepthExceeded = -63003; + +/** + * Access to the remote system was denied. Use MAX to check the Remote Device + * Access settings under Software>>NI-RIO>>NI-RIO Settings on the remote system. + */ +static const NiFpga_Status NiFpga_Status_AccessDenied = -63033; + +/** + * The NI-RIO software on the host is not compatible with the software on the + * target. Upgrade the NI-RIO software on the host in order to connect to this + * target. + */ +static const NiFpga_Status NiFpga_Status_HostVersionMismatch = -63038; + +/** + * A connection could not be established to the specified remote device. Ensure + * that the device is on and accessible over the network, that NI-RIO software + * is installed, and that the RIO server is running and properly configured. + */ +static const NiFpga_Status NiFpga_Status_RpcConnectionError = -63040; + +/** + * The RPC session is invalid. The target may have reset or been rebooted. Check + * the network connection and retry the operation. + */ +static const NiFpga_Status NiFpga_Status_RpcSessionError = -63043; + +/** + * The operation could not complete because another session is accessing the + * FIFO. Close the other session and retry. + */ +static const NiFpga_Status NiFpga_Status_FifoReserved = -63082; + +/** + * A Configure FIFO, Stop FIFO, Read FIFO, or Write FIFO function was called + * while the host had acquired elements of the FIFO. Release all acquired + * elements before configuring, stopping, reading, or writing. + */ +static const NiFpga_Status NiFpga_Status_FifoElementsCurrentlyAcquired = -63083; + +/** + * A function was called using a misaligned address. The address must be a + * multiple of the size of the datatype. + */ +static const NiFpga_Status NiFpga_Status_MisalignedAccess = -63084; + +/** + * The FPGA Read/Write Control Function is accessing a control or indicator + * with data that exceeds the maximum size supported on the current target. + * Refer to the hardware documentation for the limitations on data types for + * this target. + */ +static const NiFpga_Status NiFpga_Status_ControlOrIndicatorTooLarge = -63085; + +/** + * A valid .lvbitx bitfile is required. If you are using a valid .lvbitx + * bitfile, the bitfile may not be compatible with the software you are using. + * Determine which version of LabVIEW was used to make the bitfile, update your + * software to that version or later, and try again. + */ +static const NiFpga_Status NiFpga_Status_BitfileReadError = -63101; + +/** + * The specified signature does not match the signature of the bitfile. If the + * bitfile has been recompiled, regenerate the C API and rebuild the + * application. + */ +static const NiFpga_Status NiFpga_Status_SignatureMismatch = -63106; + +/** + * The bitfile you are trying to use is incompatible with the version + * of NI-RIO installed on the target and/or host. Update the version + * of NI-RIO on the target and/or host to the same version (or later) + * used to compile the bitfile. Alternatively, recompile the bitfile + * with the same version of NI-RIO that is currently installed on the + * target and/or host. + */ +static const NiFpga_Status NiFpga_Status_IncompatibleBitfile = -63107; + +/** + * Either the supplied resource name is invalid as a RIO resource name, or the + * device was not found. Use MAX to find the proper resource name for the + * intended device. + */ +static const NiFpga_Status NiFpga_Status_InvalidResourceName = -63192; + +/** + * The requested feature is not supported. + */ +static const NiFpga_Status NiFpga_Status_FeatureNotSupported = -63193; + +/** + * The NI-RIO software on the target system is not compatible with this + * software. Upgrade the NI-RIO software on the target system. + */ +static const NiFpga_Status NiFpga_Status_VersionMismatch = -63194; + +/** + * The session is invalid or has been closed. + */ +static const NiFpga_Status NiFpga_Status_InvalidSession = -63195; + +/** + * The maximum number of open FPGA sessions has been reached. Close some open + * sessions. + */ +static const NiFpga_Status NiFpga_Status_OutOfHandles = -63198; + +/** + * Tests whether a status is an error. + * + * @param status status to check for an error + * @return whether the status was an error + */ +static NiFpga_Inline NiFpga_Bool NiFpga_IsError(const NiFpga_Status status) +{ + return status < NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +} + +/** + * Tests whether a status is not an error. Success and warnings are not errors. + * + * @param status status to check for an error + * @return whether the status was a success or warning + */ +static NiFpga_Inline NiFpga_Bool NiFpga_IsNotError(const NiFpga_Status status) +{ + return status >= NiFpga_Status_Success ? NiFpga_True : NiFpga_False; +} + +/** + * Conditionally sets the status to a new value. The previous status is + * preserved unless the new status is more of an error, which means that + * warnings and errors overwrite successes, and errors overwrite warnings. New + * errors do not overwrite older errors, and new warnings do not overwrite + * older warnings. + * + * @param status status to conditionally set + * @param newStatus new status value that may be set + * @return the resulting status + */ +static NiFpga_Inline NiFpga_Status NiFpga_MergeStatus( + NiFpga_Status* const status, + const NiFpga_Status newStatus) +{ + if (!status) + return NiFpga_Status_InvalidParameter; + if (NiFpga_IsNotError(*status) + && (*status == NiFpga_Status_Success || NiFpga_IsError(newStatus))) + *status = newStatus; + return *status; +} + +/** + * This macro evaluates the expression only if the status is not an error. The + * expression must evaluate to an NiFpga_Status, such as a call to any NiFpga_* + * function, because the status will be set to the returned status if the + * expression is evaluated. + * + * You can use this macro to mimic status chaining in LabVIEW, where the status + * does not have to be explicitly checked after each call. Such code may look + * like the following example. + * + * NiFpga_Status status = NiFpga_Status_Success; + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * NiFpga_IfIsNotError(status, NiFpga_WriteU32(...)); + * + * @param status status to check for an error + * @param expression expression to call if the incoming status is not an error + */ +#define NiFpga_IfIsNotError(status, expression) \ + if (NiFpga_IsNotError(status)) \ + NiFpga_MergeStatus(&status, (expression)); \ + +/** + * You must call this function before all other function calls. This function + * loads the NiFpga library so that all the other functions will work. If this + * function succeeds, you must call NiFpga_Finalize after all other function + * calls. + * + * @warning This function is not thread safe. + * + * @return result of the call + */ +NiFpga_Status NiFpga_Initialize(void); + +/** + * You must call this function after all other function calls if + * NiFpga_Initialize succeeds. This function unloads the NiFpga library. + * + * @warning This function is not thread safe. + * + * @return result of the call + */ +NiFpga_Status NiFpga_Finalize(void); + +/** + * A handle to an FPGA session. + */ +typedef uint32_t NiFpga_Session; + +/** + * Attributes that NiFpga_Open accepts. + */ +typedef enum +{ + NiFpga_OpenAttribute_NoRun = 1 +} NiFpga_OpenAttribute; + +/** + * Opens a session to the FPGA. This call ensures that the contents of the + * bitfile are programmed to the FPGA. The FPGA runs unless the + * NiFpga_OpenAttribute_NoRun attribute is used. + * + * Because different operating systems have different default current working + * directories for applications, you must pass an absolute path for the bitfile + * parameter. If you pass only the filename instead of an absolute path, the + * operating system may not be able to locate the bitfile. For example, the + * default current working directories are C:\ni-rt\system\ for Phar Lap ETS and + * /c/ for VxWorks. Because the generated *_Bitfile constant is a #define to a + * string literal, you can use C/C++ string-literal concatenation to form an + * absolute path. For example, if the bitfile is in the root directory of a + * Phar Lap ETS system, pass the following for the bitfile parameter. + * + * "C:\\" NiFpga_MyApplication_Bitfile + * + * @param bitfile path to the bitfile + * @param signature signature of the bitfile + * @param resource RIO resource string to open ("RIO0" or "rio://mysystem/RIO") + * @param attribute bitwise OR of any NiFpga_OpenAttributes, or 0 + * @param session outputs the session handle, which must be closed when no + * longer needed + * @return result of the call + */ +NiFpga_Status NiFpga_Open(const char* bitfile, + const char* signature, + const char* resource, + uint32_t attribute, + NiFpga_Session* session); + +/** + * Attributes that NiFpga_Close accepts. + */ +typedef enum +{ + NiFpga_CloseAttribute_NoResetIfLastSession = 1 +} NiFpga_CloseAttribute; + +/** + * Closes the session to the FPGA. The FPGA resets unless either another session + * is still open or you use the NiFpga_CloseAttribute_NoResetIfLastSession + * attribute. + * + * @param session handle to a currently open session + * @param attribute bitwise OR of any NiFpga_CloseAttributes, or 0 + * @return result of the call + */ +NiFpga_Status NiFpga_Close(NiFpga_Session session, + uint32_t attribute); + +/** + * Attributes that NiFpga_Run accepts. + */ +typedef enum +{ + NiFpga_RunAttribute_WaitUntilDone = 1 +} NiFpga_RunAttribute; + +/** + * Runs the FPGA VI on the target. If you use NiFpga_RunAttribute_WaitUntilDone, + * NiFpga_Run blocks the thread until the FPGA finishes running. + * + * @param session handle to a currently open session + * @param attribute bitwise OR of any NiFpga_RunAttributes, or 0 + * @return result of the call + */ +NiFpga_Status NiFpga_Run(NiFpga_Session session, + uint32_t attribute); + +/** + * Aborts the FPGA VI. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Abort(NiFpga_Session session); + +/** + * Resets the FPGA VI. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Reset(NiFpga_Session session); + +/** + * Re-downloads the FPGA bitstream to the target. + * + * @param session handle to a currently open session + * @return result of the call + */ +NiFpga_Status NiFpga_Download(NiFpga_Session session); + +/** + * Reads a boolean value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadBool(NiFpga_Session session, + uint32_t indicator, + NiFpga_Bool* value); + +/** + * Reads a signed 8-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI8(NiFpga_Session session, + uint32_t indicator, + int8_t* value); + +/** + * Reads an unsigned 8-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU8(NiFpga_Session session, + uint32_t indicator, + uint8_t* value); + +/** + * Reads a signed 16-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI16(NiFpga_Session session, + uint32_t indicator, + int16_t* value); + +/** + * Reads an unsigned 16-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU16(NiFpga_Session session, + uint32_t indicator, + uint16_t* value); + +/** + * Reads a signed 32-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI32(NiFpga_Session session, + uint32_t indicator, + int32_t* value); + +/** + * Reads an unsigned 32-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU32(NiFpga_Session session, + uint32_t indicator, + uint32_t* value); + +/** + * Reads a signed 64-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadI64(NiFpga_Session session, + uint32_t indicator, + int64_t* value); + +/** + * Reads an unsigned 64-bit integer value from a given indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param value outputs the value that was read + * @return result of the call + */ +NiFpga_Status NiFpga_ReadU64(NiFpga_Session session, + uint32_t indicator, + uint64_t* value); + +/** + * Writes a boolean value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteBool(NiFpga_Session session, + uint32_t control, + NiFpga_Bool value); + +/** + * Writes a signed 8-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI8(NiFpga_Session session, + uint32_t control, + int8_t value); + +/** + * Writes an unsigned 8-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU8(NiFpga_Session session, + uint32_t control, + uint8_t value); + +/** + * Writes a signed 16-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI16(NiFpga_Session session, + uint32_t control, + int16_t value); + +/** + * Writes an unsigned 16-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU16(NiFpga_Session session, + uint32_t control, + uint16_t value); + +/** + * Writes a signed 32-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI32(NiFpga_Session session, + uint32_t control, + int32_t value); + +/** + * Writes an unsigned 32-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU32(NiFpga_Session session, + uint32_t control, + uint32_t value); + +/** + * Writes a signed 64-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteI64(NiFpga_Session session, + uint32_t control, + int64_t value); + +/** + * Writes an unsigned 64-bit integer value to a given control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param value value to write + * @return result of the call + */ +NiFpga_Status NiFpga_WriteU64(NiFpga_Session session, + uint32_t control, + uint64_t value); + +/** + * Reads an entire array of boolean values from a given array indicator or + * control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayBool(NiFpga_Session session, + uint32_t indicator, + NiFpga_Bool* array, + size_t size); + +/** + * Reads an entire array of signed 8-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI8(NiFpga_Session session, + uint32_t indicator, + int8_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 8-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU8(NiFpga_Session session, + uint32_t indicator, + uint8_t* array, + size_t size); + +/** + * Reads an entire array of signed 16-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI16(NiFpga_Session session, + uint32_t indicator, + int16_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 16-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU16(NiFpga_Session session, + uint32_t indicator, + uint16_t* array, + size_t size); + +/** + * Reads an entire array of signed 32-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI32(NiFpga_Session session, + uint32_t indicator, + int32_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 32-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU32(NiFpga_Session session, + uint32_t indicator, + uint32_t* array, + size_t size); + +/** + * Reads an entire array of signed 64-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayI64(NiFpga_Session session, + uint32_t indicator, + int64_t* array, + size_t size); + +/** + * Reads an entire array of unsigned 64-bit integer values from a given array + * indicator or control. + * + * @warning The size passed must be the exact number of elements in the + * indicator or control. + * + * @param session handle to a currently open session + * @param indicator indicator or control from which to read + * @param array outputs the entire array that was read + * @param size exact number of elements in the indicator or control + * @return result of the call + */ +NiFpga_Status NiFpga_ReadArrayU64(NiFpga_Session session, + uint32_t indicator, + uint64_t* array, + size_t size); + +/** + * Writes an entire array of boolean values to a given array control or + * indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayBool(NiFpga_Session session, + uint32_t control, + const NiFpga_Bool* array, + size_t size); + +/** + * Writes an entire array of signed 8-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI8(NiFpga_Session session, + uint32_t control, + const int8_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 8-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU8(NiFpga_Session session, + uint32_t control, + const uint8_t* array, + size_t size); + +/** + * Writes an entire array of signed 16-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI16(NiFpga_Session session, + uint32_t control, + const int16_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 16-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU16(NiFpga_Session session, + uint32_t control, + const uint16_t* array, + size_t size); + +/** + * Writes an entire array of signed 32-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI32(NiFpga_Session session, + uint32_t control, + const int32_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 32-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU32(NiFpga_Session session, + uint32_t control, + const uint32_t* array, + size_t size); + +/** + * Writes an entire array of signed 64-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayI64(NiFpga_Session session, + uint32_t control, + const int64_t* array, + size_t size); + +/** + * Writes an entire array of unsigned 64-bit integer values to a given array + * control or indicator. + * + * @warning The size passed must be the exact number of elements in the + * control or indicator. + * + * @param session handle to a currently open session + * @param control control or indicator to which to write + * @param array entire array to write + * @param size exact number of elements in the control or indicator + * @return result of the call + */ +NiFpga_Status NiFpga_WriteArrayU64(NiFpga_Session session, + uint32_t control, + const uint64_t* array, + size_t size); + +/** + * Enumeration of all 32 possible IRQs. Multiple IRQs can be bitwise ORed + * together like this: + * + * NiFpga_Irq_3 | NiFpga_Irq_23 + */ +typedef enum +{ + NiFpga_Irq_0 = 1 << 0, + NiFpga_Irq_1 = 1 << 1, + NiFpga_Irq_2 = 1 << 2, + NiFpga_Irq_3 = 1 << 3, + NiFpga_Irq_4 = 1 << 4, + NiFpga_Irq_5 = 1 << 5, + NiFpga_Irq_6 = 1 << 6, + NiFpga_Irq_7 = 1 << 7, + NiFpga_Irq_8 = 1 << 8, + NiFpga_Irq_9 = 1 << 9, + NiFpga_Irq_10 = 1 << 10, + NiFpga_Irq_11 = 1 << 11, + NiFpga_Irq_12 = 1 << 12, + NiFpga_Irq_13 = 1 << 13, + NiFpga_Irq_14 = 1 << 14, + NiFpga_Irq_15 = 1 << 15, + NiFpga_Irq_16 = 1 << 16, + NiFpga_Irq_17 = 1 << 17, + NiFpga_Irq_18 = 1 << 18, + NiFpga_Irq_19 = 1 << 19, + NiFpga_Irq_20 = 1 << 20, + NiFpga_Irq_21 = 1 << 21, + NiFpga_Irq_22 = 1 << 22, + NiFpga_Irq_23 = 1 << 23, + NiFpga_Irq_24 = 1 << 24, + NiFpga_Irq_25 = 1 << 25, + NiFpga_Irq_26 = 1 << 26, + NiFpga_Irq_27 = 1 << 27, + NiFpga_Irq_28 = 1 << 28, + NiFpga_Irq_29 = 1 << 29, + NiFpga_Irq_30 = 1 << 30, + NiFpga_Irq_31 = 1U << 31 +} NiFpga_Irq; + +/** + * Represents an infinite timeout. + */ +static const uint32_t NiFpga_InfiniteTimeout = 0xFFFFFFFF; + +/** + * See NiFpga_ReserveIrqContext for more information. + */ +typedef void* NiFpga_IrqContext; + +/** + * IRQ contexts are single-threaded; only one thread can wait with a + * particular context at any given time. To minimize jitter when first + * waiting on IRQs, reserve as many contexts as the application + * requires. + * + * If a context is successfully reserved (the returned status is not an error), + * it must be unreserved later. Otherwise a memory leak will occur. + * + * @param session handle to a currently open session + * @param context outputs the IRQ context + * @return result of the call + */ +NiFpga_Status NiFpga_ReserveIrqContext(NiFpga_Session session, + NiFpga_IrqContext* context); + +/** + * Unreserves an IRQ context obtained from NiFpga_ReserveIrqContext. + * + * @param session handle to a currently open session + * @param context IRQ context to unreserve + * @return result of the call + */ +NiFpga_Status NiFpga_UnreserveIrqContext(NiFpga_Session session, + NiFpga_IrqContext context); + +/** + * This is a blocking function that stops the calling thread until the + * FPGA asserts any IRQ in the irqs parameter, or until the function + * call times out. Before calling this function, use + * NiFpga_ReserveIrqContext to reserve an IRQ context. No other + * threads can use the same context when this function is called. + * + * You can use the irqsAsserted parameter to determine which IRQs were asserted + * for each function call. + * + * @param session handle to a currently open session + * @param context IRQ context with which to wait + * @param irqs bitwise OR of NiFpga_Irqs + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param irqsAsserted if non-NULL, outputs bitwise OR of IRQs that were + * asserted + * @param timedOut if non-NULL, outputs whether the timeout expired + * @return result of the call + */ +NiFpga_Status NiFpga_WaitOnIrqs(NiFpga_Session session, + NiFpga_IrqContext context, + uint32_t irqs, + uint32_t timeout, + uint32_t* irqsAsserted, + NiFpga_Bool* timedOut); + +/** + * Acknowledges an IRQ or set of IRQs. + * + * @param session handle to a currently open session + * @param irqs bitwise OR of NiFpga_Irqs + * @return result of the call + */ +NiFpga_Status NiFpga_AcknowledgeIrqs(NiFpga_Session session, + uint32_t irqs); + +/** + * Specifies the depth of the host memory part of the DMA FIFO. This method is + * optional. In order to see the actual depth configured, use + * NiFpga_ConfigureFifo2. + * + * @param session handle to a currently open session + * @param fifo FIFO to configure + * @param depth requested number of elements in the host memory part of the + * DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ConfigureFifo(NiFpga_Session session, + uint32_t fifo, + size_t depth); + +/** + * Specifies the depth of the host memory part of the DMA FIFO. This method is + * optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to configure + * @param requestedDepth requested number of elements in the host memory part + * of the DMA FIFO + * @param actualDepth if non-NULL, outputs the actual number of elements in the + * host memory part of the DMA FIFO, which may be more than + * the requested number + * @return result of the call + */ +NiFpga_Status NiFpga_ConfigureFifo2(NiFpga_Session session, + uint32_t fifo, + size_t requestedDepth, + size_t* actualDepth); + +/** + * Starts a FIFO. This method is optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to start + * @return result of the call + */ +NiFpga_Status NiFpga_StartFifo(NiFpga_Session session, + uint32_t fifo); + +/** + * Stops a FIFO. This method is optional. + * + * @param session handle to a currently open session + * @param fifo FIFO to stop + * @return result of the call + */ +NiFpga_Status NiFpga_StopFifo(NiFpga_Session session, + uint32_t fifo); + +/** + * Reads from a target-to-host FIFO of booleans. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoBool(NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI8(NiFpga_Session session, + uint32_t fifo, + int8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU8(NiFpga_Session session, + uint32_t fifo, + uint8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI16(NiFpga_Session session, + uint32_t fifo, + int16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU16(NiFpga_Session session, + uint32_t fifo, + uint16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI32(NiFpga_Session session, + uint32_t fifo, + int32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU32(NiFpga_Session session, + uint32_t fifo, + uint32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of signed 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoI64(NiFpga_Session session, + uint32_t fifo, + int64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Reads from a target-to-host FIFO of unsigned 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param data outputs the data that was read + * @param numberOfElements number of elements to read + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_ReadFifoU64(NiFpga_Session session, + uint32_t fifo, + uint64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* elementsRemaining); + +/** + * Writes to a host-to-target FIFO of booleans. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoBool(NiFpga_Session session, + uint32_t fifo, + const NiFpga_Bool* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI8(NiFpga_Session session, + uint32_t fifo, + const int8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 8-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU8(NiFpga_Session session, + uint32_t fifo, + const uint8_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI16(NiFpga_Session session, + uint32_t fifo, + const int16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 16-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU16(NiFpga_Session session, + uint32_t fifo, + const uint16_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI32(NiFpga_Session session, + uint32_t fifo, + const int32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 32-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU32(NiFpga_Session session, + uint32_t fifo, + const uint32_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of signed 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoI64(NiFpga_Session session, + uint32_t fifo, + const int64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Writes to a host-to-target FIFO of unsigned 64-bit integers. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param data data to write + * @param numberOfElements number of elements to write + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param emptyElementsRemaining if non-NULL, outputs the number of empty + * elements remaining in the host memory part of + * the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_WriteFifoU64(NiFpga_Session session, + uint32_t fifo, + const uint64_t* data, + size_t numberOfElements, + uint32_t timeout, + size_t* emptyElementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of booleans. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsBool( + NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 8-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI8( + NiFpga_Session session, + uint32_t fifo, + int8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 8-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU8( + NiFpga_Session session, + uint32_t fifo, + uint8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 16-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI16( + NiFpga_Session session, + uint32_t fifo, + int16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 16-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU16( + NiFpga_Session session, + uint32_t fifo, + uint16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 32-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI32( + NiFpga_Session session, + uint32_t fifo, + int32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 32-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU32( + NiFpga_Session session, + uint32_t fifo, + uint32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of signed 64-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsI64( + NiFpga_Session session, + uint32_t fifo, + int64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for reading from a target-to-host FIFO of unsigned 64-bit + * integers. + * + * Acquiring, reading, and releasing FIFO elements prevents the need to copy + * the contents of elements from the host memory buffer to a separate + * user-allocated buffer before reading. The FPGA target cannot write to + * elements acquired by the host. Therefore, the host must release elements + * after reading them. The number of elements acquired may differ from the + * number of elements requested if, for example, the number of elements + * requested reaches the end of the host memory buffer. Always release all + * acquired elements before closing the session. Do not attempt to access FIFO + * elements after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo target-to-host FIFO from which to read + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoReadElementsU64( + NiFpga_Session session, + uint32_t fifo, + uint64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of booleans. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsBool( + NiFpga_Session session, + uint32_t fifo, + NiFpga_Bool** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 8-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI8( + NiFpga_Session session, + uint32_t fifo, + int8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 8-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU8( + NiFpga_Session session, + uint32_t fifo, + uint8_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 16-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI16( + NiFpga_Session session, + uint32_t fifo, + int16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 16-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU16( + NiFpga_Session session, + uint32_t fifo, + uint16_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 32-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI32( + NiFpga_Session session, + uint32_t fifo, + int32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 32-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU32( + NiFpga_Session session, + uint32_t fifo, + uint32_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of signed 64-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsI64( + NiFpga_Session session, + uint32_t fifo, + int64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Acquires elements for writing to a host-to-target FIFO of unsigned 64-bit + * integers. + * + * Acquiring, writing, and releasing FIFO elements prevents the need to write + * first into a separate user-allocated buffer and then copy the contents of + * elements to the host memory buffer. The FPGA target cannot read elements + * acquired by the host. Therefore, the host must release elements after + * writing to them. The number of elements acquired may differ from the number + * of elements requested if, for example, the number of elements requested + * reaches the end of the host memory buffer. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo host-to-target FIFO to which to write + * @param elements outputs a pointer to the elements acquired + * @param elementsRequested requested number of elements + * @param timeout timeout in milliseconds, or NiFpga_InfiniteTimeout + * @param elementsAcquired actual number of elements acquired, which may be + * less than the requested number + * @param elementsRemaining if non-NULL, outputs the number of elements + * remaining in the host memory part of the DMA FIFO + * @return result of the call + */ +NiFpga_Status NiFpga_AcquireFifoWriteElementsU64( + NiFpga_Session session, + uint32_t fifo, + uint64_t** elements, + size_t elementsRequested, + uint32_t timeout, + size_t* elementsAcquired, + size_t* elementsRemaining); + +/** + * Releases previously acquired FIFO elements. + * + * The FPGA target cannot read elements acquired by the host. Therefore, the + * host must release elements after acquiring them. Always release all acquired + * elements before closing the session. Do not attempt to access FIFO elements + * after the elements are released or the session is closed. + * + * @param session handle to a currently open session + * @param fifo FIFO from which to release elements + * @param elements number of elements to release + * @return result of the call + */ +NiFpga_Status NiFpga_ReleaseFifoElements(NiFpga_Session session, + uint32_t fifo, + size_t elements); + +/** + * Gets an endpoint reference to a peer-to-peer FIFO. + * + * @param session handle to a currently open session + * @param fifo peer-to-peer FIFO + * @param endpoint outputs the endpoint reference + * @return result of the call + */ +NiFpga_Status NiFpga_GetPeerToPeerFifoEndpoint(NiFpga_Session session, + uint32_t fifo, + uint32_t* endpoint); + +#if NiFpga_Cpp +} +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/frccansae/CANDeviceInterface.h b/Robot2016/wpilib/cpp/current/include/frccansae/CANDeviceInterface.h new file mode 100644 index 0000000..8fe4235 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/frccansae/CANDeviceInterface.h @@ -0,0 +1,156 @@ +#ifndef __CAN_DEVICE_INTERFACE_H__ +#define __CAN_DEVICE_INTERFACE_H__ + +#define MAX_STRING_LEN 64 + +#define SUPPORT_UNIQUE_ID (1) /* depends entirely on old vs new build */ +#define USE_NTH_ORDER (0) /* zero to user deviceId */ +#define SUPPORT_MOTOR_CONTROLLER_PROFILE (1) +namespace CANDeviceInterface1 +{ + +struct PIDSlot +{ + // Proportional gain + float pGain; + // Integral gain + float iGain; + // Differential gain + float dGain; + // Feed-forward gain + float fGain; + // Integral zone + float iZone; + // Closed-loop ramp rate + float clRampRate; +}; + +struct DeviceDescriptor +{ + // The full device ID, including the device number, manufacturer, and device type. + // The mask of a message the device supports is 0x1FFF003F. + unsigned int deviceID; +#if SUPPORT_UNIQUE_ID != 0 + // This is the ID that uniquely identifies the device node in the UI. + // The purpose of this is to be able to track the device across renames or deviceID changes. + unsigned int uniqueID; +#endif + // An dynamically assigned ID that will make setting deviceIDs robust, + // Never again will you need to isolate a CAN node just to fix it's ID. + unsigned int dynamicID; + // User visible name. This can be customized by the user, but should have a + // reasonable default. + char name[MAX_STRING_LEN]; + // This is a user visible model name that should match the can_devices.ini section. + char model[MAX_STRING_LEN]; + // This is a version number that represents the version of firmware currently + // installed on the device. + char currentVersion[MAX_STRING_LEN]; + // Hardware revision. + char hardwareRev[MAX_STRING_LEN]; + // Bootloader version. Will not change for the life of the product, but additional + // field upgrade features could be added in newer hardware. + char bootloaderRev[MAX_STRING_LEN]; + // Manufacture Date. Could be a calender date or just the FRC season year. + // Also helps troubleshooting "old ones" vs "new ones". + char manufactureDate[MAX_STRING_LEN]; + // General status of the hardware. For example if the device is in bootloader + // due to a bad flash UI could emphasize that. + char softwareStatus[MAX_STRING_LEN]; + // Is the LED currently on? + bool led; + // Reserved fields for future use by CTRE. Not touched by frccansae + unsigned int dynFlags; + unsigned int flags; /* bitfield */ + unsigned int ptrToString; + //unsigned int reserved0; + //unsigned int reserved1; + //unsigned int reserved2; +#if SUPPORT_MOTOR_CONTROLLER_PROFILE != 0 + // Motor controller properties (ignored if SupportsMotorControllerProperties is false or unset for this model) + unsigned int brakeMode; // 0=Coast, 1=Brake + unsigned int limitSwitchFwdMode; // 0=disabled, 1=Normally Closed, 2=Normally Open + unsigned int limitSwitchRevMode; // 0=disabled, 1=Normally Closed, 2=Normally Open + // Limit-switch soft limits + bool bFwdSoftLimitEnable; + bool bRevSoftLimitEnable; + float softLimitFwd; + float softLimitRev; + // PID constants for slot 0 + struct PIDSlot slot0; + // PID constants for slot 1 + struct PIDSlot slot1; +#endif +}; + +#define kLimitSwitchMode_Disabled (0) +#define kLimitSwitchMode_NormallyClosed (1) +#define kLimitSwitchMode_NormallyOpen (2) + +// Interface functions that must be implemented by the CAN Firmware Update Library + +// Returns the number of devices that will be returned in a call to +// getListOfDevices(). The calling library will use this info to allocate enough +// memory to accept all device info. +int getNumberOfDevices(); + +// Return info about discovered devices. The array of structs should be +// populated before returning. The numDescriptors input describes how many +// elements were allocated to prevent memory corruption. The number of devices +// populated should be returned from this function as well. +int getListOfDevices(DeviceDescriptor *devices, int numDescriptors); + +// When the user requests to update the firmware of a device a thread will be +// spawned and this function is called from that thread. This function should +// complete the firmware update process before returning. The image +// contents and size are directly from the file selected by the user. The +// error message string can be filled with a NULL-terminated message to show the +// user if there was a problem updating firmware. The error message is only +// displayed if a non-zero value is returned from this function. +int updateFirmware(const DeviceDescriptor *device, const unsigned char *imageContents, unsigned int imageSize, char *errorMessage, int errorMessageMaxSize); + +// This function is called periodically from the UI thread while the firmware +// update is in progress. The percentComplete parameter should the filled in +// with the current progress of the firmware update process to update a progress +// bar in the UI. +void checkUpdateProgress(const DeviceDescriptor *device, int *percentComplete); + +// This is called when the user selects a new ID to assign on the bus and +// chooses to save. The newDeviceID is really just the device number. The +// manufacturer and device type will remain unchanged. If a problem is detected +// when assigning a new ID, this function should return a non-zero value. +int assignBroadcastDeviceID(unsigned int newDeviceID); +// The device descriptor should be updated with the new device ID. The name may +// also change in the descriptor and will be updated in the UI immediately. +// Be sure to modify the descriptor first since the refresh from the UI is +// asynchronous. +int assignDeviceID(DeviceDescriptor *device, unsigned int newDeviceID); + +// This entry-point will get called when the user chooses to change the value +// of the device's LED. This will allow the user to identify devices which +// support dynamic addresses or are otherwise unknown. If this function returns +// a non-zero value, the UI will report an error. +int saveLightLed(const DeviceDescriptor *device, bool newLEDStatus); + +// This entry-point will get called when the user chooses to change the alias +// of the device with the device specified. If this function returns a non- +// zero value, the UI will report an error. The device descriptor must be +// updated with the new name that was selected. If a different name is saved +// to the descriptor than the user specified, this will require a manual +// refresh by the user. This is reported as CAR #505139 +int saveDeviceName(DeviceDescriptor *device, const char *newName); + +// This entry-point will get called when the user changes any of the motor +// controller specific properties. If this function returns a non-zero value, +// the UI will report an error. The device descriptor may be updated with +// coerced values. +int saveMotorParameters(DeviceDescriptor *device); + +// Run some sort of self-test functionality on the device. This can be anything +// and the results will be displayed to the user. A non-zero return value +// indicates an error. +int selfTest(const DeviceDescriptor *device, char *detailedResults, int detailedResultsMaxSize); + +} /* CANDeviceInterface */ + +#endif /* __CAN_DEVICE_INTERFACE_H__ */ diff --git a/Robot2016/wpilib/cpp/current/include/i2clib/i2c-lib.h b/Robot2016/wpilib/cpp/current/include/i2clib/i2c-lib.h new file mode 100644 index 0000000..cd893aa --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/i2clib/i2c-lib.h @@ -0,0 +1,16 @@ +#ifndef __I2C_LIB_H__ +#define __I2C_LIB_H__ + +#ifdef __cplusplus +extern "C" { +#endif +int i2clib_open(const char *device); +void i2clib_close(int handle); +int i2clib_read(int handle, uint8_t dev_addr, char *recv_buf, int32_t recv_size); +int i2clib_write(int handle, uint8_t dev_addr, const char *send_buf, int32_t send_size); +int i2clib_writeread(int handle, uint8_t dev_addr, const char *send_buf, int32_t send_size, char *recv_buf, int32_t recv_size); +#ifdef __cplusplus +} +#endif + +#endif /* __I2C_LIB_H__ */ \ No newline at end of file diff --git a/Robot2016/wpilib/cpp/current/include/interfaces/Accelerometer.h b/Robot2016/wpilib/cpp/current/include/interfaces/Accelerometer.h new file mode 100644 index 0000000..12296ca --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/interfaces/Accelerometer.h @@ -0,0 +1,47 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 + +/** + * Interface for 3-axis accelerometers + */ +class Accelerometer { + public: + virtual ~Accelerometer() = default; + + enum Range { kRange_2G = 0, kRange_4G = 1, kRange_8G = 2, kRange_16G = 3 }; + + /** + * Common interface for setting the measuring range of an accelerometer. + * + * @param range The maximum acceleration, positive or negative, that the + * accelerometer will measure. Not all accelerometers support all ranges. + */ + virtual void SetRange(Range range) = 0; + + /** + * Common interface for getting the x axis acceleration + * + * @return The acceleration along the x axis in g-forces + */ + virtual double GetX() = 0; + + /** + * Common interface for getting the y axis acceleration + * + * @return The acceleration along the y axis in g-forces + */ + virtual double GetY() = 0; + + /** + * Common interface for getting the z axis acceleration + * + * @return The acceleration along the z axis in g-forces + */ + virtual double GetZ() = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/interfaces/Gyro.h b/Robot2016/wpilib/cpp/current/include/interfaces/Gyro.h new file mode 100644 index 0000000..6766444 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/interfaces/Gyro.h @@ -0,0 +1,56 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2014-2016. 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 + +/** + * Interface for yaw rate gyros + */ +class Gyro { + public: + virtual ~Gyro() = default; + + /** + * Calibrate the gyro by running for a number of samples and computing the + * center value. Then use the center value as the Accumulator center value for + * subsequent measurements. It's important to make sure that the robot is not + * moving while the centering calculations are in progress, this is typically + * done when the robot is first turned on while it's sitting at rest before + * the competition starts. + */ + virtual void Calibrate() = 0; + + /** + * Reset the gyro. Resets the gyro to a heading of zero. This can be used if + * there is significant drift in the gyro and it needs to be recalibrated + * after it has been running. + */ + virtual void Reset() = 0; + + /** + * Return the actual angle in degrees that the robot is currently facing. + * + * The angle is based on the current accumulator value corrected by the + * oversampling rate, the gyro type and the A/D calibration values. The angle + * is continuous, that is it will continue from 360 to 361 degrees. This + * allows algorithms that wouldn't want to see a discontinuity in the gyro + * output as it sweeps past from 360 to 0 on the second time around. + * + * @return the current heading of the robot in degrees. This heading is based + * on integration of the returned rate from the gyro. + */ + virtual float GetAngle() const = 0; + + /** + * Return the rate of rotation of the gyro + * + * The rate is based on the most recent reading of the gyro analog value + * + * @return the current rate in degrees per second + */ + virtual double GetRate() const = 0; +}; diff --git a/Robot2016/wpilib/cpp/current/include/interfaces/Potentiometer.h b/Robot2016/wpilib/cpp/current/include/interfaces/Potentiometer.h new file mode 100644 index 0000000..1c2e99a --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/interfaces/Potentiometer.h @@ -0,0 +1,30 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2008-2016. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef INTERFACES_POTENTIOMETER_H +#define INTERFACES_POTENTIOMETER_H + +#include "PIDSource.h" + +/** + * Interface for potentiometers. + */ +class Potentiometer : public PIDSource { + public: + virtual ~Potentiometer() = default; + + /** + * Common interface for getting the current value of a potentiometer. + * + * @return The current set speed. Value is between -1.0 and 1.0. + */ + virtual double Get() const = 0; + + virtual void SetPIDSourceType(PIDSourceType pidSource) override; +}; + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/AlignOf.h b/Robot2016/wpilib/cpp/current/include/llvm/AlignOf.h new file mode 100644 index 0000000..5ff04d8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/AlignOf.h @@ -0,0 +1,234 @@ +//===--- AlignOf.h - Portable calculation of type alignment -----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the AlignOf function that computes alignments for +// arbitrary types. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_ALIGNOF_H +#define LLVM_SUPPORT_ALIGNOF_H + +#include + +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +namespace llvm { +template +struct AlignmentCalcImpl { + char x; +#if defined(_MSC_VER) +// Disables "structure was padded due to __declspec(align())" warnings that are +// generated by any class using AlignOf with a manually specified alignment. +// Although the warning is disabled in the LLVM project we need this pragma +// as AlignOf.h is a published support header that's available for use +// out-of-tree, and we would like that to compile cleanly at /W4. +#pragma warning(suppress : 4324) +#endif + T t; +private: + AlignmentCalcImpl() {} // Never instantiate. +}; + +/// AlignOf - A templated class that contains an enum value representing +/// the alignment of the template argument. For example, +/// AlignOf::Alignment represents the alignment of type "int". The +/// alignment calculated is the minimum alignment, and not necessarily +/// the "desired" alignment returned by GCC's __alignof__ (for example). Note +/// that because the alignment is an enum value, it can be used as a +/// compile-time constant (e.g., for template instantiation). +template +struct AlignOf { +#ifndef _MSC_VER + // Avoid warnings from GCC like: + // comparison between 'enum llvm::AlignOf::' and 'enum + // llvm::AlignOf::' [-Wenum-compare] + // by using constexpr instead of enum. + // (except on MSVC, since it doesn't support constexpr yet). + static constexpr unsigned Alignment = + static_cast(sizeof(AlignmentCalcImpl) - sizeof(T)); +#else + enum { Alignment = + static_cast(sizeof(AlignmentCalcImpl) - sizeof(T)) }; +#endif + enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 }; + enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 }; + enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 }; + enum { Alignment_GreaterEqual_16Bytes = Alignment >= 16 ? 1 : 0 }; + + enum { Alignment_LessEqual_2Bytes = Alignment <= 2 ? 1 : 0 }; + enum { Alignment_LessEqual_4Bytes = Alignment <= 4 ? 1 : 0 }; + enum { Alignment_LessEqual_8Bytes = Alignment <= 8 ? 1 : 0 }; + enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 }; +}; + +#ifndef _MSC_VER +template constexpr unsigned AlignOf::Alignment; +#endif + +/// alignOf - A templated function that returns the minimum alignment of +/// of a type. This provides no extra functionality beyond the AlignOf +/// class besides some cosmetic cleanliness. Example usage: +/// alignOf() returns the alignment of an int. +template +inline unsigned alignOf() { return AlignOf::Alignment; } + +/// \struct AlignedCharArray +/// \brief Helper for building an aligned character array type. +/// +/// This template is used to explicitly build up a collection of aligned +/// character array types. We have to build these up using a macro and explicit +/// specialization to cope with old versions of MSVC and GCC where only an +/// integer literal can be used to specify an alignment constraint. Once built +/// up here, we can then begin to indirect between these using normal C++ +/// template parameters. + +// MSVC requires special handling here. +#ifndef _MSC_VER + +#if __has_feature(cxx_alignas) +template +struct AlignedCharArray { + alignas(Alignment) char buffer[Size]; +}; + +#elif defined(__GNUC__) || defined(__IBM_ATTRIBUTES) +/// \brief Create a type with an aligned char buffer. +template +struct AlignedCharArray; + +#define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ + template \ + struct AlignedCharArray { \ + __attribute__((aligned(x))) char buffer[Size]; \ + }; + +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128) + +#undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT + +#else +# error No supported align as directive. +#endif + +#else // _MSC_VER + +/// \brief Create a type with an aligned char buffer. +template +struct AlignedCharArray; + +// We provide special variations of this template for the most common +// alignments because __declspec(align(...)) doesn't actually work when it is +// a member of a by-value function argument in MSVC, even if the alignment +// request is something reasonably like 8-byte or 16-byte. Note that we can't +// even include the declspec with the union that forces the alignment because +// MSVC warns on the existence of the declspec despite the union member forcing +// proper alignment. + +template +struct AlignedCharArray<1, Size> { + union { + char aligned; + char buffer[Size]; + }; +}; + +template +struct AlignedCharArray<2, Size> { + union { + short aligned; + char buffer[Size]; + }; +}; + +template +struct AlignedCharArray<4, Size> { + union { + int aligned; + char buffer[Size]; + }; +}; + +template +struct AlignedCharArray<8, Size> { + union { + double aligned; + char buffer[Size]; + }; +}; + + +// The rest of these are provided with a __declspec(align(...)) and we simply +// can't pass them by-value as function arguments on MSVC. + +#define LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \ + template \ + struct AlignedCharArray { \ + __declspec(align(x)) char buffer[Size]; \ + }; + +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64) +LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128) + +#undef LLVM_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT + +#endif // _MSC_VER + +namespace detail { +template +class AlignerImpl { + T1 t1; T2 t2; T3 t3; T4 t4; T5 t5; T6 t6; T7 t7; T8 t8; T9 t9; T10 t10; + + AlignerImpl(); // Never defined or instantiated. +}; + +template +union SizerImpl { + char arr1[sizeof(T1)], arr2[sizeof(T2)], arr3[sizeof(T3)], arr4[sizeof(T4)], + arr5[sizeof(T5)], arr6[sizeof(T6)], arr7[sizeof(T7)], arr8[sizeof(T8)], + arr9[sizeof(T9)], arr10[sizeof(T10)]; +}; +} // end namespace detail + +/// \brief This union template exposes a suitably aligned and sized character +/// array member which can hold elements of any of up to ten types. +/// +/// These types may be arrays, structs, or any other types. The goal is to +/// expose a char array buffer member which can be used as suitable storage for +/// a placement new of any of these types. Support for more than ten types can +/// be added at the cost of more boilerplate. +template +struct AlignedCharArrayUnion : llvm::AlignedCharArray< + AlignOf >::Alignment, + sizeof(detail::SizerImpl)> { +}; +} // end namespace llvm +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/ArrayRef.h b/Robot2016/wpilib/cpp/current/include/llvm/ArrayRef.h new file mode 100644 index 0000000..e7203ae --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/ArrayRef.h @@ -0,0 +1,399 @@ +//===--- ArrayRef.h - Array Reference Wrapper -------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_ARRAYREF_H +#define LLVM_ADT_ARRAYREF_H + +#include "llvm/None.h" +#include "llvm/SmallVector.h" +#include + +#ifndef LLVM_CONSTEXPR +# ifdef _MSC_VER +# if _MSC_VER >= 1900 +# define LLVM_CONSTEXPR constexpr +# else +# define LLVM_CONSTEXPR +# endif +# elif defined(__has_feature) +# if __has_feature(cxx_constexpr) +# define LLVM_CONSTEXPR constexpr +# else +# define LLVM_CONSTEXPR +# endif +# elif defined(__GXX_EXPERIMENTAL_CXX0X__) +# define LLVM_CONSTEXPR constexpr +# elif defined(__has_constexpr) +# define LLVM_CONSTEXPR constexpr +# else +# define LLVM_CONSTEXPR +# endif +# define DEFINED_LLVM_CONSTEXPR +#endif + +namespace llvm { + + /// ArrayRef - Represent a constant reference to an array (0 or more elements + /// consecutively in memory), i.e. a start pointer and a length. It allows + /// various APIs to take consecutive elements easily and conveniently. + /// + /// This class does not own the underlying data, it is expected to be used in + /// situations where the data resides in some other buffer, whose lifetime + /// extends past that of the ArrayRef. For this reason, it is not in general + /// safe to store an ArrayRef. + /// + /// This is intended to be trivially copyable, so it should be passed by + /// value. + template + class ArrayRef { + public: + typedef const T *iterator; + typedef const T *const_iterator; + typedef size_t size_type; + + typedef std::reverse_iterator reverse_iterator; + + private: + /// The start of the array, in an external buffer. + const T *Data; + + /// The number of elements. + size_type Length; + + public: + /// @name Constructors + /// @{ + + /// Construct an empty ArrayRef. + /*implicit*/ ArrayRef() : Data(nullptr), Length(0) {} + + /// Construct an empty ArrayRef from None. + /*implicit*/ ArrayRef(NoneType) : Data(nullptr), Length(0) {} + + /// Construct an ArrayRef from a single element. + /*implicit*/ ArrayRef(const T &OneElt) + : Data(&OneElt), Length(1) {} + + /// Construct an ArrayRef from a pointer and length. + /*implicit*/ ArrayRef(const T *data, size_t length) + : Data(data), Length(length) {} + + /// Construct an ArrayRef from a range. + ArrayRef(const T *begin, const T *end) + : Data(begin), Length(end - begin) {} + + /// Construct an ArrayRef from a SmallVector. This is templated in order to + /// avoid instantiating SmallVectorTemplateCommon whenever we + /// copy-construct an ArrayRef. + template + /*implicit*/ ArrayRef(const SmallVectorTemplateCommon &Vec) + : Data(Vec.data()), Length(Vec.size()) { + } + + /// Construct an ArrayRef from a std::vector. + template + /*implicit*/ ArrayRef(const std::vector &Vec) + : Data(Vec.data()), Length(Vec.size()) {} + + /// Construct an ArrayRef from a C array. + template + /*implicit*/ LLVM_CONSTEXPR ArrayRef(const T (&Arr)[N]) + : Data(Arr), Length(N) {} + + /// Construct an ArrayRef from a std::initializer_list. + /*implicit*/ ArrayRef(const std::initializer_list &Vec) + : Data(Vec.begin() == Vec.end() ? (T*)0 : Vec.begin()), + Length(Vec.size()) {} + + /// Construct an ArrayRef from ArrayRef. This uses SFINAE to + /// ensure that only ArrayRefs of pointers can be converted. + template + ArrayRef(const ArrayRef &A, + typename std::enable_if< + std::is_convertible::value>::type* = 0) + : Data(A.data()), Length(A.size()) {} + + /// Construct an ArrayRef from a SmallVector. This is + /// templated in order to avoid instantiating SmallVectorTemplateCommon + /// whenever we copy-construct an ArrayRef. + template + /*implicit*/ ArrayRef(const SmallVectorTemplateCommon &Vec, + typename std::enable_if< + std::is_convertible::value>::type* = 0) + : Data(Vec.data()), Length(Vec.size()) { + } + + /// Construct an ArrayRef from std::vector. This uses SFINAE + /// to ensure that only vectors of pointers can be converted. + template + ArrayRef(const std::vector &Vec, + typename std::enable_if< + std::is_convertible::value>::type* = 0) + : Data(Vec.data()), Length(Vec.size()) {} + + /// @} + /// @name Simple Operations + /// @{ + + iterator begin() const { return Data; } + iterator end() const { return Data + Length; } + + reverse_iterator rbegin() const { return reverse_iterator(end()); } + reverse_iterator rend() const { return reverse_iterator(begin()); } + + /// empty - Check if the array is empty. + bool empty() const { return Length == 0; } + + const T *data() const { return Data; } + + /// size - Get the array size. + size_t size() const { return Length; } + + /// front - Get the first element. + const T &front() const { + assert(!empty()); + return Data[0]; + } + + /// back - Get the last element. + const T &back() const { + assert(!empty()); + return Data[Length-1]; + } + + // copy - Allocate copy in Allocator and return ArrayRef to it. + template ArrayRef copy(Allocator &A) { + T *Buff = A.template Allocate(Length); + std::copy(begin(), end(), Buff); + return ArrayRef(Buff, Length); + } + + /// equals - Check for element-wise equality. + bool equals(ArrayRef RHS) const { + if (Length != RHS.Length) + return false; + if (Length == 0) + return true; + return std::equal(begin(), end(), RHS.begin()); + } + + /// slice(n) - Chop off the first N elements of the array. + ArrayRef slice(unsigned N) const { + assert(N <= size() && "Invalid specifier"); + return ArrayRef(data()+N, size()-N); + } + + /// slice(n, m) - Chop off the first N elements of the array, and keep M + /// elements in the array. + ArrayRef slice(unsigned N, unsigned M) const { + assert(N+M <= size() && "Invalid specifier"); + return ArrayRef(data()+N, M); + } + + // \brief Drop the last \p N elements of the array. + ArrayRef drop_back(unsigned N = 1) const { + assert(size() >= N && "Dropping more elements than exist"); + return slice(0, size() - N); + } + + /// @} + /// @name Operator Overloads + /// @{ + const T &operator[](size_t Index) const { + assert(Index < Length && "Invalid index!"); + return Data[Index]; + } + + /// @} + /// @name Expensive Operations + /// @{ + std::vector vec() const { + return std::vector(Data, Data+Length); + } + + /// @} + /// @name Conversion operators + /// @{ + operator std::vector() const { + return std::vector(Data, Data+Length); + } + + /// @} + }; + + /// MutableArrayRef - Represent a mutable reference to an array (0 or more + /// elements consecutively in memory), i.e. a start pointer and a length. It + /// allows various APIs to take and modify consecutive elements easily and + /// conveniently. + /// + /// This class does not own the underlying data, it is expected to be used in + /// situations where the data resides in some other buffer, whose lifetime + /// extends past that of the MutableArrayRef. For this reason, it is not in + /// general safe to store a MutableArrayRef. + /// + /// This is intended to be trivially copyable, so it should be passed by + /// value. + template + class MutableArrayRef : public ArrayRef { + public: + typedef T *iterator; + + typedef std::reverse_iterator reverse_iterator; + + /// Construct an empty MutableArrayRef. + /*implicit*/ MutableArrayRef() : ArrayRef() {} + + /// Construct an empty MutableArrayRef from None. + /*implicit*/ MutableArrayRef(NoneType) : ArrayRef() {} + + /// Construct an MutableArrayRef from a single element. + /*implicit*/ MutableArrayRef(T &OneElt) : ArrayRef(OneElt) {} + + /// Construct an MutableArrayRef from a pointer and length. + /*implicit*/ MutableArrayRef(T *data, size_t length) + : ArrayRef(data, length) {} + + /// Construct an MutableArrayRef from a range. + MutableArrayRef(T *begin, T *end) : ArrayRef(begin, end) {} + + /// Construct an MutableArrayRef from a SmallVector. + /*implicit*/ MutableArrayRef(SmallVectorImpl &Vec) + : ArrayRef(Vec) {} + + /// Construct a MutableArrayRef from a std::vector. + /*implicit*/ MutableArrayRef(std::vector &Vec) + : ArrayRef(Vec) {} + + /// Construct an MutableArrayRef from a C array. + template + /*implicit*/ LLVM_CONSTEXPR MutableArrayRef(T (&Arr)[N]) + : ArrayRef(Arr) {} + + T *data() const { return const_cast(ArrayRef::data()); } + + iterator begin() const { return data(); } + iterator end() const { return data() + this->size(); } + + reverse_iterator rbegin() const { return reverse_iterator(end()); } + reverse_iterator rend() const { return reverse_iterator(begin()); } + + /// front - Get the first element. + T &front() const { + assert(!this->empty()); + return data()[0]; + } + + /// back - Get the last element. + T &back() const { + assert(!this->empty()); + return data()[this->size()-1]; + } + + /// slice(n) - Chop off the first N elements of the array. + MutableArrayRef slice(unsigned N) const { + assert(N <= this->size() && "Invalid specifier"); + return MutableArrayRef(data()+N, this->size()-N); + } + + /// slice(n, m) - Chop off the first N elements of the array, and keep M + /// elements in the array. + MutableArrayRef slice(unsigned N, unsigned M) const { + assert(N+M <= this->size() && "Invalid specifier"); + return MutableArrayRef(data()+N, M); + } + + MutableArrayRef drop_back(unsigned N) const { + assert(this->size() >= N && "Dropping more elements than exist"); + return slice(0, this->size() - N); + } + + /// @} + /// @name Operator Overloads + /// @{ + T &operator[](size_t Index) const { + assert(Index < this->size() && "Invalid index!"); + return data()[Index]; + } + }; + + /// @name ArrayRef Convenience constructors + /// @{ + + /// Construct an ArrayRef from a single element. + template + ArrayRef makeArrayRef(const T &OneElt) { + return OneElt; + } + + /// Construct an ArrayRef from a pointer and length. + template + ArrayRef makeArrayRef(const T *data, size_t length) { + return ArrayRef(data, length); + } + + /// Construct an ArrayRef from a range. + template + ArrayRef makeArrayRef(const T *begin, const T *end) { + return ArrayRef(begin, end); + } + + /// Construct an ArrayRef from a SmallVector. + template + ArrayRef makeArrayRef(const SmallVectorImpl &Vec) { + return Vec; + } + + /// Construct an ArrayRef from a SmallVector. + template + ArrayRef makeArrayRef(const SmallVector &Vec) { + return Vec; + } + + /// Construct an ArrayRef from a std::vector. + template + ArrayRef makeArrayRef(const std::vector &Vec) { + return Vec; + } + + /// Construct an ArrayRef from a C array. + template + ArrayRef makeArrayRef(const T (&Arr)[N]) { + return ArrayRef(Arr); + } + + /// @} + /// @name ArrayRef Comparison Operators + /// @{ + + template + inline bool operator==(ArrayRef LHS, ArrayRef RHS) { + return LHS.equals(RHS); + } + + template + inline bool operator!=(ArrayRef LHS, ArrayRef RHS) { + return !(LHS == RHS); + } + + /// @} + + // ArrayRefs can be treated like a POD type. + template struct isPodLike; + template struct isPodLike > { + static const bool value = true; + }; +} // namespace llvm + +#ifdef DEFINED_LLVM_CONSTEXPR +# undef DEFINED_LLVM_CONSTEXPR +# undef LLVM_CONSTEXPR +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/Compiler.h b/Robot2016/wpilib/cpp/current/include/llvm/Compiler.h new file mode 100644 index 0000000..b690218 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/Compiler.h @@ -0,0 +1,68 @@ +//===-- llvm/Support/Compiler.h - Compiler abstraction support --*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines several macros, based on the current compiler. This allows +// use of compiler-specific features in a way that remains portable. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_COMPILER_H +#define LLVM_SUPPORT_COMPILER_H + +#ifndef __has_feature +# define __has_feature(x) 0 +#endif + +#ifndef __has_extension +# define __has_extension(x) 0 +#endif + +#ifndef __has_attribute +# define __has_attribute(x) 0 +#endif + +#ifndef __has_builtin +# define __has_builtin(x) 0 +#endif + +/// \macro LLVM_GNUC_PREREQ +/// \brief Extend the default __GNUC_PREREQ even if glibc's features.h isn't +/// available. +#ifndef LLVM_GNUC_PREREQ +# if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__) +# define LLVM_GNUC_PREREQ(maj, min, patch) \ + ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >= \ + ((maj) << 20) + ((min) << 10) + (patch)) +# elif defined(__GNUC__) && defined(__GNUC_MINOR__) +# define LLVM_GNUC_PREREQ(maj, min, patch) \ + ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10)) +# else +# define LLVM_GNUC_PREREQ(maj, min, patch) 0 +# endif +#endif + +#ifndef LLVM_ATTRIBUTE_UNUSED_RESULT +#if __has_attribute(warn_unused_result) || LLVM_GNUC_PREREQ(3, 4, 0) +#define LLVM_ATTRIBUTE_UNUSED_RESULT __attribute__((__warn_unused_result__)) +#else +#define LLVM_ATTRIBUTE_UNUSED_RESULT +#endif +#endif + +#ifndef LLVM_UNLIKELY +#if __has_builtin(__builtin_expect) || LLVM_GNUC_PREREQ(4, 0, 0) +#define LLVM_LIKELY(EXPR) __builtin_expect((bool)(EXPR), true) +#define LLVM_UNLIKELY(EXPR) __builtin_expect((bool)(EXPR), false) +#else +#define LLVM_LIKELY(EXPR) (EXPR) +#define LLVM_UNLIKELY(EXPR) (EXPR) +#endif +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/DenseMap.h b/Robot2016/wpilib/cpp/current/include/llvm/DenseMap.h new file mode 100644 index 0000000..58f3a52 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/DenseMap.h @@ -0,0 +1,1073 @@ +//===- llvm/ADT/DenseMap.h - Dense probed hash table ------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the DenseMap class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_DENSEMAP_H +#define LLVM_ADT_DENSEMAP_H + +#include "llvm/DenseMapInfo.h" +#include "llvm/EpochTracker.h" +#include "llvm/AlignOf.h" +#include "llvm/Compiler.h" +#include "llvm/MathExtras.h" +#include "llvm/type_traits.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace llvm { + +namespace detail { +// We extend a pair to allow users to override the bucket type with their own +// implementation without requiring two members. +template +struct DenseMapPair : public std::pair { + KeyT &getFirst() { return std::pair::first; } + const KeyT &getFirst() const { return std::pair::first; } + ValueT &getSecond() { return std::pair::second; } + const ValueT &getSecond() const { return std::pair::second; } +}; +} // namespace detail + +template < + typename KeyT, typename ValueT, typename KeyInfoT = DenseMapInfo, + typename Bucket = detail::DenseMapPair, bool IsConst = false> +class DenseMapIterator; + +template +class DenseMapBase : public DebugEpochBase { +public: + typedef unsigned size_type; + typedef KeyT key_type; + typedef ValueT mapped_type; + typedef BucketT value_type; + + typedef DenseMapIterator iterator; + typedef DenseMapIterator + const_iterator; + inline iterator begin() { + // When the map is empty, avoid the overhead of AdvancePastEmptyBuckets(). + return empty() ? end() : iterator(getBuckets(), getBucketsEnd(), *this); + } + inline iterator end() { + return iterator(getBucketsEnd(), getBucketsEnd(), *this, true); + } + inline const_iterator begin() const { + return empty() ? end() + : const_iterator(getBuckets(), getBucketsEnd(), *this); + } + inline const_iterator end() const { + return const_iterator(getBucketsEnd(), getBucketsEnd(), *this, true); + } + + bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { + return getNumEntries() == 0; + } + unsigned size() const { return getNumEntries(); } + + /// Grow the densemap so that it has at least Size buckets. Does not shrink + void resize(size_type Size) { + incrementEpoch(); + if (Size > getNumBuckets()) + grow(Size); + } + + void clear() { + incrementEpoch(); + if (getNumEntries() == 0 && getNumTombstones() == 0) return; + + // If the capacity of the array is huge, and the # elements used is small, + // shrink the array. + if (getNumEntries() * 4 < getNumBuckets() && getNumBuckets() > 64) { + shrink_and_clear(); + return; + } + + const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); + unsigned NumEntries = getNumEntries(); + for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) { + if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey)) { + if (!KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) { + P->getSecond().~ValueT(); + --NumEntries; + } + P->getFirst() = EmptyKey; + } + } + assert(NumEntries == 0 && "Node count imbalance!"); + setNumEntries(0); + setNumTombstones(0); + } + + /// Return 1 if the specified key is in the map, 0 otherwise. + size_type count(const KeyT &Val) const { + const BucketT *TheBucket; + return LookupBucketFor(Val, TheBucket) ? 1 : 0; + } + + iterator find(const KeyT &Val) { + BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return iterator(TheBucket, getBucketsEnd(), *this, true); + return end(); + } + const_iterator find(const KeyT &Val) const { + const BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return const_iterator(TheBucket, getBucketsEnd(), *this, true); + return end(); + } + + /// Alternate version of find() which allows a different, and possibly + /// less expensive, key type. + /// The DenseMapInfo is responsible for supplying methods + /// getHashValue(LookupKeyT) and isEqual(LookupKeyT, KeyT) for each key + /// type used. + template + iterator find_as(const LookupKeyT &Val) { + BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return iterator(TheBucket, getBucketsEnd(), *this, true); + return end(); + } + template + const_iterator find_as(const LookupKeyT &Val) const { + const BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return const_iterator(TheBucket, getBucketsEnd(), *this, true); + return end(); + } + + /// lookup - Return the entry for the specified key, or a default + /// constructed value if no such entry exists. + ValueT lookup(const KeyT &Val) const { + const BucketT *TheBucket; + if (LookupBucketFor(Val, TheBucket)) + return TheBucket->getSecond(); + return ValueT(); + } + + // Inserts key,value pair into the map if the key isn't already in the map. + // If the key is already in the map, it returns false and doesn't update the + // value. + std::pair insert(const std::pair &KV) { + BucketT *TheBucket; + if (LookupBucketFor(KV.first, TheBucket)) + return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true), + false); // Already in map. + + // Otherwise, insert the new element. + TheBucket = InsertIntoBucket(KV.first, KV.second, TheBucket); + return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true), + true); + } + + // Inserts key,value pair into the map if the key isn't already in the map. + // If the key is already in the map, it returns false and doesn't update the + // value. + std::pair insert(std::pair &&KV) { + BucketT *TheBucket; + if (LookupBucketFor(KV.first, TheBucket)) + return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true), + false); // Already in map. + + // Otherwise, insert the new element. + TheBucket = InsertIntoBucket(std::move(KV.first), + std::move(KV.second), + TheBucket); + return std::make_pair(iterator(TheBucket, getBucketsEnd(), *this, true), + true); + } + + /// insert - Range insertion of pairs. + template + void insert(InputIt I, InputIt E) { + for (; I != E; ++I) + insert(*I); + } + + + bool erase(const KeyT &Val) { + BucketT *TheBucket; + if (!LookupBucketFor(Val, TheBucket)) + return false; // not in map. + + TheBucket->getSecond().~ValueT(); + TheBucket->getFirst() = getTombstoneKey(); + decrementNumEntries(); + incrementNumTombstones(); + return true; + } + void erase(iterator I) { + BucketT *TheBucket = &*I; + TheBucket->getSecond().~ValueT(); + TheBucket->getFirst() = getTombstoneKey(); + decrementNumEntries(); + incrementNumTombstones(); + } + + value_type& FindAndConstruct(const KeyT &Key) { + BucketT *TheBucket; + if (LookupBucketFor(Key, TheBucket)) + return *TheBucket; + + return *InsertIntoBucket(Key, ValueT(), TheBucket); + } + + ValueT &operator[](const KeyT &Key) { + return FindAndConstruct(Key).second; + } + + value_type& FindAndConstruct(KeyT &&Key) { + BucketT *TheBucket; + if (LookupBucketFor(Key, TheBucket)) + return *TheBucket; + + return *InsertIntoBucket(std::move(Key), ValueT(), TheBucket); + } + + ValueT &operator[](KeyT &&Key) { + return FindAndConstruct(std::move(Key)).second; + } + + /// isPointerIntoBucketsArray - Return true if the specified pointer points + /// somewhere into the DenseMap's array of buckets (i.e. either to a key or + /// value in the DenseMap). + bool isPointerIntoBucketsArray(const void *Ptr) const { + return Ptr >= getBuckets() && Ptr < getBucketsEnd(); + } + + /// getPointerIntoBucketsArray() - Return an opaque pointer into the buckets + /// array. In conjunction with the previous method, this can be used to + /// determine whether an insertion caused the DenseMap to reallocate. + const void *getPointerIntoBucketsArray() const { return getBuckets(); } + +protected: + DenseMapBase() = default; + + void destroyAll() { + if (getNumBuckets() == 0) // Nothing to do. + return; + + const KeyT EmptyKey = getEmptyKey(), TombstoneKey = getTombstoneKey(); + for (BucketT *P = getBuckets(), *E = getBucketsEnd(); P != E; ++P) { + if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) + P->getSecond().~ValueT(); + P->getFirst().~KeyT(); + } + } + + void initEmpty() { + setNumEntries(0); + setNumTombstones(0); + + assert((getNumBuckets() & (getNumBuckets()-1)) == 0 && + "# initial buckets must be a power of two!"); + const KeyT EmptyKey = getEmptyKey(); + for (BucketT *B = getBuckets(), *E = getBucketsEnd(); B != E; ++B) + new (&B->getFirst()) KeyT(EmptyKey); + } + + void moveFromOldBuckets(BucketT *OldBucketsBegin, BucketT *OldBucketsEnd) { + initEmpty(); + + // Insert all the old elements. + const KeyT EmptyKey = getEmptyKey(); + const KeyT TombstoneKey = getTombstoneKey(); + for (BucketT *B = OldBucketsBegin, *E = OldBucketsEnd; B != E; ++B) { + if (!KeyInfoT::isEqual(B->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(B->getFirst(), TombstoneKey)) { + // Insert the key/value into the new table. + BucketT *DestBucket; + bool FoundVal = LookupBucketFor(B->getFirst(), DestBucket); + (void)FoundVal; // silence warning. + assert(!FoundVal && "Key already in new map?"); + DestBucket->getFirst() = std::move(B->getFirst()); + new (&DestBucket->getSecond()) ValueT(std::move(B->getSecond())); + incrementNumEntries(); + + // Free the value. + B->getSecond().~ValueT(); + } + B->getFirst().~KeyT(); + } + } + + template + void copyFrom( + const DenseMapBase &other) { + assert(&other != this); + assert(getNumBuckets() == other.getNumBuckets()); + + setNumEntries(other.getNumEntries()); + setNumTombstones(other.getNumTombstones()); + + if (isPodLike::value && isPodLike::value) + memcpy(getBuckets(), other.getBuckets(), + getNumBuckets() * sizeof(BucketT)); + else + for (size_t i = 0; i < getNumBuckets(); ++i) { + new (&getBuckets()[i].getFirst()) + KeyT(other.getBuckets()[i].getFirst()); + if (!KeyInfoT::isEqual(getBuckets()[i].getFirst(), getEmptyKey()) && + !KeyInfoT::isEqual(getBuckets()[i].getFirst(), getTombstoneKey())) + new (&getBuckets()[i].getSecond()) + ValueT(other.getBuckets()[i].getSecond()); + } + } + + static unsigned getHashValue(const KeyT &Val) { + return KeyInfoT::getHashValue(Val); + } + template + static unsigned getHashValue(const LookupKeyT &Val) { + return KeyInfoT::getHashValue(Val); + } + static const KeyT getEmptyKey() { + return KeyInfoT::getEmptyKey(); + } + static const KeyT getTombstoneKey() { + return KeyInfoT::getTombstoneKey(); + } + +private: + unsigned getNumEntries() const { + return static_cast(this)->getNumEntries(); + } + void setNumEntries(unsigned Num) { + static_cast(this)->setNumEntries(Num); + } + void incrementNumEntries() { + setNumEntries(getNumEntries() + 1); + } + void decrementNumEntries() { + setNumEntries(getNumEntries() - 1); + } + unsigned getNumTombstones() const { + return static_cast(this)->getNumTombstones(); + } + void setNumTombstones(unsigned Num) { + static_cast(this)->setNumTombstones(Num); + } + void incrementNumTombstones() { + setNumTombstones(getNumTombstones() + 1); + } + void decrementNumTombstones() { + setNumTombstones(getNumTombstones() - 1); + } + const BucketT *getBuckets() const { + return static_cast(this)->getBuckets(); + } + BucketT *getBuckets() { + return static_cast(this)->getBuckets(); + } + unsigned getNumBuckets() const { + return static_cast(this)->getNumBuckets(); + } + BucketT *getBucketsEnd() { + return getBuckets() + getNumBuckets(); + } + const BucketT *getBucketsEnd() const { + return getBuckets() + getNumBuckets(); + } + + void grow(unsigned AtLeast) { + static_cast(this)->grow(AtLeast); + } + + void shrink_and_clear() { + static_cast(this)->shrink_and_clear(); + } + + + BucketT *InsertIntoBucket(const KeyT &Key, const ValueT &Value, + BucketT *TheBucket) { + TheBucket = InsertIntoBucketImpl(Key, TheBucket); + + TheBucket->getFirst() = Key; + new (&TheBucket->getSecond()) ValueT(Value); + return TheBucket; + } + + BucketT *InsertIntoBucket(const KeyT &Key, ValueT &&Value, + BucketT *TheBucket) { + TheBucket = InsertIntoBucketImpl(Key, TheBucket); + + TheBucket->getFirst() = Key; + new (&TheBucket->getSecond()) ValueT(std::move(Value)); + return TheBucket; + } + + BucketT *InsertIntoBucket(KeyT &&Key, ValueT &&Value, BucketT *TheBucket) { + TheBucket = InsertIntoBucketImpl(Key, TheBucket); + + TheBucket->getFirst() = std::move(Key); + new (&TheBucket->getSecond()) ValueT(std::move(Value)); + return TheBucket; + } + + BucketT *InsertIntoBucketImpl(const KeyT &Key, BucketT *TheBucket) { + incrementEpoch(); + + // If the load of the hash table is more than 3/4, or if fewer than 1/8 of + // the buckets are empty (meaning that many are filled with tombstones), + // grow the table. + // + // The later case is tricky. For example, if we had one empty bucket with + // tons of tombstones, failing lookups (e.g. for insertion) would have to + // probe almost the entire table until it found the empty bucket. If the + // table completely filled with tombstones, no lookup would ever succeed, + // causing infinite loops in lookup. + unsigned NewNumEntries = getNumEntries() + 1; + unsigned NumBuckets = getNumBuckets(); + if (LLVM_UNLIKELY(NewNumEntries * 4 >= NumBuckets * 3)) { + this->grow(NumBuckets * 2); + LookupBucketFor(Key, TheBucket); + NumBuckets = getNumBuckets(); + } else if (LLVM_UNLIKELY(NumBuckets-(NewNumEntries+getNumTombstones()) <= + NumBuckets/8)) { + this->grow(NumBuckets); + LookupBucketFor(Key, TheBucket); + } + assert(TheBucket); + + // Only update the state after we've grown our bucket space appropriately + // so that when growing buckets we have self-consistent entry count. + incrementNumEntries(); + + // If we are writing over a tombstone, remember this. + const KeyT EmptyKey = getEmptyKey(); + if (!KeyInfoT::isEqual(TheBucket->getFirst(), EmptyKey)) + decrementNumTombstones(); + + return TheBucket; + } + + /// LookupBucketFor - Lookup the appropriate bucket for Val, returning it in + /// FoundBucket. If the bucket contains the key and a value, this returns + /// true, otherwise it returns a bucket with an empty marker or tombstone and + /// returns false. + template + bool LookupBucketFor(const LookupKeyT &Val, + const BucketT *&FoundBucket) const { + const BucketT *BucketsPtr = getBuckets(); + const unsigned NumBuckets = getNumBuckets(); + + if (NumBuckets == 0) { + FoundBucket = nullptr; + return false; + } + + // FoundTombstone - Keep track of whether we find a tombstone while probing. + const BucketT *FoundTombstone = nullptr; + const KeyT EmptyKey = getEmptyKey(); + const KeyT TombstoneKey = getTombstoneKey(); + assert(!KeyInfoT::isEqual(Val, EmptyKey) && + !KeyInfoT::isEqual(Val, TombstoneKey) && + "Empty/Tombstone value shouldn't be inserted into map!"); + + unsigned BucketNo = getHashValue(Val) & (NumBuckets-1); + unsigned ProbeAmt = 1; + while (1) { + const BucketT *ThisBucket = BucketsPtr + BucketNo; + // Found Val's bucket? If so, return it. + if (LLVM_LIKELY(KeyInfoT::isEqual(Val, ThisBucket->getFirst()))) { + FoundBucket = ThisBucket; + return true; + } + + // If we found an empty bucket, the key doesn't exist in the set. + // Insert it and return the default value. + if (LLVM_LIKELY(KeyInfoT::isEqual(ThisBucket->getFirst(), EmptyKey))) { + // If we've already seen a tombstone while probing, fill it in instead + // of the empty bucket we eventually probed to. + FoundBucket = FoundTombstone ? FoundTombstone : ThisBucket; + return false; + } + + // If this is a tombstone, remember it. If Val ends up not in the map, we + // prefer to return it than something that would require more probing. + if (KeyInfoT::isEqual(ThisBucket->getFirst(), TombstoneKey) && + !FoundTombstone) + FoundTombstone = ThisBucket; // Remember the first tombstone found. + + // Otherwise, it's a hash collision or a tombstone, continue quadratic + // probing. + BucketNo += ProbeAmt++; + BucketNo &= (NumBuckets-1); + } + } + + template + bool LookupBucketFor(const LookupKeyT &Val, BucketT *&FoundBucket) { + const BucketT *ConstFoundBucket; + bool Result = const_cast(this) + ->LookupBucketFor(Val, ConstFoundBucket); + FoundBucket = const_cast(ConstFoundBucket); + return Result; + } + +public: + /// Return the approximate size (in bytes) of the actual map. + /// This is just the raw memory used by DenseMap. + /// If entries are pointers to objects, the size of the referenced objects + /// are not included. + size_t getMemorySize() const { + return getNumBuckets() * sizeof(BucketT); + } +}; + +template , + typename BucketT = detail::DenseMapPair> +class DenseMap : public DenseMapBase, + KeyT, ValueT, KeyInfoT, BucketT> { + // Lift some types from the dependent base class into this class for + // simplicity of referring to them. + typedef DenseMapBase BaseT; + friend class DenseMapBase; + + BucketT *Buckets; + unsigned NumEntries; + unsigned NumTombstones; + unsigned NumBuckets; + +public: + explicit DenseMap(unsigned NumInitBuckets = 0) { + init(NumInitBuckets); + } + + DenseMap(const DenseMap &other) : BaseT() { + init(0); + copyFrom(other); + } + + DenseMap(DenseMap &&other) : BaseT() { + init(0); + swap(other); + } + + template + DenseMap(const InputIt &I, const InputIt &E) { + init(NextPowerOf2(std::distance(I, E))); + this->insert(I, E); + } + + ~DenseMap() { + this->destroyAll(); + operator delete(Buckets); + } + + void swap(DenseMap& RHS) { + this->incrementEpoch(); + RHS.incrementEpoch(); + std::swap(Buckets, RHS.Buckets); + std::swap(NumEntries, RHS.NumEntries); + std::swap(NumTombstones, RHS.NumTombstones); + std::swap(NumBuckets, RHS.NumBuckets); + } + + DenseMap& operator=(const DenseMap& other) { + if (&other != this) + copyFrom(other); + return *this; + } + + DenseMap& operator=(DenseMap &&other) { + this->destroyAll(); + operator delete(Buckets); + init(0); + swap(other); + return *this; + } + + void copyFrom(const DenseMap& other) { + this->destroyAll(); + operator delete(Buckets); + if (allocateBuckets(other.NumBuckets)) { + this->BaseT::copyFrom(other); + } else { + NumEntries = 0; + NumTombstones = 0; + } + } + + void init(unsigned InitBuckets) { + if (allocateBuckets(InitBuckets)) { + this->BaseT::initEmpty(); + } else { + NumEntries = 0; + NumTombstones = 0; + } + } + + void grow(unsigned AtLeast) { + unsigned OldNumBuckets = NumBuckets; + BucketT *OldBuckets = Buckets; + + allocateBuckets(std::max(64, static_cast(NextPowerOf2(AtLeast-1)))); + assert(Buckets); + if (!OldBuckets) { + this->BaseT::initEmpty(); + return; + } + + this->moveFromOldBuckets(OldBuckets, OldBuckets+OldNumBuckets); + + // Free the old table. + operator delete(OldBuckets); + } + + void shrink_and_clear() { + unsigned OldNumEntries = NumEntries; + this->destroyAll(); + + // Reduce the number of buckets. + unsigned NewNumBuckets = 0; + if (OldNumEntries) + NewNumBuckets = std::max(64, 1 << (Log2_32_Ceil(OldNumEntries) + 1)); + if (NewNumBuckets == NumBuckets) { + this->BaseT::initEmpty(); + return; + } + + operator delete(Buckets); + init(NewNumBuckets); + } + +private: + unsigned getNumEntries() const { + return NumEntries; + } + void setNumEntries(unsigned Num) { + NumEntries = Num; + } + + unsigned getNumTombstones() const { + return NumTombstones; + } + void setNumTombstones(unsigned Num) { + NumTombstones = Num; + } + + BucketT *getBuckets() const { + return Buckets; + } + + unsigned getNumBuckets() const { + return NumBuckets; + } + + bool allocateBuckets(unsigned Num) { + NumBuckets = Num; + if (NumBuckets == 0) { + Buckets = nullptr; + return false; + } + + Buckets = static_cast(operator new(sizeof(BucketT) * NumBuckets)); + return true; + } +}; + +template , + typename BucketT = detail::DenseMapPair> +class SmallDenseMap + : public DenseMapBase< + SmallDenseMap, KeyT, + ValueT, KeyInfoT, BucketT> { + // Lift some types from the dependent base class into this class for + // simplicity of referring to them. + typedef DenseMapBase BaseT; + friend class DenseMapBase; + + unsigned Small : 1; + unsigned NumEntries : 31; + unsigned NumTombstones; + + struct LargeRep { + BucketT *Buckets; + unsigned NumBuckets; + }; + + /// A "union" of an inline bucket array and the struct representing + /// a large bucket. This union will be discriminated by the 'Small' bit. + AlignedCharArrayUnion storage; + +public: + explicit SmallDenseMap(unsigned NumInitBuckets = 0) { + init(NumInitBuckets); + } + + SmallDenseMap(const SmallDenseMap &other) : BaseT() { + init(0); + copyFrom(other); + } + + SmallDenseMap(SmallDenseMap &&other) : BaseT() { + init(0); + swap(other); + } + + template + SmallDenseMap(const InputIt &I, const InputIt &E) { + init(NextPowerOf2(std::distance(I, E))); + this->insert(I, E); + } + + ~SmallDenseMap() { + this->destroyAll(); + deallocateBuckets(); + } + + void swap(SmallDenseMap& RHS) { + unsigned TmpNumEntries = RHS.NumEntries; + RHS.NumEntries = NumEntries; + NumEntries = TmpNumEntries; + std::swap(NumTombstones, RHS.NumTombstones); + + const KeyT EmptyKey = this->getEmptyKey(); + const KeyT TombstoneKey = this->getTombstoneKey(); + if (Small && RHS.Small) { + // If we're swapping inline bucket arrays, we have to cope with some of + // the tricky bits of DenseMap's storage system: the buckets are not + // fully initialized. Thus we swap every key, but we may have + // a one-directional move of the value. + for (unsigned i = 0, e = InlineBuckets; i != e; ++i) { + BucketT *LHSB = &getInlineBuckets()[i], + *RHSB = &RHS.getInlineBuckets()[i]; + bool hasLHSValue = (!KeyInfoT::isEqual(LHSB->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(LHSB->getFirst(), TombstoneKey)); + bool hasRHSValue = (!KeyInfoT::isEqual(RHSB->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(RHSB->getFirst(), TombstoneKey)); + if (hasLHSValue && hasRHSValue) { + // Swap together if we can... + std::swap(*LHSB, *RHSB); + continue; + } + // Swap separately and handle any assymetry. + std::swap(LHSB->getFirst(), RHSB->getFirst()); + if (hasLHSValue) { + new (&RHSB->getSecond()) ValueT(std::move(LHSB->getSecond())); + LHSB->getSecond().~ValueT(); + } else if (hasRHSValue) { + new (&LHSB->getSecond()) ValueT(std::move(RHSB->getSecond())); + RHSB->getSecond().~ValueT(); + } + } + return; + } + if (!Small && !RHS.Small) { + std::swap(getLargeRep()->Buckets, RHS.getLargeRep()->Buckets); + std::swap(getLargeRep()->NumBuckets, RHS.getLargeRep()->NumBuckets); + return; + } + + SmallDenseMap &SmallSide = Small ? *this : RHS; + SmallDenseMap &LargeSide = Small ? RHS : *this; + + // First stash the large side's rep and move the small side across. + LargeRep TmpRep = std::move(*LargeSide.getLargeRep()); + LargeSide.getLargeRep()->~LargeRep(); + LargeSide.Small = true; + // This is similar to the standard move-from-old-buckets, but the bucket + // count hasn't actually rotated in this case. So we have to carefully + // move construct the keys and values into their new locations, but there + // is no need to re-hash things. + for (unsigned i = 0, e = InlineBuckets; i != e; ++i) { + BucketT *NewB = &LargeSide.getInlineBuckets()[i], + *OldB = &SmallSide.getInlineBuckets()[i]; + new (&NewB->getFirst()) KeyT(std::move(OldB->getFirst())); + OldB->getFirst().~KeyT(); + if (!KeyInfoT::isEqual(NewB->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(NewB->getFirst(), TombstoneKey)) { + new (&NewB->getSecond()) ValueT(std::move(OldB->getSecond())); + OldB->getSecond().~ValueT(); + } + } + + // The hard part of moving the small buckets across is done, just move + // the TmpRep into its new home. + SmallSide.Small = false; + new (SmallSide.getLargeRep()) LargeRep(std::move(TmpRep)); + } + + SmallDenseMap& operator=(const SmallDenseMap& other) { + if (&other != this) + copyFrom(other); + return *this; + } + + SmallDenseMap& operator=(SmallDenseMap &&other) { + this->destroyAll(); + deallocateBuckets(); + init(0); + swap(other); + return *this; + } + + void copyFrom(const SmallDenseMap& other) { + this->destroyAll(); + deallocateBuckets(); + Small = true; + if (other.getNumBuckets() > InlineBuckets) { + Small = false; + new (getLargeRep()) LargeRep(allocateBuckets(other.getNumBuckets())); + } + this->BaseT::copyFrom(other); + } + + void init(unsigned InitBuckets) { + Small = true; + if (InitBuckets > InlineBuckets) { + Small = false; + new (getLargeRep()) LargeRep(allocateBuckets(InitBuckets)); + } + this->BaseT::initEmpty(); + } + + void grow(unsigned AtLeast) { + if (AtLeast >= InlineBuckets) + AtLeast = std::max(64, NextPowerOf2(AtLeast-1)); + + if (Small) { + if (AtLeast < InlineBuckets) + return; // Nothing to do. + + // First move the inline buckets into a temporary storage. + AlignedCharArrayUnion TmpStorage; + BucketT *TmpBegin = reinterpret_cast(TmpStorage.buffer); + BucketT *TmpEnd = TmpBegin; + + // Loop over the buckets, moving non-empty, non-tombstones into the + // temporary storage. Have the loop move the TmpEnd forward as it goes. + const KeyT EmptyKey = this->getEmptyKey(); + const KeyT TombstoneKey = this->getTombstoneKey(); + for (BucketT *P = getBuckets(), *E = P + InlineBuckets; P != E; ++P) { + if (!KeyInfoT::isEqual(P->getFirst(), EmptyKey) && + !KeyInfoT::isEqual(P->getFirst(), TombstoneKey)) { + assert(size_t(TmpEnd - TmpBegin) < InlineBuckets && + "Too many inline buckets!"); + new (&TmpEnd->getFirst()) KeyT(std::move(P->getFirst())); + new (&TmpEnd->getSecond()) ValueT(std::move(P->getSecond())); + ++TmpEnd; + P->getSecond().~ValueT(); + } + P->getFirst().~KeyT(); + } + + // Now make this map use the large rep, and move all the entries back + // into it. + Small = false; + new (getLargeRep()) LargeRep(allocateBuckets(AtLeast)); + this->moveFromOldBuckets(TmpBegin, TmpEnd); + return; + } + + LargeRep OldRep = std::move(*getLargeRep()); + getLargeRep()->~LargeRep(); + if (AtLeast <= InlineBuckets) { + Small = true; + } else { + new (getLargeRep()) LargeRep(allocateBuckets(AtLeast)); + } + + this->moveFromOldBuckets(OldRep.Buckets, OldRep.Buckets+OldRep.NumBuckets); + + // Free the old table. + operator delete(OldRep.Buckets); + } + + void shrink_and_clear() { + unsigned OldSize = this->size(); + this->destroyAll(); + + // Reduce the number of buckets. + unsigned NewNumBuckets = 0; + if (OldSize) { + NewNumBuckets = 1 << (Log2_32_Ceil(OldSize) + 1); + if (NewNumBuckets > InlineBuckets && NewNumBuckets < 64u) + NewNumBuckets = 64; + } + if ((Small && NewNumBuckets <= InlineBuckets) || + (!Small && NewNumBuckets == getLargeRep()->NumBuckets)) { + this->BaseT::initEmpty(); + return; + } + + deallocateBuckets(); + init(NewNumBuckets); + } + +private: + unsigned getNumEntries() const { + return NumEntries; + } + void setNumEntries(unsigned Num) { + assert(Num < INT_MAX && "Cannot support more than INT_MAX entries"); + NumEntries = Num; + } + + unsigned getNumTombstones() const { + return NumTombstones; + } + void setNumTombstones(unsigned Num) { + NumTombstones = Num; + } + + const BucketT *getInlineBuckets() const { + assert(Small); + // Note that this cast does not violate aliasing rules as we assert that + // the memory's dynamic type is the small, inline bucket buffer, and the + // 'storage.buffer' static type is 'char *'. + return reinterpret_cast(storage.buffer); + } + BucketT *getInlineBuckets() { + return const_cast( + const_cast(this)->getInlineBuckets()); + } + const LargeRep *getLargeRep() const { + assert(!Small); + // Note, same rule about aliasing as with getInlineBuckets. + return reinterpret_cast(storage.buffer); + } + LargeRep *getLargeRep() { + return const_cast( + const_cast(this)->getLargeRep()); + } + + const BucketT *getBuckets() const { + return Small ? getInlineBuckets() : getLargeRep()->Buckets; + } + BucketT *getBuckets() { + return const_cast( + const_cast(this)->getBuckets()); + } + unsigned getNumBuckets() const { + return Small ? InlineBuckets : getLargeRep()->NumBuckets; + } + + void deallocateBuckets() { + if (Small) + return; + + operator delete(getLargeRep()->Buckets); + getLargeRep()->~LargeRep(); + } + + LargeRep allocateBuckets(unsigned Num) { + assert(Num > InlineBuckets && "Must allocate more buckets than are inline"); + LargeRep Rep = { + static_cast(operator new(sizeof(BucketT) * Num)), Num + }; + return Rep; + } +}; + +template +class DenseMapIterator : DebugEpochBase::HandleBase { + typedef DenseMapIterator ConstIterator; + friend class DenseMapIterator; + friend class DenseMapIterator; + +public: + typedef ptrdiff_t difference_type; + typedef typename std::conditional::type + value_type; + typedef value_type *pointer; + typedef value_type &reference; + typedef std::forward_iterator_tag iterator_category; +private: + pointer Ptr, End; +public: + DenseMapIterator() : Ptr(nullptr), End(nullptr) {} + + DenseMapIterator(pointer Pos, pointer E, const DebugEpochBase &Epoch, + bool NoAdvance = false) + : DebugEpochBase::HandleBase(&Epoch), Ptr(Pos), End(E) { + assert(isHandleInSync() && "invalid construction!"); + if (!NoAdvance) AdvancePastEmptyBuckets(); + } + + // Converting ctor from non-const iterators to const iterators. SFINAE'd out + // for const iterator destinations so it doesn't end up as a user defined copy + // constructor. + template ::type> + DenseMapIterator( + const DenseMapIterator &I) + : DebugEpochBase::HandleBase(I), Ptr(I.Ptr), End(I.End) {} + + reference operator*() const { + assert(isHandleInSync() && "invalid iterator access!"); + return *Ptr; + } + pointer operator->() const { + assert(isHandleInSync() && "invalid iterator access!"); + return Ptr; + } + + bool operator==(const ConstIterator &RHS) const { + assert((!Ptr || isHandleInSync()) && "handle not in sync!"); + assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!"); + assert(getEpochAddress() == RHS.getEpochAddress() && + "comparing incomparable iterators!"); + return Ptr == RHS.Ptr; + } + bool operator!=(const ConstIterator &RHS) const { + assert((!Ptr || isHandleInSync()) && "handle not in sync!"); + assert((!RHS.Ptr || RHS.isHandleInSync()) && "handle not in sync!"); + assert(getEpochAddress() == RHS.getEpochAddress() && + "comparing incomparable iterators!"); + return Ptr != RHS.Ptr; + } + + inline DenseMapIterator& operator++() { // Preincrement + assert(isHandleInSync() && "invalid iterator access!"); + ++Ptr; + AdvancePastEmptyBuckets(); + return *this; + } + DenseMapIterator operator++(int) { // Postincrement + assert(isHandleInSync() && "invalid iterator access!"); + DenseMapIterator tmp = *this; ++*this; return tmp; + } + +private: + void AdvancePastEmptyBuckets() { + const KeyT Empty = KeyInfoT::getEmptyKey(); + const KeyT Tombstone = KeyInfoT::getTombstoneKey(); + + while (Ptr != End && (KeyInfoT::isEqual(Ptr->getFirst(), Empty) || + KeyInfoT::isEqual(Ptr->getFirst(), Tombstone))) + ++Ptr; + } +}; + +template +static inline size_t +capacity_in_bytes(const DenseMap &X) { + return X.getMemorySize(); +} + +} // end namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/DenseMapInfo.h b/Robot2016/wpilib/cpp/current/include/llvm/DenseMapInfo.h new file mode 100644 index 0000000..17793d5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/DenseMapInfo.h @@ -0,0 +1,168 @@ +//===- llvm/ADT/DenseMapInfo.h - Type traits for DenseMap -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines DenseMapInfo traits for DenseMap. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_DENSEMAPINFO_H +#define LLVM_ADT_DENSEMAPINFO_H + +#include "llvm/PointerLikeTypeTraits.h" +#include "llvm/type_traits.h" + +namespace llvm { + +template +struct DenseMapInfo { + //static inline T getEmptyKey(); + //static inline T getTombstoneKey(); + //static unsigned getHashValue(const T &Val); + //static bool isEqual(const T &LHS, const T &RHS); +}; + +// Provide DenseMapInfo for all pointers. +template +struct DenseMapInfo { + static inline T* getEmptyKey() { + uintptr_t Val = static_cast(-1); + Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; + return reinterpret_cast(Val); + } + static inline T* getTombstoneKey() { + uintptr_t Val = static_cast(-2); + Val <<= PointerLikeTypeTraits::NumLowBitsAvailable; + return reinterpret_cast(Val); + } + static unsigned getHashValue(const T *PtrVal) { + return (unsigned((uintptr_t)PtrVal) >> 4) ^ + (unsigned((uintptr_t)PtrVal) >> 9); + } + static bool isEqual(const T *LHS, const T *RHS) { return LHS == RHS; } +}; + +// Provide DenseMapInfo for chars. +template<> struct DenseMapInfo { + static inline char getEmptyKey() { return ~0; } + static inline char getTombstoneKey() { return ~0 - 1; } + static unsigned getHashValue(const char& Val) { return Val * 37U; } + static bool isEqual(const char &LHS, const char &RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for unsigned ints. +template<> struct DenseMapInfo { + static inline unsigned getEmptyKey() { return ~0U; } + static inline unsigned getTombstoneKey() { return ~0U - 1; } + static unsigned getHashValue(const unsigned& Val) { return Val * 37U; } + static bool isEqual(const unsigned& LHS, const unsigned& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for unsigned longs. +template<> struct DenseMapInfo { + static inline unsigned long getEmptyKey() { return ~0UL; } + static inline unsigned long getTombstoneKey() { return ~0UL - 1L; } + static unsigned getHashValue(const unsigned long& Val) { + return (unsigned)(Val * 37UL); + } + static bool isEqual(const unsigned long& LHS, const unsigned long& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for unsigned long longs. +template<> struct DenseMapInfo { + static inline unsigned long long getEmptyKey() { return ~0ULL; } + static inline unsigned long long getTombstoneKey() { return ~0ULL - 1ULL; } + static unsigned getHashValue(const unsigned long long& Val) { + return (unsigned)(Val * 37ULL); + } + static bool isEqual(const unsigned long long& LHS, + const unsigned long long& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for ints. +template<> struct DenseMapInfo { + static inline int getEmptyKey() { return 0x7fffffff; } + static inline int getTombstoneKey() { return -0x7fffffff - 1; } + static unsigned getHashValue(const int& Val) { return (unsigned)(Val * 37U); } + static bool isEqual(const int& LHS, const int& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for longs. +template<> struct DenseMapInfo { + static inline long getEmptyKey() { + return (1UL << (sizeof(long) * 8 - 1)) - 1UL; + } + static inline long getTombstoneKey() { return getEmptyKey() - 1L; } + static unsigned getHashValue(const long& Val) { + return (unsigned)(Val * 37UL); + } + static bool isEqual(const long& LHS, const long& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for long longs. +template<> struct DenseMapInfo { + static inline long long getEmptyKey() { return 0x7fffffffffffffffLL; } + static inline long long getTombstoneKey() { return -0x7fffffffffffffffLL-1; } + static unsigned getHashValue(const long long& Val) { + return (unsigned)(Val * 37ULL); + } + static bool isEqual(const long long& LHS, + const long long& RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for all pairs whose members have info. +template +struct DenseMapInfo > { + typedef std::pair Pair; + typedef DenseMapInfo FirstInfo; + typedef DenseMapInfo SecondInfo; + + static inline Pair getEmptyKey() { + return std::make_pair(FirstInfo::getEmptyKey(), + SecondInfo::getEmptyKey()); + } + static inline Pair getTombstoneKey() { + return std::make_pair(FirstInfo::getTombstoneKey(), + SecondInfo::getTombstoneKey()); + } + static unsigned getHashValue(const Pair& PairVal) { + uint64_t key = (uint64_t)FirstInfo::getHashValue(PairVal.first) << 32 + | (uint64_t)SecondInfo::getHashValue(PairVal.second); + key += ~(key << 32); + key ^= (key >> 22); + key += ~(key << 13); + key ^= (key >> 8); + key += (key << 3); + key ^= (key >> 15); + key += ~(key << 27); + key ^= (key >> 31); + return (unsigned)key; + } + static bool isEqual(const Pair &LHS, const Pair &RHS) { + return FirstInfo::isEqual(LHS.first, RHS.first) && + SecondInfo::isEqual(LHS.second, RHS.second); + } +}; + +} // end namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/EpochTracker.h b/Robot2016/wpilib/cpp/current/include/llvm/EpochTracker.h new file mode 100644 index 0000000..f589136 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/EpochTracker.h @@ -0,0 +1,97 @@ +//===- llvm/ADT/EpochTracker.h - ADT epoch tracking --------------*- C++ -*-==// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the DebugEpochBase and DebugEpochBase::HandleBase classes. +// These can be used to write iterators that are fail-fast when LLVM is built +// with asserts enabled. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_EPOCH_TRACKER_H +#define LLVM_ADT_EPOCH_TRACKER_H + +#include + +namespace llvm { + +#ifdef NDEBUG //ifndef LLVM_ENABLE_ABI_BREAKING_CHECKS + +class DebugEpochBase { +public: + void incrementEpoch() {} + + class HandleBase { + public: + HandleBase() = default; + explicit HandleBase(const DebugEpochBase *) {} + bool isHandleInSync() const { return true; } + const void *getEpochAddress() const { return nullptr; } + }; +}; + +#else + +/// \brief A base class for data structure classes wishing to make iterators +/// ("handles") pointing into themselves fail-fast. When building without +/// asserts, this class is empty and does nothing. +/// +/// DebugEpochBase does not by itself track handles pointing into itself. The +/// expectation is that routines touching the handles will poll on +/// isHandleInSync at appropriate points to assert that the handle they're using +/// is still valid. +/// +class DebugEpochBase { + uint64_t Epoch; + +public: + DebugEpochBase() : Epoch(0) {} + + /// \brief Calling incrementEpoch invalidates all handles pointing into the + /// calling instance. + void incrementEpoch() { ++Epoch; } + + /// \brief The destructor calls incrementEpoch to make use-after-free bugs + /// more likely to crash deterministically. + ~DebugEpochBase() { incrementEpoch(); } + + /// \brief A base class for iterator classes ("handles") that wish to poll for + /// iterator invalidating modifications in the underlying data structure. + /// When LLVM is built without asserts, this class is empty and does nothing. + /// + /// HandleBase does not track the parent data structure by itself. It expects + /// the routines modifying the data structure to call incrementEpoch when they + /// make an iterator-invalidating modification. + /// + class HandleBase { + const uint64_t *EpochAddress; + uint64_t EpochAtCreation; + + public: + HandleBase() : EpochAddress(nullptr), EpochAtCreation(UINT64_MAX) {} + + explicit HandleBase(const DebugEpochBase *Parent) + : EpochAddress(&Parent->Epoch), EpochAtCreation(Parent->Epoch) {} + + /// \brief Returns true if the DebugEpochBase this Handle is linked to has + /// not called incrementEpoch on itself since the creation of this + /// HandleBase instance. + bool isHandleInSync() const { return *EpochAddress == EpochAtCreation; } + + /// \brief Returns a pointer to the epoch word stored in the data structure + /// this handle points into. Can be used to check if two iterators point + /// into the same data structure. + const void *getEpochAddress() const { return EpochAddress; } + }; +}; + +#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS + +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/MathExtras.h b/Robot2016/wpilib/cpp/current/include/llvm/MathExtras.h new file mode 100644 index 0000000..1152dbe --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/MathExtras.h @@ -0,0 +1,189 @@ +//===-- llvm/Support/MathExtras.h - Useful math functions -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains some functions that are useful for math stuff. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_MATHEXTRAS_H +#define LLVM_SUPPORT_MATHEXTRAS_H + +#include "llvm/Compiler.h" +#include +#include + +namespace llvm { +/// \brief The behavior an operation has on an input of 0. +enum ZeroBehavior { + /// \brief The returned value is undefined. + ZB_Undefined, + /// \brief The returned value is numeric_limits::max() + ZB_Max, + /// \brief The returned value is numeric_limits::digits + ZB_Width +}; + +namespace detail { +template struct LeadingZerosCounter { + static std::size_t count(T Val, ZeroBehavior) { + if (!Val) + return std::numeric_limits::digits; + + // Bisection method. + std::size_t ZeroBits = 0; + for (T Shift = std::numeric_limits::digits >> 1; Shift; Shift >>= 1) { + T Tmp = Val >> Shift; + if (Tmp) + Val = Tmp; + else + ZeroBits |= Shift; + } + return ZeroBits; + } +}; + +#if __GNUC__ >= 4 || _MSC_VER +template struct LeadingZerosCounter { + static std::size_t count(T Val, ZeroBehavior ZB) { + if (ZB != ZB_Undefined && Val == 0) + return 32; + +#if __has_builtin(__builtin_clz) || LLVM_GNUC_PREREQ(4, 0, 0) + return __builtin_clz(Val); +#elif _MSC_VER + unsigned long Index; + _BitScanReverse(&Index, Val); + return Index ^ 31; +#endif + } +}; + +#if !defined(_MSC_VER) || defined(_M_X64) +template struct LeadingZerosCounter { + static std::size_t count(T Val, ZeroBehavior ZB) { + if (ZB != ZB_Undefined && Val == 0) + return 64; + +#if __has_builtin(__builtin_clzll) || LLVM_GNUC_PREREQ(4, 0, 0) + return __builtin_clzll(Val); +#elif _MSC_VER + unsigned long Index; + _BitScanReverse64(&Index, Val); + return Index ^ 63; +#endif + } +}; +#endif +#endif +} // namespace detail + +/// \brief Count number of 0's from the most significant bit to the least +/// stopping at the first 1. +/// +/// Only unsigned integral types are allowed. +/// +/// \param ZB the behavior on an input of 0. Only ZB_Width and ZB_Undefined are +/// valid arguments. +template +std::size_t countLeadingZeros(T Val, ZeroBehavior ZB = ZB_Width) { + static_assert(std::numeric_limits::is_integer && + !std::numeric_limits::is_signed, + "Only unsigned integral types are allowed."); + return detail::LeadingZerosCounter::count(Val, ZB); +} + +/// Log2_32 - This function returns the floor log base 2 of the specified value, +/// -1 if the value is zero. (32 bit edition.) +/// Ex. Log2_32(32) == 5, Log2_32(1) == 0, Log2_32(0) == -1, Log2_32(6) == 2 +inline unsigned Log2_32(uint32_t Value) { + return 31 - countLeadingZeros(Value); +} + +/// Log2_64 - This function returns the floor log base 2 of the specified value, +/// -1 if the value is zero. (64 bit edition.) +inline unsigned Log2_64(uint64_t Value) { + return 63 - countLeadingZeros(Value); +} + +/// Log2_32_Ceil - This function returns the ceil log base 2 of the specified +/// value, 32 if the value is zero. (32 bit edition). +/// Ex. Log2_32_Ceil(32) == 5, Log2_32_Ceil(1) == 0, Log2_32_Ceil(6) == 3 +inline unsigned Log2_32_Ceil(uint32_t Value) { + return 32 - countLeadingZeros(Value - 1); +} + +/// Log2_64_Ceil - This function returns the ceil log base 2 of the specified +/// value, 64 if the value is zero. (64 bit edition.) +inline unsigned Log2_64_Ceil(uint64_t Value) { + return 64 - countLeadingZeros(Value - 1); +} + +/// BitsToDouble - This function takes a 64-bit integer and returns the bit +/// equivalent double. +inline double BitsToDouble(uint64_t Bits) { + union { + uint64_t L; + double D; + } T; + T.L = Bits; + return T.D; +} + +/// BitsToFloat - This function takes a 32-bit integer and returns the bit +/// equivalent float. +inline float BitsToFloat(uint32_t Bits) { + union { + uint32_t I; + float F; + } T; + T.I = Bits; + return T.F; +} + +/// DoubleToBits - This function takes a double and returns the bit +/// equivalent 64-bit integer. Note that copying doubles around +/// changes the bits of NaNs on some hosts, notably x86, so this +/// routine cannot be used if these bits are needed. +inline uint64_t DoubleToBits(double Double) { + union { + uint64_t L; + double D; + } T; + T.D = Double; + return T.L; +} + +/// FloatToBits - This function takes a float and returns the bit +/// equivalent 32-bit integer. Note that copying floats around +/// changes the bits of NaNs on some hosts, notably x86, so this +/// routine cannot be used if these bits are needed. +inline uint32_t FloatToBits(float Float) { + union { + uint32_t I; + float F; + } T; + T.F = Float; + return T.I; +} + +/// NextPowerOf2 - Returns the next power of two (in 64-bits) +/// that is strictly greater than A. Returns zero on overflow. +inline uint64_t NextPowerOf2(uint64_t A) { + A |= (A >> 1); + A |= (A >> 2); + A |= (A >> 4); + A |= (A >> 8); + A |= (A >> 16); + A |= (A >> 32); + return A + 1; +} + +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/None.h b/Robot2016/wpilib/cpp/current/include/llvm/None.h new file mode 100644 index 0000000..d69ec17 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/None.h @@ -0,0 +1,26 @@ +//===-- None.h - Simple null value for implicit construction ------*- C++ -*-=// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides None, an enumerator for use in implicit constructors +// of various (usually templated) types to make such construction more +// terse. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_NONE_H +#define LLVM_ADT_NONE_H + +namespace llvm { +/// \brief A simple null object to allow implicit construction of Optional +/// and similar types without having to spell out the specialization's name. +enum class NoneType { None }; +const NoneType None = None; +} + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/PointerLikeTypeTraits.h b/Robot2016/wpilib/cpp/current/include/llvm/PointerLikeTypeTraits.h new file mode 100644 index 0000000..b4d5a85 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/PointerLikeTypeTraits.h @@ -0,0 +1,81 @@ +//===- llvm/Support/PointerLikeTypeTraits.h - Pointer Traits ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the PointerLikeTypeTraits class. This allows data +// structures to reason about pointers and other things that are pointer sized. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_POINTERLIKETYPETRAITS_H +#define LLVM_SUPPORT_POINTERLIKETYPETRAITS_H + +#include + +namespace llvm { + +/// PointerLikeTypeTraits - This is a traits object that is used to handle +/// pointer types and things that are just wrappers for pointers as a uniform +/// entity. +template +class PointerLikeTypeTraits { + // getAsVoidPointer + // getFromVoidPointer + // getNumLowBitsAvailable +}; + +// Provide PointerLikeTypeTraits for non-cvr pointers. +template +class PointerLikeTypeTraits { +public: + static inline void *getAsVoidPointer(T* P) { return P; } + static inline T *getFromVoidPointer(void *P) { + return static_cast(P); + } + + /// Note, we assume here that malloc returns objects at least 4-byte aligned. + /// However, this may be wrong, or pointers may be from something other than + /// malloc. In this case, you should specialize this template to reduce this. + /// + /// All clients should use assertions to do a run-time check to ensure that + /// this is actually true. + enum { NumLowBitsAvailable = 2 }; +}; + +// Provide PointerLikeTypeTraits for const pointers. +template +class PointerLikeTypeTraits { + typedef PointerLikeTypeTraits NonConst; + +public: + static inline const void *getAsVoidPointer(const T* P) { + return NonConst::getAsVoidPointer(const_cast(P)); + } + static inline const T *getFromVoidPointer(const void *P) { + return NonConst::getFromVoidPointer(const_cast(P)); + } + enum { NumLowBitsAvailable = NonConst::NumLowBitsAvailable }; +}; + +// Provide PointerLikeTypeTraits for uintptr_t. +template<> +class PointerLikeTypeTraits { +public: + static inline void *getAsVoidPointer(uintptr_t P) { + return reinterpret_cast(P); + } + static inline uintptr_t getFromVoidPointer(void *P) { + return reinterpret_cast(P); + } + // No bits are available! + enum { NumLowBitsAvailable = 0 }; +}; + +} // end namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/SmallPtrSet.h b/Robot2016/wpilib/cpp/current/include/llvm/SmallPtrSet.h new file mode 100644 index 0000000..41905fd --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/SmallPtrSet.h @@ -0,0 +1,346 @@ +//===- llvm/ADT/SmallPtrSet.h - 'Normally small' pointer set ----*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the SmallPtrSet class. See the doxygen comment for +// SmallPtrSetImplBase for more details on the algorithm used. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_SMALLPTRSET_H +#define LLVM_ADT_SMALLPTRSET_H + +#include "llvm/Compiler.h" +#include "llvm/PointerLikeTypeTraits.h" +#include +#include +#include +#include +#include + +namespace llvm { + +class SmallPtrSetIteratorImpl; + +/// SmallPtrSetImplBase - This is the common code shared among all the +/// SmallPtrSet<>'s, which is almost everything. SmallPtrSet has two modes, one +/// for small and one for large sets. +/// +/// Small sets use an array of pointers allocated in the SmallPtrSet object, +/// which is treated as a simple array of pointers. When a pointer is added to +/// the set, the array is scanned to see if the element already exists, if not +/// the element is 'pushed back' onto the array. If we run out of space in the +/// array, we grow into the 'large set' case. SmallSet should be used when the +/// sets are often small. In this case, no memory allocation is used, and only +/// light-weight and cache-efficient scanning is used. +/// +/// Large sets use a classic exponentially-probed hash table. Empty buckets are +/// represented with an illegal pointer value (-1) to allow null pointers to be +/// inserted. Tombstones are represented with another illegal pointer value +/// (-2), to allow deletion. The hash table is resized when the table is 3/4 or +/// more. When this happens, the table is doubled in size. +/// +class SmallPtrSetImplBase { + friend class SmallPtrSetIteratorImpl; +protected: + /// SmallArray - Points to a fixed size set of buckets, used in 'small mode'. + const void **SmallArray; + /// CurArray - This is the current set of buckets. If equal to SmallArray, + /// then the set is in 'small mode'. + const void **CurArray; + /// CurArraySize - The allocated size of CurArray, always a power of two. + unsigned CurArraySize; + + // If small, this is # elts allocated consecutively + unsigned NumElements; + unsigned NumTombstones; + + // Helpers to copy and move construct a SmallPtrSet. + SmallPtrSetImplBase(const void **SmallStorage, const SmallPtrSetImplBase &that); + SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize, + SmallPtrSetImplBase &&that); + explicit SmallPtrSetImplBase(const void **SmallStorage, unsigned SmallSize) : + SmallArray(SmallStorage), CurArray(SmallStorage), CurArraySize(SmallSize) { + assert(SmallSize && (SmallSize & (SmallSize-1)) == 0 && + "Initial size must be a power of two!"); + clear(); + } + ~SmallPtrSetImplBase(); + +public: + typedef unsigned size_type; + bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return size() == 0; } + size_type size() const { return NumElements; } + + void clear() { + // If the capacity of the array is huge, and the # elements used is small, + // shrink the array. + if (!isSmall() && NumElements*4 < CurArraySize && CurArraySize > 32) + return shrink_and_clear(); + + // Fill the array with empty markers. + memset(CurArray, -1, CurArraySize*sizeof(void*)); + NumElements = 0; + NumTombstones = 0; + } + +protected: + static void *getTombstoneMarker() { return reinterpret_cast(-2); } + static void *getEmptyMarker() { + // Note that -1 is chosen to make clear() efficiently implementable with + // memset and because it's not a valid pointer value. + return reinterpret_cast(-1); + } + + /// insert_imp - This returns true if the pointer was new to the set, false if + /// it was already in the set. This is hidden from the client so that the + /// derived class can check that the right type of pointer is passed in. + std::pair insert_imp(const void *Ptr); + + /// erase_imp - If the set contains the specified pointer, remove it and + /// return true, otherwise return false. This is hidden from the client so + /// that the derived class can check that the right type of pointer is passed + /// in. + bool erase_imp(const void * Ptr); + + bool count_imp(const void * Ptr) const { + if (isSmall()) { + // Linear search for the item. + for (const void *const *APtr = SmallArray, + *const *E = SmallArray+NumElements; APtr != E; ++APtr) + if (*APtr == Ptr) + return true; + return false; + } + + // Big set case. + return *FindBucketFor(Ptr) == Ptr; + } + +private: + bool isSmall() const { return CurArray == SmallArray; } + + const void * const *FindBucketFor(const void *Ptr) const; + void shrink_and_clear(); + + /// Grow - Allocate a larger backing store for the buckets and move it over. + void Grow(unsigned NewSize); + + void operator=(const SmallPtrSetImplBase &RHS) = delete; +protected: + /// swap - Swaps the elements of two sets. + /// Note: This method assumes that both sets have the same small size. + void swap(SmallPtrSetImplBase &RHS); + + void CopyFrom(const SmallPtrSetImplBase &RHS); + void MoveFrom(unsigned SmallSize, SmallPtrSetImplBase &&RHS); +}; + +/// SmallPtrSetIteratorImpl - This is the common base class shared between all +/// instances of SmallPtrSetIterator. +class SmallPtrSetIteratorImpl { +protected: + const void *const *Bucket; + const void *const *End; +public: + explicit SmallPtrSetIteratorImpl(const void *const *BP, const void*const *E) + : Bucket(BP), End(E) { + AdvanceIfNotValid(); + } + + bool operator==(const SmallPtrSetIteratorImpl &RHS) const { + return Bucket == RHS.Bucket; + } + bool operator!=(const SmallPtrSetIteratorImpl &RHS) const { + return Bucket != RHS.Bucket; + } + +protected: + /// AdvanceIfNotValid - If the current bucket isn't valid, advance to a bucket + /// that is. This is guaranteed to stop because the end() bucket is marked + /// valid. + void AdvanceIfNotValid() { + assert(Bucket <= End); + while (Bucket != End && + (*Bucket == SmallPtrSetImplBase::getEmptyMarker() || + *Bucket == SmallPtrSetImplBase::getTombstoneMarker())) + ++Bucket; + } +}; + +/// SmallPtrSetIterator - This implements a const_iterator for SmallPtrSet. +template +class SmallPtrSetIterator : public SmallPtrSetIteratorImpl { + typedef PointerLikeTypeTraits PtrTraits; + +public: + typedef PtrTy value_type; + typedef PtrTy reference; + typedef PtrTy pointer; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + explicit SmallPtrSetIterator(const void *const *BP, const void *const *E) + : SmallPtrSetIteratorImpl(BP, E) {} + + // Most methods provided by baseclass. + + const PtrTy operator*() const { + assert(Bucket < End); + return PtrTraits::getFromVoidPointer(const_cast(*Bucket)); + } + + inline SmallPtrSetIterator& operator++() { // Preincrement + ++Bucket; + AdvanceIfNotValid(); + return *this; + } + + SmallPtrSetIterator operator++(int) { // Postincrement + SmallPtrSetIterator tmp = *this; ++*this; return tmp; + } +}; + +/// RoundUpToPowerOfTwo - This is a helper template that rounds N up to the next +/// power of two (which means N itself if N is already a power of two). +template +struct RoundUpToPowerOfTwo; + +/// RoundUpToPowerOfTwoH - If N is not a power of two, increase it. This is a +/// helper template used to implement RoundUpToPowerOfTwo. +template +struct RoundUpToPowerOfTwoH { + enum { Val = N }; +}; +template +struct RoundUpToPowerOfTwoH { + enum { + // We could just use NextVal = N+1, but this converges faster. N|(N-1) sets + // the right-most zero bits to one all at once, e.g. 0b0011000 -> 0b0011111. + Val = RoundUpToPowerOfTwo<(N|(N-1)) + 1>::Val + }; +}; + +template +struct RoundUpToPowerOfTwo { + enum { Val = RoundUpToPowerOfTwoH::Val }; +}; + + +/// \brief A templated base class for \c SmallPtrSet which provides the +/// typesafe interface that is common across all small sizes. +/// +/// This is particularly useful for passing around between interface boundaries +/// to avoid encoding a particular small size in the interface boundary. +template +class SmallPtrSetImpl : public SmallPtrSetImplBase { + typedef PointerLikeTypeTraits PtrTraits; + + SmallPtrSetImpl(const SmallPtrSetImpl&) = delete; +protected: + // Constructors that forward to the base. + SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that) + : SmallPtrSetImplBase(SmallStorage, that) {} + SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize, + SmallPtrSetImpl &&that) + : SmallPtrSetImplBase(SmallStorage, SmallSize, std::move(that)) {} + explicit SmallPtrSetImpl(const void **SmallStorage, unsigned SmallSize) + : SmallPtrSetImplBase(SmallStorage, SmallSize) {} + +public: + typedef SmallPtrSetIterator iterator; + typedef SmallPtrSetIterator const_iterator; + + /// Inserts Ptr if and only if there is no element in the container equal to + /// Ptr. The bool component of the returned pair is true if and only if the + /// insertion takes place, and the iterator component of the pair points to + /// the element equal to Ptr. + std::pair insert(PtrType Ptr) { + auto p = insert_imp(PtrTraits::getAsVoidPointer(Ptr)); + return std::make_pair(iterator(p.first, CurArray + CurArraySize), p.second); + } + + /// erase - If the set contains the specified pointer, remove it and return + /// true, otherwise return false. + bool erase(PtrType Ptr) { + return erase_imp(PtrTraits::getAsVoidPointer(Ptr)); + } + + /// count - Return 1 if the specified pointer is in the set, 0 otherwise. + size_type count(PtrType Ptr) const { + return count_imp(PtrTraits::getAsVoidPointer(Ptr)) ? 1 : 0; + } + + template + void insert(IterT I, IterT E) { + for (; I != E; ++I) + insert(*I); + } + + inline iterator begin() const { + return iterator(CurArray, CurArray+CurArraySize); + } + inline iterator end() const { + return iterator(CurArray+CurArraySize, CurArray+CurArraySize); + } +}; + +/// SmallPtrSet - This class implements a set which is optimized for holding +/// SmallSize or less elements. This internally rounds up SmallSize to the next +/// power of two if it is not already a power of two. See the comments above +/// SmallPtrSetImplBase for details of the algorithm. +template +class SmallPtrSet : public SmallPtrSetImpl { + typedef SmallPtrSetImpl BaseT; + + // Make sure that SmallSize is a power of two, round up if not. + enum { SmallSizePowTwo = RoundUpToPowerOfTwo::Val }; + /// SmallStorage - Fixed size storage used in 'small mode'. + const void *SmallStorage[SmallSizePowTwo]; +public: + SmallPtrSet() : BaseT(SmallStorage, SmallSizePowTwo) {} + SmallPtrSet(const SmallPtrSet &that) : BaseT(SmallStorage, that) {} + SmallPtrSet(SmallPtrSet &&that) + : BaseT(SmallStorage, SmallSizePowTwo, std::move(that)) {} + + template + SmallPtrSet(It I, It E) : BaseT(SmallStorage, SmallSizePowTwo) { + this->insert(I, E); + } + + SmallPtrSet & + operator=(const SmallPtrSet &RHS) { + if (&RHS != this) + this->CopyFrom(RHS); + return *this; + } + + SmallPtrSet& + operator=(SmallPtrSet &&RHS) { + if (&RHS != this) + this->MoveFrom(SmallSizePowTwo, std::move(RHS)); + return *this; + } + + /// swap - Swaps the elements of two sets. + void swap(SmallPtrSet &RHS) { + SmallPtrSetImplBase::swap(RHS); + } +}; + +} // namespace llvm + +namespace std { + /// Implement std::swap in terms of SmallPtrSet swap. + template + inline void swap(llvm::SmallPtrSet &LHS, llvm::SmallPtrSet &RHS) { + LHS.swap(RHS); + } +} + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/SmallString.h b/Robot2016/wpilib/cpp/current/include/llvm/SmallString.h new file mode 100644 index 0000000..3f89ca8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/SmallString.h @@ -0,0 +1,297 @@ +//===- llvm/ADT/SmallString.h - 'Normally small' strings --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the SmallString class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_SMALLSTRING_H +#define LLVM_ADT_SMALLSTRING_H + +#include "llvm/SmallVector.h" +#include "llvm/StringRef.h" + +namespace llvm { + +/// SmallString - A SmallString is just a SmallVector with methods and accessors +/// that make it work better as a string (e.g. operator+ etc). +template +class SmallString : public SmallVector { +public: + /// Default ctor - Initialize to empty. + SmallString() {} + + /// Initialize from a StringRef. + SmallString(StringRef S) : SmallVector(S.begin(), S.end()) {} + + /// Initialize with a range. + template + SmallString(ItTy S, ItTy E) : SmallVector(S, E) {} + + // Note that in order to add new overloads for append & assign, we have to + // duplicate the inherited versions so as not to inadvertently hide them. + + /// @} + /// @name String Assignment + /// @{ + + /// Assign from a repeated element. + void assign(size_t NumElts, char Elt) { + this->SmallVectorImpl::assign(NumElts, Elt); + } + + /// Assign from an iterator pair. + template + void assign(in_iter S, in_iter E) { + this->clear(); + SmallVectorImpl::append(S, E); + } + + /// Assign from a StringRef. + void assign(StringRef RHS) { + this->clear(); + SmallVectorImpl::append(RHS.begin(), RHS.end()); + } + + /// Assign from a SmallVector. + void assign(const SmallVectorImpl &RHS) { + this->clear(); + SmallVectorImpl::append(RHS.begin(), RHS.end()); + } + + /// @} + /// @name String Concatenation + /// @{ + + /// Append from an iterator pair. + template + void append(in_iter S, in_iter E) { + SmallVectorImpl::append(S, E); + } + + void append(size_t NumInputs, char Elt) { + SmallVectorImpl::append(NumInputs, Elt); + } + + + /// Append from a StringRef. + void append(StringRef RHS) { + SmallVectorImpl::append(RHS.begin(), RHS.end()); + } + + /// Append from a SmallVector. + void append(const SmallVectorImpl &RHS) { + SmallVectorImpl::append(RHS.begin(), RHS.end()); + } + + /// @} + /// @name String Comparison + /// @{ + + /// Check for string equality. This is more efficient than compare() when + /// the relative ordering of inequal strings isn't needed. + bool equals(StringRef RHS) const { + return str().equals(RHS); + } + + /// Check for string equality, ignoring case. + bool equals_lower(StringRef RHS) const { + return str().equals_lower(RHS); + } + + /// Compare two strings; the result is -1, 0, or 1 if this string is + /// lexicographically less than, equal to, or greater than the \p RHS. + int compare(StringRef RHS) const { + return str().compare(RHS); + } + + /// compare_lower - Compare two strings, ignoring case. + int compare_lower(StringRef RHS) const { + return str().compare_lower(RHS); + } + + /// compare_numeric - Compare two strings, treating sequences of digits as + /// numbers. + int compare_numeric(StringRef RHS) const { + return str().compare_numeric(RHS); + } + + /// @} + /// @name String Predicates + /// @{ + + /// startswith - Check if this string starts with the given \p Prefix. + bool startswith(StringRef Prefix) const { + return str().startswith(Prefix); + } + + /// endswith - Check if this string ends with the given \p Suffix. + bool endswith(StringRef Suffix) const { + return str().endswith(Suffix); + } + + /// @} + /// @name String Searching + /// @{ + + /// find - Search for the first character \p C in the string. + /// + /// \return - The index of the first occurrence of \p C, or npos if not + /// found. + size_t find(char C, size_t From = 0) const { + return str().find(C, From); + } + + /// Search for the first string \p Str in the string. + /// + /// \returns The index of the first occurrence of \p Str, or npos if not + /// found. + size_t find(StringRef Str, size_t From = 0) const { + return str().find(Str, From); + } + + /// Search for the last character \p C in the string. + /// + /// \returns The index of the last occurrence of \p C, or npos if not + /// found. + size_t rfind(char C, size_t From = StringRef::npos) const { + return str().rfind(C, From); + } + + /// Search for the last string \p Str in the string. + /// + /// \returns The index of the last occurrence of \p Str, or npos if not + /// found. + size_t rfind(StringRef Str) const { + return str().rfind(Str); + } + + /// Find the first character in the string that is \p C, or npos if not + /// found. Same as find. + size_t find_first_of(char C, size_t From = 0) const { + return str().find_first_of(C, From); + } + + /// Find the first character in the string that is in \p Chars, or npos if + /// not found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_first_of(StringRef Chars, size_t From = 0) const { + return str().find_first_of(Chars, From); + } + + /// Find the first character in the string that is not \p C or npos if not + /// found. + size_t find_first_not_of(char C, size_t From = 0) const { + return str().find_first_not_of(C, From); + } + + /// Find the first character in the string that is not in the string + /// \p Chars, or npos if not found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_first_not_of(StringRef Chars, size_t From = 0) const { + return str().find_first_not_of(Chars, From); + } + + /// Find the last character in the string that is \p C, or npos if not + /// found. + size_t find_last_of(char C, size_t From = StringRef::npos) const { + return str().find_last_of(C, From); + } + + /// Find the last character in the string that is in \p C, or npos if not + /// found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_last_of( + StringRef Chars, size_t From = StringRef::npos) const { + return str().find_last_of(Chars, From); + } + + /// @} + /// @name Helpful Algorithms + /// @{ + + /// Return the number of occurrences of \p C in the string. + size_t count(char C) const { + return str().count(C); + } + + /// Return the number of non-overlapped occurrences of \p Str in the + /// string. + size_t count(StringRef Str) const { + return str().count(Str); + } + + /// @} + /// @name Substring Operations + /// @{ + + /// Return a reference to the substring from [Start, Start + N). + /// + /// \param Start The index of the starting character in the substring; if + /// the index is npos or greater than the length of the string then the + /// empty substring will be returned. + /// + /// \param N The number of characters to included in the substring. If \p N + /// exceeds the number of characters remaining in the string, the string + /// suffix (starting with \p Start) will be returned. + StringRef substr(size_t Start, size_t N = StringRef::npos) const { + return str().substr(Start, N); + } + + /// Return a reference to the substring from [Start, End). + /// + /// \param Start The index of the starting character in the substring; if + /// the index is npos or greater than the length of the string then the + /// empty substring will be returned. + /// + /// \param End The index following the last character to include in the + /// substring. If this is npos, or less than \p Start, or exceeds the + /// number of characters remaining in the string, the string suffix + /// (starting with \p Start) will be returned. + StringRef slice(size_t Start, size_t End) const { + return str().slice(Start, End); + } + + // Extra methods. + + /// Explicit conversion to StringRef. + StringRef str() const { return StringRef(this->begin(), this->size()); } + + // TODO: Make this const, if it's safe... + const char* c_str() { + this->push_back(0); + this->pop_back(); + return this->data(); + } + + /// Implicit conversion to StringRef. + operator StringRef() const { return str(); } + + // Extra operators. + const SmallString &operator=(StringRef RHS) { + this->clear(); + return *this += RHS; + } + + SmallString &operator+=(StringRef RHS) { + this->append(RHS.begin(), RHS.end()); + return *this; + } + SmallString &operator+=(char C) { + this->push_back(C); + return *this; + } +}; + +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/SmallVector.h b/Robot2016/wpilib/cpp/current/include/llvm/SmallVector.h new file mode 100644 index 0000000..ce8f8ce --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/SmallVector.h @@ -0,0 +1,945 @@ +//===- llvm/ADT/SmallVector.h - 'Normally small' vectors --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the SmallVector class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_SMALLVECTOR_H +#define LLVM_ADT_SMALLVECTOR_H + +#include "llvm/iterator_range.h" +#include "llvm/AlignOf.h" +#include "llvm/Compiler.h" +#include "llvm/MathExtras.h" +#include "llvm/type_traits.h" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace llvm { + +/// This is all the non-templated stuff common to all SmallVectors. +class SmallVectorBase { +protected: + void *BeginX, *EndX, *CapacityX; + +protected: + SmallVectorBase(void *FirstEl, size_t Size) + : BeginX(FirstEl), EndX(FirstEl), CapacityX((char*)FirstEl+Size) {} + + /// This is an implementation of the grow() method which only works + /// on POD-like data types and is out of line to reduce code duplication. + void grow_pod(void *FirstEl, size_t MinSizeInBytes, size_t TSize); + +public: + /// This returns size()*sizeof(T). + size_t size_in_bytes() const { + return size_t((char*)EndX - (char*)BeginX); + } + + /// capacity_in_bytes - This returns capacity()*sizeof(T). + size_t capacity_in_bytes() const { + return size_t((char*)CapacityX - (char*)BeginX); + } + + bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const { return BeginX == EndX; } +}; + +template struct SmallVectorStorage; + +/// This is the part of SmallVectorTemplateBase which does not depend on whether +/// the type T is a POD. The extra dummy template argument is used by ArrayRef +/// to avoid unnecessarily requiring T to be complete. +template +class SmallVectorTemplateCommon : public SmallVectorBase { +private: + template friend struct SmallVectorStorage; + + // Allocate raw space for N elements of type T. If T has a ctor or dtor, we + // don't want it to be automatically run, so we need to represent the space as + // something else. Use an array of char of sufficient alignment. + typedef llvm::AlignedCharArrayUnion U; + U FirstEl; + // Space after 'FirstEl' is clobbered, do not add any instance vars after it. + +protected: + SmallVectorTemplateCommon(size_t Size) : SmallVectorBase(&FirstEl, Size) {} + + void grow_pod(size_t MinSizeInBytes, size_t TSize) { + SmallVectorBase::grow_pod(&FirstEl, MinSizeInBytes, TSize); + } + + /// Return true if this is a smallvector which has not had dynamic + /// memory allocated for it. + bool isSmall() const { + return BeginX == static_cast(&FirstEl); + } + + /// Put this vector in a state of being small. + void resetToSmall() { + BeginX = EndX = CapacityX = &FirstEl; + } + + void setEnd(T *P) { this->EndX = P; } +public: + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *iterator; + typedef const T *const_iterator; + + typedef std::reverse_iterator const_reverse_iterator; + typedef std::reverse_iterator reverse_iterator; + + typedef T &reference; + typedef const T &const_reference; + typedef T *pointer; + typedef const T *const_pointer; + + // forward iterator creation methods. + iterator begin() { return (iterator)this->BeginX; } + const_iterator begin() const { return (const_iterator)this->BeginX; } + iterator end() { return (iterator)this->EndX; } + const_iterator end() const { return (const_iterator)this->EndX; } +protected: + iterator capacity_ptr() { return (iterator)this->CapacityX; } + const_iterator capacity_ptr() const { return (const_iterator)this->CapacityX;} +public: + + // reverse iterator creation methods. + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); } + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return const_reverse_iterator(begin());} + + size_type size() const { return end()-begin(); } + size_type max_size() const { return size_type(-1) / sizeof(T); } + + /// Return the total number of elements in the currently allocated buffer. + size_t capacity() const { return capacity_ptr() - begin(); } + + /// Return a pointer to the vector's buffer, even if empty(). + pointer data() { return pointer(begin()); } + /// Return a pointer to the vector's buffer, even if empty(). + const_pointer data() const { return const_pointer(begin()); } + + reference operator[](size_type idx) { + assert(idx < size()); + return begin()[idx]; + } + const_reference operator[](size_type idx) const { + assert(idx < size()); + return begin()[idx]; + } + + reference front() { + assert(!empty()); + return begin()[0]; + } + const_reference front() const { + assert(!empty()); + return begin()[0]; + } + + reference back() { + assert(!empty()); + return end()[-1]; + } + const_reference back() const { + assert(!empty()); + return end()[-1]; + } +}; + +/// SmallVectorTemplateBase - This is where we put method +/// implementations that are designed to work with non-POD-like T's. +template +class SmallVectorTemplateBase : public SmallVectorTemplateCommon { +protected: + SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon(Size) {} + + static void destroy_range(T *S, T *E) { + while (S != E) { + --E; + E->~T(); + } + } + + /// Use move-assignment to move the range [I, E) onto the + /// objects starting with "Dest". This is just 's + /// std::move, but not all stdlibs actually provide that. + template + static It2 move(It1 I, It1 E, It2 Dest) { + for (; I != E; ++I, ++Dest) + *Dest = ::std::move(*I); + return Dest; + } + + /// Use move-assignment to move the range + /// [I, E) onto the objects ending at "Dest", moving objects + /// in reverse order. This is just 's + /// std::move_backward, but not all stdlibs actually provide that. + template + static It2 move_backward(It1 I, It1 E, It2 Dest) { + while (I != E) + *--Dest = ::std::move(*--E); + return Dest; + } + + /// Move the range [I, E) into the uninitialized memory starting with "Dest", + /// constructing elements as needed. + template + static void uninitialized_move(It1 I, It1 E, It2 Dest) { + for (; I != E; ++I, ++Dest) + ::new ((void*) &*Dest) T(::std::move(*I)); + } + + /// Copy the range [I, E) onto the uninitialized memory starting with "Dest", + /// constructing elements as needed. + template + static void uninitialized_copy(It1 I, It1 E, It2 Dest) { + std::uninitialized_copy(I, E, Dest); + } + + /// Grow the allocated memory (without initializing new elements), doubling + /// the size of the allocated memory. Guarantees space for at least one more + /// element, or MinSize more elements if specified. + void grow(size_t MinSize = 0); + +public: + void push_back(const T &Elt) { + if (LLVM_UNLIKELY(this->EndX >= this->CapacityX)) + this->grow(); + ::new ((void*) this->end()) T(Elt); + this->setEnd(this->end()+1); + } + + void push_back(T &&Elt) { + if (LLVM_UNLIKELY(this->EndX >= this->CapacityX)) + this->grow(); + ::new ((void*) this->end()) T(::std::move(Elt)); + this->setEnd(this->end()+1); + } + + void pop_back() { + this->setEnd(this->end()-1); + this->end()->~T(); + } +}; + +// Define this out-of-line to dissuade the C++ compiler from inlining it. +template +void SmallVectorTemplateBase::grow(size_t MinSize) { + size_t CurCapacity = this->capacity(); + size_t CurSize = this->size(); + // Always grow, even from zero. + size_t NewCapacity = size_t(NextPowerOf2(CurCapacity+2)); + if (NewCapacity < MinSize) + NewCapacity = MinSize; + T *NewElts = static_cast(malloc(NewCapacity*sizeof(T))); + + // Move the elements over. + this->uninitialized_move(this->begin(), this->end(), NewElts); + + // Destroy the original elements. + destroy_range(this->begin(), this->end()); + + // If this wasn't grown from the inline copy, deallocate the old space. + if (!this->isSmall()) + free(this->begin()); + + this->setEnd(NewElts+CurSize); + this->BeginX = NewElts; + this->CapacityX = this->begin()+NewCapacity; +} + + +/// SmallVectorTemplateBase - This is where we put method +/// implementations that are designed to work with POD-like T's. +template +class SmallVectorTemplateBase : public SmallVectorTemplateCommon { +protected: + SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon(Size) {} + + // No need to do a destroy loop for POD's. + static void destroy_range(T *, T *) {} + + /// Use move-assignment to move the range [I, E) onto the + /// objects starting with "Dest". For PODs, this is just memcpy. + template + static It2 move(It1 I, It1 E, It2 Dest) { + return ::std::copy(I, E, Dest); + } + + /// Use move-assignment to move the range [I, E) onto the objects ending at + /// "Dest", moving objects in reverse order. + template + static It2 move_backward(It1 I, It1 E, It2 Dest) { + return ::std::copy_backward(I, E, Dest); + } + + /// Move the range [I, E) onto the uninitialized memory + /// starting with "Dest", constructing elements into it as needed. + template + static void uninitialized_move(It1 I, It1 E, It2 Dest) { + // Just do a copy. + uninitialized_copy(I, E, Dest); + } + + /// Copy the range [I, E) onto the uninitialized memory + /// starting with "Dest", constructing elements into it as needed. + template + static void uninitialized_copy(It1 I, It1 E, It2 Dest) { + // Arbitrary iterator types; just use the basic implementation. + std::uninitialized_copy(I, E, Dest); + } + + /// Copy the range [I, E) onto the uninitialized memory + /// starting with "Dest", constructing elements into it as needed. + template + static void uninitialized_copy( + T1 *I, T1 *E, T2 *Dest, + typename std::enable_if::type, + T2>::value>::type * = nullptr) { + // Use memcpy for PODs iterated by pointers (which includes SmallVector + // iterators): std::uninitialized_copy optimizes to memmove, but we can + // use memcpy here. + memcpy(Dest, I, (E-I)*sizeof(T)); + } + + /// Double the size of the allocated memory, guaranteeing space for at + /// least one more element or MinSize if specified. + void grow(size_t MinSize = 0) { + this->grow_pod(MinSize*sizeof(T), sizeof(T)); + } +public: + void push_back(const T &Elt) { + if (LLVM_UNLIKELY(this->EndX >= this->CapacityX)) + this->grow(); + memcpy(this->end(), &Elt, sizeof(T)); + this->setEnd(this->end()+1); + } + + void pop_back() { + this->setEnd(this->end()-1); + } +}; + + +/// This class consists of common code factored out of the SmallVector class to +/// reduce code duplication based on the SmallVector 'N' template parameter. +template +class SmallVectorImpl : public SmallVectorTemplateBase::value> { + typedef SmallVectorTemplateBase::value > SuperClass; + + SmallVectorImpl(const SmallVectorImpl&) = delete; +public: + typedef typename SuperClass::iterator iterator; + typedef typename SuperClass::size_type size_type; + +protected: + // Default ctor - Initialize to empty. + explicit SmallVectorImpl(unsigned N) + : SmallVectorTemplateBase::value>(N*sizeof(T)) { + } + +public: + ~SmallVectorImpl() { + // Destroy the constructed elements in the vector. + this->destroy_range(this->begin(), this->end()); + + // If this wasn't grown from the inline copy, deallocate the old space. + if (!this->isSmall()) + free(this->begin()); + } + + + void clear() { + this->destroy_range(this->begin(), this->end()); + this->EndX = this->BeginX; + } + + void resize(size_type N) { + if (N < this->size()) { + this->destroy_range(this->begin()+N, this->end()); + this->setEnd(this->begin()+N); + } else if (N > this->size()) { + if (this->capacity() < N) + this->grow(N); + for (auto I = this->end(), E = this->begin() + N; I != E; ++I) + new (&*I) T(); + this->setEnd(this->begin()+N); + } + } + + void resize(size_type N, const T &NV) { + if (N < this->size()) { + this->destroy_range(this->begin()+N, this->end()); + this->setEnd(this->begin()+N); + } else if (N > this->size()) { + if (this->capacity() < N) + this->grow(N); + std::uninitialized_fill(this->end(), this->begin()+N, NV); + this->setEnd(this->begin()+N); + } + } + + void reserve(size_type N) { + if (this->capacity() < N) + this->grow(N); + } + + T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val() { + T Result = ::std::move(this->back()); + this->pop_back(); + return Result; + } + + void swap(SmallVectorImpl &RHS); + + /// Add the specified range to the end of the SmallVector. + template + void append(in_iter in_start, in_iter in_end) { + size_type NumInputs = std::distance(in_start, in_end); + // Grow allocated space if needed. + if (NumInputs > size_type(this->capacity_ptr()-this->end())) + this->grow(this->size()+NumInputs); + + // Copy the new elements over. + this->uninitialized_copy(in_start, in_end, this->end()); + this->setEnd(this->end() + NumInputs); + } + + /// Add the specified range to the end of the SmallVector. + void append(size_type NumInputs, const T &Elt) { + // Grow allocated space if needed. + if (NumInputs > size_type(this->capacity_ptr()-this->end())) + this->grow(this->size()+NumInputs); + + // Copy the new elements over. + std::uninitialized_fill_n(this->end(), NumInputs, Elt); + this->setEnd(this->end() + NumInputs); + } + + void append(std::initializer_list IL) { + append(IL.begin(), IL.end()); + } + + void assign(size_type NumElts, const T &Elt) { + clear(); + if (this->capacity() < NumElts) + this->grow(NumElts); + this->setEnd(this->begin()+NumElts); + std::uninitialized_fill(this->begin(), this->end(), Elt); + } + + void assign(std::initializer_list IL) { + clear(); + append(IL); + } + + iterator erase(iterator I) { + assert(I >= this->begin() && "Iterator to erase is out of bounds."); + assert(I < this->end() && "Erasing at past-the-end iterator."); + + iterator N = I; + // Shift all elts down one. + this->move(I+1, this->end(), I); + // Drop the last elt. + this->pop_back(); + return(N); + } + + iterator erase(iterator S, iterator E) { + assert(S >= this->begin() && "Range to erase is out of bounds."); + assert(S <= E && "Trying to erase invalid range."); + assert(E <= this->end() && "Trying to erase past the end."); + + iterator N = S; + // Shift all elts down. + iterator I = this->move(E, this->end(), S); + // Drop the last elts. + this->destroy_range(I, this->end()); + this->setEnd(I); + return(N); + } + + iterator insert(iterator I, T &&Elt) { + if (I == this->end()) { // Important special case for empty vector. + this->push_back(::std::move(Elt)); + return this->end()-1; + } + + assert(I >= this->begin() && "Insertion iterator is out of bounds."); + assert(I <= this->end() && "Inserting past the end of the vector."); + + if (this->EndX >= this->CapacityX) { + size_t EltNo = I-this->begin(); + this->grow(); + I = this->begin()+EltNo; + } + + ::new ((void*) this->end()) T(::std::move(this->back())); + // Push everything else over. + this->move_backward(I, this->end()-1, this->end()); + this->setEnd(this->end()+1); + + // If we just moved the element we're inserting, be sure to update + // the reference. + T *EltPtr = &Elt; + if (I <= EltPtr && EltPtr < this->EndX) + ++EltPtr; + + *I = ::std::move(*EltPtr); + return I; + } + + iterator insert(iterator I, const T &Elt) { + if (I == this->end()) { // Important special case for empty vector. + this->push_back(Elt); + return this->end()-1; + } + + assert(I >= this->begin() && "Insertion iterator is out of bounds."); + assert(I <= this->end() && "Inserting past the end of the vector."); + + if (this->EndX >= this->CapacityX) { + size_t EltNo = I-this->begin(); + this->grow(); + I = this->begin()+EltNo; + } + ::new ((void*) this->end()) T(std::move(this->back())); + // Push everything else over. + this->move_backward(I, this->end()-1, this->end()); + this->setEnd(this->end()+1); + + // If we just moved the element we're inserting, be sure to update + // the reference. + const T *EltPtr = &Elt; + if (I <= EltPtr && EltPtr < this->EndX) + ++EltPtr; + + *I = *EltPtr; + return I; + } + + iterator insert(iterator I, size_type NumToInsert, const T &Elt) { + // Convert iterator to elt# to avoid invalidating iterator when we reserve() + size_t InsertElt = I - this->begin(); + + if (I == this->end()) { // Important special case for empty vector. + append(NumToInsert, Elt); + return this->begin()+InsertElt; + } + + assert(I >= this->begin() && "Insertion iterator is out of bounds."); + assert(I <= this->end() && "Inserting past the end of the vector."); + + // Ensure there is enough space. + reserve(this->size() + NumToInsert); + + // Uninvalidate the iterator. + I = this->begin()+InsertElt; + + // If there are more elements between the insertion point and the end of the + // range than there are being inserted, we can use a simple approach to + // insertion. Since we already reserved space, we know that this won't + // reallocate the vector. + if (size_t(this->end()-I) >= NumToInsert) { + T *OldEnd = this->end(); + append(std::move_iterator(this->end() - NumToInsert), + std::move_iterator(this->end())); + + // Copy the existing elements that get replaced. + this->move_backward(I, OldEnd-NumToInsert, OldEnd); + + std::fill_n(I, NumToInsert, Elt); + return I; + } + + // Otherwise, we're inserting more elements than exist already, and we're + // not inserting at the end. + + // Move over the elements that we're about to overwrite. + T *OldEnd = this->end(); + this->setEnd(this->end() + NumToInsert); + size_t NumOverwritten = OldEnd-I; + this->uninitialized_move(I, OldEnd, this->end()-NumOverwritten); + + // Replace the overwritten part. + std::fill_n(I, NumOverwritten, Elt); + + // Insert the non-overwritten middle part. + std::uninitialized_fill_n(OldEnd, NumToInsert-NumOverwritten, Elt); + return I; + } + + template + iterator insert(iterator I, ItTy From, ItTy To) { + // Convert iterator to elt# to avoid invalidating iterator when we reserve() + size_t InsertElt = I - this->begin(); + + if (I == this->end()) { // Important special case for empty vector. + append(From, To); + return this->begin()+InsertElt; + } + + assert(I >= this->begin() && "Insertion iterator is out of bounds."); + assert(I <= this->end() && "Inserting past the end of the vector."); + + size_t NumToInsert = std::distance(From, To); + + // Ensure there is enough space. + reserve(this->size() + NumToInsert); + + // Uninvalidate the iterator. + I = this->begin()+InsertElt; + + // If there are more elements between the insertion point and the end of the + // range than there are being inserted, we can use a simple approach to + // insertion. Since we already reserved space, we know that this won't + // reallocate the vector. + if (size_t(this->end()-I) >= NumToInsert) { + T *OldEnd = this->end(); + append(std::move_iterator(this->end() - NumToInsert), + std::move_iterator(this->end())); + + // Copy the existing elements that get replaced. + this->move_backward(I, OldEnd-NumToInsert, OldEnd); + + std::copy(From, To, I); + return I; + } + + // Otherwise, we're inserting more elements than exist already, and we're + // not inserting at the end. + + // Move over the elements that we're about to overwrite. + T *OldEnd = this->end(); + this->setEnd(this->end() + NumToInsert); + size_t NumOverwritten = OldEnd-I; + this->uninitialized_move(I, OldEnd, this->end()-NumOverwritten); + + // Replace the overwritten part. + for (T *J = I; NumOverwritten > 0; --NumOverwritten) { + *J = *From; + ++J; ++From; + } + + // Insert the non-overwritten middle part. + this->uninitialized_copy(From, To, OldEnd); + return I; + } + + void insert(iterator I, std::initializer_list IL) { + insert(I, IL.begin(), IL.end()); + } + + template void emplace_back(ArgTypes &&... Args) { + if (LLVM_UNLIKELY(this->EndX >= this->CapacityX)) + this->grow(); + ::new ((void *)this->end()) T(std::forward(Args)...); + this->setEnd(this->end() + 1); + } + + SmallVectorImpl &operator=(const SmallVectorImpl &RHS); + + SmallVectorImpl &operator=(SmallVectorImpl &&RHS); + + bool operator==(const SmallVectorImpl &RHS) const { + if (this->size() != RHS.size()) return false; + return std::equal(this->begin(), this->end(), RHS.begin()); + } + bool operator!=(const SmallVectorImpl &RHS) const { + return !(*this == RHS); + } + + bool operator<(const SmallVectorImpl &RHS) const { + return std::lexicographical_compare(this->begin(), this->end(), + RHS.begin(), RHS.end()); + } + + /// Set the array size to \p N, which the current array must have enough + /// capacity for. + /// + /// This does not construct or destroy any elements in the vector. + /// + /// Clients can use this in conjunction with capacity() to write past the end + /// of the buffer when they know that more elements are available, and only + /// update the size later. This avoids the cost of value initializing elements + /// which will only be overwritten. + void set_size(size_type N) { + assert(N <= this->capacity()); + this->setEnd(this->begin() + N); + } +}; + + +template +void SmallVectorImpl::swap(SmallVectorImpl &RHS) { + if (this == &RHS) return; + + // We can only avoid copying elements if neither vector is small. + if (!this->isSmall() && !RHS.isSmall()) { + std::swap(this->BeginX, RHS.BeginX); + std::swap(this->EndX, RHS.EndX); + std::swap(this->CapacityX, RHS.CapacityX); + return; + } + if (RHS.size() > this->capacity()) + this->grow(RHS.size()); + if (this->size() > RHS.capacity()) + RHS.grow(this->size()); + + // Swap the shared elements. + size_t NumShared = this->size(); + if (NumShared > RHS.size()) NumShared = RHS.size(); + for (size_type i = 0; i != NumShared; ++i) + std::swap((*this)[i], RHS[i]); + + // Copy over the extra elts. + if (this->size() > RHS.size()) { + size_t EltDiff = this->size() - RHS.size(); + this->uninitialized_copy(this->begin()+NumShared, this->end(), RHS.end()); + RHS.setEnd(RHS.end()+EltDiff); + this->destroy_range(this->begin()+NumShared, this->end()); + this->setEnd(this->begin()+NumShared); + } else if (RHS.size() > this->size()) { + size_t EltDiff = RHS.size() - this->size(); + this->uninitialized_copy(RHS.begin()+NumShared, RHS.end(), this->end()); + this->setEnd(this->end() + EltDiff); + this->destroy_range(RHS.begin()+NumShared, RHS.end()); + RHS.setEnd(RHS.begin()+NumShared); + } +} + +template +SmallVectorImpl &SmallVectorImpl:: + operator=(const SmallVectorImpl &RHS) { + // Avoid self-assignment. + if (this == &RHS) return *this; + + // If we already have sufficient space, assign the common elements, then + // destroy any excess. + size_t RHSSize = RHS.size(); + size_t CurSize = this->size(); + if (CurSize >= RHSSize) { + // Assign common elements. + iterator NewEnd; + if (RHSSize) + NewEnd = std::copy(RHS.begin(), RHS.begin()+RHSSize, this->begin()); + else + NewEnd = this->begin(); + + // Destroy excess elements. + this->destroy_range(NewEnd, this->end()); + + // Trim. + this->setEnd(NewEnd); + return *this; + } + + // If we have to grow to have enough elements, destroy the current elements. + // This allows us to avoid copying them during the grow. + // FIXME: don't do this if they're efficiently moveable. + if (this->capacity() < RHSSize) { + // Destroy current elements. + this->destroy_range(this->begin(), this->end()); + this->setEnd(this->begin()); + CurSize = 0; + this->grow(RHSSize); + } else if (CurSize) { + // Otherwise, use assignment for the already-constructed elements. + std::copy(RHS.begin(), RHS.begin()+CurSize, this->begin()); + } + + // Copy construct the new elements in place. + this->uninitialized_copy(RHS.begin()+CurSize, RHS.end(), + this->begin()+CurSize); + + // Set end. + this->setEnd(this->begin()+RHSSize); + return *this; +} + +template +SmallVectorImpl &SmallVectorImpl::operator=(SmallVectorImpl &&RHS) { + // Avoid self-assignment. + if (this == &RHS) return *this; + + // If the RHS isn't small, clear this vector and then steal its buffer. + if (!RHS.isSmall()) { + this->destroy_range(this->begin(), this->end()); + if (!this->isSmall()) free(this->begin()); + this->BeginX = RHS.BeginX; + this->EndX = RHS.EndX; + this->CapacityX = RHS.CapacityX; + RHS.resetToSmall(); + return *this; + } + + // If we already have sufficient space, assign the common elements, then + // destroy any excess. + size_t RHSSize = RHS.size(); + size_t CurSize = this->size(); + if (CurSize >= RHSSize) { + // Assign common elements. + iterator NewEnd = this->begin(); + if (RHSSize) + NewEnd = this->move(RHS.begin(), RHS.end(), NewEnd); + + // Destroy excess elements and trim the bounds. + this->destroy_range(NewEnd, this->end()); + this->setEnd(NewEnd); + + // Clear the RHS. + RHS.clear(); + + return *this; + } + + // If we have to grow to have enough elements, destroy the current elements. + // This allows us to avoid copying them during the grow. + // FIXME: this may not actually make any sense if we can efficiently move + // elements. + if (this->capacity() < RHSSize) { + // Destroy current elements. + this->destroy_range(this->begin(), this->end()); + this->setEnd(this->begin()); + CurSize = 0; + this->grow(RHSSize); + } else if (CurSize) { + // Otherwise, use assignment for the already-constructed elements. + this->move(RHS.begin(), RHS.begin()+CurSize, this->begin()); + } + + // Move-construct the new elements in place. + this->uninitialized_move(RHS.begin()+CurSize, RHS.end(), + this->begin()+CurSize); + + // Set end. + this->setEnd(this->begin()+RHSSize); + + RHS.clear(); + return *this; +} + +/// Storage for the SmallVector elements which aren't contained in +/// SmallVectorTemplateCommon. There are 'N-1' elements here. The remaining '1' +/// element is in the base class. This is specialized for the N=1 and N=0 cases +/// to avoid allocating unnecessary storage. +template +struct SmallVectorStorage { + typename SmallVectorTemplateCommon::U InlineElts[N - 1]; +}; +template struct SmallVectorStorage {}; +template struct SmallVectorStorage {}; + +/// This is a 'vector' (really, a variable-sized array), optimized +/// for the case when the array is small. It contains some number of elements +/// in-place, which allows it to avoid heap allocation when the actual number of +/// elements is below that threshold. This allows normal "small" cases to be +/// fast without losing generality for large inputs. +/// +/// Note that this does not attempt to be exception safe. +/// +template +class SmallVector : public SmallVectorImpl { + /// Inline space for elements which aren't stored in the base class. + SmallVectorStorage Storage; +public: + SmallVector() : SmallVectorImpl(N) { + } + + explicit SmallVector(size_t Size, const T &Value = T()) + : SmallVectorImpl(N) { + this->assign(Size, Value); + } + + template + SmallVector(ItTy S, ItTy E) : SmallVectorImpl(N) { + this->append(S, E); + } + + template + explicit SmallVector(const llvm::iterator_range R) + : SmallVectorImpl(N) { + this->append(R.begin(), R.end()); + } + + SmallVector(std::initializer_list IL) : SmallVectorImpl(N) { + this->assign(IL); + } + + SmallVector(const SmallVector &RHS) : SmallVectorImpl(N) { + if (!RHS.empty()) + SmallVectorImpl::operator=(RHS); + } + + const SmallVector &operator=(const SmallVector &RHS) { + SmallVectorImpl::operator=(RHS); + return *this; + } + + SmallVector(SmallVector &&RHS) : SmallVectorImpl(N) { + if (!RHS.empty()) + SmallVectorImpl::operator=(::std::move(RHS)); + } + + const SmallVector &operator=(SmallVector &&RHS) { + SmallVectorImpl::operator=(::std::move(RHS)); + return *this; + } + + SmallVector(SmallVectorImpl &&RHS) : SmallVectorImpl(N) { + if (!RHS.empty()) + SmallVectorImpl::operator=(::std::move(RHS)); + } + + const SmallVector &operator=(SmallVectorImpl &&RHS) { + SmallVectorImpl::operator=(::std::move(RHS)); + return *this; + } + + const SmallVector &operator=(std::initializer_list IL) { + this->assign(IL); + return *this; + } +}; + +template +static inline size_t capacity_in_bytes(const SmallVector &X) { + return X.capacity_in_bytes(); +} + +} // namespace llvm + +namespace std { + /// Implement std::swap in terms of SmallVector swap. + template + inline void + swap(llvm::SmallVectorImpl &LHS, llvm::SmallVectorImpl &RHS) { + LHS.swap(RHS); + } + + /// Implement std::swap in terms of SmallVector swap. + template + inline void + swap(llvm::SmallVector &LHS, llvm::SmallVector &RHS) { + LHS.swap(RHS); + } +} // namespace std + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/StringExtras.h b/Robot2016/wpilib/cpp/current/include/llvm/StringExtras.h new file mode 100644 index 0000000..d5a8deb --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/StringExtras.h @@ -0,0 +1,212 @@ +//===-- llvm/ADT/StringExtras.h - Useful string functions -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file contains some functions that are useful when dealing with strings. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_STRINGEXTRAS_H +#define LLVM_ADT_STRINGEXTRAS_H + +#include "llvm/StringRef.h" +#include +#include + +namespace llvm { +template class SmallVectorImpl; + +/// hexdigit - Return the hexadecimal character for the +/// given number \p X (which should be less than 16). +static inline char hexdigit(unsigned X, bool LowerCase = false) { + const char HexChar = LowerCase ? 'a' : 'A'; + return X < 10 ? '0' + X : HexChar + X - 10; +} + +/// Construct a string ref from a boolean. +static inline StringRef toStringRef(bool B) { + return StringRef(B ? "true" : "false"); +} + +/// Interpret the given character \p C as a hexadecimal digit and return its +/// value. +/// +/// If \p C is not a valid hex digit, -1U is returned. +static inline unsigned hexDigitValue(char C) { + if (C >= '0' && C <= '9') return C-'0'; + if (C >= 'a' && C <= 'f') return C-'a'+10U; + if (C >= 'A' && C <= 'F') return C-'A'+10U; + return -1U; +} + +/// utohex_buffer - Emit the specified number into the buffer specified by +/// BufferEnd, returning a pointer to the start of the string. This can be used +/// like this: (note that the buffer must be large enough to handle any number): +/// char Buffer[40]; +/// printf("0x%s", utohex_buffer(X, Buffer+40)); +/// +/// This should only be used with unsigned types. +/// +template +static inline char *utohex_buffer(IntTy X, char *BufferEnd, bool LowerCase = false) { + char *BufPtr = BufferEnd; + *--BufPtr = 0; // Null terminate buffer. + if (X == 0) { + *--BufPtr = '0'; // Handle special case. + return BufPtr; + } + + while (X) { + unsigned char Mod = static_cast(X) & 15; + *--BufPtr = hexdigit(Mod, LowerCase); + X >>= 4; + } + return BufPtr; +} + +static inline std::string utohexstr(uint64_t X, bool LowerCase = false) { + char Buffer[17]; + return utohex_buffer(X, Buffer+17, LowerCase); +} + +static inline std::string utostr_32(uint32_t X, bool isNeg = false) { + char Buffer[11]; + char *BufPtr = Buffer+11; + + if (X == 0) *--BufPtr = '0'; // Handle special case... + + while (X) { + *--BufPtr = '0' + char(X % 10); + X /= 10; + } + + if (isNeg) *--BufPtr = '-'; // Add negative sign... + + return std::string(BufPtr, Buffer+11); +} + +static inline std::string utostr(uint64_t X, bool isNeg = false) { + char Buffer[21]; + char *BufPtr = Buffer+21; + + if (X == 0) *--BufPtr = '0'; // Handle special case... + + while (X) { + *--BufPtr = '0' + char(X % 10); + X /= 10; + } + + if (isNeg) *--BufPtr = '-'; // Add negative sign... + return std::string(BufPtr, Buffer+21); +} + + +static inline std::string itostr(int64_t X) { + if (X < 0) + return utostr(static_cast(-X), true); + else + return utostr(static_cast(X)); +} + +/// StrInStrNoCase - Portable version of strcasestr. Locates the first +/// occurrence of string 's1' in string 's2', ignoring case. Returns +/// the offset of s2 in s1 or npos if s2 cannot be found. +StringRef::size_type StrInStrNoCase(StringRef s1, StringRef s2); + +/// getToken - This function extracts one token from source, ignoring any +/// leading characters that appear in the Delimiters string, and ending the +/// token at any of the characters that appear in the Delimiters string. If +/// there are no tokens in the source string, an empty string is returned. +/// The function returns a pair containing the extracted token and the +/// remaining tail string. +std::pair getToken(StringRef Source, + StringRef Delimiters = " \t\n\v\f\r"); + +/// SplitString - Split up the specified string according to the specified +/// delimiters, appending the result fragments to the output list. +void SplitString(StringRef Source, + SmallVectorImpl &OutFragments, + StringRef Delimiters = " \t\n\v\f\r"); + +/// HashString - Hash function for strings. +/// +/// This is the Bernstein hash function. +// +// FIXME: Investigate whether a modified bernstein hash function performs +// better: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx +// X*33+c -> X*33^c +static inline unsigned HashString(StringRef Str, unsigned Result = 0) { + for (StringRef::size_type i = 0, e = Str.size(); i != e; ++i) + Result = Result * 33 + (unsigned char)Str[i]; + return Result; +} + +/// Returns the English suffix for an ordinal integer (-st, -nd, -rd, -th). +static inline StringRef getOrdinalSuffix(unsigned Val) { + // It is critically important that we do this perfectly for + // user-written sequences with over 100 elements. + switch (Val % 100) { + case 11: + case 12: + case 13: + return "th"; + default: + switch (Val % 10) { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + default: return "th"; + } + } +} + +template +inline std::string join_impl(IteratorT Begin, IteratorT End, + StringRef Separator, std::input_iterator_tag) { + std::string S; + if (Begin == End) + return S; + + S += (*Begin); + while (++Begin != End) { + S += Separator; + S += (*Begin); + } + return S; +} + +template +inline std::string join_impl(IteratorT Begin, IteratorT End, + StringRef Separator, std::forward_iterator_tag) { + std::string S; + if (Begin == End) + return S; + + size_t Len = (std::distance(Begin, End) - 1) * Separator.size(); + for (IteratorT I = Begin; I != End; ++I) + Len += (*Begin).size(); + S.reserve(Len); + S += (*Begin); + while (++Begin != End) { + S += Separator; + S += (*Begin); + } + return S; +} + +/// Joins the strings in the range [Begin, End), adding Separator between +/// the elements. +template +inline std::string join(IteratorT Begin, IteratorT End, StringRef Separator) { + typedef typename std::iterator_traits::iterator_category tag; + return join_impl(Begin, End, Separator, tag()); +} + +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/StringMap.h b/Robot2016/wpilib/cpp/current/include/llvm/StringMap.h new file mode 100644 index 0000000..3bac33f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/StringMap.h @@ -0,0 +1,417 @@ +//===--- StringMap.h - String Hash table map interface ----------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines the StringMap class. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_STRINGMAP_H +#define LLVM_ADT_STRINGMAP_H + +#include "llvm/StringRef.h" +#include +#include +#include + +namespace llvm { + template + class StringMapConstIterator; + template + class StringMapIterator; + template + class StringMapEntry; + +/// StringMapEntryBase - Shared base class of StringMapEntry instances. +class StringMapEntryBase { + unsigned StrLen; +public: + explicit StringMapEntryBase(unsigned Len) : StrLen(Len) {} + + unsigned getKeyLength() const { return StrLen; } +}; + +/// StringMapImpl - This is the base class of StringMap that is shared among +/// all of its instantiations. +class StringMapImpl { +protected: + // Array of NumBuckets pointers to entries, null pointers are holes. + // TheTable[NumBuckets] contains a sentinel value for easy iteration. Followed + // by an array of the actual hash values as unsigned integers. + StringMapEntryBase **TheTable; + unsigned NumBuckets; + unsigned NumItems; + unsigned NumTombstones; + unsigned ItemSize; +protected: + explicit StringMapImpl(unsigned itemSize) + : TheTable(nullptr), + // Initialize the map with zero buckets to allocation. + NumBuckets(0), NumItems(0), NumTombstones(0), ItemSize(itemSize) {} + StringMapImpl(StringMapImpl &&RHS) + : TheTable(RHS.TheTable), NumBuckets(RHS.NumBuckets), + NumItems(RHS.NumItems), NumTombstones(RHS.NumTombstones), + ItemSize(RHS.ItemSize) { + RHS.TheTable = nullptr; + RHS.NumBuckets = 0; + RHS.NumItems = 0; + RHS.NumTombstones = 0; + } + + StringMapImpl(unsigned InitSize, unsigned ItemSize); + unsigned RehashTable(unsigned BucketNo = 0); + + /// LookupBucketFor - Look up the bucket that the specified string should end + /// up in. If it already exists as a key in the map, the Item pointer for the + /// specified bucket will be non-null. Otherwise, it will be null. In either + /// case, the FullHashValue field of the bucket will be set to the hash value + /// of the string. + unsigned LookupBucketFor(StringRef Key); + + /// FindKey - Look up the bucket that contains the specified key. If it exists + /// in the map, return the bucket number of the key. Otherwise return -1. + /// This does not modify the map. + int FindKey(StringRef Key) const; + + /// RemoveKey - Remove the specified StringMapEntry from the table, but do not + /// delete it. This aborts if the value isn't in the table. + void RemoveKey(StringMapEntryBase *V); + + /// RemoveKey - Remove the StringMapEntry for the specified key from the + /// table, returning it. If the key is not in the table, this returns null. + StringMapEntryBase *RemoveKey(StringRef Key); +private: + void init(unsigned Size); +public: + static StringMapEntryBase *getTombstoneVal() { + return (StringMapEntryBase*)-1; + } + + unsigned getNumBuckets() const { return NumBuckets; } + unsigned getNumItems() const { return NumItems; } + + bool empty() const { return NumItems == 0; } + unsigned size() const { return NumItems; } + + void swap(StringMapImpl &Other) { + std::swap(TheTable, Other.TheTable); + std::swap(NumBuckets, Other.NumBuckets); + std::swap(NumItems, Other.NumItems); + std::swap(NumTombstones, Other.NumTombstones); + } +}; + +/// StringMapEntry - This is used to represent one value that is inserted into +/// a StringMap. It contains the Value itself and the key: the string length +/// and data. +template +class StringMapEntry : public StringMapEntryBase { + StringMapEntry(StringMapEntry &E) = delete; +public: + ValueTy second; + + explicit StringMapEntry(unsigned strLen) + : StringMapEntryBase(strLen), second() {} + template + StringMapEntry(unsigned strLen, InitTy &&V) + : StringMapEntryBase(strLen), second(std::forward(V)) {} + + StringRef getKey() const { + return StringRef(getKeyData(), getKeyLength()); + } + + const ValueTy &getValue() const { return second; } + ValueTy &getValue() { return second; } + + void setValue(const ValueTy &V) { second = V; } + + /// getKeyData - Return the start of the string data that is the key for this + /// value. The string data is always stored immediately after the + /// StringMapEntry object. + const char *getKeyData() const {return reinterpret_cast(this+1);} + + StringRef first() const { return StringRef(getKeyData(), getKeyLength()); } + + /// Create - Create a StringMapEntry for the specified key and default + /// construct the value. + template + static StringMapEntry *Create(StringRef Key, InitType &&InitVal) { + unsigned KeyLength = Key.size(); + + // Allocate a new item with space for the string at the end and a null + // terminator. + unsigned AllocSize = static_cast(sizeof(StringMapEntry))+ + KeyLength+1; + + StringMapEntry *NewItem = + static_cast(std::malloc(AllocSize)); + + // Default construct the value. + new (NewItem) StringMapEntry(KeyLength, std::forward(InitVal)); + + // Copy the string information. + char *StrBuffer = const_cast(NewItem->getKeyData()); + memcpy(StrBuffer, Key.data(), KeyLength); + StrBuffer[KeyLength] = 0; // Null terminate for convenience of clients. + return NewItem; + } + + static StringMapEntry *Create(StringRef Key) { + return Create(Key, ValueTy()); + } + + /// GetStringMapEntryFromKeyData - Given key data that is known to be embedded + /// into a StringMapEntry, return the StringMapEntry itself. + static StringMapEntry &GetStringMapEntryFromKeyData(const char *KeyData) { + char *Ptr = const_cast(KeyData) - sizeof(StringMapEntry); + return *reinterpret_cast(Ptr); + } + + /// Destroy - Destroy this StringMapEntry, releasing memory back to the + /// specified allocator. + void Destroy() { + // Free memory referenced by the item. + this->~StringMapEntry(); + std::free(static_cast(this)); + } +}; + + +/// StringMap - This is an unconventional map that is specialized for handling +/// keys that are "strings", which are basically ranges of bytes. This does some +/// funky memory allocation and hashing things to make it extremely efficient, +/// storing the string data *after* the value in the map. +template +class StringMap : public StringMapImpl { +public: + typedef StringMapEntry MapEntryTy; + + StringMap() : StringMapImpl(static_cast(sizeof(MapEntryTy))) {} + explicit StringMap(unsigned InitialSize) + : StringMapImpl(InitialSize, static_cast(sizeof(MapEntryTy))) {} + + StringMap(StringMap &&RHS) + : StringMapImpl(std::move(RHS)) {} + + StringMap &operator=(StringMap RHS) { + StringMapImpl::swap(RHS); + return *this; + } + + // FIXME: Implement copy operations if/when they're needed. + + typedef const char* key_type; + typedef ValueTy mapped_type; + typedef StringMapEntry value_type; + typedef size_t size_type; + + typedef StringMapConstIterator const_iterator; + typedef StringMapIterator iterator; + + iterator begin() { + return iterator(TheTable, NumBuckets == 0); + } + iterator end() { + return iterator(TheTable+NumBuckets, true); + } + const_iterator begin() const { + return const_iterator(TheTable, NumBuckets == 0); + } + const_iterator end() const { + return const_iterator(TheTable+NumBuckets, true); + } + + iterator find(StringRef Key) { + int Bucket = FindKey(Key); + if (Bucket == -1) return end(); + return iterator(TheTable+Bucket, true); + } + + const_iterator find(StringRef Key) const { + int Bucket = FindKey(Key); + if (Bucket == -1) return end(); + return const_iterator(TheTable+Bucket, true); + } + + /// lookup - Return the entry for the specified key, or a default + /// constructed value if no such entry exists. + ValueTy lookup(StringRef Key) const { + const_iterator it = find(Key); + if (it != end()) + return it->second; + return ValueTy(); + } + + ValueTy &operator[](StringRef Key) { + return insert(std::make_pair(Key, ValueTy())).first->second; + } + + /// count - Return 1 if the element is in the map, 0 otherwise. + size_type count(StringRef Key) const { + return find(Key) == end() ? 0 : 1; + } + + /// insert - Insert the specified key/value pair into the map. If the key + /// already exists in the map, return false and ignore the request, otherwise + /// insert it and return true. + bool insert(MapEntryTy *KeyValue) { + unsigned BucketNo = LookupBucketFor(KeyValue->getKey()); + StringMapEntryBase *&Bucket = TheTable[BucketNo]; + if (Bucket && Bucket != getTombstoneVal()) + return false; // Already exists in map. + + if (Bucket == getTombstoneVal()) + --NumTombstones; + Bucket = KeyValue; + ++NumItems; + assert(NumItems + NumTombstones <= NumBuckets); + + RehashTable(); + return true; + } + + /// insert - Inserts the specified key/value pair into the map if the key + /// isn't already in the map. The bool component of the returned pair is true + /// if and only if the insertion takes place, and the iterator component of + /// the pair points to the element with key equivalent to the key of the pair. + std::pair insert(std::pair KV) { + unsigned BucketNo = LookupBucketFor(KV.first); + StringMapEntryBase *&Bucket = TheTable[BucketNo]; + if (Bucket && Bucket != getTombstoneVal()) + return std::make_pair(iterator(TheTable + BucketNo, false), + false); // Already exists in map. + + if (Bucket == getTombstoneVal()) + --NumTombstones; + Bucket = + MapEntryTy::Create(KV.first, std::move(KV.second)); + ++NumItems; + assert(NumItems + NumTombstones <= NumBuckets); + + BucketNo = RehashTable(BucketNo); + return std::make_pair(iterator(TheTable + BucketNo, false), true); + } + + // clear - Empties out the StringMap + void clear() { + if (empty()) return; + + // Zap all values, resetting the keys back to non-present (not tombstone), + // which is safe because we're removing all elements. + for (unsigned I = 0, E = NumBuckets; I != E; ++I) { + StringMapEntryBase *&Bucket = TheTable[I]; + if (Bucket && Bucket != getTombstoneVal()) { + static_cast(Bucket)->Destroy(); + } + Bucket = nullptr; + } + + NumItems = 0; + NumTombstones = 0; + } + + /// remove - Remove the specified key/value pair from the map, but do not + /// erase it. This aborts if the key is not in the map. + void remove(MapEntryTy *KeyValue) { + RemoveKey(KeyValue); + } + + void erase(iterator I) { + MapEntryTy &V = *I; + remove(&V); + V.Destroy(); + } + + bool erase(StringRef Key) { + iterator I = find(Key); + if (I == end()) return false; + erase(I); + return true; + } + + ~StringMap() { + // Delete all the elements in the map, but don't reset the elements + // to default values. This is a copy of clear(), but avoids unnecessary + // work not required in the destructor. + if (!empty()) { + for (unsigned I = 0, E = NumBuckets; I != E; ++I) { + StringMapEntryBase *Bucket = TheTable[I]; + if (Bucket && Bucket != getTombstoneVal()) { + static_cast(Bucket)->Destroy(); + } + } + } + free(TheTable); + } +}; + + +template +class StringMapConstIterator { +protected: + StringMapEntryBase **Ptr; +public: + typedef StringMapEntry value_type; + + StringMapConstIterator() : Ptr(nullptr) { } + + explicit StringMapConstIterator(StringMapEntryBase **Bucket, + bool NoAdvance = false) + : Ptr(Bucket) { + if (!NoAdvance) AdvancePastEmptyBuckets(); + } + + const value_type &operator*() const { + return *static_cast*>(*Ptr); + } + const value_type *operator->() const { + return static_cast*>(*Ptr); + } + + bool operator==(const StringMapConstIterator &RHS) const { + return Ptr == RHS.Ptr; + } + bool operator!=(const StringMapConstIterator &RHS) const { + return Ptr != RHS.Ptr; + } + + inline StringMapConstIterator& operator++() { // Preincrement + ++Ptr; + AdvancePastEmptyBuckets(); + return *this; + } + StringMapConstIterator operator++(int) { // Postincrement + StringMapConstIterator tmp = *this; ++*this; return tmp; + } + +private: + void AdvancePastEmptyBuckets() { + while (*Ptr == nullptr || *Ptr == StringMapImpl::getTombstoneVal()) + ++Ptr; + } +}; + +template +class StringMapIterator : public StringMapConstIterator { +public: + StringMapIterator() {} + explicit StringMapIterator(StringMapEntryBase **Bucket, + bool NoAdvance = false) + : StringMapConstIterator(Bucket, NoAdvance) { + } + StringMapEntry &operator*() const { + return *static_cast*>(*this->Ptr); + } + StringMapEntry *operator->() const { + return static_cast*>(*this->Ptr); + } +}; + +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/StringRef.h b/Robot2016/wpilib/cpp/current/include/llvm/StringRef.h new file mode 100644 index 0000000..1ffe29f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/StringRef.h @@ -0,0 +1,539 @@ +//===--- StringRef.h - Constant String Reference Wrapper --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_STRINGREF_H +#define LLVM_ADT_STRINGREF_H + +#include +#include +#include +#include +#include +#include +#include + +namespace llvm { + template + class SmallVectorImpl; + class StringRef; + + /// Helper functions for StringRef::getAsInteger. + bool getAsUnsignedInteger(StringRef Str, unsigned Radix, + unsigned long long &Result); + + bool getAsSignedInteger(StringRef Str, unsigned Radix, long long &Result); + + /// StringRef - Represent a constant reference to a string, i.e. a character + /// array and a length, which need not be null terminated. + /// + /// This class does not own the string data, it is expected to be used in + /// situations where the character data resides in some other buffer, whose + /// lifetime extends past that of the StringRef. For this reason, it is not in + /// general safe to store a StringRef. + class StringRef { + public: + typedef const char *iterator; + typedef const char *const_iterator; + static const size_t npos = ~size_t(0); + typedef size_t size_type; + + private: + /// The start of the string, in an external buffer. + const char *Data; + + /// The length of the string. + size_t Length; + + // Workaround memcmp issue with null pointers (undefined behavior) + // by providing a specialized version + static int compareMemory(const char *Lhs, const char *Rhs, size_t Length) { + if (Length == 0) { return 0; } + return ::memcmp(Lhs,Rhs,Length); + } + + public: + /// @name Constructors + /// @{ + + /// Construct an empty string ref. + /*implicit*/ StringRef() : Data(nullptr), Length(0) {} + + /// Construct a string ref from a cstring. + /*implicit*/ StringRef(const char *Str) + : Data(Str) { + assert(Str && "StringRef cannot be built from a NULL argument"); + Length = ::strlen(Str); // invoking strlen(NULL) is undefined behavior + } + + /// Construct a string ref from a pointer and length. + /*implicit*/ StringRef(const char *data, size_t length) + : Data(data), Length(length) { + assert((data || length == 0) && + "StringRef cannot be built from a NULL argument with non-null length"); + } + + /// Construct a string ref from an std::string. + /*implicit*/ StringRef(const std::string &Str) + : Data(Str.data()), Length(Str.length()) {} + + /// @} + /// @name Iterators + /// @{ + + iterator begin() const { return Data; } + + iterator end() const { return Data + Length; } + + const unsigned char *bytes_begin() const { + return reinterpret_cast(begin()); + } + const unsigned char *bytes_end() const { + return reinterpret_cast(end()); + } + + /// @} + /// @name String Operations + /// @{ + + /// data - Get a pointer to the start of the string (which may not be null + /// terminated). + const char *data() const { return Data; } + + /// empty - Check if the string is empty. + bool empty() const { return Length == 0; } + + /// size - Get the string size. + size_t size() const { return Length; } + + /// front - Get the first character in the string. + char front() const { + assert(!empty()); + return Data[0]; + } + + /// back - Get the last character in the string. + char back() const { + assert(!empty()); + return Data[Length-1]; + } + + // copy - Allocate copy in Allocator and return StringRef to it. + template StringRef copy(Allocator &A) const { + char *S = A.template Allocate(Length); + std::copy(begin(), end(), S); + return StringRef(S, Length); + } + + /// equals - Check for string equality, this is more efficient than + /// compare() when the relative ordering of inequal strings isn't needed. + bool equals(StringRef RHS) const { + return (Length == RHS.Length && + compareMemory(Data, RHS.Data, RHS.Length) == 0); + } + + /// equals_lower - Check for string equality, ignoring case. + bool equals_lower(StringRef RHS) const { + return Length == RHS.Length && compare_lower(RHS) == 0; + } + + /// compare - Compare two strings; the result is -1, 0, or 1 if this string + /// is lexicographically less than, equal to, or greater than the \p RHS. + int compare(StringRef RHS) const { + // Check the prefix for a mismatch. + if (int Res = compareMemory(Data, RHS.Data, std::min(Length, RHS.Length))) + return Res < 0 ? -1 : 1; + + // Otherwise the prefixes match, so we only need to check the lengths. + if (Length == RHS.Length) + return 0; + return Length < RHS.Length ? -1 : 1; + } + + /// compare_lower - Compare two strings, ignoring case. + int compare_lower(StringRef RHS) const; + + /// compare_numeric - Compare two strings, treating sequences of digits as + /// numbers. + int compare_numeric(StringRef RHS) const; + + /// str - Get the contents as an std::string. + std::string str() const { + if (!Data) return std::string(); + return std::string(Data, Length); + } + + /// @} + /// @name Operator Overloads + /// @{ + + char operator[](size_t Index) const { + assert(Index < Length && "Invalid index!"); + return Data[Index]; + } + + /// @} + /// @name Type Conversions + /// @{ + + operator std::string() const { + return str(); + } + + /// @} + /// @name String Predicates + /// @{ + + /// Check if this string starts with the given \p Prefix. + bool startswith(StringRef Prefix) const { + return Length >= Prefix.Length && + compareMemory(Data, Prefix.Data, Prefix.Length) == 0; + } + + /// Check if this string starts with the given \p Prefix, ignoring case. + bool startswith_lower(StringRef Prefix) const; + + /// Check if this string ends with the given \p Suffix. + bool endswith(StringRef Suffix) const { + return Length >= Suffix.Length && + compareMemory(end() - Suffix.Length, Suffix.Data, Suffix.Length) == 0; + } + + /// Check if this string ends with the given \p Suffix, ignoring case. + bool endswith_lower(StringRef Suffix) const; + + /// @} + /// @name String Searching + /// @{ + + /// Search for the first character \p C in the string. + /// + /// \returns The index of the first occurrence of \p C, or npos if not + /// found. + size_t find(char C, size_t From = 0) const { + size_t FindBegin = std::min(From, Length); + if (FindBegin < Length) { // Avoid calling memchr with nullptr. + // Just forward to memchr, which is faster than a hand-rolled loop. + if (const void *P = ::memchr(Data + FindBegin, C, Length - FindBegin)) + return static_cast(P) - Data; + } + return npos; + } + + /// Search for the first string \p Str in the string. + /// + /// \returns The index of the first occurrence of \p Str, or npos if not + /// found. + size_t find(StringRef Str, size_t From = 0) const; + + /// Search for the last character \p C in the string. + /// + /// \returns The index of the last occurrence of \p C, or npos if not + /// found. + size_t rfind(char C, size_t From = npos) const { + From = std::min(From, Length); + size_t i = From; + while (i != 0) { + --i; + if (Data[i] == C) + return i; + } + return npos; + } + + /// Search for the last string \p Str in the string. + /// + /// \returns The index of the last occurrence of \p Str, or npos if not + /// found. + size_t rfind(StringRef Str) const; + + /// Find the first character in the string that is \p C, or npos if not + /// found. Same as find. + size_t find_first_of(char C, size_t From = 0) const { + return find(C, From); + } + + /// Find the first character in the string that is in \p Chars, or npos if + /// not found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_first_of(StringRef Chars, size_t From = 0) const; + + /// Find the first character in the string that is not \p C or npos if not + /// found. + size_t find_first_not_of(char C, size_t From = 0) const; + + /// Find the first character in the string that is not in the string + /// \p Chars, or npos if not found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_first_not_of(StringRef Chars, size_t From = 0) const; + + /// Find the last character in the string that is \p C, or npos if not + /// found. + size_t find_last_of(char C, size_t From = npos) const { + return rfind(C, From); + } + + /// Find the last character in the string that is in \p C, or npos if not + /// found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_last_of(StringRef Chars, size_t From = npos) const; + + /// Find the last character in the string that is not \p C, or npos if not + /// found. + size_t find_last_not_of(char C, size_t From = npos) const; + + /// Find the last character in the string that is not in \p Chars, or + /// npos if not found. + /// + /// Complexity: O(size() + Chars.size()) + size_t find_last_not_of(StringRef Chars, size_t From = npos) const; + + /// @} + /// @name Helpful Algorithms + /// @{ + + /// Return the number of occurrences of \p C in the string. + size_t count(char C) const { + size_t Count = 0; + for (size_t i = 0, e = Length; i != e; ++i) + if (Data[i] == C) + ++Count; + return Count; + } + + /// Return the number of non-overlapped occurrences of \p Str in + /// the string. + size_t count(StringRef Str) const; + + /// Parse the current string as an integer of the specified radix. If + /// \p Radix is specified as zero, this does radix autosensing using + /// extended C rules: 0 is octal, 0x is hex, 0b is binary. + /// + /// If the string is invalid or if only a subset of the string is valid, + /// this returns true to signify the error. The string is considered + /// erroneous if empty or if it overflows T. + template + typename std::enable_if::is_signed, bool>::type + getAsInteger(unsigned Radix, T &Result) const { + long long LLVal; + if (getAsSignedInteger(*this, Radix, LLVal) || + static_cast(LLVal) != LLVal) + return true; + Result = LLVal; + return false; + } + + template + typename std::enable_if::is_signed, bool>::type + getAsInteger(unsigned Radix, T &Result) const { + unsigned long long ULLVal; + // The additional cast to unsigned long long is required to avoid the + // Visual C++ warning C4805: '!=' : unsafe mix of type 'bool' and type + // 'unsigned __int64' when instantiating getAsInteger with T = bool. + if (getAsUnsignedInteger(*this, Radix, ULLVal) || + static_cast(static_cast(ULLVal)) != ULLVal) + return true; + Result = ULLVal; + return false; + } + + /// @} + /// @name String Operations + /// @{ + + // Convert the given ASCII string to lowercase. + std::string lower() const; + + /// Convert the given ASCII string to uppercase. + std::string upper() const; + + /// @} + /// @name Substring Operations + /// @{ + + /// Return a reference to the substring from [Start, Start + N). + /// + /// \param Start The index of the starting character in the substring; if + /// the index is npos or greater than the length of the string then the + /// empty substring will be returned. + /// + /// \param N The number of characters to included in the substring. If N + /// exceeds the number of characters remaining in the string, the string + /// suffix (starting with \p Start) will be returned. + StringRef substr(size_t Start, size_t N = npos) const { + Start = std::min(Start, Length); + return StringRef(Data + Start, std::min(N, Length - Start)); + } + + /// Return a StringRef equal to 'this' but with the first \p N elements + /// dropped. + StringRef drop_front(size_t N = 1) const { + assert(size() >= N && "Dropping more elements than exist"); + return substr(N); + } + + /// Return a StringRef equal to 'this' but with the last \p N elements + /// dropped. + StringRef drop_back(size_t N = 1) const { + assert(size() >= N && "Dropping more elements than exist"); + return substr(0, size()-N); + } + + /// Return a reference to the substring from [Start, End). + /// + /// \param Start The index of the starting character in the substring; if + /// the index is npos or greater than the length of the string then the + /// empty substring will be returned. + /// + /// \param End The index following the last character to include in the + /// substring. If this is npos, or less than \p Start, or exceeds the + /// number of characters remaining in the string, the string suffix + /// (starting with \p Start) will be returned. + StringRef slice(size_t Start, size_t End) const { + Start = std::min(Start, Length); + End = std::min(std::max(Start, End), Length); + return StringRef(Data + Start, End - Start); + } + + /// Split into two substrings around the first occurrence of a separator + /// character. + /// + /// If \p Separator is in the string, then the result is a pair (LHS, RHS) + /// such that (*this == LHS + Separator + RHS) is true and RHS is + /// maximal. If \p Separator is not in the string, then the result is a + /// pair (LHS, RHS) where (*this == LHS) and (RHS == ""). + /// + /// \param Separator The character to split on. + /// \returns The split substrings. + std::pair split(char Separator) const { + size_t Idx = find(Separator); + if (Idx == npos) + return std::make_pair(*this, StringRef()); + return std::make_pair(slice(0, Idx), slice(Idx+1, npos)); + } + + /// Split into two substrings around the first occurrence of a separator + /// string. + /// + /// If \p Separator is in the string, then the result is a pair (LHS, RHS) + /// such that (*this == LHS + Separator + RHS) is true and RHS is + /// maximal. If \p Separator is not in the string, then the result is a + /// pair (LHS, RHS) where (*this == LHS) and (RHS == ""). + /// + /// \param Separator - The string to split on. + /// \return - The split substrings. + std::pair split(StringRef Separator) const { + size_t Idx = find(Separator); + if (Idx == npos) + return std::make_pair(*this, StringRef()); + return std::make_pair(slice(0, Idx), slice(Idx + Separator.size(), npos)); + } + + /// Split into substrings around the occurrences of a separator string. + /// + /// Each substring is stored in \p A. If \p MaxSplit is >= 0, at most + /// \p MaxSplit splits are done and consequently <= \p MaxSplit + /// elements are added to A. + /// If \p KeepEmpty is false, empty strings are not added to \p A. They + /// still count when considering \p MaxSplit + /// An useful invariant is that + /// Separator.join(A) == *this if MaxSplit == -1 and KeepEmpty == true + /// + /// \param A - Where to put the substrings. + /// \param Separator - The string to split on. + /// \param MaxSplit - The maximum number of times the string is split. + /// \param KeepEmpty - True if empty substring should be added. + void split(SmallVectorImpl &A, + StringRef Separator, int MaxSplit = -1, + bool KeepEmpty = true) const; + + /// Split into two substrings around the last occurrence of a separator + /// character. + /// + /// If \p Separator is in the string, then the result is a pair (LHS, RHS) + /// such that (*this == LHS + Separator + RHS) is true and RHS is + /// minimal. If \p Separator is not in the string, then the result is a + /// pair (LHS, RHS) where (*this == LHS) and (RHS == ""). + /// + /// \param Separator - The character to split on. + /// \return - The split substrings. + std::pair rsplit(char Separator) const { + size_t Idx = rfind(Separator); + if (Idx == npos) + return std::make_pair(*this, StringRef()); + return std::make_pair(slice(0, Idx), slice(Idx+1, npos)); + } + + /// Return string with consecutive characters in \p Chars starting from + /// the left removed. + StringRef ltrim(StringRef Chars = " \t\n\v\f\r") const { + return drop_front(std::min(Length, find_first_not_of(Chars))); + } + + /// Return string with consecutive characters in \p Chars starting from + /// the right removed. + StringRef rtrim(StringRef Chars = " \t\n\v\f\r") const { + return drop_back(Length - std::min(Length, find_last_not_of(Chars) + 1)); + } + + /// Return string with consecutive characters in \p Chars starting from + /// the left and right removed. + StringRef trim(StringRef Chars = " \t\n\v\f\r") const { + return ltrim(Chars).rtrim(Chars); + } + + /// @} + }; + + /// @name StringRef Comparison Operators + /// @{ + + inline bool operator==(StringRef LHS, StringRef RHS) { + return LHS.equals(RHS); + } + + inline bool operator!=(StringRef LHS, StringRef RHS) { + return !(LHS == RHS); + } + + inline bool operator<(StringRef LHS, StringRef RHS) { + return LHS.compare(RHS) == -1; + } + + inline bool operator<=(StringRef LHS, StringRef RHS) { + return LHS.compare(RHS) != 1; + } + + inline bool operator>(StringRef LHS, StringRef RHS) { + return LHS.compare(RHS) == 1; + } + + inline bool operator>=(StringRef LHS, StringRef RHS) { + return LHS.compare(RHS) != -1; + } + + inline std::string &operator+=(std::string &buffer, StringRef string) { + return buffer.append(string.data(), string.size()); + } + + inline std::ostream &operator<<(std::ostream &os, StringRef string) { + os.write(string.data(), string.size()); + return os; + } + + /// @} + + // StringRefs can be treated like a POD type. + template struct isPodLike; + template <> struct isPodLike { static const bool value = true; }; +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/iterator_range.h b/Robot2016/wpilib/cpp/current/include/llvm/iterator_range.h new file mode 100644 index 0000000..009b716 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/iterator_range.h @@ -0,0 +1,56 @@ +//===- iterator_range.h - A range adaptor for iterators ---------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// This provides a very simple, boring adaptor for a begin and end iterator +/// into a range type. This should be used to build range views that work well +/// with range based for loops and range based constructors. +/// +/// Note that code here follows more standards-based coding conventions as it +/// is mirroring proposed interfaces for standardization. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_ITERATOR_RANGE_H +#define LLVM_ADT_ITERATOR_RANGE_H + +#include + +namespace llvm { + +/// \brief A range adaptor for a pair of iterators. +/// +/// This just wraps two iterators into a range-compatible interface. Nothing +/// fancy at all. +template +class iterator_range { + IteratorT begin_iterator, end_iterator; + +public: + iterator_range(IteratorT begin_iterator, IteratorT end_iterator) + : begin_iterator(std::move(begin_iterator)), + end_iterator(std::move(end_iterator)) {} + + IteratorT begin() const { return begin_iterator; } + IteratorT end() const { return end_iterator; } +}; + +/// \brief Convenience function for iterating over sub-ranges. +/// +/// This provides a bit of syntactic sugar to make using sub-ranges +/// in for loops a bit easier. Analogous to std::make_pair(). +template iterator_range make_range(T x, T y) { + return iterator_range(std::move(x), std::move(y)); +} + +template iterator_range make_range(std::pair p) { + return iterator_range(std::move(p.first), std::move(p.second)); +} +} // namespace llvm + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/llvm/type_traits.h b/Robot2016/wpilib/cpp/current/include/llvm/type_traits.h new file mode 100644 index 0000000..6e2e202 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/llvm/type_traits.h @@ -0,0 +1,100 @@ +//===- llvm/Support/type_traits.h - Simplfied type traits -------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file provides useful additions to the standard type_traits library. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_TYPE_TRAITS_H +#define LLVM_SUPPORT_TYPE_TRAITS_H + +#include +#include + +#ifndef __has_feature +#define LLVM_DEFINED_HAS_FEATURE +#define __has_feature(x) 0 +#endif + +namespace llvm { + +/// isPodLike - This is a type trait that is used to determine whether a given +/// type can be copied around with memcpy instead of running ctors etc. +template +struct isPodLike { + // std::is_trivially_copyable is available in libc++ with clang, libstdc++ + // that comes with GCC 5. +#if (__has_feature(is_trivially_copyable) && defined(_LIBCPP_VERSION)) || \ + (defined(__GNUC__) && __GNUC__ >= 5) + // If the compiler supports the is_trivially_copyable trait use it, as it + // matches the definition of isPodLike closely. + static const bool value = std::is_trivially_copyable::value; +#elif __has_feature(is_trivially_copyable) + // Use the internal name if the compiler supports is_trivially_copyable but we + // don't know if the standard library does. This is the case for clang in + // conjunction with libstdc++ from GCC 4.x. + static const bool value = __is_trivially_copyable(T); +#else + // If we don't know anything else, we can (at least) assume that all non-class + // types are PODs. + static const bool value = !std::is_class::value; +#endif +}; + +// std::pair's are pod-like if their elements are. +template +struct isPodLike > { + static const bool value = isPodLike::value && isPodLike::value; +}; + +/// \brief Metafunction that determines whether the given type is either an +/// integral type or an enumeration type. +/// +/// Note that this accepts potentially more integral types than is_integral +/// because it is based on merely being convertible implicitly to an integral +/// type. +template class is_integral_or_enum { + typedef typename std::remove_reference::type UnderlyingT; + +public: + static const bool value = + !std::is_class::value && // Filter conversion operators. + !std::is_pointer::value && + !std::is_floating_point::value && + std::is_convertible::value; +}; + +/// \brief If T is a pointer, just return it. If it is not, return T&. +template +struct add_lvalue_reference_if_not_pointer { typedef T &type; }; + +template +struct add_lvalue_reference_if_not_pointer< + T, typename std::enable_if::value>::type> { + typedef T type; +}; + +/// \brief If T is a pointer to X, return a pointer to const X. If it is not, +/// return const T. +template +struct add_const_past_pointer { typedef const T type; }; + +template +struct add_const_past_pointer< + T, typename std::enable_if::value>::type> { + typedef const typename std::remove_pointer::type *type; +}; + +} // namespace llvm + +#ifdef LLVM_DEFINED_HAS_FEATURE +#undef __has_feature +#endif + +#endif diff --git a/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..5d8911e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ +#define __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tAI.h new file mode 100644 index 0000000..6d3de2c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tAI.h @@ -0,0 +1,73 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_AI_h__ +#define __nFRC_C0EF_1_1_0_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + + + typedef enum + { + } tCalOK_IfaceConstants; + + virtual bool readCalOK(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDoneTime_IfaceConstants; + + virtual unsigned int readDoneTime(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumOffsetRegisters = 8, + } tOffset_IfaceConstants; + + virtual signed int readOffset(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumLSBWeightRegisters = 8, + } tLSBWeight_IfaceConstants; + + virtual unsigned int readLSBWeight(unsigned char reg_index, tRioStatusCode *status) = 0; + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tGlobal.h new file mode 100644 index 0000000..f938b7e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tGlobal.h @@ -0,0 +1,69 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_Global_h__ +#define __nFRC_C0EF_1_1_0_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReserved_IfaceConstants; + + virtual unsigned char readReserved(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tLoadOut.h b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tLoadOut.h new file mode 100644 index 0000000..f1ce1e9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nInvariantFPGANamespace/tLoadOut.h @@ -0,0 +1,79 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_C0EF_1_1_0_LoadOut_h__ +#define __nFRC_C0EF_1_1_0_LoadOut_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_C0EF_1_1_0 +{ + +class tLoadOut +{ +public: + tLoadOut(){} + virtual ~tLoadOut(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tLoadOut* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tReady_IfaceConstants; + + virtual bool readReady(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDoneTime_IfaceConstants; + + virtual unsigned int readDoneTime(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumVendorIDRegisters = 8, + } tVendorID_IfaceConstants; + + virtual unsigned short readVendorID(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumSerialNumberRegisters = 8, + } tSerialNumber_IfaceConstants; + + virtual unsigned int readSerialNumber(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumModuleIDRegisters = 8, + } tModuleID_IfaceConstants; + + virtual unsigned short readModuleID(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tLoadOut(const tLoadOut&); + void operator=(const tLoadOut&); +}; + +} +} + +#endif // __nFRC_C0EF_1_1_0_LoadOut_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..a606b79 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_nInterfaceGlobals_h__ +#define __nFRC_2016_16_1_0_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_2016_16_1_0_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAI.h new file mode 100644 index 0000000..e4901df --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAI.h @@ -0,0 +1,143 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AI_h__ +#define __nFRC_2016_16_1_0_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ScanSize : 3; + unsigned ConvertRate : 26; +#else + unsigned ConvertRate : 26; + unsigned ScanSize : 3; +#endif + }; + struct{ + unsigned value : 29; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Averaged : 1; +#else + unsigned Averaged : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 4; + }; + } tReadSelect; + + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual signed int readOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0; + virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumOversampleBitsElements = 8, + } tOversampleBits_IfaceConstants; + + virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumAverageBitsElements = 8, + } tAverageBits_IfaceConstants; + + virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumScanListElements = 8, + } tScanList_IfaceConstants; + + virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tLatchOutput_IfaceConstants; + + virtual void strobeLatchOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadSelect_IfaceConstants; + + virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0; + virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0; + + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAO.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAO.h new file mode 100644 index 0000000..f53c42b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAO.h @@ -0,0 +1,50 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AO_h__ +#define __nFRC_2016_16_1_0_AO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAO +{ +public: + tAO(){} + virtual ~tAO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAO* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + + + typedef enum + { + kNumMXPRegisters = 2, + } tMXP_IfaceConstants; + + virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tAO(const tAO&); + void operator=(const tAO&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccel.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccel.h new file mode 100644 index 0000000..45b88e9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccel.h @@ -0,0 +1,102 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Accel_h__ +#define __nFRC_2016_16_1_0_Accel_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAccel +{ +public: + tAccel(){} + virtual ~tAccel(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccel* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tSTAT_IfaceConstants; + + virtual unsigned char readSTAT(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNTR_IfaceConstants; + + virtual void writeCNTR(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNTR(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDATO_IfaceConstants; + + virtual void writeDATO(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDATO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNFG_IfaceConstants; + + virtual void writeCNFG(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNFG(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCNTL_IfaceConstants; + + virtual void writeCNTL(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readCNTL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDATI_IfaceConstants; + + virtual unsigned char readDATI(tRioStatusCode *status) = 0; + + + typedef enum + { + } tGO_IfaceConstants; + + virtual void strobeGO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tADDR_IfaceConstants; + + virtual void writeADDR(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readADDR(tRioStatusCode *status) = 0; + + + + +private: + tAccel(const tAccel&); + void operator=(const tAccel&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Accel_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccumulator.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccumulator.h new file mode 100644 index 0000000..d6964be --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAccumulator.h @@ -0,0 +1,87 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Accumulator_h__ +#define __nFRC_2016_16_1_0_Accumulator_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAccumulator +{ +public: + tAccumulator(){} + virtual ~tAccumulator(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ + signed long long Value; + unsigned Count : 32; + }; + struct{ + unsigned value : 32; + unsigned value2 : 32; + unsigned value3 : 32; + }; + } tOutput; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual signed long long readOutput_Value(tRioStatusCode *status) = 0; + virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCenter_IfaceConstants; + + virtual void writeCenter(signed int value, tRioStatusCode *status) = 0; + virtual signed int readCenter(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDeadband_IfaceConstants; + + virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0; + virtual signed int readDeadband(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + + + +private: + tAccumulator(const tAccumulator&); + void operator=(const tAccumulator&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Accumulator_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAlarm.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAlarm.h new file mode 100644 index 0000000..b51c5f8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAlarm.h @@ -0,0 +1,57 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Alarm_h__ +#define __nFRC_2016_16_1_0_Alarm_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAlarm +{ +public: + tAlarm(){} + virtual ~tAlarm(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAlarm* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTriggerTime_IfaceConstants; + + virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0; + + + + +private: + tAlarm(const tAlarm&); + void operator=(const tAlarm&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Alarm_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAnalogTrigger.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAnalogTrigger.h new file mode 100644 index 0000000..06eb352 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tAnalogTrigger.h @@ -0,0 +1,129 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_AnalogTrigger_h__ +#define __nFRC_2016_16_1_0_AnalogTrigger_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tAnalogTrigger +{ +public: + tAnalogTrigger(){} + virtual ~tAnalogTrigger(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned InHysteresis : 1; + unsigned OverLimit : 1; + unsigned Rising : 1; + unsigned Falling : 1; +#else + unsigned Falling : 1; + unsigned Rising : 1; + unsigned OverLimit : 1; + unsigned InHysteresis : 1; +#endif + }; + struct{ + unsigned value : 4; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Averaged : 1; + unsigned Filter : 1; + unsigned FloatingRollover : 1; + signed RolloverLimit : 8; +#else + signed RolloverLimit : 8; + unsigned FloatingRollover : 1; + unsigned Filter : 1; + unsigned Averaged : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 14; + }; + } tSourceSelect; + + + typedef enum + { + } tSourceSelect_IfaceConstants; + + virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0; + virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0; + virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUpperLimit_IfaceConstants; + + virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readUpperLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLowerLimit_IfaceConstants; + + virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readLowerLimit(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumOutputElements = 8, + } tOutput_IfaceConstants; + + virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tAnalogTrigger(const tAnalogTrigger&); + void operator=(const tAnalogTrigger&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_AnalogTrigger_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tBIST.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tBIST.h new file mode 100644 index 0000000..f28c50e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tBIST.h @@ -0,0 +1,90 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_BIST_h__ +#define __nFRC_2016_16_1_0_BIST_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tBIST +{ +public: + tBIST(){} + virtual ~tBIST(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tBIST* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tDO0SquareTicks_IfaceConstants; + + virtual void writeDO0SquareTicks(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDO0SquareTicks(tRioStatusCode *status) = 0; + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO1SquareEnable_IfaceConstants; + + virtual void writeDO1SquareEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readDO1SquareEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO0SquareEnable_IfaceConstants; + + virtual void writeDO0SquareEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readDO0SquareEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO1SquareTicks_IfaceConstants; + + virtual void writeDO1SquareTicks(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDO1SquareTicks(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumDORegisters = 2, + } tDO_IfaceConstants; + + virtual void writeDO(unsigned char reg_index, bool value, tRioStatusCode *status) = 0; + virtual bool readDO(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tBIST(const tBIST&); + void operator=(const tBIST&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_BIST_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tCounter.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tCounter.h new file mode 100644 index 0000000..6305714 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tCounter.h @@ -0,0 +1,219 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Counter_h__ +#define __nFRC_2016_16_1_0_Counter_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tCounter +{ +public: + tCounter(){} + virtual ~tCounter(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tCounter* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned UpSource_Channel : 4; + unsigned UpSource_Module : 1; + unsigned UpSource_AnalogTrigger : 1; + unsigned DownSource_Channel : 4; + unsigned DownSource_Module : 1; + unsigned DownSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexEdgeSensitive : 1; + unsigned UpRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned DownFallingEdge : 1; + unsigned Mode : 2; + unsigned PulseLengthThreshold : 6; +#else + unsigned PulseLengthThreshold : 6; + unsigned Mode : 2; + unsigned DownFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned UpRisingEdge : 1; + unsigned IndexEdgeSensitive : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned DownSource_AnalogTrigger : 1; + unsigned DownSource_Module : 1; + unsigned DownSource_Channel : 4; + unsigned UpSource_AnalogTrigger : 1; + unsigned UpSource_Module : 1; + unsigned UpSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0; + virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tCounter(const tCounter&); + void operator=(const tCounter&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Counter_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDIO.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDIO.h new file mode 100644 index 0000000..fa6ed49 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDIO.h @@ -0,0 +1,248 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_DIO_h__ +#define __nFRC_2016_16_1_0_DIO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tDIO +{ +public: + tDIO(){} + virtual ~tDIO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDIO* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tDO; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutputEnable; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tPulse; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Headers : 10; + unsigned Reserved : 6; + unsigned MXP : 16; +#else + unsigned MXP : 16; + unsigned Reserved : 6; + unsigned Headers : 10; +#endif + }; + struct{ + unsigned value : 32; + }; + } tDI; + + + + typedef enum + { + } tDO_IfaceConstants; + + virtual void writeDO(tDO value, tRioStatusCode *status) = 0; + virtual void writeDO_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeDO_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tDO readDO(tRioStatusCode *status) = 0; + virtual unsigned short readDO_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readDO_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readDO_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMDutyCycleAElements = 4, + } tPWMDutyCycleA_IfaceConstants; + + virtual void writePWMDutyCycleA(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMDutyCycleA(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMDutyCycleBElements = 2, + } tPWMDutyCycleB_IfaceConstants; + + virtual void writePWMDutyCycleB(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMDutyCycleB(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterSelectHdrElements = 16, + } tFilterSelectHdr_IfaceConstants; + + virtual void writeFilterSelectHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelectHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tOutputEnable_IfaceConstants; + + virtual void writeOutputEnable(tOutputEnable value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeOutputEnable_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tOutputEnable readOutputEnable(tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readOutputEnable_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMOutputSelectElements = 6, + } tPWMOutputSelect_IfaceConstants; + + virtual void writePWMOutputSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMOutputSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulse_IfaceConstants; + + virtual void writePulse(tPulse value, tRioStatusCode *status) = 0; + virtual void writePulse_Headers(unsigned short value, tRioStatusCode *status) = 0; + virtual void writePulse_Reserved(unsigned char value, tRioStatusCode *status) = 0; + virtual void writePulse_MXP(unsigned short value, tRioStatusCode *status) = 0; + virtual tPulse readPulse(tRioStatusCode *status) = 0; + virtual unsigned short readPulse_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readPulse_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readPulse_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDI_IfaceConstants; + + virtual tDI readDI(tRioStatusCode *status) = 0; + virtual unsigned short readDI_Headers(tRioStatusCode *status) = 0; + virtual unsigned char readDI_Reserved(tRioStatusCode *status) = 0; + virtual unsigned short readDI_MXP(tRioStatusCode *status) = 0; + + + typedef enum + { + } tEnableMXPSpecialFunction_IfaceConstants; + + virtual void writeEnableMXPSpecialFunction(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readEnableMXPSpecialFunction(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterSelectMXPElements = 16, + } tFilterSelectMXP_IfaceConstants; + + virtual void writeFilterSelectMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelectMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulseLength_IfaceConstants; + + virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPulseLength(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPWMPeriodPower_IfaceConstants; + + virtual void writePWMPeriodPower(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readPWMPeriodPower(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumFilterPeriodMXPRegisters = 3, + } tFilterPeriodMXP_IfaceConstants; + + virtual void writeFilterPeriodMXP(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readFilterPeriodMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterPeriodHdrRegisters = 3, + } tFilterPeriodHdr_IfaceConstants; + + virtual void writeFilterPeriodHdr(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readFilterPeriodHdr(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tDIO(const tDIO&); + void operator=(const tDIO&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_DIO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDMA.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDMA.h new file mode 100644 index 0000000..ea07962 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tDMA.h @@ -0,0 +1,197 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_DMA_h__ +#define __nFRC_2016_16_1_0_DMA_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tDMA +{ +public: + tDMA(){} + virtual ~tDMA(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDMA* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Pause : 1; + unsigned Enable_AI0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_DI : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_Encoders_Low : 1; + unsigned Enable_Encoders_High : 1; + unsigned Enable_EncoderTimers_Low : 1; + unsigned Enable_EncoderTimers_High : 1; + unsigned ExternalClock : 1; +#else + unsigned ExternalClock : 1; + unsigned Enable_EncoderTimers_High : 1; + unsigned Enable_EncoderTimers_Low : 1; + unsigned Enable_Encoders_High : 1; + unsigned Enable_Encoders_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_DI : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AI0_Low : 1; + unsigned Pause : 1; +#endif + }; + struct{ + unsigned value : 22; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ExternalClockSource_Channel : 4; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; +#else + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tExternalTriggers; + + + + typedef enum + { + } tRate_IfaceConstants; + + virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual bool readConfig_Pause(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumExternalTriggersRegisters = 2, + kNumExternalTriggersElements = 4, + } tExternalTriggers_IfaceConstants; + + virtual void writeExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual tExternalTriggers readExternalTriggers(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_RisingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_FallingEdge(unsigned char reg_index, unsigned char bitfield_index, tRioStatusCode *status) = 0; + + +private: + tDMA(const tDMA&); + void operator=(const tDMA&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_DMA_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tEncoder.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tEncoder.h new file mode 100644 index 0000000..611143b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tEncoder.h @@ -0,0 +1,199 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Encoder_h__ +#define __nFRC_2016_16_1_0_Encoder_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tEncoder +{ +public: + tEncoder(){} + virtual ~tEncoder(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tEncoder* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ASource_Channel : 4; + unsigned ASource_Module : 1; + unsigned ASource_AnalogTrigger : 1; + unsigned BSource_Channel : 4; + unsigned BSource_Module : 1; + unsigned BSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexEdgeSensitive : 1; + unsigned Reverse : 1; +#else + unsigned Reverse : 1; + unsigned IndexEdgeSensitive : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned BSource_AnalogTrigger : 1; + unsigned BSource_Module : 1; + unsigned BSource_Channel : 4; + unsigned ASource_AnalogTrigger : 1; + unsigned ASource_Module : 1; + unsigned ASource_Channel : 4; +#endif + }; + struct{ + unsigned value : 21; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexEdgeSensitive(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexEdgeSensitive(tRioStatusCode *status) = 0; + virtual bool readConfig_Reverse(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tEncoder(const tEncoder&); + void operator=(const tEncoder&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Encoder_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tGlobal.h new file mode 100644 index 0000000..66f253e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tGlobal.h @@ -0,0 +1,104 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Global_h__ +#define __nFRC_2016_16_1_0_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Radio : 8; + unsigned Comm : 8; + unsigned Mode : 8; + unsigned RSL : 1; +#else + unsigned RSL : 1; + unsigned Mode : 8; + unsigned Comm : 8; + unsigned Radio : 8; +#endif + }; + struct{ + unsigned value : 25; + }; + } tLEDs; + + + + typedef enum + { + } tLEDs_IfaceConstants; + + virtual void writeLEDs(tLEDs value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Radio(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Comm(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeLEDs_RSL(bool value, tRioStatusCode *status) = 0; + virtual tLEDs readLEDs(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Radio(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Comm(tRioStatusCode *status) = 0; + virtual unsigned char readLEDs_Mode(tRioStatusCode *status) = 0; + virtual bool readLEDs_RSL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserButton_IfaceConstants; + + virtual bool readUserButton(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tInterrupt.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tInterrupt.h new file mode 100644 index 0000000..1dbd981 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tInterrupt.h @@ -0,0 +1,100 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Interrupt_h__ +#define __nFRC_2016_16_1_0_Interrupt_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tInterrupt +{ +public: + tInterrupt(){} + virtual ~tInterrupt(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Source_Channel : 4; + unsigned Source_Module : 1; + unsigned Source_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; + unsigned WaitForAck : 1; +#else + unsigned WaitForAck : 1; + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned Source_AnalogTrigger : 1; + unsigned Source_Module : 1; + unsigned Source_Channel : 4; +#endif + }; + struct{ + unsigned value : 9; + }; + } tConfig; + + + typedef enum + { + } tFallingTimeStamp_IfaceConstants; + + virtual unsigned int readFallingTimeStamp(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRisingTimeStamp_IfaceConstants; + + virtual unsigned int readRisingTimeStamp(tRioStatusCode *status) = 0; + + + + + +private: + tInterrupt(const tInterrupt&); + void operator=(const tInterrupt&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Interrupt_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPWM.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPWM.h new file mode 100644 index 0000000..08143b8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPWM.h @@ -0,0 +1,120 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_PWM_h__ +#define __nFRC_2016_16_1_0_PWM_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tPWM +{ +public: + tPWM(){} + virtual ~tPWM(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tPWM* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 16; + unsigned MinHigh : 16; +#else + unsigned MinHigh : 16; + unsigned Period : 16; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Period(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_Period(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_MinHigh(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPeriodScaleMXPElements = 10, + } tPeriodScaleMXP_IfaceConstants; + + virtual void writePeriodScaleMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPeriodScaleMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPeriodScaleHdrElements = 10, + } tPeriodScaleHdr_IfaceConstants; + + virtual void writePeriodScaleHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPeriodScaleHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumZeroLatchElements = 20, + } tZeroLatch_IfaceConstants; + + virtual void writeZeroLatch(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual bool readZeroLatch(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + + typedef enum + { + kNumHdrRegisters = 10, + } tHdr_IfaceConstants; + + virtual void writeHdr(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readHdr(unsigned char reg_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumMXPRegisters = 10, + } tMXP_IfaceConstants; + + virtual void writeMXP(unsigned char reg_index, unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readMXP(unsigned char reg_index, tRioStatusCode *status) = 0; + + +private: + tPWM(const tPWM&); + void operator=(const tPWM&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_PWM_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPower.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPower.h new file mode 100644 index 0000000..da40d8b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tPower.h @@ -0,0 +1,220 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Power_h__ +#define __nFRC_2016_16_1_0_Power_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tPower +{ +public: + tPower(){} + virtual ~tPower(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tPower* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned User3V3 : 8; + unsigned User5V : 8; + unsigned User6V : 8; +#else + unsigned User6V : 8; + unsigned User5V : 8; + unsigned User3V3 : 8; +#endif + }; + struct{ + unsigned value : 24; + }; + } tStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned OverCurrentFaultCount3V3 : 8; + unsigned OverCurrentFaultCount5V : 8; + unsigned OverCurrentFaultCount6V : 8; + unsigned UnderVoltageFaultCount5V : 8; +#else + unsigned UnderVoltageFaultCount5V : 8; + unsigned OverCurrentFaultCount6V : 8; + unsigned OverCurrentFaultCount5V : 8; + unsigned OverCurrentFaultCount3V3 : 8; +#endif + }; + struct{ + unsigned value : 32; + }; + } tFaultCounts; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned User3V3 : 1; + unsigned User5V : 1; + unsigned User6V : 1; +#else + unsigned User6V : 1; + unsigned User5V : 1; + unsigned User3V3 : 1; +#endif + }; + struct{ + unsigned value : 3; + }; + } tDisable; + + + + typedef enum + { + } tUserVoltage3V3_IfaceConstants; + + virtual unsigned short readUserVoltage3V3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User3V3(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User5V(tRioStatusCode *status) = 0; + virtual unsigned char readStatus_User6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserVoltage6V_IfaceConstants; + + virtual unsigned short readUserVoltage6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tOnChipTemperature_IfaceConstants; + + virtual unsigned short readOnChipTemperature(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserVoltage5V_IfaceConstants; + + virtual unsigned short readUserVoltage5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tResetFaultCounts_IfaceConstants; + + virtual void strobeResetFaultCounts(tRioStatusCode *status) = 0; + + + typedef enum + { + } tIntegratedIO_IfaceConstants; + + virtual unsigned short readIntegratedIO(tRioStatusCode *status) = 0; + + + typedef enum + { + } tMXP_DIOVoltage_IfaceConstants; + + virtual unsigned short readMXP_DIOVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent3V3_IfaceConstants; + + virtual unsigned short readUserCurrent3V3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVinVoltage_IfaceConstants; + + virtual unsigned short readVinVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent6V_IfaceConstants; + + virtual unsigned short readUserCurrent6V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUserCurrent5V_IfaceConstants; + + virtual unsigned short readUserCurrent5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tAOVoltage_IfaceConstants; + + virtual unsigned short readAOVoltage(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFaultCounts_IfaceConstants; + + virtual tFaultCounts readFaultCounts(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount3V3(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount5V(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_OverCurrentFaultCount6V(tRioStatusCode *status) = 0; + virtual unsigned char readFaultCounts_UnderVoltageFaultCount5V(tRioStatusCode *status) = 0; + + + typedef enum + { + } tVinCurrent_IfaceConstants; + + virtual unsigned short readVinCurrent(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDisable_IfaceConstants; + + virtual void writeDisable(tDisable value, tRioStatusCode *status) = 0; + virtual void writeDisable_User3V3(bool value, tRioStatusCode *status) = 0; + virtual void writeDisable_User5V(bool value, tRioStatusCode *status) = 0; + virtual void writeDisable_User6V(bool value, tRioStatusCode *status) = 0; + virtual tDisable readDisable(tRioStatusCode *status) = 0; + virtual bool readDisable_User3V3(tRioStatusCode *status) = 0; + virtual bool readDisable_User5V(tRioStatusCode *status) = 0; + virtual bool readDisable_User6V(tRioStatusCode *status) = 0; + + + + +private: + tPower(const tPower&); + void operator=(const tPower&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Power_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tRelay.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tRelay.h new file mode 100644 index 0000000..e32a3d5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tRelay.h @@ -0,0 +1,68 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_Relay_h__ +#define __nFRC_2016_16_1_0_Relay_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tRelay +{ +public: + tRelay(){} + virtual ~tRelay(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tRelay* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Forward : 4; + unsigned Reverse : 4; +#else + unsigned Reverse : 4; + unsigned Forward : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tValue; + + + + typedef enum + { + } tValue_IfaceConstants; + + virtual void writeValue(tValue value, tRioStatusCode *status) = 0; + virtual void writeValue_Forward(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeValue_Reverse(unsigned char value, tRioStatusCode *status) = 0; + virtual tValue readValue(tRioStatusCode *status) = 0; + virtual unsigned char readValue_Forward(tRioStatusCode *status) = 0; + virtual unsigned char readValue_Reverse(tRioStatusCode *status) = 0; + + + + +private: + tRelay(const tRelay&); + void operator=(const tRelay&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_Relay_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSPI.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSPI.h new file mode 100644 index 0000000..e54715f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSPI.h @@ -0,0 +1,68 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_SPI_h__ +#define __nFRC_2016_16_1_0_SPI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tSPI +{ +public: + tSPI(){} + virtual ~tSPI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSPI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Hdr : 4; + unsigned MXP : 1; +#else + unsigned MXP : 1; + unsigned Hdr : 4; +#endif + }; + struct{ + unsigned value : 5; + }; + } tChipSelectActiveHigh; + + + + typedef enum + { + } tChipSelectActiveHigh_IfaceConstants; + + virtual void writeChipSelectActiveHigh(tChipSelectActiveHigh value, tRioStatusCode *status) = 0; + virtual void writeChipSelectActiveHigh_Hdr(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChipSelectActiveHigh_MXP(unsigned char value, tRioStatusCode *status) = 0; + virtual tChipSelectActiveHigh readChipSelectActiveHigh(tRioStatusCode *status) = 0; + virtual unsigned char readChipSelectActiveHigh_Hdr(tRioStatusCode *status) = 0; + virtual unsigned char readChipSelectActiveHigh_MXP(tRioStatusCode *status) = 0; + + + + +private: + tSPI(const tSPI&); + void operator=(const tSPI&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_SPI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSysWatchdog.h b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSysWatchdog.h new file mode 100644 index 0000000..8c2133e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRoboRIO_FPGANamespace/tSysWatchdog.h @@ -0,0 +1,108 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2016_16_1_0_SysWatchdog_h__ +#define __nFRC_2016_16_1_0_SysWatchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2016_16_1_0 +{ + +class tSysWatchdog +{ +public: + tSysWatchdog(){} + virtual ~tSysWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSysWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SystemActive : 1; + unsigned PowerAlive : 1; + unsigned SysDisableCount : 15; + unsigned PowerDisableCount : 15; +#else + unsigned PowerDisableCount : 15; + unsigned SysDisableCount : 15; + unsigned PowerAlive : 1; + unsigned SystemActive : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tStatus; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0; + virtual bool readStatus_PowerAlive(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_PowerDisableCount(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCommand_IfaceConstants; + + virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readCommand(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChallenge_IfaceConstants; + + virtual unsigned char readChallenge(tRioStatusCode *status) = 0; + + + typedef enum + { + } tActive_IfaceConstants; + + virtual void writeActive(bool value, tRioStatusCode *status) = 0; + virtual bool readActive(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + typedef enum + { + } tForcedKills_IfaceConstants; + + virtual unsigned short readForcedKills(tRioStatusCode *status) = 0; + + + + +private: + tSysWatchdog(const tSysWatchdog&); + void operator=(const tSysWatchdog&); +}; + +} +} + +#endif // __nFRC_2016_16_1_0_SysWatchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/nInterfaceGlobals.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/nInterfaceGlobals.h new file mode 100644 index 0000000..b6c366c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/nInterfaceGlobals.h @@ -0,0 +1,15 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_nInterfaceGlobals_h__ +#define __nFRC_2012_1_6_4_nInterfaceGlobals_h__ + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + extern unsigned int g_currentTargetClass; +} +} + +#endif // __nFRC_2012_1_6_4_nInterfaceGlobals_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAI.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAI.h new file mode 100644 index 0000000..6316af6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAI.h @@ -0,0 +1,149 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_AI_h__ +#define __nFRC_2012_1_6_4_AI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAI +{ +public: + tAI(){} + virtual ~tAI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAI* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Module : 1; + unsigned Averaged : 1; +#else + unsigned Averaged : 1; + unsigned Module : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 5; + }; + } tReadSelect; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ScanSize : 3; + unsigned ConvertRate : 26; +#else + unsigned ConvertRate : 26; + unsigned ScanSize : 3; +#endif + }; + struct{ + unsigned value : 29; + }; + } tConfig; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0; + virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumOversampleBitsElements = 8, + } tOversampleBits_IfaceConstants; + + virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumAverageBitsElements = 8, + } tAverageBits_IfaceConstants; + + virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumScanListElements = 8, + } tScanList_IfaceConstants; + + virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual signed int readOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLatchOutput_IfaceConstants; + + virtual void strobeLatchOutput(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadSelect_IfaceConstants; + + virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readReadSelect_Module(tRioStatusCode *status) = 0; + virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0; + + + + +private: + tAI(const tAI&); + void operator=(const tAI&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_AI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAccumulator.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAccumulator.h new file mode 100644 index 0000000..d182882 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAccumulator.h @@ -0,0 +1,87 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Accumulator_h__ +#define __nFRC_2012_1_6_4_Accumulator_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAccumulator +{ +public: + tAccumulator(){} + virtual ~tAccumulator(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ + signed long long Value; + unsigned Count : 32; + }; + struct{ + unsigned value : 32; + unsigned value2 : 32; + unsigned value3 : 32; + }; + } tOutput; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual signed long long readOutput_Value(tRioStatusCode *status) = 0; + virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0; + + + typedef enum + { + } tCenter_IfaceConstants; + + virtual void writeCenter(signed int value, tRioStatusCode *status) = 0; + virtual signed int readCenter(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDeadband_IfaceConstants; + + virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0; + virtual signed int readDeadband(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + + + +private: + tAccumulator(const tAccumulator&); + void operator=(const tAccumulator&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Accumulator_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAlarm.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAlarm.h new file mode 100644 index 0000000..a1c2f51 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAlarm.h @@ -0,0 +1,57 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Alarm_h__ +#define __nFRC_2012_1_6_4_Alarm_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAlarm +{ +public: + tAlarm(){} + virtual ~tAlarm(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAlarm* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tEnable_IfaceConstants; + + virtual void writeEnable(bool value, tRioStatusCode *status) = 0; + virtual bool readEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTriggerTime_IfaceConstants; + + virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0; + + + + +private: + tAlarm(const tAlarm&); + void operator=(const tAlarm&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Alarm_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAnalogTrigger.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAnalogTrigger.h new file mode 100644 index 0000000..4fabd9c --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tAnalogTrigger.h @@ -0,0 +1,133 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_AnalogTrigger_h__ +#define __nFRC_2012_1_6_4_AnalogTrigger_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tAnalogTrigger +{ +public: + tAnalogTrigger(){} + virtual ~tAnalogTrigger(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned InHysteresis : 1; + unsigned OverLimit : 1; + unsigned Rising : 1; + unsigned Falling : 1; +#else + unsigned Falling : 1; + unsigned Rising : 1; + unsigned OverLimit : 1; + unsigned InHysteresis : 1; +#endif + }; + struct{ + unsigned value : 4; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Channel : 3; + unsigned Module : 1; + unsigned Averaged : 1; + unsigned Filter : 1; + unsigned FloatingRollover : 1; + signed RolloverLimit : 8; +#else + signed RolloverLimit : 8; + unsigned FloatingRollover : 1; + unsigned Filter : 1; + unsigned Averaged : 1; + unsigned Module : 1; + unsigned Channel : 3; +#endif + }; + struct{ + unsigned value : 15; + }; + } tSourceSelect; + + + typedef enum + { + } tSourceSelect_IfaceConstants; + + virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0; + virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0; + virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readSourceSelect_Module(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0; + virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0; + virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tUpperLimit_IfaceConstants; + + virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readUpperLimit(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLowerLimit_IfaceConstants; + + virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0; + virtual signed int readLowerLimit(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumOutputElements = 8, + } tOutput_IfaceConstants; + + virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tAnalogTrigger(const tAnalogTrigger&); + void operator=(const tAnalogTrigger&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_AnalogTrigger_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tCounter.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tCounter.h new file mode 100644 index 0000000..200ffb3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tCounter.h @@ -0,0 +1,219 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Counter_h__ +#define __nFRC_2012_1_6_4_Counter_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tCounter +{ +public: + tCounter(){} + virtual ~tCounter(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tCounter* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned UpSource_Channel : 4; + unsigned UpSource_Module : 1; + unsigned UpSource_AnalogTrigger : 1; + unsigned DownSource_Channel : 4; + unsigned DownSource_Module : 1; + unsigned DownSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned UpRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned DownFallingEdge : 1; + unsigned Mode : 2; + unsigned PulseLengthThreshold : 6; + unsigned Enable : 1; +#else + unsigned Enable : 1; + unsigned PulseLengthThreshold : 6; + unsigned Mode : 2; + unsigned DownFallingEdge : 1; + unsigned DownRisingEdge : 1; + unsigned UpFallingEdge : 1; + unsigned UpRisingEdge : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned DownSource_AnalogTrigger : 1; + unsigned DownSource_Module : 1; + unsigned DownSource_Channel : 4; + unsigned UpSource_AnalogTrigger : 1; + unsigned UpSource_Module : 1; + unsigned UpSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 32; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0; + virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tCounter(const tCounter&); + void operator=(const tCounter&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Counter_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDIO.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDIO.h new file mode 100644 index 0000000..d9852c9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDIO.h @@ -0,0 +1,330 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_DIO_h__ +#define __nFRC_2012_1_6_4_DIO_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tDIO +{ +public: + tDIO(){} + virtual ~tDIO(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDIO* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 2, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 16; + unsigned MinHigh : 16; +#else + unsigned MinHigh : 16; + unsigned Period : 16; +#endif + }; + struct{ + unsigned value : 32; + }; + } tPWMConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned RelayFwd : 8; + unsigned RelayRev : 8; + unsigned I2CHeader : 4; +#else + unsigned I2CHeader : 4; + unsigned RelayRev : 8; + unsigned RelayFwd : 8; +#endif + }; + struct{ + unsigned value : 20; + }; + } tSlowValue; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Transaction : 1; + unsigned Done : 1; + unsigned Aborted : 1; + unsigned DataReceivedHigh : 24; +#else + unsigned DataReceivedHigh : 24; + unsigned Aborted : 1; + unsigned Done : 1; + unsigned Transaction : 1; +#endif + }; + struct{ + unsigned value : 27; + }; + } tI2CStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Address : 8; + unsigned BytesToRead : 3; + unsigned BytesToWrite : 3; + unsigned DataToSendHigh : 16; + unsigned BitwiseHandshake : 1; +#else + unsigned BitwiseHandshake : 1; + unsigned DataToSendHigh : 16; + unsigned BytesToWrite : 3; + unsigned BytesToRead : 3; + unsigned Address : 8; +#endif + }; + struct{ + unsigned value : 31; + }; + } tI2CConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned PeriodPower : 4; + unsigned OutputSelect_0 : 4; + unsigned OutputSelect_1 : 4; + unsigned OutputSelect_2 : 4; + unsigned OutputSelect_3 : 4; +#else + unsigned OutputSelect_3 : 4; + unsigned OutputSelect_2 : 4; + unsigned OutputSelect_1 : 4; + unsigned OutputSelect_0 : 4; + unsigned PeriodPower : 4; +#endif + }; + struct{ + unsigned value : 20; + }; + } tDO_PWMConfig; + + + typedef enum + { + kNumFilterSelectElements = 16, + } tFilterSelect_IfaceConstants; + + virtual void writeFilterSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CDataToSend_IfaceConstants; + + virtual void writeI2CDataToSend(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readI2CDataToSend(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO_IfaceConstants; + + virtual void writeDO(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readDO(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumFilterPeriodElements = 3, + } tFilterPeriod_IfaceConstants; + + virtual void writeFilterPeriod(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readFilterPeriod(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tOutputEnable_IfaceConstants; + + virtual void writeOutputEnable(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readOutputEnable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulse_IfaceConstants; + + virtual void writePulse(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readPulse(tRioStatusCode *status) = 0; + + + typedef enum + { + } tSlowValue_IfaceConstants; + + virtual void writeSlowValue(tSlowValue value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_RelayFwd(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_RelayRev(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeSlowValue_I2CHeader(unsigned char value, tRioStatusCode *status) = 0; + virtual tSlowValue readSlowValue(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_RelayFwd(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_RelayRev(tRioStatusCode *status) = 0; + virtual unsigned char readSlowValue_I2CHeader(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CStatus_IfaceConstants; + + virtual tI2CStatus readI2CStatus(tRioStatusCode *status) = 0; + virtual unsigned char readI2CStatus_Transaction(tRioStatusCode *status) = 0; + virtual bool readI2CStatus_Done(tRioStatusCode *status) = 0; + virtual bool readI2CStatus_Aborted(tRioStatusCode *status) = 0; + virtual unsigned int readI2CStatus_DataReceivedHigh(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CDataReceived_IfaceConstants; + + virtual unsigned int readI2CDataReceived(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDI_IfaceConstants; + + virtual unsigned short readDI(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPulseLength_IfaceConstants; + + virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPulseLength(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumPWMPeriodScaleElements = 10, + } tPWMPeriodScale_IfaceConstants; + + virtual void writePWMPeriodScale(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMPeriodScale(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + kNumDO_PWMDutyCycleElements = 4, + } tDO_PWMDutyCycle_IfaceConstants; + + virtual void writeDO_PWMDutyCycle(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMDutyCycle(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + typedef enum + { + } tBFL_IfaceConstants; + + virtual void writeBFL(bool value, tRioStatusCode *status) = 0; + virtual bool readBFL(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CConfig_IfaceConstants; + + virtual void writeI2CConfig(tI2CConfig value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_Address(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BytesToRead(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BytesToWrite(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_DataToSendHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual void writeI2CConfig_BitwiseHandshake(bool value, tRioStatusCode *status) = 0; + virtual tI2CConfig readI2CConfig(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_Address(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_BytesToRead(tRioStatusCode *status) = 0; + virtual unsigned char readI2CConfig_BytesToWrite(tRioStatusCode *status) = 0; + virtual unsigned short readI2CConfig_DataToSendHigh(tRioStatusCode *status) = 0; + virtual bool readI2CConfig_BitwiseHandshake(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDO_PWMConfig_IfaceConstants; + + virtual void writeDO_PWMConfig(tDO_PWMConfig value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_PeriodPower(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_0(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_1(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_2(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeDO_PWMConfig_OutputSelect_3(unsigned char value, tRioStatusCode *status) = 0; + virtual tDO_PWMConfig readDO_PWMConfig(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_PeriodPower(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_0(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_1(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_2(tRioStatusCode *status) = 0; + virtual unsigned char readDO_PWMConfig_OutputSelect_3(tRioStatusCode *status) = 0; + + + typedef enum + { + } tI2CStart_IfaceConstants; + + virtual void strobeI2CStart(tRioStatusCode *status) = 0; + + + + typedef enum + { + } tLoopTiming_IfaceConstants; + + virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0; + + + typedef enum + { + } tPWMConfig_IfaceConstants; + + virtual void writePWMConfig(tPWMConfig value, tRioStatusCode *status) = 0; + virtual void writePWMConfig_Period(unsigned short value, tRioStatusCode *status) = 0; + virtual void writePWMConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0; + virtual tPWMConfig readPWMConfig(tRioStatusCode *status) = 0; + virtual unsigned short readPWMConfig_Period(tRioStatusCode *status) = 0; + virtual unsigned short readPWMConfig_MinHigh(tRioStatusCode *status) = 0; + + + + typedef enum + { + kNumPWMValueRegisters = 10, + } tPWMValue_IfaceConstants; + + virtual void writePWMValue(unsigned char reg_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readPWMValue(unsigned char reg_index, tRioStatusCode *status) = 0; + + + +private: + tDIO(const tDIO&); + void operator=(const tDIO&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_DIO_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDMA.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDMA.h new file mode 100644 index 0000000..c46cad2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tDMA.h @@ -0,0 +1,188 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_DMA_h__ +#define __nFRC_2012_1_6_4_DMA_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tDMA +{ +public: + tDMA(){} + virtual ~tDMA(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tDMA* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Pause : 1; + unsigned Enable_AI0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_DI : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_Encoders : 1; + unsigned Enable_EncoderTimers : 1; + unsigned ExternalClock : 1; +#else + unsigned ExternalClock : 1; + unsigned Enable_EncoderTimers : 1; + unsigned Enable_Encoders : 1; + unsigned Enable_CounterTimers_High : 1; + unsigned Enable_CounterTimers_Low : 1; + unsigned Enable_Counters_High : 1; + unsigned Enable_Counters_Low : 1; + unsigned Enable_AnalogTriggers : 1; + unsigned Enable_DI : 1; + unsigned Enable_Accumulator1 : 1; + unsigned Enable_Accumulator0 : 1; + unsigned Enable_AIAveraged1_High : 1; + unsigned Enable_AIAveraged1_Low : 1; + unsigned Enable_AI1_High : 1; + unsigned Enable_AI1_Low : 1; + unsigned Enable_AIAveraged0_High : 1; + unsigned Enable_AIAveraged0_Low : 1; + unsigned Enable_AI0_High : 1; + unsigned Enable_AI0_Low : 1; + unsigned Pause : 1; +#endif + }; + struct{ + unsigned value : 20; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ExternalClockSource_Channel : 4; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; +#else + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned ExternalClockSource_AnalogTrigger : 1; + unsigned ExternalClockSource_Module : 1; + unsigned ExternalClockSource_Channel : 4; +#endif + }; + struct{ + unsigned value : 8; + }; + } tExternalTriggers; + + + + typedef enum + { + } tRate_IfaceConstants; + + virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readRate(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_Encoders(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable_EncoderTimers(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual bool readConfig_Pause(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_Encoders(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable_EncoderTimers(tRioStatusCode *status) = 0; + virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0; + + + typedef enum + { + kNumExternalTriggersElements = 4, + } tExternalTriggers_IfaceConstants; + + virtual void writeExternalTriggers(unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_RisingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual void writeExternalTriggers_FallingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0; + virtual tExternalTriggers readExternalTriggers(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_RisingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0; + virtual bool readExternalTriggers_FallingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tDMA(const tDMA&); + void operator=(const tDMA&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_DMA_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tEncoder.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tEncoder.h new file mode 100644 index 0000000..0b68067 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tEncoder.h @@ -0,0 +1,199 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Encoder_h__ +#define __nFRC_2012_1_6_4_Encoder_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tEncoder +{ +public: + tEncoder(){} + virtual ~tEncoder(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tEncoder* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 4, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Direction : 1; + signed Value : 31; +#else + signed Value : 31; + unsigned Direction : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ASource_Channel : 4; + unsigned ASource_Module : 1; + unsigned ASource_AnalogTrigger : 1; + unsigned BSource_Channel : 4; + unsigned BSource_Module : 1; + unsigned BSource_AnalogTrigger : 1; + unsigned IndexSource_Channel : 4; + unsigned IndexSource_Module : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexActiveHigh : 1; + unsigned Reverse : 1; + unsigned Enable : 1; +#else + unsigned Enable : 1; + unsigned Reverse : 1; + unsigned IndexActiveHigh : 1; + unsigned IndexSource_AnalogTrigger : 1; + unsigned IndexSource_Module : 1; + unsigned IndexSource_Channel : 4; + unsigned BSource_AnalogTrigger : 1; + unsigned BSource_Module : 1; + unsigned BSource_Channel : 4; + unsigned ASource_AnalogTrigger : 1; + unsigned ASource_Module : 1; + unsigned ASource_Channel : 4; +#endif + }; + struct{ + unsigned value : 21; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Period : 23; + signed Count : 8; + unsigned Stalled : 1; +#else + unsigned Stalled : 1; + signed Count : 8; + unsigned Period : 23; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerOutput; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned StallPeriod : 24; + unsigned AverageSize : 7; + unsigned UpdateWhenEmpty : 1; +#else + unsigned UpdateWhenEmpty : 1; + unsigned AverageSize : 7; + unsigned StallPeriod : 24; +#endif + }; + struct{ + unsigned value : 32; + }; + } tTimerConfig; + + + typedef enum + { + } tOutput_IfaceConstants; + + virtual tOutput readOutput(tRioStatusCode *status) = 0; + virtual bool readOutput_Direction(tRioStatusCode *status) = 0; + virtual signed int readOutput_Value(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0; + virtual bool readConfig_Reverse(tRioStatusCode *status) = 0; + virtual bool readConfig_Enable(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerOutput_IfaceConstants; + + virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0; + virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0; + virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0; + virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimerConfig_IfaceConstants; + + virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0; + virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0; + virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0; + virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0; + virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0; + + + + + +private: + tEncoder(const tEncoder&); + void operator=(const tEncoder&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Encoder_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tGlobal.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tGlobal.h new file mode 100644 index 0000000..2dbbbe7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tGlobal.h @@ -0,0 +1,70 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Global_h__ +#define __nFRC_2012_1_6_4_Global_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tGlobal +{ +public: + tGlobal(){} + virtual ~tGlobal(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tGlobal* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tVersion_IfaceConstants; + + virtual unsigned short readVersion(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLocalTime_IfaceConstants; + + virtual unsigned int readLocalTime(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFPGA_LED_IfaceConstants; + + virtual void writeFPGA_LED(bool value, tRioStatusCode *status) = 0; + virtual bool readFPGA_LED(tRioStatusCode *status) = 0; + + + typedef enum + { + } tRevision_IfaceConstants; + + virtual unsigned int readRevision(tRioStatusCode *status) = 0; + + + + +private: + tGlobal(const tGlobal&); + void operator=(const tGlobal&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Global_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tInterrupt.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tInterrupt.h new file mode 100644 index 0000000..519f6b3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tInterrupt.h @@ -0,0 +1,93 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Interrupt_h__ +#define __nFRC_2012_1_6_4_Interrupt_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tInterrupt +{ +public: + tInterrupt(){} + virtual ~tInterrupt(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status); + virtual unsigned char getSystemIndex() = 0; + + + typedef enum + { + kNumSystems = 8, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned Source_Channel : 4; + unsigned Source_Module : 1; + unsigned Source_AnalogTrigger : 1; + unsigned RisingEdge : 1; + unsigned FallingEdge : 1; + unsigned WaitForAck : 1; +#else + unsigned WaitForAck : 1; + unsigned FallingEdge : 1; + unsigned RisingEdge : 1; + unsigned Source_AnalogTrigger : 1; + unsigned Source_Module : 1; + unsigned Source_Channel : 4; +#endif + }; + struct{ + unsigned value : 9; + }; + } tConfig; + + + typedef enum + { + } tTimeStamp_IfaceConstants; + + virtual unsigned int readTimeStamp(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0; + virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0; + virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0; + virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0; + + + + + +private: + tInterrupt(const tInterrupt&); + void operator=(const tInterrupt&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Interrupt_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSPI.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSPI.h new file mode 100644 index 0000000..c74ec9b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSPI.h @@ -0,0 +1,228 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_SPI_h__ +#define __nFRC_2012_1_6_4_SPI_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSPI +{ +public: + tSPI(){} + virtual ~tSPI(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSPI* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned ReceivedDataOverflow : 1; + unsigned Idle : 1; +#else + unsigned Idle : 1; + unsigned ReceivedDataOverflow : 1; +#endif + }; + struct{ + unsigned value : 2; + }; + } tStatus; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned BusBitWidth : 8; + unsigned ClockHalfPeriodDelay : 8; + unsigned MSBfirst : 1; + unsigned DataOnFalling : 1; + unsigned LatchFirst : 1; + unsigned LatchLast : 1; + unsigned FramePolarity : 1; + unsigned WriteOnly : 1; + unsigned ClockPolarity : 1; +#else + unsigned ClockPolarity : 1; + unsigned WriteOnly : 1; + unsigned FramePolarity : 1; + unsigned LatchLast : 1; + unsigned LatchFirst : 1; + unsigned DataOnFalling : 1; + unsigned MSBfirst : 1; + unsigned ClockHalfPeriodDelay : 8; + unsigned BusBitWidth : 8; +#endif + }; + struct{ + unsigned value : 23; + }; + } tConfig; + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SCLK_Channel : 4; + unsigned SCLK_Module : 1; + unsigned MOSI_Channel : 4; + unsigned MOSI_Module : 1; + unsigned MISO_Channel : 4; + unsigned MISO_Module : 1; + unsigned SS_Channel : 4; + unsigned SS_Module : 1; +#else + unsigned SS_Module : 1; + unsigned SS_Channel : 4; + unsigned MISO_Module : 1; + unsigned MISO_Channel : 4; + unsigned MOSI_Module : 1; + unsigned MOSI_Channel : 4; + unsigned SCLK_Module : 1; + unsigned SCLK_Channel : 4; +#endif + }; + struct{ + unsigned value : 20; + }; + } tChannels; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_ReceivedDataOverflow(tRioStatusCode *status) = 0; + virtual bool readStatus_Idle(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReceivedData_IfaceConstants; + + virtual unsigned int readReceivedData(tRioStatusCode *status) = 0; + + + typedef enum + { + } tDataToLoad_IfaceConstants; + + virtual void writeDataToLoad(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readDataToLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tConfig_IfaceConstants; + + virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0; + virtual void writeConfig_BusBitWidth(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_ClockHalfPeriodDelay(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeConfig_MSBfirst(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_DataOnFalling(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_LatchFirst(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_LatchLast(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_FramePolarity(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_WriteOnly(bool value, tRioStatusCode *status) = 0; + virtual void writeConfig_ClockPolarity(bool value, tRioStatusCode *status) = 0; + virtual tConfig readConfig(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_BusBitWidth(tRioStatusCode *status) = 0; + virtual unsigned char readConfig_ClockHalfPeriodDelay(tRioStatusCode *status) = 0; + virtual bool readConfig_MSBfirst(tRioStatusCode *status) = 0; + virtual bool readConfig_DataOnFalling(tRioStatusCode *status) = 0; + virtual bool readConfig_LatchFirst(tRioStatusCode *status) = 0; + virtual bool readConfig_LatchLast(tRioStatusCode *status) = 0; + virtual bool readConfig_FramePolarity(tRioStatusCode *status) = 0; + virtual bool readConfig_WriteOnly(tRioStatusCode *status) = 0; + virtual bool readConfig_ClockPolarity(tRioStatusCode *status) = 0; + + + typedef enum + { + } tClearReceivedData_IfaceConstants; + + virtual void strobeClearReceivedData(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReceivedElements_IfaceConstants; + + virtual unsigned short readReceivedElements(tRioStatusCode *status) = 0; + + + typedef enum + { + } tLoad_IfaceConstants; + + virtual void strobeLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReset_IfaceConstants; + + virtual void strobeReset(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChannels_IfaceConstants; + + virtual void writeChannels(tChannels value, tRioStatusCode *status) = 0; + virtual void writeChannels_SCLK_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SCLK_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MOSI_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MOSI_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MISO_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_MISO_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SS_Channel(unsigned char value, tRioStatusCode *status) = 0; + virtual void writeChannels_SS_Module(unsigned char value, tRioStatusCode *status) = 0; + virtual tChannels readChannels(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SCLK_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SCLK_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MOSI_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MOSI_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MISO_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_MISO_Module(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SS_Channel(tRioStatusCode *status) = 0; + virtual unsigned char readChannels_SS_Module(tRioStatusCode *status) = 0; + + + typedef enum + { + } tAvailableToLoad_IfaceConstants; + + virtual unsigned short readAvailableToLoad(tRioStatusCode *status) = 0; + + + typedef enum + { + } tReadReceivedData_IfaceConstants; + + virtual void strobeReadReceivedData(tRioStatusCode *status) = 0; + + + + +private: + tSPI(const tSPI&); + void operator=(const tSPI&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_SPI_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSolenoid.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSolenoid.h new file mode 100644 index 0000000..67c9a40 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSolenoid.h @@ -0,0 +1,50 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Solenoid_h__ +#define __nFRC_2012_1_6_4_Solenoid_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSolenoid +{ +public: + tSolenoid(){} + virtual ~tSolenoid(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSolenoid* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + kNumDO7_0Elements = 2, + } tDO7_0_IfaceConstants; + + virtual void writeDO7_0(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0; + virtual unsigned char readDO7_0(unsigned char bitfield_index, tRioStatusCode *status) = 0; + + + + +private: + tSolenoid(const tSolenoid&); + void operator=(const tSolenoid&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Solenoid_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSysWatchdog.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSysWatchdog.h new file mode 100644 index 0000000..daca9b6 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tSysWatchdog.h @@ -0,0 +1,71 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_SysWatchdog_h__ +#define __nFRC_2012_1_6_4_SysWatchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tSysWatchdog +{ +public: + tSysWatchdog(){} + virtual ~tSysWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tSysWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + + + + typedef enum + { + } tCommand_IfaceConstants; + + virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0; + virtual unsigned short readCommand(tRioStatusCode *status) = 0; + + + typedef enum + { + } tChallenge_IfaceConstants; + + virtual unsigned char readChallenge(tRioStatusCode *status) = 0; + + + typedef enum + { + } tActive_IfaceConstants; + + virtual void writeActive(bool value, tRioStatusCode *status) = 0; + virtual bool readActive(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + + +private: + tSysWatchdog(const tSysWatchdog&); + void operator=(const tSysWatchdog&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_SysWatchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tWatchdog.h b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tWatchdog.h new file mode 100644 index 0000000..d4a4cba --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nRuntimeFPGANamespace/tWatchdog.h @@ -0,0 +1,108 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. +// Do Not Edit... this file is generated! + +#ifndef __nFRC_2012_1_6_4_Watchdog_h__ +#define __nFRC_2012_1_6_4_Watchdog_h__ + +#include "tSystemInterface.h" + +namespace nFPGA +{ +namespace nFRC_2012_1_6_4 +{ + +class tWatchdog +{ +public: + tWatchdog(){} + virtual ~tWatchdog(){} + + virtual tSystemInterface* getSystemInterface() = 0; + static tWatchdog* create(tRioStatusCode *status); + + typedef enum + { + kNumSystems = 1, + } tIfaceConstants; + + typedef + union{ + struct{ +#ifdef __vxworks + unsigned SystemActive : 1; + unsigned Alive : 1; + unsigned SysDisableCount : 15; + unsigned DisableCount : 15; +#else + unsigned DisableCount : 15; + unsigned SysDisableCount : 15; + unsigned Alive : 1; + unsigned SystemActive : 1; +#endif + }; + struct{ + unsigned value : 32; + }; + } tStatus; + + + + typedef enum + { + } tStatus_IfaceConstants; + + virtual tStatus readStatus(tRioStatusCode *status) = 0; + virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0; + virtual bool readStatus_Alive(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0; + virtual unsigned short readStatus_DisableCount(tRioStatusCode *status) = 0; + + + typedef enum + { + } tKill_IfaceConstants; + + virtual void strobeKill(tRioStatusCode *status) = 0; + + + typedef enum + { + } tFeed_IfaceConstants; + + virtual void strobeFeed(tRioStatusCode *status) = 0; + + + typedef enum + { + } tTimer_IfaceConstants; + + virtual unsigned int readTimer(tRioStatusCode *status) = 0; + + + typedef enum + { + } tExpiration_IfaceConstants; + + virtual void writeExpiration(unsigned int value, tRioStatusCode *status) = 0; + virtual unsigned int readExpiration(tRioStatusCode *status) = 0; + + + typedef enum + { + } tImmortal_IfaceConstants; + + virtual void writeImmortal(bool value, tRioStatusCode *status) = 0; + virtual bool readImmortal(tRioStatusCode *status) = 0; + + + + +private: + tWatchdog(const tWatchdog&); + void operator=(const tWatchdog&); +}; + +} +} + +#endif // __nFRC_2012_1_6_4_Watchdog_h__ diff --git a/Robot2016/wpilib/cpp/current/include/networktables/NetworkTable.h b/Robot2016/wpilib/cpp/current/include/networktables/NetworkTable.h new file mode 100644 index 0000000..5d8e9b7 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/networktables/NetworkTable.h @@ -0,0 +1,479 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef NETWORKTABLE_H_ +#define NETWORKTABLE_H_ + +#include +#include +#include + +#include "tables/ITable.h" + +/** + * A network table that knows its subtable path. + */ +class NetworkTable : public ITable { + private: + struct private_init {}; + + std::string m_path; + std::mutex m_mutex; + typedef std::pair Listener; + std::vector m_listeners; + + static std::string s_ip_address; + static std::string s_persistent_filename; + static bool s_client; + static bool s_running; + static unsigned int s_port; + + public: + NetworkTable(llvm::StringRef path, const private_init&); + virtual ~NetworkTable(); + + /** + * The path separator for sub-tables and keys + * + */ + static const char PATH_SEPARATOR_CHAR; + + /** + * @throws IOException + */ + static void Initialize(); + static void Shutdown(); + + /** + * set that network tables should be a client + * This must be called before initialize or GetTable + */ + static void SetClientMode(); + + /** + * set that network tables should be a server + * This must be called before initialize or GetTable + */ + static void SetServerMode(); + + /** + * set the team the robot is configured for (this will set the mdns address + * that network tables will connect to in client mode) + * This must be called before initialize or GetTable + * @param team the team number + */ + static void SetTeam(int team); + + /** + * @param address the adress that network tables will connect to in client + * mode + */ + static void SetIPAddress(llvm::StringRef address); + + /** + * @param port the port number that network tables will connect to in client + * mode or listen to in server mode + */ + static void SetPort(unsigned int port); + + /** + * Sets the persistent filename. + * @param filename the filename that the network tables server uses for + * automatic loading and saving of persistent values + */ + static void SetPersistentFilename(llvm::StringRef filename); + + /** + * Sets the network identity. + * This is provided in the connection info on the remote end. + * @param name identity + */ + static void SetNetworkIdentity(llvm::StringRef name); + + /** + * Deletes ALL keys in ALL subtables. Use with caution! + */ + static void GlobalDeleteAll(); + + /** + * Flushes all updated values immediately to the network. + * Note: This is rate-limited to protect the network from flooding. + * This is primarily useful for synchronizing network updates with + * user code. + */ + static void Flush(); + + /** + * Set the periodic update rate. + * + * @param interval update interval in seconds (range 0.1 to 1.0) + */ + static void SetUpdateRate(double interval); + + /** + * Saves persistent keys to a file. The server does this automatically. + * + * @param filename file name + * @return Error (or nullptr). + */ + static const char* SavePersistent(llvm::StringRef filename); + + /** + * Loads persistent keys from a file. The server does this automatically. + * + * @param filename file name + * @param warn callback function called for warnings + * @return Error (or nullptr). + */ + static const char* LoadPersistent( + llvm::StringRef filename, + std::function warn); + + /** + * Gets the table with the specified key. If the table does not exist, a new + * table will be created.
+ * This will automatically initialize network tables if it has not been + * already. + * + * @param key + * the key name + * @return the network table requested + */ + static std::shared_ptr GetTable(llvm::StringRef key); + + void AddTableListener(ITableListener* listener) override; + void AddTableListener(ITableListener* listener, + bool immediateNotify) override; + void AddTableListenerEx(ITableListener* listener, + unsigned int flags) override; + void AddTableListener(llvm::StringRef key, ITableListener* listener, + bool immediateNotify) override; + void AddTableListenerEx(llvm::StringRef key, ITableListener* listener, + unsigned int flags) override; + void AddSubTableListener(ITableListener* listener) override; + void AddSubTableListener(ITableListener* listener, bool localNotify) override; + void RemoveTableListener(ITableListener* listener) override; + + /** + * Returns the table at the specified key. If there is no table at the + * specified key, it will create a new table + * + * @param key + * the key name + * @return the networktable to be returned + */ + std::shared_ptr GetSubTable(llvm::StringRef key) const override; + + /** + * Determines whether the given key is in this table. + * + * @param key the key to search for + * @return true if the table as a value assigned to the given key + */ + bool ContainsKey(llvm::StringRef key) const override; + + /** + * Determines whether there exists a non-empty subtable for this key + * in this table. + * + * @param key the key to search for + * @return true if there is a subtable with the key which contains at least + * one key/subtable of its own + */ + bool ContainsSubTable(llvm::StringRef key) const override; + + /** + * @param types bitmask of types; 0 is treated as a "don't care". + * @return keys currently in the table + */ + std::vector GetKeys(int types = 0) const override; + + /** + * @return subtables currently in the table + */ + std::vector GetSubTables() const override; + + /** + * Makes a key's value persistent through program restarts. + * + * @param key the key to make persistent + */ + void SetPersistent(llvm::StringRef key) override; + + /** + * Stop making a key's value persistent through program restarts. + * The key cannot be null. + * + * @param key the key name + */ + void ClearPersistent(llvm::StringRef key) override; + + /** + * Returns whether the value is persistent through program restarts. + * The key cannot be null. + * + * @param key the key name + */ + bool IsPersistent(llvm::StringRef key) const override; + + /** + * Sets flags on the specified key in this table. The key can + * not be null. + * + * @param key the key name + * @param flags the flags to set (bitmask) + */ + void SetFlags(llvm::StringRef key, unsigned int flags) override; + + /** + * Clears flags on the specified key in this table. The key can + * not be null. + * + * @param key the key name + * @param flags the flags to clear (bitmask) + */ + void ClearFlags(llvm::StringRef key, unsigned int flags) override; + + /** + * Returns the flags for the specified key. + * + * @param key the key name + * @return the flags, or 0 if the key is not defined + */ + unsigned int GetFlags(llvm::StringRef key) const override; + + /** + * Deletes the specified key in this table. + * + * @param key the key name + */ + void Delete(llvm::StringRef key) override; + + /** + * Put a number in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + bool PutNumber(llvm::StringRef key, double value) override; + + /** + * Gets the number associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetNumber(StringRef key, double defaultValue) instead") + virtual double GetNumber(llvm::StringRef key) const override; + + /** + * Gets the number associated with the given name. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + */ + virtual double GetNumber(llvm::StringRef key, + double defaultValue) const override; + + /** + * Put a string in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutString(llvm::StringRef key, llvm::StringRef value) override; + + /** + * Gets the string associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetString(StringRef key, StringRef defaultValue) instead") + virtual std::string GetString(llvm::StringRef key) const override; + + /** + * Gets the string associated with the given name. If the key does not + * exist or is of different type, it will return the default value. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + */ + virtual std::string GetString(llvm::StringRef key, + llvm::StringRef defaultValue) const override; + + /** + * Put a boolean in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutBoolean(llvm::StringRef key, bool value) override; + + /** + * Gets the boolean associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetBoolean(StringRef key, bool defaultValue) instead") + virtual bool GetBoolean(llvm::StringRef key) const override; + + /** + * Gets the boolean associated with the given name. If the key does not + * exist or is of different type, it will return the default value. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + */ + virtual bool GetBoolean(llvm::StringRef key, + bool defaultValue) const override; + + /** + * Put a boolean array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + * + * @note The array must be of int's rather than of bool's because + * std::vector is special-cased in C++. 0 is false, any + * non-zero value is true. + */ + virtual bool PutBooleanArray(llvm::StringRef key, + llvm::ArrayRef value) override; + + /** + * Returns the boolean array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + * + * @note The returned array is std::vector instead of std::vector + * because std::vector is special-cased in C++. 0 is false, any + * non-zero value is true. + */ + virtual std::vector GetBooleanArray( + llvm::StringRef key, llvm::ArrayRef defaultValue) const override; + + /** + * Put a number array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutNumberArray(llvm::StringRef key, + llvm::ArrayRef value) override; + + /** + * Returns the number array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::vector GetNumberArray( + llvm::StringRef key, llvm::ArrayRef defaultValue) const override; + + /** + * Put a string array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutStringArray(llvm::StringRef key, + llvm::ArrayRef value) override; + + /** + * Returns the string array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::vector GetStringArray( + llvm::StringRef key, + llvm::ArrayRef defaultValue) const override; + + /** + * Put a raw value (byte array) in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutRaw(llvm::StringRef key, llvm::StringRef value) override; + + /** + * Returns the raw value (byte array) the key maps to. If the key does not + * exist or is of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the raw contents. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::string GetRaw(llvm::StringRef key, + llvm::StringRef defaultValue) const override; + + /** + * Put a value in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + bool PutValue(llvm::StringRef key, std::shared_ptr value) override; + + /** + * Gets the value associated with a key as an object + * + * @param key the key of the value to look up + * @return the value associated with the given key, or nullptr if the key + * does not exist + */ + std::shared_ptr GetValue(llvm::StringRef key) const override; +}; + +#endif // NETWORKTABLE_H_ diff --git a/Robot2016/wpilib/cpp/current/include/nivision.h b/Robot2016/wpilib/cpp/current/include/nivision.h new file mode 100644 index 0000000..5c56962 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nivision.h @@ -0,0 +1,8829 @@ +/*============================================================================*/ +/* IMAQ Vision */ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) National Instruments 2001. All Rights Reserved. */ +/*----------------------------------------------------------------------------*/ +/* */ +/* Title: NIVision.h */ +/* */ +/*============================================================================*/ +#if !defined(NiVision_h) +#define NiVision_h + +//============================================================================ +// Includes +//============================================================================ +#include + +//============================================================================ +// Control Defines +//============================================================================ +#if !defined(IMAQ_IMPORT) +#ifndef __GNUC__ +#define IMAQ_IMPORT __declspec(dllimport) +#else +#define IMAQ_IMPORT +#endif +#endif + +#if !defined(IMAQ_FUNC) +#if !defined(__cplusplus) +#define IMAQ_FUNC IMAQ_IMPORT +#else +#define IMAQ_FUNC extern "C" IMAQ_IMPORT +#endif +#endif + +#if !defined(IMAQ_STDCALL) +#ifndef __GNUC__ +#define IMAQ_STDCALL __stdcall +#else +#define IMAQ_STDCALL +#endif +#endif + +#ifdef _CVI_ +#pragma EnableLibraryRuntimeChecking +#include +#endif + +#define IMAQ_CALLBACK __cdecl + +//============================================================================ +// Manifest Constants +//============================================================================ +#ifndef NULL +#ifdef __cplusplus +#define NULL ((void*)0) +#else +#define NULL 0 +#endif +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#define IMAQ_DEFAULT_SHOW_COORDINATES TRUE +#define IMAQ_DEFAULT_MAX_ICONS_PER_LINE 4 +#define IMAQ_DEFAULT_LEARNING_MODE IMAQ_LEARN_SHIFT_INFORMATION +#define IMAQ_DEFAULT_BMP_COMPRESS FALSE +#define IMAQ_DEFAULT_PNG_QUALITY 750 +#define IMAQ_DEFAULT_JPEG_QUALITY 750 +#define IMAQ_ALL_CONTOURS -1 +#define IMAQ_ALL_WINDOWS -1 +#define IMAQ_SHIFT 1 +#define IMAQ_ALT 2 +#define IMAQ_CTRL 4 +#define IMAQ_CAPS_LOCK 8 +#define IMAQ_MODAL_DIALOG -1 +#define IMAQ_INIT_RGB_TRANSPARENT \ + { 0, 0, 0, 1 } +#define IMAQ_INIT_RGB_RED \ + { 0, 0, 255, 0 } +#define IMAQ_INIT_RGB_BLUE \ + { 255, 0, 0, 0 } +#define IMAQ_INIT_RGB_GREEN \ + { 0, 255, 0, 0 } +#define IMAQ_INIT_RGB_YELLOW \ + { 0, 255, 255, 0 } +#define IMAQ_INIT_RGB_WHITE \ + { 255, 255, 255, 0 } +#define IMAQ_INIT_RGB_BLACK \ + { 0, 0, 0, 0 } +#define IMAQ_USE_DEFAULT_QUALITY -1 +#define IMAQ_ALL_SAMPLES -1 +#define IMAQ_ALL_OBJECTS -1 +#define IMAQ_ALL_CHARACTERS -1 + +//============================================================================ +// Predefined Valid Characters +//============================================================================ +#define IMAQ_ANY_CHARACTER "" // Any Character +#define IMAQ_ALPHABETIC \ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" // Alphabetic +#define IMAQ_ALPHANUMERIC \ + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" // Alphanumeric +#define IMAQ_UPPERCASE_LETTERS "ABCDEFGHIJKLMNOPQRSTUVWXYZ" // Uppercase + // Letters +#define IMAQ_LOWERCASE_LETTERS "abcdefghijklmnopqrstuvwxyz" // Lowercase + // Letters +#define IMAQ_DECIMAL_DIGITS "0123456789" // Decimal Digits +#define IMAQ_HEXADECIMAL_DIGITS "0123456789ABCDEFabcdef" // Hexadecimal Digits +#define IMAQ_PATTERN \ + "\xFF" // Pattern (A single character string with the character value set to + // 255) +#define IMAQ_FORCE_SPACE " " // Force Space + +//============================================================================ +// Macros +//============================================================================ +#define IMAQ_NO_RECT imaqMakeRect(0, 0, 0x7FFFFFFF, 0x7FFFFFFF) +#define IMAQ_NO_ROTATED_RECT \ + imaqMakeRotatedRect(0, 0, 0x7FFFFFFF, 0x7FFFFFFF, 0) +#define IMAQ_NO_POINT imaqMakePoint(-1, -1) +#define IMAQ_NO_POINT_FLOAT imaqMakePointFloat(-1.0, -1.0) +#define IMAQ_NO_OFFSET imaqMakePointFloat(0.0, 0.0) + +//============================================================================ +// When in Borland, some functions must be mapped to different names. +// This accomplishes said task. +//============================================================================ +#if defined(__BORLANDC__) || (defined(_CVI_) && defined(_NI_BC_)) +#define imaqMakePoint imaqMakePoint_BC +#define imaqMakePointFloat imaqMakePointFloat_BC +#endif + +//============================================================================ +// When in Watcom, some functions must be mapped to different names. +// This accomplishes said task. +//============================================================================ +#if defined(__WATCOMC__) || (defined(_CVI_) && defined(_NI_WC_)) +#define imaqMakePoint imaqMakePoint_BC +#define imaqMakePointFloat imaqMakePointFloat_BC +#endif + +//============================================================================ +// If using Visual C++, force startup & shutdown code to run. +//============================================================================ +#if defined(_MSC_VER) && !defined(_CVI_) && !defined(__BORLANDC__) +#pragma comment(linker, "/INCLUDE:_nivision_startup_shutdown") +#pragma comment(linker, "/DEFAULTLIB:nivision.lib") +#endif + +//============================================================================ +// Error Codes +//============================================================================ +#define ERR_SUCCESS 0 // No error. +#define ERR_SYSTEM_ERROR -1074396160 // System error. +#define ERR_OUT_OF_MEMORY \ + -1074396159 // Not enough memory for requested operation. +#define ERR_MEMORY_ERROR -1074396158 // Memory error. +#define ERR_UNREGISTERED -1074396157 // Unlicensed copy of NI Vision. +#define ERR_NEED_FULL_VERSION \ + -1074396156 // The function requires an NI Vision 5.0 Advanced license. +#define ERR_UNINIT -1074396155 // NI Vision did not initialize properly. +#define ERR_IMAGE_TOO_SMALL \ + -1074396154 // The image is not large enough for the operation. +#define ERR_BARCODE_CODABAR \ + -1074396153 // The barcode is not a valid Codabar barcode. +#define ERR_BARCODE_CODE39 \ + -1074396152 // The barcode is not a valid Code 3 of 9 barcode. +#define ERR_BARCODE_CODE93 \ + -1074396151 // The barcode is not a valid Code93 barcode. +#define ERR_BARCODE_CODE128 \ + -1074396150 // The barcode is not a valid Code128 barcode. +#define ERR_BARCODE_EAN8 \ + -1074396149 // The barcode is not a valid EAN8 barcode. +#define ERR_BARCODE_EAN13 \ + -1074396148 // The barcode is not a valid EAN13 barcode. +#define ERR_BARCODE_I25 \ + -1074396147 // The barcode is not a valid Interleaved 2 of 5 barcode. +#define ERR_BARCODE_MSI -1074396146 // The barcode is not a valid MSI barcode. +#define ERR_BARCODE_UPCA \ + -1074396145 // The barcode is not a valid UPCA barcode. +#define ERR_BARCODE_CODE93_SHIFT \ + -1074396144 // The Code93 barcode contains invalid shift encoding. +#define ERR_BARCODE_TYPE -1074396143 // The barcode type is invalid. +#define ERR_BARCODE_INVALID \ + -1074396142 // The image does not represent a valid linear barcode. +#define ERR_BARCODE_CODE128_FNC \ + -1074396141 // The FNC value in the Code128 barcode is not located before the + // first data value. +#define ERR_BARCODE_CODE128_SET \ + -1074396140 // The starting code set in the Code128 barcode is not valid. +#define ERR_ROLLBACK_RESOURCE_OUT_OF_MEMORY \ + -1074396139 // Not enough reserved memory in the timed environment for the + // requested operation. +#define ERR_ROLLBACK_NOT_SUPPORTED \ + -1074396138 // The function is not supported when a time limit is active. +#define ERR_DIRECTX_DLL_NOT_FOUND \ + -1074396137 // Quartz.dll not found. Install DirectX 8.1 or later. +#define ERR_DIRECTX_INVALID_FILTER_QUALITY \ + -1074396136 // The filter quality you provided is invalid. Valid quality + // values range from -1 to 1000. +#define ERR_INVALID_BUTTON_LABEL -1074396135 // Invalid button label. +#define ERR_THREAD_INITIALIZING \ + -1074396134 // Could not execute the function in the separate thread because + // the thread has not completed initialization. +#define ERR_THREAD_COULD_NOT_INITIALIZE \ + -1074396133 // Could not execute the function in the separate thread because + // the thread could not initialize. +#define ERR_MASK_NOT_TEMPLATE_SIZE \ + -1074396132 // The mask must be the same size as the template. +#define ERR_NOT_RECT_OR_ROTATED_RECT \ + -1074396130 // The ROI must only have either a single Rectangle contour or a + // single Rotated Rectangle contour. +#define ERR_ROLLBACK_UNBOUNDED_INTERFACE \ + -1074396129 // During timed execution, you must use the preallocated version + // of this operation. +#define ERR_ROLLBACK_RESOURCE_CONFLICT_3 \ + -1074396128 // An image being modified by one process cannot be requested by + // another process while a time limit is active. +#define ERR_ROLLBACK_RESOURCE_CONFLICT_2 \ + -1074396127 // An image with pattern matching, calibration, or overlay + // information cannot be manipulated while a time limit is + // active. +#define ERR_ROLLBACK_RESOURCE_CONFLICT_1 \ + -1074396126 // An image created before a time limit is started cannot be + // resized while a time limit is active. +#define ERR_INVALID_CONTRAST_THRESHOLD \ + -1074396125 // Invalid contrast threshold. The threshold value must be + // greater than 0. +#define ERR_INVALID_CALIBRATION_ROI_MODE \ + -1074396124 // NI Vision does not support the calibration ROI mode you + // supplied. +#define ERR_INVALID_CALIBRATION_MODE \ + -1074396123 // NI Vision does not support the calibration mode you supplied. +#define ERR_DRAWTEXT_COLOR_MUST_BE_GRAYSCALE \ + -1074396122 // Set the foreground and background text colors to grayscale to + // draw on a U8 image. +#define ERR_SATURATION_THRESHOLD_OUT_OF_RANGE \ + -1074396121 // The value of the saturation threshold must be from 0 to 255. +#define ERR_NOT_IMAGE -1074396120 // Not an image. +#define ERR_CUSTOMDATA_INVALID_KEY \ + -1074396119 // They custom data key you supplied is invalid. The only valid + // character values are decimal 32-126 and 161-255. There must + // also be no repeated, leading, or trailing spaces. +#define ERR_INVALID_STEP_SIZE \ + -1074396118 // Step size must be greater than zero and less than Image size +#define ERR_MATRIX_SIZE \ + -1074396117 // Invalid matrix size in the structuring element. +#define ERR_CALIBRATION_INSF_POINTS \ + -1074396116 // Insufficient number of calibration feature points. +#define ERR_CALIBRATION_IMAGE_CORRECTED \ + -1074396115 // The operation is invalid in a corrected image. +#define ERR_CALIBRATION_INVALID_ROI \ + -1074396114 // The ROI contains an invalid contour type or is not contained + // in the ROI learned for calibration. +#define ERR_CALIBRATION_IMAGE_UNCALIBRATED \ + -1074396113 // The source/input image has not been calibrated. +#define ERR_INCOMP_MATRIX_SIZE \ + -1074396112 // The number of pixel and real-world coordinates must be equal. +#define ERR_CALIBRATION_FAILED_TO_FIND_GRID \ + -1074396111 // Unable to automatically detect grid because the image is too + // distorted. +#define ERR_CALIBRATION_INFO_VERSION \ + -1074396110 // Invalid calibration information version. +#define ERR_CALIBRATION_INVALID_SCALING_FACTOR \ + -1074396109 // Invalid calibration scaling factor. +#define ERR_CALIBRATION_ERRORMAP \ + -1074396108 // The calibration error map cannot be computed. +#define ERR_CALIBRATION_INFO_1 \ + -1074396107 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_2 \ + -1074396106 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_3 \ + -1074396105 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_4 \ + -1074396104 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_5 \ + -1074396103 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_6 \ + -1074396102 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_MICRO_PLANE \ + -1074396101 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_PERSPECTIVE_PROJECTION \ + -1074396100 // Invalid calibration template image. +#define ERR_CALIBRATION_INFO_SIMPLE_TRANSFORM \ + -1074396099 // Invalid calibration template image. +#define ERR_RESERVED_MUST_BE_NULL \ + -1074396098 // You must pass NULL for the reserved parameter. +#define ERR_INVALID_PARTICLE_PARAMETER_VALUE \ + -1074396097 // You entered an invalid selection in the particle parameter. +#define ERR_NOT_AN_OBJECT -1074396096 // Not an object. +#define ERR_CALIBRATION_DUPLICATE_REFERENCE_POINT \ + -1074396095 // The reference points passed are inconsistent. At least two + // similar pixel coordinates correspond to different real-world + // coordinates. +#define ERR_ROLLBACK_RESOURCE_CANNOT_UNLOCK \ + -1074396094 // A resource conflict occurred in the timed environment. Two + // processes cannot manage the same resource and be time bounded. +#define ERR_ROLLBACK_RESOURCE_LOCKED \ + -1074396093 // A resource conflict occurred in the timed environment. Two + // processes cannot access the same resource and be time bounded. +#define ERR_ROLLBACK_RESOURCE_NON_EMPTY_INITIALIZE \ + -1074396092 // Multiple timed environments are not supported. +#define ERR_ROLLBACK_RESOURCE_UNINITIALIZED_ENABLE \ + -1074396091 // A time limit cannot be started until the timed environment is + // initialized. +#define ERR_ROLLBACK_RESOURCE_ENABLED \ + -1074396090 // Multiple timed environments are not supported. +#define ERR_ROLLBACK_RESOURCE_REINITIALIZE \ + -1074396089 // The timed environment is already initialized. +#define ERR_ROLLBACK_RESIZE \ + -1074396088 // The results of the operation exceeded the size limits on the + // output data arrays. +#define ERR_ROLLBACK_STOP_TIMER \ + -1074396087 // No time limit is available to stop. +#define ERR_ROLLBACK_START_TIMER -1074396086 // A time limit could not be set. +#define ERR_ROLLBACK_INIT_TIMER \ + -1074396085 // The timed environment could not be initialized. +#define ERR_ROLLBACK_DELETE_TIMER \ + -1074396084 // No initialized timed environment is available to close. +#define ERR_ROLLBACK_TIMEOUT -1074396083 // The time limit has expired. +#define ERR_PALETTE_NOT_SUPPORTED \ + -1074396082 // Only 8-bit images support the use of palettes. Either do not + // use a palette, or convert your image to an 8-bit image before + // using a palette. +#define ERR_BAD_PASSWORD -1074396081 // Incorrect password. +#define ERR_INVALID_IMAGE_TYPE -1074396080 // Invalid image type. +#define ERR_INVALID_METAFILE_HANDLE -1074396079 // Invalid metafile handle. +#define ERR_INCOMP_TYPE -1074396077 // Incompatible image type. +#define ERR_COORD_SYS_FIRST_AXIS \ + -1074396076 // Unable to fit a line for the primary axis. +#define ERR_COORD_SYS_SECOND_AXIS \ + -1074396075 // Unable to fit a line for the secondary axis. +#define ERR_INCOMP_SIZE -1074396074 // Incompatible image size. +#define ERR_MASK_OUTSIDE_IMAGE \ + -1074396073 // When the mask's offset was applied, the mask was entirely + // outside of the image. +#define ERR_INVALID_BORDER -1074396072 // Invalid image border. +#define ERR_INVALID_SCAN_DIRECTION -1074396071 // Invalid scan direction. +#define ERR_INVALID_FUNCTION -1074396070 // Unsupported function. +#define ERR_INVALID_COLOR_MODE \ + -1074396069 // NI Vision does not support the color mode you specified. +#define ERR_INVALID_ACTION \ + -1074396068 // The function does not support the requested action. +#define ERR_IMAGES_NOT_DIFF \ + -1074396067 // The source image and destination image must be different. +#define ERR_INVALID_POINTSYMBOL -1074396066 // Invalid point symbol. +#define ERR_CANT_RESIZE_EXTERNAL \ + -1074396065 // Cannot resize an image in an acquisition buffer. +#define ERR_EXTERNAL_NOT_SUPPORTED \ + -1074396064 // This operation is not supported for images in an acquisition + // buffer. +#define ERR_EXTERNAL_ALIGNMENT \ + -1074396063 // The external buffer must be aligned on a 4-byte boundary. The + // line width and border pixels must be 4-byte aligned, as well. +#define ERR_INVALID_TOLERANCE \ + -1074396062 // The tolerance parameter must be greater than or equal to 0. +#define ERR_INVALID_WINDOW_SIZE \ + -1074396061 // The size of each dimension of the window must be greater than + // 2 and less than or equal to the size of the image in the + // corresponding dimension. +#define ERR_JPEG2000_LOSSLESS_WITH_FLOATING_POINT \ + -1074396060 // Lossless compression cannot be used with the floating point + // wavelet transform mode. Either set the wavelet transform mode + // to integer, or use lossy compression. +#define ERR_INVALID_MAX_ITERATIONS \ + -1074396059 // Invalid maximum number of iterations. Maximum number of + // iterations must be greater than zero. +#define ERR_INVALID_ROTATION_MODE -1074396058 // Invalid rotation mode. +#define ERR_INVALID_SEARCH_VECTOR_WIDTH \ + -1074396057 // Invalid search vector width. The width must be an odd number + // greater than zero. +#define ERR_INVALID_MATRIX_MIRROR_MODE \ + -1074396056 // Invalid matrix mirror mode. +#define ERR_INVALID_ASPECT_RATIO \ + -1074396055 // Invalid aspect ratio. Valid aspect ratios must be greater than + // or equal to zero. +#define ERR_INVALID_CELL_FILL_TYPE -1074396054 // Invalid cell fill type. +#define ERR_INVALID_BORDER_INTEGRITY \ + -1074396053 // Invalid border integrity. Valid values range from 0 to 100. +#define ERR_INVALID_DEMODULATION_MODE -1074396052 // Invalid demodulation mode. +#define ERR_INVALID_CELL_FILTER_MODE -1074396051 // Invalid cell filter mode. +#define ERR_INVALID_ECC_TYPE -1074396050 // Invalid ECC type. +#define ERR_INVALID_MATRIX_POLARITY -1074396049 // Invalid matrix polarity. +#define ERR_INVALID_CELL_SAMPLE_SIZE -1074396048 // Invalid cell sample size. +#define ERR_INVALID_LINEAR_AVERAGE_MODE \ + -1074396047 // Invalid linear average mode. +#define ERR_INVALID_2D_BARCODE_CONTRAST_FOR_ROI \ + -1074396046 // When using a region of interest that is not a rectangle, you + // must specify the contrast mode of the barcode as either black + // on white or white on black. +#define ERR_INVALID_2D_BARCODE_SUBTYPE \ + -1074396045 // Invalid 2-D barcode Data Matrix subtype. +#define ERR_INVALID_2D_BARCODE_SHAPE -1074396044 // Invalid 2-D barcode shape. +#define ERR_INVALID_2D_BARCODE_CELL_SHAPE \ + -1074396043 // Invalid 2-D barcode cell shape. +#define ERR_INVALID_2D_BARCODE_CONTRAST \ + -1074396042 // Invalid 2-D barcode contrast. +#define ERR_INVALID_2D_BARCODE_TYPE -1074396041 // Invalid 2-D barcode type. +#define ERR_DRIVER -1074396040 // Cannot access NI-IMAQ driver. +#define ERR_IO_ERROR -1074396039 // I/O error. +#define ERR_FIND_COORDSYS_MORE_THAN_ONE_EDGE \ + -1074396038 // When searching for a coordinate system, the number of lines to + // fit must be 1. +#define ERR_TIMEOUT -1074396037 // Trigger timeout. +#define ERR_INVALID_SKELETONMODE \ + -1074396036 // The Skeleton mode you specified is invalid. +#define ERR_TEMPLATEIMAGE_NOCIRCLE \ + -1074396035 // The template image does not contain enough information for + // learning the aggressive search strategy. +#define ERR_TEMPLATEIMAGE_EDGEINFO \ + -1074396034 // The template image does not contain enough edge information + // for the sample size(s) requested. +#define ERR_TEMPLATEDESCRIPTOR_LEARNSETUPDATA \ + -1074396033 // Invalid template descriptor. +#define ERR_TEMPLATEDESCRIPTOR_ROTATION_SEARCHSTRATEGY \ + -1074396032 // The template descriptor does not contain data required for the + // requested search strategy in rotation-invariant matching. +#define ERR_INVALID_TETRAGON \ + -1074396031 // The input tetragon must have four points. The points are + // specified clockwise starting with the top left point. +#define ERR_TOO_MANY_CLASSIFICATION_SESSIONS \ + -1074396030 // There are too many classification sessions open. You must + // close a session before you can open another one. +#define ERR_TIME_BOUNDED_EXECUTION_NOT_SUPPORTED \ + -1074396028 // NI Vision no longer supports time-bounded execution. +#define ERR_INVALID_COLOR_RESOLUTION \ + -1074396027 // Invalid Color Resolution for the Color Classifier +#define ERR_INVALID_PROCESS_TYPE_FOR_EDGE_DETECTION \ + -1074396026 // Invalid process type for edge detection. +#define ERR_INVALID_ANGLE_RANGE_FOR_STRAIGHT_EDGE \ + -1074396025 // Angle range value should be equal to or greater than zero. +#define ERR_INVALID_MIN_COVERAGE_FOR_STRAIGHT_EDGE \ + -1074396024 // Minimum coverage value should be greater than zero. +#define ERR_INVALID_ANGLE_TOL_FOR_STRAIGHT_EDGE \ + -1074396023 // The angle tolerance should be equal to or greater than 0.001. +#define ERR_INVALID_SEARCH_MODE_FOR_STRAIGHT_EDGE \ + -1074396022 // Invalid search mode for detecting straight edges +#define ERR_INVALID_KERNEL_SIZE_FOR_EDGE_DETECTION \ + -1074396021 // Invalid kernel size for edge detection. The minimum kernel + // size is 3, the maximum kernel size is 1073741823 and the + // kernel size must be odd. +#define ERR_INVALID_GRADING_MODE -1074396020 // Invalid grading mode. +#define ERR_INVALID_THRESHOLD_PERCENTAGE \ + -1074396019 // Invalid threshold percentage. Valid values range from 0 to + // 100. +#define ERR_INVALID_EDGE_POLARITY_SEARCH_MODE \ + -1074396018 // Invalid edge polarity search mode. +#define ERR_OPENING_NEWER_AIM_GRADING_DATA \ + -1074396017 // The AIM grading data attached to the image you tried to open + // was created with a newer version of NI Vision. Upgrade to the + // latest version of NI Vision to read this file. +#define ERR_NO_VIDEO_DRIVER -1074396016 // No video driver is installed. +#define ERR_RPC_EXECUTE_IVB \ + -1074396015 // Unable to establish network connection with remote system. +#define ERR_INVALID_VIDEO_BLIT \ + -1074396014 // RT Video Out does not support displaying the supplied image + // type at the selected color depth. +#define ERR_INVALID_VIDEO_MODE -1074396013 // Invalid video mode. +#define ERR_RPC_EXECUTE \ + -1074396012 // Unable to display remote image on network connection. +#define ERR_RPC_BIND -1074396011 // Unable to establish network connection. +#define ERR_INVALID_FRAME_NUMBER -1074396010 // Invalid frame number. +#define ERR_DIRECTX \ + -1074396009 // An internal DirectX error has occurred. Try upgrading to the + // latest version of DirectX. +#define ERR_DIRECTX_NO_FILTER \ + -1074396008 // An appropriate DirectX filter to process this file could not + // be found. Install the filter that was used to create this + // AVI. Upgrading to the latest version of DirectX may correct + // this error. NI Vision requires DirectX 8.1 or higher. +#define ERR_DIRECTX_INCOMPATIBLE_COMPRESSION_FILTER \ + -1074396007 // Incompatible compression filter. +#define ERR_DIRECTX_UNKNOWN_COMPRESSION_FILTER \ + -1074396006 // Unknown compression filter. +#define ERR_INVALID_AVI_SESSION -1074396005 // Invalid AVI session. +#define ERR_DIRECTX_CERTIFICATION_FAILURE \ + -1074396004 // A software key is restricting the use of this compression + // filter. +#define ERR_AVI_DATA_EXCEEDS_BUFFER_SIZE \ + -1074396003 // The data for this frame exceeds the data buffer size specified + // when creating the AVI file. +#define ERR_INVALID_LINEGAUGEMETHOD -1074396002 // Invalid line gauge method. +#define ERR_TOO_MANY_AVI_SESSIONS \ + -1074396001 // There are too many AVI sessions open. You must close a + // session before you can open another one. +#define ERR_FILE_FILE_HEADER -1074396000 // Invalid file header. +#define ERR_FILE_FILE_TYPE -1074395999 // Invalid file type. +#define ERR_FILE_COLOR_TABLE -1074395998 // Invalid color table. +#define ERR_FILE_ARGERR -1074395997 // Invalid parameter. +#define ERR_FILE_OPEN -1074395996 // File is already open for writing. +#define ERR_FILE_NOT_FOUND -1074395995 // File not found. +#define ERR_FILE_TOO_MANY_OPEN -1074395994 // Too many files open. +#define ERR_FILE_IO_ERR -1074395993 // File I/O error. +#define ERR_FILE_PERMISSION -1074395992 // File access denied. +#define ERR_FILE_INVALID_TYPE \ + -1074395991 // NI Vision does not support the file type you specified. +#define ERR_FILE_GET_INFO -1074395990 // Could not read Vision info from file. +#define ERR_FILE_READ -1074395989 // Unable to read data. +#define ERR_FILE_WRITE -1074395988 // Unable to write data. +#define ERR_FILE_EOF -1074395987 // Premature end of file. +#define ERR_FILE_FORMAT -1074395986 // Invalid file format. +#define ERR_FILE_OPERATION -1074395985 // Invalid file operation. +#define ERR_FILE_INVALID_DATA_TYPE \ + -1074395984 // NI Vision does not support the file data type you specified. +#define ERR_FILE_NO_SPACE -1074395983 // Disk full. +#define ERR_INVALID_FRAMES_PER_SECOND \ + -1074395982 // The frames per second in an AVI must be greater than zero. +#define ERR_INSUFFICIENT_BUFFER_SIZE \ + -1074395981 // The buffer that was passed in is not big enough to hold all of + // the data. +#define ERR_COM_INITIALIZE -1074395980 // Error initializing COM. +#define ERR_INVALID_PARTICLE_INFO \ + -1074395979 // The image has invalid particle information. Call + // imaqCountParticles on the image to create particle + // information. +#define ERR_INVALID_PARTICLE_NUMBER -1074395978 // Invalid particle number. +#define ERR_AVI_VERSION \ + -1074395977 // The AVI file was created in a newer version of NI Vision. + // Upgrade to the latest version of NI Vision to read this AVI + // file. +#define ERR_NUMBER_OF_PALETTE_COLORS \ + -1074395976 // The color palette must have exactly 0 or 256 entries. +#define ERR_AVI_TIMEOUT \ + -1074395975 // DirectX has timed out reading or writing the AVI file. When + // closing an AVI file, try adding an additional delay. When + // reading an AVI file, try reducing CPU and disk load. +#define ERR_UNSUPPORTED_JPEG2000_COLORSPACE_METHOD \ + -1074395974 // NI Vision does not support reading JPEG2000 files with this + // colorspace method. +#define ERR_JPEG2000_UNSUPPORTED_MULTIPLE_LAYERS \ + -1074395973 // NI Vision does not support reading JPEG2000 files with more + // than one layer. +#define ERR_DIRECTX_ENUMERATE_FILTERS \ + -1074395972 // DirectX is unable to enumerate the compression filters. This + // is caused by a third-party compression filter that is either + // improperly installed or is preventing itself from being + // enumerated. Remove any recently installed compression filters + // and try again. +#define ERR_INVALID_OFFSET \ + -1074395971 // The offset you specified must be size 2. +#define ERR_INIT -1074395960 // Initialization error. +#define ERR_CREATE_WINDOW -1074395959 // Unable to create window. +#define ERR_WINDOW_ID -1074395958 // Invalid window ID. +#define ERR_ARRAY_SIZE_MISMATCH \ + -1074395957 // The array sizes are not compatible. +#define ERR_INVALID_QUALITY \ + -1074395956 // The quality you provided is invalid. Valid quality values + // range from -1 to 1000. +#define ERR_INVALID_MAX_WAVELET_TRANSFORM_LEVEL \ + -1074395955 // Invalid maximum wavelet transform level. Valid values range + // from 0 to 255. +#define ERR_INVALID_QUANTIZATION_STEP_SIZE \ + -1074395954 // The quantization step size must be greater than or equal to 0. +#define ERR_INVALID_WAVELET_TRANSFORM_MODE \ + -1074395953 // Invalid wavelet transform mode. +#define ERR_ROI_NOT_POINT \ + -1074395952 // The ROI must only have a single Point contour. +#define ERR_ROI_NOT_POINTS \ + -1074395951 // The ROI must only have Point contours. +#define ERR_ROI_NOT_LINE \ + -1074395950 // The ROI must only have a single Line contour. +#define ERR_ROI_NOT_ANNULUS \ + -1074395949 // The ROI must only have a single Annulus contour. +#define ERR_INVALID_MEASURE_PARTICLES_CALIBRATION_MODE \ + -1074395948 // Invalid measure particles calibration mode. +#define ERR_INVALID_PARTICLE_CLASSIFIER_THRESHOLD_TYPE \ + -1074395947 // Invalid particle classifier threshold type. +#define ERR_INVALID_DISTANCE -1074395946 // Invalid Color Segmentation Distance +#define ERR_INVALID_PARTICLE_AREA \ + -1074395945 // Invalid Color Segmenation Particle Area +#define ERR_CLASS_NAME_NOT_FOUND \ + -1074395944 // Required Class name is not found in trained labels/Class names +#define ERR_NUMBER_LABEL_LIMIT_EXCEEDED \ + -1074395943 // Number of Labels exceeded limit of label Image type +#define ERR_INVALID_DISTANCE_LEVEL \ + -1074395942 // Invalid Color Segmentation distance level +#define ERR_INVALID_SVM_TYPE -1074395941 // Invalid SVM model type +#define ERR_INVALID_SVM_KERNEL -1074395940 // Invalid SVM kernel type +#define ERR_NO_SUPPORT_VECTOR_FOUND \ + -1074395939 // No Support Vector is found at SVM training +#define ERR_COST_LABEL_NOT_FOUND \ + -1074395938 // Label name is not found in added samples +#define ERR_EXCEEDED_SVM_MAX_ITERATION \ + -1074395937 // SVM training exceeded maximim Iteration limit +#define ERR_INVALID_SVM_PARAMETER -1074395936 // Invalid SVM Parameter +#define ERR_INVALID_IDENTIFICATION_SCORE \ + -1074395935 // Invalid Identification score. Must be between 0-1000. +#define ERR_INVALID_TEXTURE_FEATURE \ + -1074395934 // Requested for invalid texture feature +#define ERR_INVALID_COOCCURRENCE_LEVEL \ + -1074395933 // The coOccurrence Level must lie between 1 and the maximum + // pixel value of an image (255 for U8 image) +#define ERR_INVALID_WAVELET_SUBBAND \ + -1074395932 // Request for invalid wavelet subBand +#define ERR_INVALID_FINAL_STEP_SIZE \ + -1074395931 // The final step size must be lesser than the initial step size +#define ERR_INVALID_ENERGY \ + -1074395930 // Minimum Energy should lie between 0 and 100 +#define ERR_INVALID_TEXTURE_LABEL \ + -1074395929 // The classification label must be texture or defect for texture + // defect classifier +#define ERR_INVALID_WAVELET_TYPE -1074395928 // The wavelet type is invalid +#define ERR_SAME_WAVELET_BANDS_SELECTED \ + -1074395927 // Same Wavelet band is selected multiple times +#define ERR_IMAGE_SIZE_MISMATCH \ + -1074395926 // The two input image sizes are different +#define ERR_NUMBER_CLASS -1074395920 // Invalid number of classes. +#define ERR_INVALID_LUCAS_KANADE_WINDOW_SIZE \ + -1074395888 // Both dimensions of the window size should be odd, greater than + // 2 and less than 16. +#define ERR_INVALID_MATRIX_TYPE \ + -1074395887 // The type of matrix supplied to the function is not supported. +#define ERR_INVALID_OPTICAL_FLOW_TERMINATION_CRITERIA_TYPE \ + -1074395886 // An invalid termination criteria was specified for the optical + // flow computation. +#define ERR_LKP_NULL_PYRAMID \ + -1074395885 // The pyramid levels where not properly allocated. +#define ERR_INVALID_PYRAMID_LEVEL \ + -1074395884 // The pyramid level specified cannot be negative +#define ERR_INVALID_LKP_KERNEL \ + -1074395883 // The kernel must be symmetric with non-zero coefficients and + // of odd size +#define ERR_INVALID_HORN_SCHUNCK_LAMBDA \ + -1074395882 // Invalid smoothing parameter in Horn Schunck operation. +#define ERR_INVALID_HORN_SCHUNCK_TYPE \ + -1074395881 // Invalid stopping criteria type for Horn Schunck optical flow. +#define ERR_PARTICLE -1074395880 // Invalid particle. +#define ERR_BAD_MEASURE -1074395879 // Invalid measure number. +#define ERR_PROP_NODE_WRITE_NOT_SUPPORTED \ + -1074395878 // The Image Display control does not support writing this + // property node. +#define ERR_COLORMODE_REQUIRES_CHANGECOLORSPACE2 \ + -1074395877 // The specified color mode requires the use of + // imaqChangeColorSpace2. +#define ERR_UNSUPPORTED_COLOR_MODE \ + -1074395876 // This function does not currently support the color mode you + // specified. +#define ERR_BARCODE_PHARMACODE \ + -1074395875 // The barcode is not a valid Pharmacode symbol +#define ERR_BAD_INDEX -1074395840 // Invalid handle table index. +#define ERR_INVALID_COMPRESSION_RATIO \ + -1074395837 // The compression ratio must be greater than or equal to 1. +#define ERR_TOO_MANY_CONTOURS \ + -1074395801 // The ROI contains too many contours. +#define ERR_PROTECTION -1074395800 // Protection error. +#define ERR_INTERNAL -1074395799 // Internal error. +#define ERR_INVALID_CUSTOM_SAMPLE \ + -1074395798 // The size of the feature vector in the custom sample must match + // the size of those you have already added. +#define ERR_INVALID_CLASSIFIER_SESSION \ + -1074395797 // Not a valid classifier session. +#define ERR_INVALID_KNN_METHOD \ + -1074395796 // You requested an invalid Nearest Neighbor classifier method. +#define ERR_K_TOO_LOW -1074395795 // The k parameter must be greater than two. +#define ERR_K_TOO_HIGH \ + -1074395794 // The k parameter must be <= the number of samples in each + // class. +#define ERR_INVALID_OPERATION_ON_COMPACT_SESSION_ATTEMPTED \ + -1074395793 // This classifier session is compact. Only the Classify and + // Dispose functions may be called on a compact classifier + // session. +#define ERR_CLASSIFIER_SESSION_NOT_TRAINED \ + -1074395792 // This classifier session is not trained. You may only call this + // function on a trained classifier session. +#define ERR_CLASSIFIER_INVALID_SESSION_TYPE \ + -1074395791 // This classifier function cannot be called on this type of + // classifier session. +#define ERR_INVALID_DISTANCE_METRIC \ + -1074395790 // You requested an invalid distance metric. +#define ERR_OPENING_NEWER_CLASSIFIER_SESSION \ + -1074395789 // The classifier session you tried to open was created with a + // newer version of NI Vision. Upgrade to the latest version of + // NI Vision to read this file. +#define ERR_NO_SAMPLES \ + -1074395788 // This operation cannot be performed because you have not added + // any samples. +#define ERR_INVALID_CLASSIFIER_TYPE \ + -1074395787 // You requested an invalid classifier type. +#define ERR_INVALID_PARTICLE_OPTIONS \ + -1074395786 // The sum of Scale Dependence and Symmetry Dependence must be + // less than 1000. +#define ERR_NO_PARTICLE -1074395785 // The image yielded no particles. +#define ERR_INVALID_LIMITS \ + -1074395784 // The limits you supplied are not valid. +#define ERR_BAD_SAMPLE_INDEX \ + -1074395783 // The Sample Index fell outside the range of Samples. +#define ERR_DESCRIPTION_TOO_LONG \ + -1074395782 // The description must be <= 255 characters. +#define ERR_CLASSIFIER_INVALID_ENGINE_TYPE \ + -1074395781 // The engine for this classifier session does not support this + // operation. +#define ERR_INVALID_PARTICLE_TYPE \ + -1074395780 // You requested an invalid particle type. +#define ERR_CANNOT_COMPACT_UNTRAINED \ + -1074395779 // You may only save a session in compact form if it is trained. +#define ERR_INVALID_KERNEL_SIZE \ + -1074395778 // The Kernel size must be smaller than the image size. +#define ERR_INCOMPATIBLE_CLASSIFIER_TYPES \ + -1074395777 // The session you read from file must be the same type as the + // session you passed in. +#define ERR_INVALID_USE_OF_COMPACT_SESSION_FILE \ + -1074395776 // You can not use a compact classification file with read + // options other than Read All. +#define ERR_ROI_HAS_OPEN_CONTOURS \ + -1074395775 // The ROI you passed in may only contain closed contours. +#define ERR_NO_LABEL -1074395774 // You must pass in a label. +#define ERR_NO_DEST_IMAGE -1074395773 // You must provide a destination image. +#define ERR_INVALID_REGISTRATION_METHOD \ + -1074395772 // You provided an invalid registration method. +#define ERR_OPENING_NEWER_INSPECTION_TEMPLATE \ + -1074395771 // The golden template you tried to open was created with a newer + // version of NI Vision. Upgrade to the latest version of NI + // Vision to read this file. +#define ERR_INVALID_INSPECTION_TEMPLATE -1074395770 // Invalid golden template. +#define ERR_INVALID_EDGE_THICKNESS \ + -1074395769 // Edge Thickness to Ignore must be greater than zero. +#define ERR_INVALID_SCALE -1074395768 // Scale must be greater than zero. +#define ERR_INVALID_ALIGNMENT \ + -1074395767 // The supplied scale is invalid for your template. +#define ERR_DEPRECATED_FUNCTION \ + -1074395766 // This backwards-compatibility function can not be used with + // this session. Use newer, supported functions instead. +#define ERR_INVALID_NORMALIZATION_METHOD \ + -1074395763 // You must provide a valid normalization method. +#define ERR_INVALID_NIBLACK_DEVIATION_FACTOR \ + -1074395762 // The deviation factor for Niblack local threshold must be + // between 0 and 1. +#define ERR_BOARD_NOT_FOUND -1074395760 // Board not found. +#define ERR_BOARD_NOT_OPEN -1074395758 // Board not opened. +#define ERR_DLL_NOT_FOUND -1074395757 // DLL not found. +#define ERR_DLL_FUNCTION_NOT_FOUND -1074395756 // DLL function not found. +#define ERR_TRIG_TIMEOUT -1074395754 // Trigger timeout. +#define ERR_CONTOUR_INVALID_REFINEMENTS \ + -1074395746 // Invalid number specified for maximum contour refinements. +#define ERR_TOO_MANY_CURVES \ + -1074395745 // Too many curves extracted from image. Raise the edge threshold + // or reduce the ROI. +#define ERR_CONTOUR_INVALID_KERNEL_FOR_SMOOTHING \ + -1074395744 // Invalid kernel for contour smoothing. Zero indicates no + // smoothing, otherwise value must be odd. +#define ERR_CONTOUR_LINE_INVALID \ + -1074395743 // The contour line fit is invalid. Line segment start and stop + // must differ. +#define ERR_CONTOUR_TEMPLATE_IMAGE_INVALID \ + -1074395742 // The template image must be trained with IMAQ Learn Contour + // Pattern or be the same size as the target image. +#define ERR_CONTOUR_GPM_FAIL \ + -1074395741 // Matching failed to align the template and target contours. +#define ERR_CONTOUR_OPENING_NEWER_VERSION \ + -1074395740 // The contour you tried to open was created with a newer version + // of NI Vision. Upgrade to the latest version of NI Vision to + // read this file. +#define ERR_CONTOUR_CONNECT_DUPLICATE \ + -1074395739 // Only one range is allowed per curve connection constraint + // type. +#define ERR_CONTOUR_CONNECT_TYPE \ + -1074395738 // Invalid contour connection constraint type. +#define ERR_CONTOUR_MATCH_STR_NOT_APPLICABLE \ + -1074395737 // In order to use contour matching, you must provide a template + // image that has been trained with IMAQ Learn Contour Pattern +#define ERR_CONTOUR_CURVATURE_KERNEL \ + -1074395736 // Invalid kernel width for curvature calculation. Must be an odd + // value greater than 1. +#define ERR_CONTOUR_EXTRACT_SELECTION \ + -1074395735 // Invalid Contour Selection method for contour extraction. +#define ERR_CONTOUR_EXTRACT_DIRECTION \ + -1074395734 // Invalid Search Direction for contour extraction. +#define ERR_CONTOUR_EXTRACT_ROI \ + -1074395733 // Invalid ROI for contour extraction. The ROI must contain an + // annulus, rectangle or rotated rectangle. +#define ERR_CONTOUR_NO_CURVES -1074395732 // No curves were found in the image. +#define ERR_CONTOUR_COMPARE_KERNEL \ + -1074395731 // Invalid Smoothing Kernel width for contour comparison. Must be + // zero or an odd positive integer. +#define ERR_CONTOUR_COMPARE_SINGLE_IMAGE \ + -1074395730 // If no template image is provided, the target image must + // contain both a contour with extracted points and a fitted + // equation. +#define ERR_CONTOUR_INVALID -1074395729 // Invalid contour image. +#define ERR_INVALID_2D_BARCODE_SEARCH_MODE \ + -1074395728 // NI Vision does not support the search mode you provided. +#define ERR_UNSUPPORTED_2D_BARCODE_SEARCH_MODE \ + -1074395727 // NI Vision does not support the search mode you provided for + // the type of 2D barcode for which you are searching. +#define ERR_MATCHFACTOR_OBSOLETE \ + -1074395726 // matchFactor has been obsoleted. Instead, set the + // initialMatchListLength and matchListReductionFactor in the + // MatchPatternAdvancedOptions structure. +#define ERR_DATA_VERSION \ + -1074395725 // The data was stored with a newer version of NI Vision. Upgrade + // to the latest version of NI Vision to read this data. +#define ERR_CUSTOMDATA_INVALID_SIZE \ + -1074395724 // The size you specified is out of the valid range. +#define ERR_CUSTOMDATA_KEY_NOT_FOUND \ + -1074395723 // The key you specified cannot be found in the image. +#define ERR_CLASSIFIER_CLASSIFY_IMAGE_WITH_CUSTOM_SESSION \ + -1074395722 // Custom classifier sessions only classify feature vectors. They + // do not support classifying images. +#define ERR_INVALID_BIT_DEPTH \ + -1074395721 // NI Vision does not support the bit depth you supplied for the + // image you supplied. +#define ERR_BAD_ROI -1074395720 // Invalid ROI. +#define ERR_BAD_ROI_BOX -1074395719 // Invalid ROI global rectangle. +#define ERR_LAB_VERSION \ + -1074395718 // The version of LabVIEW or BridgeVIEW you are running does not + // support this operation. +#define ERR_INVALID_RANGE -1074395717 // The range you supplied is invalid. +#define ERR_INVALID_SCALING_METHOD \ + -1074395716 // NI Vision does not support the scaling method you provided. +#define ERR_INVALID_CALIBRATION_UNIT \ + -1074395715 // NI Vision does not support the calibration unit you supplied. +#define ERR_INVALID_AXIS_ORIENTATION \ + -1074395714 // NI Vision does not support the axis orientation you supplied. +#define ERR_VALUE_NOT_IN_ENUM -1074395713 // Value not in enumeration. +#define ERR_WRONG_REGION_TYPE \ + -1074395712 // You selected a region that is not of the right type. +#define ERR_NOT_ENOUGH_REGIONS \ + -1074395711 // You specified a viewer that does not contain enough regions. +#define ERR_TOO_MANY_PARTICLES \ + -1074395710 // The image has too many particles for this process. +#define ERR_AVI_UNOPENED_SESSION \ + -1074395709 // The AVI session has not been opened. +#define ERR_AVI_READ_SESSION_REQUIRED \ + -1074395708 // The AVI session is a write session, but this operation + // requires a read session. +#define ERR_AVI_WRITE_SESSION_REQUIRED \ + -1074395707 // The AVI session is a read session, but this operation requires + // a write session. +#define ERR_AVI_SESSION_ALREADY_OPEN \ + -1074395706 // This AVI session is already open. You must close it before + // calling the Create or Open functions. +#define ERR_DATA_CORRUPTED \ + -1074395705 // The data is corrupted and cannot be read. +#define ERR_INVALID_COMPRESSION_TYPE -1074395704 // Invalid compression type. +#define ERR_INVALID_TYPE_OF_FLATTEN -1074395703 // Invalid type of flatten. +#define ERR_INVALID_LENGTH \ + -1074395702 // The length of the edge detection line must be greater than + // zero. +#define ERR_INVALID_MATRIX_SIZE_RANGE \ + -1074395701 // The maximum Data Matrix barcode size must be equal to or + // greater than the minimum Data Matrix barcode size. +#define ERR_REQUIRES_WIN2000_OR_NEWER \ + -1074395700 // The function requires the operating system to be Microsoft + // Windows 2000 or newer. +#define ERR_INVALID_CALIBRATION_METHOD \ + -1074395662 // Invalid calibration method requested +#define ERR_INVALID_OPERATION_ON_COMPACT_CALIBRATION_ATTEMPTED \ + -1074395661 // This calibration is compact. Re-Learning calibration and + // retrieving thumbnails are not possible with this calibration +#define ERR_INVALID_POLYNOMIAL_MODEL_K_COUNT \ + -1074395660 // Invalid number of K values +#define ERR_INVALID_DISTORTION_MODEL \ + -1074395659 // Invalid distortion model type +#define ERR_CAMERA_MODEL_NOT_AVAILABLE \ + -1074395658 // Camera Model is not learned +#define ERR_INVALID_THUMBNAIL_INDEX \ + -1074395657 // Supplied thumbnail index is invalid +#define ERR_SMOOTH_CONTOURS_MUST_BE_SAME \ + -1074395656 // You must specify the same value for the smooth contours + // advanced match option for all templates you want to match. +#define ERR_ENABLE_CALIBRATION_SUPPORT_MUST_BE_SAME \ + -1074395655 // You must specify the same value for the enable calibration + // support advanced match option for all templates you want to + // match. +#define ERR_GRADING_INFORMATION_NOT_FOUND \ + -1074395654 // The source image does not contain grading information. You + // must prepare the source image for grading when reading the + // Data Matrix, and you cannot change the contents of the source + // image between reading and grading the Data Matrix. +#define ERR_OPENING_NEWER_MULTIPLE_GEOMETRIC_TEMPLATE \ + -1074395653 // The multiple geometric matching template you tried to open was + // created with a newer version of NI Vision. Upgrade to the + // latest version of NI Vision to read this file. +#define ERR_OPENING_NEWER_GEOMETRIC_MATCHING_TEMPLATE \ + -1074395652 // The geometric matching template you tried to open was created + // with a newer version of NI Vision. Upgrade to the latest + // version of NI Vision to read this file. +#define ERR_EDGE_FILTER_SIZE_MUST_BE_SAME \ + -1074395651 // You must specify the same edge filter size for all the + // templates you want to match. +#define ERR_CURVE_EXTRACTION_MODE_MUST_BE_SAME \ + -1074395650 // You must specify the same curve extraction mode for all the + // templates you want to match. +#define ERR_INVALID_GEOMETRIC_FEATURE_TYPE \ + -1074395649 // The geometric feature type specified is invalid. +#define ERR_TEMPLATE_NOT_LEARNED \ + -1074395648 // You supplied a template that was not learned. +#define ERR_INVALID_MULTIPLE_GEOMETRIC_TEMPLATE \ + -1074395647 // Invalid multiple geometric template. +#define ERR_NO_TEMPLATE_TO_LEARN \ + -1074395646 // Need at least one template to learn. +#define ERR_INVALID_NUMBER_OF_LABELS \ + -1074395645 // You supplied an invalid number of labels. +#define ERR_LABEL_TOO_LONG -1074395644 // Labels must be <= 255 characters. +#define ERR_INVALID_NUMBER_OF_MATCH_OPTIONS \ + -1074395643 // You supplied an invalid number of match options. +#define ERR_LABEL_NOT_FOUND \ + -1074395642 // Cannot find a label that matches the one you specified. +#define ERR_DUPLICATE_LABEL -1074395641 // Duplicate labels are not allowed. +#define ERR_TOO_MANY_ZONES \ + -1074395640 // The number of zones found exceeded the capacity of the + // algorithm. +#define ERR_INVALID_HATCH_STYLE \ + -1074395639 // The hatch style for the window background is invalid. +#define ERR_INVALID_FILL_STYLE \ + -1074395638 // The fill style for the window background is invalid. +#define ERR_HARDWARE_DOESNT_SUPPORT_NONTEARING \ + -1074395637 // Your hardware is not supported by DirectX and cannot be put + // into NonTearing mode. +#define ERR_DIRECTX_NOT_FOUND \ + -1074395636 // DirectX is required for this feature. Please install the + // latest version.. +#define ERR_INVALID_SHAPE_DESCRIPTOR \ + -1074395635 // The passed shape descriptor is invalid. +#define ERR_INVALID_MAX_MATCH_OVERLAP \ + -1074395634 // Invalid max match overlap. Values must be between -1 and 100. +#define ERR_INVALID_MIN_MATCH_SEPARATION_SCALE \ + -1074395633 // Invalid minimum match separation scale. Values must be + // greater than or equal to -1. +#define ERR_INVALID_MIN_MATCH_SEPARATION_ANGLE \ + -1074395632 // Invalid minimum match separation angle. Values must be + // between -1 and 360. +#define ERR_INVALID_MIN_MATCH_SEPARATION_DISTANCE \ + -1074395631 // Invalid minimum match separation distance. Values must be + // greater than or equal to -1. +#define ERR_INVALID_MAXIMUM_FEATURES_LEARNED \ + -1074395630 // Invalid maximum number of features learn. Values must be + // integers greater than zero. +#define ERR_INVALID_MAXIMUM_PIXEL_DISTANCE_FROM_LINE \ + -1074395629 // Invalid maximum pixel distance from line. Values must be + // positive real numbers. +#define ERR_INVALID_GEOMETRIC_MATCHING_TEMPLATE \ + -1074395628 // Invalid geometric matching template image. +#define ERR_NOT_ENOUGH_TEMPLATE_FEATURES_1 \ + -1074395627 // The template does not contain enough features for geometric + // matching. +#define ERR_NOT_ENOUGH_TEMPLATE_FEATURES \ + -1074395626 // The template does not contain enough features for geometric + // matching. +#define ERR_INVALID_MATCH_CONSTRAINT_TYPE \ + -1074395625 // You specified an invalid value for the match constraint value + // of the range settings. +#define ERR_INVALID_OCCLUSION_RANGE \ + -1074395624 // Invalid occlusion range. Valid values for the bounds range + // from 0 to 100 and the upper bound must be greater than or + // equal to the lower bound. +#define ERR_INVALID_SCALE_RANGE \ + -1074395623 // Invalid scale range. Values for the lower bound must be a + // positive real numbers and the upper bound must be greater than + // or equal to the lower bound. +#define ERR_INVALID_MATCH_GEOMETRIC_PATTERN_SETUP_DATA \ + -1074395622 // Invalid match geometric pattern setup data. +#define ERR_INVALID_LEARN_GEOMETRIC_PATTERN_SETUP_DATA \ + -1074395621 // Invalid learn geometric pattern setup data. +#define ERR_INVALID_CURVE_EXTRACTION_MODE \ + -1074395620 // Invalid curve extraction mode. +#define ERR_TOO_MANY_OCCLUSION_RANGES \ + -1074395619 // You can specify only one occlusion range. +#define ERR_TOO_MANY_SCALE_RANGES \ + -1074395618 // You can specify only one scale range. +#define ERR_INVALID_NUMBER_OF_FEATURES_RANGE \ + -1074395617 // The minimum number of features must be less than or equal to + // the maximum number of features. +#define ERR_INVALID_EDGE_FILTER_SIZE -1074395616 // Invalid edge filter size. +#define ERR_INVALID_MINIMUM_FEATURE_STRENGTH \ + -1074395615 // Invalid minimum strength for features. Values must be positive + // real numbers. +#define ERR_INVALID_MINIMUM_FEATURE_ASPECT_RATIO \ + -1074395614 // Invalid aspect ratio for rectangular features. Values must be + // positive real numbers in the range 0.01 to 1.0. +#define ERR_INVALID_MINIMUM_FEATURE_LENGTH \ + -1074395613 // Invalid minimum length for linear features. Values must be + // integers greater than 0. +#define ERR_INVALID_MINIMUM_FEATURE_RADIUS \ + -1074395612 // Invalid minimum radius for circular features. Values must be + // integers greater than 0. +#define ERR_INVALID_MINIMUM_RECTANGLE_DIMENSION \ + -1074395611 // Invalid minimum rectangle dimension. Values must be integers + // greater than 0. +#define ERR_INVALID_INITIAL_MATCH_LIST_LENGTH \ + -1074395610 // Invalid initial match list length. Values must be integers + // greater than 5. +#define ERR_INVALID_SUBPIXEL_TOLERANCE \ + -1074395609 // Invalid subpixel tolerance. Values must be positive real + // numbers. +#define ERR_INVALID_SUBPIXEL_ITERATIONS \ + -1074395608 // Invalid number of subpixel iterations. Values must be integers + // greater 10. +#define ERR_INVALID_MAXIMUM_FEATURES_PER_MATCH \ + -1074395607 // Invalid maximum number of features used per match. Values must + // be integers greater than or equal to zero. +#define ERR_INVALID_MINIMUM_FEATURES_TO_MATCH \ + -1074395606 // Invalid minimum number of features used for matching. Values + // must be integers greater than zero. +#define ERR_INVALID_MAXIMUM_END_POINT_GAP \ + -1074395605 // Invalid maximum end point gap. Valid values range from 0 to + // 32767. +#define ERR_INVALID_COLUMN_STEP \ + -1074395604 // Invalid column step. Valid range is 1 to 255. +#define ERR_INVALID_ROW_STEP \ + -1074395603 // Invalid row step. Valid range is 1 to 255. +#define ERR_INVALID_MINIMUM_CURVE_LENGTH \ + -1074395602 // Invalid minimum length. Valid values must be greater than or + // equal to zero. +#define ERR_INVALID_EDGE_THRESHOLD \ + -1074395601 // Invalid edge threshold. Valid values range from 1 to 360. +#define ERR_INFO_NOT_FOUND \ + -1074395600 // You must provide information about the subimage within the + // browser. +#define ERR_NIOCR_INVALID_ACCEPTANCE_LEVEL \ + -1074395598 // The acceptance level is outside the valid range of 0 to 1000. +#define ERR_NIOCR_NOT_A_VALID_SESSION -1074395597 // Not a valid OCR session. +#define ERR_NIOCR_INVALID_CHARACTER_SIZE \ + -1074395596 // Invalid character size. Character size must be >= 1. +#define ERR_NIOCR_INVALID_THRESHOLD_MODE \ + -1074395595 // Invalid threshold mode value. +#define ERR_NIOCR_INVALID_SUBSTITUTION_CHARACTER \ + -1074395594 // Invalid substitution character. Valid substitution characters + // are ASCII values that range from 1 to 254. +#define ERR_NIOCR_INVALID_NUMBER_OF_BLOCKS \ + -1074395593 // Invalid number of blocks. Number of blocks must be >= 4 and <= + // 50. +#define ERR_NIOCR_INVALID_READ_STRATEGY -1074395592 // Invalid read strategy. +#define ERR_NIOCR_INVALID_CHARACTER_INDEX \ + -1074395591 // Invalid character index. +#define ERR_NIOCR_INVALID_NUMBER_OF_VALID_CHARACTER_POSITIONS \ + -1074395590 // Invalid number of character positions. Valid values range from + // 0 to 255. +#define ERR_NIOCR_INVALID_LOW_THRESHOLD_VALUE \ + -1074395589 // Invalid low threshold value. Valid threshold values range from + // 0 to 255. +#define ERR_NIOCR_INVALID_HIGH_THRESHOLD_VALUE \ + -1074395588 // Invalid high threshold value. Valid threshold values range + // from 0 to 255. +#define ERR_NIOCR_INVALID_THRESHOLD_RANGE \ + -1074395587 // The low threshold must be less than the high threshold. +#define ERR_NIOCR_INVALID_LOWER_THRESHOLD_LIMIT \ + -1074395586 // Invalid lower threshold limit. Valid lower threshold limits + // range from 0 to 255. +#define ERR_NIOCR_INVALID_UPPER_THRESHOLD_LIMIT \ + -1074395585 // Invalid upper threshold limit. Valid upper threshold limits + // range from 0 to 255. +#define ERR_NIOCR_INVALID_THRESHOLD_LIMITS \ + -1074395584 // The lower threshold limit must be less than the upper + // threshold limit. +#define ERR_NIOCR_INVALID_MIN_CHAR_SPACING \ + -1074395583 // Invalid minimum character spacing value. Character spacing + // must be >= 1 pixel. +#define ERR_NIOCR_INVALID_MAX_HORIZ_ELEMENT_SPACING \ + -1074395582 // Invalid maximum horizontal element spacing value. Maximum + // horizontal element spacing must be >= 0. +#define ERR_NIOCR_INVALID_MAX_VERT_ELEMENT_SPACING \ + -1074395581 // Invalid maximum vertical element spacing value. Maximum + // vertical element spacing must be >= 0. +#define ERR_NIOCR_INVALID_MIN_BOUNDING_RECT_WIDTH \ + -1074395580 // Invalid minimum bounding rectangle width. Minimum bounding + // rectangle width must be >= 1. +#define ERR_NIOCR_INVALID_ASPECT_RATIO \ + -1074395579 // Invalid aspect ratio value. The aspect ratio must be zero or + // >= 100. +#define ERR_NIOCR_INVALID_CHARACTER_SET_FILE \ + -1074395578 // Invalid or corrupt character set file. +#define ERR_NIOCR_CHARACTER_VALUE_CANNOT_BE_EMPTYSTRING \ + -1074395577 // The character value must not be an empty string. +#define ERR_NIOCR_CHARACTER_VALUE_TOO_LONG \ + -1074395576 // Character values must be <=255 characters. +#define ERR_NIOCR_INVALID_NUMBER_OF_EROSIONS \ + -1074395575 // Invalid number of erosions. The number of erosions must be >= + // 0. +#define ERR_NIOCR_CHARACTER_SET_DESCRIPTION_TOO_LONG \ + -1074395574 // The character set description must be <=255 characters. +#define ERR_NIOCR_INVALID_CHARACTER_SET_FILE_VERSION \ + -1074395573 // The character set file was created by a newer version of NI + // Vision. Upgrade to the latest version of NI Vision to read the + // character set file. +#define ERR_NIOCR_INTEGER_VALUE_FOR_STRING_ATTRIBUTE \ + -1074395572 // You must specify characters for a string. A string cannot + // contain integers. +#define ERR_NIOCR_GET_ONLY_ATTRIBUTE \ + -1074395571 // This attribute is read-only. +#define ERR_NIOCR_INTEGER_VALUE_FOR_BOOLEAN_ATTRIBUTE \ + -1074395570 // This attribute requires a Boolean value. +#define ERR_NIOCR_INVALID_ATTRIBUTE -1074395569 // Invalid attribute. +#define ERR_NIOCR_STRING_VALUE_FOR_INTEGER_ATTRIBUTE \ + -1074395568 // This attribute requires integer values. +#define ERR_NIOCR_STRING_VALUE_FOR_BOOLEAN_ATTRIBUTE \ + -1074395567 // String values are invalid for this attribute. Enter a boolean + // value. +#define ERR_NIOCR_BOOLEAN_VALUE_FOR_INTEGER_ATTRIBUTE \ + -1074395566 // Boolean values are not valid for this attribute. Enter an + // integer value. +#define ERR_NIOCR_MUST_BE_SINGLE_CHARACTER \ + -1074395565 // Requires a single-character string. +#define ERR_NIOCR_INVALID_PREDEFINED_CHARACTER \ + -1074395564 // Invalid predefined character value. +#define ERR_NIOCR_UNLICENSED -1074395563 // This copy of NI OCR is unlicensed. +#define ERR_NIOCR_BOOLEAN_VALUE_FOR_STRING_ATTRIBUTE \ + -1074395562 // String values are not valid for this attribute. Enter a + // Boolean value. +#define ERR_NIOCR_INVALID_NUMBER_OF_CHARACTERS \ + -1074395561 // The number of characters in the character value must match the + // number of objects in the image. +#define ERR_NIOCR_INVALID_OBJECT_INDEX -1074395560 // Invalid object index. +#define ERR_NIOCR_INVALID_READ_OPTION -1074395559 // Invalid read option. +#define ERR_NIOCR_INVALID_CHARACTER_SIZE_RANGE \ + -1074395558 // The minimum character size must be less than the maximum + // character size. +#define ERR_NIOCR_INVALID_BOUNDING_RECT_WIDTH_RANGE \ + -1074395557 // The minimum character bounding rectangle width must be less + // than the maximum character bounding rectangle width. +#define ERR_NIOCR_INVALID_BOUNDING_RECT_HEIGHT_RANGE \ + -1074395556 // The minimum character bounding rectangle height must be less + // than the maximum character bounding rectangle height. +#define ERR_NIOCR_INVALID_SPACING_RANGE \ + -1074395555 // The maximum horizontal element spacing value must not exceed + // the minimum character spacing value. +#define ERR_NIOCR_INVALID_READ_RESOLUTION \ + -1074395554 // Invalid read resolution. +#define ERR_NIOCR_INVALID_MIN_BOUNDING_RECT_HEIGHT \ + -1074395553 // Invalid minimum bounding rectangle height. The minimum + // bounding rectangle height must be >= 1. +#define ERR_NIOCR_NOT_A_VALID_CHARACTER_SET \ + -1074395552 // Not a valid character set. +#define ERR_NIOCR_RENAME_REFCHAR \ + -1074395551 // A trained OCR character cannot be renamed while it is a + // reference character. +#define ERR_NIOCR_INVALID_CHARACTER_VALUE \ + -1074395550 // A character cannot have an ASCII value of 255. +#define ERR_NIOCR_INVALID_NUMBER_OF_OBJECTS_TO_VERIFY \ + -1074395549 // The number of objects found does not match the number of + // expected characters or patterns to verify. +#define ERR_INVALID_STEREO_BLOCKMATCHING_PREFILTER_CAP \ + -1074395421 // The specified value for the filter cap for block matching is + // invalid. +#define ERR_INVALID_STEREO_BLOCKMATCHING_PREFILTER_SIZE \ + -1074395420 // The specified prefilter size for block matching is invalid. +#define ERR_INVALID_STEREO_BLOCKMATCHING_PREFILTER_TYPE \ + -1074395419 // The specified prefilter type for block matching is invalid. +#define ERR_INVALID_STEREO_BLOCKMATCHING_NUMDISPARITIES \ + -1074395418 // The specifed value for number of disparities is invalid. +#define ERR_INVALID_STEREO_BLOCKMATCHING_WINDOW_SIZE \ + -1074395417 // The specified window size for block matching is invalid. +#define ERR_3DVISION_INVALID_SESSION_TYPE \ + -1074395416 // This 3D vision function cannot be called on this type of 3d + // vision session. +#define ERR_TOO_MANY_3DVISION_SESSIONS \ + -1074395415 // There are too many 3D vision sessions open. You must close a + // session before you can open another one. +#define ERR_OPENING_NEWER_3DVISION_SESSION \ + -1074395414 // The 3D vision session you tried to open was created with a + // newer version of NI Vision. Upgrade to the latest version of + // NI Vision to read this file. +#define ERR_INVALID_STEREO_BLOCKMATCHING_FILTERTYPE \ + -1074395413 // You have specified an invalid filter type for block matching. +#define ERR_INVALID_STEREO_CAMERA_POSITION \ + -1074395412 // You have requested results at an invalid camera position in + // the stereo setup. +#define ERR_INVALID_3DVISION_SESSION \ + -1074395411 // Not a valid 3D Vision session. +#define ERR_INVALID_ICONS_PER_LINE \ + -1074395410 // NI Vision does not support less than one icon per line. +#define ERR_INVALID_SUBPIXEL_DIVISIONS \ + -1074395409 // Invalid subpixel divisions. +#define ERR_INVALID_DETECTION_MODE -1074395408 // Invalid detection mode. +#define ERR_INVALID_CONTRAST \ + -1074395407 // Invalid contrast value. Valid contrast values range from 0 to + // 255. +#define ERR_COORDSYS_NOT_FOUND \ + -1074395406 // The coordinate system could not be found on this image. +#define ERR_INVALID_TEXTORIENTATION \ + -1074395405 // NI Vision does not support the text orientation value you + // supplied. +#define ERR_INVALID_INTERPOLATIONMETHOD_FOR_UNWRAP \ + -1074395404 // UnwrapImage does not support the interpolation method value + // you supplied. Valid interpolation methods are zero order and + // bilinear. +#define ERR_EXTRAINFO_VERSION \ + -1074395403 // The image was created in a newer version of NI Vision. Upgrade + // to the latest version of NI Vision to use this image. +#define ERR_INVALID_MAXPOINTS \ + -1074395402 // The function does not support the maximum number of points + // that you specified. +#define ERR_INVALID_MATCHFACTOR \ + -1074395401 // The function does not support the matchFactor that you + // specified. +#define ERR_MULTICORE_OPERATION \ + -1074395400 // The operation you have given Multicore Options is invalid. + // Please see the available enumeration values for Multicore + // Operation. +#define ERR_MULTICORE_INVALID_ARGUMENT \ + -1074395399 // You have given Multicore Options an invalid argument. +#define ERR_COMPLEX_IMAGE_REQUIRED -1074395397 // A complex image is required. +#define ERR_COLOR_IMAGE_REQUIRED \ + -1074395395 // The input image must be a color image. +#define ERR_COLOR_SPECTRUM_MASK \ + -1074395394 // The color mask removes too much color information. +#define ERR_COLOR_TEMPLATE_IMAGE_TOO_SMALL \ + -1074395393 // The color template image is too small. +#define ERR_COLOR_TEMPLATE_IMAGE_TOO_LARGE \ + -1074395392 // The color template image is too large. +#define ERR_COLOR_TEMPLATE_IMAGE_HUE_CONTRAST_TOO_LOW \ + -1074395391 // The contrast in the hue plane of the image is too low for + // learning shape features. +#define ERR_COLOR_TEMPLATE_IMAGE_LUMINANCE_CONTRAST_TOO_LOW \ + -1074395390 // The contrast in the luminance plane of the image is too low to + // learn shape features. +#define ERR_COLOR_LEARN_SETUP_DATA \ + -1074395389 // Invalid color learn setup data. +#define ERR_COLOR_LEARN_SETUP_DATA_SHAPE \ + -1074395388 // Invalid color learn setup data. +#define ERR_COLOR_MATCH_SETUP_DATA \ + -1074395387 // Invalid color match setup data. +#define ERR_COLOR_MATCH_SETUP_DATA_SHAPE \ + -1074395386 // Invalid color match setup data. +#define ERR_COLOR_ROTATION_REQUIRES_SHAPE_FEATURE \ + -1074395385 // Rotation-invariant color pattern matching requires a feature + // mode including shape. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR \ + -1074395384 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_1 \ + -1074395383 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_2 \ + -1074395382 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_3 \ + -1074395381 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_4 \ + -1074395380 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_5 \ + -1074395379 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_6 \ + -1074395378 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_SHIFT \ + -1074395377 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_NOSHIFT \ + -1074395376 // The color template image does not contain data required for + // shift-invariant color matching. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_SHIFT_1 \ + -1074395375 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_SHIFT_2 \ + -1074395374 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION \ + -1074395373 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_NOROTATION \ + -1074395372 // The color template image does not contain data required for + // rotation-invariant color matching. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION_1 \ + -1074395371 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION_2 \ + -1074395370 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION_3 \ + -1074395369 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION_4 \ + -1074395368 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_ROTATION_5 \ + -1074395367 // Invalid color template image. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_NOSHAPE \ + -1074395366 // The color template image does not contain data required for + // color matching in shape feature mode. +#define ERR_COLOR_TEMPLATE_DESCRIPTOR_NOSPECTRUM \ + -1074395365 // The color template image does not contain data required for + // color matching in color feature mode. +#define ERR_IGNORE_COLOR_SPECTRUM_SET \ + -1074395364 // The ignore color spectra array is invalid. +#define ERR_INVALID_SUBSAMPLING_RATIO -1074395363 // Invalid subsampling ratio. +#define ERR_INVALID_WIDTH -1074395362 // Invalid pixel width. +#define ERR_INVALID_STEEPNESS -1074395361 // Invalid steepness. +#define ERR_COMPLEX_PLANE -1074395360 // Invalid complex plane. +#define ERR_INVALID_COLOR_IGNORE_MODE -1074395357 // Invalid color ignore mode. +#define ERR_INVALID_MIN_MATCH_SCORE \ + -1074395356 // Invalid minimum match score. Acceptable values range from 0 to + // 1000. +#define ERR_INVALID_NUM_MATCHES_REQUESTED \ + -1074395355 // Invalid number of matches requested. You must request a + // minimum of one match. +#define ERR_INVALID_COLOR_WEIGHT \ + -1074395354 // Invalid color weight. Acceptable values range from 0 to 1000. +#define ERR_INVALID_SEARCH_STRATEGY -1074395353 // Invalid search strategy. +#define ERR_INVALID_FEATURE_MODE -1074395352 // Invalid feature mode. +#define ERR_INVALID_RECT \ + -1074395351 // NI Vision does not support rectangles with negative widths or + // negative heights. +#define ERR_INVALID_VISION_INFO \ + -1074395350 // NI Vision does not support the vision information type you + // supplied. +#define ERR_INVALID_SKELETONMETHOD \ + -1074395349 // NI Vision does not support the SkeletonMethod value you + // supplied. +#define ERR_INVALID_3DPLANE \ + -1074395348 // NI Vision does not support the 3DPlane value you supplied. +#define ERR_INVALID_3DDIRECTION \ + -1074395347 // NI Vision does not support the 3DDirection value you supplied. +#define ERR_INVALID_INTERPOLATIONMETHOD_FOR_ROTATE \ + -1074395346 // imaqRotate does not support the InterpolationMethod value you + // supplied. +#define ERR_INVALID_FLIPAXIS \ + -1074395345 // NI Vision does not support the axis of symmetry you supplied. +#define ERR_FILE_FILENAME_NULL \ + -1074395343 // You must pass a valid file name. Do not pass in NULL. +#define ERR_INVALID_SIZETYPE \ + -1074395340 // NI Vision does not support the SizeType value you supplied. +#define ERR_UNKNOWN_ALGORITHM \ + -1074395336 // You specified the dispatch status of an unknown algorithm. +#define ERR_DISPATCH_STATUS_CONFLICT \ + -1074395335 // You are attempting to set the same algorithm to dispatch and + // to not dispatch. Remove one of the conflicting settings. +#define ERR_INVALID_CONVERSIONSTYLE \ + -1074395334 // NI Vision does not support the Conversion Method value you + // supplied. +#define ERR_INVALID_VERTICAL_TEXT_ALIGNMENT \ + -1074395333 // NI Vision does not support the VerticalTextAlignment value you + // supplied. +#define ERR_INVALID_COMPAREFUNCTION \ + -1074395332 // NI Vision does not support the CompareFunction value you + // supplied. +#define ERR_INVALID_BORDERMETHOD \ + -1074395331 // NI Vision does not support the BorderMethod value you + // supplied. +#define ERR_INVALID_BORDER_SIZE \ + -1074395330 // Invalid border size. Acceptable values range from 0 to 50. +#define ERR_INVALID_OUTLINEMETHOD \ + -1074395329 // NI Vision does not support the OutlineMethod value you + // supplied. +#define ERR_INVALID_INTERPOLATIONMETHOD \ + -1074395328 // NI Vision does not support the InterpolationMethod value you + // supplied. +#define ERR_INVALID_SCALINGMODE \ + -1074395327 // NI Vision does not support the ScalingMode value you supplied. +#define ERR_INVALID_DRAWMODE_FOR_LINE \ + -1074395326 // imaqDrawLineOnImage does not support the DrawMode value you + // supplied. +#define ERR_INVALID_DRAWMODE \ + -1074395325 // NI Vision does not support the DrawMode value you supplied. +#define ERR_INVALID_SHAPEMODE \ + -1074395324 // NI Vision does not support the ShapeMode value you supplied. +#define ERR_INVALID_FONTCOLOR \ + -1074395323 // NI Vision does not support the FontColor value you supplied. +#define ERR_INVALID_TEXTALIGNMENT \ + -1074395322 // NI Vision does not support the TextAlignment value you + // supplied. +#define ERR_INVALID_MORPHOLOGYMETHOD \ + -1074395321 // NI Vision does not support the MorphologyMethod value you + // supplied. +#define ERR_TEMPLATE_EMPTY -1074395320 // The template image is empty. +#define ERR_INVALID_SUBPIX_TYPE \ + -1074395319 // NI Vision does not support the interpolation type you + // supplied. +#define ERR_INSF_POINTS \ + -1074395318 // You supplied an insufficient number of points to perform this + // operation. +#define ERR_UNDEF_POINT \ + -1074395317 // You specified a point that lies outside the image. +#define ERR_INVALID_KERNEL_CODE -1074395316 // Invalid kernel code. +#define ERR_INEFFICIENT_POINTS \ + -1074395315 // You supplied an inefficient set of points to match the minimum + // score. +#define ERR_WRITE_FILE_NOT_SUPPORTED \ + -1074395313 // Writing files is not supported on this device. +#define ERR_LCD_CALIBRATE \ + -1074395312 // The input image does not seem to be a valid LCD or LED + // calibration image. +#define ERR_INVALID_COLOR_SPECTRUM \ + -1074395311 // The color spectrum array you provided has an invalid number of + // elements or contains an element set to not-a-number (NaN). +#define ERR_INVALID_PALETTE_TYPE \ + -1074395310 // NI Vision does not support the PaletteType value you supplied. +#define ERR_INVALID_WINDOW_THREAD_POLICY \ + -1074395309 // NI Vision does not support the WindowThreadPolicy value you + // supplied. +#define ERR_INVALID_COLORSENSITIVITY \ + -1074395308 // NI Vision does not support the ColorSensitivity value you + // supplied. +#define ERR_PRECISION_NOT_GTR_THAN_0 \ + -1074395307 // The precision parameter must be greater than 0. +#define ERR_INVALID_TOOL \ + -1074395306 // NI Vision does not support the Tool value you supplied. +#define ERR_INVALID_REFERENCEMODE \ + -1074395305 // NI Vision does not support the ReferenceMode value you + // supplied. +#define ERR_INVALID_MATHTRANSFORMMETHOD \ + -1074395304 // NI Vision does not support the MathTransformMethod value you + // supplied. +#define ERR_INVALID_NUM_OF_CLASSES \ + -1074395303 // Invalid number of classes for auto threshold. Acceptable + // values range from 2 to 256. +#define ERR_INVALID_THRESHOLDMETHOD \ + -1074395302 // NI Vision does not support the threshold method value you + // supplied. +#define ERR_ROI_NOT_2_LINES \ + -1074395301 // The ROI you passed into imaqGetMeterArc must consist of two + // lines. +#define ERR_INVALID_METERARCMODE \ + -1074395300 // NI Vision does not support the MeterArcMode value you + // supplied. +#define ERR_INVALID_COMPLEXPLANE \ + -1074395299 // NI Vision does not support the ComplexPlane value you + // supplied. +#define ERR_COMPLEXPLANE_NOT_REAL_OR_IMAGINARY \ + -1074395298 // You can perform this operation on a real or an imaginary + // ComplexPlane only. +#define ERR_INVALID_PARTICLEINFOMODE \ + -1074395297 // NI Vision does not support the ParticleInfoMode value you + // supplied. +#define ERR_INVALID_BARCODETYPE \ + -1074395296 // NI Vision does not support the BarcodeType value you supplied. +#define ERR_INVALID_INTERPOLATIONMETHOD_INTERPOLATEPOINTS \ + -1074395295 // imaqInterpolatePoints does not support the InterpolationMethod + // value you supplied. +#define ERR_CONTOUR_INDEX_OUT_OF_RANGE \ + -1074395294 // The contour index you supplied is larger than the number of + // contours in the ROI. +#define ERR_CONTOURID_NOT_FOUND \ + -1074395293 // The supplied ContourID did not correlate to a contour inside + // the ROI. +#define ERR_POINTS_ARE_COLLINEAR \ + -1074395292 // Do not supply collinear points for this operation. +#define ERR_SHAPEMATCH_BADIMAGEDATA \ + -1074395291 // Shape Match requires the image to contain only pixel values of + // 0 or 1. +#define ERR_SHAPEMATCH_BADTEMPLATE \ + -1074395290 // The template you supplied for ShapeMatch contains no shape + // information. +#define ERR_CONTAINER_CAPACITY_EXCEEDED_UINT_MAX \ + -1074395289 // The operation would have exceeded the capacity of an internal + // container, which is limited to 4294967296 unique elements. +#define ERR_CONTAINER_CAPACITY_EXCEEDED_INT_MAX \ + -1074395288 // The operation would have exceeded the capacity of an internal + // container, which is limited to 2147483648 unique elements. +#define ERR_INVALID_LINE \ + -1074395287 // The line you provided contains two identical points, or one of + // the coordinate locations for the line is not a number (NaN). +#define ERR_INVALID_CONCENTRIC_RAKE_DIRECTION \ + -1074395286 // Invalid concentric rake direction. +#define ERR_INVALID_SPOKE_DIRECTION -1074395285 // Invalid spoke direction. +#define ERR_INVALID_EDGE_PROCESS -1074395284 // Invalid edge process. +#define ERR_INVALID_RAKE_DIRECTION -1074395283 // Invalid rake direction. +#define ERR_CANT_DRAW_INTO_VIEWER \ + -1074395282 // Unable to draw to viewer. You must have the latest version of + // the control. +#define ERR_IMAGE_SMALLER_THAN_BORDER \ + -1074395281 // Your image must be larger than its border size for this + // operation. +#define ERR_ROI_NOT_RECT \ + -1074395280 // The ROI must only have a single Rectangle contour. +#define ERR_ROI_NOT_POLYGON -1074395279 // ROI is not a polygon. +#define ERR_LCD_NOT_NUMERIC -1074395278 // LCD image is not a number. +#define ERR_BARCODE_CHECKSUM \ + -1074395277 // The decoded barcode information did not pass the checksum + // test. +#define ERR_LINES_PARALLEL \ + -1074395276 // You specified parallel lines for the meter ROI. +#define ERR_INVALID_BROWSER_IMAGE -1074395275 // Invalid browser image. +#define ERR_DIV_BY_ZERO -1074395270 // Cannot divide by zero. +#define ERR_NULL_POINTER -1074395269 // Null pointer. +#define ERR_LINEAR_COEFF \ + -1074395268 // The linear equations are not independent. +#define ERR_COMPLEX_ROOT -1074395267 // The roots of the equation are complex. +#define ERR_BARCODE \ + -1074395265 // The barcode does not match the type you specified. +#define ERR_LCD_NO_SEGMENTS -1074395263 // No lit segment. +#define ERR_LCD_BAD_MATCH -1074395262 // The LCD does not form a known digit. +#define ERR_GIP_RANGE \ + -1074395261 // An internal error occurred while attempting to access an + // invalid coordinate on an image. +#define ERR_HEAP_TRASHED -1074395260 // An internal memory error occurred. +#define ERR_BAD_FILTER_WIDTH \ + -1074395258 // The filter width must be odd for the Canny operator. +#define ERR_INVALID_EDGE_DIR \ + -1074395257 // You supplied an invalid edge direction in the Canny operator. +#define ERR_EVEN_WINDOW_SIZE \ + -1074395256 // The window size must be odd for the Canny operator. +#define ERR_INVALID_LEARN_MODE -1074395253 // Invalid learn mode. +#define ERR_LEARN_SETUP_DATA -1074395252 // Invalid learn setup data. +#define ERR_INVALID_MATCH_MODE -1074395251 // Invalid match mode. +#define ERR_MATCH_SETUP_DATA -1074395250 // Invalid match setup data. +#define ERR_ROTATION_ANGLE_RANGE_TOO_LARGE \ + -1074395249 // At least one range in the array of rotation angle ranges + // exceeds 360 degrees. +#define ERR_TOO_MANY_ROTATION_ANGLE_RANGES \ + -1074395248 // The array of rotation angle ranges contains too many ranges. +#define ERR_TEMPLATE_DESCRIPTOR -1074395247 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_1 -1074395246 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_2 -1074395245 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_3 -1074395244 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_4 \ + -1074395243 // The template descriptor was created with a newer version of NI + // Vision. Upgrade to the latest version of NI Vision to use this + // template. +#define ERR_TEMPLATE_DESCRIPTOR_ROTATION \ + -1074395242 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_NOROTATION \ + -1074395241 // The template descriptor does not contain data required for + // rotation-invariant matching. +#define ERR_TEMPLATE_DESCRIPTOR_ROTATION_1 \ + -1074395240 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_SHIFT \ + -1074395239 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_NOSHIFT \ + -1074395238 // The template descriptor does not contain data required for + // shift-invariant matching. +#define ERR_TEMPLATE_DESCRIPTOR_SHIFT_1 \ + -1074395237 // Invalid template descriptor. +#define ERR_TEMPLATE_DESCRIPTOR_NOSCALE \ + -1074395236 // The template descriptor does not contain data required for + // scale-invariant matching. +#define ERR_TEMPLATE_IMAGE_CONTRAST_TOO_LOW \ + -1074395235 // The template image does not contain enough contrast. +#define ERR_TEMPLATE_IMAGE_TOO_SMALL \ + -1074395234 // The template image is too small. +#define ERR_TEMPLATE_IMAGE_TOO_LARGE \ + -1074395233 // The template image is too large. +#define ERR_TOO_MANY_OCR_SESSIONS \ + -1074395214 // There are too many OCR sessions open. You must close a + // session before you can open another one. +#define ERR_OCR_TEMPLATE_WRONG_SIZE \ + -1074395212 // The size of the template string must match the size of the + // string you are trying to correct. +#define ERR_OCR_BAD_TEXT_TEMPLATE \ + -1074395211 // The supplied text template contains nonstandard characters + // that cannot be generated by OCR. +#define ERR_OCR_CANNOT_MATCH_TEXT_TEMPLATE \ + -1074395210 // At least one character in the text template was of a lexical + // class that did not match the supplied character reports. +#define ERR_OCR_LIB_INIT \ + -1074395203 // The OCR library cannot be initialized correctly. +#define ERR_OCR_LOAD_LIBRARY \ + -1074395201 // There was a failure when loading one of the internal OCR + // engine or LabView libraries. +#define ERR_OCR_INVALID_PARAMETER \ + -1074395200 // One of the parameters supplied to the OCR function that + // generated this error is invalid. +#define ERR_MARKER_INFORMATION_NOT_SUPPLIED \ + -1074395199 // Marker image and points are not supplied +#define ERR_INCOMPATIBLE_MARKER_IMAGE_SIZE \ + -1074395198 // Source Image and Marker Image should be of same size. +#define ERR_BOTH_MARKER_INPUTS_SUPPLIED \ + -1074395197 // Both Marker Image and Points are supplied. +#define ERR_INVALID_MORPHOLOGICAL_OPERATION \ + -1074395196 // Invalid Morphological Operation. +#define ERR_IMAGE_CONTAINS_NAN_VALUES \ + -1074395195 // Float image contains NaN values +#define ERR_OVERLAY_EXTRAINFO_OPENING_NEW_VERSION \ + -1074395194 // The overlay information you tried to open was created with a + // newer version of NI Vision. Upgrade to the latest version of + // NI Vision to read this file. +#define ERR_NO_CLAMP_FOUND \ + -1074395193 // No valid clamp was found with the current configuration +#define ERR_NO_CLAMP_WITHIN_ANGLE_RANGE \ + -1074395192 // Supplied angle range for clamp is insufficient +#define ERR_GHT_INVALID_USE_ALL_CURVES_VALUE \ + -1074395188 // The use all curves advanced option specified during learn is + // not supported +#define ERR_INVALID_GAUSS_SIGMA_VALUE \ + -1074395187 // The sigma value specified for the Gaussian filter is too + // small. +#define ERR_INVALID_GAUSS_FILTER_TYPE \ + -1074395186 // The specified Gaussian filter type is not supported. +#define ERR_INVALID_CONTRAST_REVERSAL_MODE \ + -1074395185 // The contrast reversal mode specified during matching is + // invalid. +#define ERR_INVALID_ROTATION_RANGE \ + -1074395184 // Invalid roation angle range. The upper bound must be greater + // than or equal to the lower bound. +#define ERR_GHT_INVALID_MINIMUM_LEARN_ANGLE_VALUE \ + -1074395183 // The minimum rotation angle value specifed during learning of + // the template is not supported. +#define ERR_GHT_INVALID_MAXIMUM_LEARN_ANGLE_VALUE \ + -1074395182 // The maximum rotation angle value specifed during learning of + // the template is not supported. +#define ERR_GHT_INVALID_MAXIMUM_LEARN_SCALE_FACTOR \ + -1074395181 // The maximum scale factor specifed during learning of the + // template is not supported. +#define ERR_GHT_INVALID_MINIMUM_LEARN_SCALE_FACTOR \ + -1074395180 // The minimum scale factor specifed during learning of the + // template is not supported. +#define ERR_OCR_PREPROCESSING_FAILED \ + -1074395179 // The OCR engine failed during the preprocessing stage. +#define ERR_OCR_RECOGNITION_FAILED \ + -1074395178 // The OCR engine failed during the recognition stage. +#define ERR_OCR_BAD_USER_DICTIONARY \ + -1074395175 // The provided filename is not valid user dictionary filename. +#define ERR_OCR_INVALID_AUTOORIENTMODE \ + -1074395174 // NI Vision does not support the AutoOrientMode value you + // supplied. +#define ERR_OCR_INVALID_LANGUAGE \ + -1074395173 // NI Vision does not support the Language value you supplied. +#define ERR_OCR_INVALID_CHARACTERSET \ + -1074395172 // NI Vision does not support the CharacterSet value you + // supplied. +#define ERR_OCR_INI_FILE_NOT_FOUND \ + -1074395171 // The system could not locate the initialization file required + // for OCR initialization. +#define ERR_OCR_INVALID_CHARACTERTYPE \ + -1074395170 // NI Vision does not support the CharacterType value you + // supplied. +#define ERR_OCR_INVALID_RECOGNITIONMODE \ + -1074395169 // NI Vision does not support the RecognitionMode value you + // supplied. +#define ERR_OCR_INVALID_AUTOCORRECTIONMODE \ + -1074395168 // NI Vision does not support the AutoCorrectionMode value you + // supplied. +#define ERR_OCR_INVALID_OUTPUTDELIMITER \ + -1074395167 // NI Vision does not support the OutputDelimiter value you + // supplied. +#define ERR_OCR_BIN_DIR_NOT_FOUND \ + -1074395166 // The system could not locate the OCR binary directory required + // for OCR initialization. +#define ERR_OCR_WTS_DIR_NOT_FOUND \ + -1074395165 // The system could not locate the OCR weights directory required + // for OCR initialization. +#define ERR_OCR_ADD_WORD_FAILED \ + -1074395164 // The supplied word could not be added to the user dictionary. +#define ERR_OCR_INVALID_CHARACTERPREFERENCE \ + -1074395163 // NI Vision does not support the CharacterPreference value you + // supplied. +#define ERR_OCR_INVALID_CORRECTIONMODE \ + -1074395162 // NI Vision does not support the CorrectionMethod value you + // supplied. +#define ERR_OCR_INVALID_CORRECTIONLEVEL \ + -1074395161 // NI Vision does not support the CorrectionLevel value you + // supplied. +#define ERR_OCR_INVALID_MAXPOINTSIZE \ + -1074395160 // NI Vision does not support the maximum point size you + // supplied. Valid values range from 4 to 72. +#define ERR_OCR_INVALID_TOLERANCE \ + -1074395159 // NI Vision does not support the tolerance value you supplied. + // Valid values are non-negative. +#define ERR_OCR_INVALID_CONTRASTMODE \ + -1074395158 // NI Vision does not support the ContrastMode value you + // supplied. +#define ERR_OCR_SKEW_DETECT_FAILED \ + -1074395156 // The OCR attempted to detected the text skew and failed. +#define ERR_OCR_ORIENT_DETECT_FAILED \ + -1074395155 // The OCR attempted to detected the text orientation and failed. +#define ERR_FONT_FILE_FORMAT -1074395153 // Invalid font file format. +#define ERR_FONT_FILE_NOT_FOUND -1074395152 // Font file not found. +#define ERR_OCR_CORRECTION_FAILED \ + -1074395151 // The OCR engine failed during the correction stage. +#define ERR_INVALID_ROUNDING_MODE \ + -1074395150 // NI Vision does not support the RoundingMode value you + // supplied. +#define ERR_DUPLICATE_TRANSFORM_TYPE \ + -1074395149 // Found a duplicate transform type in the properties array. Each + // properties array may only contain one behavior for each + // transform type. +#define ERR_OVERLAY_GROUP_NOT_FOUND -1074395148 // Overlay Group Not Found. +#define ERR_BARCODE_RSSLIMITED \ + -1074395147 // The barcode is not a valid RSS Limited symbol +#define ERR_QR_DETECTION_VERSION \ + -1074395146 // Couldn't determine the correct version of the QR code. +#define ERR_QR_INVALID_READ -1074395145 // Invalid read of the QR code. +#define ERR_QR_INVALID_BARCODE \ + -1074395144 // The barcode that was read contains invalid parameters. +#define ERR_QR_DETECTION_MODE \ + -1074395143 // The data stream that was demodulated could not be read because + // the mode was not detected. +#define ERR_QR_DETECTION_MODELTYPE \ + -1074395142 // Couldn't determine the correct model of the QR code. +#define ERR_OCR_NO_TEXT_FOUND \ + -1074395141 // The OCR engine could not find any text in the supplied region. +#define ERR_OCR_CHAR_REPORT_CORRUPTED \ + -1074395140 // One of the character reports is no longer usable by the + // system. +#define ERR_IMAQ_QR_DIMENSION_INVALID -1074395139 // Invalid Dimensions. +#define ERR_OCR_REGION_TOO_SMALL \ + -1074395138 // The OCR region provided was too small to have contained any + // characters. +#define _FIRST_ERR ERR_SYSTEM_ERROR +#define _LAST_ERR ERR_OCR_REGION_TOO_SMALL + +//============================================================================ +// Enumerated Types +//============================================================================ +typedef enum PointSymbol_enum { + IMAQ_POINT_AS_PIXEL = 0, // A single pixel represents a point in the overlay. + IMAQ_POINT_AS_CROSS = 1, // A cross represents a point in the overlay. + IMAQ_POINT_USER_DEFINED = + 2, // The pattern supplied by the user represents a point in the overlay. + IMAQ_POINT_SYMBOL_SIZE_GUARD = 0xFFFFFFFF +} PointSymbol; + +typedef enum MeasurementValue_enum { + IMAQ_AREA = 0, // Surface area of the particle in pixels. + IMAQ_AREA_CALIBRATED = + 1, // Surface area of the particle in calibrated units. + IMAQ_NUM_HOLES = 2, // Number of holes in the particle. + IMAQ_AREA_OF_HOLES = 3, // Surface area of the holes in calibrated units. + IMAQ_TOTAL_AREA = + 4, // Total surface area (holes and particle) in calibrated units. + IMAQ_IMAGE_AREA = 5, // Surface area of the entire image in calibrated units. + IMAQ_PARTICLE_TO_IMAGE = 6, // Ratio, expressed as a percentage, of the + // surface area of a particle in relation to the + // total area of the particle. + IMAQ_PARTICLE_TO_TOTAL = 7, // Ratio, expressed as a percentage, of the + // surface area of a particle in relation to the + // total area of the particle. + IMAQ_CENTER_MASS_X = 8, // X-coordinate of the center of mass. + IMAQ_CENTER_MASS_Y = 9, // Y-coordinate of the center of mass. + IMAQ_LEFT_COLUMN = 10, // Left edge of the bounding rectangle. + IMAQ_TOP_ROW = 11, // Top edge of the bounding rectangle. + IMAQ_RIGHT_COLUMN = 12, // Right edge of the bounding rectangle. + IMAQ_BOTTOM_ROW = 13, // Bottom edge of bounding rectangle. + IMAQ_WIDTH = 14, // Width of bounding rectangle in calibrated units. + IMAQ_HEIGHT = 15, // Height of bounding rectangle in calibrated units. + IMAQ_MAX_SEGMENT_LENGTH = 16, // Length of longest horizontal line segment. + IMAQ_MAX_SEGMENT_LEFT_COLUMN = + 17, // Leftmost x-coordinate of longest horizontal line segment. + IMAQ_MAX_SEGMENT_TOP_ROW = + 18, // Y-coordinate of longest horizontal line segment. + IMAQ_PERIMETER = 19, // Outer perimeter of the particle. + IMAQ_PERIMETER_OF_HOLES = 20, // Perimeter of all holes within the particle. + IMAQ_SIGMA_X = 21, // Sum of the particle pixels on the x-axis. + IMAQ_SIGMA_Y = 22, // Sum of the particle pixels on the y-axis. + IMAQ_SIGMA_XX = 23, // Sum of the particle pixels on the x-axis squared. + IMAQ_SIGMA_YY = 24, // Sum of the particle pixels on the y-axis squared. + IMAQ_SIGMA_XY = 25, // Sum of the particle pixels on the x-axis and y-axis. + IMAQ_PROJ_X = 26, // Projection corrected in X. + IMAQ_PROJ_Y = 27, // Projection corrected in Y. + IMAQ_INERTIA_XX = 28, // Inertia matrix coefficient in XX. + IMAQ_INERTIA_YY = 29, // Inertia matrix coefficient in YY. + IMAQ_INERTIA_XY = 30, // Inertia matrix coefficient in XY. + IMAQ_MEAN_H = 31, // Mean length of horizontal segments. + IMAQ_MEAN_V = 32, // Mean length of vertical segments. + IMAQ_MAX_INTERCEPT = 33, // Length of longest segment of the convex hull. + IMAQ_MEAN_INTERCEPT = 34, // Mean length of the chords in an object + // perpendicular to its max intercept. + IMAQ_ORIENTATION = 35, // The orientation based on the inertia of the pixels + // in the particle. + IMAQ_EQUIV_ELLIPSE_MINOR = 36, // Total length of the axis of the ellipse + // having the same area as the particle and a + // major axis equal to half the max intercept. + IMAQ_ELLIPSE_MAJOR = 37, // Total length of major axis having the same area + // and perimeter as the particle in calibrated + // units. + IMAQ_ELLIPSE_MINOR = 38, // Total length of minor axis having the same area + // and perimeter as the particle in calibrated + // units. + IMAQ_ELLIPSE_RATIO = 39, // Fraction of major axis to minor axis. + IMAQ_RECT_LONG_SIDE = 40, // Length of the long side of a rectangle having + // the same area and perimeter as the particle in + // calibrated units. + IMAQ_RECT_SHORT_SIDE = 41, // Length of the short side of a rectangle having + // the same area and perimeter as the particle in + // calibrated units. + IMAQ_RECT_RATIO = + 42, // Ratio of rectangle long side to rectangle short side. + IMAQ_ELONGATION = 43, // Max intercept/mean perpendicular intercept. + IMAQ_COMPACTNESS = 44, // Particle area/(height x width). + IMAQ_HEYWOOD = 45, // Particle perimeter/perimeter of the circle having the + // same area as the particle. + IMAQ_TYPE_FACTOR = 46, // A complex factor relating the surface area to the + // moment of inertia. + IMAQ_HYDRAULIC = 47, // Particle area/particle perimeter. + IMAQ_WADDLE_DISK = 48, // Diameter of the disk having the same area as the + // particle in user units. + IMAQ_DIAGONAL = 49, // Diagonal of an equivalent rectangle in user units. + IMAQ_MEASUREMENT_VALUE_SIZE_GUARD = 0xFFFFFFFF +} MeasurementValue; + +typedef enum ScalingMode_enum { + IMAQ_SCALE_LARGER = + 0, // The function duplicates pixels to make the image larger. + IMAQ_SCALE_SMALLER = + 1, // The function subsamples pixels to make the image smaller. + IMAQ_SCALING_MODE_SIZE_GUARD = 0xFFFFFFFF +} ScalingMode; + +typedef enum ScalingMethod_enum { + IMAQ_SCALE_TO_PRESERVE_AREA = 0, // Correction functions scale the image such + // that the features in the corrected image + // have the same area as the features in the + // input image. + IMAQ_SCALE_TO_FIT = 1, // Correction functions scale the image such that the + // corrected image is the same size as the input + // image. + IMAQ_SCALING_METHOD_SIZE_GUARD = 0xFFFFFFFF +} ScalingMethod; + +typedef enum ReferenceMode_enum { + IMAQ_COORD_X_Y = + 0, // This method requires three elements in the points array. + IMAQ_COORD_ORIGIN_X = + 1, // This method requires two elements in the points array. + IMAQ_REFERENCE_MODE_SIZE_GUARD = 0xFFFFFFFF +} ReferenceMode; + +typedef enum RectOrientation_enum { + IMAQ_BASE_INSIDE = 0, // Specifies that the base of the rectangular image + // lies along the inside edge of the annulus. + IMAQ_BASE_OUTSIDE = 1, // Specifies that the base of the rectangular image + // lies along the outside edge of the annulus. + IMAQ_TEXT_ORIENTATION_SIZE_GUARD = 0xFFFFFFFF +} RectOrientation; + +typedef enum ShapeMode_enum { + IMAQ_SHAPE_RECT = 1, // The function draws a rectangle. + IMAQ_SHAPE_OVAL = 2, // The function draws an oval. + IMAQ_SHAPE_MODE_SIZE_GUARD = 0xFFFFFFFF +} ShapeMode; + +typedef enum PolarityType_enum { + IMAQ_EDGE_RISING = 1, // The edge is a rising edge. + IMAQ_EDGE_FALLING = -1, // The edge is a falling edge. + IMAQ_POLARITY_TYPE_SIZE_GUARD = 0xFFFFFFFF +} PolarityType; + +typedef enum SizeType_enum { + IMAQ_KEEP_LARGE = + 0, // The function keeps large particles remaining after the erosion. + IMAQ_KEEP_SMALL = + 1, // The function keeps small particles eliminated by the erosion. + IMAQ_SIZE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} SizeType; + +typedef enum Plane3D_enum { + IMAQ_3D_REAL = 0, // The function shows the real part of complex images. + IMAQ_3D_IMAGINARY = + 1, // The function shows the imaginary part of complex images. + IMAQ_3D_MAGNITUDE = + 2, // The function shows the magnitude part of complex images. + IMAQ_3D_PHASE = 3, // The function shows the phase part of complex images. + IMAQ_PLANE_3D_SIZE_GUARD = 0xFFFFFFFF +} Plane3D; + +typedef enum PhotometricMode_enum { + IMAQ_WHITE_IS_ZERO = + 0, // The function interprets zero-value pixels as white. + IMAQ_BLACK_IS_ZERO = + 1, // The function interprets zero-value pixels as black. + IMAQ_PHOTOMETRIC_MODE_SIZE_GUARD = 0xFFFFFFFF +} PhotometricMode; + +typedef enum ParticleInfoMode_enum { + IMAQ_BASIC_INFO = 0, // The function returns only the following elements of + // each report: area, calibratedArea, boundingRect. + IMAQ_ALL_INFO = + 1, // The function returns all the information about each particle. + IMAQ_PARTICLE_INFO_MODE_SIZE_GUARD = 0xFFFFFFFF +} ParticleInfoMode; + +typedef enum OutlineMethod_enum { + IMAQ_EDGE_DIFFERENCE = 0, // The function uses a method that produces + // continuous contours by highlighting each pixel + // where an intensity variation occurs between + // itself and its three upper-left neighbors. + IMAQ_EDGE_GRADIENT = 1, // The function uses a method that outlines contours + // where an intensity variation occurs along the + // vertical axis. + IMAQ_EDGE_PREWITT = 2, // The function uses a method that extracts the outer + // contours of objects. + IMAQ_EDGE_ROBERTS = 3, // The function uses a method that outlines the + // contours that highlight pixels where an intensity + // variation occurs along the diagonal axes. + IMAQ_EDGE_SIGMA = 4, // The function uses a method that outlines contours and + // details by setting pixels to the mean value found in + // their neighborhood, if their deviation from this + // value is not significant. + IMAQ_EDGE_SOBEL = 5, // The function uses a method that extracts the outer + // contours of objects. + IMAQ_OUTLINE_METHOD_SIZE_GUARD = 0xFFFFFFFF +} OutlineMethod; + +typedef enum MorphologyMethod_enum { + IMAQ_AUTOM = 0, // The function uses a transformation that generates simpler + // particles that contain fewer details. + IMAQ_CLOSE = 1, // The function uses a transformation that fills tiny holes + // and smooths boundaries. + IMAQ_DILATE = 2, // The function uses a transformation that eliminates tiny + // holes isolated in particles and expands the contour of + // the particles according to the template defined by the + // structuring element. + IMAQ_ERODE = 3, // The function uses a transformation that eliminates pixels + // isolated in the background and erodes the contour of + // particles according to the template defined by the + // structuring element. + IMAQ_GRADIENT = 4, // The function uses a transformation that leaves only the + // pixels that would be added by the dilation process or + // eliminated by the erosion process. + IMAQ_GRADIENTOUT = 5, // The function uses a transformation that leaves only + // the pixels that would be added by the dilation + // process. + IMAQ_GRADIENTIN = 6, // The function uses a transformation that leaves only + // the pixels that would be eliminated by the erosion + // process. + IMAQ_HITMISS = 7, // The function uses a transformation that extracts each + // pixel located in a neighborhood exactly matching the + // template defined by the structuring element. + IMAQ_OPEN = 8, // The function uses a transformation that removes small + // particles and smooths boundaries. + IMAQ_PCLOSE = 9, // The function uses a transformation that fills tiny holes + // and smooths the inner contour of particles according to + // the template defined by the structuring element. + IMAQ_POPEN = 10, // The function uses a transformation that removes small + // particles and smooths the contour of particles according + // to the template defined by the structuring element. + IMAQ_THICK = 11, // The function uses a transformation that adds to an image + // those pixels located in a neighborhood that matches a + // template specified by the structuring element. + IMAQ_THIN = 12, // The function uses a transformation that eliminates pixels + // that are located in a neighborhood matching a template + // specified by the structuring element. + IMAQ_MORPHOLOGY_METHOD_SIZE_GUARD = 0xFFFFFFFF +} MorphologyMethod; + +typedef enum MeterArcMode_enum { + IMAQ_METER_ARC_ROI = 0, // The function uses the roi parameter and ignores + // the base, start, and end parameters. + IMAQ_METER_ARC_POINTS = 1, // The function uses the base,start, and end + // parameters and ignores the roi parameter. + IMAQ_METER_ARC_MODE_SIZE_GUARD = 0xFFFFFFFF +} MeterArcMode; + +typedef enum RakeDirection_enum { + IMAQ_LEFT_TO_RIGHT = 0, // The function searches from the left side of the + // search area to the right side of the search area. + IMAQ_RIGHT_TO_LEFT = 1, // The function searches from the right side of the + // search area to the left side of the search area. + IMAQ_TOP_TO_BOTTOM = 2, // The function searches from the top side of the + // search area to the bottom side of the search area. + IMAQ_BOTTOM_TO_TOP = 3, // The function searches from the bottom side of the + // search area to the top side of the search area. + IMAQ_RAKE_DIRECTION_SIZE_GUARD = 0xFFFFFFFF +} RakeDirection; + +typedef enum TruncateMode_enum { + IMAQ_TRUNCATE_LOW = 0, // The function truncates low frequencies. + IMAQ_TRUNCATE_HIGH = 1, // The function truncates high frequencies. + IMAQ_TRUNCATE_MODE_SIZE_GUARD = 0xFFFFFFFF +} TruncateMode; + +typedef enum AttenuateMode_enum { + IMAQ_ATTENUATE_LOW = 0, // The function attenuates low frequencies. + IMAQ_ATTENUATE_HIGH = 1, // The function attenuates high frequencies. + IMAQ_ATTENUATE_MODE_SIZE_GUARD = 0xFFFFFFFF +} AttenuateMode; + +typedef enum WindowThreadPolicy_enum { + IMAQ_CALLING_THREAD = 0, // Using this policy, NI Vision creates windows in + // the thread that makes the first display function + // call for a given window number. + IMAQ_SEPARATE_THREAD = 1, // Using this policy, NI Vision creates windows in + // a separate thread and processes messages for the + // windows automatically. + IMAQ_WINDOW_THREAD_POLICY_SIZE_GUARD = 0xFFFFFFFF +} WindowThreadPolicy; + +typedef enum WindowOptions_enum { + IMAQ_WIND_RESIZABLE = + 1, // When present, the user may resize the window interactively. + IMAQ_WIND_TITLEBAR = + 2, // When present, the title bar on the window is visible. + IMAQ_WIND_CLOSEABLE = 4, // When present, the close box is available. + IMAQ_WIND_TOPMOST = 8, // When present, the window is always on top. + IMAQ_WINDOW_OPTIONS_SIZE_GUARD = 0xFFFFFFFF +} WindowOptions; + +typedef enum WindowEventType_enum { + IMAQ_NO_EVENT = + 0, // No event occurred since the last call to imaqGetLastEvent(). + IMAQ_CLICK_EVENT = 1, // The user clicked on a window. + IMAQ_DRAW_EVENT = 2, // The user drew an ROI in a window. + IMAQ_MOVE_EVENT = 3, // The user moved a window. + IMAQ_SIZE_EVENT = 4, // The user sized a window. + IMAQ_SCROLL_EVENT = 5, // The user scrolled a window. + IMAQ_ACTIVATE_EVENT = 6, // The user activated a window. + IMAQ_CLOSE_EVENT = 7, // The user closed a window. + IMAQ_DOUBLE_CLICK_EVENT = 8, // The user double-clicked in a window. + IMAQ_WINDOW_EVENT_TYPE_SIZE_GUARD = 0xFFFFFFFF +} WindowEventType; + +typedef enum VisionInfoType_enum { + IMAQ_ANY_VISION_INFO = 0, // The function checks if any extra vision + // information is associated with the image. + IMAQ_PATTERN_MATCHING_INFO = 1, // The function checks if any pattern + // matching template information is + // associated with the image. + IMAQ_CALIBRATION_INFO = 2, // The function checks if any calibration + // information is associated with the image. + IMAQ_OVERLAY_INFO = 3, // The function checks if any overlay information is + // associated with the image. + IMAQ_VISION_INFO_TYPE_SIZE_GUARD = 0xFFFFFFFF +} VisionInfoType; + +typedef enum SearchStrategy_enum { + IMAQ_CONSERVATIVE = 1, // Instructs the pattern matching algorithm to use the + // largest possible amount of information from the + // image at the expense of slowing down the speed of + // the algorithm. + IMAQ_BALANCED = 2, // Instructs the pattern matching algorithm to balance the + // amount of information from the image it uses with the + // speed of the algorithm. + IMAQ_AGGRESSIVE = 3, // Instructs the pattern matching algorithm to use a + // lower amount of information from the image, which + // allows the algorithm to run quickly but at the + // expense of accuracy. + IMAQ_VERY_AGGRESSIVE = 4, // Instructs the pattern matching algorithm to use + // the smallest possible amount of information from + // the image, which allows the algorithm to run at + // the highest speed possible but at the expense of + // accuracy. + IMAQ_SEARCH_STRATEGY_SIZE_GUARD = 0xFFFFFFFF +} SearchStrategy; + +typedef enum TwoEdgePolarityType_enum { + IMAQ_NONE = 0, // The function ignores the polarity of the edges. + IMAQ_RISING_FALLING = 1, // The polarity of the first edge is rising (dark to + // light) and the polarity of the second edge is + // falling (light to dark). + IMAQ_FALLING_RISING = 2, // The polarity of the first edge is falling (light + // to dark) and the polarity of the second edge is + // rising (dark to light). + IMAQ_RISING_RISING = 3, // The polarity of the first edge is rising (dark to + // light) and the polarity of the second edge is + // rising (dark to light). + IMAQ_FALLING_FALLING = 4, // The polarity of the first edge is falling (light + // to dark) and the polarity of the second edge is + // falling (light to dark). + IMAQ_TWO_EDGE_POLARITY_TYPE_SIZE_GUARD = 0xFFFFFFFF +} TwoEdgePolarityType; + +typedef enum ObjectType_enum { + IMAQ_BRIGHT_OBJECTS = 0, // The function detects bright objects. + IMAQ_DARK_OBJECTS = 1, // The function detects dark objects. + IMAQ_OBJECT_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ObjectType; + +typedef enum Tool_enum { + IMAQ_NO_TOOL = -1, // No tool is in the selected state. + IMAQ_SELECTION_TOOL = + 0, // The selection tool selects an existing ROI in an image. + IMAQ_POINT_TOOL = 1, // The point tool draws a point on the image. + IMAQ_LINE_TOOL = 2, // The line tool draws a line on the image. + IMAQ_RECTANGLE_TOOL = + 3, // The rectangle tool draws a rectangle on the image. + IMAQ_OVAL_TOOL = 4, // The oval tool draws an oval on the image. + IMAQ_POLYGON_TOOL = 5, // The polygon tool draws a polygon on the image. + IMAQ_CLOSED_FREEHAND_TOOL = + 6, // The closed freehand tool draws closed freehand shapes on the image. + IMAQ_ANNULUS_TOOL = 7, // The annulus tool draws annuluses on the image. + IMAQ_ZOOM_TOOL = 8, // The zoom tool controls the zoom of an image. + IMAQ_PAN_TOOL = 9, // The pan tool shifts the view of the image. + IMAQ_POLYLINE_TOOL = 10, // The polyline tool draws a series of connected + // straight lines on the image. + IMAQ_FREEHAND_TOOL = + 11, // The freehand tool draws freehand lines on the image. + IMAQ_ROTATED_RECT_TOOL = + 12, // The rotated rectangle tool draws rotated rectangles on the image. + IMAQ_ZOOM_OUT_TOOL = 13, // The zoom out tool controls the zoom of an image. + IMAQ_TOOL_SIZE_GUARD = 0xFFFFFFFF +} Tool; + +typedef enum TIFFCompressionType_enum { + IMAQ_NO_COMPRESSION = 0, // The function does not compress the TIFF file. + IMAQ_JPEG = 1, // The function uses the JPEG compression algorithm to + // compress the TIFF file. + IMAQ_RUN_LENGTH = 2, // The function uses a run length compression algorithm + // to compress the TIFF file. + IMAQ_ZIP = 3, // The function uses the ZIP compression algorithm to compress + // the TIFF file. + IMAQ_TIFF_COMPRESSION_TYPE_SIZE_GUARD = 0xFFFFFFFF +} TIFFCompressionType; + +typedef enum ThresholdMethod_enum { + IMAQ_THRESH_CLUSTERING = 0, // The function uses a method that sorts the + // histogram of the image within a discrete + // number of classes corresponding to the number + // of phases perceived in an image. + IMAQ_THRESH_ENTROPY = 1, // The function uses a method that is best for + // detecting particles that are present in minuscule + // proportions on the image. + IMAQ_THRESH_METRIC = 2, // The function uses a method that is well-suited for + // images in which classes are not too + // disproportionate. + IMAQ_THRESH_MOMENTS = 3, // The function uses a method that is suited for + // images that have poor contrast. + IMAQ_THRESH_INTERCLASS = 4, // The function uses a method that is well-suited + // for images in which classes have well + // separated pixel value distributions. + IMAQ_THRESHOLD_METHOD_SIZE_GUARD = 0xFFFFFFFF +} ThresholdMethod; + +typedef enum TextAlignment_enum { + IMAQ_LEFT = 0, // Left aligns the text at the reference point. + IMAQ_CENTER = 1, // Centers the text around the reference point. + IMAQ_RIGHT = 2, // Right aligns the text at the reference point. + IMAQ_TEXT_ALIGNMENT_SIZE_GUARD = 0xFFFFFFFF +} TextAlignment; + +typedef enum SpokeDirection_enum { + IMAQ_OUTSIDE_TO_INSIDE = 0, // The function searches from the outside of the + // search area to the inside of the search area. + IMAQ_INSIDE_TO_OUTSIDE = 1, // The function searches from the inside of the + // search area to the outside of the search area. + IMAQ_SPOKE_DIRECTION_SIZE_GUARD = 0xFFFFFFFF +} SpokeDirection; + +typedef enum SkeletonMethod_enum { + IMAQ_SKELETON_L = + 0, // Uses an L-shaped structuring element in the skeleton function. + IMAQ_SKELETON_M = + 1, // Uses an M-shaped structuring element in the skeleton function. + IMAQ_SKELETON_INVERSE = 2, // Uses an L-shaped structuring element on an + // inverse of the image in the skeleton function. + IMAQ_SKELETON_METHOD_SIZE_GUARD = 0xFFFFFFFF +} SkeletonMethod; + +typedef enum VerticalTextAlignment_enum { + IMAQ_BOTTOM = 0, // Aligns the bottom of the text at the reference point. + IMAQ_TOP = 1, // Aligns the top of the text at the reference point. + IMAQ_BASELINE = 2, // Aligns the baseline of the text at the reference point. + IMAQ_VERTICAL_TEXT_ALIGNMENT_SIZE_GUARD = 0xFFFFFFFF +} VerticalTextAlignment; + +typedef enum CalibrationROI_enum { + IMAQ_FULL_IMAGE = 0, // The correction function corrects the whole image, + // regardless of the user-defined or calibration-defined + // ROIs. + IMAQ_CALIBRATION_ROI = 1, // The correction function corrects the area + // defined by the calibration ROI. + IMAQ_USER_ROI = 2, // The correction function corrects the area defined by + // the user-defined ROI. + IMAQ_CALIBRATION_AND_USER_ROI = + 3, // The correction function corrects the area defined by the + // intersection of the user-defined ROI and the calibration ROI. + IMAQ_CALIBRATION_OR_USER_ROI = + 4, // The correction function corrects the area defined by the union of + // the user-defined ROI and the calibration ROI. + IMAQ_CALIBRATION_ROI_SIZE_GUARD = 0xFFFFFFFF +} CalibrationROI; + +typedef enum ContourType_enum { + IMAQ_EMPTY_CONTOUR = 0, // The contour is empty. + IMAQ_POINT = 1, // The contour represents a point. + IMAQ_LINE = 2, // The contour represents a line. + IMAQ_RECT = 3, // The contour represents a rectangle. + IMAQ_OVAL = 4, // The contour represents an oval. + IMAQ_CLOSED_CONTOUR = 5, // The contour represents a series of connected + // points where the last point connects to the + // first. + IMAQ_OPEN_CONTOUR = 6, // The contour represents a series of connected points + // where the last point does not connect to the first. + IMAQ_ANNULUS = 7, // The contour represents an annulus. + IMAQ_ROTATED_RECT = 8, // The contour represents a rotated rectangle. + IMAQ_CONTOUR_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ContourType; + +typedef enum MathTransformMethod_enum { + IMAQ_TRANSFORM_LINEAR = 0, // The function uses linear remapping. + IMAQ_TRANSFORM_LOG = 1, // The function uses logarithmic remapping. + IMAQ_TRANSFORM_EXP = 2, // The function uses exponential remapping. + IMAQ_TRANSFORM_SQR = 3, // The function uses square remapping. + IMAQ_TRANSFORM_SQRT = 4, // The function uses square root remapping. + IMAQ_TRANSFORM_POWX = 5, // The function uses power X remapping. + IMAQ_TRANSFORM_POW1X = 6, // The function uses power 1/X remapping. + IMAQ_MATH_TRANSFORM_METHOD_SIZE_GUARD = 0xFFFFFFFF +} MathTransformMethod; + +typedef enum ComplexPlane_enum { + IMAQ_REAL = + 0, // The function operates on the real plane of the complex image. + IMAQ_IMAGINARY = + 1, // The function operates on the imaginary plane of the complex image. + IMAQ_MAGNITUDE = + 2, // The function operates on the magnitude plane of the complex image. + IMAQ_PHASE = + 3, // The function operates on the phase plane of the complex image. + IMAQ_COMPLEX_PLANE_SIZE_GUARD = 0xFFFFFFFF +} ComplexPlane; + +typedef enum PaletteType_enum { + IMAQ_PALETTE_GRAY = 0, // The function uses a palette that has a gradual + // gray-level variation from black to white. + IMAQ_PALETTE_BINARY = 1, // The function uses a palette of 16 cycles of 16 + // different colors that is useful with binary + // images. + IMAQ_PALETTE_GRADIENT = 2, // The function uses a palette that has a + // gradation from red to white with a prominent + // range of light blue in the upper value range. + IMAQ_PALETTE_RAINBOW = 3, // The function uses a palette that has a gradation + // from blue to red with a prominent range of + // greens in the middle value range. + IMAQ_PALETTE_TEMPERATURE = 4, // The function uses a palette that has a + // gradation from light brown to dark brown. + IMAQ_PALETTE_USER = 5, // The function uses a palette defined by the user. + IMAQ_PALETTE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} PaletteType; + +typedef enum ColorSensitivity_enum { + IMAQ_SENSITIVITY_LOW = 0, // Instructs the algorithm to divide the hue plane + // into a low number of sectors, allowing for + // simple color analysis. + IMAQ_SENSITIVITY_MED = 1, // Instructs the algorithm to divide the hue plane + // into a medium number of sectors, allowing for + // color analysis that balances sensitivity and + // complexity. + IMAQ_SENSITIVITY_HIGH = 2, // Instructs the algorithm to divide the hue plane + // into a high number of sectors, allowing for + // complex, sensitive color analysis. + IMAQ_COLOR_SENSITIVITY_SIZE_GUARD = 0xFFFFFFFF +} ColorSensitivity; + +typedef enum ColorMode_enum { + IMAQ_RGB = + 0, // The function operates in the RGB (Red, Blue, Green) color space. + IMAQ_HSL = 1, // The function operates in the HSL (Hue, Saturation, + // Luminance) color space. + IMAQ_HSV = 2, // The function operates in the HSV (Hue, Saturation, Value) + // color space. + IMAQ_HSI = 3, // The function operates in the HSI (Hue, Saturation, + // Intensity) color space. + IMAQ_CIE = 4, // The function operates in the CIE L*a*b* color space. + IMAQ_CIEXYZ = 5, // The function operates in the CIE XYZ color space. + IMAQ_COLOR_MODE_SIZE_GUARD = 0xFFFFFFFF +} ColorMode; + +typedef enum DetectionMode_enum { + IMAQ_DETECT_PEAKS = 0, // The function detects peaks. + IMAQ_DETECT_VALLEYS = 1, // The function detects valleys. + IMAQ_DETECTION_MODE_SIZE_GUARD = 0xFFFFFFFF +} DetectionMode; + +typedef enum CalibrationUnit_enum { + IMAQ_UNDEFINED = 0, // The image does not have a defined unit of measurement. + IMAQ_ANGSTROM = 1, // The unit of measure for the image is angstroms. + IMAQ_MICROMETER = 2, // The unit of measure for the image is micrometers. + IMAQ_MILLIMETER = 3, // The unit of measure for the image is millimeters. + IMAQ_CENTIMETER = 4, // The unit of measure for the image is centimeters. + IMAQ_METER = 5, // The unit of measure for the image is meters. + IMAQ_KILOMETER = 6, // The unit of measure for the image is kilometers. + IMAQ_MICROINCH = 7, // The unit of measure for the image is microinches. + IMAQ_INCH = 8, // The unit of measure for the image is inches. + IMAQ_FOOT = 9, // The unit of measure for the image is feet. + IMAQ_NAUTICMILE = 10, // The unit of measure for the image is nautical miles. + IMAQ_GROUNDMILE = 11, // The unit of measure for the image is ground miles. + IMAQ_STEP = 12, // The unit of measure for the image is steps. + IMAQ_CALIBRATION_UNIT_SIZE_GUARD = 0xFFFFFFFF +} CalibrationUnit; + +typedef enum ConcentricRakeDirection_enum { + IMAQ_COUNTER_CLOCKWISE = 0, // The function searches the search area in a + // counter-clockwise direction. + IMAQ_CLOCKWISE = + 1, // The function searches the search area in a clockwise direction. + IMAQ_CONCENTRIC_RAKE_DIRECTION_SIZE_GUARD = 0xFFFFFFFF +} ConcentricRakeDirection; + +typedef enum CalibrationMode_enum { + IMAQ_PERSPECTIVE = 0, // Functions correct for distortion caused by the + // camera's perspective. + IMAQ_NONLINEAR = + 1, // Functions correct for distortion caused by the camera's lens. + IMAQ_SIMPLE_CALIBRATION = 2, // Functions do not correct for distortion. + IMAQ_CORRECTED_IMAGE = 3, // The image is already corrected. + IMAQ_CALIBRATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} CalibrationMode; + +typedef enum BrowserLocation_enum { + IMAQ_INSERT_FIRST_FREE = + 0, // Inserts the thumbnail in the first available cell. + IMAQ_INSERT_END = 1, // Inserts the thumbnail after the last occupied cell. + IMAQ_BROWSER_LOCATION_SIZE_GUARD = 0xFFFFFFFF +} BrowserLocation; + +typedef enum BrowserFrameStyle_enum { + IMAQ_RAISED_FRAME = 0, // Each thumbnail has a raised frame. + IMAQ_BEVELLED_FRAME = 1, // Each thumbnail has a beveled frame. + IMAQ_OUTLINE_FRAME = 2, // Each thumbnail has an outlined frame. + IMAQ_HIDDEN_FRAME = 3, // Each thumbnail has a hidden frame. + IMAQ_STEP_FRAME = 4, // Each thumbnail has a stepped frame. + IMAQ_RAISED_OUTLINE_FRAME = + 5, // Each thumbnail has a raised, outlined frame. + IMAQ_BROWSER_FRAME_STYLE_SIZE_GUARD = 0xFFFFFFFF +} BrowserFrameStyle; + +typedef enum BorderMethod_enum { + IMAQ_BORDER_MIRROR = + 0, // Symmetrically copies pixel values from the image into the border. + IMAQ_BORDER_COPY = 1, // Copies the value of the pixel closest to the edge of + // the image into the border. + IMAQ_BORDER_CLEAR = 2, // Sets all pixels in the border to 0. + IMAQ_BORDER_METHOD_SIZE_GUARD = 0xFFFFFFFF +} BorderMethod; + +typedef enum BarcodeType_enum { + IMAQ_INVALID = -1, // The barcode is not of a type known by NI Vision. + IMAQ_CODABAR = 1, // The barcode is of type Codabar. + IMAQ_CODE39 = 2, // The barcode is of type Code 39. + IMAQ_CODE93 = 4, // The barcode is of type Code 93. + IMAQ_CODE128 = 8, // The barcode is of type Code 128. + IMAQ_EAN8 = 16, // The barcode is of type EAN 8. + IMAQ_EAN13 = 32, // The barcode is of type EAN 13. + IMAQ_I2_OF_5 = 64, // The barcode is of type Code 25. + IMAQ_MSI = 128, // The barcode is of type MSI code. + IMAQ_UPCA = 256, // The barcode is of type UPC A. + IMAQ_PHARMACODE = 512, // The barcode is of type Pharmacode. + IMAQ_RSS_LIMITED = 1024, // The barcode is of type RSS Limited. + IMAQ_BARCODE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} BarcodeType; + +typedef enum AxisOrientation_enum { + IMAQ_DIRECT = 0, // The y-axis direction corresponds to the y-axis direction + // of the Cartesian coordinate system. + IMAQ_INDIRECT = 1, // The y-axis direction corresponds to the y-axis + // direction of an image. + IMAQ_AXIS_ORIENTATION_SIZE_GUARD = 0xFFFFFFFF +} AxisOrientation; + +typedef enum ColorIgnoreMode_enum { + IMAQ_IGNORE_NONE = + 0, // Specifies that the function does not ignore any pixels. + IMAQ_IGNORE_BLACK = 1, // Specifies that the function ignores black pixels. + IMAQ_IGNORE_WHITE = 2, // Specifies that the function ignores white pixels. + IMAQ_IGNORE_BLACK_AND_WHITE = + 3, // Specifies that the function ignores black pixels and white pixels. + IMAQ_BLACK_WHITE_IGNORE_MODE_SIZE_GUARD = 0xFFFFFFFF +} ColorIgnoreMode; + +typedef enum LevelType_enum { + IMAQ_ABSOLUTE = 0, // The function evaluates the threshold and hysteresis + // values as absolute values. + IMAQ_RELATIVE = 1, // The function evaluates the threshold and hysteresis + // values relative to the dynamic range of the given path. + IMAQ_LEVEL_TYPE_SIZE_GUARD = 0xFFFFFFFF +} LevelType; + +typedef enum MatchingMode_enum { + IMAQ_MATCH_SHIFT_INVARIANT = 1, // Searches for occurrences of the template + // image anywhere in the searchRect, assuming + // that the pattern is not rotated more than + // plus or minus 4 degrees. + IMAQ_MATCH_ROTATION_INVARIANT = 2, // Searches for occurrences of the pattern + // in the image with no restriction on the + // rotation of the pattern. + IMAQ_MATCHING_MODE_SIZE_GUARD = 0xFFFFFFFF +} MatchingMode; + +typedef enum MappingMethod_enum { + IMAQ_FULL_DYNAMIC = 0, //(Obsolete) When the image bit depth is 0, the + //function maps the full dynamic range of the 16-bit + //image to an 8-bit scale. + IMAQ_DOWNSHIFT = 1, //(Obsolete) When the image bit depth is 0, the function + //shifts the 16-bit image pixels to the right the number + //of times specified by the shiftCount element of the + //DisplayMapping structure. + IMAQ_RANGE = 2, //(Obsolete) When the image bit depth is 0, the function maps + //the pixel values in the range specified by the minimumValue + //and maximumValue elements of the DisplayMapping structure + //to an 8-bit scale. + IMAQ_90_PCT_DYNAMIC = + 3, //(Obsolete) When the image bit depth to 0, the function maps the + //dynamic range containing the middle 90 percent of the cumulated + //histogram of the image to an 8-bit (256 grayscale values) scale. + IMAQ_PERCENT_RANGE = 4, //(Obsolete) When the image bit depth is 0, the + //function maps the pixel values in the relative + //percentage range (0 to 100) of the cumulated + //histogram specified by minimumValue and + //maximumValue to an 8-bit scale. + IMAQ_DEFAULT_MAPPING = + 10, // If the bit depth is 0, the function maps the 16-bit image to 8 + // bits by following the IMAQ_FULL_DYNAMIC_ALWAYS behavior; + // otherwise, the function shifts the image data to the right + // according to the IMAQ_MOST_SIGNIFICANT behavior. + IMAQ_MOST_SIGNIFICANT = 11, // The function shifts the 16-bit image pixels to + // the right until the 8 most significant bits of + // the image data are remaining. + IMAQ_FULL_DYNAMIC_ALWAYS = 12, // The function maps the full dynamic range of + // the 16-bit image to an 8-bit scale. + IMAQ_DOWNSHIFT_ALWAYS = 13, // The function shifts the 16-bit image pixels to + // the right the number of times specified by the + // shiftCount element of the DisplayMapping + // structure. + IMAQ_RANGE_ALWAYS = 14, // The function maps the pixel values in the range + // specified by the minimumValue and maximumValue + // elements of the DisplayMapping structure to an + // 8-bit scale. + IMAQ_90_PCT_DYNAMIC_ALWAYS = 15, // The function maps the dynamic range + // containing the middle 90 percent of the + // cumulated histogram of the image to an + // 8-bit (256 grayscale values) scale. + IMAQ_PERCENT_RANGE_ALWAYS = + 16, // The function maps the pixel values in the relative percentage + // range (0 to 100) of the cumulated histogram specified by + // minimumValue and maximumValue to an 8-bit scale. + IMAQ_MAPPING_METHOD_SIZE_GUARD = 0xFFFFFFFF +} MappingMethod; + +typedef enum ComparisonFunction_enum { + IMAQ_CLEAR_LESS = 0, // The comparison is true if the source pixel value is + // less than the comparison image pixel value. + IMAQ_CLEAR_LESS_OR_EQUAL = 1, // The comparison is true if the source pixel + // value is less than or equal to the + // comparison image pixel value. + IMAQ_CLEAR_EQUAL = 2, // The comparison is true if the source pixel value is + // equal to the comparison image pixel value. + IMAQ_CLEAR_GREATER_OR_EQUAL = 3, // The comparison is true if the source + // pixel value is greater than or equal to + // the comparison image pixel value. + IMAQ_CLEAR_GREATER = 4, // The comparison is true if the source pixel value + // is greater than the comparison image pixel value. + IMAQ_COMPARE_FUNCTION_SIZE_GUARD = 0xFFFFFFFF +} ComparisonFunction; + +typedef enum LineGaugeMethod_enum { + IMAQ_EDGE_TO_EDGE = 0, // Measures from the first edge on the line to the + // last edge on the line. + IMAQ_EDGE_TO_POINT = 1, // Measures from the first edge on the line to the + // end point of the line. + IMAQ_POINT_TO_EDGE = 2, // Measures from the start point of the line to the + // first edge on the line. + IMAQ_POINT_TO_POINT = 3, // Measures from the start point of the line to the + // end point of the line. + IMAQ_LINE_GAUGE_METHOD_SIZE_GUARD = 0xFFFFFFFF +} LineGaugeMethod; + +typedef enum Direction3D_enum { + IMAQ_3D_NW = 0, // The viewing angle for the 3D image is from the northwest. + IMAQ_3D_SW = 1, // The viewing angle for the 3D image is from the southwest. + IMAQ_3D_SE = 2, // The viewing angle for the 3D image is from the southeast. + IMAQ_3D_NE = 3, // The viewing angle for the 3D image is from the northeast. + IMAQ_DIRECTION_3D_SIZE_GUARD = 0xFFFFFFFF +} Direction3D; + +typedef enum LearningMode_enum { + IMAQ_LEARN_ALL = 0, // The function extracts information for shift- and + // rotation-invariant matching. + IMAQ_LEARN_SHIFT_INFORMATION = + 1, // The function extracts information for shift-invariant matching. + IMAQ_LEARN_ROTATION_INFORMATION = + 2, // The function extracts information for rotation-invariant matching. + IMAQ_LEARNING_MODE_SIZE_GUARD = 0xFFFFFFFF +} LearningMode; + +typedef enum KernelFamily_enum { + IMAQ_GRADIENT_FAMILY = 0, // The kernel is in the gradient family. + IMAQ_LAPLACIAN_FAMILY = 1, // The kernel is in the Laplacian family. + IMAQ_SMOOTHING_FAMILY = 2, // The kernel is in the smoothing family. + IMAQ_GAUSSIAN_FAMILY = 3, // The kernel is in the Gaussian family. + IMAQ_KERNEL_FAMILY_SIZE_GUARD = 0xFFFFFFFF +} KernelFamily; + +typedef enum InterpolationMethod_enum { + IMAQ_ZERO_ORDER = 0, // The function uses an interpolation method that + // interpolates new pixel values using the nearest valid + // neighboring pixel. + IMAQ_BILINEAR = 1, // The function uses an interpolation method that + // interpolates new pixel values using a bidirectional + // average of the neighboring pixels. + IMAQ_QUADRATIC = 2, // The function uses an interpolation method that + // interpolates new pixel values using a quadratic + // approximating polynomial. + IMAQ_CUBIC_SPLINE = 3, // The function uses an interpolation method that + // interpolates new pixel values by fitting them to a + // cubic spline curve, where the curve is based on + // known pixel values from the image. + IMAQ_BILINEAR_FIXED = 4, // The function uses an interpolation method that + // interpolates new pixel values using a + // bidirectional average of the neighboring pixels. + IMAQ_INTERPOLATION_METHOD_SIZE_GUARD = 0xFFFFFFFF +} InterpolationMethod; + +typedef enum ImageType_enum { + IMAQ_IMAGE_U8 = 0, // The image type is 8-bit unsigned integer grayscale. + IMAQ_IMAGE_U16 = 7, // The image type is 16-bit unsigned integer grayscale. + IMAQ_IMAGE_I16 = 1, // The image type is 16-bit signed integer grayscale. + IMAQ_IMAGE_SGL = 2, // The image type is 32-bit floating-point grayscale. + IMAQ_IMAGE_COMPLEX = 3, // The image type is complex. + IMAQ_IMAGE_RGB = 4, // The image type is RGB color. + IMAQ_IMAGE_HSL = 5, // The image type is HSL color. + IMAQ_IMAGE_RGB_U64 = 6, // The image type is 64-bit unsigned RGB color. + IMAQ_IMAGE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ImageType; + +typedef enum ImageFeatureMode_enum { + IMAQ_COLOR_AND_SHAPE_FEATURES = 0, // Instructs the function to use the color + // and the shape features of the color + // pattern. + IMAQ_COLOR_FEATURES = 1, // Instructs the function to use the color features + // of the color pattern. + IMAQ_SHAPE_FEATURES = 2, // Instructs the function to use the shape features + // of the color pattern. + IMAQ_FEATURE_MODE_SIZE_GUARD = 0xFFFFFFFF +} ImageFeatureMode; + +typedef enum FontColor_enum { + IMAQ_WHITE = 0, // Draws text in white. + IMAQ_BLACK = 1, // Draws text in black. + IMAQ_INVERT = 2, // Inverts the text pixels. + IMAQ_BLACK_ON_WHITE = 3, // Draws text in black with a white background. + IMAQ_WHITE_ON_BLACK = 4, // Draws text in white with a black background. + IMAQ_FONT_COLOR_SIZE_GUARD = 0xFFFFFFFF +} FontColor; + +typedef enum FlipAxis_enum { + IMAQ_HORIZONTAL_AXIS = + 0, // Flips the image over the central horizontal axis. + IMAQ_VERTICAL_AXIS = 1, // Flips the image over the central vertical axis. + IMAQ_CENTER_AXIS = + 2, // Flips the image over both the central vertical and horizontal axes. + IMAQ_DIAG_L_TO_R_AXIS = 3, // Flips the image over an axis from the upper + // left corner to lower right corner. + IMAQ_DIAG_R_TO_L_AXIS = 4, // Flips the image over an axis from the upper + // right corner to lower left corner. + IMAQ_FLIP_AXIS_SIZE_GUARD = 0xFFFFFFFF +} FlipAxis; + +typedef enum EdgeProcess_enum { + IMAQ_FIRST = 0, // The function looks for the first edge. + IMAQ_FIRST_AND_LAST = 1, // The function looks for the first and last edge. + IMAQ_ALL = 2, // The function looks for all edges. + IMAQ_BEST = 3, // The function looks for the best edge. + IMAQ_EDGE_PROCESS_SIZE_GUARD = 0xFFFFFFFF +} EdgeProcess; + +typedef enum DrawMode_enum { + IMAQ_DRAW_VALUE = + 0, // Draws the boundary of the object with the specified pixel value. + IMAQ_DRAW_INVERT = + 2, // Inverts the pixel values of the boundary of the object. + IMAQ_PAINT_VALUE = 1, // Fills the object with the given pixel value. + IMAQ_PAINT_INVERT = 3, // Inverts the pixel values of the object. + IMAQ_HIGHLIGHT_VALUE = 4, // The function fills the object by highlighting + // the enclosed pixels with the color of the + // object. + IMAQ_DRAW_MODE_SIZE_GUARD = 0xFFFFFFFF +} DrawMode; + +typedef enum NearestNeighborMetric_enum { + IMAQ_METRIC_MAXIMUM = 0, // The maximum metric. + IMAQ_METRIC_SUM = 1, // The sum metric. + IMAQ_METRIC_EUCLIDEAN = 2, // The Euclidean metric. + IMAQ_NEAREST_NEIGHBOR_METRIC_SIZE_GUARD = 0xFFFFFFFF +} NearestNeighborMetric; + +typedef enum ReadResolution_enum { + IMAQ_LOW_RESOLUTION = + 0, // Configures NI Vision to use low resolution during the read process. + IMAQ_MEDIUM_RESOLUTION = 1, // Configures NI Vision to use medium resolution + // during the read process. + IMAQ_HIGH_RESOLUTION = 2, // Configures NI Vision to use high resolution + // during the read process. + IMAQ_READ_RESOLUTION_SIZE_GUARD = 0xFFFFFFFF +} ReadResolution; + +typedef enum ThresholdMode_enum { + IMAQ_FIXED_RANGE = 0, // Performs thresholding using the values you provide + // in the lowThreshold and highThreshold elements of + // OCRProcessingOptions. + IMAQ_COMPUTED_UNIFORM = + 1, // Calculates a single threshold value for the entire ROI. + IMAQ_COMPUTED_LINEAR = 2, // Calculates a value on the left side of the ROI, + // calculates a value on the right side of the ROI, + // and linearly fills the middle values from left + // to right. + IMAQ_COMPUTED_NONLINEAR = 3, // Divides the ROI into the number of blocks + // specified by the blockCount element of + // OCRProcessingOptions and calculates a + // threshold value for each block. + IMAQ_THRESHOLD_MODE_SIZE_GUARD = 0xFFFFFFFF +} ThresholdMode; + +typedef enum ReadStrategy_enum { + IMAQ_READ_AGGRESSIVE = 0, // Configures NI Vision to perform fewer checks + // when analyzing objects to determine if they + // match trained characters. + IMAQ_READ_CONSERVATIVE = 1, // Configures NI Vision to perform more checks to + // determine if an object matches a trained + // character. + IMAQ_READ_STRATEGY_SIZE_GUARD = 0xFFFFFFFF +} ReadStrategy; + +typedef enum MeasurementType_enum { + IMAQ_MT_CENTER_OF_MASS_X = 0, // X-coordinate of the point representing the + // average position of the total particle mass, + // assuming every point in the particle has a + // constant density. + IMAQ_MT_CENTER_OF_MASS_Y = 1, // Y-coordinate of the point representing the + // average position of the total particle mass, + // assuming every point in the particle has a + // constant density. + IMAQ_MT_FIRST_PIXEL_X = + 2, // X-coordinate of the highest, leftmost particle pixel. + IMAQ_MT_FIRST_PIXEL_Y = + 3, // Y-coordinate of the highest, leftmost particle pixel. + IMAQ_MT_BOUNDING_RECT_LEFT = + 4, // X-coordinate of the leftmost particle point. + IMAQ_MT_BOUNDING_RECT_TOP = 5, // Y-coordinate of highest particle point. + IMAQ_MT_BOUNDING_RECT_RIGHT = + 6, // X-coordinate of the rightmost particle point. + IMAQ_MT_BOUNDING_RECT_BOTTOM = + 7, // Y-coordinate of the lowest particle point. + IMAQ_MT_MAX_FERET_DIAMETER_START_X = + 8, // X-coordinate of the start of the line segment connecting the two + // perimeter points that are the furthest apart. + IMAQ_MT_MAX_FERET_DIAMETER_START_Y = + 9, // Y-coordinate of the start of the line segment connecting the two + // perimeter points that are the furthest apart. + IMAQ_MT_MAX_FERET_DIAMETER_END_X = + 10, // X-coordinate of the end of the line segment connecting the two + // perimeter points that are the furthest apart. + IMAQ_MT_MAX_FERET_DIAMETER_END_Y = + 11, // Y-coordinate of the end of the line segment connecting the two + // perimeter points that are the furthest apart. + IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_LEFT = + 12, // X-coordinate of the leftmost pixel in the longest row of + // contiguous pixels in the particle. + IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_RIGHT = + 13, // X-coordinate of the rightmost pixel in the longest row of + // contiguous pixels in the particle. + IMAQ_MT_MAX_HORIZ_SEGMENT_LENGTH_ROW = + 14, // Y-coordinate of all of the pixels in the longest row of contiguous + // pixels in the particle. + IMAQ_MT_BOUNDING_RECT_WIDTH = + 16, // Distance between the x-coordinate of the leftmost particle point + // and the x-coordinate of the rightmost particle point. + IMAQ_MT_BOUNDING_RECT_HEIGHT = + 17, // Distance between the y-coordinate of highest particle point and + // the y-coordinate of the lowest particle point. + IMAQ_MT_BOUNDING_RECT_DIAGONAL = + 18, // Distance between opposite corners of the bounding rectangle. + IMAQ_MT_PERIMETER = 19, // Length of the outer boundary of the particle. + IMAQ_MT_CONVEX_HULL_PERIMETER = 20, // Perimeter of the smallest convex + // polygon containing all points in the + // particle. + IMAQ_MT_HOLES_PERIMETER = + 21, // Sum of the perimeters of each hole in the particle. + IMAQ_MT_MAX_FERET_DIAMETER = 22, // Distance between the start and end of the + // line segment connecting the two perimeter + // points that are the furthest apart. + IMAQ_MT_EQUIVALENT_ELLIPSE_MAJOR_AXIS = + 23, // Length of the major axis of the ellipse with the same perimeter + // and area as the particle. + IMAQ_MT_EQUIVALENT_ELLIPSE_MINOR_AXIS = + 24, // Length of the minor axis of the ellipse with the same perimeter + // and area as the particle. + IMAQ_MT_EQUIVALENT_ELLIPSE_MINOR_AXIS_FERET = + 25, // Length of the minor axis of the ellipse with the same area as the + // particle, and Major Axis equal in length to the Max Feret + // Diameter. + IMAQ_MT_EQUIVALENT_RECT_LONG_SIDE = 26, // Longest side of the rectangle with + // the same perimeter and area as the + // particle. + IMAQ_MT_EQUIVALENT_RECT_SHORT_SIDE = 27, // Shortest side of the rectangle + // with the same perimeter and area + // as the particle. + IMAQ_MT_EQUIVALENT_RECT_DIAGONAL = 28, // Distance between opposite corners + // of the rectangle with the same + // perimeter and area as the particle. + IMAQ_MT_EQUIVALENT_RECT_SHORT_SIDE_FERET = + 29, // Shortest side of the rectangle with the same area as the particle, + // and longest side equal in length to the Max Feret Diameter. + IMAQ_MT_AVERAGE_HORIZ_SEGMENT_LENGTH = + 30, // Average length of a horizontal segment in the particle. + IMAQ_MT_AVERAGE_VERT_SEGMENT_LENGTH = + 31, // Average length of a vertical segment in the particle. + IMAQ_MT_HYDRAULIC_RADIUS = + 32, // The particle area divided by the particle perimeter. + IMAQ_MT_WADDEL_DISK_DIAMETER = + 33, // Diameter of a disk with the same area as the particle. + IMAQ_MT_AREA = 35, // Area of the particle. + IMAQ_MT_HOLES_AREA = 36, // Sum of the areas of each hole in the particle. + IMAQ_MT_PARTICLE_AND_HOLES_AREA = + 37, // Area of a particle that completely covers the image. + IMAQ_MT_CONVEX_HULL_AREA = 38, // Area of the smallest convex polygon + // containing all points in the particle. + IMAQ_MT_IMAGE_AREA = 39, // Area of the image. + IMAQ_MT_NUMBER_OF_HOLES = 41, // Number of holes in the particle. + IMAQ_MT_NUMBER_OF_HORIZ_SEGMENTS = + 42, // Number of horizontal segments in the particle. + IMAQ_MT_NUMBER_OF_VERT_SEGMENTS = + 43, // Number of vertical segments in the particle. + IMAQ_MT_ORIENTATION = 45, // The angle of the line that passes through the + // particle Center of Mass about which the particle + // has the lowest moment of inertia. + IMAQ_MT_MAX_FERET_DIAMETER_ORIENTATION = + 46, // The angle of the line segment connecting the two perimeter points + // that are the furthest apart. + IMAQ_MT_AREA_BY_IMAGE_AREA = + 48, // Percentage of the particle Area covering the Image Area. + IMAQ_MT_AREA_BY_PARTICLE_AND_HOLES_AREA = 49, // Percentage of the particle + // Area in relation to its + // Particle and Holes Area. + IMAQ_MT_RATIO_OF_EQUIVALENT_ELLIPSE_AXES = 50, // Equivalent Ellipse Major + // Axis divided by Equivalent + // Ellipse Minor Axis. + IMAQ_MT_RATIO_OF_EQUIVALENT_RECT_SIDES = + 51, // Equivalent Rect Long Side divided by Equivalent Rect Short Side. + IMAQ_MT_ELONGATION_FACTOR = + 53, // Max Feret Diameter divided by Equivalent Rect Short Side (Feret). + IMAQ_MT_COMPACTNESS_FACTOR = 54, // Area divided by the product of Bounding + // Rect Width and Bounding Rect Height. + IMAQ_MT_HEYWOOD_CIRCULARITY_FACTOR = 55, // Perimeter divided by the + // circumference of a circle with + // the same area. + IMAQ_MT_TYPE_FACTOR = 56, // Factor relating area to moment of inertia. + IMAQ_MT_SUM_X = 58, // The sum of all x-coordinates in the particle. + IMAQ_MT_SUM_Y = 59, // The sum of all y-coordinates in the particle. + IMAQ_MT_SUM_XX = 60, // The sum of all x-coordinates squared in the particle. + IMAQ_MT_SUM_XY = + 61, // The sum of all x-coordinates times y-coordinates in the particle. + IMAQ_MT_SUM_YY = 62, // The sum of all y-coordinates squared in the particle. + IMAQ_MT_SUM_XXX = 63, // The sum of all x-coordinates cubed in the particle. + IMAQ_MT_SUM_XXY = 64, // The sum of all x-coordinates squared times + // y-coordinates in the particle. + IMAQ_MT_SUM_XYY = 65, // The sum of all x-coordinates times y-coordinates + // squared in the particle. + IMAQ_MT_SUM_YYY = 66, // The sum of all y-coordinates cubed in the particle. + IMAQ_MT_MOMENT_OF_INERTIA_XX = + 68, // The moment of inertia in the x-direction twice. + IMAQ_MT_MOMENT_OF_INERTIA_XY = + 69, // The moment of inertia in the x and y directions. + IMAQ_MT_MOMENT_OF_INERTIA_YY = + 70, // The moment of inertia in the y-direction twice. + IMAQ_MT_MOMENT_OF_INERTIA_XXX = + 71, // The moment of inertia in the x-direction three times. + IMAQ_MT_MOMENT_OF_INERTIA_XXY = 72, // The moment of inertia in the + // x-direction twice and the y-direction + // once. + IMAQ_MT_MOMENT_OF_INERTIA_XYY = 73, // The moment of inertia in the + // x-direction once and the y-direction + // twice. + IMAQ_MT_MOMENT_OF_INERTIA_YYY = + 74, // The moment of inertia in the y-direction three times. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_XX = + 75, // The normalized moment of inertia in the x-direction twice. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_XY = + 76, // The normalized moment of inertia in the x- and y-directions. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_YY = + 77, // The normalized moment of inertia in the y-direction twice. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXX = + 78, // The normalized moment of inertia in the x-direction three times. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_XXY = 79, // The normalized moment of inertia + // in the x-direction twice and the + // y-direction once. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_XYY = 80, // The normalized moment of inertia + // in the x-direction once and the + // y-direction twice. + IMAQ_MT_NORM_MOMENT_OF_INERTIA_YYY = + 81, // The normalized moment of inertia in the y-direction three times. + IMAQ_MT_HU_MOMENT_1 = 82, // The first Hu moment. + IMAQ_MT_HU_MOMENT_2 = 83, // The second Hu moment. + IMAQ_MT_HU_MOMENT_3 = 84, // The third Hu moment. + IMAQ_MT_HU_MOMENT_4 = 85, // The fourth Hu moment. + IMAQ_MT_HU_MOMENT_5 = 86, // The fifth Hu moment. + IMAQ_MT_HU_MOMENT_6 = 87, // The sixth Hu moment. + IMAQ_MT_HU_MOMENT_7 = 88, // The seventh Hu moment. + IMAQ_MEASUREMENT_TYPE_SIZE_GUARD = 0xFFFFFFFF +} MeasurementType; + +typedef enum GeometricMatchingMode_enum { + IMAQ_GEOMETRIC_MATCH_SHIFT_INVARIANT = + 0, // Searches for occurrences of the pattern in the image, assuming that + // the pattern is not rotated more than plus or minus 5 degrees. + IMAQ_GEOMETRIC_MATCH_ROTATION_INVARIANT = + 1, // Searches for occurrences of the pattern in the image with reduced + // restriction on the rotation of the pattern. + IMAQ_GEOMETRIC_MATCH_SCALE_INVARIANT = + 2, // Searches for occurrences of the pattern in the image with reduced + // restriction on the size of the pattern. + IMAQ_GEOMETRIC_MATCH_OCCLUSION_INVARIANT = + 4, // Searches for occurrences of the pattern in the image, allowing for + // a specified percentage of the pattern to be occluded. + IMAQ_GEOMETRIC_MATCHING_MODE_SIZE_GUARD = 0xFFFFFFFF +} GeometricMatchingMode; + +typedef enum ButtonLabel_enum { + IMAQ_BUTTON_OK = 0, // The label "OK". + IMAQ_BUTTON_SAVE = 1, // The label "Save". + IMAQ_BUTTON_SELECT = 2, // The label "Select". + IMAQ_BUTTON_LOAD = 3, // The label "Load". + IMAQ_BUTTON_LABEL_SIZE_GUARD = 0xFFFFFFFF +} ButtonLabel; + +typedef enum NearestNeighborMethod_enum { + IMAQ_MINIMUM_MEAN_DISTANCE = 0, // The minimum mean distance method. + IMAQ_K_NEAREST_NEIGHBOR = 1, // The k-nearest neighbor method. + IMAQ_NEAREST_PROTOTYPE = 2, // The nearest prototype method. + IMAQ_NEAREST_NEIGHBOR_METHOD_SIZE_GUARD = 0xFFFFFFFF +} NearestNeighborMethod; + +typedef enum QRMirrorMode_enum { + IMAQ_QR_MIRROR_MODE_AUTO_DETECT = + -2, // The function should determine if the QR code is mirrored. + IMAQ_QR_MIRROR_MODE_MIRRORED = + 1, // The function should expect the QR code to appear mirrored. + IMAQ_QR_MIRROR_MODE_NORMAL = + 0, // The function should expect the QR code to appear normal. + IMAQ_QR_MIRROR_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRMirrorMode; + +typedef enum ColumnProcessingMode_enum { + IMAQ_AVERAGE_COLUMNS = 0, // Averages the data extracted for edge detection. + IMAQ_MEDIAN_COLUMNS = + 1, // Takes the median of the data extracted for edge detection. + IMAQ_COLUMN_PROCESSING_MODE_SIZE_GUARD = 0xFFFFFFFF +} ColumnProcessingMode; + +typedef enum FindReferenceDirection_enum { + IMAQ_LEFT_TO_RIGHT_DIRECT = 0, // Searches from the left side of the search + // area to the right side of the search area + // for a direct axis. + IMAQ_LEFT_TO_RIGHT_INDIRECT = 1, // Searches from the left side of the search + // area to the right side of the search area + // for an indirect axis. + IMAQ_TOP_TO_BOTTOM_DIRECT = 2, // Searches from the top of the search area to + // the bottom of the search area for a direct + // axis. + IMAQ_TOP_TO_BOTTOM_INDIRECT = 3, // Searches from the top of the search area + // to the bottom of the search area for an + // indirect axis. + IMAQ_RIGHT_TO_LEFT_DIRECT = 4, // Searches from the right side of the search + // area to the left side of the search area + // for a direct axis. + IMAQ_RIGHT_TO_LEFT_INDIRECT = 5, // Searches from the right side of the + // search area to the left side of the + // search area for an indirect axis. + IMAQ_BOTTOM_TO_TOP_DIRECT = 6, // Searches from the bottom of the search area + // to the top of the search area for a direct + // axis. + IMAQ_BOTTOM_TO_TOP_INDIRECT = 7, // Searches from the bottom of the search + // area to the top of the search area for an + // indirect axis. + IMAQ_FIND_COORD_SYS_DIR_SIZE_GUARD = 0xFFFFFFFF +} FindReferenceDirection; + +typedef enum MulticoreOperation_enum { + IMAQ_GET_CORES = + 0, // The number of processor cores NI Vision is currently using. + IMAQ_SET_CORES = 1, // The number of processor cores for NI Vision to use. + IMAQ_USE_MAX_AVAILABLE = + 2, // Use the maximum number of available processor cores. + IMAQ_MULTICORE_OPERATION_SIZE_GUARD = 0xFFFFFFFF +} MulticoreOperation; + +typedef enum GroupBehavior_enum { + IMAQ_GROUP_CLEAR = 0, // Sets the behavior of the overlay group to clear the + // current settings when an image is transformed. + IMAQ_GROUP_KEEP = 1, // Sets the behavior of the overlay group to keep the + // current settings when an image is transformed. + IMAQ_GROUP_TRANSFORM = + 2, // Sets the behavior of the overlay group to transform with the image. + IMAQ_GROUP_BEHAVIOR_SIZE_GUARD = 0xFFFFFFFF +} GroupBehavior; + +typedef enum QRDimensions_enum { + IMAQ_QR_DIMENSIONS_AUTO_DETECT = 0, // The function will automatically + // determine the dimensions of the QR + // code. + IMAQ_QR_DIMENSIONS_11x11 = + 11, // Specifies the dimensions of the QR code as 11 x 11. + IMAQ_QR_DIMENSIONS_13x13 = + 13, // Specifies the dimensions of the QR code as 13 x 13. + IMAQ_QR_DIMENSIONS_15x15 = + 15, // Specifies the dimensions of the QR code as 15 x 15. + IMAQ_QR_DIMENSIONS_17x17 = + 17, // Specifies the dimensions of the QR code as 17 x 17. + IMAQ_QR_DIMENSIONS_21x21 = + 21, // Specifies the dimensions of the QR code as 21 x 21. + IMAQ_QR_DIMENSIONS_25x25 = + 25, // Specifies the dimensions of the QR code as 25 x 25. + IMAQ_QR_DIMENSIONS_29x29 = + 29, // Specifies the dimensions of the QR code as 29 x 29. + IMAQ_QR_DIMENSIONS_33x33 = + 33, // Specifies the dimensions of the QR code as 33 x 33. + IMAQ_QR_DIMENSIONS_37x37 = + 37, // Specifies the dimensions of the QR code as 37 x 37. + IMAQ_QR_DIMENSIONS_41x41 = + 41, // Specifies the dimensions of the QR code as 41 x 41. + IMAQ_QR_DIMENSIONS_45x45 = + 45, // Specifies the dimensions of the QR code as 45 x 45. + IMAQ_QR_DIMENSIONS_49x49 = + 49, // Specifies the dimensions of the QR code as 49 x 49. + IMAQ_QR_DIMENSIONS_53x53 = + 53, // Specifies the dimensions of the QR code as 53 x 53. + IMAQ_QR_DIMENSIONS_57x57 = + 57, // Specifies the dimensions of the QR code as 57 x 57. + IMAQ_QR_DIMENSIONS_61x61 = + 61, // Specifies the dimensions of the QR code as 61 x 61. + IMAQ_QR_DIMENSIONS_65x65 = + 65, // Specifies the dimensions of the QR code as 65 x 65. + IMAQ_QR_DIMENSIONS_69x69 = + 69, // Specifies the dimensions of the QR code as 69 x 69. + IMAQ_QR_DIMENSIONS_73x73 = + 73, // Specifies the dimensions of the QR code as 73 x 73. + IMAQ_QR_DIMENSIONS_77x77 = + 77, // Specifies the dimensions of the QR code as 77 x 77. + IMAQ_QR_DIMENSIONS_81x81 = + 81, // Specifies the dimensions of the QR code as 81 x 81. + IMAQ_QR_DIMENSIONS_85x85 = + 85, // Specifies the dimensions of the QR code as 85 x 85. + IMAQ_QR_DIMENSIONS_89x89 = + 89, // Specifies the dimensions of the QR code as 89 x 89. + IMAQ_QR_DIMENSIONS_93x93 = + 93, // Specifies the dimensions of the QR code as 93 x 93. + IMAQ_QR_DIMENSIONS_97x97 = + 97, // Specifies the dimensions of the QR code as 97 x 97. + IMAQ_QR_DIMENSIONS_101x101 = + 101, // Specifies the dimensions of the QR code as 101 x 101. + IMAQ_QR_DIMENSIONS_105x105 = + 105, // Specifies the dimensions of the QR code as 105 x 105. + IMAQ_QR_DIMENSIONS_109x109 = + 109, // Specifies the dimensions of the QR code as 109 x 109. + IMAQ_QR_DIMENSIONS_113x113 = + 113, // Specifies the dimensions of the QR code as 113 x 113. + IMAQ_QR_DIMENSIONS_117x117 = + 117, // Specifies the dimensions of the QR code as 117 x 117. + IMAQ_QR_DIMENSIONS_121x121 = + 121, // Specifies the dimensions of the QR code as 121 x 121. + IMAQ_QR_DIMENSIONS_125x125 = + 125, // Specifies the dimensions of the QR code as 125 x 125. + IMAQ_QR_DIMENSIONS_129x129 = + 129, // Specifies the dimensions of the QR code as 129 x 129. + IMAQ_QR_DIMENSIONS_133x133 = + 133, // Specifies the dimensions of the QR code as 133 x 133. + IMAQ_QR_DIMENSIONS_137x137 = + 137, // Specifies the dimensions of the QR code as 137 x 137. + IMAQ_QR_DIMENSIONS_141x141 = + 141, // Specifies the dimensions of the QR code as 141 x 141. + IMAQ_QR_DIMENSIONS_145x145 = + 145, // Specifies the dimensions of the QR code as 145 x 145. + IMAQ_QR_DIMENSIONS_149x149 = + 149, // Specifies the dimensions of the QR code as 149 x 149. + IMAQ_QR_DIMENSIONS_153x153 = + 153, // Specifies the dimensions of the QR code as 153 x 153. + IMAQ_QR_DIMENSIONS_157x157 = + 157, // Specifies the dimensions of the QR code as 157 x 1537. + IMAQ_QR_DIMENSIONS_161x161 = + 161, // Specifies the dimensions of the QR code as 161 x 161. + IMAQ_QR_DIMENSIONS_165x165 = + 165, // Specifies the dimensions of the QR code as 165 x 165. + IMAQ_QR_DIMENSIONS_169x169 = + 169, // Specifies the dimensions of the QR code as 169 x 169. + IMAQ_QR_DIMENSIONS_173x173 = + 173, // Specifies the dimensions of the QR code as 173 x 173. + IMAQ_QR_DIMENSIONS_177x177 = + 177, // Specifies the dimensions of the QR code as 177 x 177. + IMAQ_QR_DIMENSIONS_SIZE_GUARD = 0xFFFFFFFF +} QRDimensions; + +typedef enum QRCellFilterMode_enum { + IMAQ_QR_CELL_FILTER_MODE_AUTO_DETECT = + -2, // The function will try all filter modes and uses the one that + // decodes the QR code within the fewest iterations and utilizing the + // least amount of error correction. + IMAQ_QR_CELL_FILTER_MODE_AVERAGE = 0, // The function sets the pixel value + // for the cell to the average of the + // sampled pixels. + IMAQ_QR_CELL_FILTER_MODE_MEDIAN = 1, // The function sets the pixel value for + // the cell to the median of the sampled + // pixels. + IMAQ_QR_CELL_FILTER_MODE_CENTRAL_AVERAGE = + 2, // The function sets the pixel value for the cell to the average of + // the pixels in the center of the cell sample. + IMAQ_QR_CELL_FILTER_MODE_HIGH_AVERAGE = + 3, // The function sets the pixel value for the cell to the average value + // of the half of the sampled pixels with the highest pixel values. + IMAQ_QR_CELL_FILTER_MODE_LOW_AVERAGE = + 4, // The function sets the pixel value for the cell to the average value + // of the half of the sampled pixels with the lowest pixel values. + IMAQ_QR_CELL_FILTER_MODE_VERY_HIGH_AVERAGE = + 5, // The function sets the pixel value for the cell to the average value + // of the ninth of the sampled pixels with the highest pixel values. + IMAQ_QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE = + 6, // The function sets the pixel value for the cell to the average value + // of the ninth of the sampled pixels with the lowest pixel values. + IMAQ_QR_CELL_FILTER_MODE_ALL = + 8, // The function tries each filter mode, starting with + // IMAQ_QR_CELL_FILTER_MODE_AVERAGE and ending with + // IMAQ_QR_CELL_FILTER_MODE_VERY_LOW_AVERAGE, stopping once a filter + // mode decodes correctly. + IMAQ_QR_CELL_FILTER_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRCellFilterMode; + +typedef enum RoundingMode_enum { + IMAQ_ROUNDING_MODE_OPTIMIZE = + 0, // Rounds the result of a division using the best available method. + IMAQ_ROUNDING_MODE_TRUNCATE = 1, // Truncates the result of a division. + IMAQ_ROUNDING_MODE_SIZE_GUARD = 0xFFFFFFFF +} RoundingMode; + +typedef enum QRDemodulationMode_enum { + IMAQ_QR_DEMODULATION_MODE_AUTO_DETECT = + -2, // The function will try each demodulation mode and use the one which + // decodes the QR code within the fewest iterations and utilizing the + // least amount of error correction. + IMAQ_QR_DEMODULATION_MODE_HISTOGRAM = 0, // The function uses a histogram of + // all of the QR cells to calculate + // a threshold. + IMAQ_QR_DEMODULATION_MODE_LOCAL_CONTRAST = + 1, // The function examines each of the cell's neighbors to determine if + // the cell is on or off. + IMAQ_QR_DEMODULATION_MODE_COMBINED = 2, // The function uses the histogram of + // the QR code to calculate a + // threshold. + IMAQ_QR_DEMODULATION_MODE_ALL = + 3, // The function tries IMAQ_QR_DEMODULATION_MODE_HISTOGRAM, then + // IMAQ_QR_DEMODULATION_MODE_LOCAL_CONTRAST and then + // IMAQ_QR_DEMODULATION_MODE_COMBINED, stopping once one mode is + // successful. + IMAQ_QR_DEMODULATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRDemodulationMode; + +typedef enum ContrastMode_enum { + IMAQ_ORIGINAL_CONTRAST = 0, // Instructs the geometric matching algorithm to + // find matches with the same contrast as the + // template. + IMAQ_REVERSED_CONTRAST = 1, // Instructs the geometric matching algorithm to + // find matches with the inverted contrast of the + // template. + IMAQ_BOTH_CONTRASTS = 2, // Instructs the geometric matching algorithm to + // find matches with the same and inverted contrast + // of the template. +} ContrastMode; + +typedef enum QRPolarities_enum { + IMAQ_QR_POLARITY_AUTO_DETECT = + -2, // The function should determine the polarity of the QR code. + IMAQ_QR_POLARITY_BLACK_ON_WHITE = 0, // The function should search for a QR + // code with dark data on a bright + // background. + IMAQ_QR_POLARITY_WHITE_ON_BLACK = 1, // The function should search for a QR + // code with bright data on a dark + // background. + IMAQ_QR_POLARITY_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRPolarities; + +typedef enum QRRotationMode_enum { + IMAQ_QR_ROTATION_MODE_UNLIMITED = + 0, // The function allows for unlimited rotation. + IMAQ_QR_ROTATION_MODE_0_DEGREES = + 1, // The function allows for ??? 5 degrees of rotation. + IMAQ_QR_ROTATION_MODE_90_DEGREES = + 2, // The function allows for between 85 and 95 degrees of rotation. + IMAQ_QR_ROTATION_MODE_180_DEGREES = + 3, // The function allows for between 175 and 185 degrees of rotation. + IMAQ_QR_ROTATION_MODE_270_DEGREES = + 4, // The function allows for between 265 and 275 degrees of rotation. + IMAQ_QR_ROTATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRRotationMode; + +typedef enum QRGradingMode_enum { + IMAQ_QR_NO_GRADING = + 0, // The function does not make any preparatory calculations. + IMAQ_QR_GRADING_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRGradingMode; + +typedef enum StraightEdgeSearchMode_enum { + IMAQ_USE_FIRST_RAKE_EDGES = + 0, // Fits a straight edge on the first points detected using a rake. + IMAQ_USE_BEST_RAKE_EDGES = + 1, // Fits a straight edge on the best points detected using a rake. + IMAQ_USE_BEST_HOUGH_LINE = 2, // Finds the strongest straight edge using all + // points detected on a rake. + IMAQ_USE_FIRST_PROJECTION_EDGE = + 3, // Uses the location of the first projected edge as the straight edge. + IMAQ_USE_BEST_PROJECTION_EDGE = 4, // Finds the strongest projected edge + // location to determine the straight + // edge. + IMAQ_STRAIGHT_EDGE_SEARCH_SIZE_GUARD = 0xFFFFFFFF +} StraightEdgeSearchMode; + +typedef enum SearchDirection_enum { + IMAQ_SEARCH_DIRECTION_LEFT_TO_RIGHT = 0, // Searches from the left side of + // the search area to the right side + // of the search area. + IMAQ_SEARCH_DIRECTION_RIGHT_TO_LEFT = 1, // Searches from the right side of + // the search area to the left side + // of the search area. + IMAQ_SEARCH_DIRECTION_TOP_TO_BOTTOM = 2, // Searches from the top side of the + // search area to the bottom side of + // the search area. + IMAQ_SEARCH_DIRECTION_BOTTOM_TO_TOP = 3, // Searches from the bottom side of + // the search area to the top side + // of the search area. + IMAQ_SEARCH_DIRECTION_SIZE_GUARD = 0xFFFFFFFF +} SearchDirection; + +typedef enum QRStreamMode_enum { + IMAQ_QR_MODE_NUMERIC = + 0, // Specifies that the data was encoded using numeric mode. + IMAQ_QR_MODE_ALPHANUMERIC = + 1, // Specifies that the data was encoded using alpha-numeric mode. + IMAQ_QR_MODE_RAW_BYTE = 2, // Specifies that the data was not encoded but is + // only raw binary bytes, or encoded in JIS-8. + IMAQ_QR_MODE_EAN128_TOKEN = 3, // Specifies that the data has a special + // meaning represented by the application ID. + IMAQ_QR_MODE_EAN128_DATA = 4, // Specifies that the data has a special + // meaning represented by the application ID. + IMAQ_QR_MODE_ECI = 5, // Specifies that the data was meant to be read using + // the language represented in the language ID. + IMAQ_QR_MODE_KANJI = + 6, // Specifies that the data was encoded in Shift-JIS16 Japanese. + IMAQ_QR_MODE_SIZE_GUARD = 0xFFFFFFFF +} QRStreamMode; + +typedef enum ParticleClassifierType_enum { + IMAQ_PARTICLE_LARGEST = 0, // Use only the largest particle in the image. + IMAQ_PARTICLE_ALL = 1, // Use all particles in the image. + IMAQ_PARTICLE_CLASSIFIER_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ParticleClassifierType; + +typedef enum QRCellSampleSize_enum { + IMAQ_QR_CELL_SAMPLE_SIZE_AUTO_DETECT = + -2, // The function will try each sample size and use the one which + // decodes the QR code within the fewest iterations and utilizing the + // least amount of error correction. + IMAQ_QR_CELL_SAMPLE_SIZE1X1 = + 1, // The function will use a 1x1 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE2X2 = + 2, // The function will use a 2x2 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE3X3 = + 3, // The function will use a 3x3 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE4X4 = + 4, // The function will use a 4x4 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE5X5 = + 5, // The function will use a 5x5 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE6X6 = + 6, // The function will use a 6x6 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_SIZE7X7 = + 7, // The function will use a 7x7 sized sample from each cell. + IMAQ_QR_CELL_SAMPLE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} QRCellSampleSize; + +typedef enum RakeProcessType_enum { + IMAQ_GET_FIRST_EDGES = 0, + IMAQ_GET_FIRST_AND_LAST_EDGES = 1, + IMAQ_GET_ALL_EDGES = 2, + IMAQ_GET_BEST_EDGES = 3, + IMAQ_RAKE_PROCESS_TYPE_SIZE_GUARD = 0xFFFFFFFF +} RakeProcessType; + +typedef enum GeometricSetupDataItem_enum { + IMAQ_CURVE_EXTRACTION_MODE = + 0, // Specifies how the function identifies curves in the image. + IMAQ_CURVE_EDGE_THRSHOLD = 1, // Specifies the minimum contrast an edge pixel + // must have for it to be considered part of a + // curve. + IMAQ_CURVE_EDGE_FILTER = 2, // Specifies the width of the edge filter that + // the function uses to identify curves in the + // image. + IMAQ_MINIMUM_CURVE_LENGTH = 3, // Specifies the length, in pixels, of the + // smallest curve that you want the function + // to identify. + IMAQ_CURVE_ROW_SEARCH_STEP_SIZE = + 4, // Specifies the distance, in the y direction, between the image rows + // that the algorithm inspects for curve seed points. + IMAQ_CURVE_COL_SEARCH_STEP_SIZE = + 5, // Specifies the distance, in the x direction, between the image + // columns that the algorithm inspects for curve seed points. + IMAQ_CURVE_MAX_END_POINT_GAP = + 6, // Specifies the maximum gap, in pixels, between the endpoints of a + // curve that the function identifies as a closed curve. + IMAQ_EXTRACT_CLOSED_CURVES = + 7, // Specifies whether to identify only closed curves in the image. + IMAQ_ENABLE_SUBPIXEL_CURVE_EXTRACTION = + 8, // The function ignores this option. + IMAQ_ENABLE_CORRELATION_SCORE = 9, // Specifies that the function should + // calculate the Correlation Score and + // return it for each match result. + IMAQ_ENABLE_SUBPIXEL_ACCURACY = 10, // Determines whether to return the match + // results with subpixel accuracy. + IMAQ_SUBPIXEL_ITERATIONS = 11, // Specifies the maximum number of incremental + // improvements used to refine matches using + // subpixel information. + IMAQ_SUBPIXEL_TOLERANCE = + 12, // Specifies the maximum amount of change, in pixels, between + // consecutive incremental improvements in the match position before + // the function stops refining the match position. + IMAQ_INITIAL_MATCH_LIST_LENGTH = + 13, // Specifies the maximum size of the match list. + IMAQ_ENABLE_TARGET_TEMPLATE_CURVESCORE = + 14, // Specifies whether the function should calculate the match curve to + // template curve score and return it for each match result. + IMAQ_MINIMUM_MATCH_SEPARATION_DISTANCE = + 15, // Specifies the minimum separation distance, in pixels, between the + // origins of two matches that have unique positions. + IMAQ_MINIMUM_MATCH_SEPARATION_ANGLE = + 16, // Specifies the minimum angular difference, in degrees, between two + // matches that have unique angles. + IMAQ_MINIMUM_MATCH_SEPARATION_SCALE = + 17, // Specifies the minimum difference in scale, expressed as a + // percentage, between two matches that have unique scales. + IMAQ_MAXIMUM_MATCH_OVERLAP = 18, // Specifies whether you want the algorithm + // to spend less time accurately estimating + // the location of a match. + IMAQ_ENABLE_COARSE_RESULT = 19, // Specifies whether you want the algorithm + // to spend less time accurately estimating + // the location of a match. + IMAQ_ENABLE_CALIBRATION_SUPPORT = 20, // Specifies whether or not the + // algorithm treat the inspection image + // as a calibrated image. + IMAQ_ENABLE_CONTRAST_REVERSAL = + 21, // Specifies the contrast of the matches to search for. + IMAQ_SEARCH_STRATEGY = 22, // Specifies the aggressiveness of the strategy + // used to find matches in the image. + IMAQ_REFINEMENT_MATCH_FACTOR = + 23, // Specifies the factor applied to the number of matches requested to + // determine how many matches are refined in the pyramid stage. + IMAQ_SUBPIXEL_MATCH_FACTOR = 24, // Specifies the factor applied to the + // number for matches requested to determine + // how many matches are used for the final + // (subpixel) stage. + IMAQ_MAX_REFINEMENT_ITERATIONS = + 25, // Specifies maximum refinement iteration. +} GeometricSetupDataItem; + +typedef enum DistortionModel_enum { + IMAQ_POLYNOMIAL_MODEL = 0, // Polynomial model. + IMAQ_DIVISION_MODEL = 1, // Division Model. + IMAQ_NO_DISTORTION_MODEL = -1, // Not a distortion model. +} DistortionModel; + +typedef enum CalibrationThumbnailType_enum { + IMAQ_CAMARA_MODEL_TYPE = 0, // Camara model thumbnail type. + IMAQ_PERSPECTIVE_TYPE = 1, // Perspective thumbnail type. + IMAQ_MICRO_PLANE_TYPE = 2, // Micro Plane thumbnail type. + IMAQ_CALIBRATION_THUMBNAIL_TYPE_SIZE_GUARD = 0xFFFFFFFF +} CalibrationThumbnailType; + +typedef enum SettingType_enum { + IMAQ_ROTATION_ANGLE_RANGE = 0, // Set a range for this option to specify the + // angles at which you expect the Function to + // find template matches in the inspection + // image. + IMAQ_SCALE_RANGE = 1, // Set a range for this option to specify the sizes at + // which you expect the Function to find template + // matches in the inspection image. + IMAQ_OCCLUSION_RANGE = 2, // Set a range for this option to specify the + // amount of occlusion you expect for a match in + // the inspection image. + IMAQ_SETTING_TYPE_SIZE_GUARD = 0xFFFFFFFF +} SettingType; + +typedef enum SegmentationDistanceLevel_enum { + IMAQ_SEGMENTATION_LEVEL_CONSERVATIVE = + 0, // Uses extensive criteria to determine the Maximum Distance. + IMAQ_SEGMENTATION_LEVEL_AGGRESSIVE = + 1, // Uses few criteria to determine the Maximum Distance. + IMAQ_SEGMENTATION_LEVEL_SIZE_GUARD = 0xFFFFFFFF +} SegmentationDistanceLevel; + +typedef enum ExtractContourSelection_enum { + IMAQ_CLOSEST = 0, // Selects the curve closest to the ROI. + IMAQ_LONGEST = 1, // Selects the longest curve. + IMAQ_STRONGEST = 2, // Selects the curve with the highest edge strength + // averaged from each point on the curve. + IMAQ_EXTRACT_CONTOUR_SELECTION_SIZE_GUARD = 0xFFFFFFFF +} ExtractContourSelection; + +typedef enum FindTransformMode_enum { + IMAQ_FIND_REFERENCE = 0, // Update both parts of the coordinate system. + IMAQ_UPDATE_TRANSFORM = 1, // Update only the new reference system. + IMAQ_FIND_TRANSFORM_MODE_SIZE_GUARD = 0xFFFFFFFF +} FindTransformMode; + +typedef enum ExtractContourDirection_enum { + IMAQ_RECT_LEFT_RIGHT = 0, // Searches the ROI from left to right. + IMAQ_RECT_RIGHT_LEFT = 1, // Searches the ROI from right to left. + IMAQ_RECT_TOP_BOTTOM = 2, // Searches the ROI from top to bottom. + IMAQ_RECT_BOTTOM_TOP = 3, // Searches the ROI from bottom to top. + IMAQ_ANNULUS_INNER_OUTER = + 4, // Searches the ROI from the inner radius to the outer radius. + IMAQ_ANNULUS_OUTER_INNER = + 5, // Searches the ROI from the outer radius to the inner radius. + IMAQ_ANNULUS_START_STOP = + 6, // Searches the ROI from start angle to end angle. + IMAQ_ANNULUS_STOP_START = + 7, // Searches the ROI from end angle to start angle. + IMAQ_EXTRACT_CONTOUR_DIRECTION_SIZE_GUARD = 0xFFFFFFFF +} ExtractContourDirection; + +typedef enum EdgePolaritySearchMode_enum { + IMAQ_SEARCH_FOR_ALL_EDGES = 0, // Searches for all edges. + IMAQ_SEARCH_FOR_RISING_EDGES = 1, // Searches for rising edges only. + IMAQ_SEARCH_FOR_FALLING_EDGES = 2, // Searches for falling edges only. + IMAQ_EDGE_POLARITY_MODE_SIZE_GUARD = 0xFFFFFFFF +} EdgePolaritySearchMode; + +typedef enum Connectivity_enum { + IMAQ_FOUR_CONNECTED = + 0, // Morphological reconstruction is performed in connectivity mode 4. + IMAQ_EIGHT_CONNECTED = + 1, // Morphological reconstruction is performed in connectivity mode 8. + IMAQ_CONNECTIVITY_SIZE_GUARD = 0xFFFFFFFF +} Connectivity; + +typedef enum MorphologyReconstructOperation_enum { + IMAQ_DILATE_RECONSTRUCT = 0, // Performs Reconstruction by dilation. + IMAQ_ERODE_RECONSTRUCT = 1, // Performs Reconstruction by erosion. + IMAQ_MORPHOLOGY_RECONSTRUCT_OPERATION_SIZE_GUARD = 0xFFFFFFFF +} MorphologyReconstructOperation; + +typedef enum WaveletType_enum { + IMAQ_DB02 = 0, + IMAQ_DB03 = 1, + IMAQ_DB04 = 2, // Specifies the Wavelet Type as DB02. + IMAQ_DB05 = 3, + IMAQ_DB06 = 4, + IMAQ_DB07 = 5, + IMAQ_DB08 = 6, + IMAQ_DB09 = 7, + IMAQ_DB10 = 8, + IMAQ_DB11 = 9, + IMAQ_DB12 = 10, + IMAQ_DB13 = 11, + IMAQ_DB14 = 12, + IMAQ_HAAR = 13, + IMAQ_BIOR1_3 = 14, + IMAQ_BIOR1_5 = 15, + IMAQ_BIOR2_2 = 16, + IMAQ_BIOR2_4 = 17, + IMAQ_BIOR2_6 = 18, + IMAQ_BIOR2_8 = 19, + IMAQ_BIOR3_1 = 20, + IMAQ_BIOR3_3 = 21, + IMAQ_BIOR3_5 = 22, + IMAQ_BIOR3_7 = 23, + IMAQ_BIOR3_9 = 24, + IMAQ_BIOR4_4 = 25, + IMAQ_COIF1 = 26, + IMAQ_COIF2 = 27, + IMAQ_COIF3 = 28, + IMAQ_COIF4 = 29, + IMAQ_COIF5 = 30, + IMAQ_SYM2 = 31, + IMAQ_SYM3 = 32, + IMAQ_SYM4 = 33, + IMAQ_SYM5 = 34, + IMAQ_SYM6 = 35, + IMAQ_SYM7 = 36, + IMAQ_SYM8 = 37, + IMAQ_BIOR5_5 = 38, + IMAQ_BIOR6_8 = 39, + IMAQ_WAVE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} WaveletType; + +typedef enum ParticleClassifierThresholdType_enum { + IMAQ_THRESHOLD_MANUAL = 0, // The classifier performs a manual threshold on + // the image during preprocessing. + IMAQ_THRESHOLD_AUTO = 1, // The classifier performs an auto threshold on the + // image during preprocessing. + IMAQ_THRESHOLD_LOCAL = 2, // The classifier performs a local threshold on the + // image during preprocessing. +} ParticleClassifierThresholdType; + +typedef enum MeasureParticlesCalibrationMode_enum { + IMAQ_CALIBRATION_MODE_PIXEL = 0, // The function takes only pixel + // measurements on the particles in the + // image. + IMAQ_CALIBRATION_MODE_CALIBRATED = 1, // The function takes only calibrated + // measurements on the particles in the + // image. + IMAQ_CALIBRATION_MODE_BOTH = 2, // The function takes both pixel and + // calibrated measurements on the particles + // in the image. + IMAQ_MEASURE_PARTICLES_CALIBRATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} MeasureParticlesCalibrationMode; + +typedef enum GeometricMatchingSearchStrategy_enum { + IMAQ_GEOMETRIC_MATCHING_CONSERVATIVE = + 0, // Instructs the pattern matching algorithm to use the largest + // possible amount of information from the image at the expense of + // slowing down the speed of the algorithm. + IMAQ_GEOMETRIC_MATCHING_BALANCED = + 1, // Instructs the pattern matching algorithm to balance the amount of + // information from the image it uses with the speed of the algorithm. + IMAQ_GEOMETRIC_MATCHING_AGGRESSIVE = + 2, // Instructs the pattern matching algorithm to use a lower amount of + // information from the image, which allows the algorithm to run + // quickly but at the expense of accuracy. + IMAQ_GEOMETRIC_MATCHING_SEARCH_STRATEGY_SIZE_GUARD = 0xFFFFFFFF +} GeometricMatchingSearchStrategy; + +typedef enum ColorClassificationResolution_enum { + IMAQ_CLASSIFIER_LOW_RESOLUTION = + 0, // Low resolution version of the color classifier. + IMAQ_CLASSIFIER_MEDIUM_RESOLUTION = + 1, // Medium resolution version of the color classifier. + IMAQ_CLASSIFIER_HIGH_RESOLUTION = + 2, // High resolution version of the color classifier. + IMAQ_CLASSIFIER_RESOLUTION_SIZE_GUARD = 0xFFFFFFFF +} ColorClassificationResolution; + +typedef enum ConnectionConstraintType_enum { + IMAQ_DISTANCE_CONSTRAINT = 0, // Specifies the distance, in pixels, within + // which the end points of two curves must lie + // in order to be considered part of a contour. + IMAQ_ANGLE_CONSTRAINT = + 1, // Specifies the range, in degrees, within which the difference + // between the angle of two curves, measured at the end points, must + // lie in order for the two curves to be considered part of a contour. + IMAQ_CONNECTIVITY_CONSTRAINT = + 2, // Specifies the distance, in pixels, within which a line extended + // from the end point of a curve must pass the end point of another + // curve in order for the two curves to be considered part of a + // contour. + IMAQ_GRADIENT_CONSTRAINT = + 3, // Specifies the range, in degrees, within which the gradient angles + // of two curves, measured at the end points, must lie in order for + // the two curves to be considered part of a contour. + IMAQ_NUM_CONNECTION_CONSTRAINT_TYPES = 4, //. + IMAQ_CONNECTION_CONSTRAINT_SIZE_GUARD = 0xFFFFFFFF +} ConnectionConstraintType; + +typedef enum Barcode2DContrast_enum { + IMAQ_ALL_BARCODE_2D_CONTRASTS = + 0, // The function searches for barcodes of each contrast type. + IMAQ_BLACK_ON_WHITE_BARCODE_2D = 1, // The function searches for 2D barcodes + // containing black data on a white + // background. + IMAQ_WHITE_ON_BLACK_BARCODE_2D = 2, // The function searches for 2D barcodes + // containing white data on a black + // background. + IMAQ_BARCODE_2D_CONTRAST_SIZE_GUARD = 0xFFFFFFFF +} Barcode2DContrast; + +typedef enum QRModelType_enum { + IMAQ_QR_MODELTYPE_AUTO_DETECT = + 0, // Specifies that the function will auto-detect the type of QR code. + IMAQ_QR_MODELTYPE_MICRO = 1, // Specifies the QR code is of a micro type. + IMAQ_QR_MODELTYPE_MODEL1 = 2, // Specifies the QR code is of a model1 type. + IMAQ_QR_MODELTYPE_MODEL2 = 3, // Specifies the QR code is of a model2 type. + IMAQ_QR_MODEL_TYPE_SIZE_GUARD = 0xFFFFFFFF +} QRModelType; + +typedef enum WindowBackgroundFillStyle_enum { + IMAQ_FILL_STYLE_SOLID = 0, // Fill the display window with a solid color. + IMAQ_FILL_STYLE_HATCH = 2, // Fill the display window with a pattern defined + // by WindowBackgroundHatchStyle. + IMAQ_FILL_STYLE_DEFAULT = + 3, // Fill the display window with the NI Vision default pattern. + IMAQ_FILL_STYLE_SIZE_GUARD = 0xFFFFFFFF +} WindowBackgroundFillStyle; + +typedef enum ExtractionMode_enum { + IMAQ_NORMAL_IMAGE = 0, // Specifies that the function makes no assumptions + // about the uniformity of objects in the image or the + // image background. + IMAQ_UNIFORM_REGIONS = 1, // Specifies that the function assumes that either + // the objects in the image or the image background + // consists of uniform pixel values. + IMAQ_EXTRACTION_MODE_SIZE_GUARD = 0xFFFFFFFF +} ExtractionMode; + +typedef enum EdgeFilterSize_enum { + IMAQ_FINE = + 0, // Specifies that the function uses a fine (narrow) edge filter. + IMAQ_NORMAL = 1, // Specifies that the function uses a normal edge filter. + IMAQ_CONTOUR_TRACING = 2, // Sets the Edge Filter Size to contour tracing, + // which provides the best results for contour + // extraction but increases the time required to + // process the image. + IMAQ_EDGE_FILTER_SIZE_SIZE_GUARD = 0xFFFFFFFF +} EdgeFilterSize; + +typedef enum Barcode2DSearchMode_enum { + IMAQ_SEARCH_MULTIPLE = 0, // The function searches for multiple 2D barcodes. + IMAQ_SEARCH_SINGLE_CONSERVATIVE = + 1, // The function searches for 2D barcodes using the same searching + // algorithm as IMAQ_SEARCH_MULTIPLE but stops searching after + // locating one valid barcode. + IMAQ_SEARCH_SINGLE_AGGRESSIVE = + 2, // The function searches for a single 2D barcode using a method that + // assumes the barcode occupies a majority of the search region. + IMAQ_BARCODE_2D_SEARCH_MODE_SIZE_GUARD = 0xFFFFFFFF +} Barcode2DSearchMode; + +typedef enum DataMatrixSubtype_enum { + IMAQ_ALL_DATA_MATRIX_SUBTYPES = + 0, // The function searches for Data Matrix barcodes of all subtypes. + IMAQ_DATA_MATRIX_SUBTYPES_ECC_000_ECC_140 = + 1, // The function searches for Data Matrix barcodes of subtypes ECC 000, + // ECC 050, ECC 080, ECC 100 and ECC 140. + IMAQ_DATA_MATRIX_SUBTYPE_ECC_200 = + 2, // The function searches for Data Matrix ECC 200 barcodes. + IMAQ_DATA_MATRIX_SUBTYPE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixSubtype; + +typedef enum FeatureType_enum { + IMAQ_NOT_FOUND_FEATURE = 0, // Specifies the feature is not found. + IMAQ_CIRCLE_FEATURE = 1, // Specifies the feature is a circle. + IMAQ_ELLIPSE_FEATURE = 2, // Specifies the feature is an ellipse. + IMAQ_CONST_CURVE_FEATURE = 3, // Specifies the features is a constant curve. + IMAQ_RECTANGLE_FEATURE = 4, // Specifies the feature is a rectangle. + IMAQ_LEG_FEATURE = 5, // Specifies the feature is a leg. + IMAQ_CORNER_FEATURE = 6, // Specifies the feature is a corner. + IMAQ_PARALLEL_LINE_PAIR_FEATURE = + 7, // Specifies the feature is a parallel line pair. + IMAQ_PAIR_OF_PARALLEL_LINE_PAIRS_FEATURE = + 8, // Specifies the feature is a pair of parallel line pairs. + IMAQ_LINE_FEATURE = 9, // Specifies the feature is a line. + IMAQ_CLOSED_CURVE_FEATURE = 10, // Specifies the feature is a closed curve. + IMAQ_FEATURE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} FeatureType; + +typedef enum Barcode2DCellShape_enum { + IMAQ_SQUARE_CELLS = 0, // The function uses an algorithm for decoding the 2D + // barcode that works with square data cells. + IMAQ_ROUND_CELLS = 1, // The function uses an algorithm for decoding the 2D + // barcode that works with round data cells. + IMAQ_BARCODE_2D_CELL_SHAPE_SIZE_GUARD = 0xFFFFFFFF +} Barcode2DCellShape; + +typedef enum LocalThresholdMethod_enum { + IMAQ_NIBLACK = 0, // The function computes thresholds for each pixel based on + // its local statistics using the Niblack local + // thresholding algorithm. + IMAQ_BACKGROUND_CORRECTION = + 1, // The function performs background correction first to eliminate + // non-uniform lighting effects, then performs thresholding using the + // Otsu thresholding algorithm. + IMAQ_LOCAL_THRESHOLD_METHOD_SIZE_GUARD = 0xFFFFFFFF +} LocalThresholdMethod; + +typedef enum Barcode2DType_enum { + IMAQ_PDF417 = 0, // The 2D barcode is of type PDF417. + IMAQ_DATA_MATRIX_ECC_000 = + 1, // The 2D barcode is of type Data Matrix ECC 000. + IMAQ_DATA_MATRIX_ECC_050 = + 2, // The 2D barcode is of type Data Matrix ECC 050. + IMAQ_DATA_MATRIX_ECC_080 = + 3, // The 2D barcode is of type Data Matrix ECC 080. + IMAQ_DATA_MATRIX_ECC_100 = + 4, // The 2D barcode is of type Data Matrix ECC 100. + IMAQ_DATA_MATRIX_ECC_140 = + 5, // The 2D barcode is of type Data Matrix ECC 140. + IMAQ_DATA_MATRIX_ECC_200 = + 6, // The 2D barcode is of type Data Matrix ECC 200. + IMAQ_BARCODE_2D_TYPE_SIZE_GUARD = 0xFFFFFFFF +} Barcode2DType; + +typedef enum ClassifierEngineType_enum { + IMAQ_ENGINE_NONE = 0, // No engine has been set on this classifier session. + IMAQ_ENGINE_NEAREST_NEIGHBOR = 1, // Nearest neighbor engine. + IMAQ_ENGINE_SUPPORT_VECTOR_MACHINE = 2, + IMAQ_CLASSIFIER_ENGINE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ClassifierEngineType; + +typedef enum ClassifierType_enum { + IMAQ_CLASSIFIER_CUSTOM = + 0, // The classifier session classifies vectors of doubles. + IMAQ_CLASSIFIER_PARTICLE = + 1, // The classifier session classifies particles in binary images. + IMAQ_CLASSIFIER_COLOR = + 2, // The classifier session classifies an image based on its color. + IMAQ_CLASSIFIER_TEXTURE = + 3, // The classifier session classifies an image based on its texture. + IMAQ_CLASSIFIER_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ClassifierType; + +typedef enum ParticleType_enum { + IMAQ_PARTICLE_BRIGHT = 0, // Bright particles. + IMAQ_PARTICLE_DARK = 1, // Dark particles. + IMAQ_PARTICLE_TYPE_SIZE_GUARD = 0xFFFFFFFF +} ParticleType; + +typedef enum VisionInfoType2_enum { + IMAQ_VISIONINFO_CALIBRATION = 0x01, // Used to indicate interaction with the + // Calibration information in an image. + IMAQ_VISIONINFO_OVERLAY = 0x02, // Used to indicate interaction with the + // Overlay information in an image. + IMAQ_VISIONINFO_GRAYTEMPLATE = 0x04, // Used to indicate interaction with the + // grayscale template information in an + // image. + IMAQ_VISIONINFO_COLORTEMPLATE = 0x08, // Used to indicate interaction with + // the color template information in an + // image. + IMAQ_VISIONINFO_GEOMETRICTEMPLATE = 0x10, // Used to indicate interaction + // with the geometric template + // information in an image. + IMAQ_VISIONINFO_CUSTOMDATA = 0x20, // Used to indicate interaction with the + // binary or text Custom Data in an image. + IMAQ_VISIONINFO_GOLDENTEMPLATE = 0x40, // Used to indicate interaction with + // the golden template information in + // an image. + IMAQ_VISIONINFO_GEOMETRICTEMPLATE2 = 0x80, // Used to indicate interaction + // with the geometric template 2 + // information in an image. + IMAQ_VISIONINFO_ALL = 0xFFFFFFFF, // Removes, checks for, or indicates the + // presence of all types of extra + // information in an image. +} VisionInfoType2; + +typedef enum ReadClassifierFileMode_enum { + IMAQ_CLASSIFIER_READ_ALL = + 0, // Read all information from the classifier file. + IMAQ_CLASSIFIER_READ_SAMPLES = + 1, // Read only the samples from the classifier file. + IMAQ_CLASSIFIER_READ_PROPERTIES = + 2, // Read only the properties from the classifier file. + IMAQ_READ_CLASSIFIER_FILE_MODES_SIZE_GUARD = 0xFFFFFFFF +} ReadClassifierFileMode; + +typedef enum WriteClassifierFileMode_enum { + IMAQ_CLASSIFIER_WRITE_ALL = + 0, // Writes all information to the classifier file. + IMAQ_CLASSIFIER_WRITE_CLASSIFY_ONLY = 1, // Write only the information needed + // to classify to the classifier + // file. + IMAQ_WRITE_CLASSIFIER_FILE_MODES_SIZE_GUARD = 0xFFFFFFFF +} WriteClassifierFileMode; + +typedef enum Barcode2DShape_enum { + IMAQ_SQUARE_BARCODE_2D = 0, // The function searches for square 2D barcodes. + IMAQ_RECTANGULAR_BARCODE_2D = + 1, // The function searches for rectangular 2D barcodes. + IMAQ_BARCODE_2D_SHAPE_SIZE_GUARD = 0xFFFFFFFF +} Barcode2DShape; + +typedef enum DataMatrixRotationMode_enum { + IMAQ_UNLIMITED_ROTATION = 0, // The function allows for unlimited rotation. + IMAQ_0_DEGREES = + 1, // The function allows for between -5 and 5 degrees of rotation. + IMAQ_90_DEGREES = + 2, // The function allows for between 85 and 95 degrees of rotation. + IMAQ_180_DEGREES = + 3, // The function allows for between 175 and 185 degrees of rotation. + IMAQ_270_DEGREES = + 4, // The function allows for between 265 and 275 degrees of rotation. + IMAQ_DATA_MATRIX_ROTATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixRotationMode; + +typedef enum AIMGrade_enum { + IMAQ_AIM_GRADE_F = 0, // The Data Matrix barcode received a grade of F. + IMAQ_AIM_GRADE_D = 1, // The Data Matrix barcode received a grade of D. + IMAQ_AIM_GRADE_C = 2, // The Data Matrix barcode received a grade of C. + IMAQ_AIM_GRADE_B = 3, // The Data Matrix barcode received a grade of B. + IMAQ_AIM_GRADE_A = 4, // The Data Matrix barcode received a grade of A. + IMAQ_DATA_MATRIX_AIM_GRADE_SIZE_GUARD = 0xFFFFFFFF +} AIMGrade; + +typedef enum DataMatrixCellFillMode_enum { + IMAQ_AUTO_DETECT_CELL_FILL_MODE = -2, // Sets the function to determine the + // Data Matrix barcode cell fill + // percentage automatically. + IMAQ_LOW_FILL = 0, // Sets the function to read Data Matrix barcodes with a + // cell fill percentage of less than 30 percent. + IMAQ_NORMAL_FILL = 1, // Sets the function to read Data Matrix barcodes with + // a cell fill percentage greater than or equal to 30 + // percent. + IMAQ_DATA_MATRIX_CELL_FILL_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixCellFillMode; + +typedef enum DataMatrixDemodulationMode_enum { + IMAQ_AUTO_DETECT_DEMODULATION_MODE = + -2, // The function will try each demodulation mode and use the one which + // decodes the Data Matrix barcode within the fewest iterations and + // utilizing the least amount of error correction. + IMAQ_HISTOGRAM = 0, // The function uses a histogram of all of the Data + // Matrix cells to calculate a threshold. + IMAQ_LOCAL_CONTRAST = 1, // The function examines each of the cell's + // neighbors to determine if the cell is on or off. + IMAQ_COMBINED = 2, // The function uses the histogram of the Data Matrix + // barcode to calculate a threshold. + IMAQ_ALL_DEMODULATION_MODES = + 3, // The function tries IMAQ_HISTOGRAM, then IMAQ_LOCAL_CONTRAST and + // then IMAQ_COMBINATION, stopping once one mode is successful. + IMAQ_DATA_MATRIX_DEMODULATION_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixDemodulationMode; + +typedef enum DataMatrixECC_enum { + IMAQ_AUTO_DETECT_ECC = -2, // Sets the function to determine the Data Matrix + // barcode ECC automatically. + IMAQ_ECC_000 = + 0, // Sets the function to read Data Matrix barcodes of ECC 000 only. + IMAQ_ECC_050 = + 50, // Sets the function to read Data Matrix barcodes of ECC 050 only. + IMAQ_ECC_080 = + 80, // Sets the function to read Data Matrix barcodes of ECC 080 only. + IMAQ_ECC_100 = + 100, // Sets the function to read Data Matrix barcodes of ECC 100 only. + IMAQ_ECC_140 = + 140, // Sets the function to read Data Matrix barcodes of ECC 140 only. + IMAQ_ECC_000_140 = 190, // Sets the function to read Data Matrix barcodes of + // ECC 000, ECC 050, ECC 080, ECC 100, and ECC 140 + // only. + IMAQ_ECC_200 = + 200, // Sets the function to read Data Matrix barcodes of ECC 200 only. + IMAQ_DATA_MATRIX_ECC_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixECC; + +typedef enum DataMatrixPolarity_enum { + IMAQ_AUTO_DETECT_POLARITY = -2, // Sets the function to determine the Data + // Matrix barcode polarity automatically. + IMAQ_BLACK_DATA_ON_WHITE_BACKGROUND = 0, // Sets the function to read Data + // Matrix barcodes with dark data on + // a bright background. + IMAQ_WHITE_DATA_ON_BLACK_BACKGROUND = 1, // Sets the function to read Data + // Matrix barcodes with bright data + // on a dark background. + IMAQ_DATA_MATRIX_POLARITY_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixPolarity; + +typedef enum DataMatrixCellFilterMode_enum { + IMAQ_AUTO_DETECT_CELL_FILTER_MODE = + -2, // The function will try all filter modes and uses the one that + // decodes the Data Matrix barcode within the fewest iterations and + // utilizing the least amount of error correction. + IMAQ_AVERAGE_FILTER = 0, // The function sets the pixel value for the cell to + // the average of the sampled pixels. + IMAQ_MEDIAN_FILTER = 1, // The function sets the pixel value for the cell to + // the median of the sampled pixels. + IMAQ_CENTRAL_AVERAGE_FILTER = 2, // The function sets the pixel value for the + // cell to the average of the pixels in the + // center of the cell sample. + IMAQ_HIGH_AVERAGE_FILTER = + 3, // The function sets the pixel value for the cell to the average value + // of the half of the sampled pixels with the highest pixel values. + IMAQ_LOW_AVERAGE_FILTER = 4, // The function sets the pixel value for the + // cell to the average value of the half of the + // sampled pixels with the lowest pixel values. + IMAQ_VERY_HIGH_AVERAGE_FILTER = + 5, // The function sets the pixel value for the cell to the average value + // of the ninth of the sampled pixels with the highest pixel values. + IMAQ_VERY_LOW_AVERAGE_FILTER = + 6, // The function sets the pixel value for the cell to the average value + // of the ninth of the sampled pixels with the lowest pixel values. + IMAQ_ALL_CELL_FILTERS = 8, // The function tries each filter mode, starting + // with IMAQ_AVERAGE_FILTER and ending with + // IMAQ_VERY_LOW_AVERAGE_FILTER, stopping once a + // filter mode decodes correctly. + IMAQ_DATA_MATRIX_CELL_FILTER_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixCellFilterMode; + +typedef enum WindowBackgroundHatchStyle_enum { + IMAQ_HATCH_STYLE_HORIZONTAL = + 0, // The background of the display window will be horizontal bars. + IMAQ_HATCH_STYLE_VERTICAL = + 1, // The background of the display window will be vertical bars. + IMAQ_HATCH_STYLE_FORWARD_DIAGONAL = + 2, // The background of the display window will be diagonal bars. + IMAQ_HATCH_STYLE_BACKWARD_DIAGONAL = + 3, // The background of the display window will be diagonal bars. + IMAQ_HATCH_STYLE_CROSS = 4, // The background of the display window will be + // intersecting horizontal and vertical bars. + IMAQ_HATCH_STYLE_CROSS_HATCH = 5, // The background of the display window + // will be intersecting forward and + // backward diagonal bars. + IMAQ_HATCH_STYLE_SIZE_GUARD = 0xFFFFFFFF +} WindowBackgroundHatchStyle; + +typedef enum DataMatrixMirrorMode_enum { + IMAQ_AUTO_DETECT_MIRROR = -2, // Specifies that the function should determine + // if the Data Matrix barcode is mirrored. + IMAQ_APPEARS_NORMAL = 0, // Specifies that the function should expect the + // Data Matrix barcode to appear normal. + IMAQ_APPEARS_MIRRORED = 1, // Specifies that the function should expect the + // Data Matrix barcode to appear mirrored. + IMAQ_DATA_MATRIX_MIRROR_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixMirrorMode; + +typedef enum CalibrationMode2_enum { + IMAQ_PERSPECTIVE_MODE = 0, // Functions correct for distortion caused by the + // camera's perspective. + IMAQ_MICROPLANE_MODE = + 1, // Functions correct for distortion caused by the camera's lens. + IMAQ_SIMPLE_CALIBRATION_MODE = 2, // Functions do not correct for distortion. + IMAQ_CORRECTED_IMAGE_MODE = 3, // The image is already corrected. + IMAQ_NO_CALIBRATION_MODE = 4, // Image with No calibration. + IMAQ_CALIBRATION_MODE2_SIZE_GUARD = 0xFFFFFFFF +} CalibrationMode2; + +typedef enum DataMatrixGradingMode_enum { + IMAQ_NO_GRADING = + 0, // The function does not make any preparatory calculations. + IMAQ_PREPARE_FOR_AIM = 1, // The function prepares the image for grading + // using the AIM Print Quality metrics. + IMAQ_DATA_MATRIX_GRADING_MODE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixGradingMode; + +typedef enum WaveletTransformMode_enum { + IMAQ_WAVELET_TRANSFORM_INTEGER = + 0, // Uses a 5-3 reversible integer transform. + IMAQ_WAVELET_TRANSFORM_FLOATING_POINT = + 1, // Performs a 9-7 irreversible floating-point transform. + IMAQ_WAVELET_TRANSFORM_MODE_SIZE_GUARD = 0xFFFFFFFF +} WaveletTransformMode; + +typedef enum NormalizationMethod_enum { + IMAQ_NORMALIZATION_NONE = 0, // No normalization. + IMAQ_NORMALIZATION_HISTOGRAM_MATCHING = 1, // Adjust image so its histogram + // is similar to the golden + // template's histogram. + IMAQ_NORMALIZATION_AVERAGE_MATCHING = 2, // Adjust image so its mean pixel + // value equals the golden + // template's mean pixel value. + IMAQ_NORMALIZATION_SIZE_GUARD = 0xFFFFFFFF +} NormalizationMethod; + +typedef enum RegistrationMethod_enum { + IMAQ_REGISTRATION_NONE = 0, // No registration. + IMAQ_REGISTRATION_PERSPECTIVE = 1, // Adjust image to correct for minor + // variations in alignment or perspective. + IMAQ_REGISTRATION_SIZE_GUARD = 0xFFFFFFFF +} RegistrationMethod; + +typedef enum LinearAveragesMode_enum { + IMAQ_COLUMN_AVERAGES = 1, // Specifies that the function calculates the mean + // pixel value of each column. + IMAQ_ROW_AVERAGES = 2, // Specifies that the function calculates the mean + // pixel value of each row. + IMAQ_RISING_DIAGONAL_AVERAGES = + 4, // Specifies that the function calculates the mean pixel value of each + // diagonal running from the lower left to the upper right of the + // inspected area of the image. + IMAQ_FALLING_DIAGONAL_AVERAGES = + 8, // Specifies that the function calculates the mean pixel value of each + // diagonal running from the upper left to the lower right of the + // inspected area of the image. + IMAQ_ALL_LINEAR_AVERAGES = 15, // Specifies that the function calculates all + // four linear mean pixel values. + IMAQ_LINEAR_AVERAGES_MODE_SIZE_GUARD = 0xFFFFFFFF +} LinearAveragesMode; + +typedef enum CompressionType_enum { + IMAQ_COMPRESSION_NONE = + 0, // Specifies that the function should not compress the image. + IMAQ_COMPRESSION_JPEG = 1, // Specifies that the function should use lossy + // JPEG compression on the image. + IMAQ_COMPRESSION_PACKED_BINARY = 2, // Specifies that the function should use + // lossless binary packing on the image. + IMAQ_COMPRESSION_TYPE_SIZE_GUARD = 0xFFFFFFFF +} CompressionType; + +typedef enum FlattenType_enum { + IMAQ_FLATTEN_IMAGE = 0, // Flattens just the image data. + IMAQ_FLATTEN_IMAGE_AND_VISION_INFO = 1, // Flattens the image data and any + // Vision information associated with + // the image. + IMAQ_FLATTEN_TYPE_SIZE_GUARD = 0xFFFFFFFF +} FlattenType; + +typedef enum DataMatrixCellSampleSize_enum { + IMAQ_AUTO_DETECT_CELL_SAMPLE_SIZE = + -2, // The function will try each sample size and use the one which + // decodes the Data Matrix barcode within the fewest iterations and + // utilizing the least amount of error correction. + IMAQ_1x1 = 1, // The function will use a 1x1 sized sample from each cell. + IMAQ_2x2 = 2, // The function will use a 2x2 sized sample from each cell. + IMAQ_3x3 = 3, // The function will use a 3x3 sized sample from each cell. + IMAQ_4x4 = 4, // The function will use a 4x4 sized sample from each cell. + IMAQ_5x5 = 5, // The function will use a 5x5 sized sample from each cell. + IMAQ_6x6 = 6, // The function will use a 6x6 sized sample from each cell. + IMAQ_7x7 = 7, // The function will use a 7x7 sized sample from each cell. + IMAQ_DATA_MATRIX_CELL_SAMPLE_SIZE_SIZE_GUARD = 0xFFFFFFFF +} DataMatrixCellSampleSize; + +//============================================================================ +// Forward Declare Data Structures +//============================================================================ +typedef struct Image_struct Image; +typedef struct ROI_struct ROI; +typedef struct Overlay_struct Overlay; +typedef struct ClassifierSession_struct ClassifierSession; +typedef struct MultipleGeometricPattern_struct MultipleGeometricPattern; +typedef int ContourID; +typedef unsigned long SESSION_ID; +typedef int AVISession; +typedef char* FilterName; +typedef char String255[256]; +typedef struct CharSet_struct CharSet; +typedef struct OCRSpacingOptions_struct OCRSpacingOptions; +typedef struct OCRProcessingOptions_struct OCRProcessingOptions; +typedef struct ReadTextOptions_struct ReadTextOptions; +typedef struct CharInfo_struct CharInfo; +typedef struct CharReport_struct CharReport; +typedef struct ReadTextReport_struct ReadTextReport; +typedef struct DivisionModel_struct DivisionModel; +typedef struct FocalLength_struct FocalLength; +typedef struct PolyModel_struct PolyModel; +typedef struct DistortionModelParams_struct DistortionModelParams; +typedef struct PointFloat_struct PointFloat; +typedef struct InternalParameters_struct InternalParameters; +typedef struct MaxGridSize_struct MaxGridSize; +typedef struct ImageSize_struct ImageSize; +typedef struct CalibrationReferencePoints_struct CalibrationReferencePoints; +typedef struct GetCameraParametersReport_struct GetCameraParametersReport; +typedef struct CalibrationAxisInfo_struct CalibrationAxisInfo; +typedef struct CalibrationLearnSetupInfo_struct CalibrationLearnSetupInfo; +typedef struct GridDescriptor_struct GridDescriptor; +typedef struct ErrorStatistics_struct ErrorStatistics; +typedef struct GetCalibrationInfoReport_struct GetCalibrationInfoReport; +typedef struct EdgePolarity_struct EdgePolarity; +typedef struct ClampSettings_struct ClampSettings; +typedef struct PointDouble_struct PointDouble; +typedef struct PointDoublePair_struct PointDoublePair; +typedef struct ClampResults_struct ClampResults; +typedef struct ClampPoints_struct ClampPoints; +typedef struct RGBValue_struct RGBValue; +typedef struct ClampOverlaySettings_struct ClampOverlaySettings; +typedef struct ClampMax2Report_struct ClampMax2Report; +typedef struct ContourFitSplineReport_struct ContourFitSplineReport; +typedef struct LineFloat_struct LineFloat; +typedef struct LineEquation_struct LineEquation; +typedef struct ContourFitLineReport_struct ContourFitLineReport; +typedef struct ContourFitPolynomialReport_struct ContourFitPolynomialReport; +typedef struct PartialCircle_struct PartialCircle; +typedef struct PartialEllipse_struct PartialEllipse; +typedef struct SetupMatchPatternData_struct SetupMatchPatternData; +typedef struct RangeSettingDouble_struct RangeSettingDouble; +typedef struct GeometricAdvancedSetupDataOption_struct + GeometricAdvancedSetupDataOption; +typedef struct ContourInfoReport_struct ContourInfoReport; +typedef struct ROILabel_struct ROILabel; +typedef struct SupervisedColorSegmentationReport_struct + SupervisedColorSegmentationReport; +typedef struct LabelToROIReport_struct LabelToROIReport; +typedef struct ColorSegmenationOptions_struct ColorSegmenationOptions; +typedef struct ClassifiedCurve_struct ClassifiedCurve; +typedef struct RangeDouble_struct RangeDouble; +typedef struct RangeLabel_struct RangeLabel; +typedef struct CurvatureAnalysisReport_struct CurvatureAnalysisReport; +typedef struct Disparity_struct Disparity; +typedef struct ComputeDistancesReport_struct ComputeDistancesReport; +typedef struct MatchMode_struct MatchMode; +typedef struct ClassifiedDisparity_struct ClassifiedDisparity; +typedef struct ClassifyDistancesReport_struct ClassifyDistancesReport; +typedef struct ContourComputeCurvatureReport_struct + ContourComputeCurvatureReport; +typedef struct ContourOverlaySettings_struct ContourOverlaySettings; +typedef struct CurveParameters_struct CurveParameters; +typedef struct ExtractContourReport_struct ExtractContourReport; +typedef struct ConnectionConstraint_struct ConnectionConstraint; +typedef struct ExtractTextureFeaturesReport_struct ExtractTextureFeaturesReport; +typedef struct WaveletBandsReport_struct WaveletBandsReport; +typedef struct CircleFitOptions_struct CircleFitOptions; +typedef struct EdgeOptions2_struct EdgeOptions2; +typedef struct FindCircularEdgeOptions_struct FindCircularEdgeOptions; +typedef struct FindConcentricEdgeOptions_struct FindConcentricEdgeOptions; +typedef struct ConcentricEdgeFitOptions_struct ConcentricEdgeFitOptions; +typedef struct FindConcentricEdgeReport_struct FindConcentricEdgeReport; +typedef struct FindCircularEdgeReport_struct FindCircularEdgeReport; +typedef struct WindowSize_struct WindowSize; +typedef struct DisplacementVector_struct DisplacementVector; +typedef struct WaveletOptions_struct WaveletOptions; +typedef struct CooccurrenceOptions_struct CooccurrenceOptions; +typedef struct ParticleClassifierLocalThresholdOptions_struct + ParticleClassifierLocalThresholdOptions; +typedef struct RangeFloat_struct RangeFloat; +typedef struct ParticleClassifierAutoThresholdOptions_struct + ParticleClassifierAutoThresholdOptions; +typedef struct ParticleClassifierPreprocessingOptions2_struct + ParticleClassifierPreprocessingOptions2; +typedef struct MeasureParticlesReport_struct MeasureParticlesReport; +typedef struct GeometricPatternMatch3_struct GeometricPatternMatch3; +typedef struct MatchGeometricPatternAdvancedOptions3_struct + MatchGeometricPatternAdvancedOptions3; +typedef struct ColorOptions_struct ColorOptions; +typedef struct SampleScore_struct SampleScore; +typedef struct ClassifierReportAdvanced_struct ClassifierReportAdvanced; +typedef struct LearnGeometricPatternAdvancedOptions2_struct + LearnGeometricPatternAdvancedOptions2; +typedef struct ParticleFilterOptions2_struct ParticleFilterOptions2; +typedef struct FindEdgeOptions2_struct FindEdgeOptions2; +typedef struct FindEdgeReport_struct FindEdgeReport; +typedef struct FindTransformRectOptions2_struct FindTransformRectOptions2; +typedef struct FindTransformRectsOptions2_struct FindTransformRectsOptions2; +typedef struct ReadTextReport3_struct ReadTextReport3; +typedef struct CharacterStatistics_struct CharacterStatistics; +typedef struct CharReport3_struct CharReport3; +typedef struct ArcInfo2_struct ArcInfo2; +typedef struct EdgeReport2_struct EdgeReport2; +typedef struct SearchArcInfo_struct SearchArcInfo; +typedef struct ConcentricRakeReport2_struct ConcentricRakeReport2; +typedef struct SpokeReport2_struct SpokeReport2; +typedef struct EdgeInfo_struct EdgeInfo; +typedef struct SearchLineInfo_struct SearchLineInfo; +typedef struct RakeReport2_struct RakeReport2; +typedef struct TransformBehaviors_struct TransformBehaviors; +typedef struct QRCodeDataToken_struct QRCodeDataToken; +typedef struct ParticleFilterOptions_struct ParticleFilterOptions; +typedef struct StraightEdgeReport2_struct StraightEdgeReport2; +typedef struct StraightEdgeOptions_struct StraightEdgeOptions; +typedef struct StraightEdge_struct StraightEdge; +typedef struct QRCodeSearchOptions_struct QRCodeSearchOptions; +typedef struct QRCodeSizeOptions_struct QRCodeSizeOptions; +typedef struct QRCodeDescriptionOptions_struct QRCodeDescriptionOptions; +typedef struct QRCodeReport_struct QRCodeReport; +typedef struct AIMGradeReport_struct AIMGradeReport; +typedef struct DataMatrixSizeOptions_struct DataMatrixSizeOptions; +typedef struct DataMatrixDescriptionOptions_struct DataMatrixDescriptionOptions; +typedef struct DataMatrixSearchOptions_struct DataMatrixSearchOptions; +typedef struct DataMatrixReport_struct DataMatrixReport; +typedef struct JPEG2000FileAdvancedOptions_struct JPEG2000FileAdvancedOptions; +typedef struct MatchGeometricPatternAdvancedOptions2_struct + MatchGeometricPatternAdvancedOptions2; +typedef struct InspectionAlignment_struct InspectionAlignment; +typedef struct InspectionOptions_struct InspectionOptions; +typedef struct CharReport2_struct CharReport2; +typedef struct CharInfo2_struct CharInfo2; +typedef struct ReadTextReport2_struct ReadTextReport2; +typedef struct EllipseFeature_struct EllipseFeature; +typedef struct CircleFeature_struct CircleFeature; +typedef struct ConstCurveFeature_struct ConstCurveFeature; +typedef struct RectangleFeature_struct RectangleFeature; +typedef struct LegFeature_struct LegFeature; +typedef struct CornerFeature_struct CornerFeature; +typedef struct LineFeature_struct LineFeature; +typedef struct ParallelLinePairFeature_struct ParallelLinePairFeature; +typedef struct PairOfParallelLinePairsFeature_struct + PairOfParallelLinePairsFeature; +typedef union GeometricFeature_union GeometricFeature; +typedef struct FeatureData_struct FeatureData; +typedef struct GeometricPatternMatch2_struct GeometricPatternMatch2; +typedef struct ClosedCurveFeature_struct ClosedCurveFeature; +typedef struct LineMatch_struct LineMatch; +typedef struct LineDescriptor_struct LineDescriptor; +typedef struct RectangleDescriptor_struct RectangleDescriptor; +typedef struct RectangleMatch_struct RectangleMatch; +typedef struct EllipseDescriptor_struct EllipseDescriptor; +typedef struct EllipseMatch_struct EllipseMatch; +typedef struct CircleMatch_struct CircleMatch; +typedef struct CircleDescriptor_struct CircleDescriptor; +typedef struct ShapeDetectionOptions_struct ShapeDetectionOptions; +typedef struct Curve_struct Curve; +typedef struct CurveOptions_struct CurveOptions; +typedef struct Barcode2DInfo_struct Barcode2DInfo; +typedef struct DataMatrixOptions_struct DataMatrixOptions; +typedef struct ClassifierAccuracyReport_struct ClassifierAccuracyReport; +typedef struct NearestNeighborClassResult_struct NearestNeighborClassResult; +typedef struct NearestNeighborTrainingReport_struct + NearestNeighborTrainingReport; +typedef struct ParticleClassifierPreprocessingOptions_struct + ParticleClassifierPreprocessingOptions; +typedef struct ClassifierSampleInfo_struct ClassifierSampleInfo; +typedef struct ClassScore_struct ClassScore; +typedef struct ClassifierReport_struct ClassifierReport; +typedef struct NearestNeighborOptions_struct NearestNeighborOptions; +typedef struct ParticleClassifierOptions_struct ParticleClassifierOptions; +typedef struct RGBU64Value_struct RGBU64Value; +typedef struct GeometricPatternMatch_struct GeometricPatternMatch; +typedef struct MatchGeometricPatternAdvancedOptions_struct + MatchGeometricPatternAdvancedOptions; +typedef struct MatchGeometricPatternOptions_struct MatchGeometricPatternOptions; +typedef struct LearnGeometricPatternAdvancedOptions_struct + LearnGeometricPatternAdvancedOptions; +typedef struct FitEllipseOptions_struct FitEllipseOptions; +typedef struct FitCircleOptions_struct FitCircleOptions; +typedef struct ConstructROIOptions2_struct ConstructROIOptions2; +typedef struct HSLValue_struct HSLValue; +typedef struct HSVValue_struct HSVValue; +typedef struct HSIValue_struct HSIValue; +typedef struct CIELabValue_struct CIELabValue; +typedef struct CIEXYZValue_struct CIEXYZValue; +typedef union Color2_union Color2; +typedef struct BestEllipse2_struct BestEllipse2; +typedef struct LearnPatternAdvancedOptions_struct LearnPatternAdvancedOptions; +typedef struct AVIInfo_struct AVIInfo; +typedef struct LearnPatternAdvancedShiftOptions_struct + LearnPatternAdvancedShiftOptions; +typedef struct LearnPatternAdvancedRotationOptions_struct + LearnPatternAdvancedRotationOptions; +typedef struct MatchPatternAdvancedOptions_struct MatchPatternAdvancedOptions; +typedef struct ParticleFilterCriteria2_struct ParticleFilterCriteria2; +typedef struct BestCircle2_struct BestCircle2; +typedef struct OCRSpacingOptions_struct OCRSpacingOptions; +typedef struct OCRProcessingOptions_struct OCRProcessingOptions; +typedef struct ReadTextOptions_struct ReadTextOptions; +typedef struct CharInfo_struct CharInfo; +#if !defined(USERINT_HEADER) && !defined(_CVI_RECT_DEFINED) +typedef struct Rect_struct Rect; +#endif +typedef struct CharReport_struct CharReport; +typedef struct ReadTextReport_struct ReadTextReport; +#if !defined(USERINT_HEADER) && !defined(_CVI_POINT_DEFINED) +typedef struct Point_struct Point; +#endif +typedef struct Annulus_struct Annulus; +typedef struct EdgeLocationReport_struct EdgeLocationReport; +typedef struct EdgeOptions_struct EdgeOptions; +typedef struct EdgeReport_struct EdgeReport; +typedef struct ExtremeReport_struct ExtremeReport; +typedef struct FitLineOptions_struct FitLineOptions; +typedef struct DisplayMapping_struct DisplayMapping; +typedef struct DetectExtremesOptions_struct DetectExtremesOptions; +typedef struct ImageInfo_struct ImageInfo; +typedef struct LCDOptions_struct LCDOptions; +typedef struct LCDReport_struct LCDReport; +typedef struct LCDSegments_struct LCDSegments; +typedef struct LearnCalibrationOptions_struct LearnCalibrationOptions; +typedef struct LearnColorPatternOptions_struct LearnColorPatternOptions; +typedef struct Line_struct Line; +typedef struct LinearAverages_struct LinearAverages; +typedef struct LineProfile_struct LineProfile; +typedef struct MatchColorPatternOptions_struct MatchColorPatternOptions; +typedef struct HistogramReport_struct HistogramReport; +typedef struct ArcInfo_struct ArcInfo; +typedef struct AxisReport_struct AxisReport; +typedef struct BarcodeInfo_struct BarcodeInfo; +typedef struct BCGOptions_struct BCGOptions; +typedef struct BestCircle_struct BestCircle; +typedef struct BestEllipse_struct BestEllipse; +typedef struct BestLine_struct BestLine; +typedef struct BrowserOptions_struct BrowserOptions; +typedef struct CoordinateSystem_struct CoordinateSystem; +typedef struct CalibrationInfo_struct CalibrationInfo; +typedef struct CalibrationPoints_struct CalibrationPoints; +typedef struct CaliperOptions_struct CaliperOptions; +typedef struct CaliperReport_struct CaliperReport; +typedef struct DrawTextOptions_struct DrawTextOptions; +typedef struct CircleReport_struct CircleReport; +typedef struct ClosedContour_struct ClosedContour; +typedef struct ColorHistogramReport_struct ColorHistogramReport; +typedef struct ColorInformation_struct ColorInformation; +typedef struct Complex_struct Complex; +typedef struct ConcentricRakeReport_struct ConcentricRakeReport; +typedef struct ConstructROIOptions_struct ConstructROIOptions; +typedef struct ContourInfo_struct ContourInfo; +typedef union ContourUnion_union ContourUnion; +typedef struct ContourInfo2_struct ContourInfo2; +typedef struct ContourPoint_struct ContourPoint; +typedef struct CoordinateTransform_struct CoordinateTransform; +typedef struct CoordinateTransform2_struct CoordinateTransform2; +typedef struct CannyOptions_struct CannyOptions; +typedef struct Range_struct Range; +typedef struct UserPointSymbol_struct UserPointSymbol; +typedef struct View3DOptions_struct View3DOptions; +typedef struct MatchPatternOptions_struct MatchPatternOptions; +typedef struct TIFFFileOptions_struct TIFFFileOptions; +typedef union Color_union Color; +typedef union PixelValue_union PixelValue; +typedef struct OpenContour_struct OpenContour; +typedef struct OverlayTextOptions_struct OverlayTextOptions; +typedef struct ParticleFilterCriteria_struct ParticleFilterCriteria; +typedef struct ParticleReport_struct ParticleReport; +typedef struct PatternMatch_struct PatternMatch; +typedef struct QuantifyData_struct QuantifyData; +typedef struct QuantifyReport_struct QuantifyReport; +typedef struct RakeOptions_struct RakeOptions; +typedef struct RakeReport_struct RakeReport; +typedef struct TransformReport_struct TransformReport; +typedef struct ShapeReport_struct ShapeReport; +typedef struct MeterArc_struct MeterArc; +typedef struct ThresholdData_struct ThresholdData; +typedef struct StructuringElement_struct StructuringElement; +typedef struct SpokeReport_struct SpokeReport; +typedef struct SimpleEdgeOptions_struct SimpleEdgeOptions; +typedef struct SelectParticleCriteria_struct SelectParticleCriteria; +typedef struct SegmentInfo_struct SegmentInfo; +typedef struct RotationAngleRange_struct RotationAngleRange; +typedef struct RotatedRect_struct RotatedRect; +typedef struct ROIProfile_struct ROIProfile; +typedef struct ToolWindowOptions_struct ToolWindowOptions; +typedef struct SpokeOptions_struct SpokeOptions; + +//============================================================================ +// Data Structures +//============================================================================ +#if !defined __GNUC__ && !defined _M_X64 +#pragma pack(push, 1) +#endif +typedef struct DivisionModel_struct { + float kappa; // The learned kappa coefficient of division model. +} DivisionModel; + +typedef struct FocalLength_struct { + float fx; // Focal length in X direction. + float fy; // Focal length in Y direction. +} FocalLength; + +typedef struct PolyModel_struct { + float* kCoeffs; // The learned radial coefficients of polynomial model. + unsigned int numKCoeffs; // Number of K coefficients. + float p1; // The P1(learned tangential coefficients of polynomial model). + float p2; // The P2(learned tangential coefficients of polynomial model). +} PolyModel; + +typedef struct DistortionModelParams_struct { + DistortionModel distortionModel; // Type of learned distortion model. + PolyModel polyModel; // The learned coefficients of polynomial model. + DivisionModel divisionModel; // The learned coefficient of division model. +} DistortionModelParams; + +typedef struct PointFloat_struct { + float x; // The x-coordinate of the point. + float y; // The y-coordinate of the point. +} PointFloat; + +typedef struct InternalParameters_struct { + char isInsufficientData; + FocalLength focalLength; + PointFloat opticalCenter; +} InternalParameters; + +typedef struct MaxGridSize_struct { + unsigned int xMax; // Maximum x limit for the grid size. + unsigned int yMax; // Maximum y limit for the grid size. +} MaxGridSize; + +typedef struct ImageSize_struct { + unsigned int xRes; // X resolution of the image. + unsigned int yRes; // Y resolution of the image. +} ImageSize; + +typedef struct CalibrationReferencePoints_struct { + PointDouble* + pixelCoords; // Specifies the coordinates of the pixel reference points. + unsigned int numPixelCoords; // Number of pixel coordinates. + PointDouble* + realCoords; // Specifies the measuring unit associated with the image. + unsigned int numRealCoords; // Number of real coordinates. + CalibrationUnit units; // Specifies the units of X Step and Y Step. + ImageSize imageSize; // Specifies the size of calibration template image. +} CalibrationReferencePoints; + +typedef struct GetCameraParametersReport_struct { + double* + projectionMatrix; // The projection(homography) matrix of working plane. + unsigned int projectionMatrixRows; // Number of rows in projection matrix. + unsigned int projectionMatrixCols; // Number of columns in projection matrix. + DistortionModelParams distortion; // Distortion model Coefficients. + InternalParameters internalParams; // The learned internal paramters of + // camera model such as focal length and + // optical center. +} GetCameraParametersReport; + +typedef struct CalibrationAxisInfo_struct { + PointFloat center; // The origin of the reference coordinate system, + // expressed in pixel units. + float rotationAngle; // The angle of the x-axis of the real-world coordinate + // system, in relation to the horizontal. + AxisOrientation axisDirection; // Specifies the direction of the calibraiton + // axis which is either Direct or Indirect. +} CalibrationAxisInfo; + +typedef struct CalibrationLearnSetupInfo_struct { + CalibrationMode2 calibrationMethod; // Type of calibration method used. + DistortionModel distortionModel; // Type of learned distortion model. + ScalingMethod + scaleMode; // The aspect scaling to use when correcting an image. + CalibrationROI roiMode; // The ROI to use when correcting an image. + char learnCorrectionTable; // Set this input to true value if you want the + // correction table to be determined and stored. +} CalibrationLearnSetupInfo; + +typedef struct GridDescriptor_struct { + float xStep; // The distance in the x direction between two adjacent pixels + // in units specified by unit. + float yStep; // The distance in the y direction between two adjacent pixels + // in units specified by unit. + CalibrationUnit unit; // The unit of measure for the image. +} GridDescriptor; + +typedef struct ErrorStatistics_struct { + double mean; // Mean error statistics value. + double maximum; // Maximum value of error. + double standardDeviation; // The standard deviation error statistiscs value. + double distortion; // The distortion error statistics value. +} ErrorStatistics; + +typedef struct GetCalibrationInfoReport_struct { + ROI* userRoi; // Specifies the ROI the user provided when learning the + // calibration. + ROI* calibrationRoi; // Specifies the ROI that corresponds to the region of + // the image where the calibration information is + // accurate. + CalibrationAxisInfo + axisInfo; // Reference Coordinate System for the real-world coordinates. + CalibrationLearnSetupInfo + learnSetupInfo; // Calibration learn setup information. + GridDescriptor gridDescriptor; // Specifies scaling constants used to + // calibrate the image. + float* errorMap; // The the error map of calibration template image. + unsigned int errorMapRows; // Number of rows in error map. + unsigned int errorMapCols; // Number of Columns in error map. + ErrorStatistics errorStatistics; // Error statistics of the calibration. +} GetCalibrationInfoReport; + +typedef struct EdgePolarity_struct { + EdgePolaritySearchMode start; + EdgePolaritySearchMode end; +} EdgePolarity; + +typedef struct ClampSettings_struct { + double angleRange; // Specifies the angle range. + EdgePolarity edgePolarity; // Specifies the edge polarity. +} ClampSettings; + +typedef struct PointDouble_struct { + double x; // The x-coordinate of the point. + double y; // The y-coordinate of the point. +} PointDouble; + +typedef struct PointDoublePair_struct { + PointDouble start; // The Start co-ordinate of the pair. + PointDouble end; // The End co-ordinate of the pair. +} PointDoublePair; + +typedef struct ClampResults_struct { + double distancePix; // Defines the Pixel world distance. + double distanceRealWorld; // Defines the real world distance. + double angleAbs; // Defines the absolute angle. + double angleRelative; // Defines the relative angle. +} ClampResults; + +typedef struct ClampPoints_struct { + PointDoublePair pixel; // Specifies the pixel world point pair for clamp. + PointDoublePair realWorld; // Specifies the real world point pair for clamp. +} ClampPoints; + +typedef struct RGBValue_struct { + unsigned char B; // The blue value of the color. + unsigned char G; // The green value of the color. + unsigned char R; // The red value of the color. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} RGBValue; + +typedef struct ClampOverlaySettings_struct { + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showCurves; // If TRUE, the function overlays the curves on the image. + int showClampLocation; // If TRUE, the function overlays the clamp location + // on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue curvesColor; // Specifies the RGB color value to use to overlay the + // curves. + RGBValue clampLocationsColor; // Specifies the RGB color value to use to + // overlay the clamp locations. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the group overlay name for the step + // overlays. +} ClampOverlaySettings; + +typedef struct ClampMax2Report_struct { + ClampResults clampResults; // Specifies the Clamp results information + // returned by the function. + ClampPoints clampPoints; // Specifies the clamp points information returned + // by the function. + unsigned int calibrationValid; // Specifies if the calibration information is + // valid or not. +} ClampMax2Report; + +typedef struct ContourFitSplineReport_struct { + PointDouble* points; // It returns the points of the best-fit B-spline curve. + int numberOfPoints; // Number of Best fit points returned. +} ContourFitSplineReport; + +typedef struct LineFloat_struct { + PointFloat start; // The coordinate location of the start of the line. + PointFloat end; // The coordinate location of the end of the line. +} LineFloat; + +typedef struct LineEquation_struct { + double a; // The a coefficient of the line equation. + double b; // The b coefficient of the line equation. + double c; // The c coefficient of the line equation. +} LineEquation; + +typedef struct ContourFitLineReport_struct { + LineFloat lineSegment; // Line Segment represents the intersection of the + // line equation and the contour. + LineEquation lineEquation; // Line Equation is a structure of three + // coefficients A, B, and C of the equation in the + // normal form (Ax + By + C=0) of the best fit + // line. +} ContourFitLineReport; + +typedef struct ContourFitPolynomialReport_struct { + PointDouble* bestFit; // It returns the points of the best-fit polynomial. + int numberOfPoints; // Number of Best fit points returned. + double* polynomialCoefficients; // Polynomial Coefficients returns the + // coefficients of the polynomial equation. + int numberOfCoefficients; // Number of Coefficients returned in the + // polynomial coefficients array. +} ContourFitPolynomialReport; + +typedef struct PartialCircle_struct { + PointFloat center; // Center of the circle. + double radius; // Radius of the circle. + double startAngle; // Start angle of the fitted structure. + double endAngle; // End angle of the fitted structure. +} PartialCircle; + +typedef struct PartialEllipse_struct { + PointFloat center; // Center of the Ellipse. + double angle; // Angle of the ellipse. + double majorRadius; // The length of the semi-major axis of the ellipse. + double minorRadius; // The length of the semi-minor axis of the ellipse. + double startAngle; // Start angle of the fitted structure. + double endAngle; // End angle of the fitted structure. +} PartialEllipse; + +typedef struct SetupMatchPatternData_struct { + unsigned char* matchSetupData; // String containing the match setup data. + int numMatchSetupData; // Number of match setup data. +} SetupMatchPatternData; + +typedef struct RangeSettingDouble_struct { + SettingType settingType; // Match Constraints specifies the match option + // whose values you want to constrain by the given + // range. + double min; // Min is the minimum value of the range for a given Match + // Constraint. + double max; // Max is the maximum value of the range for a given Match + // Constraint. +} RangeSettingDouble; + +typedef struct GeometricAdvancedSetupDataOption_struct { + GeometricSetupDataItem type; // It determines the option you want to use + // during the matching phase. + double value; // Value is the value for the option you want to use during the + // matching phase. +} GeometricAdvancedSetupDataOption; + +typedef struct ContourInfoReport_struct { + PointDouble* pointsPixel; // Points (pixel) specifies the location of every + // point detected on the curve, in pixels. + unsigned int numPointsPixel; // Number of points pixel elements. + PointDouble* pointsReal; // Points (real) specifies the location of every + // point detected on the curve, in calibrated units. + unsigned int numPointsReal; // Number of points real elements. + double* curvaturePixel; // Curvature Pixel displays the curvature profile for + // the selected contour, in pixels. + unsigned int numCurvaturePixel; // Number of curvature pixels. + double* curvatureReal; // Curvature Real displays the curvature profile for + // the selected contour, in calibrated units. + unsigned int numCurvatureReal; // Number of curvature Real elements. + double length; // Length (pixel) specifies the length, in pixels, of the + // curves in the image. + double lengthReal; // Length (real) specifies the length, in calibrated + // units, of the curves within the curvature range. + unsigned int hasEquation; // Has Equation specifies whether the contour has a + // fitted equation. +} ContourInfoReport; + +typedef struct ROILabel_struct { + char* className; // Specifies the classname you want to segment. + unsigned int + label; // Label is the label number associated with the Class Name. +} ROILabel; + +typedef struct SupervisedColorSegmentationReport_struct { + ROILabel* labelOut; // The Roi labels array. + unsigned int numLabelOut; // The number of elements in labelOut array. +} SupervisedColorSegmentationReport; + +typedef struct LabelToROIReport_struct { + ROI** roiArray; // Array of ROIs. + unsigned int numOfROIs; // Number of ROIs in the roiArray. + unsigned int* labelsOutArray; // Array of labels. + unsigned int numOfLabels; // Number of labels. + int* isTooManyVectorsArray; // isTooManyVectorsArray array. + unsigned int isTooManyVectorsArraySize; // Number of elements in + // isTooManyVectorsArray. +} LabelToROIReport; + +typedef struct ColorSegmenationOptions_struct { + unsigned int windowX; // X is the window size in x direction. + unsigned int windowY; // Y is the window size in y direction. + unsigned int stepSize; // Step Size is the distance between two windows. + unsigned int minParticleArea; // Min Particle Area is the minimum number of + // allowed pixels. + unsigned int maxParticleArea; // Max Particle Area is the maximum number of + // allowed pixels. + short isFineSegment; // When enabled, the step processes the boundary pixels + // of each segmentation cluster using a step size of 1. +} ColorSegmenationOptions; + +typedef struct ClassifiedCurve_struct { + double length; // Specifies the length, in pixels, of the curves within the + // curvature range. + double lengthReal; // specifies the length, in calibrated units, of the + // curves within the curvature range. + double maxCurvature; // specifies the maximum curvature, in pixels, for the + // selected curvature range. + double maxCurvatureReal; // specifies the maximum curvature, in calibrated + // units, for the selected curvature range. + unsigned int label; // specifies the class to which the the sample belongs. + PointDouble* curvePoints; // Curve Points is a point-coordinate cluster that + // defines the points of the curve. + unsigned int numCurvePoints; // Number of curve points. +} ClassifiedCurve; + +typedef struct RangeDouble_struct { + double minValue; // The minimum value of the range. + double maxValue; // The maximum value of the range. +} RangeDouble; + +typedef struct RangeLabel_struct { + RangeDouble range; // Specifies the range of curvature values. + unsigned int label; // Class Label specifies the class to which the the + // sample belongs. +} RangeLabel; + +typedef struct CurvatureAnalysisReport_struct { + ClassifiedCurve* curves; + unsigned int numCurves; +} CurvatureAnalysisReport; + +typedef struct Disparity_struct { + PointDouble + current; // Current is a array of points that defines the target contour. + PointDouble reference; // reference is a array of points that defines the + // template contour. + double distance; // Specifies the distance, in pixels, between the template + // contour point and the target contour point. +} Disparity; + +typedef struct ComputeDistancesReport_struct { + Disparity* + distances; // Distances is an array containing the computed distances. + unsigned int numDistances; // Number elements in the distances array. + Disparity* distancesReal; // Distances Real is an array containing the + // computed distances in calibrated units. + unsigned int numDistancesReal; // Number of elements in real distances array. +} ComputeDistancesReport; + +typedef struct MatchMode_struct { + unsigned int rotation; // Rotation When enabled, the Function searches for + // occurrences of the template in the inspection + // image, allowing for template matches to be rotated. + unsigned int scale; // Rotation When enabled, the Function searches for + // occurrences of the template in the inspection image, + // allowing for template matches to be rotated. + unsigned int occlusion; // Occlusion specifies whether or not to search for + // occluded versions of the shape. +} MatchMode; + +typedef struct ClassifiedDisparity_struct { + double length; // Length (pixel) specifies the length, in pixels, of the + // curves within the curvature range. + double lengthReal; // Length (real) specifies the length, in calibrated + // units, of the curves within the curvature range. + double maxDistance; // Maximum Distance (pixel) specifies the maximum + // distance, in pixels, between points along the selected + // contour and the template contour. + double maxDistanceReal; // Maximum Distance (real) specifies the maximum + // distance, in calibrated units, between points + // along the selected contour and the template + // contour. + unsigned int label; // Class Label specifies the class to which the the + // sample belongs. + PointDouble* templateSubsection; // Template subsection points is an array of + // points that defines the boundary of the + // template. + unsigned int numTemplateSubsection; // Number of reference points. + PointDouble* targetSubsection; // Current Points(Target subsection points) is + // an array of points that defines the + // boundary of the target. + unsigned int numTargetSubsection; // Number of current points. +} ClassifiedDisparity; + +typedef struct ClassifyDistancesReport_struct { + ClassifiedDisparity* classifiedDistances; // Disparity array containing the + // classified distances. + unsigned int + numClassifiedDistances; // Number of elements in the disparity array. +} ClassifyDistancesReport; + +typedef struct ContourComputeCurvatureReport_struct { + double* curvaturePixel; // Curvature Pixel displays the curvature profile for + // the selected contour, in pixels. + unsigned int numCurvaturePixel; // Number of curvature pixels. + double* curvatureReal; // Curvature Real displays the curvature profile for + // the selected contour, in calibrated units. + unsigned int numCurvatureReal; // Number of curvature Real elements. +} ContourComputeCurvatureReport; + +typedef struct ContourOverlaySettings_struct { + unsigned int overlay; // Overlay specifies whether to display the overlay on + // the image. + RGBValue color; // Color is the color of the overlay. + unsigned int width; // Width specifies the width of the overlay in pixels. + unsigned int maintainWidth; // Maintain Width? specifies whether you want the + // overlay measured in screen pixels or image + // pixels. +} ContourOverlaySettings; + +typedef struct CurveParameters_struct { + ExtractionMode extractionMode; // Specifies the method the function uses to + // identify curves in the image. + int threshold; // Specifies the minimum contrast a seed point must have in + // order to begin a curve. + EdgeFilterSize filterSize; // Specifies the width of the edge filter the + // function uses to identify curves in the image. + int minLength; // Specifies the length, in pixels, of the smallest curve the + // function will extract. + int searchStep; // Search Step Size specifies the distance, in the y + // direction, between the image rows that the algorithm + // inspects for curve seed points. + int maxEndPointGap; // Specifies the maximum gap, in pixels, between the + // endpoints of a curve that the function identifies as a + // closed curve. + int subpixel; // Subpixel specifies whether to detect curve points with + // subpixel accuracy. +} CurveParameters; + +typedef struct ExtractContourReport_struct { + PointDouble* contourPoints; // Contour Points specifies every point found on + // the contour. + int numContourPoints; // Number of contour points. + PointDouble* sourcePoints; // Source Image Points specifies every point found + // on the contour in the source image. + int numSourcePoints; // Number of source points. +} ExtractContourReport; + +typedef struct ConnectionConstraint_struct { + ConnectionConstraintType constraintType; // Constraint Type specifies what + // criteria to use to consider two + // curves part of a contour. + RangeDouble range; // Specifies range for a given Match Constraint. +} ConnectionConstraint; + +typedef struct ExtractTextureFeaturesReport_struct { + int* waveletBands; // The array having all the Wavelet Banks used for + // extraction. + int numWaveletBands; // Number of wavelet banks in the Array. + double** textureFeatures; // 2-D array to store all the Texture features + // extracted. + int textureFeaturesRows; // Number of Rows in the Texture Features array. + int textureFeaturesCols; // Number of Cols in Texture Features array. +} ExtractTextureFeaturesReport; + +typedef struct WaveletBandsReport_struct { + float** LLBand; // 2-D array for LL Band. + float** LHBand; // 2-D array for LH Band. + float** HLBand; // 2-D array for HL Band. + float** HHBand; // 2-D array for HH Band. + float** LLLBand; // 2-D array for LLL Band. + float** LLHBand; // 2-D array for LLH Band. + float LHLBand; // 2-D array for LHL Band. + float** LHHBand; // 2-D array for LHH Band. + int rows; // Number of Rows for each of the 2-D arrays. + int cols; // Number of Columns for each of the 2-D arrays. +} WaveletBandsReport; + +typedef struct CircleFitOptions_struct { + int maxRadius; // Specifies the acceptable distance, in pixels, that a point + // determined to belong to the circle can be from the + // perimeter of the circle. + double stepSize; // Step Size is the angle, in degrees, between each radial + // line in the annular region. + RakeProcessType processType; // Method used to process the data extracted for + // edge detection. +} CircleFitOptions; + +typedef struct EdgeOptions2_struct { + EdgePolaritySearchMode + polarity; // Specifies the polarity of the edges to be found. + unsigned int kernelSize; // Specifies the size of the edge detection kernel. + unsigned int width; // Specifies the number of pixels averaged perpendicular + // to the search direction to compute the edge profile + // strength at each point along the search ROI. + float minThreshold; // Specifies the minimum edge strength (gradient + // magnitude) required for a detected edge. + InterpolationMethod interpolationType; // Specifies the interpolation method + // used to locate the edge position. + ColumnProcessingMode columnProcessingMode; // Specifies the method used to + // find the straight edge. +} EdgeOptions2; + +typedef struct FindCircularEdgeOptions_struct { + SpokeDirection + direction; // Specifies the Spoke direction to search in the ROI. + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showSearchLines; // If TRUE, the function overlays the search lines used + // to locate the edges on the image. + int showEdgesFound; // If TRUE, the function overlays the locations of the + // edges found on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay + // the search lines. + RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay + // the search edges. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the overlay group name to assign to the + // overlays. + EdgeOptions2 edgeOptions; // Specifies the edge detection options along a + // single search line. +} FindCircularEdgeOptions; + +typedef struct FindConcentricEdgeOptions_struct { + ConcentricRakeDirection direction; // Specifies the Concentric Rake + // direction. + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showSearchLines; // If TRUE, the function overlays the search lines used + // to locate the edges on the image. + int showEdgesFound; // If TRUE, the function overlays the locations of the + // edges found on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay + // the search lines. + RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay + // the search edges. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the overlay group name to assign to the + // overlays. + EdgeOptions2 edgeOptions; // Specifies the edge detection options along a + // single search line. +} FindConcentricEdgeOptions; + +typedef struct ConcentricEdgeFitOptions_struct { + int maxRadius; // Specifies the acceptable distance, in pixels, that a point + // determined to belong to the circle can be from the + // perimeter of the circle. + double stepSize; // The sampling factor that determines the gap between the + // rake lines. + RakeProcessType processType; // Method used to process the data extracted for + // edge detection. +} ConcentricEdgeFitOptions; + +typedef struct FindConcentricEdgeReport_struct { + PointFloat startPt; // Pixel Coordinates for starting point of the edge. + PointFloat endPt; // Pixel Coordinates for end point of the edge. + PointFloat startPtCalibrated; // Real world Coordinates for starting point of + // the edge. + PointFloat + endPtCalibrated; // Real world Coordinates for end point of the edge. + double angle; // Angle of the edge found. + double angleCalibrated; // Calibrated angle of the edge found. + double straightness; // The straightness value of the detected straight edge. + double avgStrength; // Average strength of the egde found. + double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge found. + int lineFound; // If the edge is found or not. +} FindConcentricEdgeReport; + +typedef struct FindCircularEdgeReport_struct { + PointFloat centerCalibrated; // Real world Coordinates of the Center. + double radiusCalibrated; // Real world radius of the Circular Edge found. + PointFloat center; // Pixel Coordinates of the Center. + double radius; // Radius in pixels of the Circular Edge found. + double roundness; // The roundness of the calculated circular edge. + double avgStrength; // Average strength of the egde found. + double avgSNR; // Average SNR(Signal to Noise Ratio) for the edge found. + int circleFound; // If the circlular edge is found or not. +} FindCircularEdgeReport; + +typedef struct WindowSize_struct { + int x; // Window lenght on X direction. + int y; // Window lenght on Y direction. + int stepSize; // Distance between windows. +} WindowSize; + +typedef struct DisplacementVector_struct { + int x; // length on X direction. + int y; // length on Y direction. +} DisplacementVector; + +typedef struct WaveletOptions_struct { + WaveletType typeOfWavelet; // Type of wavelet(db, bior. + float minEnergy; // Minimum Energy in the bands to consider for texture + // defect detection. +} WaveletOptions; + +typedef struct CooccurrenceOptions_struct { + int level; // Level/size of matrix. + DisplacementVector + displacement; // Displacemnet between pixels to accumulate the matrix. +} CooccurrenceOptions; + +typedef struct ParticleClassifierLocalThresholdOptions_struct { + LocalThresholdMethod + method; // Specifies the local thresholding method the function uses. + ParticleType particleType; // Specifies what kind of particles to look for. + unsigned int windowWidth; // The width of the rectangular window around the + // pixel on which the function performs the local + // threshold. + unsigned int windowHeight; // The height of the rectangular window around the + // pixel on which the function performs the local + // threshold. + double deviationWeight; // Specifies the k constant used in the Niblack local + // thresholding algorithm, which determines the + // weight applied to the variance calculation. +} ParticleClassifierLocalThresholdOptions; + +typedef struct RangeFloat_struct { + float minValue; // The minimum value of the range. + float maxValue; // The maximum value of the range. +} RangeFloat; + +typedef struct ParticleClassifierAutoThresholdOptions_struct { + ThresholdMethod method; // The method for binary thresholding, which + // specifies how to calculate the classes. + ParticleType particleType; // Specifies what kind of particles to look for. + RangeFloat limits; // The limits on the automatic threshold range. +} ParticleClassifierAutoThresholdOptions; + +typedef struct ParticleClassifierPreprocessingOptions2_struct { + ParticleClassifierThresholdType + thresholdType; // The type of threshold to perform on the image. + RangeFloat manualThresholdRange; // The range of pixels to keep if manually + // thresholding the image. + ParticleClassifierAutoThresholdOptions + autoThresholdOptions; // The options used to auto threshold the image. + ParticleClassifierLocalThresholdOptions + localThresholdOptions; // The options used to local threshold the image. + int rejectBorder; // Set this element to TRUE to reject border particles. + int numErosions; // The number of erosions to perform. +} ParticleClassifierPreprocessingOptions2; + +typedef struct MeasureParticlesReport_struct { + double** pixelMeasurements; // The measurements on the particles in the + // image, in pixel coordinates. + double** calibratedMeasurements; // The measurements on the particles in the + // image, in real-world coordinates. + size_t numParticles; // The number of particles on which measurements were + // taken. + size_t numMeasurements; // The number of measurements taken. +} MeasureParticlesReport; + +typedef struct GeometricPatternMatch3_struct { + PointFloat + position; // The location of the origin of the template in the match. + float rotation; // The rotation of the match relative to the template image, + // in degrees. + float scale; // The size of the match relative to the size of the template + // image, expressed as a percentage. + float score; // The accuracy of the match. + PointFloat corner[4]; // An array of four points describing the rectangle + // surrounding the template image. + int inverse; // This element is TRUE if the match is an inverse of the + // template image. + float occlusion; // The percentage of the match that is occluded. + float templateMatchCurveScore; // The accuracy of the match obtained by + // comparing the template curves to the curves + // in the match region. + float matchTemplateCurveScore; // The accuracy of the match obtained by + // comparing the curves in the match region to + // the template curves. + float correlationScore; // The accuracy of the match obtained by comparing + // the template image to the match region using a + // correlation metric that compares the two regions + // as a function of their pixel values. + PointFloat calibratedPosition; // The location of the origin of the template + // in the match. + float calibratedRotation; // The rotation of the match relative to the + // template image, in degrees. + PointFloat calibratedCorner[4]; // An array of four points describing the + // rectangle surrounding the template image. +} GeometricPatternMatch3; + +typedef struct MatchGeometricPatternAdvancedOptions3_struct { + unsigned int subpixelIterations; // Specifies the maximum number of + // incremental improvements used to refine + // matches with subpixel information. + double subpixelTolerance; // Specifies the maximum amount of change, in + // pixels, between consecutive incremental + // improvements in the match position before the + // function stops refining the match position. + unsigned int + initialMatchListLength; // Specifies the maximum size of the match list. + int targetTemplateCurveScore; // Set this element to TRUE to specify that the + // function should calculate the match curve to + // template curve score and return it for each + // match result. + int correlationScore; // Set this element to TRUE to specify that the + // function should calculate the correlation score and + // return it for each match result. + double minMatchSeparationDistance; // Specifies the minimum separation + // distance, in pixels, between the + // origins of two matches that have unique + // positions. + double minMatchSeparationAngle; // Specifies the minimum angular difference, + // in degrees, between two matches that have + // unique angles. + double minMatchSeparationScale; // Specifies the minimum difference in scale, + // expressed as a percentage, between two + // matches that have unique scales. + double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed + // as a percentage, allowed between the bounding + // rectangles of two unique matches. + int coarseResult; // Specifies whether you want the function to spend less + // time accurately estimating the location of a match. + int enableCalibrationSupport; // Set this element to TRUE to specify the + // algorithm treat the inspection image as a + // calibrated image. + ContrastMode enableContrastReversal; // Use this element to specify the + // contrast of the matches to search for + // in the image. + GeometricMatchingSearchStrategy + matchStrategy; // Specifies the aggressiveness of the search strategy. + unsigned int refineMatchFactor; // Specifies the factor that is applied to + // the number of matches requested by the + // user to determine the number of matches + // that are refined at the initial matching + // stage. + unsigned int subpixelMatchFactor; // Specifies the factor that is applied to + // the number of matches requested by the + // user to determine the number of matches + // that are evaluated at the final subpixel + // matching stage. +} MatchGeometricPatternAdvancedOptions3; + +typedef struct ColorOptions_struct { + ColorClassificationResolution colorClassificationResolution; // Specifies the + // color + // resolution of + // the + // classifier. + unsigned int useLuminance; // Specifies if the luminance band is going to be + // used in the feature vector. + ColorMode colorMode; // Specifies the color mode of the classifier. +} ColorOptions; + +typedef struct SampleScore_struct { + char* className; // The name of the class. + float distance; // The distance from the item to this class. + unsigned int index; // index of this sample. +} SampleScore; + +typedef struct ClassifierReportAdvanced_struct { + char* bestClassName; // The name of the best class for the sample. + float classificationScore; // The similarity of the sample and the two + // closest classes in the classifier. + float identificationScore; // The similarity of the sample and the assigned + // class. + ClassScore* allScores; // All classes and their scores. + int allScoresSize; // The number of entries in allScores. + SampleScore* sampleScores; // All samples and their scores. + int sampleScoresSize; // The number of entries in sampleScores. +} ClassifierReportAdvanced; + +typedef struct LearnGeometricPatternAdvancedOptions2_struct { + double minScaleFactor; // Specifies the minimum scale factor that the + // template is learned for. + double maxScaleFactor; // Specifies the maximum scale factor the template is + // learned for. + double minRotationAngleValue; // Specifies the minimum rotation angle the + // template is learned for. + double maxRotationAngleValue; // Specifies the maximum rotation angle the + // template is learned for. + unsigned int imageSamplingFactor; // Specifies the factor that is used to + // subsample the template and the image for + // the initial matching phase. +} LearnGeometricPatternAdvancedOptions2; + +typedef struct ParticleFilterOptions2_struct { + int rejectMatches; // Set this parameter to TRUE to transfer only those + // particles that do not meet all the criteria. + int rejectBorder; // Set this element to TRUE to reject border particles. + int fillHoles; // Set this element to TRUE to fill holes in particles. + int connectivity8; // Set this parameter to TRUE to use connectivity-8 to + // determine whether particles are touching. +} ParticleFilterOptions2; + +typedef struct FindEdgeOptions2_struct { + RakeDirection direction; // The direction to search in the ROI. + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showSearchLines; // If TRUE, the function overlays the search lines used + // to locate the edges on the image. + int showEdgesFound; // If TRUE, the function overlays the locations of the + // edges found on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay + // the search lines. + RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay + // the search edges. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the overlay group name to assign to the + // overlays. + EdgeOptions2 edgeOptions; // Specifies the edge detection options along a + // single search line. +} FindEdgeOptions2; + +typedef struct FindEdgeReport_struct { + StraightEdge* straightEdges; // An array of straight edges detected. + unsigned int + numStraightEdges; // Indicates the number of straight edges found. +} FindEdgeReport; + +typedef struct FindTransformRectOptions2_struct { + FindReferenceDirection direction; // Specifies the direction and orientation + // in which the function searches for the + // primary axis. + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showSearchLines; // If TRUE, the function overlays the search lines used + // to locate the edges on the image. + int showEdgesFound; // If TRUE, the function overlays the locations of the + // edges found on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay + // the search lines. + RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay + // the search edges. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the overlay group name to assign to the + // overlays. + EdgeOptions2 edgeOptions; // Specifies the edge detection options along a + // single search line. +} FindTransformRectOptions2; + +typedef struct FindTransformRectsOptions2_struct { + FindReferenceDirection direction; // Specifies the direction and orientation + // in which the function searches for the + // primary axis. + int showSearchArea; // If TRUE, the function overlays the search area on the + // image. + int showSearchLines; // If TRUE, the function overlays the search lines used + // to locate the edges on the image. + int showEdgesFound; // If TRUE, the function overlays the locations of the + // edges found on the image. + int showResult; // If TRUE, the function overlays the hit lines to the object + // and the edge used to generate the hit line on the result + // image. + RGBValue searchAreaColor; // Specifies the RGB color value to use to overlay + // the search area. + RGBValue searchLinesColor; // Specifies the RGB color value to use to overlay + // the search lines. + RGBValue searchEdgesColor; // Specifies the RGB color value to use to overlay + // the search edges. + RGBValue resultColor; // Specifies the RGB color value to use to overlay the + // results. + char* overlayGroupName; // Specifies the overlay group name to assign to the + // overlays. + EdgeOptions2 primaryEdgeOptions; // Specifies the parameters used to compute + // the edge gradient information and detect + // the edges for the primary ROI. + EdgeOptions2 secondaryEdgeOptions; // Specifies the parameters used to + // compute the edge gradient information + // and detect the edges for the secondary + // ROI. +} FindTransformRectsOptions2; + +typedef struct ReadTextReport3_struct { + const char* readString; // The read string. + CharReport3* characterReport; // An array of reports describing the + // properties of each identified character. + int numCharacterReports; // The number of identified characters. + ROI* roiBoundingCharacters; // An array specifying the coordinates of the + // character bounding ROI. +} ReadTextReport3; + +typedef struct CharacterStatistics_struct { + int left; // The left offset of the character bounding rectangles in the + // current ROI. + int top; // The top offset of the character bounding rectangles in the + // current ROI. + int width; // The width of each of the characters you trained in the current + // ROI. + int height; // The height of each trained character in the current ROI. + int characterSize; // The size of the character in pixels. +} CharacterStatistics; + +typedef struct CharReport3_struct { + const char* character; // The character value. + int classificationScore; // The degree to which the assigned character class + // represents the object better than the other + // character classes in the character set. + int verificationScore; // The similarity of the character and the reference + // character for the character class. + int verified; // This element is TRUE if a reference character was found for + // the character class and FALSE if a reference character was + // not found. + int lowThreshold; // The minimum value of the threshold range used for this + // character. + int highThreshold; // The maximum value of the threshold range used for this + // character. + CharacterStatistics + characterStats; // Describes the characters segmented in the ROI. +} CharReport3; + +typedef struct ArcInfo2_struct { + PointFloat center; // The center point of the arc. + double radius; // The radius of the arc. + double startAngle; // The starting angle of the arc, specified + // counter-clockwise from the x-axis. + double endAngle; // The ending angle of the arc, specified counter-clockwise + // from the x-axis. +} ArcInfo2; + +typedef struct EdgeReport2_struct { + EdgeInfo* edges; // An array of edges detected. + unsigned int numEdges; // Indicates the number of edges detected. + double* gradientInfo; // An array that contains the calculated edge strengths + // along the user-defined search area. + unsigned int numGradientInfo; // Indicates the number of elements contained + // in gradientInfo. + int calibrationValid; // Indicates if the calibration data corresponding to + // the location of the edges is correct. +} EdgeReport2; + +typedef struct SearchArcInfo_struct { + ArcInfo2 arcCoordinates; // Describes the arc used for edge detection. + EdgeReport2 edgeReport; // Describes the edges found in this search line. +} SearchArcInfo; + +typedef struct ConcentricRakeReport2_struct { + EdgeInfo* firstEdges; // The first edge point detected along each search line + // in the ROI. + unsigned int numFirstEdges; // The number of points in the firstEdges array. + EdgeInfo* lastEdges; // The last edge point detected along each search line + // in the ROI. + unsigned int numLastEdges; // The number of points in the lastEdges array. + SearchArcInfo* searchArcs; // Contains the arcs used for edge detection and + // the edge information for each arc. + unsigned int numSearchArcs; // The number of arcs in the searchArcs array. +} ConcentricRakeReport2; + +typedef struct SpokeReport2_struct { + EdgeInfo* firstEdges; // The first edge point detected along each search line + // in the ROI. + unsigned int numFirstEdges; // The number of points in the firstEdges array. + EdgeInfo* lastEdges; // The last edge point detected along each search line + // in the ROI. + unsigned int numLastEdges; // The number of points in the lastEdges array. + SearchLineInfo* searchLines; // The search lines used for edge detection. + unsigned int + numSearchLines; // The number of search lines used in the edge detection. +} SpokeReport2; + +typedef struct EdgeInfo_struct { + PointFloat position; // The location of the edge in the image. + PointFloat calibratedPosition; // The position of the edge in the image in + // real-world coordinates. + double distance; // The location of the edge from the first point along the + // boundary of the input ROI. + double calibratedDistance; // The location of the edge from the first point + // along the boundary of the input ROI in + // real-world coordinates. + double magnitude; // The intensity contrast at the edge. + double + noisePeak; // The strength of the noise associated with the current edge. + int rising; // Indicates the polarity of the edge. +} EdgeInfo; + +typedef struct SearchLineInfo_struct { + LineFloat lineCoordinates; // The endpoints of the search line. + EdgeReport2 edgeReport; // Describes the edges found in this search line. +} SearchLineInfo; + +typedef struct RakeReport2_struct { + EdgeInfo* firstEdges; // The first edge point detected along each search line + // in the ROI. + unsigned int numFirstEdges; // The number of points in the firstEdges array. + EdgeInfo* lastEdges; // The last edge point detected along each search line + // in the ROI. + unsigned int numLastEdges; // The number of points in the lastEdges array. + SearchLineInfo* searchLines; // The search lines used for edge detection. + unsigned int + numSearchLines; // The number of search lines used in the edge detection. +} RakeReport2; + +typedef struct TransformBehaviors_struct { + GroupBehavior ShiftBehavior; // Specifies the behavior of an overlay group + // when a shift operation is applied to an + // image. + GroupBehavior ScaleBehavior; // Specifies the behavior of an overlay group + // when a scale operation is applied to an + // image. + GroupBehavior RotateBehavior; // Specifies the behavior of an overlay group + // when a rotate operation is applied to an + // image. + GroupBehavior SymmetryBehavior; // Specifies the behavior of an overlay group + // when a symmetry operation is applied to an + // image. +} TransformBehaviors; + +typedef struct QRCodeDataToken_struct { + QRStreamMode mode; // Specifies the stream mode or the format of the data + // that is encoded in the QR code. + unsigned int modeData; // Indicates specifiers used by the user to + // postprocess the data if it requires it. + unsigned char* data; // Shows the encoded data in the QR code. + unsigned int + dataLength; // Specifies the length of the data found in the QR code. +} QRCodeDataToken; + +typedef struct ParticleFilterOptions_struct { + int rejectMatches; // Set this parameter to TRUE to transfer only those + // particles that do not meet all the criteria. + int rejectBorder; // Set this element to TRUE to reject border particles. + int connectivity8; // Set this parameter to TRUE to use connectivity-8 to + // determine whether particles are touching. +} ParticleFilterOptions; + +typedef struct StraightEdgeReport2_struct { + StraightEdge* straightEdges; // Contains an array of found straight edges. + unsigned int + numStraightEdges; // Indicates the number of straight edges found. + SearchLineInfo* searchLines; // Contains an array of all search lines used in + // the detection. + unsigned int + numSearchLines; // The number of search lines used in the edge detection. +} StraightEdgeReport2; + +typedef struct StraightEdgeOptions_struct { + unsigned int numLines; // Specifies the number of straight edges to find. + StraightEdgeSearchMode + searchMode; // Specifies the method used to find the straight edge. + double minScore; // Specifies the minimum score of a detected straight edge. + double maxScore; // Specifies the maximum score of a detected edge. + double orientation; // Specifies the angle at which the straight edge is + // expected to be found. + double angleRange; // Specifies the +/- range around the orientation within + // which the straight edge is expected to be found. + double angleTolerance; // Specifies the expected angular accuracy of the + // straight edge. + unsigned int stepSize; // Specifies the gap in pixels between the search + // lines used with the rake-based methods. + double minSignalToNoiseRatio; // Specifies the minimum signal to noise ratio + // (SNR) of the edge points used to fit the + // straight edge. + double minCoverage; // Specifies the minimum number of points as a percentage + // of the number of search lines that need to be included + // in the detected straight edge. + unsigned int houghIterations; // Specifies the number of iterations used in + // the Hough-based method. +} StraightEdgeOptions; + +typedef struct StraightEdge_struct { + LineFloat straightEdgeCoordinates; // End points of the detected straight + // edge in pixel coordinates. + LineFloat calibratedStraightEdgeCoordinates; // End points of the detected + // straight edge in real-world + // coordinates. + double angle; // Angle of the found edge using the pixel coordinates. + double calibratedAngle; // Angle of the found edge using the real-world + // coordinates. + double score; // Describes the score of the detected edge. + double straightness; // The straightness value of the detected straight edge. + double averageSignalToNoiseRatio; // Describes the average signal to noise + // ratio (SNR) of the detected edge. + int calibrationValid; // Indicates if the calibration data for the straight + // edge is valid. + EdgeInfo* usedEdges; // An array of edges that were used to determine this + // straight line. + unsigned int + numUsedEdges; // Indicates the number of edges in the usedEdges array. +} StraightEdge; + +typedef struct QRCodeSearchOptions_struct { + QRRotationMode rotationMode; // Specifies the amount of QR code rotation the + // function should allow for. + unsigned int skipLocation; // If set to TRUE, specifies that the function + // should assume that the QR code occupies the + // entire image (or the entire search region). + unsigned int edgeThreshold; // The strength of the weakest edge the function + // uses to find the coarse location of the QR + // code in the image. + QRDemodulationMode demodulationMode; // The demodulation mode the function + // uses to locate the QR code. + QRCellSampleSize cellSampleSize; // The cell sample size the function uses to + // locate the QR code. + QRCellFilterMode cellFilterMode; // The cell filter mode the function uses to + // locate the QR code. + unsigned int skewDegreesAllowed; // Specifies the amount of skew in the QR + // code the function should allow for. +} QRCodeSearchOptions; + +typedef struct QRCodeSizeOptions_struct { + unsigned int minSize; // Specifies the minimum size (in pixels) of the QR + // code in the image. + unsigned int maxSize; // Specifies the maximum size (in pixels) of the QR + // code in the image. +} QRCodeSizeOptions; + +typedef struct QRCodeDescriptionOptions_struct { + QRDimensions dimensions; // The number of rows and columns that are populated + // for the QR code, measured in cells. + QRPolarities polarity; // The polarity of the QR code. + QRMirrorMode mirror; // This element is TRUE if the QR code appears mirrored + // in the image and FALSE if the QR code appears + // normally in the image. + QRModelType + modelType; // This option allows you to specify the type of QR code. +} QRCodeDescriptionOptions; + +typedef struct QRCodeReport_struct { + unsigned int found; // This element is TRUE if the function located and + // decoded a QR code and FALSE if the function failed to + // locate and decode a QR code. + unsigned char* data; // The data encoded in the QR code. + unsigned int dataLength; // The length of the data array. + PointFloat boundingBox[4]; // An array of four points describing the + // rectangle surrounding the QR code. + QRCodeDataToken* tokenizedData; // Contains the data tokenized in exactly the + // way it was encoded in the code. + unsigned int sizeOfTokenizedData; // Size of the tokenized data. + unsigned int numErrorsCorrected; // The number of errors the function + // corrected when decoding the QR code. + unsigned int dimensions; // The number of rows and columns that are populated + // for the QR code, measured in cells. + unsigned int version; // The version of the QR code. + QRModelType modelType; // This option allows you to specify what type of QR + // code this is. + QRStreamMode streamMode; // The format of the data encoded in the stream. + QRPolarities matrixPolarity; // The polarity of the QR code. + unsigned int mirrored; // This element is TRUE if the QR code appears + // mirrored in the image and FALSE if the QR code + // appears normally in the image. + unsigned int positionInAppendStream; // Indicates what position the QR code + // is in with respect to the stream of + // data in all codes. + unsigned int sizeOfAppendStream; // Specifies how many QR codes are part of a + // larger array of codes. + int firstEAN128ApplicationID; // The first EAN-128 Application ID encountered + // in the stream. + int firstECIDesignator; // The first Regional Language Designator encountered + // in the stream. + unsigned int appendStreamIdentifier; // Specifies what stream the QR code is + // in relation to when the code is part + // of a larger array of codes. + unsigned int minimumEdgeStrength; // The strength of the weakest edge the + // function used to find the coarse + // location of the QR code in the image. + QRDemodulationMode demodulationMode; // The demodulation mode the function + // used to locate the QR code. + QRCellSampleSize cellSampleSize; // The cell sample size the function used to + // locate the QR code. + QRCellFilterMode cellFilterMode; // The cell filter mode the function used to + // locate the QR code. +} QRCodeReport; + +typedef struct AIMGradeReport_struct { + AIMGrade overallGrade; // The overall letter grade, which is equal to the + // lowest of the other five letter grades. + AIMGrade decodingGrade; // The letter grade assigned to a Data Matrix barcode + // based on the success of the function in decoding + // the Data Matrix barcode. + AIMGrade symbolContrastGrade; // The letter grade assigned to a Data Matrix + // barcode based on the symbol contrast raw + // score. + float symbolContrast; // The symbol contrast raw score representing the + // percentage difference between the mean of the + // reflectance of the darkest 10 percent and lightest + // 10 percent of the Data Matrix barcode. + AIMGrade printGrowthGrade; // The print growth letter grade for the Data + // Matrix barcode. + float printGrowth; // The print growth raw score for the barcode, which is + // based on the extent to which dark or light markings + // appropriately fill their module boundaries. + AIMGrade axialNonuniformityGrade; // The axial nonuniformity grade for the + // Data Matrix barcode. + float axialNonuniformity; // The axial nonuniformity raw score for the + // barcode, which is based on how much the sampling + // point spacing differs from one axis to another. + AIMGrade unusedErrorCorrectionGrade; // The unused error correction letter + // grade for the Data Matrix barcode. + float unusedErrorCorrection; // The unused error correction raw score for the + // Data Matrix barcode, which is based on the + // extent to which regional or spot damage in + // the Data Matrix barcode has eroded the + // reading safety margin provided by the error + // correction. +} AIMGradeReport; + +typedef struct DataMatrixSizeOptions_struct { + unsigned int minSize; // Specifies the minimum size (in pixels) of the Data + // Matrix barcode in the image. + unsigned int maxSize; // Specifies the maximum size (in pixels) of the Data + // Matrix barcode in the image. + unsigned int quietZoneWidth; // Specifies the expected minimum size of the + // quiet zone, in pixels. +} DataMatrixSizeOptions; + +typedef struct DataMatrixDescriptionOptions_struct { + float aspectRatio; // Specifies the ratio of the width of each Data Matrix + // barcode cell (in pixels) to the height of the Data + // Matrix barcode (in pixels). + unsigned int rows; // Specifies the number of rows in the Data Matrix + // barcode. + unsigned int + columns; // Specifies the number of columns in the Data Matrix barcode. + int rectangle; // Set this element to TRUE to specify that the Data Matrix + // barcode is rectangular. + DataMatrixECC ecc; // Specifies the ECC used for this Data Matrix barcode. + DataMatrixPolarity polarity; // Specifies the data-to-background contrast for + // the Data Matrix barcode. + DataMatrixCellFillMode cellFill; // Specifies the fill percentage for a cell + // of the Data Matrix barcode that is in the + // "ON" state. + float minBorderIntegrity; // Specifies the minimum percentage of the border + // (locator pattern and timing pattern) the + // function should expect in the Data Matrix + // barcode. + DataMatrixMirrorMode mirrorMode; // Specifies if the Data Matrix barcode + // appears normally in the image or if the + // barcode appears mirrored in the image. +} DataMatrixDescriptionOptions; + +typedef struct DataMatrixSearchOptions_struct { + DataMatrixRotationMode rotationMode; // Specifies the amount of Data Matrix + // barcode rotation the function should + // allow for. + int skipLocation; // If set to TRUE, specifies that the function should + // assume that the Data Matrix barcode occupies the entire + // image (or the entire search region). + unsigned int edgeThreshold; // Specifies the minimum contrast a pixel must + // have in order to be considered part of a + // matrix cell edge. + DataMatrixDemodulationMode demodulationMode; // Specifies the mode the + // function should use to + // demodulate (determine which + // cells are on and which cells + // are off) the Data Matrix + // barcode. + DataMatrixCellSampleSize cellSampleSize; // Specifies the sample size, in + // pixels, the function should take + // to determine if each cell is on + // or off. + DataMatrixCellFilterMode cellFilterMode; // Specifies the mode the function + // uses to determine the pixel value + // for each cell. + unsigned int skewDegreesAllowed; // Specifies the amount of skew in the Data + // Matrix barcode the function should allow + // for. + unsigned int maxIterations; // Specifies the maximum number of iterations + // before the function stops looking for the Data + // Matrix barcode. + unsigned int initialSearchVectorWidth; // Specifies the number of pixels the + // function should average together to + // determine the location of an edge. +} DataMatrixSearchOptions; + +typedef struct DataMatrixReport_struct { + int found; // This element is TRUE if the function located and decoded a Data + // Matrix barcode and FALSE if the function failed to locate and + // decode a Data Matrix barcode. + int binary; // This element is TRUE if the Data Matrix barcode contains + // binary data and FALSE if the Data Matrix barcode contains text + // data. + unsigned char* data; // The data encoded in the Data Matrix barcode. + unsigned int dataLength; // The length of the data array. + PointFloat boundingBox[4]; // An array of four points describing the + // rectangle surrounding the Data Matrix barcode. + unsigned int numErrorsCorrected; // The number of errors the function + // corrected when decoding the Data Matrix + // barcode. + unsigned int numErasuresCorrected; // The number of erasures the function + // corrected when decoding the Data Matrix + // barcode. + float aspectRatio; // Specifies the aspect ratio of the Data Matrix barcode + // in the image, which equals the ratio of the width of a + // Data Matrix barcode cell (in pixels) to the height of a + // Data Matrix barcode cell (in pixels). + unsigned int rows; // The number of rows in the Data Matrix barcode. + unsigned int columns; // The number of columns in the Data Matrix barcode. + DataMatrixECC + ecc; // The Error Correction Code (ECC) used by the Data Matrix barcode. + DataMatrixPolarity polarity; // The polarity of the Data Matrix barcode. + DataMatrixCellFillMode + cellFill; // The cell fill percentage of the Data Matrix barcode. + float borderIntegrity; // The percentage of the Data Matrix barcode border + // that appears correctly in the image. + int mirrored; // This element is TRUE if the Data Matrix barcode appears + // mirrored in the image and FALSE if the Data Matrix barcode + // appears normally in the image. + unsigned int minimumEdgeStrength; // The strength of the weakest edge the + // function used to find the coarse + // location of the Data Matrix barcode in + // the image. + DataMatrixDemodulationMode demodulationMode; // The demodulation mode the + // function used to locate the + // Data Matrix barcode. + DataMatrixCellSampleSize cellSampleSize; // The cell sample size the function + // used to locate the Data Matrix + // barcode. + DataMatrixCellFilterMode cellFilterMode; // The cell filter mode the function + // used to locate the Data Matrix + // barcode. + unsigned int iterations; // The number of iterations the function took in + // attempting to locate the Data Matrix barcode. +} DataMatrixReport; + +typedef struct JPEG2000FileAdvancedOptions_struct { + WaveletTransformMode waveletMode; // Determines which wavelet transform to + // use when writing the file. + int useMultiComponentTransform; // Set this parameter to TRUE to use an + // additional transform on RGB images. + unsigned int maxWaveletTransformLevel; // Specifies the maximum allowed level + // of wavelet transform. + float quantizationStepSize; // Specifies the absolute base quantization step + // size for derived quantization mode. +} JPEG2000FileAdvancedOptions; + +typedef struct MatchGeometricPatternAdvancedOptions2_struct { + int minFeaturesUsed; // Specifies the minimum number of features the function + // uses when matching. + int maxFeaturesUsed; // Specifies the maximum number of features the function + // uses when matching. + int subpixelIterations; // Specifies the maximum number of incremental + // improvements used to refine matches with subpixel + // information. + double subpixelTolerance; // Specifies the maximum amount of change, in + // pixels, between consecutive incremental + // improvements in the match position before the + // function stops refining the match position. + int initialMatchListLength; // Specifies the maximum size of the match list. + float matchTemplateCurveScore; // Set this element to TRUE to specify that + // the function should calculate the match + // curve to template curve score and return it + // for each match result. + int correlationScore; // Set this element to TRUE to specify that the + // function should calculate the correlation score and + // return it for each match result. + double minMatchSeparationDistance; // Specifies the minimum separation + // distance, in pixels, between the + // origins of two matches that have unique + // positions. + double minMatchSeparationAngle; // Specifies the minimum angular difference, + // in degrees, between two matches that have + // unique angles. + double minMatchSeparationScale; // Specifies the minimum difference in scale, + // expressed as a percentage, between two + // matches that have unique scales. + double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed + // as a percentage, allowed between the bounding + // rectangles of two unique matches. + int coarseResult; // Specifies whether you want the function to spend less + // time accurately estimating the location of a match. + int smoothContours; // Set this element to TRUE to specify smoothing be done + // on the contours of the inspection image before feature + // extraction. + int enableCalibrationSupport; // Set this element to TRUE to specify the + // algorithm treat the inspection image as a + // calibrated image. +} MatchGeometricPatternAdvancedOptions2; + +typedef struct InspectionAlignment_struct { + PointFloat position; // The location of the center of the golden template in + // the image under inspection. + float rotation; // The rotation of the golden template in the image under + // inspection, in degrees. + float scale; // The percentage of the size of the area under inspection + // compared to the size of the golden template. +} InspectionAlignment; + +typedef struct InspectionOptions_struct { + RegistrationMethod registrationMethod; // Specifies how the function + // registers the golden template and + // the target image. + NormalizationMethod normalizationMethod; // Specifies how the function + // normalizes the golden template to + // the target image. + int edgeThicknessToIgnore; // Specifies desired thickness of edges to be + // ignored. + float brightThreshold; // Specifies the threshold for areas where the target + // image is brighter than the golden template. + float darkThreshold; // Specifies the threshold for areas where the target + // image is darker than the golden template. + int binary; // Specifies whether the function should return a binary image + // giving the location of defects, or a grayscale image giving + // the intensity of defects. +} InspectionOptions; + +typedef struct CharReport2_struct { + const char* character; // The character value. + PointFloat corner[4]; // An array of four points that describes the rectangle + // that surrounds the character. + int lowThreshold; // The minimum value of the threshold range used for this + // character. + int highThreshold; // The maximum value of the threshold range used for this + // character. + int classificationScore; // The degree to which the assigned character class + // represents the object better than the other + // character classes in the character set. + int verificationScore; // The similarity of the character and the reference + // character for the character class. + int verified; // This element is TRUE if a reference character was found for + // the character class and FALSE if a reference character was + // not found. +} CharReport2; + +typedef struct CharInfo2_struct { + const char* charValue; // Retrieves the character value of the corresponding + // character in the character set. + const Image* charImage; // The image you used to train this character. + const Image* internalImage; // The internal representation that NI Vision + // uses to match objects to this character. + int isReferenceChar; // This element is TRUE if the character is the + // reference character for the character class. +} CharInfo2; + +typedef struct ReadTextReport2_struct { + const char* readString; // The read string. + CharReport2* characterReport; // An array of reports describing the + // properties of each identified character. + int numCharacterReports; // The number of identified characters. +} ReadTextReport2; + +typedef struct EllipseFeature_struct { + PointFloat position; // The location of the center of the ellipse. + double rotation; // The orientation of the semi-major axis of the ellipse + // with respect to the horizontal. + double minorRadius; // The length of the semi-minor axis of the ellipse. + double majorRadius; // The length of the semi-major axis of the ellipse. +} EllipseFeature; + +typedef struct CircleFeature_struct { + PointFloat position; // The location of the center of the circle. + double radius; // The radius of the circle. +} CircleFeature; + +typedef struct ConstCurveFeature_struct { + PointFloat + position; // The center of the circle that this constant curve lies upon. + double radius; // The radius of the circle that this constant curve lies + // upon. + double startAngle; // When traveling along the constant curve from one + // endpoint to the next in a counterclockwise manner, this + // is the angular component of the vector originating at + // the center of the constant curve and pointing towards + // the first endpoint of the constant curve. + double endAngle; // When traveling along the constant curve from one endpoint + // to the next in a counterclockwise manner, this is the + // angular component of the vector originating at the center + // of the constant curve and pointing towards the second + // endpoint of the constant curve. +} ConstCurveFeature; + +typedef struct RectangleFeature_struct { + PointFloat position; // The center of the rectangle. + PointFloat corner[4]; // The four corners of the rectangle. + double rotation; // The orientation of the rectangle with respect to the + // horizontal. + double width; // The width of the rectangle. + double height; // The height of the rectangle. +} RectangleFeature; + +typedef struct LegFeature_struct { + PointFloat position; // The location of the leg feature. + PointFloat corner[4]; // The four corners of the leg feature. + double rotation; // The orientation of the leg with respect to the + // horizontal. + double width; // The width of the leg. + double height; // The height of the leg. +} LegFeature; + +typedef struct CornerFeature_struct { + PointFloat position; // The location of the corner feature. + double rotation; // The angular component of the vector bisecting the corner + // from position. + double enclosedAngle; // The measure of the enclosed angle of the corner. + int isVirtual; +} CornerFeature; + +typedef struct LineFeature_struct { + PointFloat startPoint; // The starting point of the line. + PointFloat endPoint; // The ending point of the line. + double length; // The length of the line measured in pixels from the start + // point to the end point. + double + rotation; // The orientation of the line with respect to the horizontal. +} LineFeature; + +typedef struct ParallelLinePairFeature_struct { + PointFloat + firstStartPoint; // The starting point of the first line of the pair. + PointFloat firstEndPoint; // The ending point of the first line of the pair. + PointFloat + secondStartPoint; // The starting point of the second line of the pair. + PointFloat secondEndPoint; // The ending point of the second line of the + // pair. + double rotation; // The orientation of the feature with respect to the + // horizontal. + double distance; // The distance from the first line to the second line. +} ParallelLinePairFeature; + +typedef struct PairOfParallelLinePairsFeature_struct { + ParallelLinePairFeature + firstParallelLinePair; // The first parallel line pair. + ParallelLinePairFeature + secondParallelLinePair; // The second parallel line pair. + double rotation; // The orientation of the feature with respect to the + // horizontal. + double distance; // The distance from the midline of the first parallel line + // pair to the midline of the second parallel line pair. +} PairOfParallelLinePairsFeature; + +typedef union GeometricFeature_union { + CircleFeature* circle; // A pointer to a CircleFeature. + EllipseFeature* ellipse; // A pointer to an EllipseFeature. + ConstCurveFeature* constCurve; // A pointer to a ConstCurveFeature. + RectangleFeature* rectangle; // A pointer to a RectangleFeature. + LegFeature* leg; // A pointer to a LegFeature. + CornerFeature* corner; // A pointer to a CornerFeature. + ParallelLinePairFeature* + parallelLinePair; // A pointer to a ParallelLinePairFeature. + PairOfParallelLinePairsFeature* + pairOfParallelLinePairs; // A pointer to a + // PairOfParallelLinePairsFeature. + LineFeature* line; // A pointer to a LineFeature. + ClosedCurveFeature* closedCurve; // A pointer to a ClosedCurveFeature. +} GeometricFeature; + +typedef struct FeatureData_struct { + FeatureType type; // An enumeration representing the type of the feature. + PointFloat* + contourPoints; // A set of points describing the contour of the feature. + int numContourPoints; // The number of points in the contourPoints array. + GeometricFeature + feature; // The feature data specific to this type of feature. +} FeatureData; + +typedef struct GeometricPatternMatch2_struct { + PointFloat + position; // The location of the origin of the template in the match. + float rotation; // The rotation of the match relative to the template image, + // in degrees. + float scale; // The size of the match relative to the size of the template + // image, expressed as a percentage. + float score; // The accuracy of the match. + PointFloat corner[4]; // An array of four points describing the rectangle + // surrounding the template image. + int inverse; // This element is TRUE if the match is an inverse of the + // template image. + float occlusion; // The percentage of the match that is occluded. + float templateMatchCurveScore; // The accuracy of the match obtained by + // comparing the template curves to the curves + // in the match region. + float matchTemplateCurveScore; // The accuracy of the match obtained by + // comparing the curves in the match region to + // the template curves. + float correlationScore; // The accuracy of the match obtained by comparing + // the template image to the match region using a + // correlation metric that compares the two regions + // as a function of their pixel values. + String255 label; // The label corresponding to this match when the match is + // returned by imaqMatchMultipleGeometricPatterns(). + FeatureData* featureData; // The features used in this match. + int numFeatureData; // The size of the featureData array. + PointFloat calibratedPosition; // The location of the origin of the template + // in the match. + float calibratedRotation; // The rotation of the match relative to the + // template image, in degrees. + PointFloat calibratedCorner[4]; // An array of four points describing the + // rectangle surrounding the template image. +} GeometricPatternMatch2; + +typedef struct ClosedCurveFeature_struct { + PointFloat position; // The center of the closed curve feature. + double arcLength; // The arc length of the closed curve feature. +} ClosedCurveFeature; + +typedef struct LineMatch_struct { + PointFloat startPoint; // The starting point of the matched line. + PointFloat endPoint; // The ending point of the matched line. + double length; // The length of the line measured in pixels from the start + // point to the end point. + double rotation; // The orientation of the matched line. + double score; // The score of the matched line. +} LineMatch; + +typedef struct LineDescriptor_struct { + double minLength; // Specifies the minimum length of a line the function will + // return. + double maxLength; // Specifies the maximum length of a line the function will + // return. +} LineDescriptor; + +typedef struct RectangleDescriptor_struct { + double minWidth; // Specifies the minimum width of a rectangle the algorithm + // will return. + double maxWidth; // Specifies the maximum width of a rectangle the algorithm + // will return. + double minHeight; // Specifies the minimum height of a rectangle the + // algorithm will return. + double maxHeight; // Specifies the maximum height of a rectangle the + // algorithm will return. +} RectangleDescriptor; + +typedef struct RectangleMatch_struct { + PointFloat corner[4]; // The corners of the matched rectangle. + double rotation; // The orientation of the matched rectangle. + double width; // The width of the matched rectangle. + double height; // The height of the matched rectangle. + double score; // The score of the matched rectangle. +} RectangleMatch; + +typedef struct EllipseDescriptor_struct { + double minMajorRadius; // Specifies the minimum length of the semi-major axis + // of an ellipse the function will return. + double maxMajorRadius; // Specifies the maximum length of the semi-major axis + // of an ellipse the function will return. + double minMinorRadius; // Specifies the minimum length of the semi-minor axis + // of an ellipse the function will return. + double maxMinorRadius; // Specifies the maximum length of the semi-minor axis + // of an ellipse the function will return. +} EllipseDescriptor; + +typedef struct EllipseMatch_struct { + PointFloat position; // The location of the center of the matched ellipse. + double rotation; // The orientation of the matched ellipse. + double + majorRadius; // The length of the semi-major axis of the matched ellipse. + double + minorRadius; // The length of the semi-minor axis of the matched ellipse. + double score; // The score of the matched ellipse. +} EllipseMatch; + +typedef struct CircleMatch_struct { + PointFloat position; // The location of the center of the matched circle. + double radius; // The radius of the matched circle. + double score; // The score of the matched circle. +} CircleMatch; + +typedef struct CircleDescriptor_struct { + double minRadius; // Specifies the minimum radius of a circle the function + // will return. + double maxRadius; // Specifies the maximum radius of a circle the function + // will return. +} CircleDescriptor; + +typedef struct ShapeDetectionOptions_struct { + unsigned int mode; // Specifies the method used when looking for the shape in + // the image. + RangeFloat* angleRanges; // An array of angle ranges, in degrees, where each + // range specifies how much you expect the shape to + // be rotated in the image. + int numAngleRanges; // The size of the orientationRanges array. + RangeFloat scaleRange; // A range that specifies the sizes of the shapes you + // expect to be in the image, expressed as a ratio + // percentage representing the size of the pattern in + // the image divided by size of the original pattern + // multiplied by 100. + double minMatchScore; +} ShapeDetectionOptions; + +typedef struct Curve_struct { + PointFloat* points; // The points on the curve. + unsigned int numPoints; // The number of points in the curve. + int closed; // This element is TRUE if the curve is closed and FALSE if the + // curve is open. + double curveLength; // The length of the curve. + double minEdgeStrength; // The lowest edge strength detected on the curve. + double maxEdgeStrength; // The highest edge strength detected on the curve. + double averageEdgeStrength; // The average of all edge strengths detected on + // the curve. +} Curve; + +typedef struct CurveOptions_struct { + ExtractionMode extractionMode; // Specifies the method the function uses to + // identify curves in the image. + int threshold; // Specifies the minimum contrast a seed point must have in + // order to begin a curve. + EdgeFilterSize filterSize; // Specifies the width of the edge filter the + // function uses to identify curves in the image. + int minLength; // Specifies the length, in pixels, of the smallest curve the + // function will extract. + int rowStepSize; // Specifies the distance, in the y direction, between lines + // the function inspects for curve seed points. + int columnStepSize; // Specifies the distance, in the x direction, between + // columns the function inspects for curve seed points. + int maxEndPointGap; // Specifies the maximum gap, in pixels, between the + // endpoints of a curve that the function identifies as a + // closed curve. + int onlyClosed; // Set this element to TRUE to specify that the function + // should only identify closed curves in the image. + int subpixelAccuracy; // Set this element to TRUE to specify that the + // function identifies the location of curves with + // subpixel accuracy by interpolating between points to + // find the crossing of threshold. +} CurveOptions; + +typedef struct Barcode2DInfo_struct { + Barcode2DType type; // The type of the 2D barcode. + int binary; // This element is TRUE if the 2D barcode contains binary data + // and FALSE if the 2D barcode contains text data. + unsigned char* data; // The data encoded in the 2D barcode. + unsigned int dataLength; // The length of the data array. + PointFloat boundingBox[4]; // An array of four points describing the + // rectangle surrounding the 2D barcode. + unsigned int numErrorsCorrected; // The number of errors the function + // corrected when decoding the 2D barcode. + unsigned int numErasuresCorrected; // The number of erasures the function + // corrected when decoding the 2D barcode. + unsigned int rows; // The number of rows in the 2D barcode. + unsigned int columns; // The number of columns in the 2D barcode. +} Barcode2DInfo; + +typedef struct DataMatrixOptions_struct { + Barcode2DSearchMode searchMode; // Specifies the mode the function uses to + // search for barcodes. + Barcode2DContrast contrast; // Specifies the contrast of the barcodes that + // the function searches for. + Barcode2DCellShape cellShape; // Specifies the shape of the barcode data + // cells, which affects how the function + // decodes the barcode. + Barcode2DShape barcodeShape; // Specifies the shape of the barcodes that the + // function searches for. + DataMatrixSubtype subtype; // Specifies the Data Matrix subtypes of the + // barcodes that the function searches for. +} DataMatrixOptions; + +typedef struct ClassifierAccuracyReport_struct { + int size; // The size of the arrays in this structure. + float accuracy; // The overall accuracy of the classifier, from 0 to 1000. + char** classNames; // The names of the classes of this classifier. + double* classAccuracy; // An array of size elements that contains accuracy + // information for each class. + double* classPredictiveValue; // An array containing size elements that + // contains the predictive values of each + // class. + int** classificationDistribution; // A two-dimensional array containing + // information about how the classifier + // classifies its samples. +} ClassifierAccuracyReport; + +typedef struct NearestNeighborClassResult_struct { + char* className; // The name of the class. + float standardDeviation; // The standard deviation of the members of this + // class. + int count; // The number of samples in this class. +} NearestNeighborClassResult; + +typedef struct NearestNeighborTrainingReport_struct { + float** classDistancesTable; // The confidence in the training. + NearestNeighborClassResult* allScores; // All classes and their scores. + int allScoresSize; // The number of entries in allScores. +} NearestNeighborTrainingReport; + +typedef struct ParticleClassifierPreprocessingOptions_struct { + int manualThreshold; // Set this element to TRUE to specify the threshold + // range manually. + RangeFloat manualThresholdRange; // If a manual threshold is being done, the + // range of pixels to keep. + ThresholdMethod autoThresholdMethod; // If an automatic threshold is being + // done, the method used to calculate + // the threshold range. + RangeFloat limits; // The limits on the automatic threshold range. + ParticleType particleType; // Specifies what kind of particles to look for. + int rejectBorder; // Set this element to TRUE to reject border particles. + int numErosions; // The number of erosions to perform. +} ParticleClassifierPreprocessingOptions; + +typedef struct ClassifierSampleInfo_struct { + char* className; // The name of the class this sample is in. + double* featureVector; // The feature vector of this sample, or NULL if this + // is not a custom classifier session. + int featureVectorSize; // The number of elements in the feature vector. + Image* thumbnail; // A thumbnail image of this sample, or NULL if no image + // was specified. +} ClassifierSampleInfo; + +typedef struct ClassScore_struct { + char* className; // The name of the class. + float distance; // The distance from the item to this class. +} ClassScore; + +typedef struct ClassifierReport_struct { + char* bestClassName; // The name of the best class for the sample. + float classificationScore; // The similarity of the sample and the two + // closest classes in the classifier. + float identificationScore; // The similarity of the sample and the assigned + // class. + ClassScore* allScores; // All classes and their scores. + int allScoresSize; // The number of entries in allScores. +} ClassifierReport; + +typedef struct NearestNeighborOptions_struct { + NearestNeighborMethod method; // The method to use. + NearestNeighborMetric metric; // The metric to use. + int k; // The value of k, if the IMAQ_K_NEAREST_NEIGHBOR method is used. +} NearestNeighborOptions; + +typedef struct ParticleClassifierOptions_struct { + float scaleDependence; // The relative importance of scale when classifying + // particles. + float mirrorDependence; // The relative importance of mirror symmetry when + // classifying particles. +} ParticleClassifierOptions; + +typedef struct RGBU64Value_struct { + unsigned short B; // The blue value of the color. + unsigned short G; // The green value of the color. + unsigned short R; // The red value of the color. + unsigned short alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} RGBU64Value; + +typedef struct GeometricPatternMatch_struct { + PointFloat + position; // The location of the origin of the template in the match. + float rotation; // The rotation of the match relative to the template image, + // in degrees. + float scale; // The size of the match relative to the size of the template + // image, expressed as a percentage. + float score; // The accuracy of the match. + PointFloat corner[4]; // An array of four points describing the rectangle + // surrounding the template image. + int inverse; // This element is TRUE if the match is an inverse of the + // template image. + float occlusion; // The percentage of the match that is occluded. + float templateMatchCurveScore; // The accuracy of the match obtained by + // comparing the template curves to the curves + // in the match region. + float matchTemplateCurveScore; // The accuracy of the match obtained by + // comparing the curves in the match region to + // the template curves. + float correlationScore; // The accuracy of the match obtained by comparing + // the template image to the match region using a + // correlation metric that compares the two regions + // as a function of their pixel values. +} GeometricPatternMatch; + +typedef struct MatchGeometricPatternAdvancedOptions_struct { + int minFeaturesUsed; // Specifies the minimum number of features the function + // uses when matching. + int maxFeaturesUsed; // Specifies the maximum number of features the function + // uses when matching. + int subpixelIterations; // Specifies the maximum number of incremental + // improvements used to refine matches with subpixel + // information. + double subpixelTolerance; // Specifies the maximum amount of change, in + // pixels, between consecutive incremental + // improvements in the match position before the + // function stops refining the match position. + int initialMatchListLength; // Specifies the maximum size of the match list. + int matchTemplateCurveScore; // Set this element to TRUE to specify that the + // function should calculate the match curve to + // template curve score and return it for each + // match result. + int correlationScore; // Set this element to TRUE to specify that the + // function should calculate the correlation score and + // return it for each match result. + double minMatchSeparationDistance; // Specifies the minimum separation + // distance, in pixels, between the + // origins of two matches that have unique + // positions. + double minMatchSeparationAngle; // Specifies the minimum angular difference, + // in degrees, between two matches that have + // unique angles. + double minMatchSeparationScale; // Specifies the minimum difference in scale, + // expressed as a percentage, between two + // matches that have unique scales. + double maxMatchOverlap; // Specifies the maximum amount of overlap, expressed + // as a percentage, allowed between the bounding + // rectangles of two unique matches. + int coarseResult; // Specifies whether you want the function to spend less + // time accurately estimating the location of a match. +} MatchGeometricPatternAdvancedOptions; + +typedef struct MatchGeometricPatternOptions_struct { + unsigned int mode; // Specifies the method imaqMatchGeometricPattern() uses + // when looking for the pattern in the image. + int subpixelAccuracy; // Set this element to TRUE to specify that the + // function should calculate match locations with + // subpixel accuracy. + RangeFloat* angleRanges; // An array of angle ranges, in degrees, where each + // range specifies how much you expect the template + // to be rotated in the image. + int numAngleRanges; // Number of angle ranges in the angleRanges array. + RangeFloat scaleRange; // A range that specifies the sizes of the pattern you + // expect to be in the image, expressed as a ratio + // percentage representing the size of the pattern in + // the image divided by size of the original pattern + // multiplied by 100. + RangeFloat occlusionRange; // A range that specifies the percentage of the + // pattern you expect to be occluded in the image. + int numMatchesRequested; // Number of valid matches expected. + float minMatchScore; // The minimum score a match can have for the function + // to consider the match valid. +} MatchGeometricPatternOptions; + +typedef struct LearnGeometricPatternAdvancedOptions_struct { + int minRectLength; // Specifies the minimum length for each side of a + // rectangular feature. + double minRectAspectRatio; // Specifies the minimum aspect ratio of a + // rectangular feature. + int minRadius; // Specifies the minimum radius for a circular feature. + int minLineLength; // Specifies the minimum length for a linear feature. + double minFeatureStrength; // Specifies the minimum strength for a feature. + int maxFeaturesUsed; // Specifies the maximum number of features the function + // uses when learning. + int maxPixelDistanceFromLine; // Specifies the maximum number of pixels + // between an edge pixel and a linear feature + // for the function to consider that edge pixel + // as part of the linear feature. +} LearnGeometricPatternAdvancedOptions; + +typedef struct FitEllipseOptions_struct { + int rejectOutliers; // Whether to use every given point or only a subset of + // the points to fit the ellipse. + double minScore; // Specifies the required quality of the fitted ellipse. + double pixelRadius; // The acceptable distance, in pixels, that a point + // determined to belong to the ellipse can be from the + // circumference of the ellipse. + int maxIterations; // Specifies the number of refinement iterations you allow + // the function to perform on the initial subset of + // points. +} FitEllipseOptions; + +typedef struct FitCircleOptions_struct { + int rejectOutliers; // Whether to use every given point or only a subset of + // the points to fit the circle. + double minScore; // Specifies the required quality of the fitted circle. + double pixelRadius; // The acceptable distance, in pixels, that a point + // determined to belong to the circle can be from the + // circumference of the circle. + int maxIterations; // Specifies the number of refinement iterations you allow + // the function to perform on the initial subset of + // points. +} FitCircleOptions; + +typedef struct ConstructROIOptions2_struct { + int windowNumber; // The window number of the image window. + const char* windowTitle; // Specifies the message string that the function + // displays in the title bar of the window. + PaletteType type; // The palette type to use. + RGBValue* palette; // If type is IMAQ_PALETTE_USER, this array is the palette + // of colors to use with the window. + int numColors; // If type is IMAQ_PALETTE_USER, this element is the number of + // colors in the palette array. + unsigned int maxContours; // The maximum number of contours the user will be + // able to select. +} ConstructROIOptions2; + +typedef struct HSLValue_struct { + unsigned char L; // The color luminance. + unsigned char S; // The color saturation. + unsigned char H; // The color hue. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} HSLValue; + +typedef struct HSVValue_struct { + unsigned char V; // The color value. + unsigned char S; // The color saturation. + unsigned char H; // The color hue. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} HSVValue; + +typedef struct HSIValue_struct { + unsigned char I; // The color intensity. + unsigned char S; // The color saturation. + unsigned char H; // The color hue. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} HSIValue; + +typedef struct CIELabValue_struct { + double b; // The yellow/blue information of the color. + double a; // The red/green information of the color. + double L; // The color lightness. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} CIELabValue; + +typedef struct CIEXYZValue_struct { + double Z; // The Z color information. + double Y; // The color luminance. + double X; // The X color information. + unsigned char alpha; // The alpha value of the color, which represents extra + // information about a color image, such as gamma + // correction. +} CIEXYZValue; + +typedef union Color2_union { + RGBValue rgb; // The information needed to describe a color in the RGB (Red, + // Green, and Blue) color space. + HSLValue hsl; // The information needed to describe a color in the HSL (Hue, + // Saturation, and Luminance) color space. + HSVValue hsv; // The information needed to describe a color in the HSI (Hue, + // Saturation, and Value) color space. + HSIValue hsi; // The information needed to describe a color in the HSI (Hue, + // Saturation, and Intensity) color space. + CIELabValue cieLab; // The information needed to describe a color in the CIE + // L*a*b* (L, a, b) color space. + CIEXYZValue cieXYZ; // The information needed to describe a color in the CIE + // XYZ (X, Y, Z) color space. + int rawValue; // The integer value for the data in the color union. +} Color2; + +typedef struct BestEllipse2_struct { + PointFloat center; // The coordinate location of the center of the ellipse. + PointFloat majorAxisStart; // The coordinate location of the start of the + // major axis of the ellipse. + PointFloat majorAxisEnd; // The coordinate location of the end of the major + // axis of the ellipse. + PointFloat minorAxisStart; // The coordinate location of the start of the + // minor axis of the ellipse. + PointFloat minorAxisEnd; // The coordinate location of the end of the minor + // axis of the ellipse. + double area; // The area of the ellipse. + double perimeter; // The length of the perimeter of the ellipse. + double error; // Represents the least square error of the fitted ellipse to + // the entire set of points. + int valid; // This element is TRUE if the function achieved the minimum score + // within the number of allowed refinement iterations and FALSE if + // the function did not achieve the minimum score. + int* pointsUsed; // An array of the indexes for the points array indicating + // which points the function used to fit the ellipse. + int numPointsUsed; // The number of points the function used to fit the + // ellipse. +} BestEllipse2; + +typedef struct LearnPatternAdvancedOptions_struct { + LearnPatternAdvancedShiftOptions* shiftOptions; // Use this element to + // control the behavior of + // imaqLearnPattern2() during + // the shift-invariant + // learning phase. + LearnPatternAdvancedRotationOptions* + rotationOptions; // Use this element to control the behavior of + // imaqLearnPattern2()during the rotation-invariant + // learning phase. +} LearnPatternAdvancedOptions; + +typedef struct AVIInfo_struct { + unsigned int width; // The width of each frame. + unsigned int height; // The height of each frame. + ImageType imageType; // The type of images this AVI contains. + unsigned int numFrames; // The number of frames in the AVI. + unsigned int framesPerSecond; // The number of frames per second this AVI + // should be shown at. + char* filterName; // The name of the compression filter used to create this + // AVI. + int hasData; // Specifies whether this AVI has data attached to each frame or + // not. + unsigned int maxDataSize; // If this AVI has data, the maximum size of the + // data in each frame. +} AVIInfo; + +typedef struct LearnPatternAdvancedShiftOptions_struct { + int initialStepSize; // The largest number of image pixels to shift the + // sample across the inspection image during the initial + // phase of shift-invariant matching. + int initialSampleSize; // Specifies the number of template pixels that you + // want to include in a sample for the initial phase + // of shift-invariant matching. + double initialSampleSizeFactor; // Specifies the size of the sample for the + // initial phase of shift-invariant matching + // as a percent of the template size, in + // pixels. + int finalSampleSize; // Specifies the number of template pixels you want to + // add to initialSampleSize for the final phase of + // shift-invariant matching. + double finalSampleSizeFactor; // Specifies the size of the sample for the + // final phase of shift-invariant matching as a + // percent of the edge points in the template, + // in pixels. + int subpixelSampleSize; // Specifies the number of template pixels that you + // want to include in a sample for the subpixel phase + // of shift-invariant matching. + double subpixelSampleSizeFactor; // Specifies the size of the sample for the + // subpixel phase of shift-invariant + // matching as a percent of the template + // size, in pixels. +} LearnPatternAdvancedShiftOptions; + +typedef struct LearnPatternAdvancedRotationOptions_struct { + SearchStrategy searchStrategySupport; // Specifies the aggressiveness of the + // rotation search strategy available + // during the matching phase. + int initialStepSize; // The largest number of image pixels to shift the + // sample across the inspection image during the initial + // phase of matching. + int initialSampleSize; // Specifies the number of template pixels that you + // want to include in a sample for the initial phase + // of rotation-invariant matching. + double initialSampleSizeFactor; // Specifies the size of the sample for the + // initial phase of rotation-invariant + // matching as a percent of the template + // size, in pixels. + int initialAngularAccuracy; // Sets the angle accuracy, in degrees, to use + // during the initial phase of rotation-invariant + // matching. + int finalSampleSize; // Specifies the number of template pixels you want to + // add to initialSampleSize for the final phase of + // rotation-invariant matching. + double finalSampleSizeFactor; // Specifies the size of the sample for the + // final phase of rotation-invariant matching + // as a percent of the edge points in the + // template, in pixels. + int finalAngularAccuracy; // Sets the angle accuracy, in degrees, to use + // during the final phase of the rotation-invariant + // matching. + int subpixelSampleSize; // Specifies the number of template pixels that you + // want to include in a sample for the subpixel phase + // of rotation-invariant matching. + double subpixelSampleSizeFactor; // Specifies the size of the sample for the + // subpixel phase of rotation-invariant + // matching as a percent of the template + // size, in pixels. +} LearnPatternAdvancedRotationOptions; + +typedef struct MatchPatternAdvancedOptions_struct { + int subpixelIterations; // Defines the maximum number of incremental + // improvements used to refine matching using + // subpixel information. + double subpixelTolerance; // Defines the maximum amount of change, in pixels, + // between consecutive incremental improvements in + // the match position that you want to trigger the + // end of the refinement process. + int initialMatchListLength; // Specifies the maximum size of the match list. + int matchListReductionFactor; // Specifies the reduction of the match list as + // matches are refined. + int initialStepSize; // Specifies the number of pixels to shift the sample + // across the inspection image during the initial phase + // of shift-invariant matching. + SearchStrategy searchStrategy; // Specifies the aggressiveness of the + // rotation search strategy. + int intermediateAngularAccuracy; // Specifies the accuracy to use during the + // intermediate phase of rotation-invariant + // matching. +} MatchPatternAdvancedOptions; + +typedef struct ParticleFilterCriteria2_struct { + MeasurementType parameter; // The morphological measurement that the function + // uses for filtering. + float lower; // The lower bound of the criteria range. + float upper; // The upper bound of the criteria range. + int calibrated; // Set this element to TRUE to take calibrated measurements. + int exclude; // Set this element to TRUE to indicate that a match occurs when + // the measurement is outside the criteria range. +} ParticleFilterCriteria2; + +typedef struct BestCircle2_struct { + PointFloat center; // The coordinate location of the center of the circle. + double radius; // The radius of the circle. + double area; // The area of the circle. + double perimeter; // The length of the perimeter of the circle. + double error; // Represents the least square error of the fitted circle to + // the entire set of points. + int valid; // This element is TRUE if the function achieved the minimum score + // within the number of allowed refinement iterations and FALSE if + // the function did not achieve the minimum score. + int* pointsUsed; // An array of the indexes for the points array indicating + // which points the function used to fit the circle. + int numPointsUsed; // The number of points the function used to fit the + // circle. +} BestCircle2; + +typedef struct OCRSpacingOptions_struct { + int minCharSpacing; // The minimum number of pixels that must be between two + // characters for NI Vision to train or read the + // characters separately. + int minCharSize; // The minimum number of pixels required for an object to be + // a potentially identifiable character. + int maxCharSize; // The maximum number of pixels required for an object to be + // a potentially identifiable character. + int maxHorizontalElementSpacing; // The maximum horizontal spacing, in + // pixels, allowed between character + // elements to train or read the character + // elements as a single character. + int maxVerticalElementSpacing; // The maximum vertical element spacing in + // pixels. + int minBoundingRectWidth; // The minimum possible width, in pixels, for a + // character bounding rectangle. + int maxBoundingRectWidth; // The maximum possible width, in pixels, for a + // character bounding rectangle. + int minBoundingRectHeight; // The minimum possible height, in pixels, for a + // character bounding rectangle. + int maxBoundingRectHeight; // The maximum possible height, in pixels, for a + // character bounding rectangle. + int autoSplit; // Set this element to TRUE to automatically adjust the + // location of the character bounding rectangle when + // characters overlap vertically. +} OCRSpacingOptions; + +typedef struct OCRProcessingOptions_struct { + ThresholdMode mode; // The thresholding mode. + int lowThreshold; // The low threshold value when you set mode to + // IMAQ_FIXED_RANGE. + int highThreshold; // The high threshold value when you set mode to + // IMAQ_FIXED_RANGE. + int blockCount; // The number of blocks for threshold calculation algorithms + // that require blocks. + int fastThreshold; // Set this element to TRUE to use a faster, less accurate + // threshold calculation algorithm. + int biModalCalculation; // Set this element to TRUE to calculate both the low + // and high threshold values when using the fast + // thresholding method. + int darkCharacters; // Set this element to TRUE to read or train dark + // characters on a light background. + int removeParticlesTouchingROI; // Set this element to TRUE to remove the + // particles touching the ROI. + int erosionCount; // The number of erosions to perform. +} OCRProcessingOptions; + +typedef struct ReadTextOptions_struct { + String255 validChars[255]; // An array of strings that specifies the valid + // characters. + int numValidChars; // The number of strings in the validChars array that you + // have initialized. + char substitutionChar; // The character to substitute for objects that the + // function cannot match with any of the trained + // characters. + ReadStrategy readStrategy; // The read strategy, which determines how closely + // the function analyzes images in the reading + // process to match objects with trained + // characters. + int acceptanceLevel; // The minimum acceptance level at which an object is + // considered a trained character. + int aspectRatio; // The maximum aspect ratio variance percentage for valid + // characters. + ReadResolution readResolution; // The read resolution, which determines how + // much of the trained character data the + // function uses to match objects to trained + // characters. +} ReadTextOptions; + +typedef struct CharInfo_struct { + const char* charValue; // Retrieves the character value of the corresponding + // character in the character set. + const Image* charImage; // The image you used to train this character. + const Image* internalImage; // The internal representation that NI Vision + // uses to match objects to this character. +} CharInfo; + +#if !defined(USERINT_HEADER) && !defined(_CVI_RECT_DEFINED) +typedef struct Rect_struct { + int top; // Location of the top edge of the rectangle. + int left; // Location of the left edge of the rectangle. + int height; // Height of the rectangle. + int width; // Width of the rectangle. +} Rect; +#define _CVI_RECT_DEFINED +#endif + +typedef struct CharReport_struct { + const char* character; // The character value. + PointFloat corner[4]; // An array of four points that describes the rectangle + // that surrounds the character. + int reserved; // This element is reserved. + int lowThreshold; // The minimum value of the threshold range used for this + // character. + int highThreshold; // The maximum value of the threshold range used for this + // character. +} CharReport; + +typedef struct ReadTextReport_struct { + const char* readString; // The read string. + const CharReport* characterReport; // An array of reports describing the + // properties of each identified + // character. + int numCharacterReports; // The number of identified characters. +} ReadTextReport; + +#if !defined(USERINT_HEADER) && !defined(_CVI_POINT_DEFINED) +typedef struct Point_struct { + int x; // The x-coordinate of the point. + int y; // The y-coordinate of the point. +} Point; +#define _CVI_POINT_DEFINED +#endif + +typedef struct Annulus_struct { + Point center; // The coordinate location of the center of the annulus. + int innerRadius; // The internal radius of the annulus. + int outerRadius; // The external radius of the annulus. + double startAngle; // The start angle, in degrees, of the annulus. + double endAngle; // The end angle, in degrees, of the annulus. +} Annulus; + +typedef struct EdgeLocationReport_struct { + PointFloat* edges; // The coordinate location of all edges detected by the + // search line. + int numEdges; // The number of points in the edges array. +} EdgeLocationReport; + +typedef struct EdgeOptions_struct { + unsigned + threshold; // Specifies the threshold value for the contrast of the edge. + unsigned width; // The number of pixels that the function averages to find + // the contrast at either side of the edge. + unsigned steepness; // The span, in pixels, of the slope of the edge + // projected along the path specified by the input + // points. + InterpolationMethod subpixelType; // The method for interpolating. + unsigned subpixelDivisions; // The number of samples the function obtains + // from a pixel. +} EdgeOptions; + +typedef struct EdgeReport_struct { + float location; // The location of the edge from the first point in the + // points array. + float contrast; // The contrast at the edge. + PolarityType polarity; // The polarity of the edge. + float reserved; // This element is reserved. + PointFloat coordinate; // The coordinates of the edge. +} EdgeReport; + +typedef struct ExtremeReport_struct { + double location; // The locations of the extreme. + double amplitude; // The amplitude of the extreme. + double secondDerivative; // The second derivative of the extreme. +} ExtremeReport; + +typedef struct FitLineOptions_struct { + float minScore; // Specifies the required quality of the fitted line. + float pixelRadius; // Specifies the neighborhood pixel relationship for the + // initial subset of points being used. + int numRefinements; // Specifies the number of refinement iterations you + // allow the function to perform on the initial subset of + // points. +} FitLineOptions; + +typedef struct DisplayMapping_struct { + MappingMethod method; // Describes the method for converting 16-bit pixels to + // 8-bit pixels. + int minimumValue; // When method is IMAQ_RANGE, minimumValue represents the + // value that is mapped to 0. + int maximumValue; // When method is IMAQ_RANGE, maximumValue represents the + // value that is mapped to 255. + int shiftCount; // When method is IMAQ_DOWNSHIFT, shiftCount represents the + // number of bits the function right-shifts the 16-bit pixel + // values. +} DisplayMapping; + +typedef struct DetectExtremesOptions_struct { + double threshold; // Defines which extremes are too small. + int width; // Specifies the number of consecutive data points the function + // uses in the quadratic least-squares fit. +} DetectExtremesOptions; + +typedef struct ImageInfo_struct { + CalibrationUnit imageUnit; // If you set calibration information with + // imaqSetSimpleCalibrationInfo(), imageUnit is + // the calibration unit. + float stepX; // If you set calibration information with + // imaqSetCalibrationInfo(), stepX is the distance in the + // calibration unit between two pixels in the x direction. + float stepY; // If you set calibration information with + // imaqSetCalibrationInfo(), stepY is the distance in the + // calibration unit between two pixels in the y direction. + ImageType imageType; // The type of the image. + int xRes; // The number of columns in the image. + int yRes; // The number of rows in the image. + int xOffset; // If you set mask offset information with imaqSetMaskOffset(), + // xOffset is the offset of the mask origin in the x direction. + int yOffset; // If you set mask offset information with imaqSetMaskOffset(), + // yOffset is the offset of the mask origin in the y direction. + int border; // The number of border pixels around the image. + int pixelsPerLine; // The number of pixels stored for each line of the image. + void* reserved0; // This element is reserved. + void* reserved1; // This element is reserved. + void* imageStart; // A pointer to pixel (0,0). +} ImageInfo; + +typedef struct LCDOptions_struct { + int litSegments; // Set this parameter to TRUE if the segments are brighter + // than the background. + float threshold; // Determines whether a segment is ON or OFF. + int sign; // Indicates whether the function must read the sign of the + // indicator. + int decimalPoint; // Determines whether to look for a decimal separator after + // each digit. +} LCDOptions; + +typedef struct LCDReport_struct { + const char* text; // A string of the characters of the LCD. + LCDSegments* segmentInfo; // An array of LCDSegment structures describing + // which segments of each digit are on. + int numCharacters; // The number of characters that the function reads. + int reserved; // This element is reserved. +} LCDReport; + +typedef struct LCDSegments_struct { + unsigned a : 1; // True if the a segment is on. + unsigned b : 1; // True if the b segment is on. + unsigned c : 1; // True if the c segment is on. + unsigned d : 1; // True if the d segment is on. + unsigned e : 1; // True if the e segment is on. + unsigned f : 1; // True if the f segment is on. + unsigned g : 1; // True if the g segment is on. + unsigned reserved : 25; // This element is reserved. +} LCDSegments; + +typedef struct LearnCalibrationOptions_struct { + CalibrationMode mode; // Specifies the type of algorithm you want to use to + // reduce distortion in your image. + ScalingMethod method; // Defines the scaling method correction functions use + // to correct the image. + CalibrationROI roi; // Specifies the ROI correction functions use when + // correcting an image. + int learnMap; // Set this element to TRUE if you want the function to + // calculate and store an error map during the learning + // process. + int learnTable; // Set this element to TRUE if you want the function to + // calculate and store the correction table. +} LearnCalibrationOptions; + +typedef struct LearnColorPatternOptions_struct { + LearningMode learnMode; // Specifies the invariance mode the function uses + // when learning the pattern. + ImageFeatureMode featureMode; // Specifies the features the function uses + // when learning the color pattern. + int threshold; // Specifies the saturation threshold the function uses to + // distinguish between two colors that have the same hue + // values. + ColorIgnoreMode ignoreMode; // Specifies whether the function excludes + // certain colors from the color features of the + // template image. + ColorInformation* colorsToIgnore; // An array of ColorInformation structures + // providing a set of colors to exclude + // from the color features of the template + // image. + int numColorsToIgnore; // The number of ColorInformation structures in the + // colorsToIgnore array. +} LearnColorPatternOptions; + +typedef struct Line_struct { + Point start; // The coordinate location of the start of the line. + Point end; // The coordinate location of the end of the line. +} Line; + +typedef struct LinearAverages_struct { + float* columnAverages; // An array containing the mean pixel value of each + // column. + int columnCount; // The number of elements in the columnAverages array. + float* rowAverages; // An array containing the mean pixel value of each row. + int rowCount; // The number of elements in the rowAverages array. + float* risingDiagAverages; // An array containing the mean pixel value of + // each diagonal running from the lower left to + // the upper right of the inspected area of the + // image. + int risingDiagCount; // The number of elements in the risingDiagAverages + // array. + float* fallingDiagAverages; // An array containing the mean pixel value of + // each diagonal running from the upper left to + // the lower right of the inspected area of the + // image. + int fallingDiagCount; // The number of elements in the fallingDiagAverages + // array. +} LinearAverages; + +typedef struct LineProfile_struct { + float* + profileData; // An array containing the value of each pixel in the line. + Rect boundingBox; // The bounding rectangle of the line. + float min; // The smallest pixel value in the line profile. + float max; // The largest pixel value in the line profile. + float mean; // The mean value of the pixels in the line profile. + float stdDev; // The standard deviation of the line profile. + int dataCount; // The size of the profileData array. +} LineProfile; + +typedef struct MatchColorPatternOptions_struct { + MatchingMode matchMode; // Specifies the method to use when looking for the + // color pattern in the image. + ImageFeatureMode featureMode; // Specifies the features to use when looking + // for the color pattern in the image. + int minContrast; // Specifies the minimum contrast expected in the image. + int subpixelAccuracy; // Set this parameter to TRUE to return areas in the + // image that match the pattern area with subpixel + // accuracy. + RotationAngleRange* angleRanges; // An array of angle ranges, in degrees, + // where each range specifies how much you + // expect the pattern to be rotated in the + // image. + int numRanges; // Number of angle ranges in the angleRanges array. + double colorWeight; // Determines the percent contribution of the color score + // to the final color pattern matching score. + ColorSensitivity sensitivity; // Specifies the sensitivity of the color + // information in the image. + SearchStrategy strategy; // Specifies how the color features of the image are + // used during the search phase. + int numMatchesRequested; // Number of valid matches expected. + float minMatchScore; // The minimum score a match can have for the function + // to consider the match valid. +} MatchColorPatternOptions; + +typedef struct HistogramReport_struct { + int* histogram; // An array describing the number of pixels that fell into + // each class. + int histogramCount; // The number of elements in the histogram array. + float min; // The smallest pixel value that the function classified. + float max; // The largest pixel value that the function classified. + float start; // The smallest pixel value that fell into the first class. + float width; // The size of each class. + float mean; // The mean value of the pixels that the function classified. + float stdDev; // The standard deviation of the pixels that the function + // classified. + int numPixels; // The number of pixels that the function classified. +} HistogramReport; + +typedef struct ArcInfo_struct { + Rect boundingBox; // The coordinate location of the bounding box of the arc. + double startAngle; // The counterclockwise angle from the x-axis in degrees + // to the start of the arc. + double endAngle; // The counterclockwise angle from the x-axis in degrees to + // the end of the arc. +} ArcInfo; + +typedef struct AxisReport_struct { + PointFloat origin; // The origin of the coordinate system, which is the + // intersection of the two axes of the coordinate system. + PointFloat mainAxisEnd; // The end of the main axis, which is the result of + // the computation of the intersection of the main + // axis with the rectangular search area. + PointFloat secondaryAxisEnd; // The end of the secondary axis, which is the + // result of the computation of the intersection + // of the secondary axis with the rectangular + // search area. +} AxisReport; + +typedef struct BarcodeInfo_struct { + const char* outputString; // A string containing the decoded barcode data. + int size; // The size of the output string. + char outputChar1; // The contents of this character depend on the barcode + // type. + char outputChar2; // The contents of this character depend on the barcode + // type. + double confidenceLevel; // A quality measure of the decoded barcode ranging + // from 0 to 100, with 100 being the best. + BarcodeType type; // The type of barcode. +} BarcodeInfo; + +typedef struct BCGOptions_struct { + float brightness; // Adjusts the brightness of the image. + float contrast; // Adjusts the contrast of the image. + float gamma; // Performs gamma correction. +} BCGOptions; + +typedef struct BestCircle_struct { + PointFloat center; // The coordinate location of the center of the circle. + double radius; // The radius of the circle. + double area; // The area of the circle. + double perimeter; // The length of the perimeter of the circle. + double error; // Represents the least square error of the fitted circle to + // the entire set of points. +} BestCircle; + +typedef struct BestEllipse_struct { + PointFloat center; // The coordinate location of the center of the ellipse. + PointFloat majorAxisStart; // The coordinate location of the start of the + // major axis of the ellipse. + PointFloat majorAxisEnd; // The coordinate location of the end of the major + // axis of the ellipse. + PointFloat minorAxisStart; // The coordinate location of the start of the + // minor axis of the ellipse. + PointFloat minorAxisEnd; // The coordinate location of the end of the minor + // axis of the ellipse. + double area; // The area of the ellipse. + double perimeter; // The length of the perimeter of the ellipse. +} BestEllipse; + +typedef struct BestLine_struct { + PointFloat start; // The coordinate location of the start of the line. + PointFloat end; // The coordinate location of the end of the line. + LineEquation equation; // Defines the three coefficients of the equation of + // the best fit line. + int valid; // This element is TRUE if the function achieved the minimum score + // within the number of allowed refinement iterations and FALSE if + // the function did not achieve the minimum score. + double error; // Represents the least square error of the fitted line to the + // entire set of points. + int* pointsUsed; // An array of the indexes for the points array indicating + // which points the function used to fit the line. + int numPointsUsed; // The number of points the function used to fit the line. +} BestLine; + +typedef struct BrowserOptions_struct { + int width; // The width to make the browser. + int height; // The height to make the browser image. + int imagesPerLine; // The number of images to place on a single line. + RGBValue backgroundColor; // The background color of the browser. + int frameSize; // Specifies the number of pixels with which to border each + // thumbnail. + BrowserFrameStyle style; // The style for the frame around each thumbnail. + float ratio; // Specifies the width to height ratio of each thumbnail. + RGBValue focusColor; // The color to use to display focused cells. +} BrowserOptions; + +typedef struct CoordinateSystem_struct { + PointFloat origin; // The origin of the coordinate system. + float angle; // The angle, in degrees, of the x-axis of the coordinate system + // relative to the image x-axis. + AxisOrientation axisOrientation; // The direction of the y-axis of the + // coordinate reference system. +} CoordinateSystem; + +typedef struct CalibrationInfo_struct { + float* errorMap; // The error map for the calibration. + int mapColumns; // The number of columns in the error map. + int mapRows; // The number of rows in the error map. + ROI* userRoi; // Specifies the ROI the user provided when learning the + // calibration. + ROI* calibrationRoi; // Specifies the ROI that corresponds to the region of + // the image where the calibration information is + // accurate. + LearnCalibrationOptions options; // Specifies the calibration options the + // user provided when learning the + // calibration. + GridDescriptor grid; // Specifies the scaling constants for the image. + CoordinateSystem system; // Specifies the coordinate system for the real + // world coordinates. + RangeFloat range; // The range of the grayscale the function used to + // represent the circles in the grid image. + float quality; // The quality score of the learning process, which is a value + // between 0-1000. +} CalibrationInfo; + +typedef struct CalibrationPoints_struct { + PointFloat* pixelCoordinates; // The array of pixel coordinates. + PointFloat* realWorldCoordinates; // The array of corresponding real-world + // coordinates. + int numCoordinates; // The number of coordinates in both of the arrays. +} CalibrationPoints; + +typedef struct CaliperOptions_struct { + TwoEdgePolarityType + polarity; // Specifies the edge polarity of the edge pairs. + float separation; // The distance between edge pairs. + float separationDeviation; // Sets the range around the separation value. +} CaliperOptions; + +typedef struct CaliperReport_struct { + float edge1Contrast; // The contrast of the first edge. + PointFloat edge1Coord; // The coordinates of the first edge. + float edge2Contrast; // The contrast of the second edge. + PointFloat edge2Coord; // The coordinates of the second edge. + float separation; // The distance between the two edges. + float reserved; // This element is reserved. +} CaliperReport; + +typedef struct DrawTextOptions_struct { + char fontName[32]; // The font name to use. + int fontSize; // The size of the font. + int bold; // Set this parameter to TRUE to bold text. + int italic; // Set this parameter to TRUE to italicize text. + int underline; // Set this parameter to TRUE to underline text. + int strikeout; // Set this parameter to TRUE to strikeout text. + TextAlignment textAlignment; // Sets the alignment of text. + FontColor fontColor; // Sets the font color. +} DrawTextOptions; + +typedef struct CircleReport_struct { + Point center; // The coordinate point of the center of the circle. + int radius; // The radius of the circle, in pixels. + int area; // The area of the circle, in pixels. +} CircleReport; + +typedef struct ClosedContour_struct { + Point* points; // The points that make up the closed contour. + int numPoints; // The number of points in the array. +} ClosedContour; + +typedef struct ColorHistogramReport_struct { + HistogramReport plane1; // The histogram report of the first color plane. + HistogramReport plane2; // The histogram report of the second plane. + HistogramReport plane3; // The histogram report of the third plane. +} ColorHistogramReport; + +typedef struct ColorInformation_struct { + int infoCount; // The size of the info array. + int saturation; // The saturation level the function uses to learn the color + // information. + double* info; // An array of color information that represents the color + // spectrum analysis of a region of an image in a compact form. +} ColorInformation; + +typedef struct Complex_struct { + float r; // The real part of the value. + float i; // The imaginary part of the value. +} Complex; + +typedef struct ConcentricRakeReport_struct { + ArcInfo* rakeArcs; // An array containing the location of each concentric arc + // line used for edge detection. + int numArcs; // The number of arc lines in the rakeArcs array. + PointFloat* firstEdges; // The coordinate location of all edges detected as + // first edges. + int numFirstEdges; // The number of points in the first edges array. + PointFloat* lastEdges; // The coordinate location of all edges detected as + // last edges. + int numLastEdges; // The number of points in the last edges array. + EdgeLocationReport* allEdges; // An array of reports describing the location + // of the edges located by each concentric rake + // arc line. + int* linesWithEdges; // An array of indices into the rakeArcs array + // indicating the concentric rake arc lines on which the + // function detected at least one edge. + int numLinesWithEdges; // The number of concentric rake arc lines along which + // the function detected edges. +} ConcentricRakeReport; + +typedef struct ConstructROIOptions_struct { + int windowNumber; // The window number of the image window. + const char* windowTitle; // Specifies the message string that the function + // displays in the title bar of the window. + PaletteType type; // The palette type to use. + RGBValue* palette; // If type is IMAQ_PALETTE_USER, this array is the palette + // of colors to use with the window. + int numColors; // If type is IMAQ_PALETTE_USER, this element is the number of + // colors in the palette array. +} ConstructROIOptions; + +typedef struct ContourInfo_struct { + ContourType type; // The contour type. + unsigned numPoints; // The number of points that make up the contour. + Point* points; // The points describing the contour. + RGBValue contourColor; // The contour color. +} ContourInfo; + +typedef union ContourUnion_union { + Point* point; // Use this member when the contour is of type IMAQ_POINT. + Line* line; // Use this member when the contour is of type IMAQ_LINE. + Rect* rect; // Use this member when the contour is of type IMAQ_RECT. + Rect* ovalBoundingBox; // Use this member when the contour is of type + // IMAQ_OVAL. + ClosedContour* closedContour; // Use this member when the contour is of type + // IMAQ_CLOSED_CONTOUR. + OpenContour* openContour; // Use this member when the contour is of type + // IMAQ_OPEN_CONTOUR. + Annulus* annulus; // Use this member when the contour is of type + // IMAQ_ANNULUS. + RotatedRect* rotatedRect; // Use this member when the contour is of type + // IMAQ_ROTATED_RECT. +} ContourUnion; + +typedef struct ContourInfo2_struct { + ContourType type; // The contour type. + RGBValue color; // The contour color. + ContourUnion structure; // The information necessary to describe the contour + // in coordinate space. +} ContourInfo2; + +typedef struct ContourPoint_struct { + double x; // The x-coordinate value in the image. + double y; // The y-coordinate value in the image. + double curvature; // The change in slope at this edge point of the segment. + double xDisplacement; // The x displacement of the current edge pixel from a + // cubic spline fit of the current edge segment. + double yDisplacement; // The y displacement of the current edge pixel from a + // cubic spline fit of the current edge segment. +} ContourPoint; + +typedef struct CoordinateTransform_struct { + Point initialOrigin; // The origin of the initial coordinate system. + float initialAngle; // The angle, in degrees, of the x-axis of the initial + // coordinate system relative to the image x-axis. + Point finalOrigin; // The origin of the final coordinate system. + float finalAngle; // The angle, in degrees, of the x-axis of the final + // coordinate system relative to the image x-axis. +} CoordinateTransform; + +typedef struct CoordinateTransform2_struct { + CoordinateSystem + referenceSystem; // Defines the coordinate system for input coordinates. + CoordinateSystem measurementSystem; // Defines the coordinate system in which + // the function should perform + // measurements. +} CoordinateTransform2; + +typedef struct CannyOptions_struct { + float sigma; // The sigma of the Gaussian smoothing filter that the function + // applies to the image before edge detection. + float upperThreshold; // The upper fraction of pixel values in the image from + // which the function chooses a seed or starting point + // of an edge segment. + float lowerThreshold; // The function multiplies this value by upperThreshold + // to determine the lower threshold for all the pixels + // in an edge segment. + int windowSize; // The window size of the Gaussian filter that the function + // applies to the image. +} CannyOptions; + +typedef struct Range_struct { + int minValue; // The minimum value of the range. + int maxValue; // The maximum value of the range. +} Range; + +typedef struct UserPointSymbol_struct { + int cols; // Number of columns in the symbol. + int rows; // Number of rows in the symbol. + int* pixels; // The pixels of the symbol. +} UserPointSymbol; + +typedef struct View3DOptions_struct { + int sizeReduction; // A divisor the function uses when determining the final + // height and width of the 3D image. + int maxHeight; // Defines the maximum height of a pixel from the image source + // drawn in 3D. + Direction3D direction; // Defines the 3D orientation. + float alpha; // Determines the angle between the horizontal and the baseline. + float beta; // Determines the angle between the horizontal and the second + // baseline. + int border; // Defines the border size. + int background; // Defines the background color. + Plane3D plane; // Indicates the view a function uses to show complex images. +} View3DOptions; + +typedef struct MatchPatternOptions_struct { + MatchingMode mode; // Specifies the method to use when looking for the + // pattern in the image. + int minContrast; // Specifies the minimum contrast expected in the image. + int subpixelAccuracy; // Set this element to TRUE to return areas in the + // image that match the pattern area with subpixel + // accuracy. + RotationAngleRange* angleRanges; // An array of angle ranges, in degrees, + // where each range specifies how much you + // expect the pattern to be rotated in the + // image. + int numRanges; // Number of angle ranges in the angleRanges array. + int numMatchesRequested; // Number of valid matches expected. + int matchFactor; // Controls the number of potential matches that the + // function examines. + float minMatchScore; // The minimum score a match can have for the function + // to consider the match valid. +} MatchPatternOptions; + +typedef struct TIFFFileOptions_struct { + int rowsPerStrip; // Indicates the number of rows that the function writes + // per strip. + PhotometricMode + photoInterp; // Designates which photometric interpretation to use. + TIFFCompressionType compressionType; // Indicates the type of compression to + // use on the TIFF file. +} TIFFFileOptions; + +typedef union Color_union { + RGBValue rgb; // The information needed to describe a color in the RGB (Red, + // Green, and Blue) color space. + HSLValue hsl; // The information needed to describe a color in the HSL (Hue, + // Saturation, and Luminance) color space. + HSVValue hsv; // The information needed to describe a color in the HSI (Hue, + // Saturation, and Value) color space. + HSIValue hsi; // The information needed to describe a color in the HSI (Hue, + // Saturation, and Intensity) color space. + int rawValue; // The integer value for the data in the color union. +} Color; + +typedef union PixelValue_union { + float grayscale; // A grayscale pixel value. + RGBValue rgb; // A RGB pixel value. + HSLValue hsl; // A HSL pixel value. + Complex complex; // A complex pixel value. + RGBU64Value rgbu64; // An unsigned 64-bit RGB pixel value. +} PixelValue; + +typedef struct OpenContour_struct { + Point* points; // The points that make up the open contour. + int numPoints; // The number of points in the array. +} OpenContour; + +typedef struct OverlayTextOptions_struct { + const char* fontName; // The name of the font to use. + int fontSize; // The size of the font. + int bold; // Set this element to TRUE to bold the text. + int italic; // Set this element to TRUE to italicize the text. + int underline; // Set this element to TRUE to underline the text. + int strikeout; // Set this element to TRUE to strikeout the text. + TextAlignment horizontalTextAlignment; // Sets the alignment of the text. + VerticalTextAlignment + verticalTextAlignment; // Sets the vertical alignment for the text. + RGBValue backgroundColor; // Sets the color for the text background pixels. + double angle; // The counterclockwise angle, in degrees, of the text relative + // to the x-axis. +} OverlayTextOptions; + +typedef struct ParticleFilterCriteria_struct { + MeasurementValue parameter; // The morphological measurement that the + // function uses for filtering. + float lower; // The lower bound of the criteria range. + float upper; // The upper bound of the criteria range. + int exclude; // Set this element to TRUE to indicate that a match occurs when + // the value is outside the criteria range. +} ParticleFilterCriteria; + +typedef struct ParticleReport_struct { + int area; // The number of pixels in the particle. + float calibratedArea; // The size of the particle, calibrated to the + // calibration information of the image. + float perimeter; // The length of the perimeter, calibrated to the + // calibration information of the image. + int numHoles; // The number of holes in the particle. + int areaOfHoles; // The total surface area, in pixels, of all the holes in a + // particle. + float perimeterOfHoles; // The length of the perimeter of all the holes in + // the particle calibrated to the calibration + // information of the image. + Rect boundingBox; // The smallest rectangle that encloses the particle. + float sigmaX; // The sum of the particle pixels on the x-axis. + float sigmaY; // The sum of the particle pixels on the y-axis. + float sigmaXX; // The sum of the particle pixels on the x-axis, squared. + float sigmaYY; // The sum of the particle pixels on the y-axis, squared. + float sigmaXY; // The sum of the particle pixels on the x-axis and y-axis. + int longestLength; // The length of the longest horizontal line segment. + Point longestPoint; // The location of the leftmost pixel of the longest + // segment in the particle. + int projectionX; // The length of the particle when projected onto the + // x-axis. + int projectionY; // The length of the particle when projected onto the + // y-axis. + int connect8; // This element is TRUE if the function used connectivity-8 to + // determine if particles are touching. +} ParticleReport; + +typedef struct PatternMatch_struct { + PointFloat position; // The location of the center of the match. + float rotation; // The rotation of the match relative to the template image, + // in degrees. + float scale; // The size of the match relative to the size of the template + // image, expressed as a percentage. + float score; // The accuracy of the match. + PointFloat corner[4]; // An array of four points describing the rectangle + // surrounding the template image. +} PatternMatch; + +typedef struct QuantifyData_struct { + float mean; // The mean value of the pixel values. + float stdDev; // The standard deviation of the pixel values. + float min; // The smallest pixel value. + float max; // The largest pixel value. + float calibratedArea; // The area, calibrated to the calibration information + // of the image. + int pixelArea; // The area, in number of pixels. + float relativeSize; // The proportion, expressed as a percentage, of the + // associated region relative to the whole image. +} QuantifyData; + +typedef struct QuantifyReport_struct { + QuantifyData global; // Statistical data of the whole image. + QuantifyData* regions; // An array of QuantifyData structures containing + // statistical data of each region of the image. + int regionCount; // The number of regions. +} QuantifyReport; + +typedef struct RakeOptions_struct { + int threshold; // Specifies the threshold value for the contrast of the edge. + int width; // The number of pixels that the function averages to find the + // contrast at either side of the edge. + int steepness; // The span, in pixels, of the slope of the edge projected + // along the path specified by the input points. + int subsamplingRatio; // Specifies the number of pixels that separate two + // consecutive search lines. + InterpolationMethod subpixelType; // The method for interpolating. + int subpixelDivisions; // The number of samples the function obtains from a + // pixel. +} RakeOptions; + +typedef struct RakeReport_struct { + LineFloat* rakeLines; // The coordinate location of each of the rake lines + // used by the function. + int numRakeLines; // The number of lines in the rakeLines array. + PointFloat* firstEdges; // The coordinate location of all edges detected as + // first edges. + unsigned int numFirstEdges; // The number of points in the firstEdges array. + PointFloat* lastEdges; // The coordinate location of all edges detected as + // last edges. + unsigned int numLastEdges; // The number of points in the lastEdges array. + EdgeLocationReport* allEdges; // An array of reports describing the location + // of the edges located by each rake line. + int* linesWithEdges; // An array of indices into the rakeLines array + // indicating the rake lines on which the function + // detected at least one edge. + int numLinesWithEdges; // The number of rake lines along which the function + // detected edges. +} RakeReport; + +typedef struct TransformReport_struct { + PointFloat* points; // An array of transformed coordinates. + int* validPoints; // An array of values that describe the validity of each of + // the coordinates according to the region of interest you + // calibrated using either imaqLearnCalibrationGrid() or + // imaqLearnCalibrationPoints(). + int numPoints; // The length of both the points array and the validPoints + // array. +} TransformReport; + +typedef struct ShapeReport_struct { + Rect coordinates; // The bounding rectangle of the object. + Point centroid; // The coordinate location of the centroid of the object. + int size; // The size, in pixels, of the object. + double score; // A value ranging between 1 and 1,000 that specifies how + // similar the object in the image is to the template. +} ShapeReport; + +typedef struct MeterArc_struct { + PointFloat + needleBase; // The coordinate location of the base of the meter needle. + PointFloat* arcCoordPoints; // An array of points describing the coordinate + // location of the meter arc. + int numOfArcCoordPoints; // The number of points in the arcCoordPoints array. + int needleColor; // This element is TRUE when the meter has a light-colored + // needle on a dark background. +} MeterArc; + +typedef struct ThresholdData_struct { + float rangeMin; // The lower boundary of the range to keep. + float rangeMax; // The upper boundary of the range to keep. + float newValue; // If useNewValue is TRUE, newValue is the replacement value + // for pixels within the range. + int useNewValue; // If TRUE, the function sets pixel values within [rangeMin, + // rangeMax] to the value specified in newValue. +} ThresholdData; + +typedef struct StructuringElement_struct { + int matrixCols; // Number of columns in the matrix. + int matrixRows; // Number of rows in the matrix. + int hexa; // Set this element to TRUE if you specify a hexagonal structuring + // element in kernel. + int* kernel; // The values of the structuring element. +} StructuringElement; + +typedef struct SpokeReport_struct { + LineFloat* spokeLines; // The coordinate location of each of the spoke lines + // used by the function. + int numSpokeLines; // The number of lines in the spokeLines array. + PointFloat* firstEdges; // The coordinate location of all edges detected as + // first edges. + int numFirstEdges; // The number of points in the firstEdges array. + PointFloat* lastEdges; // The coordinate location of all edges detected as + // last edges. + int numLastEdges; // The number of points in the lastEdges array. + EdgeLocationReport* allEdges; // An array of reports describing the location + // of the edges located by each spoke line. + int* linesWithEdges; // An array of indices into the spokeLines array + // indicating the rake lines on which the function + // detected at least one edge. + int numLinesWithEdges; // The number of spoke lines along which the function + // detects edges. +} SpokeReport; + +typedef struct SimpleEdgeOptions_struct { + LevelType type; // Determines how the function evaluates the threshold and + // hysteresis values. + int threshold; // The pixel value at which an edge occurs. + int hysteresis; // A value that helps determine edges in noisy images. + EdgeProcess process; // Determines which edges the function looks for. + int subpixel; // Set this element to TRUE to find edges with subpixel + // accuracy by interpolating between points to find the + // crossing of the given threshold. +} SimpleEdgeOptions; + +typedef struct SelectParticleCriteria_struct { + MeasurementValue parameter; // The morphological measurement that the + // function uses for filtering. + float lower; // The lower boundary of the criteria range. + float upper; // The upper boundary of the criteria range. +} SelectParticleCriteria; + +typedef struct SegmentInfo_struct { + int numberOfPoints; // The number of points in the segment. + int isOpen; // If TRUE, the contour is open. + double weight; // The significance of the edge in terms of the gray values + // that constitute the edge. + ContourPoint* points; // The points of the segment. +} SegmentInfo; + +typedef struct RotationAngleRange_struct { + float lower; // The lowest amount of rotation, in degrees, a valid pattern + // can have. + float upper; // The highest amount of rotation, in degrees, a valid pattern + // can have. +} RotationAngleRange; + +typedef struct RotatedRect_struct { + int top; // Location of the top edge of the rectangle before rotation. + int left; // Location of the left edge of the rectangle before rotation. + int height; // Height of the rectangle. + int width; // Width of the rectangle. + double angle; // The rotation, in degrees, of the rectangle. +} RotatedRect; + +typedef struct ROIProfile_struct { + LineProfile report; // Quantifying information about the points along the + // edge of each contour in the ROI. + Point* pixels; // An array of the points along the edge of each contour in + // the ROI. +} ROIProfile; + +typedef struct ToolWindowOptions_struct { + int showSelectionTool; // If TRUE, the selection tool becomes visible. + int showZoomTool; // If TRUE, the zoom tool becomes visible. + int showPointTool; // If TRUE, the point tool becomes visible. + int showLineTool; // If TRUE, the line tool becomes visible. + int showRectangleTool; // If TRUE, the rectangle tool becomes visible. + int showOvalTool; // If TRUE, the oval tool becomes visible. + int showPolygonTool; // If TRUE, the polygon tool becomes visible. + int showClosedFreehandTool; // If TRUE, the closed freehand tool becomes + // visible. + int showPolyLineTool; // If TRUE, the polyline tool becomes visible. + int showFreehandTool; // If TRUE, the freehand tool becomes visible. + int showAnnulusTool; // If TRUE, the annulus becomes visible. + int showRotatedRectangleTool; // If TRUE, the rotated rectangle tool becomes + // visible. + int showPanTool; // If TRUE, the pan tool becomes visible. + int showZoomOutTool; // If TRUE, the zoom out tool becomes visible. + int reserved2; // This element is reserved and should be set to FALSE. + int reserved3; // This element is reserved and should be set to FALSE. + int reserved4; // This element is reserved and should be set to FALSE. +} ToolWindowOptions; + +typedef struct SpokeOptions_struct { + int threshold; // Specifies the threshold value for the contrast of the edge. + int width; // The number of pixels that the function averages to find the + // contrast at either side of the edge. + int steepness; // The span, in pixels, of the slope of the edge projected + // along the path specified by the input points. + double subsamplingRatio; // The angle, in degrees, between each radial search + // line in the spoke. + InterpolationMethod subpixelType; // The method for interpolating. + int subpixelDivisions; // The number of samples the function obtains from a + // pixel. +} SpokeOptions; + +#if !defined __GNUC__ && !defined _M_X64 +#pragma pack(pop) +#endif + +//============================================================================ +// Callback Function Type +//============================================================================ +#ifndef __GNUC__ +typedef void(IMAQ_CALLBACK* EventCallback)(WindowEventType event, + int windowNumber, Tool tool, + Rect rect); +#endif + +//============================================================================ +// Globals +//============================================================================ +#ifndef __GNUC__ +#pragma const_seg("IMAQVisionColorConstants") +#endif +static const RGBValue IMAQ_RGB_TRANSPARENT = {0, 0, 0, 1}; +static const RGBValue IMAQ_RGB_RED = {0, 0, 255, 0}; +static const RGBValue IMAQ_RGB_BLUE = {255, 0, 0, 0}; +static const RGBValue IMAQ_RGB_GREEN = {0, 255, 0, 0}; +static const RGBValue IMAQ_RGB_YELLOW = {0, 255, 255, 0}; +static const RGBValue IMAQ_RGB_WHITE = {255, 255, 255, 0}; +static const RGBValue IMAQ_RGB_BLACK = {0, 0, 0, 0}; +#ifndef __GNUC__ +#pragma const_seg() +#endif + +//============================================================================ +// Backwards Compatibility +//============================================================================ +typedef ColorSensitivity ColorComplexity; +#define IMAQ_COMPLEXITY_LOW IMAQ_SENSITIVITY_LOW +#define IMAQ_COMPLEXITY_MED IMAQ_SENSITIVITY_MED +#define IMAQ_COMPLEXITY_HIGH IMAQ_SENSITIVITY_HIGH +#define ERR_INVALID_COLORCOMPLEXITY ERR_INVALID_COLORSENSITIVITY + +//============================================================================ +// Logical functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqAnd(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqAndConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL imaqCompare(Image* dest, const Image* source, + const Image* compareImage, + ComparisonFunction compare); +IMAQ_FUNC int IMAQ_STDCALL imaqCompareConstant(Image* dest, const Image* source, + PixelValue value, + ComparisonFunction compare); +IMAQ_FUNC int IMAQ_STDCALL +imaqLogicalDifference(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL imaqLogicalDifferenceConstant(Image* dest, + const Image* source, + PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqNand(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqNandConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqNor(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqNorConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqOr(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqOrConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqXnor(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqXnorConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqXor(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqXorConstant(Image* dest, const Image* source, PixelValue value); + +//============================================================================ +// Particle Analysis functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqCountParticles(Image* image, int connectivity8, int* numParticles); +IMAQ_FUNC int IMAQ_STDCALL +imaqMeasureParticle(Image* image, int particleNumber, int calibrated, + MeasurementType measurement, double* value); +IMAQ_FUNC MeasureParticlesReport* IMAQ_STDCALL +imaqMeasureParticles(Image* image, + MeasureParticlesCalibrationMode calibrationMode, + const MeasurementType* measurements, + size_t numMeasurements); +IMAQ_FUNC int IMAQ_STDCALL +imaqParticleFilter4(Image* dest, Image* source, + const ParticleFilterCriteria2* criteria, int criteriaCount, + const ParticleFilterOptions2* options, const ROI* roi, + int* numParticles); + +//============================================================================ +// Morphology functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqConvexHull(Image* dest, Image* source, int connectivity8); +IMAQ_FUNC int IMAQ_STDCALL imaqDanielssonDistance(Image* dest, Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqFillHoles(Image* dest, const Image* source, int connectivity8); +IMAQ_FUNC CircleReport* IMAQ_STDCALL +imaqFindCircles(Image* dest, Image* source, float minRadius, float maxRadius, + int* numCircles); +IMAQ_FUNC int IMAQ_STDCALL +imaqLabel2(Image* dest, Image* source, int connectivity8, int* particleCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqMorphology(Image* dest, Image* source, MorphologyMethod method, + const StructuringElement* structuringElement); +IMAQ_FUNC int IMAQ_STDCALL +imaqRejectBorder(Image* dest, Image* source, int connectivity8); +IMAQ_FUNC int IMAQ_STDCALL imaqSegmentation(Image* dest, Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqSeparation(Image* dest, Image* source, int erosions, + const StructuringElement* structuringElement); +IMAQ_FUNC int IMAQ_STDCALL +imaqSimpleDistance(Image* dest, Image* source, + const StructuringElement* structuringElement); +IMAQ_FUNC int IMAQ_STDCALL +imaqSizeFilter(Image* dest, Image* source, int connectivity8, int erosions, + SizeType keepSize, const StructuringElement* structuringElement); +IMAQ_FUNC int IMAQ_STDCALL +imaqSkeleton(Image* dest, Image* source, SkeletonMethod method); + +//============================================================================ +// Acquisition functions +//============================================================================ +IMAQ_FUNC Image* IMAQ_STDCALL imaqCopyFromRing(SESSION_ID sessionID, + Image* image, int imageToCopy, + int* imageNumber, Rect rect); +IMAQ_FUNC Image* IMAQ_STDCALL imaqEasyAcquire(const char* interfaceName); +IMAQ_FUNC Image* IMAQ_STDCALL +imaqExtractFromRing(SESSION_ID sessionID, int imageToExtract, int* imageNumber); +IMAQ_FUNC Image* IMAQ_STDCALL +imaqGrab(SESSION_ID sessionID, Image* image, int immediate); +IMAQ_FUNC int IMAQ_STDCALL imaqReleaseImage(SESSION_ID sessionID); +IMAQ_FUNC int IMAQ_STDCALL imaqSetupGrab(SESSION_ID sessionID, Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqSetupRing(SESSION_ID sessionID, Image** images, + int numImages, int skipCount, + Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqSetupSequence(SESSION_ID sessionID, + Image** images, int numImages, + int skipCount, Rect rect); +IMAQ_FUNC Image* IMAQ_STDCALL +imaqSnap(SESSION_ID sessionID, Image* image, Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqStartAcquisition(SESSION_ID sessionID); +IMAQ_FUNC int IMAQ_STDCALL imaqStopAcquisition(SESSION_ID sessionID); + +//============================================================================ +// Arithmetic functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqAbsoluteDifference(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL imaqAbsoluteDifferenceConstant(Image* dest, + const Image* source, + PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqAdd(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqAddConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqAverage(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqAverageConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL imaqDivide2(Image* dest, const Image* sourceA, + const Image* sourceB, + RoundingMode roundingMode); +IMAQ_FUNC int IMAQ_STDCALL imaqDivideConstant2(Image* dest, const Image* source, + PixelValue value, + RoundingMode roundingMode); +IMAQ_FUNC int IMAQ_STDCALL +imaqMax(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqMaxConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqMin(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqMinConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqModulo(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqModuloConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL imaqMulDiv(Image* dest, const Image* sourceA, + const Image* sourceB, float value); +IMAQ_FUNC int IMAQ_STDCALL +imaqMultiply(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqMultiplyConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqSubtract(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC int IMAQ_STDCALL +imaqSubtractConstant(Image* dest, const Image* source, PixelValue value); + +//============================================================================ +// Caliper functions +//============================================================================ +IMAQ_FUNC CaliperReport* IMAQ_STDCALL +imaqCaliperTool(const Image* image, const Point* points, int numPoints, + const EdgeOptions* edgeOptions, + const CaliperOptions* caliperOptions, int* numEdgePairs); +IMAQ_FUNC ConcentricRakeReport2* IMAQ_STDCALL +imaqConcentricRake2(Image* image, ROI* roi, ConcentricRakeDirection direction, + EdgeProcess process, int stepSize, + EdgeOptions2* edgeOptions); +IMAQ_FUNC ExtremeReport* IMAQ_STDCALL +imaqDetectExtremes(const double* pixels, int numPixels, DetectionMode mode, + const DetectExtremesOptions* options, int* numExtremes); +IMAQ_FUNC int IMAQ_STDCALL +imaqDetectRotation(const Image* referenceImage, const Image* testImage, + PointFloat referenceCenter, PointFloat testCenter, + int radius, float precision, double* angle); +IMAQ_FUNC EdgeReport2* IMAQ_STDCALL +imaqEdgeTool4(Image* image, ROI* roi, EdgeProcess processType, + EdgeOptions2* edgeOptions, const unsigned int reverseDirection); +IMAQ_FUNC FindEdgeReport* IMAQ_STDCALL +imaqFindEdge2(Image* image, const ROI* roi, const CoordinateSystem* baseSystem, + const CoordinateSystem* newSystem, + const FindEdgeOptions2* findEdgeOptions, + const StraightEdgeOptions* straightEdgeOptions); +IMAQ_FUNC int IMAQ_STDCALL +imaqFindTransformRect2(Image* image, const ROI* roi, FindTransformMode mode, + CoordinateSystem* baseSystem, + CoordinateSystem* newSystem, + const FindTransformRectOptions2* findTransformOptions, + const StraightEdgeOptions* straightEdgeOptions, + AxisReport* axisReport); +IMAQ_FUNC int IMAQ_STDCALL +imaqFindTransformRects2(Image* image, const ROI* primaryROI, + const ROI* secondaryROI, FindTransformMode mode, + CoordinateSystem* baseSystem, + CoordinateSystem* newSystem, + const FindTransformRectsOptions2* findTransformOptions, + const StraightEdgeOptions* primaryStraightEdgeOptions, + const StraightEdgeOptions* secondaryStraightEdgeOptions, + AxisReport* axisReport); +IMAQ_FUNC int IMAQ_STDCALL +imaqLineGaugeTool2(const Image* image, Point start, Point end, + LineGaugeMethod method, const EdgeOptions* edgeOptions, + const CoordinateTransform2* transform, float* distance); +IMAQ_FUNC RakeReport2* IMAQ_STDCALL +imaqRake2(Image* image, ROI* roi, RakeDirection direction, EdgeProcess process, + int stepSize, EdgeOptions2* edgeOptions); +IMAQ_FUNC PointFloat* IMAQ_STDCALL +imaqSimpleEdge(const Image* image, const Point* points, int numPoints, + const SimpleEdgeOptions* options, int* numEdges); +IMAQ_FUNC SpokeReport2* IMAQ_STDCALL +imaqSpoke2(Image* image, ROI* roi, SpokeDirection direction, + EdgeProcess process, int stepSize, EdgeOptions2* edgeOptions); +IMAQ_FUNC StraightEdgeReport2* IMAQ_STDCALL +imaqStraightEdge(const Image* image, const ROI* roi, + SearchDirection searchDirection, + const EdgeOptions2* edgeOptions, + const StraightEdgeOptions* straightEdgeOptions); +IMAQ_FUNC StraightEdgeReport2* IMAQ_STDCALL +imaqStraightEdge2(const Image* image, const ROI* roi, + SearchDirection searchDirection, + const EdgeOptions2* edgeOptions, + const StraightEdgeOptions* straightEdgeOptions, + unsigned int optimizedMode); + +//============================================================================ +// Spatial Filters functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqCannyEdgeFilter(Image* dest, const Image* source, + const CannyOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqConvolve2(Image* dest, Image* source, float* kernel, int matrixRows, + int matrixCols, float normalize, Image* mask, + RoundingMode roundingMode); +IMAQ_FUNC int IMAQ_STDCALL imaqCorrelate(Image* dest, Image* source, + const Image* templateImage, Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqEdgeFilter(Image* dest, Image* source, + OutlineMethod method, + const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqLowPass(Image* dest, Image* source, int width, + int height, float tolerance, + const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqMedianFilter(Image* dest, Image* source, + int width, int height, + const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqNthOrderFilter(Image* dest, Image* source, + int width, int height, int n, + const Image* mask); + +//============================================================================ +// Drawing functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqDrawLineOnImage(Image* dest, const Image* source, + DrawMode mode, Point start, + Point end, float newPixelValue); +IMAQ_FUNC int IMAQ_STDCALL +imaqDrawShapeOnImage(Image* dest, const Image* source, Rect rect, DrawMode mode, + ShapeMode shape, float newPixelValue); +IMAQ_FUNC int IMAQ_STDCALL imaqDrawTextOnImage(Image* dest, const Image* source, + Point coord, const char* text, + const DrawTextOptions* options, + int* fontNameUsed); + +//============================================================================ +// Interlacing functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqInterlaceCombine(Image* frame, const Image* odd, const Image* even); +IMAQ_FUNC int IMAQ_STDCALL +imaqInterlaceSeparate(const Image* frame, Image* odd, Image* even); + +//============================================================================ +// Image Information functions +//============================================================================ +IMAQ_FUNC char** IMAQ_STDCALL +imaqEnumerateCustomKeys(const Image* image, unsigned int* size); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetBitDepth(const Image* image, unsigned int* bitDepth); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetBytesPerPixel(const Image* image, int* byteCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetImageInfo(const Image* image, ImageInfo* info); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetImageSize(const Image* image, int* width, int* height); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetImageType(const Image* image, ImageType* type); +IMAQ_FUNC int IMAQ_STDCALL imaqGetMaskOffset(const Image* image, Point* offset); +IMAQ_FUNC void* IMAQ_STDCALL +imaqGetPixelAddress(const Image* image, Point pixel); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetVisionInfoTypes(const Image* image, unsigned int* present); +IMAQ_FUNC int IMAQ_STDCALL imaqIsImageEmpty(const Image* image, int* empty); +IMAQ_FUNC void* IMAQ_STDCALL +imaqReadCustomData(const Image* image, const char* key, unsigned int* size); +IMAQ_FUNC int IMAQ_STDCALL imaqRemoveCustomData(Image* image, const char* key); +IMAQ_FUNC int IMAQ_STDCALL +imaqRemoveVisionInfo2(const Image* image, unsigned int info); +IMAQ_FUNC int IMAQ_STDCALL imaqSetBitDepth(Image* image, unsigned int bitDepth); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetImageSize(Image* image, int width, int height); +IMAQ_FUNC int IMAQ_STDCALL imaqSetMaskOffset(Image* image, Point offset); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteCustomData(Image* image, const char* key, + const void* data, + unsigned int size); + +//============================================================================ +// Display functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqAreToolsContextSensitive(int* sensitive); +IMAQ_FUNC int IMAQ_STDCALL imaqCloseWindow(int windowNumber); +IMAQ_FUNC int IMAQ_STDCALL +imaqDisplayImage(const Image* image, int windowNumber, int resize); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetLastKey(char* keyPressed, int* windowNumber, int* modifiers); +IMAQ_FUNC void* IMAQ_STDCALL imaqGetSystemWindowHandle(int windowNumber); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowCenterPos(int windowNumber, Point* centerPosition); +IMAQ_FUNC int IMAQ_STDCALL imaqSetToolContextSensitivity(int sensitive); +IMAQ_FUNC int IMAQ_STDCALL imaqShowWindow(int windowNumber, int visible); + +//============================================================================ +// Image Manipulation functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqCast(Image* dest, const Image* source, + ImageType type, const float* lookup, + int shift); +IMAQ_FUNC int IMAQ_STDCALL +imaqCopyRect(Image* dest, const Image* source, Rect rect, Point destLoc); +IMAQ_FUNC int IMAQ_STDCALL imaqDuplicate(Image* dest, const Image* source); +IMAQ_FUNC void* IMAQ_STDCALL imaqFlatten(const Image* image, FlattenType type, + CompressionType compression, + int quality, unsigned int* size); +IMAQ_FUNC int IMAQ_STDCALL +imaqFlip(Image* dest, const Image* source, FlipAxis axis); +IMAQ_FUNC int IMAQ_STDCALL +imaqMask(Image* dest, const Image* source, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqResample(Image* dest, const Image* source, + int newWidth, int newHeight, + InterpolationMethod method, Rect rect); +IMAQ_FUNC int IMAQ_STDCALL +imaqRotate2(Image* dest, const Image* source, float angle, PixelValue fill, + InterpolationMethod method, int maintainSize); +IMAQ_FUNC int IMAQ_STDCALL imaqScale(Image* dest, const Image* source, + int xScale, int yScale, + ScalingMode scaleMode, Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqShift(Image* dest, const Image* source, + int shiftX, int shiftY, PixelValue fill); +IMAQ_FUNC int IMAQ_STDCALL imaqTranspose(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqUnflatten(Image* image, const void* data, unsigned int size); +IMAQ_FUNC int IMAQ_STDCALL +imaqUnwrapImage(Image* dest, const Image* source, Annulus annulus, + RectOrientation orientation, InterpolationMethod method); +IMAQ_FUNC int IMAQ_STDCALL +imaqView3D(Image* dest, Image* source, const View3DOptions* options); + +//============================================================================ +// File I/O functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqCloseAVI(AVISession session); +IMAQ_FUNC AVISession IMAQ_STDCALL +imaqCreateAVI(const char* fileName, const char* compressionFilter, int quality, + unsigned int framesPerSecond, unsigned int maxDataSize); +IMAQ_FUNC int IMAQ_STDCALL imaqGetAVIInfo(AVISession session, AVIInfo* info); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetFileInfo(const char* fileName, CalibrationUnit* calibrationUnit, + float* calibrationX, float* calibrationY, int* width, + int* height, ImageType* imageType); +IMAQ_FUNC FilterName* IMAQ_STDCALL imaqGetFilterNames(int* numFilters); +IMAQ_FUNC char** IMAQ_STDCALL +imaqLoadImagePopup(const char* defaultDirectory, const char* defaultFileSpec, + const char* fileTypeList, const char* title, + int allowMultiplePaths, ButtonLabel buttonLabel, + int restrictDirectory, int restrictExtension, + int allowCancel, int allowMakeDirectory, int* cancelled, + int* numPaths); +IMAQ_FUNC AVISession IMAQ_STDCALL imaqOpenAVI(const char* fileName); +IMAQ_FUNC int IMAQ_STDCALL imaqReadAVIFrame(Image* image, AVISession session, + unsigned int frameNum, void* data, + unsigned int* dataSize); +IMAQ_FUNC int IMAQ_STDCALL imaqReadFile(Image* image, const char* fileName, + RGBValue* colorTable, int* numColors); +IMAQ_FUNC int IMAQ_STDCALL +imaqReadVisionFile(Image* image, const char* fileName, RGBValue* colorTable, + int* numColors); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteAVIFrame(Image* image, AVISession session, + const void* data, + unsigned int dataLength); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteBMPFile(const Image* image, + const char* fileName, int compress, + const RGBValue* colorTable); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteFile(const Image* image, + const char* fileName, + const RGBValue* colorTable); +IMAQ_FUNC int IMAQ_STDCALL +imaqWriteJPEGFile(const Image* image, const char* fileName, + unsigned int quality, void* colorTable); +IMAQ_FUNC int IMAQ_STDCALL +imaqWriteJPEG2000File(const Image* image, const char* fileName, int lossless, + float compressionRatio, + const JPEG2000FileAdvancedOptions* advancedOptions, + const RGBValue* colorTable); +IMAQ_FUNC int IMAQ_STDCALL +imaqWritePNGFile2(const Image* image, const char* fileName, + unsigned int compressionSpeed, const RGBValue* colorTable, + int useBitDepth); +IMAQ_FUNC int IMAQ_STDCALL +imaqWriteTIFFFile(const Image* image, const char* fileName, + const TIFFFileOptions* options, const RGBValue* colorTable); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteVisionFile(const Image* image, + const char* fileName, + const RGBValue* colorTable); + +//============================================================================ +// Analytic Geometry functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqBuildCoordinateSystem(const Point* points, ReferenceMode mode, + AxisOrientation orientation, + CoordinateSystem* system); +IMAQ_FUNC BestCircle2* IMAQ_STDCALL +imaqFitCircle2(const PointFloat* points, int numPoints, + const FitCircleOptions* options); +IMAQ_FUNC BestEllipse2* IMAQ_STDCALL +imaqFitEllipse2(const PointFloat* points, int numPoints, + const FitEllipseOptions* options); +IMAQ_FUNC BestLine* IMAQ_STDCALL imaqFitLine(const PointFloat* points, + int numPoints, + const FitLineOptions* options); +IMAQ_FUNC int IMAQ_STDCALL imaqGetAngle(PointFloat start1, PointFloat end1, + PointFloat start2, PointFloat end2, + float* angle); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetBisectingLine(PointFloat start1, PointFloat end1, PointFloat start2, + PointFloat end2, PointFloat* bisectStart, + PointFloat* bisectEnd); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetDistance(PointFloat point1, PointFloat point2, float* distance); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetIntersection(PointFloat start1, PointFloat end1, PointFloat start2, + PointFloat end2, PointFloat* intersection); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetMidLine(PointFloat refLineStart, PointFloat refLineEnd, PointFloat point, + PointFloat* midLineStart, PointFloat* midLineEnd); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetPerpendicularLine(PointFloat refLineStart, PointFloat refLineEnd, + PointFloat point, PointFloat* perpLineStart, + PointFloat* perpLineEnd, double* distance); +IMAQ_FUNC SegmentInfo* IMAQ_STDCALL +imaqGetPointsOnContour(const Image* image, int* numSegments); +IMAQ_FUNC Point* IMAQ_STDCALL +imaqGetPointsOnLine(Point start, Point end, int* numPoints); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetPolygonArea(const PointFloat* points, int numPoints, float* area); +IMAQ_FUNC float* IMAQ_STDCALL +imaqInterpolatePoints(const Image* image, const Point* points, int numPoints, + InterpolationMethod method, int subpixel, + int* interpCount); + +//============================================================================ +// Clipboard functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqClipboardToImage(Image* dest, RGBValue* palette); +IMAQ_FUNC int IMAQ_STDCALL +imaqImageToClipboard(const Image* image, const RGBValue* palette); + +//============================================================================ +// Border functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqFillBorder(Image* image, BorderMethod method); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetBorderSize(const Image* image, int* borderSize); +IMAQ_FUNC int IMAQ_STDCALL imaqSetBorderSize(Image* image, int size); + +//============================================================================ +// Image Management functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqArrayToImage(Image* image, const void* array, int numCols, int numRows); +IMAQ_FUNC Image* IMAQ_STDCALL imaqCreateImage(ImageType type, int borderSize); +IMAQ_FUNC void* IMAQ_STDCALL +imaqImageToArray(const Image* image, Rect rect, int* columns, int* rows); + +//============================================================================ +// Color Processing functions +//============================================================================ +IMAQ_FUNC Color2 IMAQ_STDCALL +imaqChangeColorSpace2(const Color2* sourceColor, ColorMode sourceSpace, + ColorMode destSpace, double offset, + const CIEXYZValue* whiteReference); +IMAQ_FUNC int IMAQ_STDCALL +imaqColorBCGTransform(Image* dest, const Image* source, + const BCGOptions* redOptions, + const BCGOptions* greenOptions, + const BCGOptions* blueOptions, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqColorEqualize(Image* dest, const Image* source, int colorEqualization); +IMAQ_FUNC ColorHistogramReport* IMAQ_STDCALL +imaqColorHistogram2(Image* image, int numClasses, ColorMode mode, + const CIEXYZValue* whiteReference, Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqColorLookup(Image* dest, const Image* source, ColorMode mode, + const Image* mask, const short* plane1, const short* plane2, + const short* plane3); +IMAQ_FUNC int IMAQ_STDCALL +imaqColorThreshold(Image* dest, const Image* source, int replaceValue, + ColorMode mode, const Range* plane1Range, + const Range* plane2Range, const Range* plane3Range); +IMAQ_FUNC SupervisedColorSegmentationReport* IMAQ_STDCALL +imaqSupervisedColorSegmentation(ClassifierSession* session, Image* labelImage, + const Image* srcImage, const ROI* roi, + const ROILabel* labelIn, + unsigned int numLabelIn, int maxDistance, + int minIdentificationScore, + const ColorSegmenationOptions* segmentOptions); +IMAQ_FUNC int IMAQ_STDCALL imaqGetColorSegmentationMaxDistance( + ClassifierSession* session, const ColorSegmenationOptions* segmentOptions, + SegmentationDistanceLevel distLevel, int* maxDistance); + +//============================================================================ +// Transform functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqBCGTransform(Image* dest, const Image* source, + const BCGOptions* options, + const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqEqualize(Image* dest, const Image* source, + float min, float max, + const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqInverse(Image* dest, const Image* source, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL imaqMathTransform(Image* dest, const Image* source, + MathTransformMethod method, + float rangeMin, float rangeMax, + float power, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqWatershedTransform(Image* dest, const Image* source, int connectivity8, + int* zoneCount); +IMAQ_FUNC int IMAQ_STDCALL imaqLookup2(Image* dest, const Image* source, + const int* table, const Image* mask); + +//============================================================================ +// Window Management functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqAreScrollbarsVisible(int windowNumber, int* visible); +IMAQ_FUNC int IMAQ_STDCALL imaqBringWindowToTop(int windowNumber); +IMAQ_FUNC int IMAQ_STDCALL imaqGetMousePos(Point* position, int* windowNumber); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowBackground(int windowNumber, WindowBackgroundFillStyle* fillStyle, + WindowBackgroundHatchStyle* hatchStyle, + RGBValue* fillColor, RGBValue* backgroundColor); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowDisplayMapping(int windowNum, DisplayMapping* mapping); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowGrid(int windowNumber, int* xResolution, int* yResolution); +IMAQ_FUNC int IMAQ_STDCALL imaqGetWindowHandle(int* handle); +IMAQ_FUNC int IMAQ_STDCALL imaqGetWindowPos(int windowNumber, Point* position); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowSize(int windowNumber, int* width, int* height); +IMAQ_FUNC char* IMAQ_STDCALL imaqGetWindowTitle(int windowNumber); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowZoom2(int windowNumber, float* xZoom, float* yZoom); +IMAQ_FUNC int IMAQ_STDCALL +imaqIsWindowNonTearing(int windowNumber, int* nonTearing); +IMAQ_FUNC int IMAQ_STDCALL imaqIsWindowVisible(int windowNumber, int* visible); +IMAQ_FUNC int IMAQ_STDCALL imaqMoveWindow(int windowNumber, Point position); +IMAQ_FUNC int IMAQ_STDCALL imaqSetupWindow(int windowNumber, int configuration); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowBackground(int windowNumber, WindowBackgroundFillStyle fillStyle, + WindowBackgroundHatchStyle hatchStyle, + const RGBValue* fillColor, + const RGBValue* backgroundColor); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowDisplayMapping(int windowNumber, const DisplayMapping* mapping); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowGrid(int windowNumber, int xResolution, int yResolution); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowMaxContourCount(int windowNumber, unsigned int maxContourCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowNonTearing(int windowNumber, int nonTearing); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowPalette(int windowNumber, PaletteType type, + const RGBValue* palette, int numColors); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowSize(int windowNumber, int width, int height); +IMAQ_FUNC int IMAQ_STDCALL imaqSetWindowThreadPolicy(WindowThreadPolicy policy); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowTitle(int windowNumber, const char* title); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowZoomToFit(int windowNumber, int zoomToFit); +IMAQ_FUNC int IMAQ_STDCALL imaqShowScrollbars(int windowNumber, int visible); +IMAQ_FUNC int IMAQ_STDCALL +imaqZoomWindow2(int windowNumber, float xZoom, float yZoom, Point center); + +//============================================================================ +// Utilities functions +//============================================================================ +IMAQ_FUNC const float* IMAQ_STDCALL +imaqGetKernel(KernelFamily family, int size, int number); +IMAQ_FUNC Annulus IMAQ_STDCALL +imaqMakeAnnulus(Point center, int innerRadius, int outerRadius, + double startAngle, double endAngle); +IMAQ_FUNC Point IMAQ_STDCALL imaqMakePoint(int xCoordinate, int yCoordinate); +IMAQ_FUNC PointFloat IMAQ_STDCALL +imaqMakePointFloat(float xCoordinate, float yCoordinate); +IMAQ_FUNC Rect IMAQ_STDCALL +imaqMakeRect(int top, int left, int height, int width); +IMAQ_FUNC Rect IMAQ_STDCALL +imaqMakeRectFromRotatedRect(RotatedRect rotatedRect); +IMAQ_FUNC RotatedRect IMAQ_STDCALL +imaqMakeRotatedRect(int top, int left, int height, int width, double angle); +IMAQ_FUNC RotatedRect IMAQ_STDCALL imaqMakeRotatedRectFromRect(Rect rect); +IMAQ_FUNC int IMAQ_STDCALL imaqMulticoreOptions(MulticoreOperation operation, + unsigned int* customNumCores); + +//============================================================================ +// Tool Window functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqCloseToolWindow(void); +IMAQ_FUNC int IMAQ_STDCALL imaqGetCurrentTool(Tool* currentTool); +IMAQ_FUNC int IMAQ_STDCALL imaqGetLastEvent(WindowEventType* type, + int* windowNumber, Tool* tool, + Rect* rect); +IMAQ_FUNC void* IMAQ_STDCALL imaqGetToolWindowHandle(void); +IMAQ_FUNC int IMAQ_STDCALL imaqGetToolWindowPos(Point* position); +IMAQ_FUNC int IMAQ_STDCALL imaqIsToolWindowVisible(int* visible); +IMAQ_FUNC int IMAQ_STDCALL imaqMoveToolWindow(Point position); +IMAQ_FUNC int IMAQ_STDCALL imaqSetCurrentTool(Tool currentTool); +#ifndef __GNUC__ +IMAQ_FUNC int IMAQ_STDCALL +imaqSetEventCallback(EventCallback callback, int synchronous); +#endif +IMAQ_FUNC int IMAQ_STDCALL imaqSetToolColor(const RGBValue* color); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetupToolWindow(int showCoordinates, int maxIconsPerLine, + const ToolWindowOptions* options); +IMAQ_FUNC int IMAQ_STDCALL imaqShowToolWindow(int visible); + +//============================================================================ +// Meter functions +//============================================================================ +IMAQ_FUNC MeterArc* IMAQ_STDCALL +imaqGetMeterArc(int lightNeedle, MeterArcMode mode, const ROI* roi, + PointFloat base, PointFloat start, PointFloat end); +IMAQ_FUNC int IMAQ_STDCALL +imaqReadMeter(const Image* image, const MeterArc* arcInfo, double* percentage, + PointFloat* endOfNeedle); + +//============================================================================ +// Calibration functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqCopyCalibrationInfo2(Image* dest, Image* source, Point offset); +IMAQ_FUNC int IMAQ_STDCALL +imaqCorrectCalibratedImage(Image* dest, const Image* source, PixelValue fill, + InterpolationMethod method, const ROI* roi); +IMAQ_FUNC CalibrationInfo* IMAQ_STDCALL +imaqGetCalibrationInfo2(const Image* image); +IMAQ_FUNC CalibrationInfo* IMAQ_STDCALL +imaqGetCalibrationInfo3(Image* image, unsigned int isGetErrorMap); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnCalibrationGrid(Image* image, const ROI* roi, + const LearnCalibrationOptions* options, + const GridDescriptor* grid, + const CoordinateSystem* system, + const RangeFloat* range, float* quality); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnCalibrationPoints(Image* image, const CalibrationPoints* points, + const ROI* roi, + const LearnCalibrationOptions* options, + const GridDescriptor* grid, + const CoordinateSystem* system, float* quality); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetCoordinateSystem(Image* image, const CoordinateSystem* system); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetSimpleCalibration(Image* image, ScalingMethod method, int learnTable, + const GridDescriptor* grid, + const CoordinateSystem* system); +IMAQ_FUNC TransformReport* IMAQ_STDCALL +imaqTransformPixelToRealWorld(const Image* image, + const PointFloat* pixelCoordinates, + int numCoordinates); +IMAQ_FUNC TransformReport* IMAQ_STDCALL +imaqTransformRealWorldToPixel(const Image* image, + const PointFloat* realWorldCoordinates, + int numCoordinates); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetSimpleCalibration2(Image* image, const GridDescriptor* gridDescriptor); +IMAQ_FUNC int IMAQ_STDCALL +imaqCalibrationSetAxisInfo(Image* image, CoordinateSystem* axisInfo); +IMAQ_FUNC int IMAQ_STDCALL +imaqCalibrationGetThumbnailImage(Image* templateImage, Image* image, + CalibrationThumbnailType type, + unsigned int index); +IMAQ_FUNC GetCalibrationInfoReport* IMAQ_STDCALL +imaqCalibrationGetCalibrationInfo(Image* image, unsigned int isGetErrorMap); +IMAQ_FUNC GetCameraParametersReport* IMAQ_STDCALL +imaqCalibrationGetCameraParameters(Image* templateImage); +IMAQ_FUNC int IMAQ_STDCALL imaqCalibrationCompactInformation(Image* image); + +//============================================================================ +// Pixel Manipulation functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqArrayToComplexPlane(Image* dest, const Image* source, + const float* newPixels, ComplexPlane plane); +IMAQ_FUNC float* IMAQ_STDCALL +imaqComplexPlaneToArray(const Image* image, ComplexPlane plane, Rect rect, + int* rows, int* columns); +IMAQ_FUNC int IMAQ_STDCALL imaqExtractColorPlanes(const Image* image, + ColorMode mode, Image* plane1, + Image* plane2, Image* plane3); +IMAQ_FUNC int IMAQ_STDCALL +imaqExtractComplexPlane(Image* dest, const Image* source, ComplexPlane plane); +IMAQ_FUNC int IMAQ_STDCALL +imaqFillImage(Image* image, PixelValue value, const Image* mask); +IMAQ_FUNC void* IMAQ_STDCALL +imaqGetLine(const Image* image, Point start, Point end, int* numPoints); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetPixel(const Image* image, Point pixel, PixelValue* value); +IMAQ_FUNC int IMAQ_STDCALL +imaqReplaceColorPlanes(Image* dest, const Image* source, ColorMode mode, + const Image* plane1, const Image* plane2, + const Image* plane3); +IMAQ_FUNC int IMAQ_STDCALL +imaqReplaceComplexPlane(Image* dest, const Image* source, + const Image* newValues, ComplexPlane plane); +IMAQ_FUNC int IMAQ_STDCALL imaqSetLine(Image* image, const void* array, + int arraySize, Point start, Point end); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetPixel(Image* image, Point coord, PixelValue value); + +//============================================================================ +// Color Matching functions +//============================================================================ +IMAQ_FUNC ColorInformation* IMAQ_STDCALL +imaqLearnColor(const Image* image, const ROI* roi, ColorSensitivity sensitivity, + int saturation); +IMAQ_FUNC int* IMAQ_STDCALL imaqMatchColor(const Image* image, + const ColorInformation* info, + const ROI* roi, int* numScores); + +//============================================================================ +// Frequency Domain Analysis functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqAttenuate(Image* dest, const Image* source, AttenuateMode highlow); +IMAQ_FUNC int IMAQ_STDCALL imaqConjugate(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL imaqFFT(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqFlipFrequencies(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL imaqInverseFFT(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL imaqTruncate(Image* dest, const Image* source, + TruncateMode highlow, + float ratioToKeep); + +//============================================================================ +// Barcode I/O functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqGradeDataMatrixBarcodeAIM(const Image* image, AIMGradeReport* report); +IMAQ_FUNC BarcodeInfo* IMAQ_STDCALL +imaqReadBarcode(const Image* image, BarcodeType type, const ROI* roi, + int validate); +IMAQ_FUNC DataMatrixReport* IMAQ_STDCALL imaqReadDataMatrixBarcode2( + Image* image, const ROI* roi, DataMatrixGradingMode prepareForGrading, + const DataMatrixDescriptionOptions* descriptionOptions, + const DataMatrixSizeOptions* sizeOptions, + const DataMatrixSearchOptions* searchOptions); +IMAQ_FUNC Barcode2DInfo* IMAQ_STDCALL +imaqReadPDF417Barcode(const Image* image, const ROI* roi, + Barcode2DSearchMode searchMode, + unsigned int* numBarcodes); +IMAQ_FUNC QRCodeReport* IMAQ_STDCALL +imaqReadQRCode(Image* image, const ROI* roi, QRGradingMode reserved, + const QRCodeDescriptionOptions* descriptionOptions, + const QRCodeSizeOptions* sizeOptions, + const QRCodeSearchOptions* searchOptions); + +//============================================================================ +// LCD functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqFindLCDSegments(ROI* roi, const Image* image, const LCDOptions* options); +IMAQ_FUNC LCDReport* IMAQ_STDCALL +imaqReadLCD(const Image* image, const ROI* roi, const LCDOptions* options); + +//============================================================================ +// Shape Matching functions +//============================================================================ +IMAQ_FUNC ShapeReport* IMAQ_STDCALL +imaqMatchShape(Image* dest, Image* source, const Image* templateImage, + int scaleInvariant, int connectivity8, double tolerance, + int* numMatches); + +//============================================================================ +// Contours functions +//============================================================================ +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddAnnulusContour(ROI* roi, Annulus annulus); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddClosedContour(ROI* roi, const Point* points, int numPoints); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddLineContour(ROI* roi, Point start, Point end); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddOpenContour(ROI* roi, const Point* points, int numPoints); +IMAQ_FUNC ContourID IMAQ_STDCALL imaqAddOvalContour(ROI* roi, Rect boundingBox); +IMAQ_FUNC ContourID IMAQ_STDCALL imaqAddPointContour(ROI* roi, Point point); +IMAQ_FUNC ContourID IMAQ_STDCALL imaqAddRectContour(ROI* roi, Rect rect); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddRotatedRectContour2(ROI* roi, RotatedRect rect); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqCopyContour(ROI* destRoi, const ROI* sourceRoi, ContourID id); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqGetContour(const ROI* roi, unsigned int index); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetContourColor(const ROI* roi, ContourID id, RGBValue* contourColor); +IMAQ_FUNC int IMAQ_STDCALL imaqGetContourCount(const ROI* roi); +IMAQ_FUNC ContourInfo2* IMAQ_STDCALL +imaqGetContourInfo2(const ROI* roi, ContourID id); +IMAQ_FUNC int IMAQ_STDCALL +imaqMoveContour(ROI* roi, ContourID id, int deltaX, int deltaY); +IMAQ_FUNC int IMAQ_STDCALL imaqRemoveContour(ROI* roi, ContourID id); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetContourColor(ROI* roi, ContourID id, const RGBValue* color); + +//============================================================================ +// Regions of Interest functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqConstructROI2(const Image* image, ROI* roi, Tool initialTool, + const ToolWindowOptions* tools, + const ConstructROIOptions2* options, int* okay); +IMAQ_FUNC ROI* IMAQ_STDCALL imaqCreateROI(void); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetROIBoundingBox(const ROI* roi, Rect* boundingBox); +IMAQ_FUNC int IMAQ_STDCALL imaqGetROIColor(const ROI* roi, RGBValue* roiColor); +IMAQ_FUNC ROI* IMAQ_STDCALL imaqGetWindowROI(int windowNumber); +IMAQ_FUNC int IMAQ_STDCALL imaqSetROIColor(ROI* roi, const RGBValue* color); +IMAQ_FUNC int IMAQ_STDCALL imaqSetWindowROI(int windowNumber, const ROI* roi); + +//============================================================================ +// Image Analysis functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqCentroid(const Image* image, PointFloat* centroid, const Image* mask); +IMAQ_FUNC Curve* IMAQ_STDCALL +imaqExtractCurves(const Image* image, const ROI* roi, + const CurveOptions* curveOptions, unsigned int* numCurves); +IMAQ_FUNC HistogramReport* IMAQ_STDCALL +imaqHistogram(const Image* image, int numClasses, float min, float max, + const Image* mask); +IMAQ_FUNC LinearAverages* IMAQ_STDCALL +imaqLinearAverages2(Image* image, LinearAveragesMode mode, Rect rect); +IMAQ_FUNC LineProfile* IMAQ_STDCALL +imaqLineProfile(const Image* image, Point start, Point end); +IMAQ_FUNC QuantifyReport* IMAQ_STDCALL +imaqQuantify(const Image* image, const Image* mask); + +//============================================================================ +// Error Management functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqClearError(void); +IMAQ_FUNC char* IMAQ_STDCALL imaqGetErrorText(int errorCode); +IMAQ_FUNC int IMAQ_STDCALL imaqGetLastError(void); +IMAQ_FUNC const char* IMAQ_STDCALL imaqGetLastErrorFunc(void); +IMAQ_FUNC int IMAQ_STDCALL imaqSetError(int errorCode, const char* function); + +//============================================================================ +// Threshold functions +//============================================================================ +IMAQ_FUNC ThresholdData* IMAQ_STDCALL +imaqAutoThreshold2(Image* dest, const Image* source, int numClasses, + ThresholdMethod method, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqLocalThreshold(Image* dest, const Image* source, unsigned int windowWidth, + unsigned int windowHeight, LocalThresholdMethod method, + double deviationWeight, ObjectType type, float replaceValue); +IMAQ_FUNC int IMAQ_STDCALL imaqMagicWand(Image* dest, const Image* source, + Point coord, float tolerance, + int connectivity8, float replaceValue); +IMAQ_FUNC int IMAQ_STDCALL imaqMultithreshold(Image* dest, const Image* source, + const ThresholdData* ranges, + int numRanges); +IMAQ_FUNC int IMAQ_STDCALL imaqThreshold(Image* dest, const Image* source, + float rangeMin, float rangeMax, + int useNewValue, float newValue); + +//============================================================================ +// Memory Management functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqDispose(void* object); + +//============================================================================ +// Pattern Matching functions +//============================================================================ +IMAQ_FUNC CircleMatch* IMAQ_STDCALL +imaqDetectCircles(const Image* image, const CircleDescriptor* circleDescriptor, + const CurveOptions* curveOptions, + const ShapeDetectionOptions* shapeDetectionOptions, + const ROI* roi, int* numMatchesReturned); +IMAQ_FUNC EllipseMatch* IMAQ_STDCALL +imaqDetectEllipses(const Image* image, + const EllipseDescriptor* ellipseDescriptor, + const CurveOptions* curveOptions, + const ShapeDetectionOptions* shapeDetectionOptions, + const ROI* roi, int* numMatchesReturned); +IMAQ_FUNC LineMatch* IMAQ_STDCALL +imaqDetectLines(const Image* image, const LineDescriptor* lineDescriptor, + const CurveOptions* curveOptions, + const ShapeDetectionOptions* shapeDetectionOptions, + const ROI* roi, int* numMatchesReturned); +IMAQ_FUNC RectangleMatch* IMAQ_STDCALL +imaqDetectRectangles(const Image* image, + const RectangleDescriptor* rectangleDescriptor, + const CurveOptions* curveOptions, + const ShapeDetectionOptions* shapeDetectionOptions, + const ROI* roi, int* numMatchesReturned); +IMAQ_FUNC FeatureData* IMAQ_STDCALL +imaqGetGeometricFeaturesFromCurves(const Curve* curves, unsigned int numCurves, + const FeatureType* featureTypes, + unsigned int numFeatureTypes, + unsigned int* numFeatures); +IMAQ_FUNC FeatureData* IMAQ_STDCALL +imaqGetGeometricTemplateFeatureInfo(const Image* pattern, + unsigned int* numFeatures); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnColorPattern(Image* image, const LearnColorPatternOptions* options); +IMAQ_FUNC int IMAQ_STDCALL imaqLearnGeometricPattern( + Image* image, PointFloat originOffset, const CurveOptions* curveOptions, + const LearnGeometricPatternAdvancedOptions* advancedLearnOptions, + const Image* mask); +IMAQ_FUNC MultipleGeometricPattern* IMAQ_STDCALL +imaqLearnMultipleGeometricPatterns(const Image** patterns, + unsigned int numberOfPatterns, + const String255* labels); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnPattern3(Image* image, LearningMode learningMode, + LearnPatternAdvancedOptions* advancedOptions, + const Image* mask); +IMAQ_FUNC PatternMatch* IMAQ_STDCALL +imaqMatchColorPattern(const Image* image, Image* pattern, + const MatchColorPatternOptions* options, Rect searchRect, + int* numMatches); +IMAQ_FUNC GeometricPatternMatch2* IMAQ_STDCALL imaqMatchGeometricPattern2( + const Image* image, const Image* pattern, const CurveOptions* curveOptions, + const MatchGeometricPatternOptions* matchOptions, + const MatchGeometricPatternAdvancedOptions2* advancedMatchOptions, + const ROI* roi, int* numMatches); +IMAQ_FUNC GeometricPatternMatch2* IMAQ_STDCALL +imaqMatchMultipleGeometricPatterns( + const Image* image, const MultipleGeometricPattern* multiplePattern, + const ROI* roi, int* numMatches); +IMAQ_FUNC MultipleGeometricPattern* IMAQ_STDCALL +imaqReadMultipleGeometricPatternFile(const char* fileName, + String255 description); +IMAQ_FUNC PatternMatch* IMAQ_STDCALL +imaqRefineMatches(const Image* image, const Image* pattern, + const PatternMatch* candidatesIn, int numCandidatesIn, + MatchPatternOptions* options, + MatchPatternAdvancedOptions* advancedOptions, + int* numCandidatesOut); +IMAQ_FUNC int IMAQ_STDCALL imaqSetMultipleGeometricPatternsOptions( + MultipleGeometricPattern* multiplePattern, const char* label, + const CurveOptions* curveOptions, + const MatchGeometricPatternOptions* matchOptions, + const MatchGeometricPatternAdvancedOptions2* advancedMatchOptions); +IMAQ_FUNC int IMAQ_STDCALL imaqWriteMultipleGeometricPatternFile( + const MultipleGeometricPattern* multiplePattern, const char* fileName, + const char* description); +IMAQ_FUNC GeometricPatternMatch3* IMAQ_STDCALL imaqMatchGeometricPattern3( + const Image* image, const Image* pattern, const CurveOptions* curveOptions, + const MatchGeometricPatternOptions* matchOptions, + const MatchGeometricPatternAdvancedOptions3* advancedMatchOptions, + const ROI* roi, size_t* numMatches); +IMAQ_FUNC int IMAQ_STDCALL imaqLearnGeometricPattern2( + Image* image, PointFloat originOffset, double angleOffset, + const CurveOptions* curveOptions, + const LearnGeometricPatternAdvancedOptions2* advancedLearnOptions, + const Image* mask); +IMAQ_FUNC PatternMatch* IMAQ_STDCALL +imaqMatchPattern3(const Image* image, const Image* pattern, + const MatchPatternOptions* options, + const MatchPatternAdvancedOptions* advancedOptions, + const ROI* roi, int* numMatches); + +//============================================================================ +// Overlay functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqClearOverlay(Image* image, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqCopyOverlay(Image* dest, const Image* source, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetOverlayProperties(const Image* image, const char* group, + TransformBehaviors* transformBehaviors); +IMAQ_FUNC int IMAQ_STDCALL +imaqMergeOverlay(Image* dest, const Image* source, const RGBValue* palette, + unsigned int numColors, const char* group); +IMAQ_FUNC int IMAQ_STDCALL imaqOverlayArc(Image* image, const ArcInfo* arc, + const RGBValue* color, + DrawMode drawMode, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayBitmap(Image* image, Point destLoc, const RGBValue* bitmap, + unsigned int numCols, unsigned int numRows, + const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayClosedContour(Image* image, const Point* points, int numPoints, + const RGBValue* color, DrawMode drawMode, + const char* group); +IMAQ_FUNC int IMAQ_STDCALL imaqOverlayLine(Image* image, Point start, Point end, + const RGBValue* color, + const char* group); +IMAQ_FUNC int IMAQ_STDCALL imaqOverlayMetafile(Image* image, + const void* metafile, Rect rect, + const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayOpenContour(Image* image, const Point* points, int numPoints, + const RGBValue* color, const char* group); +IMAQ_FUNC int IMAQ_STDCALL imaqOverlayOval(Image* image, Rect boundingBox, + const RGBValue* color, + DrawMode drawMode, char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayPoints(Image* image, const Point* points, int numPoints, + const RGBValue* colors, int numColors, PointSymbol symbol, + const UserPointSymbol* userSymbol, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayRect(Image* image, Rect rect, const RGBValue* color, + DrawMode drawMode, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayROI(Image* image, const ROI* roi, PointSymbol symbol, + const UserPointSymbol* userSymbol, const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqOverlayText(Image* image, Point origin, const char* text, + const RGBValue* color, const OverlayTextOptions* options, + const char* group); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetOverlayProperties(Image* image, const char* group, + TransformBehaviors* transformBehaviors); + +//============================================================================ +// OCR functions +//============================================================================ +IMAQ_FUNC CharSet* IMAQ_STDCALL imaqCreateCharSet(void); +IMAQ_FUNC int IMAQ_STDCALL imaqDeleteChar(CharSet* set, int index); +IMAQ_FUNC int IMAQ_STDCALL imaqGetCharCount(const CharSet* set); +IMAQ_FUNC CharInfo2* IMAQ_STDCALL +imaqGetCharInfo2(const CharSet* set, int index); +IMAQ_FUNC int IMAQ_STDCALL +imaqReadOCRFile(const char* fileName, CharSet* set, String255 setDescription, + ReadTextOptions* readOptions, + OCRProcessingOptions* processingOptions, + OCRSpacingOptions* spacingOptions); +IMAQ_FUNC ReadTextReport3* IMAQ_STDCALL +imaqReadText3(const Image* image, const CharSet* set, const ROI* roi, + const ReadTextOptions* readOptions, + const OCRProcessingOptions* processingOptions, + const OCRSpacingOptions* spacingOptions); +IMAQ_FUNC int IMAQ_STDCALL +imaqRenameChar(CharSet* set, int index, const char* newCharValue); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetReferenceChar(const CharSet* set, int index, int isReferenceChar); +IMAQ_FUNC int IMAQ_STDCALL +imaqTrainChars(const Image* image, CharSet* set, int index, + const char* charValue, const ROI* roi, + const OCRProcessingOptions* processingOptions, + const OCRSpacingOptions* spacingOptions); +IMAQ_FUNC int* IMAQ_STDCALL +imaqVerifyPatterns(const Image* image, const CharSet* set, + const String255* expectedPatterns, int patternCount, + const ROI* roi, int* numScores); +IMAQ_FUNC int* IMAQ_STDCALL +imaqVerifyText(const Image* image, const CharSet* set, + const char* expectedString, const ROI* roi, int* numScores); +IMAQ_FUNC int IMAQ_STDCALL +imaqWriteOCRFile(const char* fileName, const CharSet* set, + const char* setDescription, const ReadTextOptions* readOptions, + const OCRProcessingOptions* processingOptions, + const OCRSpacingOptions* spacingOptions); + +//============================================================================ +// Geometric Matching functions +//============================================================================ +IMAQ_FUNC ExtractContourReport* IMAQ_STDCALL +imaqExtractContour(Image* image, const ROI* roi, + ExtractContourDirection direction, + CurveParameters* curveParams, + const ConnectionConstraint* connectionConstraintParams, + unsigned int numOfConstraints, + ExtractContourSelection selection, Image* contourImage); +IMAQ_FUNC int IMAQ_STDCALL +imaqContourOverlay(Image* image, const Image* contourImage, + const ContourOverlaySettings* pointsSettings, + const ContourOverlaySettings* eqnSettings, + const char* groupName); +IMAQ_FUNC ContourComputeCurvatureReport* IMAQ_STDCALL +imaqContourComputeCurvature(const Image* contourImage, unsigned int kernel); +IMAQ_FUNC CurvatureAnalysisReport* IMAQ_STDCALL +imaqContourClassifyCurvature(const Image* contourImage, unsigned int kernel, + RangeLabel* curvatureClasses, + unsigned int numCurvatureClasses); +IMAQ_FUNC ComputeDistancesReport* IMAQ_STDCALL +imaqContourComputeDistances(const Image* targetImage, + const Image* templateImage, + const SetupMatchPatternData* matchSetupData, + unsigned int smoothingKernel); +IMAQ_FUNC ClassifyDistancesReport* IMAQ_STDCALL imaqContourClassifyDistances( + const Image* targetImage, const Image* templateImage, + const SetupMatchPatternData* matchSetupData, unsigned int smoothingKernel, + const RangeLabel* distanceRanges, unsigned int numDistanceRanges); +IMAQ_FUNC ContourInfoReport* IMAQ_STDCALL +imaqContourInfo(const Image* contourImage); +IMAQ_FUNC SetupMatchPatternData* IMAQ_STDCALL imaqContourSetupMatchPattern( + MatchMode* matchMode, unsigned int enableSubPixelAccuracy, + CurveParameters* curveParams, unsigned int useLearnCurveParameters, + const RangeSettingDouble* rangeSettings, unsigned int numRangeSettings); +IMAQ_FUNC int IMAQ_STDCALL imaqContourAdvancedSetupMatchPattern( + SetupMatchPatternData* matchSetupData, + GeometricAdvancedSetupDataOption* geometricOptions, + unsigned int numGeometricOptions); +IMAQ_FUNC ContourFitLineReport* IMAQ_STDCALL +imaqContourFitLine(Image* image, double pixelRadius); +IMAQ_FUNC PartialCircle* IMAQ_STDCALL +imaqContourFitCircle(Image* image, double pixelRadius, int rejectOutliers); +IMAQ_FUNC PartialEllipse* IMAQ_STDCALL +imaqContourFitEllipse(Image* image, double pixelRadius, int rejectOutliers); +IMAQ_FUNC ContourFitSplineReport* IMAQ_STDCALL +imaqContourFitSpline(Image* image, int degree, int numberOfControlPoints); +IMAQ_FUNC ContourFitPolynomialReport* IMAQ_STDCALL +imaqContourFitPolynomial(Image* image, int order); + +//============================================================================ +// Edge Detection functions +//============================================================================ +IMAQ_FUNC FindCircularEdgeReport* IMAQ_STDCALL +imaqFindCircularEdge2(Image* image, const ROI* roi, + const CoordinateSystem* baseSystem, + const CoordinateSystem* newSystem, + const FindCircularEdgeOptions* edgeOptions, + const CircleFitOptions* circleFitOptions); +IMAQ_FUNC FindConcentricEdgeReport* IMAQ_STDCALL imaqFindConcentricEdge2( + Image* image, const ROI* roi, const CoordinateSystem* baseSystem, + const CoordinateSystem* newSystem, + const FindConcentricEdgeOptions* edgeOptions, + const ConcentricEdgeFitOptions* concentricEdgeFitOptions); + +//============================================================================ +// Morphology Reconstruction functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqGrayMorphologyReconstruct(Image* dstImage, Image* srcImage, + const Image* markerImage, PointFloat* points, + int numOfPoints, + MorphologyReconstructOperation operation, + const StructuringElement* structuringElement, + const ROI* roi); +IMAQ_FUNC int IMAQ_STDCALL +imaqMorphologyReconstruct(Image* dstImage, Image* srcImage, + const Image* markerImage, PointFloat* points, + int numOfPoints, + MorphologyReconstructOperation operation, + Connectivity connectivity, const ROI* roi); + +//============================================================================ +// Texture functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqDetectTextureDefect(ClassifierSession* session, Image* destImage, + const Image* srcImage, const ROI* roi, + int initialStepSize, int finalStepSize, + unsigned char defectPixelValue, + double minClassificationScore); +IMAQ_FUNC int IMAQ_STDCALL imaqClassificationTextureDefectOptions( + ClassifierSession* session, WindowSize* windowOptions, + WaveletOptions* waveletOptions, void** bandsUsed, int* numBandsUsed, + CooccurrenceOptions* cooccurrenceOptions, unsigned char setOperation); +IMAQ_FUNC int IMAQ_STDCALL +imaqCooccurrenceMatrix(const Image* srcImage, const ROI* roi, int levelPixel, + const DisplacementVector* displacementVec, + void* featureOptionArray, + unsigned int featureOptionArraySize, + void** cooccurrenceMatrixArray, + int* coocurrenceMatrixRows, int* coocurrenceMatrixCols, + void** featureVectorArray, int* featureVectorArraySize); +IMAQ_FUNC ExtractTextureFeaturesReport* IMAQ_STDCALL +imaqExtractTextureFeatures(const Image* srcImage, const ROI* roi, + const WindowSize* windowOptions, + const WaveletOptions* waveletOptions, + void* waveletBands, unsigned int numWaveletBands, + const CooccurrenceOptions* cooccurrenceOptions, + unsigned char useWindow); +IMAQ_FUNC WaveletBandsReport* IMAQ_STDCALL +imaqExtractWaveletBands(const Image* srcImage, + const WaveletOptions* waveletOptions, + void* waveletBands, unsigned int numWaveletBands); + +//============================================================================ +// Regions of Interest Manipulation functions +//============================================================================ +IMAQ_FUNC ROI* IMAQ_STDCALL imaqMaskToROI(const Image* mask, int* withinLimit); +IMAQ_FUNC ROIProfile* IMAQ_STDCALL +imaqROIProfile(const Image* image, const ROI* roi); +IMAQ_FUNC int IMAQ_STDCALL imaqROIToMask(Image* mask, const ROI* roi, + int fillValue, const Image* imageModel, + int* inSpace); +IMAQ_FUNC int IMAQ_STDCALL imaqTransformROI2(ROI* roi, + const CoordinateSystem* baseSystem, + const CoordinateSystem* newSystem); +IMAQ_FUNC LabelToROIReport* IMAQ_STDCALL +imaqLabelToROI(const Image* image, const unsigned int* labelsIn, + unsigned int numLabelsIn, int maxNumVectors, + int isExternelEdges); + +//============================================================================ +// Morphology functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqGrayMorphology(Image* dest, Image* source, MorphologyMethod method, + const StructuringElement* structuringElement); + +//============================================================================ +// Classification functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqAddClassifierSample(Image* image, ClassifierSession* session, + const ROI* roi, const char* sampleClass, + double* featureVector, unsigned int vectorSize); +IMAQ_FUNC ClassifierReportAdvanced* IMAQ_STDCALL +imaqAdvanceClassify(Image* image, const ClassifierSession* session, + const ROI* roi, double* featureVector, + unsigned int vectorSize); +IMAQ_FUNC ClassifierReport* IMAQ_STDCALL +imaqClassify(Image* image, const ClassifierSession* session, const ROI* roi, + double* featureVector, unsigned int vectorSize); +IMAQ_FUNC ClassifierSession* IMAQ_STDCALL +imaqCreateClassifier(ClassifierType type); +IMAQ_FUNC int IMAQ_STDCALL +imaqDeleteClassifierSample(ClassifierSession* session, int index); +IMAQ_FUNC ClassifierAccuracyReport* IMAQ_STDCALL +imaqGetClassifierAccuracy(const ClassifierSession* session); +IMAQ_FUNC ClassifierSampleInfo* IMAQ_STDCALL +imaqGetClassifierSampleInfo(const ClassifierSession* session, int index, + int* numSamples); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetColorClassifierOptions(const ClassifierSession* session, + ColorOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetNearestNeighborOptions(const ClassifierSession* session, + NearestNeighborOptions* options); +IMAQ_FUNC int IMAQ_STDCALL imaqGetParticleClassifierOptions2( + const ClassifierSession* session, + ParticleClassifierPreprocessingOptions2* preprocessingOptions, + ParticleClassifierOptions* options); +IMAQ_FUNC ClassifierSession* IMAQ_STDCALL +imaqReadClassifierFile(ClassifierSession* session, const char* fileName, + ReadClassifierFileMode mode, ClassifierType* type, + ClassifierEngineType* engine, String255 description); +IMAQ_FUNC int IMAQ_STDCALL +imaqRelabelClassifierSample(ClassifierSession* session, int index, + const char* newClass); +IMAQ_FUNC int IMAQ_STDCALL imaqSetParticleClassifierOptions2( + ClassifierSession* session, + const ParticleClassifierPreprocessingOptions2* preprocessingOptions, + const ParticleClassifierOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetColorClassifierOptions(ClassifierSession* session, + const ColorOptions* options); +IMAQ_FUNC NearestNeighborTrainingReport* IMAQ_STDCALL +imaqTrainNearestNeighborClassifier(ClassifierSession* session, + const NearestNeighborOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqWriteClassifierFile(const ClassifierSession* session, const char* fileName, + WriteClassifierFileMode mode, + const String255 description); + +//============================================================================ +// Measure Distances functions +//============================================================================ +IMAQ_FUNC ClampMax2Report* IMAQ_STDCALL +imaqClampMax2(Image* image, const ROI* roi, const CoordinateSystem* baseSystem, + const CoordinateSystem* newSystem, + const CurveOptions* curveSettings, + const ClampSettings* clampSettings, + const ClampOverlaySettings* clampOverlaySettings); + +//============================================================================ +// Inspection functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL +imaqCompareGoldenTemplate(const Image* image, const Image* goldenTemplate, + Image* brightDefects, Image* darkDefects, + const InspectionAlignment* alignment, + const InspectionOptions* options); +IMAQ_FUNC int IMAQ_STDCALL imaqLearnGoldenTemplate(Image* goldenTemplate, + PointFloat originOffset, + const Image* mask); +//============================================================================ +// Obsolete functions +//============================================================================ +IMAQ_FUNC int IMAQ_STDCALL imaqRotate(Image* dest, const Image* source, + float angle, PixelValue fill, + InterpolationMethod method); +IMAQ_FUNC int IMAQ_STDCALL +imaqWritePNGFile(const Image* image, const char* fileName, + unsigned int compressionSpeed, const RGBValue* colorTable); +IMAQ_FUNC ParticleReport* IMAQ_STDCALL +imaqSelectParticles(const Image* image, const ParticleReport* reports, + int reportCount, int rejectBorder, + const SelectParticleCriteria* criteria, int criteriaCount, + int* selectedCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqParticleFilter(Image* dest, Image* source, + const ParticleFilterCriteria* criteria, int criteriaCount, + int rejectMatches, int connectivity8); +IMAQ_FUNC ParticleReport* IMAQ_STDCALL +imaqGetParticleInfo(Image* image, int connectivity8, ParticleInfoMode mode, + int* reportCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqCalcCoeff(const Image* image, const ParticleReport* report, + MeasurementValue parameter, float* coefficient); +IMAQ_FUNC EdgeReport* IMAQ_STDCALL +imaqEdgeTool(const Image* image, const Point* points, int numPoints, + const EdgeOptions* options, int* numEdges); +IMAQ_FUNC CircleReport* IMAQ_STDCALL +imaqCircles(Image* dest, const Image* source, float minRadius, float maxRadius, + int* numCircles); +IMAQ_FUNC int IMAQ_STDCALL +imaqLabel(Image* dest, Image* source, int connectivity8, int* particleCount); +IMAQ_FUNC int IMAQ_STDCALL +imaqFitEllipse(const PointFloat* points, int numPoints, BestEllipse* ellipse); +IMAQ_FUNC int IMAQ_STDCALL +imaqFitCircle(const PointFloat* points, int numPoints, BestCircle* circle); +IMAQ_FUNC Color IMAQ_STDCALL imaqChangeColorSpace(const Color* sourceColor, + ColorMode sourceSpace, + ColorMode destSpace); +IMAQ_FUNC PatternMatch* IMAQ_STDCALL +imaqMatchPattern(const Image* image, Image* pattern, + const MatchPatternOptions* options, Rect searchRect, + int* numMatches); +IMAQ_FUNC int IMAQ_STDCALL imaqConvex(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqIsVisionInfoPresent(const Image* image, VisionInfoType type, int* present); +IMAQ_FUNC int IMAQ_STDCALL +imaqLineGaugeTool(const Image* image, Point start, Point end, + LineGaugeMethod method, const EdgeOptions* edgeOptions, + const CoordinateTransform* reference, float* distance); +IMAQ_FUNC int IMAQ_STDCALL imaqBestCircle(const PointFloat* points, + int numPoints, PointFloat* center, + double* radius); +IMAQ_FUNC int IMAQ_STDCALL +imaqSavePattern(const Image* pattern, const char* fileName); +IMAQ_FUNC int IMAQ_STDCALL +imaqLoadPattern(Image* pattern, const char* fileName); +IMAQ_FUNC int IMAQ_STDCALL imaqTransformROI(ROI* roi, Point originStart, + float angleStart, Point originFinal, + float angleFinal); +IMAQ_FUNC int IMAQ_STDCALL imaqCoordinateReference(const Point* points, + ReferenceMode mode, + Point* origin, float* angle); +IMAQ_FUNC ContourInfo* IMAQ_STDCALL +imaqGetContourInfo(const ROI* roi, ContourID id); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetWindowOverlay(int windowNumber, const Overlay* overlay); +IMAQ_FUNC Overlay* IMAQ_STDCALL imaqCreateOverlayFromROI(const ROI* roi); +IMAQ_FUNC Overlay* IMAQ_STDCALL +imaqCreateOverlayFromMetafile(const void* metafile); +IMAQ_FUNC int IMAQ_STDCALL +imaqSetCalibrationInfo(Image* image, CalibrationUnit unit, float xDistance, + float yDistance); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetCalibrationInfo(const Image* image, CalibrationUnit* unit, + float* xDistance, float* yDistance); +IMAQ_FUNC int IMAQ_STDCALL +imaqConstructROI(const Image* image, ROI* roi, Tool initialTool, + const ToolWindowOptions* tools, + const ConstructROIOptions* options, int* okay); +IMAQ_FUNC int IMAQ_STDCALL imaqGetParticleClassifierOptions( + const ClassifierSession* session, + ParticleClassifierPreprocessingOptions* preprocessingOptions, + ParticleClassifierOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqZoomWindow(int windowNumber, int xZoom, int yZoom, Point center); +IMAQ_FUNC int IMAQ_STDCALL +imaqGetWindowZoom(int windowNumber, int* xZoom, int* yZoom); +IMAQ_FUNC int IMAQ_STDCALL +imaqParticleFilter3(Image* dest, Image* source, + const ParticleFilterCriteria2* criteria, int criteriaCount, + const ParticleFilterOptions* options, const ROI* roi, + int* numParticles); +IMAQ_FUNC ReadTextReport2* IMAQ_STDCALL +imaqReadText2(const Image* image, const CharSet* set, const ROI* roi, + const ReadTextOptions* readOptions, + const OCRProcessingOptions* processingOptions, + const OCRSpacingOptions* spacingOptions); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnPattern2(Image* image, LearningMode learningMode, + LearnPatternAdvancedOptions* advancedOptions); +IMAQ_FUNC int IMAQ_STDCALL +imaqConvolve(Image* dest, Image* source, const float* kernel, int matrixRows, + int matrixCols, float normalize, const Image* mask); +IMAQ_FUNC int IMAQ_STDCALL +imaqDivideConstant(Image* dest, const Image* source, PixelValue value); +IMAQ_FUNC int IMAQ_STDCALL +imaqDivide(Image* dest, const Image* sourceA, const Image* sourceB); +IMAQ_FUNC EdgeReport2* IMAQ_STDCALL +imaqEdgeTool3(const Image* image, const ROI* roi, EdgeProcess processType, + const EdgeOptions2* edgeOptions); +IMAQ_FUNC ConcentricRakeReport* IMAQ_STDCALL +imaqConcentricRake(const Image* image, const ROI* roi, + ConcentricRakeDirection direction, EdgeProcess process, + const RakeOptions* options); +IMAQ_FUNC SpokeReport* IMAQ_STDCALL +imaqSpoke(const Image* image, const ROI* roi, SpokeDirection direction, + EdgeProcess process, const SpokeOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqLearnPattern(Image* image, LearningMode learningMode); +IMAQ_FUNC int IMAQ_STDCALL imaqLookup(Image* dest, const Image* source, + const short* table, const Image* mask); +IMAQ_FUNC PatternMatch* IMAQ_STDCALL +imaqMatchPattern2(const Image* image, const Image* pattern, + const MatchPatternOptions* options, + const MatchPatternAdvancedOptions* advancedOptions, + Rect searchRect, int* numMatches); +IMAQ_FUNC int IMAQ_STDCALL imaqSetParticleClassifierOptions( + ClassifierSession* session, + const ParticleClassifierPreprocessingOptions* preprocessingOptions, + const ParticleClassifierOptions* options); +IMAQ_FUNC int IMAQ_STDCALL +imaqCopyCalibrationInfo(Image* dest, const Image* source); +IMAQ_FUNC int IMAQ_STDCALL +imaqParticleFilter2(Image* dest, Image* source, + const ParticleFilterCriteria2* criteria, int criteriaCount, + int rejectMatches, int connectivity8, int* numParticles); +IMAQ_FUNC EdgeReport* IMAQ_STDCALL +imaqEdgeTool2(const Image* image, const Point* points, int numPoints, + EdgeProcess process, const EdgeOptions* options, int* numEdges); +IMAQ_FUNC ContourID IMAQ_STDCALL +imaqAddRotatedRectContour(ROI* roi, RotatedRect rect); +IMAQ_FUNC Barcode2DInfo* IMAQ_STDCALL +imaqReadDataMatrixBarcode(const Image* image, const ROI* roi, + const DataMatrixOptions* options, + unsigned int* numBarcodes); +IMAQ_FUNC LinearAverages* IMAQ_STDCALL +imaqLinearAverages(const Image* image, Rect rect); +IMAQ_FUNC GeometricPatternMatch* IMAQ_STDCALL imaqMatchGeometricPattern( + const Image* image, const Image* pattern, const CurveOptions* curveOptions, + const MatchGeometricPatternOptions* matchOptions, + const MatchGeometricPatternAdvancedOptions* advancedMatchOptions, + const ROI* roi, int* numMatches); +IMAQ_FUNC CharInfo* IMAQ_STDCALL imaqGetCharInfo(const CharSet* set, int index); +IMAQ_FUNC ReadTextReport* IMAQ_STDCALL +imaqReadText(const Image* image, const CharSet* set, const ROI* roi, + const ReadTextOptions* readOptions, + const OCRProcessingOptions* processingOptions, + const OCRSpacingOptions* spacingOptions); +IMAQ_FUNC ThresholdData* IMAQ_STDCALL +imaqAutoThreshold(Image* dest, Image* source, int numClasses, + ThresholdMethod method); +IMAQ_FUNC ColorHistogramReport* IMAQ_STDCALL +imaqColorHistogram(Image* image, int numClasses, ColorMode mode, + const Image* mask); +IMAQ_FUNC RakeReport* IMAQ_STDCALL +imaqRake(const Image* image, const ROI* roi, RakeDirection direction, + EdgeProcess process, const RakeOptions* options); + +IMAQ_FUNC int IMAQ_STDCALL Priv_ReadJPEGString_C(Image* image, + const unsigned char* string, + unsigned int stringLength); +#endif diff --git a/Robot2016/wpilib/cpp/current/include/nt_Value.h b/Robot2016/wpilib/cpp/current/include/nt_Value.h new file mode 100644 index 0000000..a45e180 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/nt_Value.h @@ -0,0 +1,181 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef NT_VALUE_H_ +#define NT_VALUE_H_ + +#include +#include +#include +#include +#include + +#include "llvm/ArrayRef.h" +#include "llvm/StringRef.h" + +#include "ntcore_c.h" + +namespace nt { + +using llvm::ArrayRef; +using llvm::StringRef; + +/** NetworkTables Entry Value */ +class Value { + struct private_init {}; + + public: + Value(); + Value(NT_Type type, const private_init&); + ~Value(); + + NT_Type type() const { return m_val.type; } + const NT_Value& value() const { return m_val; } + unsigned long long last_change() const { return m_val.last_change; } + + /* + * Type Checkers + */ + bool IsBoolean() const { return m_val.type == NT_BOOLEAN; } + bool IsDouble() const { return m_val.type == NT_DOUBLE; } + bool IsString() const { return m_val.type == NT_STRING; } + bool IsRaw() const { return m_val.type == NT_RAW; } + bool IsRpc() const { return m_val.type == NT_RPC; } + bool IsBooleanArray() const { return m_val.type == NT_BOOLEAN_ARRAY; } + bool IsDoubleArray() const { return m_val.type == NT_DOUBLE_ARRAY; } + bool IsStringArray() const { return m_val.type == NT_STRING_ARRAY; } + + /* + * Type-Safe Getters + */ + bool GetBoolean() const { + assert(m_val.type == NT_BOOLEAN); + return m_val.data.v_boolean != 0; + } + double GetDouble() const { + assert(m_val.type == NT_DOUBLE); + return m_val.data.v_double; + } + StringRef GetString() const { + assert(m_val.type == NT_STRING); + return m_string; + } + StringRef GetRaw() const { + assert(m_val.type == NT_RAW); + return m_string; + } + StringRef GetRpc() const { + assert(m_val.type == NT_RPC); + return m_string; + } + ArrayRef GetBooleanArray() const { + assert(m_val.type == NT_BOOLEAN_ARRAY); + return ArrayRef(m_val.data.arr_boolean.arr, + m_val.data.arr_boolean.size); + } + ArrayRef GetDoubleArray() const { + assert(m_val.type == NT_DOUBLE_ARRAY); + return ArrayRef(m_val.data.arr_double.arr, + m_val.data.arr_double.size); + } + ArrayRef GetStringArray() const { + assert(m_val.type == NT_STRING_ARRAY); + return m_string_array; + } + + static std::shared_ptr MakeBoolean(bool value) { + auto val = std::make_shared(NT_BOOLEAN, private_init()); + val->m_val.data.v_boolean = value; + return val; + } + static std::shared_ptr MakeDouble(double value) { + auto val = std::make_shared(NT_DOUBLE, private_init()); + val->m_val.data.v_double = value; + return val; + } + static std::shared_ptr MakeString(StringRef value) { + auto val = std::make_shared(NT_STRING, private_init()); + val->m_string = value; + val->m_val.data.v_string.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_string.len = val->m_string.size(); + return val; + } +#ifdef _MSC_VER + template >> +#else + template ::value>::type> +#endif + static std::shared_ptr MakeString(T&& value) { + auto val = std::make_shared(NT_STRING, private_init()); + val->m_string = std::move(value); + val->m_val.data.v_string.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_string.len = val->m_string.size(); + return val; + } + static std::shared_ptr MakeRaw(StringRef value) { + auto val = std::make_shared(NT_RAW, private_init()); + val->m_string = value; + val->m_val.data.v_raw.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_raw.len = val->m_string.size(); + return val; + } +#ifdef _MSC_VER + template >> +#else + template ::value>::type> +#endif + static std::shared_ptr MakeRaw(T&& value) { + auto val = std::make_shared(NT_RAW, private_init()); + val->m_string = std::move(value); + val->m_val.data.v_raw.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_raw.len = val->m_string.size(); + return val; + } + static std::shared_ptr MakeRpc(StringRef value) { + auto val = std::make_shared(NT_RPC, private_init()); + val->m_string = value; + val->m_val.data.v_raw.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_raw.len = val->m_string.size(); + return val; + } + template + static std::shared_ptr MakeRpc(T&& value) { + auto val = std::make_shared(NT_RPC, private_init()); + val->m_string = std::move(value); + val->m_val.data.v_raw.str = const_cast(val->m_string.c_str()); + val->m_val.data.v_raw.len = val->m_string.size(); + return val; + } + + static std::shared_ptr MakeBooleanArray(ArrayRef value); + static std::shared_ptr MakeDoubleArray(ArrayRef value); + static std::shared_ptr MakeStringArray(ArrayRef value); + + // Note: This function moves the values out of the vector. + static std::shared_ptr MakeStringArray( + std::vector&& value); + + Value(const Value&) = delete; + Value& operator=(const Value&) = delete; + friend bool operator==(const Value& lhs, const Value& rhs); + + private: + NT_Value m_val; + std::string m_string; + std::vector m_string_array; +}; + +bool operator==(const Value& lhs, const Value& rhs); +inline bool operator!=(const Value& lhs, const Value& rhs) { + return !(lhs == rhs); +} + +} // namespace nt + +#endif // NT_VALUE_H_ diff --git a/Robot2016/wpilib/cpp/current/include/ntcore.h b/Robot2016/wpilib/cpp/current/include/ntcore.h new file mode 100644 index 0000000..b4f668b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ntcore.h @@ -0,0 +1,19 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef NTCORE_H_ +#define NTCORE_H_ + +/* C API */ +#include "ntcore_c.h" + +#ifdef __cplusplus +/* C++ API */ +#include "ntcore_cpp.h" +#endif /* __cplusplus */ + +#endif /* NTCORE_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/ntcore_c.h b/Robot2016/wpilib/cpp/current/include/ntcore_c.h new file mode 100644 index 0000000..52b06c0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ntcore_c.h @@ -0,0 +1,894 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef NTCORE_C_H_ +#define NTCORE_C_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Default network tables port number */ +#define NT_DEFAULT_PORT 1735 + +/** NetworkTables data types. */ +enum NT_Type { + NT_UNASSIGNED = 0, + NT_BOOLEAN = 0x01, + NT_DOUBLE = 0x02, + NT_STRING = 0x04, + NT_RAW = 0x08, + NT_BOOLEAN_ARRAY = 0x10, + NT_DOUBLE_ARRAY = 0x20, + NT_STRING_ARRAY = 0x40, + NT_RPC = 0x80 +}; + +/** NetworkTables entry flags. */ +enum NT_EntryFlags { + NT_PERSISTENT = 0x01 +}; + +/** NetworkTables logging levels. */ +enum NT_LogLevel { + NT_LOG_CRITICAL = 50, + NT_LOG_ERROR = 40, + NT_LOG_WARNING = 30, + NT_LOG_INFO = 20, + NT_LOG_DEBUG = 10, + NT_LOG_DEBUG1 = 9, + NT_LOG_DEBUG2 = 8, + NT_LOG_DEBUG3 = 7, + NT_LOG_DEBUG4 = 6 +}; + +/** NetworkTables notififier kinds. */ +enum NT_NotifyKind { + NT_NOTIFY_NONE = 0, + NT_NOTIFY_IMMEDIATE = 0x01, /* initial listener addition */ + NT_NOTIFY_LOCAL = 0x02, /* changed locally */ + NT_NOTIFY_NEW = 0x04, /* newly created entry */ + NT_NOTIFY_DELETE = 0x08, /* deleted */ + NT_NOTIFY_UPDATE = 0x10, /* value changed */ + NT_NOTIFY_FLAGS = 0x20 /* flags changed */ +}; + +/* + * Structures + */ + +/** A NetworkTables string. */ +struct NT_String { + /** String contents (UTF-8). + * The string is NOT required to be zero-terminated. + * When returned by the library, this is zero-terminated and allocated with + * malloc(). + */ + char *str; + + /** Length of the string in bytes. If the string happens to be zero + * terminated, this does not include the zero-termination. + */ + size_t len; +}; + +/** NetworkTables Entry Value. Note this is a typed union. */ +struct NT_Value { + enum NT_Type type; + unsigned long long last_change; + union { + int v_boolean; + double v_double; + struct NT_String v_string; + struct NT_String v_raw; + struct { + int *arr; + size_t size; + } arr_boolean; + struct { + double *arr; + size_t size; + } arr_double; + struct { + struct NT_String *arr; + size_t size; + } arr_string; + } data; +}; + +/** NetworkTables Entry Information */ +struct NT_EntryInfo { + /** Entry name */ + struct NT_String name; + + /** Entry type */ + enum NT_Type type; + + /** Entry flags */ + unsigned int flags; + + /** Timestamp of last change to entry (type or value). */ + unsigned long long last_change; +}; + +/** NetworkTables Connection Information */ +struct NT_ConnectionInfo { + struct NT_String remote_id; + char *remote_name; + unsigned int remote_port; + unsigned long long last_update; + unsigned int protocol_version; +}; + +/** NetworkTables RPC Parameter Definition */ +struct NT_RpcParamDef { + struct NT_String name; + struct NT_Value def_value; +}; + +/** NetworkTables RPC Result Definition */ +struct NT_RpcResultDef { + struct NT_String name; + enum NT_Type type; +}; + +/** NetworkTables RPC Definition */ +struct NT_RpcDefinition { + unsigned int version; + struct NT_String name; + size_t num_params; + NT_RpcParamDef *params; + size_t num_results; + NT_RpcResultDef *results; +}; + +/** NetworkTables RPC Call Data */ +struct NT_RpcCallInfo { + unsigned int rpc_id; + unsigned int call_uid; + struct NT_String name; + struct NT_String params; +}; + +/* + * Table Functions + */ + +/** Get Entry Value. + * Returns copy of current entry value. + * Note that one of the type options is "unassigned". + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param value storage for returned entry value + * + * It is the caller's responsibility to free value once it's no longer + * needed (the utility function NT_DisposeValue() is useful for this + * purpose). + */ +void NT_GetEntryValue(const char *name, size_t name_len, + struct NT_Value *value); + +/** Set Entry Value. + * Sets new entry value. If type of new value differs from the type of the + * currently stored entry, returns error and does not update value. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param value new entry value + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryValue(const char *name, size_t name_len, + const struct NT_Value *value); + +/** Set Entry Type and Value. + * Sets new entry value. If type of new value differs from the type of the + * currently stored entry, the currently stored entry type is overridden + * (generally this will generate an Entry Assignment message). + * + * This is NOT the preferred method to update a value; generally + * NT_SetEntryValue() should be used instead, with appropriate error handling. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param value new entry value + */ +void NT_SetEntryTypeValue(const char *name, size_t name_len, + const struct NT_Value *value); + +/** Set Entry Flags. + */ +void NT_SetEntryFlags(const char *name, size_t name_len, unsigned int flags); + +/** Get Entry Flags. + */ +unsigned int NT_GetEntryFlags(const char *name, size_t name_len); + +/** Delete Entry. + * Deletes an entry. This is a new feature in version 3.0 of the protocol, + * so this may not have an effect if any other node in the network is not + * version 3.0 or newer. + * + * Note: NT_GetConnections() can be used to determine the protocol version + * of direct remote connection(s), but this is not sufficient to determine + * if all nodes in the network are version 3.0 or newer. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + */ +void NT_DeleteEntry(const char *name, size_t name_len); + +/** Delete All Entries. + * Deletes ALL table entries. This is a new feature in version 3.0 of the + * so this may not have an effect if any other node in the network is not + * version 3.0 or newer. + * + * Note: NT_GetConnections() can be used to determine the protocol version + * of direct remote connection(s), but this is not sufficient to determine + * if all nodes in the network are version 3.0 or newer. + */ +void NT_DeleteAllEntries(void); + +/** Get Entry Information. + * Returns an array of entry information (name, entry type, + * and timestamp of last change to type/value). The results are optionally + * filtered by string prefix and entry type to only return a subset of all + * entries. + * + * @param prefix entry name required prefix; only entries whose name + * starts with this string are returned + * @param prefix_len length of prefix in bytes + * @param types bitmask of NT_Type values; 0 is treated specially + * as a "don't care" + * @param count output parameter; set to length of returned array + * @return Array of entry information. + */ +struct NT_EntryInfo *NT_GetEntryInfo(const char *prefix, size_t prefix_len, + unsigned int types, size_t *count); + +/** Flush Entries. + * Forces an immediate flush of all local entry changes to network. + * Normally this is done on a regularly scheduled interval (see + * NT_SetUpdateRate()). + * + * Note: flushes are rate limited to avoid excessive network traffic. If + * the time between calls is too short, the flush will occur after the minimum + * time elapses (rather than immediately). + */ +void NT_Flush(void); + +/* + * Callback Creation Functions + */ + +void NT_SetListenerOnStart(void (*on_start)(void *data), void *data); +void NT_SetListenerOnExit(void (*on_exit)(void *data), void *data); + +typedef void (*NT_EntryListenerCallback)( + unsigned int uid, void *data, const char *name, size_t name_len, + const struct NT_Value *value, unsigned int flags); + +typedef void (*NT_ConnectionListenerCallback)( + unsigned int uid, void *data, int connected, + const struct NT_ConnectionInfo *conn); + +unsigned int NT_AddEntryListener(const char *prefix, size_t prefix_len, + void *data, NT_EntryListenerCallback callback, + unsigned int flags); +void NT_RemoveEntryListener(unsigned int entry_listener_uid); +unsigned int NT_AddConnectionListener(void *data, + NT_ConnectionListenerCallback callback, + int immediate_notify); +void NT_RemoveConnectionListener(unsigned int conn_listener_uid); + +int NT_NotifierDestroyed(); + +/* + * Remote Procedure Call Functions + */ + +void NT_SetRpcServerOnStart(void (*on_start)(void *data), void *data); +void NT_SetRpcServerOnExit(void (*on_exit)(void *data), void *data); + +typedef char *(*NT_RpcCallback)(void *data, const char *name, size_t name_len, + const char *params, size_t params_len, + size_t *results_len); + +void NT_CreateRpc(const char *name, size_t name_len, const char *def, + size_t def_len, void *data, NT_RpcCallback callback); +void NT_CreatePolledRpc(const char *name, size_t name_len, const char *def, + size_t def_len); + +int NT_PollRpc(int blocking, struct NT_RpcCallInfo* call_info); +void NT_PostRpcResponse(unsigned int rpc_id, unsigned int call_uid, + const char *result, size_t result_len); + +unsigned int NT_CallRpc(const char *name, size_t name_len, const char *params, + size_t params_len); +char *NT_GetRpcResult(int blocking, unsigned int call_uid, size_t *result_len); + +char *NT_PackRpcDefinition(const struct NT_RpcDefinition *def, + size_t *packed_len); +int NT_UnpackRpcDefinition(const char *packed, size_t packed_len, + struct NT_RpcDefinition *def); +char *NT_PackRpcValues(const struct NT_Value **values, size_t values_len, + size_t *packed_len); +struct NT_Value **NT_UnpackRpcValues(const char *packed, size_t packed_len, + const NT_Type *types, size_t types_len); + +/* + * Client/Server Functions + */ +void NT_SetNetworkIdentity(const char *name, size_t name_len); + +/** Start Server + * Starts a server using the specified filename, listening address, and port. + * + * @param persist_filename the name of the persist file to use (UTF-8 string, + * null terminated) + * @param listen_address the address to listen on, or null to listen on any + * address. (UTF-8 string, null terminated) + * @param port port to communicate over. + */ +void NT_StartServer(const char *persist_filename, const char *listen_address, + unsigned int port); + +/** Stop Server + * Stops the server if it is running. + */ +void NT_StopServer(void); + +/** Starts Client + * Starts a client using the specified server and port + * + * @param server_name server name (UTF-8 string, null terminated) + * @param port port to communicate over + * + */ +void NT_StartClient(const char *server_name, unsigned int port); + +/** Stop Client + * Stops the client if it is running. + */ +void NT_StopClient(void); + +/** Stop Rpc Server + * Stops the Rpc server if it is running. + */ +void NT_StopRpcServer(void); + +/** Stop Notifier + * Stops the Notifier (Entry and Connection Listener) thread if it is running. + */ +void NT_StopNotifier(void); + +/** Set Update Rate + * Sets the update rate of the table + * + * @param interval the interval to update the table at (in seconds) + * + */ +void NT_SetUpdateRate(double interval); + +/** Get Connections + * Gets an array of all the connections in the table. + * + * @param count returns the number of elements in the array + * @return an array containing all the connections. + * + * It is the caller's responsibility to free the array. The + * NT_DisposeConnectionInfoArray function is useful for this purpose. + */ +struct NT_ConnectionInfo *NT_GetConnections(size_t *count); + +/* + * Persistent Functions + */ +/* return error string, or NULL if successful */ +const char *NT_SavePersistent(const char *filename); +const char *NT_LoadPersistent(const char *filename, + void (*warn)(size_t line, const char *msg)); + +/* + * Utility Functions + */ + +/* frees value memory */ +void NT_DisposeValue(struct NT_Value *value); + +/* sets type to unassigned and clears rest of struct */ +void NT_InitValue(struct NT_Value *value); + +/* frees string memory */ +void NT_DisposeString(struct NT_String *str); + +/* sets length to zero and pointer to null */ +void NT_InitString(struct NT_String *str); + +/* Gets the type for the specified key, or unassigned if non existent. */ +enum NT_Type NT_GetType(const char *name, size_t name_len); + +/** Dispose Connection Info Array + * Disposes a connection info array + * + * @param arr pointer to the array to dispose + * @param count number of elements in the array + * + */ +void NT_DisposeConnectionInfoArray(struct NT_ConnectionInfo *arr, size_t count); + +/** Dispose Entry Info Array + * Disposes an entry info array + * + * @param arr pointer to the array to dispose + * @param count number of elements in the array + * + */ +void NT_DisposeEntryInfoArray(struct NT_EntryInfo *arr, size_t count); + +/** Dispose Rpc Definition + * Disposes a Rpc Definition structure + * + * @param def pointer to the struct to dispose + * + */ +void NT_DisposeRpcDefinition(struct NT_RpcDefinition *def); + +/** Dispose Rpc Call Info + * Disposes a Rpc Call Info structure + * + * @param def pointer to the struct to dispose + * + */ +void NT_DisposeRpcCallInfo(struct NT_RpcCallInfo *call_info); + +/* timestamp */ +unsigned long long NT_Now(void); + +/* logging */ +typedef void (*NT_LogFunc)(unsigned int level, const char *file, + unsigned int line, const char *msg); +void NT_SetLogger(NT_LogFunc func, unsigned int min_level); + +/* + * Interop Utility Functions + */ + +/* Memory Allocators */ + +/** Allocate Character Array + * Allocates an array of chars. + * Note that the size is the number of elements, and not the + * specific number of bytes to allocate. That is calculated internally. + * + * @param size the number of elements the array will contain + * @return the allocated char array + * + * After use, the array should be freed using the NT_FreeCharArray() + * function. + */ +char *NT_AllocateCharArray(size_t size); + +/** Allocate Boolean Array + * Allocates an array of booleans. + * Note that the size is the number of elements, and not the + * specific number of bytes to allocate. That is calculated internally. + * + * @param size the number of elements the array will contain + * @return the allocated boolean array + * + * After use, the array should be freed using the NT_FreeBooleanArray() + * function. + */ +int *NT_AllocateBooleanArray(size_t size); + +/** Allocate Double Array + * Allocates an array of doubles. + * Note that the size is the number of elements, and not the + * specific number of bytes to allocate. That is calculated internally. + * + * @param size the number of elements the array will contain + * @return the allocated double array + * + * After use, the array should be freed using the NT_FreeDoubleArray() + * function. + */ +double *NT_AllocateDoubleArray(size_t size); + +/** Allocate NT_String Array + * Allocates an array of NT_Strings. + * Note that the size is the number of elements, and not the + * specific number of bytes to allocate. That is calculated internally. + * + * @param size the number of elements the array will contain + * @return the allocated NT_String array + * + * After use, the array should be freed using the NT_FreeStringArray() + * function. + */ +struct NT_String *NT_AllocateStringArray(size_t size); + +/** Free Char Array + * Frees an array of chars. + * + * @param v_boolean pointer to the char array to free + */ +void NT_FreeCharArray(char *v_char); + +/** Free Double Array + * Frees an array of doubles. + * + * @param v_boolean pointer to the double array to free + */ +void NT_FreeDoubleArray(double *v_double); + +/** Free Boolean Array + * Frees an array of booleans. + * + * @param v_boolean pointer to the boolean array to free + */ +void NT_FreeBooleanArray(int *v_boolean); + +/** Free String Array + * Frees an array of NT_Strings. + * + * @param v_string pointer to the string array to free + * @param arr_size size of the string array to free + * + * Note that the individual NT_Strings in the array should NOT be + * freed before calling this. This function will free all the strings + * individually. + */ +void NT_FreeStringArray(struct NT_String *v_string, size_t arr_size); + +/** Get Value Type + * Returns the type of an NT_Value struct. + * Note that one of the type options is "unassigned". + * + * @param value The NT_Value struct to get the type from. + * @return The type of the value, or unassigned if null. + */ +enum NT_Type NT_GetValueType(const struct NT_Value *value); + +/** Get Value Boolean + * Returns the boolean from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns 0. + * + * @param value NT_Value struct to get the boolean from + * @param last_change returns time in ms since the last change in the value + * @param v_boolean returns the boolean assigned to the name + * @return 1 if successful, or 0 if value is null or not a boolean + */ +int NT_GetValueBoolean(const struct NT_Value *value, + unsigned long long *last_change, int *v_boolean); + +/** Get Value Double + * Returns the double from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns 0. + * + * @param value NT_Value struct to get the double from + * @param last_change returns time in ms since the last change in the value + * @param v_double returns the boolean assigned to the name + * @return 1 if successful, or 0 if value is null or not a double + */ +int NT_GetValueDouble(const struct NT_Value *value, + unsigned long long *last_change, double *v_double); + +/** Get Value String + * Returns a copy of the string from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns 0. + * + * @param value NT_Value struct to get the string from + * @param last_change returns time in ms since the last change in the value + * @param str_len returns the length of the string + * @return pointer to the string (UTF-8), or null if error + * + * It is the caller's responsibility to free the string once its no longer + * needed. The NT_FreeCharArray() function is useful for this purpose. The + * returned string is a copy of the string in the value, and must be freed + * separately. + */ +char *NT_GetValueString(const struct NT_Value *value, + unsigned long long *last_change, size_t *str_len); + +/** Get Value Raw + * Returns a copy of the raw value from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns null. + * + * @param value NT_Value struct to get the string from + * @param last_change returns time in ms since the last change in the value + * @param raw_len returns the length of the string + * @return pointer to the raw value (UTF-8), or null if error + * + * It is the caller's responsibility to free the raw value once its no longer + * needed. The NT_FreeCharArray() function is useful for this purpose. The + * returned string is a copy of the string in the value, and must be freed + * separately. + */ +char *NT_GetValueRaw(const struct NT_Value *value, + unsigned long long *last_change, size_t *raw_len); + +/** Get Value Boolean Array + * Returns a copy of the boolean array from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns null. + * + * @param value NT_Value struct to get the boolean array from + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the boolean array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeBooleanArray() function is useful for this purpose. + * The returned array is a copy of the array in the value, and must be + * freed separately. + */ +int *NT_GetValueBooleanArray(const struct NT_Value *value, + unsigned long long *last_change, size_t *arr_size); + +/** Get Value Double Array + * Returns a copy of the double array from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns null. + * + * @param value NT_Value struct to get the double array from + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the double array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeDoubleArray() function is useful for this purpose. + * The returned array is a copy of the array in the value, and must be + * freed separately. + */ +double *NT_GetValueDoubleArray(const struct NT_Value *value, + unsigned long long *last_change, + size_t *arr_size); + +/** Get Value String Array + * Returns a copy of the NT_String array from the NT_Value. + * If the NT_Value is null, or is assigned to a different type, returns null. + * + * @param value NT_Value struct to get the NT_String array from + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the NT_String array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeStringArray() function is useful for this purpose. + * The returned array is a copy of the array in the value, and must be + * freed seperately. Note that the individual NT_Strings should not be freed, + * but the entire array should be freed at once. The NT_FreeStringArray() + * function will free all the NT_Strings. + */ +NT_String *NT_GetValueStringArray(const struct NT_Value *value, + unsigned long long *last_change, + size_t *arr_size); + +/** Get Entry Boolean + * Returns the boolean currently assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns 0. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param v_boolean returns the boolean assigned to the name + * @return 1 if successful, or 0 if value is unassigned or not a + * boolean + */ +int NT_GetEntryBoolean(const char *name, size_t name_len, + unsigned long long *last_change, int *v_boolean); + +/** Get Entry Double + * Returns the double currently assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns 0. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param v_double returns the double assigned to the name + * @return 1 if successful, or 0 if value is unassigned or not a + * double + */ +int NT_GetEntryDouble(const char *name, size_t name_len, + unsigned long long *last_change, double *v_double); + +/** Get Entry String + * Returns a copy of the string assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns null. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param str_len returns the length of the string + * @return pointer to the string (UTF-8), or null if error + * + * It is the caller's responsibility to free the string once its no longer + * needed. The NT_FreeCharArray() function is useful for this purpose. + */ +char *NT_GetEntryString(const char *name, size_t name_len, + unsigned long long *last_change, size_t *str_len); + +/** Get Entry Raw + * Returns a copy of the raw value assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns null. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param raw_len returns the length of the string + * @return pointer to the raw value (UTF-8), or null if error + * + * It is the caller's responsibility to free the raw value once its no longer + * needed. The NT_FreeCharArray() function is useful for this purpose. + */ +char *NT_GetEntryRaw(const char *name, size_t name_len, + unsigned long long *last_change, size_t *raw_len); + +/** Get Entry Boolean Array + * Returns a copy of the boolean array assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns null. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the boolean array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeBooleanArray() function is useful for this purpose. + */ +int *NT_GetEntryBooleanArray(const char *name, size_t name_len, + unsigned long long *last_change, size_t *arr_size); + +/** Get Entry Double Array + * Returns a copy of the double array assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns null. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the double array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeDoubleArray() function is useful for this purpose. + */ +double *NT_GetEntryDoubleArray(const char *name, size_t name_len, + unsigned long long *last_change, + size_t *arr_size); + +/** Get Entry String Array + * Returns a copy of the NT_String array assigned to the entry name. + * If the entry name is not currently assigned, or is assigned to a + * different type, returns null. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param last_change returns time in ms since the last change in the value + * @param arr_size returns the number of elements in the array + * @return pointer to the NT_String array, or null if error + * + * It is the caller's responsibility to free the array once its no longer + * needed. The NT_FreeStringArray() function is useful for this purpose. Note + * that the individual NT_Strings should not be freed, but the entire array + * should be freed at once. The NT_FreeStringArray() function will free all the + * NT_Strings. + */ +NT_String *NT_GetEntryStringArray(const char *name, size_t name_len, + unsigned long long *last_change, + size_t *arr_size); + +/* Entry Value Setters */ + +/** Set Entry Boolean + * Sets an entry boolean. If the entry name is not currently assigned to a + * boolean, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param v_boolean boolean value to set + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryBoolean(const char *name, size_t name_len, int v_boolean, + int force); + +/** Set Entry Double + * Sets an entry double. If the entry name is not currently assigned to a + * double, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param v_double double value to set + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryDouble(const char *name, size_t name_len, double v_double, + int force); + +/** Set Entry String + * Sets an entry string. If the entry name is not currently assigned to a + * string, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param str string to set (UTF-8 string) + * @param str_len length of string to write in bytes + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryString(const char *name, size_t name_len, const char *str, + size_t str_len, int force); + +/** Set Entry Raw + * Sets the raw value of an entry. If the entry name is not currently assigned + * to a raw value, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param raw raw string to set (UTF-8 string) + * @param raw_len length of raw string to write in bytes + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryRaw(const char *name, size_t name_len, const char *raw, + size_t raw_len, int force); + +/** Set Entry Boolean Array + * Sets an entry boolean array. If the entry name is not currently assigned to + * a boolean array, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param arr boolean array to write + * @param size number of elements in the array + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryBooleanArray(const char *name, size_t name_len, const int *arr, + size_t size, int force); + +/** Set Entry Double Array + * Sets an entry double array. If the entry name is not currently assigned to + * a double array, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param arr double array to write + * @param size number of elements in the array + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryDoubleArray(const char *name, size_t name_len, const double *arr, + size_t size, int force); + +/** Set Entry String Array + * Sets an entry string array. If the entry name is not currently assigned to + * a string array, returns error unless the force parameter is set. + * + * @param name entry name (UTF-8 string) + * @param name_len length of name in bytes + * @param arr NT_String array to write + * @param size number of elements in the array + * @param force 1 to force the entry to get overwritten, otherwise 0 + * @return 0 on error (type mismatch), 1 on success + */ +int NT_SetEntryStringArray(const char *name, size_t name_len, + const struct NT_String *arr, size_t size, int force); + +#ifdef __cplusplus +} +#endif + +#endif /* NTCORE_C_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/ntcore_cpp.h b/Robot2016/wpilib/cpp/current/include/ntcore_cpp.h new file mode 100644 index 0000000..5fdff76 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/ntcore_cpp.h @@ -0,0 +1,265 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef NTCORE_CPP_H_ +#define NTCORE_CPP_H_ + +#include +#include +#include +#include +#include + +#include "llvm/ArrayRef.h" +#include "llvm/StringRef.h" + +#include "nt_Value.h" + +namespace nt { + +using llvm::ArrayRef; +using llvm::StringRef; + +/** NetworkTables Entry Information */ +struct EntryInfo { + /** Entry name */ + std::string name; + + /** Entry type */ + NT_Type type; + + /** Entry flags */ + unsigned int flags; + + /** Timestamp of last change to entry (type or value). */ + unsigned long long last_change; +}; + +/** NetworkTables Connection Information */ +struct ConnectionInfo { + std::string remote_id; + std::string remote_name; + unsigned int remote_port; + unsigned long long last_update; + unsigned int protocol_version; +}; + +/** NetworkTables RPC Parameter Definition */ +struct RpcParamDef { + RpcParamDef() = default; + RpcParamDef(StringRef name_, std::shared_ptr def_value_) + : name(name_), def_value(def_value_) {} + + std::string name; + std::shared_ptr def_value; +}; + +/** NetworkTables RPC Result Definition */ +struct RpcResultDef { + RpcResultDef() = default; + RpcResultDef(StringRef name_, NT_Type type_) : name(name_), type(type_) {} + + std::string name; + NT_Type type; +}; + +/** NetworkTables RPC Definition */ +struct RpcDefinition { + unsigned int version; + std::string name; + std::vector params; + std::vector results; +}; + +/** NetworkTables RPC Call Data */ +struct RpcCallInfo { + unsigned int rpc_id; + unsigned int call_uid; + std::string name; + std::string params; +}; + +/* + * Table Functions + */ + +/** Get Entry Value. + * Returns copy of current entry value. + * Note that one of the type options is "unassigned". + * + * @param name entry name (UTF-8 string) + * @return entry value + */ +std::shared_ptr GetEntryValue(StringRef name); + +/** Set Entry Value. + * Sets new entry value. If type of new value differs from the type of the + * currently stored entry, returns error and does not update value. + * + * @param name entry name (UTF-8 string) + * @param value new entry value + * @return False on error (type mismatch), True on success + */ +bool SetEntryValue(StringRef name, std::shared_ptr value); + +/** Set Entry Type and Value. + * Sets new entry value. If type of new value differs from the type of the + * currently stored entry, the currently stored entry type is overridden + * (generally this will generate an Entry Assignment message). + * + * This is NOT the preferred method to update a value; generally + * SetEntryValue() should be used instead, with appropriate error handling. + * + * @param name entry name (UTF-8 string) + * @param value new entry value + */ +void SetEntryTypeValue(StringRef name, std::shared_ptr value); + +/** Set Entry Flags. + */ +void SetEntryFlags(StringRef name, unsigned int flags); + +/** Get Entry Flags. + */ +unsigned int GetEntryFlags(StringRef name); + +/** Delete Entry. + * Deletes an entry. This is a new feature in version 3.0 of the protocol, + * so this may not have an effect if any other node in the network is not + * version 3.0 or newer. + * + * Note: GetConnections() can be used to determine the protocol version + * of direct remote connection(s), but this is not sufficient to determine + * if all nodes in the network are version 3.0 or newer. + * + * @param name entry name (UTF-8 string) + */ +void DeleteEntry(StringRef name); + +/** Delete All Entries. + * Deletes ALL table entries. This is a new feature in version 3.0 of the + * so this may not have an effect if any other node in the network is not + * version 3.0 or newer. + * + * Note: GetConnections() can be used to determine the protocol version + * of direct remote connection(s), but this is not sufficient to determine + * if all nodes in the network are version 3.0 or newer. + */ +void DeleteAllEntries(); + +/** Get Entry Information. + * Returns an array of entry information (name, entry type, + * and timestamp of last change to type/value). The results are optionally + * filtered by string prefix and entry type to only return a subset of all + * entries. + * + * @param prefix entry name required prefix; only entries whose name + * starts with this string are returned + * @param types bitmask of NT_Type values; 0 is treated specially + * as a "don't care" + * @return Array of entry information. + */ +std::vector GetEntryInfo(StringRef prefix, unsigned int types); + +/** Flush Entries. + * Forces an immediate flush of all local entry changes to network. + * Normally this is done on a regularly scheduled interval (see + * NT_SetUpdateRate()). + * + * Note: flushes are rate limited to avoid excessive network traffic. If + * the time between calls is too short, the flush will occur after the minimum + * time elapses (rather than immediately). + */ +void Flush(); + +/* + * Callback Creation Functions + */ + +void SetListenerOnStart(std::function on_start); +void SetListenerOnExit(std::function on_exit); + +typedef std::function value, + unsigned int flags)> EntryListenerCallback; + +typedef std::function + ConnectionListenerCallback; + +unsigned int AddEntryListener(StringRef prefix, EntryListenerCallback callback, + unsigned int flags); +void RemoveEntryListener(unsigned int entry_listener_uid); +unsigned int AddConnectionListener(ConnectionListenerCallback callback, + bool immediate_notify); +void RemoveConnectionListener(unsigned int conn_listener_uid); + +bool NotifierDestroyed(); + +/* + * Remote Procedure Call Functions + */ + +void SetRpcServerOnStart(std::function on_start); +void SetRpcServerOnExit(std::function on_exit); + +typedef std::function + RpcCallback; + +void CreateRpc(StringRef name, StringRef def, RpcCallback callback); +void CreatePolledRpc(StringRef name, StringRef def); + +bool PollRpc(bool blocking, RpcCallInfo* call_info); +void PostRpcResponse(unsigned int rpc_id, unsigned int call_uid, + StringRef result); + +unsigned int CallRpc(StringRef name, StringRef params); +bool GetRpcResult(bool blocking, unsigned int call_uid, std::string* result); + +std::string PackRpcDefinition(const RpcDefinition& def); +bool UnpackRpcDefinition(StringRef packed, RpcDefinition *def); +std::string PackRpcValues(ArrayRef> values); +std::vector> UnpackRpcValues(StringRef packed, + ArrayRef types); + +/* + * Client/Server Functions + */ +void SetNetworkIdentity(StringRef name); +void StartServer(StringRef persist_filename, const char* listen_address, + unsigned int port); +void StopServer(); +void StartClient(const char* server_name, unsigned int port); +void StopClient(); +void StopRpcServer(); +void StopNotifier(); +void SetUpdateRate(double interval); +std::vector GetConnections(); + +/* + * Persistent Functions + */ +/* return error string, or nullptr if successful */ +const char* SavePersistent(StringRef filename); +const char* LoadPersistent( + StringRef filename, std::function warn); + +/* + * Utility Functions + */ + +/* timestamp */ +unsigned long long Now(); + +/* logging */ +typedef std::function LogFunc; +void SetLogger(LogFunc func, unsigned int min_level); + +} // namespace nt + +#endif /* NTCORE_CPP_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/pcre.h b/Robot2016/wpilib/cpp/current/include/pcre.h new file mode 100644 index 0000000..0605461 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/pcre.h @@ -0,0 +1,345 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* This is the public header file for the PCRE library, to be #included by +applications that call the PCRE functions. + + Copyright (c) 1997-2008 University of Cambridge + +----------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +----------------------------------------------------------------------------- +*/ + +#ifndef _PCRE_H +#define _PCRE_H + +/* The current PCRE version information. */ + +#define PCRE_MAJOR 7 +#define PCRE_MINOR 8 +#define PCRE_PRERELEASE +#define PCRE_DATE 2008 - 09 - 05 + +/* When an application links to a PCRE DLL in Windows, the symbols that are +imported have to be identified as such. When building PCRE, the appropriate +export setting is defined in pcre_internal.h, which includes this file. So we +don't change existing definitions of PCRE_EXP_DECL and PCRECPP_EXP_DECL. */ + +/** + * NI CHANGE + * + * We don't build the DLL version. We only build the static lib version. + * Since we don't want to have to #define PCRE_STATIC in every component that + * includes pcre.h, we're just going to go ahead and define it here. + * + * Adam Kemp, 12/15/2008 +*/ +#define PCRE_STATIC + +#if defined(_WIN32) && !defined(PCRE_STATIC) +#ifndef PCRE_EXP_DECL +#define PCRE_EXP_DECL extern __declspec(dllimport) +#endif +#ifdef __cplusplus +#ifndef PCRECPP_EXP_DECL +#define PCRECPP_EXP_DECL extern __declspec(dllimport) +#endif +#ifndef PCRECPP_EXP_DEFN +#define PCRECPP_EXP_DEFN __declspec(dllimport) +#endif +#endif +#endif + +/* By default, we use the standard "extern" declarations. */ + +#ifndef PCRE_EXP_DECL +#ifdef __cplusplus +#define PCRE_EXP_DECL extern "C" +#else +#define PCRE_EXP_DECL extern +#endif +#endif + +#ifdef __cplusplus +#ifndef PCRECPP_EXP_DECL +#define PCRECPP_EXP_DECL extern +#endif +#ifndef PCRECPP_EXP_DEFN +#define PCRECPP_EXP_DEFN +#endif +#endif + +/** + * NI CHANGE + * + * We use __cdecl on win32 and the default calling convention elsewhere. + * + * Originall this macro did not appear in this file, but it was used in + * internal headers. I consider it an oversight on the part of the pcre + * developers that * it was not used in this file. If these functions use + * specific calling conventions then their prototypes should include that + * calling convention in case some other project uses a different default. + * + * Adam Kemp 12/15/2008 +*/ +#ifndef PCRE_CALL_CONVENTION +#if defined(_WIN32) /* 32-bit and 64-bit */ +#define PCRE_CALL_CONVENTION __cdecl +#else +#define PCRE_CALL_CONVENTION +#endif +#else +#define PCRE_CALL_CONVENTION +#endif + +/* Have to include stdlib.h in order to ensure that size_t is defined; +it is needed here for malloc. */ + +#include + +/* Allow for C++ users */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Options */ + +#define PCRE_CASELESS 0x00000001 +#define PCRE_MULTILINE 0x00000002 +#define PCRE_DOTALL 0x00000004 +#define PCRE_EXTENDED 0x00000008 +#define PCRE_ANCHORED 0x00000010 +#define PCRE_DOLLAR_ENDONLY 0x00000020 +#define PCRE_EXTRA 0x00000040 +#define PCRE_NOTBOL 0x00000080 +#define PCRE_NOTEOL 0x00000100 +#define PCRE_UNGREEDY 0x00000200 +#define PCRE_NOTEMPTY 0x00000400 +#define PCRE_UTF8 0x00000800 +#define PCRE_NO_AUTO_CAPTURE 0x00001000 +#define PCRE_NO_UTF8_CHECK 0x00002000 +#define PCRE_AUTO_CALLOUT 0x00004000 +#define PCRE_PARTIAL 0x00008000 +#define PCRE_DFA_SHORTEST 0x00010000 +#define PCRE_DFA_RESTART 0x00020000 +#define PCRE_FIRSTLINE 0x00040000 +#define PCRE_DUPNAMES 0x00080000 +#define PCRE_NEWLINE_CR 0x00100000 +#define PCRE_NEWLINE_LF 0x00200000 +#define PCRE_NEWLINE_CRLF 0x00300000 +#define PCRE_NEWLINE_ANY 0x00400000 +#define PCRE_NEWLINE_ANYCRLF 0x00500000 +#define PCRE_BSR_ANYCRLF 0x00800000 +#define PCRE_BSR_UNICODE 0x01000000 +#define PCRE_JAVASCRIPT_COMPAT 0x02000000 + +/* Exec-time and get/set-time error codes */ + +#define PCRE_ERROR_NOMATCH (-1) +#define PCRE_ERROR_NULL (-2) +#define PCRE_ERROR_BADOPTION (-3) +#define PCRE_ERROR_BADMAGIC (-4) +#define PCRE_ERROR_UNKNOWN_OPCODE (-5) +#define PCRE_ERROR_UNKNOWN_NODE (-5) /* For backward compatibility */ +#define PCRE_ERROR_NOMEMORY (-6) +#define PCRE_ERROR_NOSUBSTRING (-7) +#define PCRE_ERROR_MATCHLIMIT (-8) +#define PCRE_ERROR_CALLOUT (-9) /* Never used by PCRE itself */ +#define PCRE_ERROR_BADUTF8 (-10) +#define PCRE_ERROR_BADUTF8_OFFSET (-11) +#define PCRE_ERROR_PARTIAL (-12) +#define PCRE_ERROR_BADPARTIAL (-13) +#define PCRE_ERROR_INTERNAL (-14) +#define PCRE_ERROR_BADCOUNT (-15) +#define PCRE_ERROR_DFA_UITEM (-16) +#define PCRE_ERROR_DFA_UCOND (-17) +#define PCRE_ERROR_DFA_UMLIMIT (-18) +#define PCRE_ERROR_DFA_WSSIZE (-19) +#define PCRE_ERROR_DFA_RECURSE (-20) +#define PCRE_ERROR_RECURSIONLIMIT (-21) +#define PCRE_ERROR_NULLWSLIMIT (-22) /* No longer actually used */ +#define PCRE_ERROR_BADNEWLINE (-23) + +/* Request types for pcre_fullinfo() */ + +#define PCRE_INFO_OPTIONS 0 +#define PCRE_INFO_SIZE 1 +#define PCRE_INFO_CAPTURECOUNT 2 +#define PCRE_INFO_BACKREFMAX 3 +#define PCRE_INFO_FIRSTBYTE 4 +#define PCRE_INFO_FIRSTCHAR 4 /* For backwards compatibility */ +#define PCRE_INFO_FIRSTTABLE 5 +#define PCRE_INFO_LASTLITERAL 6 +#define PCRE_INFO_NAMEENTRYSIZE 7 +#define PCRE_INFO_NAMECOUNT 8 +#define PCRE_INFO_NAMETABLE 9 +#define PCRE_INFO_STUDYSIZE 10 +#define PCRE_INFO_DEFAULT_TABLES 11 +#define PCRE_INFO_OKPARTIAL 12 +#define PCRE_INFO_JCHANGED 13 +#define PCRE_INFO_HASCRORLF 14 + +/* Request types for pcre_config(). Do not re-arrange, in order to remain +compatible. */ + +#define PCRE_CONFIG_UTF8 0 +#define PCRE_CONFIG_NEWLINE 1 +#define PCRE_CONFIG_LINK_SIZE 2 +#define PCRE_CONFIG_POSIX_MALLOC_THRESHOLD 3 +#define PCRE_CONFIG_MATCH_LIMIT 4 +#define PCRE_CONFIG_STACKRECURSE 5 +#define PCRE_CONFIG_UNICODE_PROPERTIES 6 +#define PCRE_CONFIG_MATCH_LIMIT_RECURSION 7 +#define PCRE_CONFIG_BSR 8 + +/* Bit flags for the pcre_extra structure. Do not re-arrange or redefine +these bits, just add new ones on the end, in order to remain compatible. */ + +#define PCRE_EXTRA_STUDY_DATA 0x0001 +#define PCRE_EXTRA_MATCH_LIMIT 0x0002 +#define PCRE_EXTRA_CALLOUT_DATA 0x0004 +#define PCRE_EXTRA_TABLES 0x0008 +#define PCRE_EXTRA_MATCH_LIMIT_RECURSION 0x0010 + +/* Types */ + +struct real_pcre; /* declaration; the definition is private */ +typedef struct real_pcre pcre; + +/* When PCRE is compiled as a C++ library, the subject pointer type can be +replaced with a custom type. For conventional use, the public interface is a +const char *. */ + +#ifndef PCRE_SPTR +#define PCRE_SPTR const char * +#endif + +/* The structure for passing additional data to pcre_exec(). This is defined in +such as way as to be extensible. Always add new fields at the end, in order to +remain compatible. */ + +typedef struct pcre_extra { + unsigned long int flags; /* Bits for which fields are set */ + void *study_data; /* Opaque data from pcre_study() */ + unsigned long int match_limit; /* Maximum number of calls to match() */ + void *callout_data; /* Data passed back in callouts */ + const unsigned char *tables; /* Pointer to character tables */ + unsigned long int match_limit_recursion; /* Max recursive calls to match() */ +} pcre_extra; + +/* The structure for passing out data via the pcre_callout_function. We use a +structure so that new fields can be added on the end in future versions, +without changing the API of the function, thereby allowing old clients to work +without modification. */ + +typedef struct pcre_callout_block { + int version; /* Identifies version of block */ + /* ------------------------ Version 0 ------------------------------- */ + int callout_number; /* Number compiled into pattern */ + int *offset_vector; /* The offset vector */ + PCRE_SPTR subject; /* The subject being matched */ + int subject_length; /* The length of the subject */ + int start_match; /* Offset to start of this match attempt */ + int current_position; /* Where we currently are in the subject */ + int capture_top; /* Max current capture */ + int capture_last; /* Most recently closed capture */ + void *callout_data; /* Data passed in with the call */ + /* ------------------- Added for Version 1 -------------------------- */ + int pattern_position; /* Offset to next item in the pattern */ + int next_item_length; /* Length of next item in the pattern */ + /* ------------------------------------------------------------------ */ +} pcre_callout_block; + +/* Indirection for store get and free functions. These can be set to +alternative malloc/free functions if required. Special ones are used in the +non-recursive case for "frames". There is also an optional callout function +that is triggered by the (?) regex item. For Virtual Pascal, these definitions +have to take another form. */ + +#ifndef VPCOMPAT +PCRE_EXP_DECL void *(PCRE_CALL_CONVENTION *pcre_malloc)(size_t); +PCRE_EXP_DECL void(PCRE_CALL_CONVENTION *pcre_free)(void *); +PCRE_EXP_DECL void *(PCRE_CALL_CONVENTION *pcre_stack_malloc)(size_t); +PCRE_EXP_DECL void(PCRE_CALL_CONVENTION *pcre_stack_free)(void *); +PCRE_EXP_DECL int(PCRE_CALL_CONVENTION *pcre_callout)(pcre_callout_block *); +#else /* VPCOMPAT */ +PCRE_EXP_DECL void *PCRE_CALL_CONVENTION pcre_malloc(size_t); +PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free(void *); +PCRE_EXP_DECL void *PCRE_CALL_CONVENTION pcre_stack_malloc(size_t); +PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_stack_free(void *); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_callout(pcre_callout_block *); +#endif /* VPCOMPAT */ + +/* Exported PCRE functions */ + +PCRE_EXP_DECL pcre *PCRE_CALL_CONVENTION +pcre_compile(const char *, int, const char **, int *, const unsigned char *); +PCRE_EXP_DECL pcre *PCRE_CALL_CONVENTION pcre_compile2(const char *, int, int *, + const char **, int *, + const unsigned char *); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_config(int, void *); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_copy_named_substring(const pcre *, const char *, int *, int, const char *, + char *, int); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_copy_substring(const char *, int *, int, int, char *, int); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_dfa_exec(const pcre *, const pcre_extra *, const char *, int, int, int, + int *, int, int *, int); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_exec(const pcre *, + const pcre_extra *, PCRE_SPTR, + int, int, int, int *, int); +PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring(const char *); +PCRE_EXP_DECL void PCRE_CALL_CONVENTION pcre_free_substring_list(const char **); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_fullinfo(const pcre *, const pcre_extra *, int, void *); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_get_named_substring(const pcre *, const char *, int *, int, const char *, + const char **); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_get_stringnumber(const pcre *, const char *); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_get_stringtable_entries(const pcre *, const char *, char **, char **); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_get_substring(const char *, int *, int, int, const char **); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION +pcre_get_substring_list(const char *, int *, int, const char ***); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_info(const pcre *, int *, int *); +PCRE_EXP_DECL const unsigned char *PCRE_CALL_CONVENTION pcre_maketables(void); +PCRE_EXP_DECL int PCRE_CALL_CONVENTION pcre_refcount(pcre *, int); +PCRE_EXP_DECL pcre_extra *PCRE_CALL_CONVENTION +pcre_study(const pcre *, int, const char **); +PCRE_EXP_DECL const char *PCRE_CALL_CONVENTION pcre_version(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* End of pcre.h */ diff --git a/Robot2016/wpilib/cpp/current/include/printFpgaVersion.h b/Robot2016/wpilib/cpp/current/include/printFpgaVersion.h new file mode 100644 index 0000000..9ef9bf4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/printFpgaVersion.h @@ -0,0 +1,42 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __printFPGAVersion_h__ +#define __printFPGAVersion_h__ + +namespace nFPGA +{ + +template +inline void printFPGAVersion(ttGlobal &global) +{ + tRioStatusCode cleanStatus=0; + uint32_t hardwareGuid[4]; + tSystemInterface &system = *global.getSystemInterface(); + system.getHardwareFpgaSignature(hardwareGuid, &cleanStatus); + const uint32_t *softwareGuid = system.getExpectedFPGASignature(); + printf("FPGA Hardware GUID: 0x"); + for(int i=0; i<4; i++) + { + printf("%08X", hardwareGuid[i]); + } + printf("\n"); + printf("FPGA Software GUID: 0x"); + for(int i=0; i<4; i++) + { + printf("%08X", softwareGuid[i]); + } + printf("\n"); + uint16_t fpgaHardwareVersion = global.readVersion(&cleanStatus); + uint16_t fpgaSoftwareVersion = system.getExpectedFPGAVersion(); + printf("FPGA Hardware Version: %X\n", fpgaHardwareVersion); + printf("FPGA Software Version: %X\n", fpgaSoftwareVersion); + uint32_t fpgaHardwareRevision = global.readRevision(&cleanStatus); + uint32_t fpgaSoftwareRevision = system.getExpectedFPGARevision(); + printf("FPGA Hardware Revision: %X.%X.%X\n", (fpgaHardwareRevision >> 20) & 0xFFF, (fpgaHardwareRevision >> 12) & 0xFF, fpgaHardwareRevision & 0xFFF); + printf("FPGA Software Revision: %X.%X.%X\n", (fpgaSoftwareRevision >> 20) & 0xFFF, (fpgaSoftwareRevision >> 12) & 0xFF, fpgaSoftwareRevision & 0xFFF); +} + +} + +#endif // __printFPGAVersion_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/spilib/spi-lib.h b/Robot2016/wpilib/cpp/current/include/spilib/spi-lib.h new file mode 100644 index 0000000..d30701f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/spilib/spi-lib.h @@ -0,0 +1,19 @@ +#ifndef __SPI_LIB_H__ +#define __SPI_LIB_H__ + +#ifdef __cplusplus +extern "C" { +#endif +int spilib_open(const char *device); +void spilib_close(int handle); +int spilib_setspeed(int handle, uint32_t speed); +int spilib_setbitsperword(int handle, uint8_t bpw); +int spilib_setopts(int handle, int msb_first, int sample_on_trailing, int clk_idle_high); +int spilib_read(int handle, char *recv_buf, int32_t size); +int spilib_write(int handle, const char *send_buf, int32_t size); +int spilib_writeread(int handle, const char *send_buf, char *recv_buf, int32_t size); +#ifdef __cplusplus +} +#endif + +#endif /* __SPI_LIB_H__ */ \ No newline at end of file diff --git a/Robot2016/wpilib/cpp/current/include/tDMAChannelDescriptor.h b/Robot2016/wpilib/cpp/current/include/tDMAChannelDescriptor.h new file mode 100644 index 0000000..2c7f54e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tDMAChannelDescriptor.h @@ -0,0 +1,17 @@ +// Describes the information needed to configure a DMA channel. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#include + +#ifndef __tDMAChannelDescriptor_h__ +#define __tDMAChannelDescriptor_h__ + +struct tDMAChannelDescriptor +{ + uint32_t channel; + uint32_t baseAddress; + uint32_t depth; + bool targetToHost; +}; + +#endif // __tDMAChannelDescriptor_h__ diff --git a/Robot2016/wpilib/cpp/current/include/tDMAManager.h b/Robot2016/wpilib/cpp/current/include/tDMAManager.h new file mode 100644 index 0000000..c2ba6b4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tDMAManager.h @@ -0,0 +1,41 @@ +// Class for handling DMA transfers. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tDMAManager_h__ +#define __tDMAManager_h__ + +#include "tSystem.h" +#include + +namespace nFPGA +{ +class tDMAManager : public tSystem +{ +public: + tDMAManager(uint32_t dmaChannel, uint32_t hostBufferSize, tRioStatusCode *status); + ~tDMAManager(); + void start(tRioStatusCode *status); + void stop(tRioStatusCode *status); + bool isStarted() {return _started;} + void read( + uint32_t* buf, + size_t num, + uint32_t timeout, + size_t* remaining, + tRioStatusCode *status); + void write( + uint32_t* buf, + size_t num, + uint32_t timeout, + size_t* remaining, + tRioStatusCode *status); +private: + bool _started; + uint32_t _dmaChannel; + uint32_t _hostBufferSize; + +}; + +} + +#endif // __tDMAManager_h__ diff --git a/Robot2016/wpilib/cpp/current/include/tInterruptManager.h b/Robot2016/wpilib/cpp/current/include/tInterruptManager.h new file mode 100644 index 0000000..6c84b54 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tInterruptManager.h @@ -0,0 +1,61 @@ +// Class for handling interrupts. +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tInterruptManager_h__ +#define __tInterruptManager_h__ + +#include "tSystem.h" + +namespace ni +{ + namespace dsc + { + namespace osdep + { + class CriticalSection; + } + } +} + +namespace nFPGA +{ + +typedef void (*tInterruptHandler)(uint32_t interruptAssertedMask, void *param); + +class tInterruptManager : public tSystem +{ +public: + tInterruptManager(uint32_t interruptMask, bool watcher, tRioStatusCode *status); + ~tInterruptManager(); + void registerHandler(tInterruptHandler handler, void *param, tRioStatusCode *status); + uint32_t watch(int32_t timeoutInMs, bool ignorePrevious, tRioStatusCode *status); + void enable(tRioStatusCode *status); + void disable(tRioStatusCode *status); + bool isEnabled(tRioStatusCode *status); +private: + class tInterruptThread; + friend class tInterruptThread; + void handler(); + static int handlerWrapper(tInterruptManager *pInterrupt); + + void acknowledge(tRioStatusCode *status); + void reserve(tRioStatusCode *status); + void unreserve(tRioStatusCode *status); + tInterruptHandler _handler; + uint32_t _interruptMask; + tInterruptThread *_thread; + NiFpga_IrqContext _rioContext; + bool _watcher; + bool _enabled; + void *_userParam; + + // maintain the interrupts that are already dealt with. + static uint32_t _globalInterruptMask; + static ni::dsc::osdep::CriticalSection *_globalInterruptMaskSemaphore; +}; + +} + + +#endif // __tInterruptManager_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/tSystem.h b/Robot2016/wpilib/cpp/current/include/tSystem.h new file mode 100644 index 0000000..cf54b05 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tSystem.h @@ -0,0 +1,48 @@ +// Base class for generated chip objects +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tSystem_h__ +#define __tSystem_h__ + +#include "fpgainterfacecapi/NiFpga.h" +typedef NiFpga_Status tRioStatusCode; + +#define FRC_FPGA_PRELOAD_BITFILE + +typedef uint32_t NiFpga_Session; + +namespace nFPGA +{ + +class tSystem +{ +public: + tSystem(tRioStatusCode *status); + ~tSystem(); + void getFpgaGuid(uint32_t *guid_ptr, tRioStatusCode *status); + void reset(tRioStatusCode *status); + +protected: + static NiFpga_Session _DeviceHandle; + +#ifdef FRC_FPGA_PRELOAD_BITFILE + void NiFpga_SharedOpen_common(const char* bitfile); + NiFpga_Status NiFpga_SharedOpen(const char* bitfile, + const char* signature, + const char* resource, + uint32_t attribute, + NiFpga_Session* session); + NiFpga_Status NiFpgaLv_SharedOpen(const char* const bitfile, + const char* const apiSignature, + const char* const resource, + const uint32_t attribute, + NiFpga_Session* const session); +private: + static char *_FileName; + static char *_Bitfile; +#endif +}; + +} + +#endif // __tSystem_h__ diff --git a/Robot2016/wpilib/cpp/current/include/tSystemInterface.h b/Robot2016/wpilib/cpp/current/include/tSystemInterface.h new file mode 100644 index 0000000..ee8ca62 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tSystemInterface.h @@ -0,0 +1,27 @@ +// Copyright (c) National Instruments 2008. All Rights Reserved. + +#ifndef __tSystemInterface_h__ +#define __tSystemInterface_h__ + +namespace nFPGA +{ + +class tSystemInterface +{ +public: + tSystemInterface(){} + virtual ~tSystemInterface(){} + + virtual const uint16_t getExpectedFPGAVersion()=0; + virtual const uint32_t getExpectedFPGARevision()=0; + virtual const uint32_t * const getExpectedFPGASignature()=0; + virtual void getHardwareFpgaSignature(uint32_t *guid_ptr, tRioStatusCode *status)=0; + virtual uint32_t getLVHandle(tRioStatusCode *status)=0; + virtual uint32_t getHandle()=0; + virtual void reset(tRioStatusCode *status)=0; +}; + +} + +#endif // __tSystemInterface_h__ + diff --git a/Robot2016/wpilib/cpp/current/include/tables/ITable.h b/Robot2016/wpilib/cpp/current/include/tables/ITable.h new file mode 100644 index 0000000..28ee6c0 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tables/ITable.h @@ -0,0 +1,435 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef ITABLE_H_ +#define ITABLE_H_ + +#include + +#include "llvm/StringRef.h" +#include "nt_Value.h" + +// [[deprecated(msg)]] is a C++14 feature not supported by MSVC or GCC < 4.9. +// We provide an equivalent warning implementation for those compilers here. +#ifndef NT_DEPRECATED + #if defined(_MSC_VER) + #define NT_DEPRECATED(msg) __declspec(deprecated(msg)) + #elif defined(__GNUC__) + #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 8) + #if __cplusplus > 201103L + #define NT_DEPRECATED(msg) [[deprecated(msg)]] + #else + #define NT_DEPRECATED(msg) [[gnu::deprecated(msg)]] + #endif + #else + #define NT_DEPRECATED(msg) __attribute__((deprecated(msg))) + #endif + #elif __cplusplus > 201103L + #define NT_DEPRECATED(msg) [[deprecated(msg)]] + #else + #define NT_DEPRECATED(msg) /*nothing*/ + #endif +#endif + +class ITableListener; + +/** + * A table whose values can be read and written to + */ +class ITable { + public: + /** + * Determines whether the given key is in this table. + * + * @param key the key to search for + * @return true if the table as a value assigned to the given key + */ + virtual bool ContainsKey(llvm::StringRef key) const = 0; + + /** + * Determines whether there exists a non-empty subtable for this key + * in this table. + * + * @param key the key to search for + * @return true if there is a subtable with the key which contains at least + * one key/subtable of its own + */ + virtual bool ContainsSubTable(llvm::StringRef key) const = 0; + + /** + * Gets the subtable in this table for the given name. + * + * @param key the name of the table relative to this one + * @return a sub table relative to this one + */ + virtual std::shared_ptr GetSubTable(llvm::StringRef key) const = 0; + + /** + * @param types bitmask of types; 0 is treated as a "don't care". + * @return keys currently in the table + */ + virtual std::vector GetKeys(int types = 0) const = 0; + + /** + * @return subtables currently in the table + */ + virtual std::vector GetSubTables() const = 0; + + /** + * Makes a key's value persistent through program restarts. + * + * @param key the key to make persistent + */ + virtual void SetPersistent(llvm::StringRef key) = 0; + + /** + * Stop making a key's value persistent through program restarts. + * The key cannot be null. + * + * @param key the key name + */ + virtual void ClearPersistent(llvm::StringRef key) = 0; + + /** + * Returns whether the value is persistent through program restarts. + * The key cannot be null. + * + * @param key the key name + */ + virtual bool IsPersistent(llvm::StringRef key) const = 0; + + /** + * Sets flags on the specified key in this table. The key can + * not be null. + * + * @param key the key name + * @param flags the flags to set (bitmask) + */ + virtual void SetFlags(llvm::StringRef key, unsigned int flags) = 0; + + /** + * Clears flags on the specified key in this table. The key can + * not be null. + * + * @param key the key name + * @param flags the flags to clear (bitmask) + */ + virtual void ClearFlags(llvm::StringRef key, unsigned int flags) = 0; + + /** + * Returns the flags for the specified key. + * + * @param key the key name + * @return the flags, or 0 if the key is not defined + */ + virtual unsigned int GetFlags(llvm::StringRef key) const = 0; + + /** + * Deletes the specified key in this table. + * + * @param key the key name + */ + virtual void Delete(llvm::StringRef key) = 0; + + /** + * Gets the value associated with a key as an object + * + * @param key the key of the value to look up + * @return the value associated with the given key, or nullptr if the key + * does not exist + */ + virtual std::shared_ptr GetValue(llvm::StringRef key) const = 0; + + /** + * Put a value in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutValue(llvm::StringRef key, + std::shared_ptr value) = 0; + + /** + * Put a number in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutNumber(llvm::StringRef key, double value) = 0; + + /** + * Gets the number associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetNumber(StringRef key, double defaultValue) instead") + virtual double GetNumber(llvm::StringRef key) const = 0; + + /** + * Gets the number associated with the given name. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + */ + virtual double GetNumber(llvm::StringRef key, double defaultValue) const = 0; + + /** + * Put a string in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutString(llvm::StringRef key, llvm::StringRef value) = 0; + + /** + * Gets the string associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetString(StringRef key, StringRef defaultValue) instead") + virtual std::string GetString(llvm::StringRef key) const = 0; + + /** + * Gets the string associated with the given name. If the key does not + * exist or is of different type, it will return the default value. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the string. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::string GetString(llvm::StringRef key, + llvm::StringRef defaultValue) const = 0; + + /** + * Put a boolean in the table + * + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutBoolean(llvm::StringRef key, bool value) = 0; + + /** + * Gets the boolean associated with the given name. + * + * @param key the key to look up + * @return the value associated with the given key + * @throws TableKeyNotDefinedException if there is no value associated with + * the given key + * @deprecated This exception-raising method has been replaced by the + * default-taking method. + */ + NT_DEPRECATED("Raises an exception if key not found; " + "use GetBoolean(StringRef key, bool defaultValue) instead") + virtual bool GetBoolean(llvm::StringRef key) const = 0; + + /** + * Gets the boolean associated with the given name. If the key does not + * exist or is of different type, it will return the default value. + * + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + */ + virtual bool GetBoolean(llvm::StringRef key, bool defaultValue) const = 0; + + /** + * Put a boolean array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + * + * @note The array must be of int's rather than of bool's because + * std::vector is special-cased in C++. 0 is false, any + * non-zero value is true. + */ + virtual bool PutBooleanArray(llvm::StringRef key, + llvm::ArrayRef value) = 0; + + /** + * Returns the boolean array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + * + * @note The returned array is std::vector instead of std::vector + * because std::vector is special-cased in C++. 0 is false, any + * non-zero value is true. + */ + virtual std::vector GetBooleanArray( + llvm::StringRef key, llvm::ArrayRef defaultValue) const = 0; + + /** + * Put a number array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutNumberArray(llvm::StringRef key, + llvm::ArrayRef value) = 0; + + /** + * Returns the number array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::vector GetNumberArray( + llvm::StringRef key, llvm::ArrayRef defaultValue) const = 0; + + /** + * Put a string array in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutStringArray(llvm::StringRef key, + llvm::ArrayRef value) = 0; + + /** + * Returns the string array the key maps to. If the key does not exist or is + * of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the array. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::vector GetStringArray( + llvm::StringRef key, llvm::ArrayRef defaultValue) const = 0; + + /** + * Put a raw value (byte array) in the table + * @param key the key to be assigned to + * @param value the value that will be assigned + * @return False if the table key already exists with a different type + */ + virtual bool PutRaw(llvm::StringRef key, llvm::StringRef value) = 0; + + /** + * Returns the raw value (byte array) the key maps to. If the key does not + * exist or is of different type, it will return the default value. + * @param key the key to look up + * @param defaultValue the value to be returned if no value is found + * @return the value associated with the given key or the given default value + * if there is no value associated with the key + * + * @note This makes a copy of the raw contents. If the overhead of this is a + * concern, use GetValue() instead. + */ + virtual std::string GetRaw(llvm::StringRef key, + llvm::StringRef defaultValue) const = 0; + + /** + * Add a listener for changes to the table + * + * @param listener the listener to add + */ + virtual void AddTableListener(ITableListener* listener) = 0; + + /** + * Add a listener for changes to the table + * + * @param listener the listener to add + * @param immediateNotify if true then this listener will be notified of all + * current entries (marked as new) + */ + virtual void AddTableListener(ITableListener* listener, + bool immediateNotify) = 0; + + /** + * Add a listener for changes to the table + * + * @param listener the listener to add + * @param immediateNotify if true then this listener will be notified of all + * current entries (marked as new) + * @param flags bitmask of NT_NotifyKind specifying desired notifications + */ + virtual void AddTableListenerEx(ITableListener* listener, + unsigned int flags) = 0; + + /** + * Add a listener for changes to a specific key the table + * + * @param key the key to listen for + * @param listener the listener to add + * @param immediateNotify if true then this listener will be notified of all + * current entries (marked as new) + */ + virtual void AddTableListener(llvm::StringRef key, ITableListener* listener, + bool immediateNotify) = 0; + + /** + * Add a listener for changes to a specific key the table + * + * @param key the key to listen for + * @param listener the listener to add + * @param immediateNotify if true then this listener will be notified of all + * current entries (marked as new) + * @param flags bitmask of NT_NotifyKind specifying desired notifications + */ + virtual void AddTableListenerEx(llvm::StringRef key, ITableListener* listener, + unsigned int flags) = 0; + + /** + * This will immediately notify the listener of all current sub tables + * @param listener the listener to add + */ + virtual void AddSubTableListener(ITableListener* listener) = 0; + + /** + * This will immediately notify the listener of all current sub tables + * @param listener the listener to add + * @param localNotify if true then this listener will be notified of all + * local changes in addition to all remote changes + */ + virtual void AddSubTableListener(ITableListener* listener, + bool localNotify) = 0; + + /** + * Remove a listener from receiving table events + * + * @param listener the listener to be removed + */ + virtual void RemoveTableListener(ITableListener* listener) = 0; +}; + +#endif // ITABLE_H_ diff --git a/Robot2016/wpilib/cpp/current/include/tables/ITableListener.h b/Robot2016/wpilib/cpp/current/include/tables/ITableListener.h new file mode 100644 index 0000000..6b728d2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tables/ITableListener.h @@ -0,0 +1,50 @@ +/* + * ITableListener.h + */ + +#ifndef ITABLELISTENER_H_ +#define ITABLELISTENER_H_ + +#include + +#include "llvm/StringRef.h" +#include "nt_Value.h" + +class ITable; + +/** + * A listener that listens to changes in values in a {@link ITable} + */ +class ITableListener { + public: + virtual ~ITableListener() = default; + /** + * Called when a key-value pair is changed in a {@link ITable} + * @param source the table the key-value pair exists in + * @param key the key associated with the value that changed + * @param value the new value + * @param isNew true if the key did not previously exist in the table, + * otherwise it is false + */ + virtual void ValueChanged(ITable* source, + llvm::StringRef key, + std::shared_ptr value, + bool isNew) = 0; + + /** + * Extended version of ValueChanged. Called when a key-value pair is + * changed in a {@link ITable}. The default implementation simply calls + * ValueChanged(). If this is overridden, ValueChanged() will not be called. + * @param source the table the key-value pair exists in + * @param key the key associated with the value that changed + * @param value the new value + * @param flags update flags; for example, NT_NOTIFY_NEW if the key did not + * previously exist in the table + */ + virtual void ValueChangedEx(ITable* source, + llvm::StringRef key, + std::shared_ptr value, + unsigned int flags); +}; + +#endif /* ITABLELISTENER_H_ */ diff --git a/Robot2016/wpilib/cpp/current/include/tables/TableKeyNotDefinedException.h b/Robot2016/wpilib/cpp/current/include/tables/TableKeyNotDefinedException.h new file mode 100644 index 0000000..8f318ba --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/tables/TableKeyNotDefinedException.h @@ -0,0 +1,36 @@ +/*----------------------------------------------------------------------------*/ +/* Copyright (c) FIRST 2015. 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. */ +/*----------------------------------------------------------------------------*/ + +#ifndef TABLEKEYNOTDEFINEDEXCEPTION_H_ +#define TABLEKEYNOTDEFINEDEXCEPTION_H_ + +#include +#include "llvm/StringRef.h" + +#if defined(_MSC_VER) + #define NT_NOEXCEPT throw() +#else + #define NT_NOEXCEPT noexcept +#endif + +/** + * An exception thrown when the lookup a a key-value fails in a {@link ITable} + */ +class TableKeyNotDefinedException : public std::exception { + public: + /** + * @param key the key that was not defined in the table + */ + TableKeyNotDefinedException(llvm::StringRef key); + ~TableKeyNotDefinedException() NT_NOEXCEPT; + const char* what() const NT_NOEXCEPT override; + + private: + std::string msg; +}; + +#endif // TABLEKEYNOTDEFINEDEXCEPTION_H_ diff --git a/Robot2016/wpilib/cpp/current/include/visa/visa.h b/Robot2016/wpilib/cpp/current/include/visa/visa.h new file mode 100644 index 0000000..3c6ad30 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/visa/visa.h @@ -0,0 +1,1064 @@ +/*---------------------------------------------------------------------------*/ +/* Distributed by IVI Foundation Inc. */ +/* Contains National Instruments extensions. */ +/* Do not modify the contents of this file. */ +/*---------------------------------------------------------------------------*/ +/* */ +/* Title : VISA.H */ +/* Date : 10-09-2006 */ +/* Purpose : Include file for the VISA Library 4.0 specification */ +/* */ +/*---------------------------------------------------------------------------*/ +/* When using NI-VISA extensions, you must link with the VISA library that */ +/* comes with NI-VISA. Currently, the extensions provided by NI-VISA are: */ +/* */ +/* PXI (Compact PCI eXtensions for Instrumentation) and PCI support. To use */ +/* this, you must define the macro NIVISA_PXI before including this header. */ +/* You must also create an INF file with the VISA Driver Development Wizard. */ +/* */ +/* A fast set of macros for viPeekXX/viPokeXX that guarantees binary */ +/* compatibility with other implementations of VISA. To use this, you must */ +/* define the macro NIVISA_PEEKPOKE before including this header. */ +/* */ +/* Support for USB devices that do not conform to a specific class. To use */ +/* this, you must define the macro NIVISA_USB before including this header. */ +/* You must also create an INF file with the VISA Driver Development Wizard. */ +/*---------------------------------------------------------------------------*/ + +#ifndef __VISA_HEADER__ +#define __VISA_HEADER__ + +#include + +#if !defined(__VISATYPE_HEADER__) +#include "visatype.h" +#endif + +#define VI_SPEC_VERSION (0x00400000UL) + +#if defined(__cplusplus) || defined(__cplusplus__) + extern "C" { +#endif + +#if defined(_CVI_) +#pragma EnableLibraryRuntimeChecking +#endif + +/*- VISA Types --------------------------------------------------------------*/ + +typedef ViObject ViEvent; +typedef ViEvent _VI_PTR ViPEvent; +typedef ViObject ViFindList; +typedef ViFindList _VI_PTR ViPFindList; + +#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT) +typedef ViUInt64 ViBusAddress; +typedef ViUInt64 ViBusSize; +typedef ViUInt64 ViAttrState; +#else +typedef ViUInt32 ViBusAddress; +typedef ViUInt32 ViBusSize; +typedef ViUInt32 ViAttrState; +#endif + +#if defined(_VI_INT64_UINT64_DEFINED) +typedef ViUInt64 ViBusAddress64; +typedef ViBusAddress64 _VI_PTR ViPBusAddress64; +#endif + +typedef ViUInt32 ViEventType; +typedef ViEventType _VI_PTR ViPEventType; +typedef ViEventType _VI_PTR ViAEventType; +typedef void _VI_PTR ViPAttrState; +typedef ViAttr _VI_PTR ViPAttr; +typedef ViAttr _VI_PTR ViAAttr; + +typedef ViString ViKeyId; +typedef ViPString ViPKeyId; +typedef ViUInt32 ViJobId; +typedef ViJobId _VI_PTR ViPJobId; +typedef ViUInt32 ViAccessMode; +typedef ViAccessMode _VI_PTR ViPAccessMode; +typedef ViBusAddress _VI_PTR ViPBusAddress; +typedef ViUInt32 ViEventFilter; + +typedef va_list ViVAList; + +typedef ViStatus (_VI_FUNCH _VI_PTR ViHndlr) + (ViSession vi, ViEventType eventType, ViEvent event, ViAddr userHandle); + +/*- Resource Manager Functions and Operations -------------------------------*/ + +ViStatus _VI_FUNC viOpenDefaultRM (ViPSession vi); +ViStatus _VI_FUNC viFindRsrc (ViSession sesn, ViString expr, ViPFindList vi, + ViPUInt32 retCnt, ViChar _VI_FAR desc[]); +ViStatus _VI_FUNC viFindNext (ViFindList vi, ViChar _VI_FAR desc[]); +ViStatus _VI_FUNC viParseRsrc (ViSession rmSesn, ViRsrc rsrcName, + ViPUInt16 intfType, ViPUInt16 intfNum); +ViStatus _VI_FUNC viParseRsrcEx (ViSession rmSesn, ViRsrc rsrcName, ViPUInt16 intfType, + ViPUInt16 intfNum, ViChar _VI_FAR rsrcClass[], + ViChar _VI_FAR expandedUnaliasedName[], + ViChar _VI_FAR aliasIfExists[]); +ViStatus _VI_FUNC viOpen (ViSession sesn, ViRsrc name, ViAccessMode mode, + ViUInt32 timeout, ViPSession vi); + +/*- Resource Template Operations --------------------------------------------*/ + +ViStatus _VI_FUNC viClose (ViObject vi); +ViStatus _VI_FUNC viSetAttribute (ViObject vi, ViAttr attrName, ViAttrState attrValue); +ViStatus _VI_FUNC viGetAttribute (ViObject vi, ViAttr attrName, void _VI_PTR attrValue); +ViStatus _VI_FUNC viStatusDesc (ViObject vi, ViStatus status, ViChar _VI_FAR desc[]); +ViStatus _VI_FUNC viTerminate (ViObject vi, ViUInt16 degree, ViJobId jobId); + +ViStatus _VI_FUNC viLock (ViSession vi, ViAccessMode lockType, ViUInt32 timeout, + ViKeyId requestedKey, ViChar _VI_FAR accessKey[]); +ViStatus _VI_FUNC viUnlock (ViSession vi); +ViStatus _VI_FUNC viEnableEvent (ViSession vi, ViEventType eventType, ViUInt16 mechanism, + ViEventFilter context); +ViStatus _VI_FUNC viDisableEvent (ViSession vi, ViEventType eventType, ViUInt16 mechanism); +ViStatus _VI_FUNC viDiscardEvents (ViSession vi, ViEventType eventType, ViUInt16 mechanism); +ViStatus _VI_FUNC viWaitOnEvent (ViSession vi, ViEventType inEventType, ViUInt32 timeout, + ViPEventType outEventType, ViPEvent outContext); +ViStatus _VI_FUNC viInstallHandler(ViSession vi, ViEventType eventType, ViHndlr handler, + ViAddr userHandle); +ViStatus _VI_FUNC viUninstallHandler(ViSession vi, ViEventType eventType, ViHndlr handler, + ViAddr userHandle); + +/*- Basic I/O Operations ----------------------------------------------------*/ + +ViStatus _VI_FUNC viRead (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPUInt32 retCnt); +ViStatus _VI_FUNC viReadAsync (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPJobId jobId); +ViStatus _VI_FUNC viReadToFile (ViSession vi, ViConstString filename, ViUInt32 cnt, + ViPUInt32 retCnt); +ViStatus _VI_FUNC viWrite (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPUInt32 retCnt); +ViStatus _VI_FUNC viWriteAsync (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPJobId jobId); +ViStatus _VI_FUNC viWriteFromFile (ViSession vi, ViConstString filename, ViUInt32 cnt, + ViPUInt32 retCnt); +ViStatus _VI_FUNC viAssertTrigger (ViSession vi, ViUInt16 protocol); +ViStatus _VI_FUNC viReadSTB (ViSession vi, ViPUInt16 status); +ViStatus _VI_FUNC viClear (ViSession vi); + +/*- Formatted and Buffered I/O Operations -----------------------------------*/ + +ViStatus _VI_FUNC viSetBuf (ViSession vi, ViUInt16 mask, ViUInt32 size); +ViStatus _VI_FUNC viFlush (ViSession vi, ViUInt16 mask); + +ViStatus _VI_FUNC viBufWrite (ViSession vi, ViBuf buf, ViUInt32 cnt, ViPUInt32 retCnt); +ViStatus _VI_FUNC viBufRead (ViSession vi, ViPBuf buf, ViUInt32 cnt, ViPUInt32 retCnt); + +ViStatus _VI_FUNCC viPrintf (ViSession vi, ViString writeFmt, ...); +ViStatus _VI_FUNC viVPrintf (ViSession vi, ViString writeFmt, ViVAList params); +ViStatus _VI_FUNCC viSPrintf (ViSession vi, ViPBuf buf, ViString writeFmt, ...); +ViStatus _VI_FUNC viVSPrintf (ViSession vi, ViPBuf buf, ViString writeFmt, + ViVAList parms); + +ViStatus _VI_FUNCC viScanf (ViSession vi, ViString readFmt, ...); +ViStatus _VI_FUNC viVScanf (ViSession vi, ViString readFmt, ViVAList params); +ViStatus _VI_FUNCC viSScanf (ViSession vi, ViBuf buf, ViString readFmt, ...); +ViStatus _VI_FUNC viVSScanf (ViSession vi, ViBuf buf, ViString readFmt, + ViVAList parms); + +ViStatus _VI_FUNCC viQueryf (ViSession vi, ViString writeFmt, ViString readFmt, ...); +ViStatus _VI_FUNC viVQueryf (ViSession vi, ViString writeFmt, ViString readFmt, + ViVAList params); + +/*- Memory I/O Operations ---------------------------------------------------*/ + +ViStatus _VI_FUNC viIn8 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViPUInt8 val8); +ViStatus _VI_FUNC viOut8 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViUInt8 val8); +ViStatus _VI_FUNC viIn16 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViPUInt16 val16); +ViStatus _VI_FUNC viOut16 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViUInt16 val16); +ViStatus _VI_FUNC viIn32 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViPUInt32 val32); +ViStatus _VI_FUNC viOut32 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViUInt32 val32); + +#if defined(_VI_INT64_UINT64_DEFINED) +ViStatus _VI_FUNC viIn64 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViPUInt64 val64); +ViStatus _VI_FUNC viOut64 (ViSession vi, ViUInt16 space, + ViBusAddress offset, ViUInt64 val64); + +ViStatus _VI_FUNC viIn8Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViPUInt8 val8); +ViStatus _VI_FUNC viOut8Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViUInt8 val8); +ViStatus _VI_FUNC viIn16Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViPUInt16 val16); +ViStatus _VI_FUNC viOut16Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViUInt16 val16); +ViStatus _VI_FUNC viIn32Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViPUInt32 val32); +ViStatus _VI_FUNC viOut32Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViUInt32 val32); +ViStatus _VI_FUNC viIn64Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViPUInt64 val64); +ViStatus _VI_FUNC viOut64Ex (ViSession vi, ViUInt16 space, + ViBusAddress64 offset, ViUInt64 val64); +#endif + +ViStatus _VI_FUNC viMoveIn8 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt8 buf8); +ViStatus _VI_FUNC viMoveOut8 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt8 buf8); +ViStatus _VI_FUNC viMoveIn16 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt16 buf16); +ViStatus _VI_FUNC viMoveOut16 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt16 buf16); +ViStatus _VI_FUNC viMoveIn32 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt32 buf32); +ViStatus _VI_FUNC viMoveOut32 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt32 buf32); + +#if defined(_VI_INT64_UINT64_DEFINED) +ViStatus _VI_FUNC viMoveIn64 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt64 buf64); +ViStatus _VI_FUNC viMoveOut64 (ViSession vi, ViUInt16 space, ViBusAddress offset, + ViBusSize length, ViAUInt64 buf64); + +ViStatus _VI_FUNC viMoveIn8Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt8 buf8); +ViStatus _VI_FUNC viMoveOut8Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt8 buf8); +ViStatus _VI_FUNC viMoveIn16Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt16 buf16); +ViStatus _VI_FUNC viMoveOut16Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt16 buf16); +ViStatus _VI_FUNC viMoveIn32Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt32 buf32); +ViStatus _VI_FUNC viMoveOut32Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt32 buf32); +ViStatus _VI_FUNC viMoveIn64Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt64 buf64); +ViStatus _VI_FUNC viMoveOut64Ex (ViSession vi, ViUInt16 space, ViBusAddress64 offset, + ViBusSize length, ViAUInt64 buf64); +#endif + +ViStatus _VI_FUNC viMove (ViSession vi, ViUInt16 srcSpace, ViBusAddress srcOffset, + ViUInt16 srcWidth, ViUInt16 destSpace, + ViBusAddress destOffset, ViUInt16 destWidth, + ViBusSize srcLength); +ViStatus _VI_FUNC viMoveAsync (ViSession vi, ViUInt16 srcSpace, ViBusAddress srcOffset, + ViUInt16 srcWidth, ViUInt16 destSpace, + ViBusAddress destOffset, ViUInt16 destWidth, + ViBusSize srcLength, ViPJobId jobId); + +#if defined(_VI_INT64_UINT64_DEFINED) +ViStatus _VI_FUNC viMoveEx (ViSession vi, ViUInt16 srcSpace, ViBusAddress64 srcOffset, + ViUInt16 srcWidth, ViUInt16 destSpace, + ViBusAddress64 destOffset, ViUInt16 destWidth, + ViBusSize srcLength); +ViStatus _VI_FUNC viMoveAsyncEx (ViSession vi, ViUInt16 srcSpace, ViBusAddress64 srcOffset, + ViUInt16 srcWidth, ViUInt16 destSpace, + ViBusAddress64 destOffset, ViUInt16 destWidth, + ViBusSize srcLength, ViPJobId jobId); +#endif + +ViStatus _VI_FUNC viMapAddress (ViSession vi, ViUInt16 mapSpace, ViBusAddress mapOffset, + ViBusSize mapSize, ViBoolean access, + ViAddr suggested, ViPAddr address); +ViStatus _VI_FUNC viUnmapAddress (ViSession vi); + +#if defined(_VI_INT64_UINT64_DEFINED) +ViStatus _VI_FUNC viMapAddressEx (ViSession vi, ViUInt16 mapSpace, ViBusAddress64 mapOffset, + ViBusSize mapSize, ViBoolean access, + ViAddr suggested, ViPAddr address); +#endif + +void _VI_FUNC viPeek8 (ViSession vi, ViAddr address, ViPUInt8 val8); +void _VI_FUNC viPoke8 (ViSession vi, ViAddr address, ViUInt8 val8); +void _VI_FUNC viPeek16 (ViSession vi, ViAddr address, ViPUInt16 val16); +void _VI_FUNC viPoke16 (ViSession vi, ViAddr address, ViUInt16 val16); +void _VI_FUNC viPeek32 (ViSession vi, ViAddr address, ViPUInt32 val32); +void _VI_FUNC viPoke32 (ViSession vi, ViAddr address, ViUInt32 val32); + +#if defined(_VI_INT64_UINT64_DEFINED) +void _VI_FUNC viPeek64 (ViSession vi, ViAddr address, ViPUInt64 val64); +void _VI_FUNC viPoke64 (ViSession vi, ViAddr address, ViUInt64 val64); +#endif + +/*- Shared Memory Operations ------------------------------------------------*/ + +ViStatus _VI_FUNC viMemAlloc (ViSession vi, ViBusSize size, ViPBusAddress offset); +ViStatus _VI_FUNC viMemFree (ViSession vi, ViBusAddress offset); + +#if defined(_VI_INT64_UINT64_DEFINED) +ViStatus _VI_FUNC viMemAllocEx (ViSession vi, ViBusSize size, ViPBusAddress64 offset); +ViStatus _VI_FUNC viMemFreeEx (ViSession vi, ViBusAddress64 offset); +#endif + +/*- Interface Specific Operations -------------------------------------------*/ + +ViStatus _VI_FUNC viGpibControlREN(ViSession vi, ViUInt16 mode); +ViStatus _VI_FUNC viGpibControlATN(ViSession vi, ViUInt16 mode); +ViStatus _VI_FUNC viGpibSendIFC (ViSession vi); +ViStatus _VI_FUNC viGpibCommand (ViSession vi, ViBuf cmd, ViUInt32 cnt, ViPUInt32 retCnt); +ViStatus _VI_FUNC viGpibPassControl(ViSession vi, ViUInt16 primAddr, ViUInt16 secAddr); + +ViStatus _VI_FUNC viVxiCommandQuery(ViSession vi, ViUInt16 mode, ViUInt32 cmd, + ViPUInt32 response); +ViStatus _VI_FUNC viAssertUtilSignal(ViSession vi, ViUInt16 line); +ViStatus _VI_FUNC viAssertIntrSignal(ViSession vi, ViInt16 mode, ViUInt32 statusID); +ViStatus _VI_FUNC viMapTrigger (ViSession vi, ViInt16 trigSrc, ViInt16 trigDest, + ViUInt16 mode); +ViStatus _VI_FUNC viUnmapTrigger (ViSession vi, ViInt16 trigSrc, ViInt16 trigDest); +ViStatus _VI_FUNC viUsbControlOut (ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest, + ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, + ViBuf buf); +ViStatus _VI_FUNC viUsbControlIn (ViSession vi, ViInt16 bmRequestType, ViInt16 bRequest, + ViUInt16 wValue, ViUInt16 wIndex, ViUInt16 wLength, + ViPBuf buf, ViPUInt16 retCnt); + +/*- Attributes (platform independent size) ----------------------------------*/ + +#define VI_ATTR_RSRC_CLASS (0xBFFF0001UL) +#define VI_ATTR_RSRC_NAME (0xBFFF0002UL) +#define VI_ATTR_RSRC_IMPL_VERSION (0x3FFF0003UL) +#define VI_ATTR_RSRC_LOCK_STATE (0x3FFF0004UL) +#define VI_ATTR_MAX_QUEUE_LENGTH (0x3FFF0005UL) +#define VI_ATTR_USER_DATA_32 (0x3FFF0007UL) +#define VI_ATTR_FDC_CHNL (0x3FFF000DUL) +#define VI_ATTR_FDC_MODE (0x3FFF000FUL) +#define VI_ATTR_FDC_GEN_SIGNAL_EN (0x3FFF0011UL) +#define VI_ATTR_FDC_USE_PAIR (0x3FFF0013UL) +#define VI_ATTR_SEND_END_EN (0x3FFF0016UL) +#define VI_ATTR_TERMCHAR (0x3FFF0018UL) +#define VI_ATTR_TMO_VALUE (0x3FFF001AUL) +#define VI_ATTR_GPIB_READDR_EN (0x3FFF001BUL) +#define VI_ATTR_IO_PROT (0x3FFF001CUL) +#define VI_ATTR_DMA_ALLOW_EN (0x3FFF001EUL) +#define VI_ATTR_ASRL_BAUD (0x3FFF0021UL) +#define VI_ATTR_ASRL_DATA_BITS (0x3FFF0022UL) +#define VI_ATTR_ASRL_PARITY (0x3FFF0023UL) +#define VI_ATTR_ASRL_STOP_BITS (0x3FFF0024UL) +#define VI_ATTR_ASRL_FLOW_CNTRL (0x3FFF0025UL) +#define VI_ATTR_RD_BUF_OPER_MODE (0x3FFF002AUL) +#define VI_ATTR_RD_BUF_SIZE (0x3FFF002BUL) +#define VI_ATTR_WR_BUF_OPER_MODE (0x3FFF002DUL) +#define VI_ATTR_WR_BUF_SIZE (0x3FFF002EUL) +#define VI_ATTR_SUPPRESS_END_EN (0x3FFF0036UL) +#define VI_ATTR_TERMCHAR_EN (0x3FFF0038UL) +#define VI_ATTR_DEST_ACCESS_PRIV (0x3FFF0039UL) +#define VI_ATTR_DEST_BYTE_ORDER (0x3FFF003AUL) +#define VI_ATTR_SRC_ACCESS_PRIV (0x3FFF003CUL) +#define VI_ATTR_SRC_BYTE_ORDER (0x3FFF003DUL) +#define VI_ATTR_SRC_INCREMENT (0x3FFF0040UL) +#define VI_ATTR_DEST_INCREMENT (0x3FFF0041UL) +#define VI_ATTR_WIN_ACCESS_PRIV (0x3FFF0045UL) +#define VI_ATTR_WIN_BYTE_ORDER (0x3FFF0047UL) +#define VI_ATTR_GPIB_ATN_STATE (0x3FFF0057UL) +#define VI_ATTR_GPIB_ADDR_STATE (0x3FFF005CUL) +#define VI_ATTR_GPIB_CIC_STATE (0x3FFF005EUL) +#define VI_ATTR_GPIB_NDAC_STATE (0x3FFF0062UL) +#define VI_ATTR_GPIB_SRQ_STATE (0x3FFF0067UL) +#define VI_ATTR_GPIB_SYS_CNTRL_STATE (0x3FFF0068UL) +#define VI_ATTR_GPIB_HS488_CBL_LEN (0x3FFF0069UL) +#define VI_ATTR_CMDR_LA (0x3FFF006BUL) +#define VI_ATTR_VXI_DEV_CLASS (0x3FFF006CUL) +#define VI_ATTR_MAINFRAME_LA (0x3FFF0070UL) +#define VI_ATTR_MANF_NAME (0xBFFF0072UL) +#define VI_ATTR_MODEL_NAME (0xBFFF0077UL) +#define VI_ATTR_VXI_VME_INTR_STATUS (0x3FFF008BUL) +#define VI_ATTR_VXI_TRIG_STATUS (0x3FFF008DUL) +#define VI_ATTR_VXI_VME_SYSFAIL_STATE (0x3FFF0094UL) +#define VI_ATTR_WIN_BASE_ADDR_32 (0x3FFF0098UL) +#define VI_ATTR_WIN_SIZE_32 (0x3FFF009AUL) +#define VI_ATTR_ASRL_AVAIL_NUM (0x3FFF00ACUL) +#define VI_ATTR_MEM_BASE_32 (0x3FFF00ADUL) +#define VI_ATTR_ASRL_CTS_STATE (0x3FFF00AEUL) +#define VI_ATTR_ASRL_DCD_STATE (0x3FFF00AFUL) +#define VI_ATTR_ASRL_DSR_STATE (0x3FFF00B1UL) +#define VI_ATTR_ASRL_DTR_STATE (0x3FFF00B2UL) +#define VI_ATTR_ASRL_END_IN (0x3FFF00B3UL) +#define VI_ATTR_ASRL_END_OUT (0x3FFF00B4UL) +#define VI_ATTR_ASRL_REPLACE_CHAR (0x3FFF00BEUL) +#define VI_ATTR_ASRL_RI_STATE (0x3FFF00BFUL) +#define VI_ATTR_ASRL_RTS_STATE (0x3FFF00C0UL) +#define VI_ATTR_ASRL_XON_CHAR (0x3FFF00C1UL) +#define VI_ATTR_ASRL_XOFF_CHAR (0x3FFF00C2UL) +#define VI_ATTR_WIN_ACCESS (0x3FFF00C3UL) +#define VI_ATTR_RM_SESSION (0x3FFF00C4UL) +#define VI_ATTR_VXI_LA (0x3FFF00D5UL) +#define VI_ATTR_MANF_ID (0x3FFF00D9UL) +#define VI_ATTR_MEM_SIZE_32 (0x3FFF00DDUL) +#define VI_ATTR_MEM_SPACE (0x3FFF00DEUL) +#define VI_ATTR_MODEL_CODE (0x3FFF00DFUL) +#define VI_ATTR_SLOT (0x3FFF00E8UL) +#define VI_ATTR_INTF_INST_NAME (0xBFFF00E9UL) +#define VI_ATTR_IMMEDIATE_SERV (0x3FFF0100UL) +#define VI_ATTR_INTF_PARENT_NUM (0x3FFF0101UL) +#define VI_ATTR_RSRC_SPEC_VERSION (0x3FFF0170UL) +#define VI_ATTR_INTF_TYPE (0x3FFF0171UL) +#define VI_ATTR_GPIB_PRIMARY_ADDR (0x3FFF0172UL) +#define VI_ATTR_GPIB_SECONDARY_ADDR (0x3FFF0173UL) +#define VI_ATTR_RSRC_MANF_NAME (0xBFFF0174UL) +#define VI_ATTR_RSRC_MANF_ID (0x3FFF0175UL) +#define VI_ATTR_INTF_NUM (0x3FFF0176UL) +#define VI_ATTR_TRIG_ID (0x3FFF0177UL) +#define VI_ATTR_GPIB_REN_STATE (0x3FFF0181UL) +#define VI_ATTR_GPIB_UNADDR_EN (0x3FFF0184UL) +#define VI_ATTR_DEV_STATUS_BYTE (0x3FFF0189UL) +#define VI_ATTR_FILE_APPEND_EN (0x3FFF0192UL) +#define VI_ATTR_VXI_TRIG_SUPPORT (0x3FFF0194UL) +#define VI_ATTR_TCPIP_ADDR (0xBFFF0195UL) +#define VI_ATTR_TCPIP_HOSTNAME (0xBFFF0196UL) +#define VI_ATTR_TCPIP_PORT (0x3FFF0197UL) +#define VI_ATTR_TCPIP_DEVICE_NAME (0xBFFF0199UL) +#define VI_ATTR_TCPIP_NODELAY (0x3FFF019AUL) +#define VI_ATTR_TCPIP_KEEPALIVE (0x3FFF019BUL) +#define VI_ATTR_4882_COMPLIANT (0x3FFF019FUL) +#define VI_ATTR_USB_SERIAL_NUM (0xBFFF01A0UL) +#define VI_ATTR_USB_INTFC_NUM (0x3FFF01A1UL) +#define VI_ATTR_USB_PROTOCOL (0x3FFF01A7UL) +#define VI_ATTR_USB_MAX_INTR_SIZE (0x3FFF01AFUL) +#define VI_ATTR_PXI_DEV_NUM (0x3FFF0201UL) +#define VI_ATTR_PXI_FUNC_NUM (0x3FFF0202UL) +#define VI_ATTR_PXI_BUS_NUM (0x3FFF0205UL) +#define VI_ATTR_PXI_CHASSIS (0x3FFF0206UL) +#define VI_ATTR_PXI_SLOTPATH (0xBFFF0207UL) +#define VI_ATTR_PXI_SLOT_LBUS_LEFT (0x3FFF0208UL) +#define VI_ATTR_PXI_SLOT_LBUS_RIGHT (0x3FFF0209UL) +#define VI_ATTR_PXI_TRIG_BUS (0x3FFF020AUL) +#define VI_ATTR_PXI_STAR_TRIG_BUS (0x3FFF020BUL) +#define VI_ATTR_PXI_STAR_TRIG_LINE (0x3FFF020CUL) +#define VI_ATTR_PXI_MEM_TYPE_BAR0 (0x3FFF0211UL) +#define VI_ATTR_PXI_MEM_TYPE_BAR1 (0x3FFF0212UL) +#define VI_ATTR_PXI_MEM_TYPE_BAR2 (0x3FFF0213UL) +#define VI_ATTR_PXI_MEM_TYPE_BAR3 (0x3FFF0214UL) +#define VI_ATTR_PXI_MEM_TYPE_BAR4 (0x3FFF0215UL) +#define VI_ATTR_PXI_MEM_TYPE_BAR5 (0x3FFF0216UL) +#define VI_ATTR_PXI_MEM_BASE_BAR0 (0x3FFF0221UL) +#define VI_ATTR_PXI_MEM_BASE_BAR1 (0x3FFF0222UL) +#define VI_ATTR_PXI_MEM_BASE_BAR2 (0x3FFF0223UL) +#define VI_ATTR_PXI_MEM_BASE_BAR3 (0x3FFF0224UL) +#define VI_ATTR_PXI_MEM_BASE_BAR4 (0x3FFF0225UL) +#define VI_ATTR_PXI_MEM_BASE_BAR5 (0x3FFF0226UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR0 (0x3FFF0231UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR1 (0x3FFF0232UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR2 (0x3FFF0233UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR3 (0x3FFF0234UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR4 (0x3FFF0235UL) +#define VI_ATTR_PXI_MEM_SIZE_BAR5 (0x3FFF0236UL) +#define VI_ATTR_PXI_IS_EXPRESS (0x3FFF0240UL) +#define VI_ATTR_PXI_SLOT_LWIDTH (0x3FFF0241UL) +#define VI_ATTR_PXI_MAX_LWIDTH (0x3FFF0242UL) +#define VI_ATTR_PXI_ACTUAL_LWIDTH (0x3FFF0243UL) +#define VI_ATTR_PXI_DSTAR_BUS (0x3FFF0244UL) +#define VI_ATTR_PXI_DSTAR_SET (0x3FFF0245UL) + +#define VI_ATTR_JOB_ID (0x3FFF4006UL) +#define VI_ATTR_EVENT_TYPE (0x3FFF4010UL) +#define VI_ATTR_SIGP_STATUS_ID (0x3FFF4011UL) +#define VI_ATTR_RECV_TRIG_ID (0x3FFF4012UL) +#define VI_ATTR_INTR_STATUS_ID (0x3FFF4023UL) +#define VI_ATTR_STATUS (0x3FFF4025UL) +#define VI_ATTR_RET_COUNT_32 (0x3FFF4026UL) +#define VI_ATTR_BUFFER (0x3FFF4027UL) +#define VI_ATTR_RECV_INTR_LEVEL (0x3FFF4041UL) +#define VI_ATTR_OPER_NAME (0xBFFF4042UL) +#define VI_ATTR_GPIB_RECV_CIC_STATE (0x3FFF4193UL) +#define VI_ATTR_RECV_TCPIP_ADDR (0xBFFF4198UL) +#define VI_ATTR_USB_RECV_INTR_SIZE (0x3FFF41B0UL) +#define VI_ATTR_USB_RECV_INTR_DATA (0xBFFF41B1UL) + +/*- Attributes (platform dependent size) ------------------------------------*/ + +#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT) +#define VI_ATTR_USER_DATA_64 (0x3FFF000AUL) +#define VI_ATTR_RET_COUNT_64 (0x3FFF4028UL) +#define VI_ATTR_USER_DATA (VI_ATTR_USER_DATA_64) +#define VI_ATTR_RET_COUNT (VI_ATTR_RET_COUNT_64) +#else +#define VI_ATTR_USER_DATA (VI_ATTR_USER_DATA_32) +#define VI_ATTR_RET_COUNT (VI_ATTR_RET_COUNT_32) +#endif + +#if defined(_VI_INT64_UINT64_DEFINED) +#define VI_ATTR_WIN_BASE_ADDR_64 (0x3FFF009BUL) +#define VI_ATTR_WIN_SIZE_64 (0x3FFF009CUL) +#define VI_ATTR_MEM_BASE_64 (0x3FFF00D0UL) +#define VI_ATTR_MEM_SIZE_64 (0x3FFF00D1UL) +#endif +#if defined(_VI_INT64_UINT64_DEFINED) && defined(_VISA_ENV_IS_64_BIT) +#define VI_ATTR_WIN_BASE_ADDR (VI_ATTR_WIN_BASE_ADDR_64) +#define VI_ATTR_WIN_SIZE (VI_ATTR_WIN_SIZE_64) +#define VI_ATTR_MEM_BASE (VI_ATTR_MEM_BASE_64) +#define VI_ATTR_MEM_SIZE (VI_ATTR_MEM_SIZE_64) +#else +#define VI_ATTR_WIN_BASE_ADDR (VI_ATTR_WIN_BASE_ADDR_32) +#define VI_ATTR_WIN_SIZE (VI_ATTR_WIN_SIZE_32) +#define VI_ATTR_MEM_BASE (VI_ATTR_MEM_BASE_32) +#define VI_ATTR_MEM_SIZE (VI_ATTR_MEM_SIZE_32) +#endif + +/*- Event Types -------------------------------------------------------------*/ + +#define VI_EVENT_IO_COMPLETION (0x3FFF2009UL) +#define VI_EVENT_TRIG (0xBFFF200AUL) +#define VI_EVENT_SERVICE_REQ (0x3FFF200BUL) +#define VI_EVENT_CLEAR (0x3FFF200DUL) +#define VI_EVENT_EXCEPTION (0xBFFF200EUL) +#define VI_EVENT_GPIB_CIC (0x3FFF2012UL) +#define VI_EVENT_GPIB_TALK (0x3FFF2013UL) +#define VI_EVENT_GPIB_LISTEN (0x3FFF2014UL) +#define VI_EVENT_VXI_VME_SYSFAIL (0x3FFF201DUL) +#define VI_EVENT_VXI_VME_SYSRESET (0x3FFF201EUL) +#define VI_EVENT_VXI_SIGP (0x3FFF2020UL) +#define VI_EVENT_VXI_VME_INTR (0xBFFF2021UL) +#define VI_EVENT_PXI_INTR (0x3FFF2022UL) +#define VI_EVENT_TCPIP_CONNECT (0x3FFF2036UL) +#define VI_EVENT_USB_INTR (0x3FFF2037UL) + +#define VI_ALL_ENABLED_EVENTS (0x3FFF7FFFUL) + +/*- Completion and Error Codes ----------------------------------------------*/ + +#define VI_SUCCESS_EVENT_EN (0x3FFF0002L) /* 3FFF0002, 1073676290 */ +#define VI_SUCCESS_EVENT_DIS (0x3FFF0003L) /* 3FFF0003, 1073676291 */ +#define VI_SUCCESS_QUEUE_EMPTY (0x3FFF0004L) /* 3FFF0004, 1073676292 */ +#define VI_SUCCESS_TERM_CHAR (0x3FFF0005L) /* 3FFF0005, 1073676293 */ +#define VI_SUCCESS_MAX_CNT (0x3FFF0006L) /* 3FFF0006, 1073676294 */ +#define VI_SUCCESS_DEV_NPRESENT (0x3FFF007DL) /* 3FFF007D, 1073676413 */ +#define VI_SUCCESS_TRIG_MAPPED (0x3FFF007EL) /* 3FFF007E, 1073676414 */ +#define VI_SUCCESS_QUEUE_NEMPTY (0x3FFF0080L) /* 3FFF0080, 1073676416 */ +#define VI_SUCCESS_NCHAIN (0x3FFF0098L) /* 3FFF0098, 1073676440 */ +#define VI_SUCCESS_NESTED_SHARED (0x3FFF0099L) /* 3FFF0099, 1073676441 */ +#define VI_SUCCESS_NESTED_EXCLUSIVE (0x3FFF009AL) /* 3FFF009A, 1073676442 */ +#define VI_SUCCESS_SYNC (0x3FFF009BL) /* 3FFF009B, 1073676443 */ + +#define VI_WARN_QUEUE_OVERFLOW (0x3FFF000CL) /* 3FFF000C, 1073676300 */ +#define VI_WARN_CONFIG_NLOADED (0x3FFF0077L) /* 3FFF0077, 1073676407 */ +#define VI_WARN_NULL_OBJECT (0x3FFF0082L) /* 3FFF0082, 1073676418 */ +#define VI_WARN_NSUP_ATTR_STATE (0x3FFF0084L) /* 3FFF0084, 1073676420 */ +#define VI_WARN_UNKNOWN_STATUS (0x3FFF0085L) /* 3FFF0085, 1073676421 */ +#define VI_WARN_NSUP_BUF (0x3FFF0088L) /* 3FFF0088, 1073676424 */ +#define VI_WARN_EXT_FUNC_NIMPL (0x3FFF00A9L) /* 3FFF00A9, 1073676457 */ + +#define VI_ERROR_SYSTEM_ERROR (_VI_ERROR+0x3FFF0000L) /* BFFF0000, -1073807360 */ +#define VI_ERROR_INV_OBJECT (_VI_ERROR+0x3FFF000EL) /* BFFF000E, -1073807346 */ +#define VI_ERROR_RSRC_LOCKED (_VI_ERROR+0x3FFF000FL) /* BFFF000F, -1073807345 */ +#define VI_ERROR_INV_EXPR (_VI_ERROR+0x3FFF0010L) /* BFFF0010, -1073807344 */ +#define VI_ERROR_RSRC_NFOUND (_VI_ERROR+0x3FFF0011L) /* BFFF0011, -1073807343 */ +#define VI_ERROR_INV_RSRC_NAME (_VI_ERROR+0x3FFF0012L) /* BFFF0012, -1073807342 */ +#define VI_ERROR_INV_ACC_MODE (_VI_ERROR+0x3FFF0013L) /* BFFF0013, -1073807341 */ +#define VI_ERROR_TMO (_VI_ERROR+0x3FFF0015L) /* BFFF0015, -1073807339 */ +#define VI_ERROR_CLOSING_FAILED (_VI_ERROR+0x3FFF0016L) /* BFFF0016, -1073807338 */ +#define VI_ERROR_INV_DEGREE (_VI_ERROR+0x3FFF001BL) /* BFFF001B, -1073807333 */ +#define VI_ERROR_INV_JOB_ID (_VI_ERROR+0x3FFF001CL) /* BFFF001C, -1073807332 */ +#define VI_ERROR_NSUP_ATTR (_VI_ERROR+0x3FFF001DL) /* BFFF001D, -1073807331 */ +#define VI_ERROR_NSUP_ATTR_STATE (_VI_ERROR+0x3FFF001EL) /* BFFF001E, -1073807330 */ +#define VI_ERROR_ATTR_READONLY (_VI_ERROR+0x3FFF001FL) /* BFFF001F, -1073807329 */ +#define VI_ERROR_INV_LOCK_TYPE (_VI_ERROR+0x3FFF0020L) /* BFFF0020, -1073807328 */ +#define VI_ERROR_INV_ACCESS_KEY (_VI_ERROR+0x3FFF0021L) /* BFFF0021, -1073807327 */ +#define VI_ERROR_INV_EVENT (_VI_ERROR+0x3FFF0026L) /* BFFF0026, -1073807322 */ +#define VI_ERROR_INV_MECH (_VI_ERROR+0x3FFF0027L) /* BFFF0027, -1073807321 */ +#define VI_ERROR_HNDLR_NINSTALLED (_VI_ERROR+0x3FFF0028L) /* BFFF0028, -1073807320 */ +#define VI_ERROR_INV_HNDLR_REF (_VI_ERROR+0x3FFF0029L) /* BFFF0029, -1073807319 */ +#define VI_ERROR_INV_CONTEXT (_VI_ERROR+0x3FFF002AL) /* BFFF002A, -1073807318 */ +#define VI_ERROR_QUEUE_OVERFLOW (_VI_ERROR+0x3FFF002DL) /* BFFF002D, -1073807315 */ +#define VI_ERROR_NENABLED (_VI_ERROR+0x3FFF002FL) /* BFFF002F, -1073807313 */ +#define VI_ERROR_ABORT (_VI_ERROR+0x3FFF0030L) /* BFFF0030, -1073807312 */ +#define VI_ERROR_RAW_WR_PROT_VIOL (_VI_ERROR+0x3FFF0034L) /* BFFF0034, -1073807308 */ +#define VI_ERROR_RAW_RD_PROT_VIOL (_VI_ERROR+0x3FFF0035L) /* BFFF0035, -1073807307 */ +#define VI_ERROR_OUTP_PROT_VIOL (_VI_ERROR+0x3FFF0036L) /* BFFF0036, -1073807306 */ +#define VI_ERROR_INP_PROT_VIOL (_VI_ERROR+0x3FFF0037L) /* BFFF0037, -1073807305 */ +#define VI_ERROR_BERR (_VI_ERROR+0x3FFF0038L) /* BFFF0038, -1073807304 */ +#define VI_ERROR_IN_PROGRESS (_VI_ERROR+0x3FFF0039L) /* BFFF0039, -1073807303 */ +#define VI_ERROR_INV_SETUP (_VI_ERROR+0x3FFF003AL) /* BFFF003A, -1073807302 */ +#define VI_ERROR_QUEUE_ERROR (_VI_ERROR+0x3FFF003BL) /* BFFF003B, -1073807301 */ +#define VI_ERROR_ALLOC (_VI_ERROR+0x3FFF003CL) /* BFFF003C, -1073807300 */ +#define VI_ERROR_INV_MASK (_VI_ERROR+0x3FFF003DL) /* BFFF003D, -1073807299 */ +#define VI_ERROR_IO (_VI_ERROR+0x3FFF003EL) /* BFFF003E, -1073807298 */ +#define VI_ERROR_INV_FMT (_VI_ERROR+0x3FFF003FL) /* BFFF003F, -1073807297 */ +#define VI_ERROR_NSUP_FMT (_VI_ERROR+0x3FFF0041L) /* BFFF0041, -1073807295 */ +#define VI_ERROR_LINE_IN_USE (_VI_ERROR+0x3FFF0042L) /* BFFF0042, -1073807294 */ +#define VI_ERROR_NSUP_MODE (_VI_ERROR+0x3FFF0046L) /* BFFF0046, -1073807290 */ +#define VI_ERROR_SRQ_NOCCURRED (_VI_ERROR+0x3FFF004AL) /* BFFF004A, -1073807286 */ +#define VI_ERROR_INV_SPACE (_VI_ERROR+0x3FFF004EL) /* BFFF004E, -1073807282 */ +#define VI_ERROR_INV_OFFSET (_VI_ERROR+0x3FFF0051L) /* BFFF0051, -1073807279 */ +#define VI_ERROR_INV_WIDTH (_VI_ERROR+0x3FFF0052L) /* BFFF0052, -1073807278 */ +#define VI_ERROR_NSUP_OFFSET (_VI_ERROR+0x3FFF0054L) /* BFFF0054, -1073807276 */ +#define VI_ERROR_NSUP_VAR_WIDTH (_VI_ERROR+0x3FFF0055L) /* BFFF0055, -1073807275 */ +#define VI_ERROR_WINDOW_NMAPPED (_VI_ERROR+0x3FFF0057L) /* BFFF0057, -1073807273 */ +#define VI_ERROR_RESP_PENDING (_VI_ERROR+0x3FFF0059L) /* BFFF0059, -1073807271 */ +#define VI_ERROR_NLISTENERS (_VI_ERROR+0x3FFF005FL) /* BFFF005F, -1073807265 */ +#define VI_ERROR_NCIC (_VI_ERROR+0x3FFF0060L) /* BFFF0060, -1073807264 */ +#define VI_ERROR_NSYS_CNTLR (_VI_ERROR+0x3FFF0061L) /* BFFF0061, -1073807263 */ +#define VI_ERROR_NSUP_OPER (_VI_ERROR+0x3FFF0067L) /* BFFF0067, -1073807257 */ +#define VI_ERROR_INTR_PENDING (_VI_ERROR+0x3FFF0068L) /* BFFF0068, -1073807256 */ +#define VI_ERROR_ASRL_PARITY (_VI_ERROR+0x3FFF006AL) /* BFFF006A, -1073807254 */ +#define VI_ERROR_ASRL_FRAMING (_VI_ERROR+0x3FFF006BL) /* BFFF006B, -1073807253 */ +#define VI_ERROR_ASRL_OVERRUN (_VI_ERROR+0x3FFF006CL) /* BFFF006C, -1073807252 */ +#define VI_ERROR_TRIG_NMAPPED (_VI_ERROR+0x3FFF006EL) /* BFFF006E, -1073807250 */ +#define VI_ERROR_NSUP_ALIGN_OFFSET (_VI_ERROR+0x3FFF0070L) /* BFFF0070, -1073807248 */ +#define VI_ERROR_USER_BUF (_VI_ERROR+0x3FFF0071L) /* BFFF0071, -1073807247 */ +#define VI_ERROR_RSRC_BUSY (_VI_ERROR+0x3FFF0072L) /* BFFF0072, -1073807246 */ +#define VI_ERROR_NSUP_WIDTH (_VI_ERROR+0x3FFF0076L) /* BFFF0076, -1073807242 */ +#define VI_ERROR_INV_PARAMETER (_VI_ERROR+0x3FFF0078L) /* BFFF0078, -1073807240 */ +#define VI_ERROR_INV_PROT (_VI_ERROR+0x3FFF0079L) /* BFFF0079, -1073807239 */ +#define VI_ERROR_INV_SIZE (_VI_ERROR+0x3FFF007BL) /* BFFF007B, -1073807237 */ +#define VI_ERROR_WINDOW_MAPPED (_VI_ERROR+0x3FFF0080L) /* BFFF0080, -1073807232 */ +#define VI_ERROR_NIMPL_OPER (_VI_ERROR+0x3FFF0081L) /* BFFF0081, -1073807231 */ +#define VI_ERROR_INV_LENGTH (_VI_ERROR+0x3FFF0083L) /* BFFF0083, -1073807229 */ +#define VI_ERROR_INV_MODE (_VI_ERROR+0x3FFF0091L) /* BFFF0091, -1073807215 */ +#define VI_ERROR_SESN_NLOCKED (_VI_ERROR+0x3FFF009CL) /* BFFF009C, -1073807204 */ +#define VI_ERROR_MEM_NSHARED (_VI_ERROR+0x3FFF009DL) /* BFFF009D, -1073807203 */ +#define VI_ERROR_LIBRARY_NFOUND (_VI_ERROR+0x3FFF009EL) /* BFFF009E, -1073807202 */ +#define VI_ERROR_NSUP_INTR (_VI_ERROR+0x3FFF009FL) /* BFFF009F, -1073807201 */ +#define VI_ERROR_INV_LINE (_VI_ERROR+0x3FFF00A0L) /* BFFF00A0, -1073807200 */ +#define VI_ERROR_FILE_ACCESS (_VI_ERROR+0x3FFF00A1L) /* BFFF00A1, -1073807199 */ +#define VI_ERROR_FILE_IO (_VI_ERROR+0x3FFF00A2L) /* BFFF00A2, -1073807198 */ +#define VI_ERROR_NSUP_LINE (_VI_ERROR+0x3FFF00A3L) /* BFFF00A3, -1073807197 */ +#define VI_ERROR_NSUP_MECH (_VI_ERROR+0x3FFF00A4L) /* BFFF00A4, -1073807196 */ +#define VI_ERROR_INTF_NUM_NCONFIG (_VI_ERROR+0x3FFF00A5L) /* BFFF00A5, -1073807195 */ +#define VI_ERROR_CONN_LOST (_VI_ERROR+0x3FFF00A6L) /* BFFF00A6, -1073807194 */ +#define VI_ERROR_MACHINE_NAVAIL (_VI_ERROR+0x3FFF00A7L) /* BFFF00A7, -1073807193 */ +#define VI_ERROR_NPERMISSION (_VI_ERROR+0x3FFF00A8L) /* BFFF00A8, -1073807192 */ + +/*- Other VISA Definitions --------------------------------------------------*/ + +#define VI_VERSION_MAJOR(ver) ((((ViVersion)ver) & 0xFFF00000UL) >> 20) +#define VI_VERSION_MINOR(ver) ((((ViVersion)ver) & 0x000FFF00UL) >> 8) +#define VI_VERSION_SUBMINOR(ver) ((((ViVersion)ver) & 0x000000FFUL) ) + +#define VI_FIND_BUFLEN (256) + +#define VI_INTF_GPIB (1) +#define VI_INTF_VXI (2) +#define VI_INTF_GPIB_VXI (3) +#define VI_INTF_ASRL (4) +#define VI_INTF_PXI (5) +#define VI_INTF_TCPIP (6) +#define VI_INTF_USB (7) + +#define VI_PROT_NORMAL (1) +#define VI_PROT_FDC (2) +#define VI_PROT_HS488 (3) +#define VI_PROT_4882_STRS (4) +#define VI_PROT_USBTMC_VENDOR (5) + +#define VI_FDC_NORMAL (1) +#define VI_FDC_STREAM (2) + +#define VI_LOCAL_SPACE (0) +#define VI_A16_SPACE (1) +#define VI_A24_SPACE (2) +#define VI_A32_SPACE (3) +#define VI_A64_SPACE (4) +#define VI_PXI_ALLOC_SPACE (9) +#define VI_PXI_CFG_SPACE (10) +#define VI_PXI_BAR0_SPACE (11) +#define VI_PXI_BAR1_SPACE (12) +#define VI_PXI_BAR2_SPACE (13) +#define VI_PXI_BAR3_SPACE (14) +#define VI_PXI_BAR4_SPACE (15) +#define VI_PXI_BAR5_SPACE (16) +#define VI_OPAQUE_SPACE (0xFFFF) + +#define VI_UNKNOWN_LA (-1) +#define VI_UNKNOWN_SLOT (-1) +#define VI_UNKNOWN_LEVEL (-1) +#define VI_UNKNOWN_CHASSIS (-1) + +#define VI_QUEUE (1) +#define VI_HNDLR (2) +#define VI_SUSPEND_HNDLR (4) +#define VI_ALL_MECH (0xFFFF) + +#define VI_ANY_HNDLR (0) + +#define VI_TRIG_ALL (-2) +#define VI_TRIG_SW (-1) +#define VI_TRIG_TTL0 (0) +#define VI_TRIG_TTL1 (1) +#define VI_TRIG_TTL2 (2) +#define VI_TRIG_TTL3 (3) +#define VI_TRIG_TTL4 (4) +#define VI_TRIG_TTL5 (5) +#define VI_TRIG_TTL6 (6) +#define VI_TRIG_TTL7 (7) +#define VI_TRIG_ECL0 (8) +#define VI_TRIG_ECL1 (9) +#define VI_TRIG_PANEL_IN (27) +#define VI_TRIG_PANEL_OUT (28) + +#define VI_TRIG_PROT_DEFAULT (0) +#define VI_TRIG_PROT_ON (1) +#define VI_TRIG_PROT_OFF (2) +#define VI_TRIG_PROT_SYNC (5) +#define VI_TRIG_PROT_RESERVE (6) +#define VI_TRIG_PROT_UNRESERVE (7) + +#define VI_READ_BUF (1) +#define VI_WRITE_BUF (2) +#define VI_READ_BUF_DISCARD (4) +#define VI_WRITE_BUF_DISCARD (8) +#define VI_IO_IN_BUF (16) +#define VI_IO_OUT_BUF (32) +#define VI_IO_IN_BUF_DISCARD (64) +#define VI_IO_OUT_BUF_DISCARD (128) + +#define VI_FLUSH_ON_ACCESS (1) +#define VI_FLUSH_WHEN_FULL (2) +#define VI_FLUSH_DISABLE (3) + +#define VI_NMAPPED (1) +#define VI_USE_OPERS (2) +#define VI_DEREF_ADDR (3) +#define VI_DEREF_ADDR_BYTE_SWAP (4) + +#define VI_TMO_IMMEDIATE (0L) +#define VI_TMO_INFINITE (0xFFFFFFFFUL) + +#define VI_NO_LOCK (0) +#define VI_EXCLUSIVE_LOCK (1) +#define VI_SHARED_LOCK (2) +#define VI_LOAD_CONFIG (4) + +#define VI_NO_SEC_ADDR (0xFFFF) + +#define VI_ASRL_PAR_NONE (0) +#define VI_ASRL_PAR_ODD (1) +#define VI_ASRL_PAR_EVEN (2) +#define VI_ASRL_PAR_MARK (3) +#define VI_ASRL_PAR_SPACE (4) + +#define VI_ASRL_STOP_ONE (10) +#define VI_ASRL_STOP_ONE5 (15) +#define VI_ASRL_STOP_TWO (20) + +#define VI_ASRL_FLOW_NONE (0) +#define VI_ASRL_FLOW_XON_XOFF (1) +#define VI_ASRL_FLOW_RTS_CTS (2) +#define VI_ASRL_FLOW_DTR_DSR (4) + +#define VI_ASRL_END_NONE (0) +#define VI_ASRL_END_LAST_BIT (1) +#define VI_ASRL_END_TERMCHAR (2) +#define VI_ASRL_END_BREAK (3) + +#define VI_STATE_ASSERTED (1) +#define VI_STATE_UNASSERTED (0) +#define VI_STATE_UNKNOWN (-1) + +#define VI_BIG_ENDIAN (0) +#define VI_LITTLE_ENDIAN (1) + +#define VI_DATA_PRIV (0) +#define VI_DATA_NPRIV (1) +#define VI_PROG_PRIV (2) +#define VI_PROG_NPRIV (3) +#define VI_BLCK_PRIV (4) +#define VI_BLCK_NPRIV (5) +#define VI_D64_PRIV (6) +#define VI_D64_NPRIV (7) + +#define VI_WIDTH_8 (1) +#define VI_WIDTH_16 (2) +#define VI_WIDTH_32 (4) +#define VI_WIDTH_64 (8) + +#define VI_GPIB_REN_DEASSERT (0) +#define VI_GPIB_REN_ASSERT (1) +#define VI_GPIB_REN_DEASSERT_GTL (2) +#define VI_GPIB_REN_ASSERT_ADDRESS (3) +#define VI_GPIB_REN_ASSERT_LLO (4) +#define VI_GPIB_REN_ASSERT_ADDRESS_LLO (5) +#define VI_GPIB_REN_ADDRESS_GTL (6) + +#define VI_GPIB_ATN_DEASSERT (0) +#define VI_GPIB_ATN_ASSERT (1) +#define VI_GPIB_ATN_DEASSERT_HANDSHAKE (2) +#define VI_GPIB_ATN_ASSERT_IMMEDIATE (3) + +#define VI_GPIB_HS488_DISABLED (0) +#define VI_GPIB_HS488_NIMPL (-1) + +#define VI_GPIB_UNADDRESSED (0) +#define VI_GPIB_TALKER (1) +#define VI_GPIB_LISTENER (2) + +#define VI_VXI_CMD16 (0x0200) +#define VI_VXI_CMD16_RESP16 (0x0202) +#define VI_VXI_RESP16 (0x0002) +#define VI_VXI_CMD32 (0x0400) +#define VI_VXI_CMD32_RESP16 (0x0402) +#define VI_VXI_CMD32_RESP32 (0x0404) +#define VI_VXI_RESP32 (0x0004) + +#define VI_ASSERT_SIGNAL (-1) +#define VI_ASSERT_USE_ASSIGNED (0) +#define VI_ASSERT_IRQ1 (1) +#define VI_ASSERT_IRQ2 (2) +#define VI_ASSERT_IRQ3 (3) +#define VI_ASSERT_IRQ4 (4) +#define VI_ASSERT_IRQ5 (5) +#define VI_ASSERT_IRQ6 (6) +#define VI_ASSERT_IRQ7 (7) + +#define VI_UTIL_ASSERT_SYSRESET (1) +#define VI_UTIL_ASSERT_SYSFAIL (2) +#define VI_UTIL_DEASSERT_SYSFAIL (3) + +#define VI_VXI_CLASS_MEMORY (0) +#define VI_VXI_CLASS_EXTENDED (1) +#define VI_VXI_CLASS_MESSAGE (2) +#define VI_VXI_CLASS_REGISTER (3) +#define VI_VXI_CLASS_OTHER (4) + +#define VI_PXI_ADDR_NONE (0) +#define VI_PXI_ADDR_MEM (1) +#define VI_PXI_ADDR_IO (2) +#define VI_PXI_ADDR_CFG (3) + +#define VI_TRIG_UNKNOWN (-1) + +#define VI_PXI_LBUS_UNKNOWN (-1) +#define VI_PXI_LBUS_NONE (0) +#define VI_PXI_LBUS_STAR_TRIG_BUS_0 (1000) +#define VI_PXI_LBUS_STAR_TRIG_BUS_1 (1001) +#define VI_PXI_LBUS_STAR_TRIG_BUS_2 (1002) +#define VI_PXI_LBUS_STAR_TRIG_BUS_3 (1003) +#define VI_PXI_LBUS_STAR_TRIG_BUS_4 (1004) +#define VI_PXI_LBUS_STAR_TRIG_BUS_5 (1005) +#define VI_PXI_LBUS_STAR_TRIG_BUS_6 (1006) +#define VI_PXI_LBUS_STAR_TRIG_BUS_7 (1007) +#define VI_PXI_LBUS_STAR_TRIG_BUS_8 (1008) +#define VI_PXI_LBUS_STAR_TRIG_BUS_9 (1009) +#define VI_PXI_STAR_TRIG_CONTROLLER (1413) + +/*- Backward Compatibility Macros -------------------------------------------*/ + +#define viGetDefaultRM(vi) viOpenDefaultRM(vi) +#define VI_ERROR_INV_SESSION (VI_ERROR_INV_OBJECT) +#define VI_INFINITE (VI_TMO_INFINITE) +#define VI_NORMAL (VI_PROT_NORMAL) +#define VI_FDC (VI_PROT_FDC) +#define VI_HS488 (VI_PROT_HS488) +#define VI_ASRL488 (VI_PROT_4882_STRS) +#define VI_ASRL_IN_BUF (VI_IO_IN_BUF) +#define VI_ASRL_OUT_BUF (VI_IO_OUT_BUF) +#define VI_ASRL_IN_BUF_DISCARD (VI_IO_IN_BUF_DISCARD) +#define VI_ASRL_OUT_BUF_DISCARD (VI_IO_OUT_BUF_DISCARD) + +/*- National Instruments ----------------------------------------------------*/ + +#define VI_INTF_RIO (8) +#define VI_INTF_FIREWIRE (9) + +#define VI_ATTR_SYNC_MXI_ALLOW_EN (0x3FFF0161UL) /* ViBoolean, read/write */ + +/* This is for VXI SERVANT resources */ + +#define VI_EVENT_VXI_DEV_CMD (0xBFFF200FUL) +#define VI_ATTR_VXI_DEV_CMD_TYPE (0x3FFF4037UL) /* ViInt16, read-only */ +#define VI_ATTR_VXI_DEV_CMD_VALUE (0x3FFF4038UL) /* ViUInt32, read-only */ + +#define VI_VXI_DEV_CMD_TYPE_16 (16) +#define VI_VXI_DEV_CMD_TYPE_32 (32) + +ViStatus _VI_FUNC viVxiServantResponse(ViSession vi, ViInt16 mode, ViUInt32 resp); +/* mode values include VI_VXI_RESP16, VI_VXI_RESP32, and the next 2 values */ +#define VI_VXI_RESP_NONE (0) +#define VI_VXI_RESP_PROT_ERROR (-1) + +/* This allows extended Serial support on Win32 and on NI ENET Serial products */ + +#define VI_ATTR_ASRL_DISCARD_NULL (0x3FFF00B0UL) +#define VI_ATTR_ASRL_CONNECTED (0x3FFF01BBUL) +#define VI_ATTR_ASRL_BREAK_STATE (0x3FFF01BCUL) +#define VI_ATTR_ASRL_BREAK_LEN (0x3FFF01BDUL) +#define VI_ATTR_ASRL_ALLOW_TRANSMIT (0x3FFF01BEUL) +#define VI_ATTR_ASRL_WIRE_MODE (0x3FFF01BFUL) + +#define VI_ASRL_WIRE_485_4 (0) +#define VI_ASRL_WIRE_485_2_DTR_ECHO (1) +#define VI_ASRL_WIRE_485_2_DTR_CTRL (2) +#define VI_ASRL_WIRE_485_2_AUTO (3) +#define VI_ASRL_WIRE_232_DTE (128) +#define VI_ASRL_WIRE_232_DCE (129) +#define VI_ASRL_WIRE_232_AUTO (130) + +#define VI_EVENT_ASRL_BREAK (0x3FFF2023UL) +#define VI_EVENT_ASRL_CTS (0x3FFF2029UL) +#define VI_EVENT_ASRL_DSR (0x3FFF202AUL) +#define VI_EVENT_ASRL_DCD (0x3FFF202CUL) +#define VI_EVENT_ASRL_RI (0x3FFF202EUL) +#define VI_EVENT_ASRL_CHAR (0x3FFF2035UL) +#define VI_EVENT_ASRL_TERMCHAR (0x3FFF2024UL) + +/* This is for fast viPeek/viPoke macros */ + +#if defined(NIVISA_PEEKPOKE) + +#if defined(NIVISA_PEEKPOKE_SUPP) +#undef NIVISA_PEEKPOKE_SUPP +#endif + +#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_) +/* This macro is supported for all Win32 compilers, including CVI. */ +#define NIVISA_PEEKPOKE_SUPP +#elif (defined(_WINDOWS) || defined(_Windows)) && !defined(_CVI_) && !defined(_NI_mswin16_) +/* This macro is supported for Borland and Microsoft compilers on Win16, but not CVI. */ +#define NIVISA_PEEKPOKE_SUPP +#elif defined(_CVI_) && defined(_NI_sparc_) +/* This macro is supported for Solaris 1 and 2, from CVI only. */ +#define NIVISA_PEEKPOKE_SUPP +#else +/* This macro is not supported on other platforms. */ +#endif + +#if defined(NIVISA_PEEKPOKE_SUPP) + +extern ViBoolean NI_viImplVISA1; +ViStatus _VI_FUNC NI_viOpenDefaultRM (ViPSession vi); +#define viOpenDefaultRM(vi) NI_viOpenDefaultRM(vi) + +#define viPeek8(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((ViPUInt8)(val)) = *((volatile ViUInt8 _VI_PTR)(addr))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPeek8)((vi),(addr),(val)); \ + } \ + } + +#define viPoke8(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((volatile ViUInt8 _VI_PTR)(addr)) = ((ViUInt8)(val))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPoke8)((vi),(addr),(val)); \ + } \ + } + +#define viPeek16(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((ViPUInt16)(val)) = *((volatile ViUInt16 _VI_PTR)(addr))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPeek16)((vi),(addr),(val)); \ + } \ + } + +#define viPoke16(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((volatile ViUInt16 _VI_PTR)(addr)) = ((ViUInt16)(val))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPoke16)((vi),(addr),(val)); \ + } \ + } + +#define viPeek32(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((ViPUInt32)(val)) = *((volatile ViUInt32 _VI_PTR)(addr))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPeek32)((vi),(addr),(val)); \ + } \ + } + +#define viPoke32(vi,addr,val) \ + { \ + if ((NI_viImplVISA1) && (*((ViPUInt32)(vi)))) \ + { \ + do (*((volatile ViUInt32 _VI_PTR)(addr)) = ((ViUInt32)(val))); \ + while (**((volatile ViUInt8 _VI_PTR _VI_PTR)(vi)) & 0x10); \ + } \ + else \ + { \ + (viPoke32)((vi),(addr),(val)); \ + } \ + } + +#endif + +#endif + +#if defined(NIVISA_PXI) || defined(PXISAVISA_PXI) + +#if 0 +/* The following 2 attributes were incorrectly implemented in earlier + versions of NI-VISA. You should now query VI_ATTR_MANF_ID or + VI_ATTR_MODEL_CODE. Those attributes contain sub-vendor information + when it exists. To get both the actual primary and subvendor codes + from the device, you should call viIn16 using VI_PXI_CFG_SPACE. */ +#define VI_ATTR_PXI_SUB_MANF_ID (0x3FFF0203UL) +#define VI_ATTR_PXI_SUB_MODEL_CODE (0x3FFF0204UL) +#endif + +#define VI_ATTR_PXI_SRC_TRIG_BUS (0x3FFF020DUL) +#define VI_ATTR_PXI_DEST_TRIG_BUS (0x3FFF020EUL) + +#define VI_ATTR_PXI_RECV_INTR_SEQ (0x3FFF4240UL) +#define VI_ATTR_PXI_RECV_INTR_DATA (0x3FFF4241UL) + +#endif + +#if defined(NIVISA_USB) + +#define VI_ATTR_USB_BULK_OUT_PIPE (0x3FFF01A2UL) +#define VI_ATTR_USB_BULK_IN_PIPE (0x3FFF01A3UL) +#define VI_ATTR_USB_INTR_IN_PIPE (0x3FFF01A4UL) +#define VI_ATTR_USB_CLASS (0x3FFF01A5UL) +#define VI_ATTR_USB_SUBCLASS (0x3FFF01A6UL) +#define VI_ATTR_USB_ALT_SETTING (0x3FFF01A8UL) +#define VI_ATTR_USB_END_IN (0x3FFF01A9UL) +#define VI_ATTR_USB_NUM_INTFCS (0x3FFF01AAUL) +#define VI_ATTR_USB_NUM_PIPES (0x3FFF01ABUL) +#define VI_ATTR_USB_BULK_OUT_STATUS (0x3FFF01ACUL) +#define VI_ATTR_USB_BULK_IN_STATUS (0x3FFF01ADUL) +#define VI_ATTR_USB_INTR_IN_STATUS (0x3FFF01AEUL) +#define VI_ATTR_USB_CTRL_PIPE (0x3FFF01B0UL) + +#define VI_USB_PIPE_STATE_UNKNOWN (-1) +#define VI_USB_PIPE_READY (0) +#define VI_USB_PIPE_STALLED (1) + +#define VI_USB_END_NONE (0) +#define VI_USB_END_SHORT (4) +#define VI_USB_END_SHORT_OR_COUNT (5) + +#endif + +#define VI_ATTR_FIREWIRE_DEST_UPPER_OFFSET (0x3FFF01F0UL) +#define VI_ATTR_FIREWIRE_SRC_UPPER_OFFSET (0x3FFF01F1UL) +#define VI_ATTR_FIREWIRE_WIN_UPPER_OFFSET (0x3FFF01F2UL) +#define VI_ATTR_FIREWIRE_VENDOR_ID (0x3FFF01F3UL) +#define VI_ATTR_FIREWIRE_LOWER_CHIP_ID (0x3FFF01F4UL) +#define VI_ATTR_FIREWIRE_UPPER_CHIP_ID (0x3FFF01F5UL) + +#define VI_FIREWIRE_DFLT_SPACE (5) + +#if defined(__cplusplus) || defined(__cplusplus__) + } +#endif + +#endif + +/*- The End -----------------------------------------------------------------*/ diff --git a/Robot2016/wpilib/cpp/current/include/visa/visatype.h b/Robot2016/wpilib/cpp/current/include/visa/visatype.h new file mode 100644 index 0000000..ef089dd --- /dev/null +++ b/Robot2016/wpilib/cpp/current/include/visa/visatype.h @@ -0,0 +1,201 @@ +/*---------------------------------------------------------------------------*/ +/* Distributed by IVI Foundation Inc. */ +/* */ +/* Do not modify the contents of this file. */ +/*---------------------------------------------------------------------------*/ +/* */ +/* Title : VISATYPE.H */ +/* Date : 04-14-2006 */ +/* Purpose : Fundamental VISA data types and macro definitions */ +/* */ +/*---------------------------------------------------------------------------*/ + +#ifndef __VISATYPE_HEADER__ +#define __VISATYPE_HEADER__ + +#if defined(_WIN64) +#define _VI_FAR +#define _VI_FUNC __fastcall +#define _VI_FUNCC __fastcall +#define _VI_FUNCH __fastcall +#define _VI_SIGNED signed +#elif (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_) +#define _VI_FAR +#define _VI_FUNC __stdcall +#define _VI_FUNCC __cdecl +#define _VI_FUNCH __stdcall +#define _VI_SIGNED signed +#elif defined(_CVI_) && defined(_NI_i386_) +#define _VI_FAR +#define _VI_FUNC _pascal +#define _VI_FUNCC +#define _VI_FUNCH _pascal +#define _VI_SIGNED signed +#elif (defined(_WINDOWS) || defined(_Windows)) && !defined(_NI_mswin16_) +#define _VI_FAR _far +#define _VI_FUNC _far _pascal _export +#define _VI_FUNCC _far _cdecl _export +#define _VI_FUNCH _far _pascal +#define _VI_SIGNED signed +#elif (defined(hpux) || defined(__hpux)) && (defined(__cplusplus) || defined(__cplusplus__)) +#define _VI_FAR +#define _VI_FUNC +#define _VI_FUNCC +#define _VI_FUNCH +#define _VI_SIGNED +#else +#define _VI_FAR +#define _VI_FUNC +#define _VI_FUNCC +#define _VI_FUNCH +#define _VI_SIGNED signed +#endif + +#define _VI_ERROR (-2147483647L-1) /* 0x80000000 */ +#define _VI_PTR _VI_FAR * + +/*- VISA Types --------------------------------------------------------------*/ + +#ifndef _VI_INT64_UINT64_DEFINED +#if defined(_WIN64) || ((defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)) && !defined(_NI_mswin16_)) +#if (defined(_MSC_VER) && (_MSC_VER >= 1200)) || (defined(_CVI_) && (_CVI_ >= 700)) || (defined(__BORLANDC__) && (__BORLANDC__ >= 0x0520)) +typedef unsigned __int64 ViUInt64; +typedef _VI_SIGNED __int64 ViInt64; +#define _VI_INT64_UINT64_DEFINED +#if defined(_WIN64) +#define _VISA_ENV_IS_64_BIT +#else +/* This is a 32-bit OS, not a 64-bit OS */ +#endif +#endif +#elif defined(__GNUC__) && (__GNUC__ >= 3) +#include +#include +typedef u_int64_t ViUInt64; +typedef int64_t ViInt64; +#define _VI_INT64_UINT64_DEFINED +#if defined(LONG_MAX) && (LONG_MAX > 0x7FFFFFFFL) +#define _VISA_ENV_IS_64_BIT +#else +/* This is a 32-bit OS, not a 64-bit OS */ +#endif +#else +/* This platform does not support 64-bit types */ +#endif +#endif + +#if defined(_VI_INT64_UINT64_DEFINED) +typedef ViUInt64 _VI_PTR ViPUInt64; +typedef ViUInt64 _VI_PTR ViAUInt64; +typedef ViInt64 _VI_PTR ViPInt64; +typedef ViInt64 _VI_PTR ViAInt64; +#endif + +#if defined(LONG_MAX) && (LONG_MAX > 0x7FFFFFFFL) +typedef unsigned int ViUInt32; +typedef _VI_SIGNED int ViInt32; +#else +typedef unsigned long ViUInt32; +typedef _VI_SIGNED long ViInt32; +#endif + +typedef ViUInt32 _VI_PTR ViPUInt32; +typedef ViUInt32 _VI_PTR ViAUInt32; +typedef ViInt32 _VI_PTR ViPInt32; +typedef ViInt32 _VI_PTR ViAInt32; + +typedef unsigned short ViUInt16; +typedef ViUInt16 _VI_PTR ViPUInt16; +typedef ViUInt16 _VI_PTR ViAUInt16; + +typedef _VI_SIGNED short ViInt16; +typedef ViInt16 _VI_PTR ViPInt16; +typedef ViInt16 _VI_PTR ViAInt16; + +typedef unsigned char ViUInt8; +typedef ViUInt8 _VI_PTR ViPUInt8; +typedef ViUInt8 _VI_PTR ViAUInt8; + +typedef _VI_SIGNED char ViInt8; +typedef ViInt8 _VI_PTR ViPInt8; +typedef ViInt8 _VI_PTR ViAInt8; + +typedef char ViChar; +typedef ViChar _VI_PTR ViPChar; +typedef ViChar _VI_PTR ViAChar; + +typedef unsigned char ViByte; +typedef ViByte _VI_PTR ViPByte; +typedef ViByte _VI_PTR ViAByte; + +typedef void _VI_PTR ViAddr; +typedef ViAddr _VI_PTR ViPAddr; +typedef ViAddr _VI_PTR ViAAddr; + +typedef float ViReal32; +typedef ViReal32 _VI_PTR ViPReal32; +typedef ViReal32 _VI_PTR ViAReal32; + +typedef double ViReal64; +typedef ViReal64 _VI_PTR ViPReal64; +typedef ViReal64 _VI_PTR ViAReal64; + +typedef ViPByte ViBuf; +typedef ViPByte ViPBuf; +typedef ViPByte _VI_PTR ViABuf; + +typedef ViPChar ViString; +typedef ViPChar ViPString; +typedef ViPChar _VI_PTR ViAString; + +typedef ViString ViRsrc; +typedef ViString ViPRsrc; +typedef ViString _VI_PTR ViARsrc; + +typedef ViUInt16 ViBoolean; +typedef ViBoolean _VI_PTR ViPBoolean; +typedef ViBoolean _VI_PTR ViABoolean; + +typedef ViInt32 ViStatus; +typedef ViStatus _VI_PTR ViPStatus; +typedef ViStatus _VI_PTR ViAStatus; + +typedef ViUInt32 ViVersion; +typedef ViVersion _VI_PTR ViPVersion; +typedef ViVersion _VI_PTR ViAVersion; + +typedef ViUInt32 ViObject; +typedef ViObject _VI_PTR ViPObject; +typedef ViObject _VI_PTR ViAObject; + +typedef ViObject ViSession; +typedef ViSession _VI_PTR ViPSession; +typedef ViSession _VI_PTR ViASession; + +typedef ViUInt32 ViAttr; + +#ifndef _VI_CONST_STRING_DEFINED +typedef const ViChar * ViConstString; +#define _VI_CONST_STRING_DEFINED +#endif + +/*- Completion and Error Codes ----------------------------------------------*/ + +#define VI_SUCCESS (0L) + +/*- Other VISA Definitions --------------------------------------------------*/ + +#define VI_NULL (0) + +#define VI_TRUE (1) +#define VI_FALSE (0) + +/*- Backward Compatibility Macros -------------------------------------------*/ + +#define VISAFN _VI_FUNC +#define ViPtr _VI_PTR + +#endif + +/*- The End -----------------------------------------------------------------*/ + diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so new file mode 100644 index 0000000..7b68b76 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunication.so.16 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16 new file mode 100644 index 0000000..52ac7c2 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunication.so.16.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0 new file mode 100644 index 0000000..932383b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunication.so.16.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0.0 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0.0 new file mode 100644 index 0000000..9cfcd70 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunication.so.16.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so new file mode 100644 index 0000000..2a94a14 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunicationLV.so.16 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16 new file mode 100644 index 0000000..4c35d45 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunicationLV.so.16.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0 new file mode 100644 index 0000000..74fe2d1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libFRC_NetworkCommunicationLV.so.16.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0.0 b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0.0 new file mode 100644 index 0000000..940acde Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libFRC_NetworkCommunicationLV.so.16.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libGCBase_gcc-4.4-arm_v2_3.so b/Robot2016/wpilib/cpp/current/lib/libGCBase_gcc-4.4-arm_v2_3.so new file mode 100644 index 0000000..3bcda8d Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libGCBase_gcc-4.4-arm_v2_3.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libGenApi_gcc-4.4-arm_v2_3.so b/Robot2016/wpilib/cpp/current/lib/libGenApi_gcc-4.4-arm_v2_3.so new file mode 100644 index 0000000..7e6a6df Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libGenApi_gcc-4.4-arm_v2_3.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libHALAthena.a b/Robot2016/wpilib/cpp/current/lib/libHALAthena.a new file mode 100644 index 0000000..f239745 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libHALAthena.a differ diff --git a/Robot2016/wpilib/cpp/current/lib/libHALAthena_shared.so b/Robot2016/wpilib/cpp/current/lib/libHALAthena_shared.so new file mode 100644 index 0000000..1bbc89e Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libHALAthena_shared.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libLog_gcc-4.4-arm_v2_3.so b/Robot2016/wpilib/cpp/current/lib/libLog_gcc-4.4-arm_v2_3.so new file mode 100644 index 0000000..6e8719b Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libLog_gcc-4.4-arm_v2_3.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libMathParser_gcc-4.4-arm_v2_3.so b/Robot2016/wpilib/cpp/current/lib/libMathParser_gcc-4.4-arm_v2_3.so new file mode 100644 index 0000000..e4d1279 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libMathParser_gcc-4.4-arm_v2_3.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpga.so b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so new file mode 100644 index 0000000..ef3895d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpga.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15 b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15 new file mode 100644 index 0000000..3db9399 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpga.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0 new file mode 100644 index 0000000..fe101f5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpga.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0.0 new file mode 100644 index 0000000..75c201d Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libNiFpga.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so new file mode 100644 index 0000000..2d5b7e8 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpgaLv.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15 b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15 new file mode 100644 index 0000000..070a616 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpgaLv.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0 new file mode 100644 index 0000000..3a71dc5 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiFpgaLv.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0.0 new file mode 100644 index 0000000..6187874 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libNiFpgaLv.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so new file mode 100644 index 0000000..b6b45e4 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiRioSrv.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15 b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15 new file mode 100644 index 0000000..e030465 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiRioSrv.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0 new file mode 100644 index 0000000..c9e5988 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libNiRioSrv.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0.0 new file mode 100644 index 0000000..d0d52ca Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libNiRioSrv.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so new file mode 100644 index 0000000..38c70b9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libRoboRIO_FRC_ChipObject.so.16 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16 b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16 new file mode 100644 index 0000000..f10be9f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libRoboRIO_FRC_ChipObject.so.16.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0 b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0 new file mode 100644 index 0000000..0e8a259 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libRoboRIO_FRC_ChipObject.so.16.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0.0 b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0.0 new file mode 100644 index 0000000..be55941 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libRoboRIO_FRC_ChipObject.so.16.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libi2c.so b/Robot2016/wpilib/cpp/current/lib/libi2c.so new file mode 100644 index 0000000..673ca37 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libi2c.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libi2c.so.1 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libi2c.so.1 b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1 new file mode 100644 index 0000000..e10758b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libi2c.so.1.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0 b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0 new file mode 100644 index 0000000..68c5890 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libi2c.so.1.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0.0 b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0.0 new file mode 100644 index 0000000..fd8c6da Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libi2c.so.1.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/liblog4cpp_gcc-4.4-arm_v2_3.so b/Robot2016/wpilib/cpp/current/lib/liblog4cpp_gcc-4.4-arm_v2_3.so new file mode 100644 index 0000000..46f6780 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/liblog4cpp_gcc-4.4-arm_v2_3.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libni_emb.so b/Robot2016/wpilib/cpp/current/lib/libni_emb.so new file mode 100644 index 0000000..b979985 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_emb.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_emb.so.8 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8 b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8 new file mode 100644 index 0000000..2723c59 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_emb.so.8.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0 b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0 new file mode 100644 index 0000000..ae1c046 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_emb.so.8.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0.0 b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0.0 new file mode 100644 index 0000000..a094ca6 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libni_emb.so.8.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so new file mode 100644 index 0000000..3045681 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_rtlog.so.2 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2 b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2 new file mode 100644 index 0000000..bae6b90 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_rtlog.so.2.4 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4 b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4 new file mode 100644 index 0000000..abaf6d9 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libni_rtlog.so.2.4.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4.0 b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4.0 new file mode 100644 index 0000000..447e399 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libni_rtlog.so.2.4.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so new file mode 100644 index 0000000..cd0a3ac --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libniimaqdx.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15 b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15 new file mode 100644 index 0000000..4f92f0d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libniimaqdx.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0 new file mode 100644 index 0000000..4e7e77b --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libniimaqdx.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0.0 new file mode 100644 index 0000000..ccad9d9 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libniimaqdx.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libnipalu.so b/Robot2016/wpilib/cpp/current/lib/libnipalu.so new file mode 100644 index 0000000..96b5031 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnipalu.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnipalu.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15 b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15 new file mode 100644 index 0000000..f951d9d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnipalu.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0 new file mode 100644 index 0000000..d50d250 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnipalu.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0.0 new file mode 100644 index 0000000..81f4a45 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libnipalu.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so new file mode 100644 index 0000000..6da3410 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnirio_emb_can.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15 b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15 new file mode 100644 index 0000000..381ed2d --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnirio_emb_can.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0 new file mode 100644 index 0000000..64e2ff1 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnirio_emb_can.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0.0 new file mode 100644 index 0000000..98f760b Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libnirio_emb_can.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libnivision.so b/Robot2016/wpilib/cpp/current/lib/libnivision.so new file mode 100644 index 0000000..f81bbcf --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivision.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivision.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivision.so.15 b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15 new file mode 100644 index 0000000..adb373e --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivision.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0 new file mode 100644 index 0000000..eae0f23 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivision.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0.0 new file mode 100644 index 0000000..0f435ea Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libnivision.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libnivissvc.so b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so new file mode 100644 index 0000000..47649ee --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivissvc.so.15 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15 b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15 new file mode 100644 index 0000000..8181c86 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivissvc.so.15.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0 b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0 new file mode 100644 index 0000000..408c822 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libnivissvc.so.15.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0.0 b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0.0 new file mode 100644 index 0000000..e314583 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libnivissvc.so.15.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libntcore.a b/Robot2016/wpilib/cpp/current/lib/libntcore.a new file mode 100644 index 0000000..541c01b Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libntcore.a differ diff --git a/Robot2016/wpilib/cpp/current/lib/libntcore_shared.so b/Robot2016/wpilib/cpp/current/lib/libntcore_shared.so new file mode 100644 index 0000000..7b13eb5 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libntcore_shared.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libspi.so b/Robot2016/wpilib/cpp/current/lib/libspi.so new file mode 100644 index 0000000..e77606f --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libspi.so @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libspi.so.1 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libspi.so.1 b/Robot2016/wpilib/cpp/current/lib/libspi.so.1 new file mode 100644 index 0000000..5aa0632 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libspi.so.1 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libspi.so.1.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0 b/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0 new file mode 100644 index 0000000..9f016df --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0 @@ -0,0 +1,2 @@ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( libspi.so.1.0.0 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0.0 b/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0.0 new file mode 100644 index 0000000..5f69f31 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libspi.so.1.0.0 differ diff --git a/Robot2016/wpilib/cpp/current/lib/libvisa.so b/Robot2016/wpilib/cpp/current/lib/libvisa.so new file mode 100644 index 0000000..0ada011 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libvisa.so differ diff --git a/Robot2016/wpilib/cpp/current/lib/libwpi.so b/Robot2016/wpilib/cpp/current/lib/libwpi.so new file mode 100644 index 0000000..429ff80 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libwpi.so @@ -0,0 +1,3 @@ +/* GNU ld script */ +OUTPUT_FORMAT(elf32-littlearm) +INPUT ( -lwpi_2015 ) diff --git a/Robot2016/wpilib/cpp/current/lib/libwpi_2015.so b/Robot2016/wpilib/cpp/current/lib/libwpi_2015.so new file mode 100644 index 0000000..dbde0b3 --- /dev/null +++ b/Robot2016/wpilib/cpp/current/lib/libwpi_2015.so @@ -0,0 +1,3 @@ +/* GNU ld script */ +OUTPUT_FORMAT(elf32-littlearm) +GROUP ( AS_NEEDED ( -lwpilib_nonshared -lHALAthena -lntcore -lFRC_NetworkCommunication -li2c -lni_emb -lNiFpgaLv -lNiFpga -lnirio_emb_can -lNiRioSrv -lni_rtlog -lRoboRIO_FRC_ChipObject -lspi -lvisa -ldl -lpthread -lrt -lGCBase_gcc-4.4-arm_v2_3 -lGenApi_gcc-4.4-arm_v2_3 -lLog_gcc-4.4-arm_v2_3 -lMathParser_gcc-4.4-arm_v2_3 -llog4cpp_gcc-4.4-arm_v2_3 -lniimaqdx -lnivision -lnivissvc -lnipalu) ) diff --git a/Robot2016/wpilib/cpp/current/lib/libwpilib_nonshared.a b/Robot2016/wpilib/cpp/current/lib/libwpilib_nonshared.a new file mode 100644 index 0000000..0c1ce03 Binary files /dev/null and b/Robot2016/wpilib/cpp/current/lib/libwpilib_nonshared.a differ diff --git a/Robot2016/wpilib/tools/OutlineViewer.jar b/Robot2016/wpilib/tools/OutlineViewer.jar new file mode 100644 index 0000000..7547bab Binary files /dev/null and b/Robot2016/wpilib/tools/OutlineViewer.jar differ diff --git a/Robot2016/wpilib/tools/RobotBuilder.jar b/Robot2016/wpilib/tools/RobotBuilder.jar new file mode 100644 index 0000000..7a04d6b Binary files /dev/null and b/Robot2016/wpilib/tools/RobotBuilder.jar differ diff --git a/Robot2016/wpilib/tools/SmartDashboard.jar b/Robot2016/wpilib/tools/SmartDashboard.jar new file mode 100644 index 0000000..6fcbd4e Binary files /dev/null and b/Robot2016/wpilib/tools/SmartDashboard.jar differ diff --git a/Robot2016/wpilib/tools/java-installer.jar b/Robot2016/wpilib/tools/java-installer.jar new file mode 100644 index 0000000..4712ffa Binary files /dev/null and b/Robot2016/wpilib/tools/java-installer.jar differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/bool/.jrubyfx_cache/774a63170b63edbd5e88db7126df6db9645b436c.rb b/Robot2016/wpilib/tools/plugins/built-in/bool/.jrubyfx_cache/774a63170b63edbd5e88db7126df6db9645b436c.rb new file mode 100644 index 0000000..d028ab1 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/bool/.jrubyfx_cache/774a63170b63edbd5e88db7126df6db9645b436c.rb @@ -0,0 +1,53 @@ +# 5972d798b67cba9bb388ffd1bfde14b91fd635a9 encoding: utf-8 +# @@ 1 + +########################### DO NOT MODIFY THIS FILE ########################### +# This file was automatically generated by JRubyFX-fxmlloader on # +# 2016-01-06 20:19:15 -0500 for ../sfx/plugins/built-in/bool/BadBool.fxml +########################### DO NOT MODIFY THIS FILE ########################### + +module JRubyFX + module GeneratedAssets + class AOT774a63170b63edbd5e88db7126df6db9645b436c + include JRubyFX + def __build_via_jit(__local_fxml_controller, __local_namespace, __local_jruby_ext) + __local_fx_id_setter = lambda do |name, __i| + __local_namespace[name] = __i + __local_fxml_controller.instance_variable_set(("@#{name}").to_sym, __i) + end +(__local_sem_inst = Java.javax.script.ScriptEngineManager.new).setBindings(javax.script.SimpleBindings.new(__local_namespace)) +(__local_sem_lang_inst_javascript = __local_sem_inst.getEngineByName("javascript")).setBindings(__local_sem_inst.getBindings(), javax.script.ScriptContext.ENGINE_SCOPE) +build(Java::DashfxControlsBases::BooleanControlBase) do + __local_fx_id_setter.call("base", self) + __local_jruby_ext[:on_root_set].call(self) if __local_jruby_ext[:on_root_set] + __local_sem_lang_inst_javascript.eval("\n\t\tfunction moused(e)\n\t\t{\n\t\t\tbase.setValue(!base.getValue());\n\t\t}\n\t") + setUi(build(Java::JavafxSceneLayout::HBox) do + getChildren.add(build(Java::JavafxSceneLayout::StackPane) do + getChildren.add(build(Java::JavafxSceneLayout::StackPane) do + setPrefHeight(16.0) + setPrefWidth(16.0) + setStyle("-fx-background-color: #60dc00;") + visibleProperty.bind(RRExpressionValue.new(__local_namespace, Java::org.jruby.jfx8.Expression.valueOf("base.value"), Java::boolean.java_class)) + end) + setPrefHeight(-1.0) + setPrefWidth(-1.0) + setStyle("-fx-background-color: #df0040;") + Java::JavafxSceneLayout::HBox.setHgrow(self, Java::javafx::scene::layout::Priority::ALWAYS) + end) + setAlignment(Java::javafx::geometry::Pos::CENTER_LEFT) + setPrefHeight(-1.0) + setPrefWidth(-1.0) + setOnMouseClicked(ScriptEventHandler.new("moused(event)", __local_sem_lang_inst_javascript)) + end) +end + end + + def hash + "5972d798b67cba9bb388ffd1bfde14b91fd635a9" + end + def compiled? + true + end + end + end +end diff --git a/Robot2016/wpilib/tools/plugins/built-in/bool/BadBool.fxml b/Robot2016/wpilib/tools/plugins/built-in/bool/BadBool.fxml new file mode 100644 index 0000000..e387103 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/bool/BadBool.fxml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + function moused(e) + { + base.setValue(!base.getValue()); + } + + + + + + + + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/bool/icon.png b/Robot2016/wpilib/tools/plugins/built-in/bool/icon.png new file mode 100644 index 0000000..0a44407 Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/bool/icon.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/bool/icon.svg b/Robot2016/wpilib/tools/plugins/built-in/bool/icon.svg new file mode 100644 index 0000000..2370b72 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/bool/icon.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/.jrubyfx_cache/ce51af7b129edfccc7586fa5960223cade268b4f.rb b/Robot2016/wpilib/tools/plugins/built-in/command/.jrubyfx_cache/ce51af7b129edfccc7586fa5960223cade268b4f.rb new file mode 100644 index 0000000..627fd33 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/command/.jrubyfx_cache/ce51af7b129edfccc7586fa5960223cade268b4f.rb @@ -0,0 +1,91 @@ +# 2c9c877d21e7a1f08aa83e546f2933780a6c4c9f encoding: utf-8 +# @@ 1 + +########################### DO NOT MODIFY THIS FILE ########################### +# This file was automatically generated by JRubyFX-fxmlloader on # +# 2016-01-06 20:19:14 -0500 for ../sfx/plugins/built-in/command/command.fxml +########################### DO NOT MODIFY THIS FILE ########################### + +module JRubyFX + module GeneratedAssets + class AOTce51af7b129edfccc7586fa5960223cade268b4f + include JRubyFX + def __build_via_jit(__local_fxml_controller, __local_namespace, __local_jruby_ext) + __local_fx_id_setter = lambda do |name, __i| + __local_namespace[name] = __i + __local_fxml_controller.instance_variable_set(("@#{name}").to_sym, __i) + end +(__local_sem_inst = Java.javax.script.ScriptEngineManager.new).setBindings(javax.script.SimpleBindings.new(__local_namespace)) +(__local_sem_lang_inst_javascript = __local_sem_inst.getEngineByName("javascript")).setBindings(__local_sem_inst.getBindings(), javax.script.ScriptContext.ENGINE_SCOPE) +build(Java::DashfxControls::DataHBox) do + setId("base") + __local_fx_id_setter.call("base", self) + __local_jruby_ext[:on_root_set].call(self) if __local_jruby_ext[:on_root_set] + __local_sem_lang_inst_javascript.eval("\n\t\tvar stopp = null\n\t\tvar startt = null;\n\t\tvar swapper = function(ov, old, running) {\n\t\t\tstopp.setVisible(running);\n\t\t\tstartt.setVisible(!running);\n\t\t};\n\t\tvar runnerVp = null;\n\t\tfunction replaced()\n\t\t{\n\t\t\t/*if (runnerVp != null)\n\t\t\t {\n\t\t\t runnerVp[\"removeListener(javafx.beans.value.ChangeListener)\"](swapper);\n\t\t\t }*/\n\t\t\trunnerVp = base.getObservable(\"running\");\n\t\t\trunnerVp[\"addListener(javafx.beans.value.ChangeListener)\"](swapper);\n\t\t\tstartt = start;\n\t\t\tstopp = stop;\n\t\t\tif (typeof runnerVp == \"boolean\")\n\t\t\t{\n\t\t\t\tswapper(null, null, runnerVp.getValue());\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tswapper(null, null, false);\n\t\t\t}\n\t\t}\n\n\t\tfunction run_command()\n\t\t{\n\t\t\trunnerVp.setValue(true);\n\t\t}\n\t\tfunction stop_command()\n\t\t{\n\t\t\trunnerVp.setValue(false);\n\t\t}\n\t") + getChildren.add(build(Java::DashfxLibControlsFxmlutils::CollapsableHBox) do + getChildren.add(build(Java::JavafxSceneControl::Button) do + setId("start") + __local_fx_id_setter.call("start", self) + setGraphic(build(Java::JavafxSceneImage::ImageView) do + setImage(build(FxmlBuilderBuilder, {"url"=>java.net.URL.new(__local_namespace['location'], "media-playback-start.png").to_s}, Java::JavafxSceneImage::Image) do + end) + setFitHeight(32.0) + setFitWidth(32.0) + setMouseTransparent(true) + setPickOnBounds(true) + setPreserveRatio(true) + end) + setStyle("-fx-background-color: transparent; -fx-margin: 0; -fx-padding: 0;") + setContentDisplay(Java::javafx::scene::control::ContentDisplay::GRAPHIC_ONLY) + setMaxHeight(1.7976931348623157e+308) + setMnemonicParsing(false) + setPrefWidth(48.0) + setText("Run") + setOnAction(ScriptEventHandler.new("run_command();", __local_sem_lang_inst_javascript)) + end) + getChildren.add(build(Java::JavafxSceneControl::Button) do + setId("stop") + __local_fx_id_setter.call("stop", self) + setGraphic(build(Java::JavafxSceneImage::ImageView) do + setImage(build(FxmlBuilderBuilder, {"url"=>java.net.URL.new(__local_namespace['location'], "media-playback-stop.png").to_s}, Java::JavafxSceneImage::Image) do + end) + setFitHeight(32.0) + setFitWidth(32.0) + setMouseTransparent(true) + setPickOnBounds(true) + setPreserveRatio(true) + end) + setStyle("-fx-background-color: transparent; -fx-margin: 0; -fx-padding: 0;") + setContentDisplay(Java::javafx::scene::control::ContentDisplay::GRAPHIC_ONLY) + setMaxHeight(1.7976931348623157e+308) + setMnemonicParsing(false) + setPrefWidth(48.0) + setText("Stop") + setOnAction(ScriptEventHandler.new("stop_command();", __local_sem_lang_inst_javascript)) + end) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("Name") + __local_fx_id_setter.call("Name", self) + setControlPath("Label") + setPropList("name: name") + setMaxHeight(1.7976931348623157e+308) + setMaxWidth(1.7976931348623157e+308) + Java::JavafxSceneLayout::HBox.setHgrow(self, Java::javafx::scene::layout::Priority::ALWAYS) + end) + setStyle("/*Intentionally blank*/") + setAlignment(Java::javafx::geometry::Pos::CENTER_LEFT) + setDataMode(Java::dashfx::lib::data::DataPaneMode::Nested) + setOnRegisterRequest(ScriptEventHandler.new("replaced()", __local_sem_lang_inst_javascript)) +end + end + + def hash + "2c9c877d21e7a1f08aa83e546f2933780a6c4c9f" + end + def compiled? + true + end + end + end +end diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/command.fxml b/Robot2016/wpilib/tools/plugins/built-in/command/command.fxml new file mode 100644 index 0000000..5d7550a --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/command/command.fxml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + var stopp = null + var startt = null; + var swapper = function(ov, old, running) { + stopp.setVisible(running); + startt.setVisible(!running); + }; + var runnerVp = null; + function replaced() + { + /*if (runnerVp != null) + { + runnerVp["removeListener(javafx.beans.value.ChangeListener)"](swapper); + }*/ + runnerVp = base.getObservable("running"); + runnerVp["addListener(javafx.beans.value.ChangeListener)"](swapper); + startt = start; + stopp = stop; + if (typeof runnerVp == "boolean") + { + swapper(null, null, runnerVp.getValue()); + } + else + { + swapper(null, null, false); + } + } + + function run_command() + { + runnerVp.setValue(true); + } + function stop_command() + { + runnerVp.setValue(false); + } + + + + + + + + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/icon.png b/Robot2016/wpilib/tools/plugins/built-in/command/icon.png new file mode 100644 index 0000000..04358d9 Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/command/icon.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/icon.svg b/Robot2016/wpilib/tools/plugins/built-in/command/icon.svg new file mode 100644 index 0000000..07cc268 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/command/icon.svg @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-start.png b/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-start.png new file mode 100644 index 0000000..dd4eea7 Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-start.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-stop.png b/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-stop.png new file mode 100644 index 0000000..1c99f8b Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/command/media-playback-stop.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/manifest.yml b/Robot2016/wpilib/tools/plugins/built-in/manifest.yml new file mode 100644 index 0000000..ae3549b --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/manifest.yml @@ -0,0 +1,54 @@ +API: 0.1 +Name: Built-in sfx controls +Description: Built in -fx:smartdashboard controls from sfx.jar +Version: 0.0.1a1 +Plugin ID: 611C21A7-6D24-4F51-81D6-E5615F59DADA +Controls: +- + Name: RedGreen + Description: Boolean control using Red and Green + Image: /bool/icon.png + Source: /bool/BadBool.fxml + Types: Boolean + Category: General + Defaults: + value: false +- + Name: PID Editor + Description: Default testing PID editor/viewer + Source: /pid/PIDParent.fxml + Image: /pid/pidicon.png + Group Type: PIDController + Category: General + Save Children: false + Sealed: true + Placeholders: [p, i, d, ff, set, disabled] +- + Name: Command + Description: Default testing PID editor/viewer + Source: /command/command.fxml + Image: /command/icon.png + Group Type: Command + Category: General + Save Children: false + Sealed: true + Placeholders: [Name] +- + Name: Subsystem + Description: Default Subsystem + Source: /subsystem/subsystem.fxml + Group Type: Subsystem + Category: General + Save Children: false + Sealed: true + Placeholders: [command] +- + Name: Tab Switcher + Description: Handy movable tab switcher + Image: /tab-switcher/icon.png + Source: /tab-switcher/tab_switcher.rb + Class: SD::CoreExt::TabSwitcher + Category: General + Save Children: false + Sealed: true + diff --git a/Robot2016/wpilib/tools/plugins/built-in/pid/.jrubyfx_cache/cc169a7ed334897bab8166f0453a93a3f710aa61.rb b/Robot2016/wpilib/tools/plugins/built-in/pid/.jrubyfx_cache/cc169a7ed334897bab8166f0453a93a3f710aa61.rb new file mode 100644 index 0000000..eff84d0 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/pid/.jrubyfx_cache/cc169a7ed334897bab8166f0453a93a3f710aa61.rb @@ -0,0 +1,155 @@ +# b4925062eadef949cb128dca41ccf80b1fbc91d0 encoding: utf-8 +# @@ 1 + +########################### DO NOT MODIFY THIS FILE ########################### +# This file was automatically generated by JRubyFX-fxmlloader on # +# 2016-01-06 20:19:15 -0500 for ../sfx/plugins/built-in/pid/PIDParent.fxml +########################### DO NOT MODIFY THIS FILE ########################### + +module JRubyFX + module GeneratedAssets + class AOTcc169a7ed334897bab8166f0453a93a3f710aa61 + include JRubyFX + def __build_via_jit(__local_fxml_controller, __local_namespace, __local_jruby_ext) + __local_fx_id_setter = lambda do |name, __i| + __local_namespace[name] = __i + __local_fxml_controller.instance_variable_set(("@#{name}").to_sym, __i) + end + +build(Java::DashfxControls::DataGridPane) do + __local_jruby_ext[:on_root_set].call(self) if __local_jruby_ext[:on_root_set] + with(getUi) do +getChildren.add(build(Java::JavafxSceneControl::Label) do + setText("P:") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 0) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 0) + end) + getChildren.add(build(Java::JavafxSceneControl::Label) do + setText("I:") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 0) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 1) + end) + getChildren.add(build(Java::JavafxSceneControl::Label) do + setText("D:") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 0) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 2) + end) + getChildren.add(build(Java::JavafxSceneControl::Label) do + setText("FF:") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 0) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 3) + end) + getChildren.add(build(Java::JavafxSceneControl::Label) do + setText("Set:") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 0) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 4) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("disabled") + __local_fx_id_setter.call("disabled", self) + setControlPath("RedGreen") + setPropList("name: disabled") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setColumnSpan(self, 1) + Java::JavafxSceneLayout::GridPane.setHalignment(self, Java::javafx::geometry::HPos::CENTER) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 5) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("d") + __local_fx_id_setter.call("d", self) + setControlPath("Number Box") + setPropList("name: d") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 2) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("i") + __local_fx_id_setter.call("i", self) + setControlPath("Number Box") + setPropList("name: i") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 1) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("p") + __local_fx_id_setter.call("p", self) + setControlPath("Number Box") + setPropList("name: p") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 0) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("ff") + __local_fx_id_setter.call("ff", self) + setControlPath("Number Box") + setPropList("name: f") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 3) + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("set") + __local_fx_id_setter.call("set", self) + setControlPath("Number Box") + setPropList("name: setpoint") + Java::JavafxSceneLayout::GridPane.setColumnIndex(self, 1) + Java::JavafxSceneLayout::GridPane.setRowIndex(self, 4) + end) + getColumnConstraints.add(build(Java::JavafxSceneLayout::ColumnConstraints) do + setHalignment(Java::javafx::geometry::HPos::RIGHT) + setHgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + setMinWidth(10.0) + setPrefWidth(-1.0) + end) + getColumnConstraints.add(build(Java::JavafxSceneLayout::ColumnConstraints) do + setHgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + setMinWidth(10.0) + setPrefWidth(100.0) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + getRowConstraints.add(build(Java::JavafxSceneLayout::RowConstraints) do + setMinHeight(10.0) + setPrefHeight(30.0) + setVgrow(Java::javafx::scene::layout::Priority::SOMETIMES) + end) + setHgap(6.0) + setPrefHeight(-1.0) + setVgap(6.0) + setStyle("/*Intentionally blank*/") +end + setDataMode(Java::dashfx::lib::data::DataPaneMode::Nested) +end + end + + def hash + "b4925062eadef949cb128dca41ccf80b1fbc91d0" + end + def compiled? + true + end + end + end +end diff --git a/Robot2016/wpilib/tools/plugins/built-in/pid/PIDParent.fxml b/Robot2016/wpilib/tools/plugins/built-in/pid/PIDParent.fxml new file mode 100644 index 0000000..432cf33 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/pid/PIDParent.fxml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.png b/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.png new file mode 100644 index 0000000..b6d978d Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.svg b/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.svg new file mode 100644 index 0000000..e9e638a --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/pid/pidicon.svg @@ -0,0 +1,655 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + PID + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/subsystem/.jrubyfx_cache/c43f0db19d95c1f21829c7e961d536a3fbb293dd.rb b/Robot2016/wpilib/tools/plugins/built-in/subsystem/.jrubyfx_cache/c43f0db19d95c1f21829c7e961d536a3fbb293dd.rb new file mode 100644 index 0000000..2a291ae --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/subsystem/.jrubyfx_cache/c43f0db19d95c1f21829c7e961d536a3fbb293dd.rb @@ -0,0 +1,61 @@ +# 7593fc32521b145675cd06984830a1e89fe9bf16 encoding: utf-8 +# @@ 1 + +########################### DO NOT MODIFY THIS FILE ########################### +# This file was automatically generated by JRubyFX-fxmlloader on # +# 2016-01-06 20:19:14 -0500 for ../sfx/plugins/built-in/subsystem/subsystem.fxml +########################### DO NOT MODIFY THIS FILE ########################### + +module JRubyFX + module GeneratedAssets + class AOTc43f0db19d95c1f21829c7e961d536a3fbb293dd + include JRubyFX + def __build_via_jit(__local_fxml_controller, __local_namespace, __local_jruby_ext) + __local_fx_id_setter = lambda do |name, __i| + __local_namespace[name] = __i + __local_fxml_controller.instance_variable_set(("@#{name}").to_sym, __i) + end +(__local_sem_inst = Java.javax.script.ScriptEngineManager.new).setBindings(javax.script.SimpleBindings.new(__local_namespace)) +(__local_sem_lang_inst_javascript = __local_sem_inst.getEngineByName("javascript")).setBindings(__local_sem_inst.getBindings(), javax.script.ScriptContext.ENGINE_SCOPE) +build(Java::DashfxControls::DataHBox) do + setId("base") + __local_fx_id_setter.call("base", self) + __local_jruby_ext[:on_root_set].call(self) if __local_jruby_ext[:on_root_set] + __local_sem_lang_inst_javascript.eval("\n\t\tvar nonelbll = null\n\t\tvar commandd = null;\n\t\tvar swapper = function(ov, old, running) {\n\t\t\tcommandd.setVisible(running);\n\t\t\tnonelbll.setVisible(!running);\n\t\t};\n\t\tvar runnerVp = null;\n\t\tfunction replaced()\n\t\t{\n\t\t\trunnerVp = base.getObservable(\"hasCommand\");\n\t\t\trunnerVp[\"addListener(javafx.beans.value.ChangeListener)\"](swapper);\n\t\t\tnonelbll = nonelbl;\n\t\t\tcommandd = command;\n\t\t\tif (typeof runnerVp == \"boolean\")\n\t\t\t{\n\t\t\t\tswapper(null, null, runnerVp.getValue());\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tswapper(null, null, false);\n\t\t\t}\n\t\t}\n\t") + getChildren.add(build(Java::JavafxSceneControl::Label) do + textProperty.bind(RRExpressionValue.new(__local_namespace, Java::org.jruby.jfx8.Expression.valueOf("base.baseName"), Java::java::lang::String.java_class)) + end) + getChildren.add(build(Java::JavafxSceneControl::Label) do + setText(": ") + end) + getChildren.add(build(Java::DashfxLibControlsFxmlutils::CollapsableHBox) do + getChildren.add(build(Java::JavafxSceneControl::Label) do + setId("nonelbl") + __local_fx_id_setter.call("nonelbl", self) + setText("None") + end) + getChildren.add(build(Java::DashfxLibControls::Placeholder) do + setId("command") + __local_fx_id_setter.call("command", self) + setControlPath("Label") + setPropList("name: command") + setMaxHeight(1.7976931348623157e+308) + setMaxWidth(1.7976931348623157e+308) + end) + end) + setStyle("/*Intentionally blank*/") + setDataMode(Java::dashfx::lib::data::DataPaneMode::Nested) + setAlignment(Java::javafx::geometry::Pos::CENTER_LEFT) + setOnRegisterRequest(ScriptEventHandler.new("replaced()", __local_sem_lang_inst_javascript)) +end + end + + def hash + "7593fc32521b145675cd06984830a1e89fe9bf16" + end + def compiled? + true + end + end + end +end diff --git a/Robot2016/wpilib/tools/plugins/built-in/subsystem/subsystem.fxml b/Robot2016/wpilib/tools/plugins/built-in/subsystem/subsystem.fxml new file mode 100644 index 0000000..be1adde --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/subsystem/subsystem.fxml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + var nonelbll = null + var commandd = null; + var swapper = function(ov, old, running) { + commandd.setVisible(running); + nonelbll.setVisible(!running); + }; + var runnerVp = null; + function replaced() + { + runnerVp = base.getObservable("hasCommand"); + runnerVp["addListener(javafx.beans.value.ChangeListener)"](swapper); + nonelbll = nonelbl; + commandd = command; + if (typeof runnerVp == "boolean") + { + swapper(null, null, runnerVp.getValue()); + } + else + { + swapper(null, null, false); + } + } + + + + + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.png b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.png new file mode 100644 index 0000000..2f83b97 Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.png differ diff --git a/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.svg b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.svg new file mode 100644 index 0000000..cd064d9 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/icon.svg @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + tab + + diff --git a/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/tab_switcher.rb b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/tab_switcher.rb new file mode 100644 index 0000000..0b27373 --- /dev/null +++ b/Robot2016/wpilib/tools/plugins/built-in/tab-switcher/tab_switcher.rb @@ -0,0 +1,62 @@ +# Copyright (C) 2013 patrick +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +module SD::CoreExt + class TabSwitcher < Java::JavafxSceneLayout::HBox + include JRubyFX + def initialize + super() + self.spacing = 6 + self.padding = [6,6,6,6] + self.style_class << "tab-switcher" + @designer = SD::Designer.instance + rebuild_menu + @designer.view_controllers.add_change_listener do + rebuild_menu + end + @designer.vc_index_property.add_change_listener do + refocus_menu + end + end + + def rebuild_menu + @bt_map = {} + children.clear + children.add_all *@designer.view_controllers.map { |vc| + Button.new(vc.name).tap do |btn| + btn.set_on_action {@designer.tab_select vc.tab} + @bt_map[btn] = vc + end + }.tap {|btns| @btns = btns; btns[@designer.vc_index].style_class << "active" } + end + + def refocus_menu + @btns.each {|btn| btn.style_class.remove "active"} + @btns[@designer.vc_index].style_class << "active" + end + + def getUi + return self + end + + def ui + return self + end + + def registered(stuff) + # do nut'in + end + end +end diff --git a/Robot2016/wpilib/tools/plugins/livewindowplugin.jar b/Robot2016/wpilib/tools/plugins/livewindowplugin.jar new file mode 100644 index 0000000..c04ddc3 Binary files /dev/null and b/Robot2016/wpilib/tools/plugins/livewindowplugin.jar differ diff --git a/Robot2016/wpilib/tools/sfx.jar b/Robot2016/wpilib/tools/sfx.jar new file mode 100644 index 0000000..29d19b7 Binary files /dev/null and b/Robot2016/wpilib/tools/sfx.jar differ diff --git a/Robot2016/wpilib/wpilib.properties b/Robot2016/wpilib/wpilib.properties new file mode 100644 index 0000000..d5f6a11 --- /dev/null +++ b/Robot2016/wpilib/wpilib.properties @@ -0,0 +1,4 @@ +#Don't add new properties, they will be deleted by the eclipse plugin. +#Thu Jan 28 10:16:33 EST 2016 +version=current +team-number=1786