Compare commits

...

211 Commits

Author SHA1 Message Date
Alex Henning
8856927fd8 Added support for Jenkins to generate doxygen.
Change-Id: I2febfe42cc9301446f796376cfe8e1ef6744f19a
2014-08-12 15:06:43 -04:00
Alex Henning
66e1f2a184 Fixed a few bugs with C++ due to the merge.
Change-Id: I6c5120ff502b40ecba0884f5a3631fa91822cfd4
2014-08-12 10:12:55 -04:00
Alex Henning
1301d76d61 Fixes for HLUsageReporting due to Jonathan's exceptions.
Change-Id: I28d6719d0b8f5a71186f6a764c9541277aea6237
2014-08-11 14:59:21 -04:00
Thomas Clark
a72ea14f92 Removed Simple Robot template option
Remove the option in Eclipse to make a "Simple Robot" project, since
there is no more simple robot template and the resulting project isn't
even generated correctly.

Change-Id: I06a9db8c7f5fb82b7be3eadb1f91813321a36119
2014-08-11 12:01:38 -04:00
Thomas Clark
14b2f14669 Merge "Implement DriverStation::GetBatteryVoltage" 2014-08-11 08:56:52 -07:00
Thomas Clark
d2cd5f3571 Implement DriverStation::GetBatteryVoltage
Make the GetBatteryVoltage method work using the new tPower header

Change-Id: If504f8a46f3f7f737f0b729b72fc6b5da0d29ff9
2014-08-11 11:56:10 -04:00
Jonathan Leitschuh (WPI)
7ecde3a33a Merge "Fix the default C++ linker settings" 2014-08-11 08:55:50 -07:00
Alex Henning (WPI)
81143fc534 Merge "Adds Exception throwing the basic robot systems are not properly initialized." 2014-08-11 08:53:37 -07:00
Thomas Clark
c58a86a3ab Fix the default C++ linker settings
Change-Id: I839b67fa6e9798f980db05f5a4ff9c8f47c32424
2014-08-11 11:27:48 -04:00
Alex Henning (WPI)
2f655bb49d Merge "Fixed bug with plugins not including all simulation dependencies." 2014-08-11 08:22:15 -07:00
Alex Henning
657054c9e2 Fixed bug with plugins not including all simulation dependencies.
Change-Id: I34c84c6cd4d918039726aa2efb81efbcf98dd593
2014-08-11 11:20:07 -04:00
Kacper Puczydlowski
f4d542b212 Add FakeEncoderTest for C++
Change-Id: Ic030a1d055a03f5b245e19e6466af05e72dd7deb
2014-08-11 11:15:42 -04:00
Alex Henning
8db11a4c6c Fix to deal with the certificates on collabnet having expired.
Change-Id: I0c7580f06107d59dfc32b343304529b17763c7fa
2014-08-11 08:13:08 -04:00
Joe Ross
14d784bca1 Fix import, resolves artf3339
Change-Id: I0abed3495ffc35161793f3a6140fb21872004866
2014-08-10 17:01:31 -07:00
Alex Henning
7c8124d76c Allowed sharing of common C++ code between RoboRIO and Simulation.
Change-Id: I8bf2bda9df389c13ae0567a62dbf0ca931ceb6f8
2014-08-08 18:36:03 -04:00
Thomas Clark (WPI)
b371600f0f Merge "Completed artf2675 - rename SimpleRobot -> SampleRobot." 2014-08-08 12:39:14 -07:00
Thomas Clark (WPI)
6c3b002a87 Merge "Refactors the CANJaguar tests to be more straightforward." 2014-08-08 12:14:24 -07:00
Colby Skeggs
0f93247641 Completed artf2675 - rename SimpleRobot -> SampleRobot.
Change-Id: I23fc503f64fa6a715867f4b92f9d03e21f6c5f82
2014-08-08 10:50:16 -07:00
Jonathan Leitschuh
54439e7198 Refactors the CANJaguar tests to be more straightforward.
Adds a brownout test from C++ (Ignored)

Change-Id: I81e04e20fb08cd9da7401d9c0e9fa6faf1fff0de
2014-08-08 12:10:56 -04:00
Thomas Clark
5b8279f404 Remove old driver station code
We don't need to send status data from the user program anymore

Change-Id: Ifbdb037cfb4e36681914dd7a3a2f5c56cbead6a2
2014-08-08 11:23:03 -04:00
Thomas Clark
8abbcf53f4 Update to the v13 headers and libraries
Add all of the most recent headers and .SOs

Also make DriverStation work with the new FRC comm protocol, using the new
functions for getting status data

Change-Id: I1c7fc5f90e72c5fbebf87d9923ce0967ed0ef3bc

Initial HAL support for v13 ds

Change-Id: I9a7f37ef8e24241598fa3981cb3df30c07c52e0f

New ds stuff in the HAL

Change-Id: I025910625453baf63f79f49bbc70ba8b2f093f50

New ds stuff in C++

Joysticks are still todo

Driver station IO is pulled out

Change-Id: I1bb59037c097713bd943e7bef00e12f67f13c3ac

New ds works in C++ and Java.  Joysticks still todo

Change-Id: Ic93f8686856761badc592eceaf05964f52355578

Make joysticks work again with the v13 image protocol

Change-Id: Ief7ee95d3398c2262ca07ab7d60499af3c8f60f7
2014-08-07 16:37:02 -04:00
Thomas Clark (WPI)
b8eeeabbb5 Merge "Removes encoder.start() from the example programs" 2014-08-07 13:18:42 -07:00
Jonathan Leitschuh
9a2bd8c49b Removes encoder.start() from the example programs
Change-Id: I26a9901a978481bb37fdb6eac6a2457c2ca990b8
2014-08-07 16:17:35 -04:00
Thomas Clark
4db634b342 Fix PCM channel indexes
The channels are fixed to correspond with the little-endian beta firmware

Change-Id: I1de0588c74a0e070c647fc2e5e629e47df3b663d
2014-08-07 13:20:39 -04:00
Thomas Clark (WPI)
57e670c18d Merge "Move PWM allocation to HAL to allow for checking against DIO allocation Re-number MXP DIO to match pinout (include SPI and I2C pins) (fixes artf2664) Change PWM MXP mapping to accommodate DIO re-mapping This re-implementation also fixes artf2668 for C++ and Java Change the test bench to reflect this change also" 2014-08-07 07:45:28 -07:00
Kevin O'Connor
59473ab7a7 Move PWM allocation to HAL to allow for checking against DIO allocation
Re-number MXP DIO to match pinout (include SPI and I2C pins) (fixes artf2664)
Change PWM MXP mapping to accommodate DIO re-mapping
This re-implementation also fixes artf2668 for C++ and Java
Change the test bench to reflect this change also

Change-Id: If30bd6a85a9f1f619fbde06a4ecd595a15fd28f7
2014-08-07 10:43:50 -04:00
Jonathan Leitschuh (WPI)
d1d4c75210 Merge "Fixed interrupt freeing in C++" 2014-08-06 06:57:11 -07:00
Thomas Clark
2356008d8c Fixed interrupt freeing in C++
When interrupts are cancelled on any interruptable class, the resource is now
freed.  Previously, the resource was only freed if the object is destructed
before CancelInterrupts() is called, so it was impossible to create and
destruct more than 8 interrupts.

The interrupts resource object is now in InterruptableSensorBase instead of
SensorBase.

A synchronous interrupt integration test was added.

Change-Id: I0806176340cecd4c1480dd8f043474cc05919f24
2014-08-06 09:46:50 -04:00
Thomas Clark
deb335d96d Fixed DoubleSolenoid, added a double solenoid test
Change-Id: I161337c8b528be7662650889d6ab7bcd2bbe2704

Fixed double solenoid, added a C++ test

Change-Id: Ib0821155efce85be87d354fc8e197fcc4deabd7c
2014-08-05 15:29:02 -04:00
Thomas Clark
1ce03b9c46 DoubleSolenoid works in C++ now
Change-Id: I75130f816efe8ef9c82e936bba834609c470f379
2014-08-05 14:42:37 -04:00
Thomas Clark
a09f75934a The output range can be set on a PIDSubSystem
Also, mimimum -> minimum in PIDController.h

Change-Id: I0cdfdca6ca2bdf2c2a40ee524cc925281069fcf4
2014-08-05 14:03:02 -04:00
Jonathan Leitschuh
aab98c0638 Adds Exception throwing the basic robot systems are not properly initialized.
Adds a BaseSystemNotInitalizedException to be thrown in the event that HLUsageRepoting, RobotState or Timer does not have its static implementation set.

Change-Id: I66fde262baa1a9d32d1df9fafa08ba3173bcbb72
2014-08-05 13:44:21 -04:00
Jonathan Leitschuh (WPI)
741e28b855 Merge "Added version numbers to maven plugins" 2014-08-05 10:29:31 -07:00
Thomas Clark
f817f6d041 Added version numbers to maven plugins
The version numbers for several maven plugins were unspecified before, which
caused a bunch of warnings before.

Change-Id: I7e2e05ccf3e2f10b24010576eb78192e9d891120
2014-08-05 13:29:01 -04:00
Thomas Clark (WPI)
7442a7ed7d Merge "Only update FRC Java Projects (fixes artf2627)" 2014-08-05 10:19:01 -07:00
Jonathan Leitschuh (WPI)
765198f5f5 Merge "Updated some comments that mention the cRIO" 2014-08-05 10:18:25 -07:00
Thomas Clark
ed08ab2989 Fixed voltage range checking and error message
Change-Id: I7ba05eb27f3d82bfd37f6b407fe39e0ab9cf5bf0
2014-08-05 13:16:10 -04:00
Jonathan Leitschuh (WPI)
4b22742cdc Merge "Cleaned up C++ compiler warnings" 2014-08-05 09:13:40 -07:00
Alex Henning (WPI)
45f93e9aba Merge "Added support for building debs on jenkins." 2014-08-05 09:04:04 -07:00
Alex Henning
049377c9ea Added support for building debs on jenkins.
Change-Id: Iec732b3a0d036e53e02e377b830f8af6b8eaf731
2014-08-05 11:54:15 -04:00
Thomas Clark
f4ace4a36d Cleaned up C++ compiler warnings
All C++ projects now build without warnings with -Wall and -Wextra

Change-Id: Idb6cf8b78274a30453e98c1e8edabcfb2a7fffb6
2014-08-05 11:51:00 -04:00
Thomas Clark
9ff420547a Updated some comments that mention the cRIO
Change-Id: Ib5e3c34fa2db83f48ca88153e8f4c834b31291f5
2014-08-05 11:17:38 -04:00
Jonathan Leitschuh (WPI)
1be31431bc Merge "Removed the User LED functions" 2014-08-05 07:37:03 -07:00
Thomas Clark
32cafd0efc Removed the User LED functions
There is no "User" LED on the RoboRIO, these functions didn't
do anything.

Change-Id: I8d2eaf0efde90cc444503a79f26d591ddaaa6322
2014-08-05 10:35:00 -04:00
Jonathan Leitschuh (WPI)
0216d1b336 Merge "Gyro deadband defaults to 0" 2014-08-05 07:31:29 -07:00
Thomas Clark
43c566bd86 Gyro deadband defaults to 0
The gyro class no longer attempts to set a default deadband, but it still
has an optional SetDeadband() method.

The gyro integration tests were modified and still pass consistently.

Change-Id: I08a97b00b98b49b0a3c63306fcc809857523af2b
2014-08-05 10:25:42 -04:00
Thomas Clark
b86c747226 Only set up once in the C++ tests
TestEnvironment::SetUp() will only initialize the first time it's called.
This allows the --gtest_repeat flag to be used to automatically repeat
the tests.

Change-Id: I20c857a37a88f48114d74ae68518d4a9d724d012
2014-08-05 09:29:07 -04:00
Thomas Clark
60a3fd0698 Added gyro deadbands
During calibration, the Gyro class sets the accumulator deadband to contain
whatever the farthest sample from the center was.  The integration test
passes now.

A SetDeadBand method was added to the Gyro class for teams to set their own
deadbands.

Change-Id: Idbe4c279e2991b4daed4d4cf3bfaf605d4ee25c0
2014-08-04 17:44:04 -04:00
Kevin O'Connor
b86c114939 Only update FRC Java Projects (fixes artf2627)
Change-Id: I62715ab5ed01d1d6c6ee1a877fad3d12a5c0219b
2014-08-04 16:35:28 -04:00
Jonathan Leitschuh (WPI)
14f201cd36 Merge "getAnalogAverageValue should use a 32-bit int" 2014-08-04 13:17:07 -07:00
Thomas Clark
c49ea255b9 getAnalogAverageValue should use a 32-bit int
getAnalogAverageValue gets a 32-bit integer and returns it as an int32_t,
but previously it stored the intermediate value as a 16-bit int.

Change-Id: I0a8b0cd3b3ff9b1ff40ad7942170f633c44c127b
2014-08-04 16:08:58 -04:00
Kevin O'Connor
065e1c24eb Update plugin menu text and make template menu options only show for correct language (fixes artf2408)
Change-Id: I13b80ab43aa79bd1aa8d12b7a8331a602a976bd0
2014-08-04 16:05:24 -04:00
Kevin O'Connor
ecdb77e4be Update plugin target to use mDNS (causes Java debug to now use mDNS)
Change-Id: I570b6e99282583b343e3dcb7f072a707726804e3
2014-08-04 16:01:53 -04:00
Jonathan Leitschuh (WPI)
10aad6d1c8 Merge "Fixed a few more small TODOs" 2014-08-04 12:41:34 -07:00
Thomas Clark
e73c8d06eb Fixed a few more small TODOs
Timer::Get now compensates for the FPGA time rolling over after 71 minutes

UltraSonic::Ping doesn't bother disabling automatic mode, since it asserts
that it's not in automatic mode on the line before.

Change-Id: I6b0f45327c453abd8a846ec8da0f9676e210d909
2014-08-04 15:25:41 -04:00
Thomas Clark
dc341a448e Fixed a few simple SmartDashboard FIXMEs and TODOs
SmartDashboard does usage reporting now (or will when it's implemented
in the HAL).

Global errors are raised in C++ when problems happen, since there is
no SmartDashboard instance.  Previously, no error reporting was done
at all.

GetData was uncommented.

Change-Id: I3331eb9f09924d1d0028e3fa041f0cf68caa5cf5
2014-08-04 14:43:31 -04:00
Thomas Clark
d521eb79b9 Analog interrupts in C++
Analog interrupts now work in C++.

The interrupts Resource was moved from a global in DigitalInput
to a static member of SensorBase.

An analog interrupt IT was added, and the digital interrupt one modified
to prevent a linker error.

Change-Id: I9a300daafed15e9666a4ccb405a509615e3dbb06
2014-08-04 13:45:16 -04:00
Thomas Clark (WPI)
f57a2dc5a9 Merge "Change deploys to use MDNS and to retry tail on missing file (fixes artf2663)" 2014-08-04 07:54:23 -07:00
Kevin O'Connor
7006d1ebc4 Change deploys to use MDNS and to retry tail on missing file (fixes artf2663)
Change-Id: I3223868968ae1d55314d76018a5dd98eaac14255
2014-08-04 10:52:37 -04:00
Thomas Clark (WPI)
c32e5707d4 Merge "Remove extra semi-colon" 2014-08-04 07:47:26 -07:00
Jonathan Leitschuh (WPI)
c27da3587d Merge "Added an interrupt test for C++" 2014-08-04 07:25:30 -07:00
Joe Ross
f18cccbc30 Remove extra semi-colon
Change-Id: I90052addd8ea499ce794d110b6945e9c7d7379cf
2014-08-03 18:08:03 -07:00
Thomas Clark
b91b681430 Added an interrupt test for C++
Change-Id: Ib2f3c575907848082c5d382144bb0462efa64107
2014-08-01 18:11:02 -04:00
Thomas Clark
b26667f866 Fixed the PCM test solenoid numbers
The numbering of the PCM channels is different in the latest firmware

Change-Id: Ib7cb5e69f7b6f076a424358ff61653a4c8ad33af
2014-08-01 17:18:46 -04:00
Thomas Clark
792e3b6ccc Removed modules from the HAL and JNI bindings
Modules aren't used anymore in wpilibc and wpilibj, so the hal functions
that references them and and JNI bindings for these functions have been
pulled out.

Both Counter classes were also modified because they still referenced
modules.

Change-Id: Ic01feb145a4ed5f08cd55f140867c721f5ee7b10
2014-08-01 15:01:28 -04:00
Jonathan Leitschuh
fd4379a946 Makes the Counter.Mode an enum and adds Null Checking
Adds null checking to the AnalogTrigger, AnalogTriggerOutput, and Counter classes

Change-Id: I09e962db36dbde0479a73a47c9998de03cd6bbb5
2014-08-01 13:41:34 -04:00
Jonathan Leitschuh
a40cdf5197 Implements the AnalogTriggerType as an enumeration
Change-Id: I411104a0bec733dc0b3854470c36366f3aec7bd6
2014-08-01 12:51:26 -04:00
Thomas Clark
ba4e74d299 AnalogTrigger support in Java
Analog triggers now work in Java.

Integration tests for analog triggers are included.

A message in the C++ analog trigger IT was fixed.

Change-Id: I50007c6901b8391d32c0e81becdbe18e48a7840f
2014-08-01 12:39:19 -04:00
Jonathan Leitschuh
38583789be Fixes the TiltPanCamera test (now GyroTest)
Change-Id: I3e954e60162ce84372a2dea39803437589aaaf00
2014-07-31 16:08:14 -04:00
Thomas Clark (WPI)
45e43b627f Merge "Changes the name of the AccelerometerTest to BuiltInAccelerometerTest" 2014-07-31 13:03:48 -07:00
Jonathan Leitschuh
e837d9083a Changes the name of the AccelerometerTest to BuiltInAccelerometerTest
Change-Id: Iabbfa8c4f3688a126443993b861018068f1969c4
2014-07-31 16:03:11 -04:00
Jonathan Leitschuh (WPI)
e0e2b498a5 Merge "Accumulators wait for the next sample after reset" 2014-07-31 12:54:26 -07:00
Thomas Clark
8fe888dbc9 Accumulators wait for the next sample after reset
Analog accumulators now wait for the amount of time a full sample
(including oversampling and averaging) lasts after
AnalogInput::ResetAccumulator() is called, so they don't return
old values after being reset.

This delay should be microseconds long and will only happen
when an accumulator is reset.

A new test is is the C++ TiltPanCameraTest that tests this behavior
with the Gyro class.

Change-Id: I1b3ffdeec187959f95c5e637a6d428c9a4bc2cf4
2014-07-31 15:46:14 -04:00
Thomas Clark (WPI)
41bb0da4e6 Merge "Fixes bugs with the Gyro" 2014-07-31 12:41:40 -07:00
Jonathan Leitschuh
97ade3606e Fixes bugs with the Gyro
If the gyro was initialized with an analog input the gyro class would not be calibrated properly.
Removes unnecessary type casting.

Change-Id: I6baa72919019a33cce7d3074f8477104cbe65396
2014-07-31 15:32:03 -04:00
Jonathan Leitschuh (WPI)
2735406bfb Merge "Added a Java internal accelerometer test" 2014-07-31 11:25:26 -07:00
Thomas Clark
ab04e19aae Added a Java internal accelerometer test
Change-Id: I9cae930bbae97af6461d13776cbfc9bb87e0cac4
2014-07-31 10:59:41 -04:00
Thomas Clark (WPI)
a58288ae6d Merge "Refactors the RobotBase Setup into a method." 2014-07-31 07:39:35 -07:00
Jonathan Leitschuh
7905259e21 Refactors the RobotBase Setup into a method.
This allows the robot base setup to be used for the robot base as well as the setup for the test system.

Change-Id: I2f8e37d42c84001f4b4eff2afd7c3e1d73785d7c
2014-07-31 10:37:39 -04:00
Thomas Clark (WPI)
f018689d0e Merge "Completed artf2662: removed Start()/Stop() in Encoders and Counters." 2014-07-31 07:32:35 -07:00
Colby Skeggs
0bb13d86ea Completed artf2662: removed Start()/Stop() in Encoders and Counters.
Change-Id: I11954bb5f66e54461455637d79013c1071f5d00f
2014-07-31 10:31:36 -04:00
Jonathan Leitschuh (WPI)
526df3679a Merge "Added a C++ Preferences test" 2014-07-31 06:36:20 -07:00
Thomas Clark
d8da3e5f1f Added a C++ Preferences test
Change-Id: I6c210535dcfad7c75ff4c04ee6446147efb2fc57
2014-07-30 17:33:26 -04:00
Jonathan Leitschuh
c0af235050 Removes the dependency-reduced-pom.xml from the repository.
Also adds this file to the .gitignore

Change-Id: I731c58d4f8a96531e61598e281a769e6b13e2e86
2014-07-30 14:08:21 -04:00
Jonathan Leitschuh (WPI)
7f6ca6824e Merge "HALInitialize should be the first thing called" 2014-07-30 08:50:09 -07:00
Thomas Clark
231bb55b2a HALInitialize should be the first thing called
Constructing a new HardwareTimer before HALInitialize is called
causes segfaults sometimes in user programs, since getFPGATime assumes
that the tGlobal objected was constructed.  This problem did not appear
in integration tests, where the calls were in the correct order.

Change-Id: I95471e9e8ad7bc5d48a65893856089e35c0b091a
2014-07-30 11:26:50 -04:00
Thomas Clark
76e488061d Removed cRIO tests, NetBeans stuff, and Ant stuff
Change-Id: I066e73916ac944e3145554a49051fb3a92d8c16d
2014-07-30 10:45:58 -04:00
Thomas Clark (WPI)
5e8ea38465 Merge "Fixes the PDP test." 2014-07-30 07:35:15 -07:00
Thomas Clark
a5b72d62a1 Remove the last obsolete interface
Change-Id: I5921968b3064af53f716858092c2da3ea7522362
2014-07-29 18:01:17 -04:00
Jonathan Leitschuh
a5e15b16fd Fixes the PDP test.
Switches the PDP test to use the MotorEncoderFixture.
Also adds helpful output information when running MotorEncoderTests by displaying the current MotorEncoder under test

Change-Id: I1d14986a6ff0ebfffa87d2fd8077d7dd1eef50e3
2014-07-29 18:01:00 -04:00
Jonathan Leitschuh (WPI)
264c38a674 Merge "Removed the old "parsing" interfaces" 2014-07-29 14:45:55 -07:00
Thomas Clark (WPI)
20de3abe80 Merge "Updates the TimerTest to give a clearer output." 2014-07-29 14:42:51 -07:00
Jonathan Leitschuh
3536d47835 Updates the TimerTest to give a clearer output.
Change-Id: I4d6685392e4e3cb21b8a24607904d0c888658855
2014-07-29 17:41:57 -04:00
Thomas Clark
60a294fbad Removed the old "parsing" interfaces
Change-Id: I94ff79f36d5b61f90c2f242fa06816bf3a3b7ac2
2014-07-29 17:34:39 -04:00
Jonathan Leitschuh (WPI)
dc42a1129f Merge "The LiveWindow instance isn't a global static" 2014-07-29 14:00:31 -07:00
Thomas Clark
386dc1f16b Added AnalogTrigger tests
Change-Id: I60c3e576e100632635278e80743975daf238e904
2014-07-29 16:48:28 -04:00
Thomas Clark
038478e437 The LiveWindow instance isn't a global static
The LiveWindow singleton instance shouldn't be a global static
variable, since the order that global statics are constructed is
undefined, and it's required by other constructors.

Change-Id: I2edccc1f723f0ea41b1347379b3e3778a50afcdc
2014-07-29 16:12:23 -04:00
Thomas Clark (WPI)
26e90a988b Merge "Adds/Updates CANJava Testing Framework." 2014-07-29 12:57:08 -07:00
Jonathan Leitschuh (WPI)
d5cd47bfa1 Merge "Minor updates to the C++ CANJaguar ITs" 2014-07-29 12:52:17 -07:00
Jonathan Leitschuh
1e35ef7802 Adds/Updates CANJava Testing Framework.
Change-Id: Iabd80ebd365a05063985fa45ce62849ced17c096
2014-07-29 15:50:31 -04:00
Jonathan Leitschuh (WPI)
65607b5bc1 Merge "Fixed CANJaguar::GetOutputVoltage for negative voltages" 2014-07-29 12:48:56 -07:00
Thomas Clark
30c0cc0561 Minor updates to the C++ CANJaguar ITs
Some tests are more explicitly named now, and negative values are
tested with both voltage and current control.

Change-Id: I316ccfb7670a341e2f13f4ed3a514f283625409e
2014-07-29 15:47:45 -04:00
Jonathan Leitschuh
92bd697417 Fixes a bug where the testing framework would never set the implementation for the libraries.
Change-Id: I8f745ebd870c8dacf28b0459e3d5128195fcbb87
2014-07-29 15:30:33 -04:00
Thomas Clark
ed0df5432f Fixed CANJaguar::GetOutputVoltage for negative voltages
Previously, negative output voltages were unpacked incorrectly.

Now, they're requested as percentages, unpacked, and then scaled
in software based on the bus voltage.  The output voltage and
bus voltage shouldn't ever be out of sync, since they're in
the same message.

Change-Id: I745fffd0faa6cbaab967240271e6cfa8653212e2
2014-07-29 15:25:35 -04:00
Thomas Clark
6deb196e90 Support for the "USER" button on the RoboRIO
You can get the state of the USER button with GetUserButton() in
C++ or Utility.getUserButton() in java.

Change-Id: I923e62cab5e621ef43fed503acab5c0d751264fb
2014-07-29 14:42:08 -04:00
Jonathan Leitschuh (WPI)
8b612f713b Merge "CANJaguar::Disable stops periodic setpoints" 2014-07-29 08:39:12 -07:00
Thomas Clark
d66bafb687 CANJaguar::Disable stops periodic setpoints
Calling CANJaguar::Disable() now makes NetComms stop periodic
setpoint messages, so the motor actually stops until EnableControl()
is called again.

Change-Id: Ib4eb4ad5f729be5c74e799f02ed000511de1e03d
2014-07-29 11:09:37 -04:00
Alex Henning (WPI)
78d2ccd299 Merge "Added stack traces and better error reporting in C++" 2014-07-29 07:27:12 -07:00
Thomas Clark (WPI)
06d59447be Merge "Adds missing Javadocs and @Overrides annotations to the PIDController in Java" 2014-07-29 07:25:34 -07:00
Jonathan Leitschuh
3475a4a8c6 Adds missing Javadocs and @Overrides annotations to the PIDController in Java
Change-Id: I61bf9a31c238b44012d01d4fae11971cc7951d54
2014-07-29 10:19:54 -04:00
Thomas Clark (WPI)
6af242b556 Merge "Fixes for javadoc eclipse plugin." 2014-07-29 07:13:00 -07:00
Alex Henning
c72e704396 Fixes for javadoc eclipse plugin.
Change-Id: I629a8b22acc2073b97b3b478c8b9d52b03cfa353
2014-07-29 10:01:23 -04:00
Thomas Clark
89fe909ae6 Added stack traces and better error reporting in C++
When an error is reported or an assertion fails in C++, a line is now
printed with information about where the error occured, and a stack trace
is printed.

The stacktrace isn't implemented in the HAL because it's not
hardware-dependent, so StackTrace.hpp and StackTrace.cpp are gone.

The Eclipse project template is modified to include "-export-dynamic" in
the linker options, which is necessary for stack traces.

Change-Id: Ie86c14185b13ed603d0fe6467e87ba4f731b1913
2014-07-28 16:35:45 -04:00
Joe Ross
c1d8e4ef4b Make AnalogInput PIDGet return an average voltage. artf2391 for Java.
Equivalent to Ia7f06ca2
Previously it returned a raw value instead of a voltage.

Change-Id: I6f1bcf8fdd7f98ae62ed991f29fec35f4ffb4098
2014-07-28 08:04:10 -07:00
Alex Henning (WPI)
338120c3a5 Merge "Fixed wpi_setErrnoError to print the error name" 2014-07-28 07:05:51 -07:00
Alex Henning (WPI)
a7efbe0d7a Merge "Fixed Preferences in C++" 2014-07-28 07:04:13 -07:00
Thomas Clark (WPI)
4c78280308 Merge "Correct voltage range in javadocs for RoboRIO" 2014-07-28 06:37:02 -07:00
Joe Ross
5a3889a3aa Correct voltage range in javadocs for RoboRIO
Change-Id: I6049fac62bb4f1fb15364bd26d0511d0603c0aee
2014-07-28 09:34:48 -04:00
Thomas Clark (WPI)
2fd4964b62 Merge "ADXL345_I2C: Make constructor explicit." 2014-07-28 06:26:10 -07:00
Thomas Clark (WPI)
6ae6394548 Merge "AnalogPotentiometer: Make constructors explicit." 2014-07-28 06:25:43 -07:00
Peter Johnson
310151132d AnalogPotentiometer: Make constructors explicit.
The second and third arguments have default values, so it needs to
be explicit.

Change-Id: I893a45d750291f96983bef6b753d91f10c44d2ab
2014-07-28 00:01:42 -07:00
Peter Johnson
7f4e1e39ae ADXL345_I2C: Make constructor explicit.
The second argument has a default value, so it needs to be explicit.

Change-Id: I5c38f8f55f9c21576835c005acd8d80fe6864140
2014-07-27 23:59:59 -07:00
Peter Johnson
eebdc3d20c BuiltInAccelerometer: Add virtual destructor.
Change-Id: I38e5ca92ba6c5b395366cfd8ea35acd2a08dbdac
2014-07-27 23:52:00 -07:00
Thomas Clark
980ea96b05 Fixed Preferences in C++
The file name was never updated from the old path, a deadlock occured
sometimes.  A "resource not found" message was also set when fopen()
returns an error, which should be an errno message because it's a C
library error.

Change-Id: Ic913a08f6f5d73219cb6625198f5a4519c039956
2014-07-25 17:03:28 -04:00
Thomas Clark
1038f98e83 Fixed wpi_setErrnoError to print the error name
Previously, wpi_setErrnoError and wpi_setErrnoErrorWithContext
always printed "Unknown errno" whenever a C library error
occured.

Change-Id: Ib235138eea0e83b0d7462dfd6e834e3499e3b0c5
2014-07-25 16:52:00 -04:00
Thomas Clark
326aa2e85c Fixed a typo with the tGlobal commit
Change-Id: Ic801e9f73235cd24e9f57484c8af892c9c125075
2014-07-25 13:08:52 -04:00
Thomas Clark
6071fc7fb3 Fixed CANJaguar percent scaling issue [artf2637]
Percent mode used to be scaled incorrectly in Java because the
max output voltage was initialized to a wrong value.

Change-Id: If88bb2f1d198e13b1724afc62a522fbf91a14b5b
2014-07-25 13:01:24 -04:00
thomasclark
f958b65ba6 CANJaguar can be disabled [artf2647]
The CANJaguar class now stores a controlEnabled flag.  When disabled, it
won't verify the control mode, which involves sending enable messages.

Change-Id: I8baa48eec31de6b4d3fee2b5a074320542a1bbef
2014-07-25 12:59:47 -04:00
Brad Miller (WPI)
f4f7588cfb Merge "A few small changes to the C++ ITs" 2014-07-25 08:54:42 -07:00
Brad Miller (WPI)
80ecff6bdb Merge "AnalogInput::PIDGet returns an average voltage[artf2391]" 2014-07-25 08:52:16 -07:00
Brad Miller (WPI)
e487c950e9 Merge "Only create one tGlobal object" 2014-07-25 08:51:32 -07:00
Thomas Clark
191e9d5d6b AnalogInput::PIDGet returns an average voltage[artf2391]
Previously it returned a raw value instead of a voltage.

Change-Id: Ia7f06ca24a6c79468c7be89a07c615d7015ffef9
2014-07-25 09:41:06 -04:00
thomasclark
40fc8326aa Only create one tGlobal object
This fixes a problem with getFPGATime() blocking for around 1 second
each time it's called.

Change-Id: I8aafb725889c231ffb2c91e7cb4bbb8110474a9d
2014-07-24 18:30:13 -04:00
thomasclark
fdbe750d3d A few small changes to the C++ ITs
A PDP channel number is correct now, the deploy script was changed to
kill Java programs before running and ignore useless messages,
the "Waiting for enable" message is only printed once, and the accelerometer
test is more robust.

Change-Id: I2226140d8c3e44c452e039c27f4f1cf11c952c42
2014-07-24 18:22:31 -04:00
Jonathan Leitschuh
3ec797a8cf Updates the CANJaguar to free itself before throwing an exception in the constructor. This allows it to be allocated later without throwing an Allocation exception.
Change-Id: Ifbd15fecad92fa17a1c4b92d444b67221dacb4b5
2014-07-24 16:55:27 -04:00
Jonathan Leitschuh
78e6cf7208 Updates the AbstractComsSetup message to report JUnits multiple exceptions correctly.
Adds a simple logger to the AbstractComsSetup that prints messages to the console based on the log level.
Replaces all System.out prints with TestBench.out()

Change-Id: Ieb7acfe51aa2febe9cfd3883f8a33094c9b72a6e
2014-07-24 15:01:44 -04:00
Jonathan Leitschuh
2481e98bc8 Fixes a deallocation of the Relay resource when calling free. Changes fake "Enum Classes" into real Enumerations
Change-Id: I9d5a4760235adc9e02e41040c9973316e1f32da2
2014-07-24 13:59:21 -04:00
thomasclark
c81d510ebe CANJaguar::ChangeControlMode marks the controlmode as unverified
This previous caused a bug where the Jaguar would sometimes
behave as if it were in the wrong mode, even when everything was
verfied.

Change-Id: Id5b96e0f7e64066eaaa0e5be4ba53fca76ba0703
2014-07-24 13:54:01 -04:00
Thomas Clark (WPI)
3fb4159101 Merge "Added missing call to m_ds.waitForData()" 2014-07-24 10:41:17 -07:00
Alex Henning
2e1bd171a5 Added missing call to m_ds.waitForData()
It was accidentally deleted in a previous commit[1] and none of our
tests caught it. As a result iterative robot loops run too fast (using
extra CPU).

[1] https://usfirst.collab.net/gerrit/gitweb?p=wpilibj.git;a=blobdiff;f=WPILibJ/src/main/java/edu/wpi/first/wpilibj/IterativeRobot.java;h=0e936de8ec86a76e0a63ddbfc65ec2b88bc71725;hp=d4c5d38a14e29c926389ba1ae84fcbd09ee51f19;hb=HEAD;hpb=726ac3a3d272310b367b25f3c7e15ba6d07b957d;tflink=projects.wpilib/scm.WPILibJ

Change-Id: I663f8619406f26b7fa6fc12bce4444657b829d9f
2014-07-24 12:02:50 -04:00
Alex Henning (WPI)
25e7a077c1 Merge "Implemented FRCSim artf2628, fixed bugs in non-sim Relay.java and sim PWM.cpp." 2014-07-24 08:59:51 -07:00
Colby Skeggs
dc48dc7f7b Implemented FRCSim artf2628, fixed bugs in non-sim Relay.java and sim PWM.cpp.
Change-Id: Ic00fcd5026ce0570c79a65be178e45eeb94b3deb
2014-07-24 11:54:46 -04:00
Colby Skeggs
2dd45c3ea6 Fixed FRCSim artf2619, and misc reformatting.
Change-Id: I7133f46f88f7e2cb2451c2a6714daa8f3f368b40
2014-07-23 14:43:11 -07:00
Jonathan Leitschuh (WPI)
461e359484 Merge "Remove the Kinect code from C++" 2014-07-23 13:57:20 -07:00
thomasclark
78dac49cf6 Remove the Kinect code from C++
Change-Id: Ifef909a8948f1d0f881bf394b9a3ba925644306f
2014-07-23 16:55:45 -04:00
thomasclark
66ba9a728e Fixed some bugs with CANJaguar verification in Java
Change-Id: I5f6510d53c806845f6bae5eb8fd9ebbc8fde054e
2014-07-23 16:33:57 -04:00
Jonathan Leitschuh (WPI)
c3d1e80a62 Merge "Fixed some bugs with CANJaguar verification in C++" 2014-07-23 12:48:17 -07:00
Jonathan Leitschuh (WPI)
01ca19f78f Merge "Added a Jaguar brownout test in C++, cleaned up some C++ tests" 2014-07-23 12:46:27 -07:00
thomasclark
202bfb2959 Added a Jaguar brownout test in C++, cleaned up some C++ tests
Change-Id: I8fe26c0c3fab35bf783f6c5dfe0c16a991ec06cd
2014-07-23 15:24:39 -04:00
thomasclark
b0369342e9 Fixed some bugs with CANJaguar verification in C++
Change-Id: I3f17c090e26c6019523eb92eb47714464aa01baf
2014-07-23 15:22:26 -04:00
Alex Henning
26d101caf9 Restructure WPILibJ to share code.
wpilibJavaDevices now contains RoboRIO specific code and wpilibJava has
shared high level information. The restructuring was mostly just copy
and paste. The three big exceptions are Timer, RobotState and
HLUsageReporting. Those require some dependencies injection since that
appears to be the cleanest way to share the code.

Change-Id: Ie7011e32bc95953a87801a9905b3bfec7f8de285
2014-07-23 14:11:52 -04:00
Jonathan Leitschuh
e84e0ebab8 Updates the TestBench to use parameters to run specific test methods or test/suite classes.
Updates the test bench to only print "Waiting for enable" on one line with a counter.
Updates all SubSuites to extend the AbstractTestSuite class.
Also includes a small set of tests to prove the validity of the base AbstractTestSuite

Change-Id: I447ca2537a08c84ab1d69fa200cb8125b448a589
2014-07-23 10:43:42 -04:00
Jonathan Leitschuh (WPI)
0704a697ce Merge "Updated the C++ TiltPanCameraTest" 2014-07-23 07:02:46 -07:00
Jonathan Leitschuh (WPI)
13f97bb6e3 Merge "Added an Accelerometer interface" 2014-07-23 06:57:42 -07:00
thomasclark
5eddb69aa0 Updated the C++ TiltPanCameraTest
The gyro sensitivity is fixed, the Accelerometer interface is
now used, and some tolerances are adjusted.

Change-Id: Iac1f3c4fbae3be923bd97692684ff72cd2f623f9
2014-07-23 09:36:27 -04:00
thomasclark
41c2b9402c Added an Accelerometer interface
ADXL345_I2C, ADXL345_SPI, and BuiltInAccelerometer implement this interface.

The analog accelerometer class Accelerometer was renamed to
AnalogAccelerometer.

Change-Id: Iaae79d582a24c36c372f5fd4ea6df37be289b9c1
2014-07-22 18:04:00 -04:00
Jonathan Leitschuh (WPI)
99632e003b Merge "Fixed the Command-Based Robot template [artf2550]" 2014-07-22 11:00:46 -07:00
thomasclark
fe12394c93 Fixed the Command-Based Robot template [artf2550]
Change-Id: I49361a70fd19d59fbeb9e22a8f65de875fa5a04a
2014-07-22 13:57:45 -04:00
Jonathan Leitschuh (WPI)
fbf196763f Merge "Removed AnalogModule, DigitalModule, and Module from C++" 2014-07-22 10:53:21 -07:00
thomasclark
b5fb35c0c4 Removed AnalogModule, DigitalModule, and Module from Java
Change-Id: I42c58237f1e14d0ebae1c7266aecda00d51eeae1
2014-07-22 13:33:00 -04:00
Alex Henning (WPI)
48e8b2136e Merge "Add support for downloading models hosted on FIRSTForge." 2014-07-22 09:54:23 -07:00
Alex Henning (WPI)
e962c770bb Merge "Fixed installation of frc_gazebo_plugins and a few minor fixes." 2014-07-21 14:12:38 -07:00
Alex Henning
1b7a352cbb Add support for downloading models hosted on FIRSTForge.
Change-Id: I191dc2620b5907316fbc38275d68c568656fa863
Completes: artf2620
2014-07-21 17:09:29 -04:00
thomasclark
1a77cea13a Removed AnalogModule, DigitalModule, and Module from C++
The HAL calls from Analog/DigitalModule are now directly in the classes
that use them.

Change-Id: I1cf879ab2979be903d03ab8282dfe5a5e7ae9443
2014-07-21 16:32:36 -04:00
Alex Henning
afa39deec5 Fixed installation of frc_gazebo_plugins and a few minor fixes.
Change-Id: I1cb30acb69526455469ad890dfee8edd42958a5d
2014-07-21 14:55:43 -04:00
Jonathan Leitschuh
f27e16735f Adds resource tracking to CANJaguar in C++
Change-Id: I0d562af5e9f4f50f79d61db15ff25eaf4dae00d5
2014-07-21 14:36:43 -04:00
Thomas Clark (WPI)
d8a5ced015 Merge "Fixes a bug with ErrorBase where the correct error code would not be set when using wpi_setWPIErrorWithContext()" 2014-07-21 08:23:59 -07:00
Jonathan Leitschuh
8fe606a4b1 Fixes a bug with ErrorBase where the correct error code would not be set when using wpi_setWPIErrorWithContext()
Change-Id: I6ed75428d31df219daf55969e9cd019bf9e0e117
2014-07-21 11:21:36 -04:00
thomasclark
6053a0cc24 Added BuiltInAccelerometer in Java and updated C++
Change-Id: I5a3360c51334e85da6a15fd640f9420bc3b64dca
2014-07-21 10:09:41 -04:00
Jonathan Leitschuh (WPI)
be106b3527 Merge "Added a C++ built-in accelerometer class" 2014-07-21 06:11:59 -07:00
Jonathan Leitschuh (WPI)
ebaf2ef058 Merge "Added HAL methods for using the built-in accelerometer" 2014-07-21 06:02:32 -07:00
thomasclark
9f1a9a07c9 Added a C++ built-in accelerometer class
Change-Id: I80cee788912277f06ac4bdda40261f160de0cbaa
2014-07-21 08:57:03 -04:00
thomasclark
ec2a455bc7 Added HAL methods for using the built-in accelerometer
Change-Id: I5372f5df9b29c546dab3913fcf983a7a9a5427dc
2014-07-21 08:49:51 -04:00
Jonathan Leitschuh
3d740a9a25 Adds Resource tracking to CANJaguar
Change-Id: Ic5da91d378d997f57c65b3bace5fcfd24485dddb
2014-07-18 15:00:59 -04:00
Thomas Clark (WPI)
1dd1e0be1e Merge "Adds a Unit Test for the Resource object in Java. Fixes a bug in the Resource class caused by allocating a negative resource value." 2014-07-17 12:55:24 -07:00
Jonathan Leitschuh
437e3ff266 Adds a Unit Test for the Resource object in Java. Fixes a bug in the Resource class caused by allocating a negative resource value.
Change-Id: I3a3b368d429dc5cd00baf94ccd80a676a10cbb48
2014-07-17 15:51:01 -04:00
Jonathan Leitschuh (WPI)
f373c8708d Merge "The camera fixture tests now include an SPI accelerometer test" 2014-07-17 12:48:32 -07:00
thomasclark
54a657a7d4 The camera fixture tests now include an SPI accelerometer test
Change-Id: I5dae746541d1d0e29f7d7c140a8fed8418502f45
2014-07-17 15:44:51 -04:00
Kevin O'Connor
60d8508a65 Fix artf2636 Don't consume ByteBuffer when checking class specific status
Change-Id: I94e46bd436cc8fd41c7550f1135287027e8be9c4
2014-07-17 15:22:53 -04:00
Kevin O'Connor
02a28c8f04 Add allocation checking for I2C MXP. Update DIO counts in Lib layer until resource checking moves down to HAL
Change-Id: I0abe80bcbe9cbbc81f0887a1cd1a3aa0862df5f1
2014-07-17 15:22:53 -04:00
Kevin O'Connor
b128828977 Update Digital Pin count to reflect full 16 DIO on MXP
Change-Id: I180dee11c2c2a7e0585f153ba4b1832bce2bd6d3
2014-07-17 15:22:52 -04:00
Kevin O'Connor
1a1a12316b Remove JNA hack no longer being used
Change-Id: If85d24003524af71d47115ac0ef31ebc88b70f42
2014-07-17 15:22:51 -04:00
Thomas Clark (WPI)
d0fdb3e704 Merge "Port SPI to roboRIO. Java SPIDevice renamed to SPI and rewritten to match C++ API." 2014-07-17 12:16:14 -07:00
Jonathan Leitschuh (WPI)
5d2e20eaec Merge "More CANJaguar integration tests" 2014-07-17 11:39:26 -07:00
Jonathan Leitschuh
fc0eb4e956 Adds/updates the documentation for the CANJaguar Classes for C++ & Java.
Also removes private unused methods in Java and an unused constructor.

Change-Id: I0a810a4839a5c6752872d947239dd9305141672e
2014-07-17 14:36:51 -04:00
thomasclark
968b69d37d More CANJaguar integration tests
Change-Id: I92e6bb7ee0e7d43c1468650e2c69bb8f46a0154d
2014-07-16 16:45:52 -04:00
Kevin O'Connor
343c7f4f3e Port SPI to roboRIO. Java SPIDevice renamed to SPI and rewritten to match C++ API.
Change-Id: I9b2c05a05cbe443331a5b6da6a6d7c7be751a5e7
2014-07-16 16:34:37 -04:00
Jonathan Leitschuh (WPI)
80c5c09f77 Merge "Encoders and counters work on the MXP" 2014-07-16 12:10:30 -07:00
thomasclark
cb9df310dc Encoders and counters work on the MXP
Change-Id: Ifeb0533dde53a1ccba841b29e2b86f6f4a1bb33f
2014-07-16 15:06:08 -04:00
thomasclark
f566c087dc Fix a few wrong messages in CANJaguar
Change-Id: I8e1a8fa9b0c20a40e060a8319dbbd605173dc407
2014-07-16 10:27:17 -04:00
Brad Miller (WPI)
7ca1b498e4 Merge "Added generic CAN methods to the HAL" 2014-07-11 12:09:46 -07:00
thomasclark
8bba58b9ab Added generic CAN methods to the HAL
Packing, unpacking, caching, receiving, and sending CAN messages can be done
with a thin wrapper around CANSessionMux now, removing the need for duplicated
code between different CAN devices and languages.

Change-Id: If40181e479f45a443db7a1c264437f7f89ff54d9
2014-07-11 11:38:22 -04:00
Colby Skeggs
8ae64a12ea Removed modules from the simulation infrastructure and refactored FRCPlugin.
Pneumatics still have CAN modules. The refactored code is now eight
plugins for sensors and actuators. There is some code reuse that should
be refactored out, but that level of abstraction will wait until we
figure out how these plugins are integrating with gazebo proper.

Change-Id: I357e695ef05af6dda83a39ba60380686bd57d11a
Closes: artf2610, artf2623
2014-07-07 13:33:34 -07:00
Alex Henning (WPI)
3b4718fc92 Merge "Fixed FRCSim artf2609 - double ports handled wrong." 2014-07-07 12:22:39 -07:00
Alex Henning (WPI)
5800af49bc Merge "Fixed FRCSim artf2599." 2014-07-07 11:46:49 -07:00
Thomas Clark (WPI)
63fc4f6cfb Merge "Makes the tests take parameters at runtime so that you can selectively run a suite without having to run the entire framework." 2014-07-03 13:20:50 -07:00
Jonathan Leitschuh
8b770ffb41 Makes the tests take parameters at runtime so that you can selectively run a suite without having to run the entire framework.
Change-Id: I1452cace993a5ea8bdd87797d3125cd353b9218f
2014-07-03 15:38:04 -04:00
Colby Skeggs
55fde6b616 Fixed FRCSim artf2609 - double ports handled wrong.
Change-Id: I2dc59c8d3113f3024d237763eb4e2f94bb85ff1a
2014-07-03 12:23:29 -07:00
Colby Skeggs
5ddacb43c1 Fixed FRCSim artf2599.
Made the wpilibC++Sim codebase's motor control as
similar to the wpilibC++ motor control as possible.

Change-Id: I5510d952cb40c4a3def210f46a566d7102d604ee
2014-07-02 15:43:12 -07:00
Brad Miller (WPI)
65c3c0ba09 Merge "Updated the HAL, wpilibj, and wpilibc for PCM and PDP" 2014-07-02 14:04:51 -07:00
Brad Miller (WPI)
fc3ed33f77 Merge "PDP and PCM updated to rely on CtreCanNode parent class, which uses new CAN API. CtreCanNode registers the periodic tx messages and provides an rx function to child classes for easy getters and setters. Some template magic to make the PDP and PCM getters/setters easy to stamp out." 2014-07-02 14:04:35 -07:00
thomasclark
255a3a5b12 Updated the HAL, wpilibj, and wpilibc for PCM and PDP
Removed #if 0...#endif from PCM.cpp

Change-Id: I2d117c87a3fa10bddebf83706f79c2e767d22a0d

Update the HAL to the PCM/PDP changes

Change-Id: If554b650e263f174e90864f1e9ffba91daf20f7e

Update C++ to the PCM/PDP changes

Change-Id: Ia3114d4526be1dc5cc2f74fd8f7ab44f204d15f2

Updated PCM/PDP in Java

Change-Id: I8fe03afbcb1739d555e86abc0eaae1e12313d490
2014-07-02 16:49:36 -04:00
Omar Zrien
0ef5c3adfa PDP and PCM updated to rely on CtreCanNode parent class, which uses new CAN API.
CtreCanNode registers the periodic tx messages and provides an rx function to child classes for easy getters and setters.
Some template magic to make the PDP and PCM getters/setters easy to stamp out.

Change-Id: Ibdd0745af070756a282df5074504491fadfde336
2014-07-02 16:48:55 -04:00
Brad Miller (WPI)
37ebcabc4a Merge "Fixed periodic voltage status message" 2014-07-02 10:42:04 -07:00
Brad Miller (WPI)
244ee8d920 Merge "Fixed C++ deploy in Eclipse" 2014-07-02 10:41:36 -07:00
thomasclark
b97d2eb0c3 Fixed periodic voltage status message
Previously, the voltage was requested as a percentage and decoded as
a number of volts, which resulted in values being scaled wrong. The
correct message is requested now.

Change-Id: I5e81c7a4a2e2698f2e8a84ba747217e0e14f7676
2014-07-02 12:14:49 -04:00
thomasclark
ae8d22b0f2 Fixed C++ deploy in Eclipse
Eclipse now runs an ant script to deploy C++ programs, which runs the
robot program with the run-at-startup system

Change-Id: I3e63967ebc40ad3c38aa561fd303ca3c577fd2a2
2014-07-01 17:04:28 -04:00
Brad Miller (WPI)
ff8016c088 Merge "Fixes CounterTest for C++" 2014-07-01 13:01:10 -07:00
Brad Miller (WPI)
f0fb3023ad Merge "CANJaguar uses periodic status updates [artf2621]" 2014-07-01 13:00:15 -07:00
Kacper Puczydlowski
1d33edffee Fixes CounterTest for C++
Change-Id: I3446561cd255c56edd3f284a45ec4fd7efaf84e6
2014-07-01 14:16:53 -04:00
thomasclark
5bd546f1fd CANJaguar uses periodic status updates [artf2621]
All status data is now in 3 messages automatically sent periodically
by the Jaguar, removing the need to send several hundred requests
every second.

The C++ integration test was also updated to be more robust against
timing problems.

Change-Id: I13bacc6c8173ea1a2291a96ad3bd80ff5b18d16f
2014-07-01 12:02:44 -04:00
847 changed files with 25993 additions and 32339 deletions

1
.gitignore vendored
View File

@@ -11,6 +11,7 @@ bin/
.cproject
.settings/
.classpath
**/dependency-reduced-pom.xml
#Java File extentions
*.class

View File

@@ -1,13 +0,0 @@
syntax: re
^\.hgignore$
.*/target(?:/|$)
.*/dist(?:/|$)
eclipse-plugins/.*/bin(?:/|$)
syntax: glob
wpilibc/build/
hal/build/
networktables/cpp/build/
build/
networktables/OutlineViewer/nbproject/private
*~

View File

@@ -1,10 +1,11 @@
cmake_minimum_required(VERSION 2.8)
project(All-WPILib)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -Wextra -Wno-unused-parameter -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -Wall -Wextra -Wno-unused-parameter -fPIC")
SET(CMAKE_SKIP_BUILD_RPATH TRUE)
file(GLOB_RECURSE NI_LIBS ni-libraries/*.so*)
get_filename_component(WPILIB_INCLUDES wpilibc/wpilibC++/include REALPATH)
get_filename_component(HAL_API_INCLUDES hal/include REALPATH)
get_filename_component(NWT_API_INCLUDES networktables/cpp/include REALPATH)
add_subdirectory(hal)

View File

@@ -4,13 +4,14 @@
if [ $(which sshpass) ]
then
sshpass -p "" ssh admin@10.1.90.2 killall FRCUserProgram
sshpass -p "" scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin
sshpass -p "" ssh admin@10.1.90.2 ./FRCUserProgram $*
# Send stderr to /dev/null - the only thing printed to it is the login prompt
sshpass -p "" ssh admin@10.1.90.2 killall FRCUserProgram java 2> /dev/null
sshpass -p "" scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin 2> /dev/null
sshpass -p "" ssh admin@10.1.90.2 ./FRCUserProgram --gtest_color=yes $* 2> /dev/null
else
ssh admin@10.1.90.2 killall FRCUserProgram
scp target/cmake/wpilibc/wpilibC++IntegrationTests/FRCUserProgram admin@10.1.90.2:/home/admin
ssh admin@10.1.90.2 ./FRCUserProgram $*
ssh admin@10.1.90.2 ./FRCUserProgram --gtest_color=yes $*
fi

View File

@@ -124,7 +124,7 @@ public class WPILibCore extends AbstractUIPlugin {
return target;
else {
int teamNumber = getTeamNumber(project);
return "10." + (teamNumber / 100) + "." + (teamNumber % 100) + ".2";
return "roborio-" + teamNumber + ".local";
}
}

View File

@@ -35,15 +35,15 @@ public class NewProjectMainPage extends WizardPage {
private Text worldText;
private Button worldButton;
Button simpleRobot, iterativeRobot, commandRobot;
Button iterativeRobot, commandRobot;
private boolean showPackage;
private boolean showProjectTypes;
private TeamNumberPage teamNumberPage;
/**
* Constructor for SampleNewWizardPage.
* @param teamNumberPage
*
* @param teamNumberPage
*
* @param pageName
*/
public NewProjectMainPage(ISelection selection, TeamNumberPage teamNumberPage) {
@@ -77,7 +77,7 @@ public class NewProjectMainPage extends WizardPage {
if (showPackage) {
label = new Label(container, SWT.NULL);
label.setText("&Package:");
packageText = new Text(container, SWT.BORDER | SWT.SINGLE);
gd = new GridData(GridData.FILL_HORIZONTAL);
packageText.setLayoutData(gd);
@@ -87,7 +87,7 @@ public class NewProjectMainPage extends WizardPage {
}
});
}
if (showProjectTypes) {
Group projectTypeGroup = new Group(container, SWT.BORDER);
projectTypeGroup.setText("Project Type");
@@ -97,21 +97,13 @@ public class NewProjectMainPage extends WizardPage {
GridLayout groupLayout = new GridLayout();
groupLayout.numColumns = 1;
projectTypeGroup.setLayout(groupLayout);
simpleRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
//simpleRobot.setData( RWT.MARKUP_ENABLED, Boolean.TRUE );
simpleRobot.setText("Simple Robot: A flexible robot project intended for robots that implement basic functionality. Can also be used as a starting point for teams with a custom framework.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
simpleRobot.setLayoutData(gd);
simpleRobot.setSelection(true);
iterativeRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
iterativeRobot.setText("Iterative Robot: A robot project that allows robots to be implemented in an iterative manner.");
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = 300;
iterativeRobot.setLayoutData(gd);
commandRobot = new Button(projectTypeGroup, SWT.RADIO | SWT.WRAP);
commandRobot.setText("Command-Based Robot: A robot project that allows robots to be implemented using the command based model to allow complex functionality to be developed from simpler functionality.");
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -121,7 +113,7 @@ public class NewProjectMainPage extends WizardPage {
label = new Label(container, SWT.NULL);
label.setText("Simulation &World:");
Composite comp = new Composite(container, SWT.NULL);
gd = new GridData(GridData.FILL_HORIZONTAL);
@@ -144,7 +136,7 @@ public class NewProjectMainPage extends WizardPage {
browse();
}
});
initialize();
dialogChanged();
setControl(container);
@@ -162,7 +154,7 @@ public class NewProjectMainPage extends WizardPage {
@Override public void stateChanged(ChangeEvent e) {
String teamNumber = TeamNumberPage.getTeamNumberFromPage(teamNumberPage);
packageText.setText("org.usfirst.frc.team"+teamNumber+".robot");
}
});
}
@@ -174,7 +166,7 @@ public class NewProjectMainPage extends WizardPage {
*/
private void dialogChanged() {
String projectName = getProjectName();
String packageString = "";
if (showPackage) packageString = getPackage();
@@ -190,7 +182,7 @@ public class NewProjectMainPage extends WizardPage {
updateStatus("Must be valid java package");
return;
}
updateStatus(null);
}
@@ -203,7 +195,7 @@ public class NewProjectMainPage extends WizardPage {
String result = dialog.open();
if (result != null) {
worldText.setText(result);
}
}
}
private void updateStatus(String message) {
@@ -218,10 +210,9 @@ public class NewProjectMainPage extends WizardPage {
public String getPackage() {
return packageText.getText();
}
public ProjectType getProjectType() {
if (!showProjectTypes) return null;
else if (simpleRobot.getSelection()) return types.get(ProjectType.SIMPLE);
else if (iterativeRobot.getSelection()) return types.get(ProjectType.ITERATIVE);
else return types.get(ProjectType.COMMAND_BASED);
}
@@ -237,7 +228,7 @@ public class NewProjectMainPage extends WizardPage {
public void setShowProjectTypes(boolean bool) {
showProjectTypes = bool;
}
public void setProjectTypes(Map<String, ProjectType> types) {
showProjectTypes = true;
this.types = types;

View File

@@ -67,12 +67,21 @@
type="new"
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandWizard">
<enablement>
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</commonWizard>
<commonWizard
@@ -80,12 +89,21 @@
type="new"
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.CommandGroupWizard">
<enablement>
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</commonWizard>
<commonWizard
@@ -93,12 +111,21 @@
type="new"
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.SubsystemWizard">
<enablement>
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</commonWizard>
<commonWizard
@@ -106,12 +133,21 @@
type="new"
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.PIDSubsystemWizard">
<enablement>
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</commonWizard>
<commonWizard
@@ -119,12 +155,21 @@
type="new"
wizardId="edu.wpi.first.wpilib.plugins.cpp.wizards.file_template.TriggerWizard">
<enablement>
<with
variable="activeWorkbenchWindow.activePerspective">
<equals
value="org.eclipse.cdt.ui.CPerspective">
</equals>
</with>
<with
variable="selection">
<iterate>
<and>
<test
value="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.core.resources.projectNature">
</test>
<test
value="org.eclipse.cdt.core.cnature"
property="org.eclipse.core.resources.projectNature">
</test>
</and>
</iterate>
</with>
</enablement>
</commonWizard>
</extension>
@@ -147,10 +192,10 @@
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="edu.wpi.first.wpilib.plugins.cpp.launching.DeployLaunchShortcut"
description="Deploy the WPILib project to the athena board."
description="Deploy the WPILib project to the roboRIO"
icon="resources/icons/wpi.ico"
id="edu.wpi.first.wpilib.plugins.cpp.launching.deploy"
label="WPILib Deploy Configure Builder"
label="WPILib C++ Deploy"
modes="run,debug">
<contextualLaunch>
<enablement>
@@ -172,20 +217,20 @@
</enablement>
</contextualLaunch>
<description
description="Deploy the WPILib project to the athena board."
description="Deploy the WPILib project to the roboRIO"
mode="run">
</description>
<description
description="Deploy the WPILib project to the athena board and debug it."
description="Deploy the WPILib project to the roboRIO"
mode="debug">
</description>
</shortcut>
<shortcut
class="edu.wpi.first.wpilib.plugins.cpp.launching.SimulateLaunchShortcut"
description="Test the WPILib project using the Gazebo simulator."
icon="resources/icons/wpi.ico"
icon="resources/icons/Gazebo.png"
id="edu.wpi.first.wpilib.plugins.cpp.launching.simulate"
label="WPILib Simulate"
label="WPILib C++ Simulation"
modes="run,debug">
<contextualLaunch>
<enablement>

Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

View File

@@ -28,6 +28,7 @@
<option id="gnu.cpp.compiler.option.optimization.level.549514425" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.debugging.level.1682909384" name="Debug Level" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
<option id="gnu.cpp.compiler.option.include.paths.1597382905" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/src&quot;"/>
<listOptionValue builtIn="false" value="$cpp-location/include"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.963785380" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
@@ -38,10 +39,11 @@
<listOptionValue builtIn="false" value="$cpp-location/lib"/>
</option>
<option id="gnu.cpp.link.option.libs.1072058280" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="WPILibAthena"/>
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="HALAthena"/>
<listOptionValue builtIn="false" value="NetworkTables"/>
<listOptionValue builtIn="false" value="FRC_FPGA_ChipObject"/>
<listOptionValue builtIn="false" value="FRC_NetworkCommunication"/>
<listOptionValue builtIn="false" value="i2c"/>
<listOptionValue builtIn="false" value="ni_emb"/>
@@ -58,6 +60,7 @@
</option>
<option id="gnu.cpp.link.option.flags.1747959472" name="Linker flags" superClass="gnu.cpp.link.option.flags" value="-Wl,-rpath-link,$cpp-location/lib" valueType="string"/>
<option id="gnu.cpp.link.option.other.1891020896" name="Other options (-Xlinker [option])" superClass="gnu.cpp.link.option.other" valueType="stringList">
<listOptionValue builtIn="false" value="-export-dynamic"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1757265359" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
@@ -167,7 +170,9 @@
<tool id="cdt.managedbuild.tool.gnu.c.linker.base.66697269" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base"/>
<tool command="g++" commandLinePattern="${COMMAND} ${FLAGS} ${OUTPUT_FLAG} ${OUTPUT_PREFIX}${OUTPUT} ${INPUTS}" errorParsers="org.eclipse.cdt.core.GLDErrorParser" id="cdt.managedbuild.tool.gnu.cpp.linker.base.2094820582" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base">
<option id="gnu.cpp.link.option.libs.1563598353" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="WPILibSim"/>
<listOptionValue builtIn="false" value="WPILib"/>
<listOptionValue builtIn="false" value="gazebo"/>
<listOptionValue builtIn="false" value="gazebo_transport"/>
<listOptionValue builtIn="false" value="gazebo_msgs"/>

View File

@@ -2,8 +2,9 @@
username=admin
password=
deploy.dir=/home/admin
deploy.run.command=./runcppprogram
deploy.debug.command=./debugcppprogram
deploy.kill.command=/usr/local/frc/bin/frcKillRobot.sh -t -r
deploy.log.file=/var/local/natinst/log/FRC_UserProgram.log
command.dir=/home/lvuser/
# Libraries to use
wpilib=${user.home}/wpilib/cpp/${cpp-version}
@@ -21,8 +22,8 @@ build.dir=build
out.exe=Debug/${out}
# Simulation
simulation.world.file=$world
simulation.world.file=/usr/share/frcsim/worlds/GearsBotDemo.world
sim.exe=Simulate/${out}
wpilib.sim=${wpilib}/sim
sim.tools=${wpilib.sim}/tools
sim.lib=${wpilib.sim}/lib
sim.lib=${wpilib.sim}/lib

View File

@@ -6,7 +6,7 @@
ExampleSubsystem* CommandBase::examplesubsystem = NULL;
OI* CommandBase::oi = NULL;
CommandBase::CommandBase(std::string name) :
CommandBase::CommandBase(char const *name) :
Command(name)
{
}

View File

@@ -14,7 +14,7 @@
class CommandBase: public Command
{
public:
CommandBase(std::string name);
CommandBase(char const *name);
CommandBase();
static void init();
// Create a single static instance of all of your subsystems

View File

@@ -1,12 +1,16 @@
#include "WPILib.h"
/**
* This is a demo program showing the use of the RobotBase class.
* The SimpleRobot class is the base of a robot application that will automatically call your
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
class Robot: public SimpleRobot
class Robot: public SampleRobot
{
RobotDrive myRobot; // robot drive system
Joystick stick; // only joystick
@@ -31,7 +35,7 @@ public:
}
/**
* Runs the motors with arcade steering.
* Runs the motors with arcade steering.
*/
void OperatorControl()
{
@@ -48,7 +52,6 @@ public:
*/
void Test()
{
}
};

View File

@@ -3,6 +3,7 @@ package edu.wpi.first.wpilib.plugins.cpp.launching;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.io.File;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.executables.Executable;
@@ -28,12 +29,13 @@ import org.eclipse.ui.PlatformUI;
import edu.wpi.first.wpilib.plugins.core.WPILibCore;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
import edu.wpi.first.wpilib.plugins.core.launching.AntLauncher;
/**
* Launch shortcut base functionality, common for deploying to the robot.
* Retrieves the project the operation is being called on, and runs the correct
* ant targets based on polymorphically determined data values
*
*
* @author Ryan O'Meara
* @author Alex Henning
*/
@@ -46,7 +48,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut
/**
* Returns the launch type of the shortcut that was used, one of the
* constants defined in BaseLaunchShortcut
*
*
* @return Launch shortcut type
*/
public String getLaunchType()
@@ -91,7 +93,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut
}
/**
*
*
* @param activeProj
* The project that the script will be run on/from
* @param mode
@@ -99,23 +101,34 @@ public class DeployLaunchShortcut implements ILaunchShortcut
* ILaunchManager.DEBUG_MODE)
*/
public void runConfig(IProject activeProj, String mode, Shell shell) {
// TODO: figure out UI issues. that's why this is undocumented
ILaunchConfigurationWorkingCopy config;
try {
config = getRemoteDebugConfig(activeProj);
//config.doSave(); // NOTE: For debugging
//org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager().addLaunch(config.launch(mode, null));
//THIS IS MADDENING! we want to add to the recent history, but I can't seem to find a public api to do so, so lets just launch the config dialog
//DebugUITools.openLaunchConfigurationPropertiesDialog(shell, config, "org.eclipse.cdt.launch.launchGroup");
//config.launch(mode, new NullProgressMonitor(), false, true);
DebugUITools.launch(config, mode);
} catch (CoreException e) {
WPILibCPPPlugin.logError("Debug attach failed.", e);
if(mode.equals(ILaunchManager.RUN_MODE)) {
// Regular deploys are done with an ant script for now, for both
// C++ and Java.
WPILibCPPPlugin.logInfo("Running ant file: " + activeProj.getLocation().toOSString() + File.separator + "build.xml");
WPILibCPPPlugin.logInfo("Targets: deploy, Mode: " + mode);
AntLauncher.runAntFile(new File (activeProj.getLocation().toOSString() + File.separator + "build.xml"), "deploy", null, mode);
} else {
// Debug deploys are done with the Eclipse Remote System Explorer,
// which lets it work with Eclipse's C++ debugger.
// TODO: figure out UI issues. that's why this is undocumented
ILaunchConfigurationWorkingCopy config;
try {
config = getRemoteDebugConfig(activeProj);
//config.doSave(); // NOTE: For debugging
//org.eclipse.debug.core.DebugPlugin.getDefault().getLaunchManager().addLaunch(config.launch(mode, null));
//THIS IS MADDENING! we want to add to the recent history, but I can't seem to find a public api to do so, so lets just launch the config dialog
//DebugUITools.openLaunchConfigurationPropertiesDialog(shell, config, "org.eclipse.cdt.launch.launchGroup");
//config.launch(mode, new NullProgressMonitor(), false, true);
DebugUITools.launch(config, mode);
} catch (CoreException e) {
WPILibCPPPlugin.logError("Debug attach failed.", e);
}
try {
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
} catch (Exception e) {}
}
try {
activeProj.refreshLocal(Resource.DEPTH_INFINITE, null);
} catch (Exception e) {}
}
private ILaunchConfigurationWorkingCopy getRemoteDebugConfig(IProject activeProj) throws CoreException
@@ -128,7 +141,7 @@ public class DeployLaunchShortcut implements ILaunchShortcut
ILaunchConfigurationWorkingCopy config = type.newInstance(null, activeProj.getName());
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, activeProj.getName());
Collection<Executable> exes = ExecutablesManager.getExecutablesManager().getExecutablesForProject(activeProj);
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
exes.size() > 0 ? exes.toArray(new Executable[0])[0].getPath().makeRelativeTo(activeProj.getLocation()).toString():
"Debug/FRCUserProgram");
config.setAttribute(IRemoteConnectionConfigurationConstants.ATTR_REMOTE_PATH, "/home/admin/FRCUserProgram");

View File

@@ -8,13 +8,6 @@ import edu.wpi.first.wpilib.plugins.core.wizards.ProjectType;
import edu.wpi.first.wpilib.plugins.cpp.WPILibCPPPlugin;
public class CPPProjectType implements ProjectType {
static ProjectType SIMPLE = new CPPProjectType() {
@Override public Map<String, String> getFiles(String packageName) {
Map<String, String> files = super.getFiles(packageName);
files.put("src/Robot.cpp", "simple/Robot.cpp");
return files;
}
};
static ProjectType ITERATIVE = new CPPProjectType() {
@Override public Map<String, String> getFiles(String packageName) {
Map<String, String> files = super.getFiles(packageName);
@@ -47,7 +40,6 @@ public class CPPProjectType implements ProjectType {
};
@SuppressWarnings("serial")
static Map<String, ProjectType> TYPES = new HashMap<String, ProjectType>() {{
put(ProjectType.SIMPLE, SIMPLE);
put(ProjectType.ITERATIVE, ITERATIVE);
put(ProjectType.COMMAND_BASED, COMMAND_BASED);
}};

View File

@@ -1,11 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="athena-project-build" default="deploy">
<property file="${wpilib.ant.dir}/../so.properties"/>
<property name="opkg.name" value="wpilib" />
<property name="opkg.arch" value="armv7a-vfp" />
<!-- Load Tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
@@ -23,107 +19,34 @@
<!-- Targets -->
<target name="get-target-ip">
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
<property name="target" value="10.${ip.upper}.${ip.lower}.2" />
<echo>Target IP: ${target}</echo>
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
</target>
<target name="deploy" depends="get-target-ip" description="Deploy the progam and start it running.">
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="rm ${deploy.dir}/FRCUserProgram" />
username="${username}"
password="${password}"
trust="true"
failonerror="no"
command="rm ${deploy.dir}/FRCUserProgram" />
<echo>[athena-deploy] Copying code over.</echo>
<scp file="${out.exe}" sftp="true" todir="${username}@${target}:${deploy.dir}"
password="${password}" trust="true"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="opkg info wpilib |grep Version | awk '{printf $2}'"
outputproperty="installedWpilibSo"/>
<if>
<equals arg1="${installedWpilibSo}" arg2="${cpp-sos}" />
<then>
<echo>Found version of WPILib: ${installedWpilibSo} (latest)</echo>
</then>
<else>
<echo>Found version of WPILib: ${installedWpilibSo}</echo>
<echo>Upgrading WPILib to ${cpp-sos}...</echo>
<delete>
<fileset dir="${wpilib.ant.dir}">
<include name="data.tar*" />
<include name="control*" />
<include name="post*" />
<include name="md5sums" />
<include name="*.deb" />
</fileset>
</delete>
<tar destfile="${wpilib.ant.dir}/data.tar">
<tarfileset dir="${wpilib.ant.dir}/../lib" username="root" group="admin" uid="0" gid="0"
prefix="usr/local/frc/lib">
<include name="libWPILibAthena.so" />
<include name="libNetworkTables.so" />
<include name="libHALAthena.so" />
</tarfileset>
</tar>
<gzip destfile="${wpilib.ant.dir}/data.tar.gz" src="${wpilib.ant.dir}/data.tar"/>
<echo file="${wpilib.ant.dir}/debian-binary">2.0</echo>
<echo file="${wpilib.ant.dir}/control">Package: ${opkg.name}
Version: ${cpp-sos}
Section: devel
Priority: optional
Architecture: ${opkg.arch}
Depends: libc6 (>= 2.11.1-r7), libgcc1 (>= 4.4.1)
Maintainer: Brad Miller &gt;bamiller@wpi.edu&lt;
Description: WPILib, NetworkTables and HAL for RoboRIO target
.
This package contains the shared objects for WPILib, NetworkTables, and HAL for the 2015 target on the RoboRIO
</echo>
<echo file="${wpilib.ant.dir}/postinst">#!/bin/sh
ldconfig
</echo>
<echo file="${wpilib.ant.dir}/postrm">#!/bin/sh
ldconfig
</echo>
<checksum property="md5.wpilib" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libWPILibAthena.so" />
<checksum property="md5.nwt" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libNetworkTables.so" />
<checksum property="md5.hal" format="MD5SUM" file="${wpilib.ant.dir}/../lib/libHALAthena.so" />
<echo file="${wpilib.ant.dir}/md5sums">${md5.wpilib} usr/local/frc/lib/libWPILibAthena.so
${md5.nwt} usr/local/frc/lib/libNetworkTables.so
${md5.hal} usr/local/frc/lib/libHALAthena.so</echo>
<tar destfile="${wpilib.ant.dir}/control.tar">
<tarfileset dir="${wpilib.ant.dir}" username="root" group="admin" uid="0" gid="0"
prefix="">
<include name="control" />
<include name="md5sums" />
</tarfileset>
<tarfileset dir="${wpilib.ant.dir}" filemode="755" username="root" group="admin" uid="0" gid="0"
prefix="">
<include name="postinst" />
<include name="postrm" />
</tarfileset>
</tar>
<gzip destfile="${wpilib.ant.dir}/control.tar.gz" src="${wpilib.ant.dir}/control.tar"/>
<exec command="${wpilib.ant.dir}\..\..\..\toolchains\arm-none-linux-gnueabi-4.4.1\bin\arm-none-linux-gnueabi-ar -r ${opkg.name}_${cpp-sos}_${opkg.arch}.deb debian-binary control.tar.gz data.tar.gz" dir="${wpilib.ant.dir}"/>
<scp file="${wpilib.ant.dir}/${opkg.name}_${cpp-sos}_${opkg.arch}.deb" todir="${username}@${target}:/tmp"
password="${password}" trust="true"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="opkg install /tmp/${opkg.name}_${cpp-sos}_${opkg.arch}.deb; sh -c 'rm -rf /tmp/wpilib*.deb'"/>
</else>
</if>
<scp file="${out.exe}" sftp="true" todir="${username}@${target}:${deploy.dir}" password="${password}" trust="true"/>
<scp file="${wpilib.ant.dir}/robotCommand" todir="${username}@${target}:/home/lvuser/" password="${password}" trust="true"/>
<echo>[athena-deploy] Starting program.</echo>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="chmod +x ${deploy.dir}/FRCUserProgram; ${deploy.dir}/FRCUserProgram"/>
username="${username}"
password="${password}"
trust="true"
command=". /etc/profile.d/natinst-path.sh; chmod a+x ${deploy.dir}/${out}; ${deploy.kill.command};"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="tail -F -s 0 -n 0 ${deploy.log.file}"/>
</target>
<target name="debug-deploy" depends="get-target-ip" description="Deploy the jar and start the program running in debug mode.">
@@ -171,4 +94,4 @@ ${md5.hal} usr/local/frc/lib/libHALAthena.so</echo>
</sequential>
</parallel>
</target>
</project>
</project>

View File

@@ -0,0 +1 @@
/home/admin/FRCUserProgram

View File

@@ -67,10 +67,16 @@
wizardId="edu.wpi.first.wpilib.plugins.java.wizards.file_template.CommandWizard">
<enablement>
<with variable="selection"><iterate>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate></with>
</enablement>
</commonWizard>
@@ -80,10 +86,16 @@
wizardId="edu.wpi.first.wpilib.plugins.java.wizards.file_template.CommandGroupWizard">
<enablement>
<with variable="selection"><iterate>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate></with>
</enablement>
</commonWizard>
@@ -93,10 +105,16 @@
wizardId="edu.wpi.first.wpilib.plugins.java.wizards.file_template.SubsystemWizard">
<enablement>
<with variable="selection"><iterate>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate></with>
</enablement>
</commonWizard>
@@ -106,10 +124,16 @@
wizardId="edu.wpi.first.wpilib.plugins.java.wizards.file_template.PIDSubsystemWizard">
<enablement>
<with variable="selection"><iterate>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate></with>
</enablement>
</commonWizard>
@@ -119,10 +143,16 @@
wizardId="edu.wpi.first.wpilib.plugins.java.wizards.file_template.TriggerWizard">
<enablement>
<with variable="selection"><iterate>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<and>
<test
args="edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
<test
args="org.eclipse.jdt.core.javanature"
property="org.eclipse.jdt.launching.hasProjectNature">
</test>
</and>
</iterate></with>
</enablement>
</commonWizard>
@@ -146,10 +176,10 @@
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="edu.wpi.first.wpilib.plugins.java.launching.DeployLaunchShortcut"
description="Deploy the WPILib project to the athena board."
description="Deploy the WPILib project to the roboRIO"
icon="resources/icons/wpi.ico"
id="edu.wpi.first.wpilib.plugins.java.launching.deploy"
label="WPILib Deploy"
label="WPILib Java Deploy"
modes="run,debug">
<contextualLaunch>
<enablement>
@@ -171,11 +201,11 @@
</enablement>
</contextualLaunch>
<description
description="Deploy the WPILib project to the athena board."
description="Deploy the WPILib project to the roboRIO board."
mode="run">
</description>
<description
description="Deploy the WPILib project to the athena board and debug it."
description="Deploy the WPILib project to the roboRIO board and debug it."
mode="debug">
</description>
</shortcut>
@@ -184,7 +214,7 @@
description="Test your WPILib program with the Gazebo simulator."
icon="resources/icons/Gazebo.png"
id="edu.wpi.first.wpilib.plugins.java.launching.simulate"
label="WPILib Simulation"
label="WPILib Java Simulation"
modes="run,debug">
<contextualLaunch>
<enablement>

View File

@@ -92,7 +92,7 @@
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
<classifier>sources</classifier>
<outputDirectory>${java-zip}/lib</outputDirectory>
@@ -102,7 +102,7 @@
<!-- Javadoc -->
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>javadoc</type>
<outputDirectory>${java-zip}/javadoc-jar</outputDirectory>
@@ -132,6 +132,12 @@
<artifactId>JavaGazebo</artifactId>
<version>0.1.0-SNAPSHOT</version>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>jar</type>
</artifactItem>
<artifactItem>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaSim</artifactId>
@@ -348,11 +354,16 @@
<artifactId>wpilibJava</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
<!-- Javadoc -->
<dependency>
<groupId>edu.wpi.first.wpilibj</groupId>
<artifactId>wpilibJava</artifactId>
<artifactId>wpilibJavaDevices</artifactId>
<version>0.1.0-SNAPSHOT</version>
<type>javadoc</type>
</dependency>

View File

@@ -1,6 +1,6 @@
package $package;
import edu.wpi.first.wpilibj.command.Trigger;
import edu.wpi.first.wpilibj.buttons.Trigger;
/**
*

View File

@@ -51,9 +51,6 @@ public class DriveTrain extends Subsystem {
left_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
right_encoder.setDistancePerPulse((4.0/12.0*Math.PI) / 360.0);
}
left_encoder.start();
right_encoder.start();
rangefinder = new AnalogInput(6);
gyro = new Gyro(1);

View File

@@ -33,7 +33,7 @@ public class Robot extends IterativeRobot {
public static Collector collector;
public static Shooter shooter;
public static Pneumatics pneumatics;
public static Pivot pivot;;
public static Pivot pivot;
public SendableChooser autoChooser;
public SendableChooser autonomousDirectionChooser;

View File

@@ -63,8 +63,6 @@ public class DriveTrain extends Subsystem {
leftEncoder.setDistancePerPulse((4.0/*in*/*Math.PI)/(360.0*12.0/*in/ft*/));
}
rightEncoder.start();
leftEncoder.start();
LiveWindow.addSensor("DriveTrain", "Right Encoder", rightEncoder);
LiveWindow.addSensor("DriveTrain", "Left Encoder", leftEncoder);

View File

@@ -0,0 +1,59 @@
package $package;
import edu.wpi.first.wpilibj.SampleRobot;
/**
* This is a demo program showing the use of the RobotDrive class.
* The SampleRobot class is the base of a robot application that will automatically call your
* Autonomous and OperatorControl methods at the right time as controlled by the switches on
* the driver station or the field controls.
*
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SampleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*
* WARNING: While it may look like a good choice to use for your code if you're inexperienced,
* don't. Unless you know what you are doing, complex code will be much more difficult under
* this system. Use IterativeRobot or Command-Based instead if you're new.
*/
public class Robot extends SampleRobot {
RobotDrive myRobot;
Joystick stick;
public Robot() {
myRobot = new RobotDrive(1, 2);
myRobot.setExpiration(0.1);
stick = new Joystick(1);
}
/**
* Drive left & right motors for 2 seconds then stop
*/
public void autonomous() {
myRobot.setSafetyEnabled(false);
myRobot.drive(-0.5, 0.0); // drive forwards half speed
Timer.delay(2.0); // for 2 seconds
myRobot.drive(0.0, 0.0); // stop robot
}
/**
* Runs the motors with arcade steering.
*/
public void operatorControl() {
myRobot.setSafetyEnabled(true);
while (isOperatorControl()) {
myRobot.arcadeDrive(stick); // drive with arcade style (use right stick)
Timer.delay(0.005); // wait for a motor update time
}
}
/**
* Runs during test mode
*/
public void test() {
}
}

View File

@@ -1,35 +0,0 @@
package $package;
import edu.wpi.first.wpilibj.SimpleRobot;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
}
/**
* This function is called once each time the robot enters test mode.
*/
public void test() {
}
}

View File

@@ -100,11 +100,15 @@ public class WPILibJavaPlugin extends AbstractUIPlugin implements IStartup {
IProject[] projects = root.getProjects();
// Loop over all projects
for (IProject project : projects) {
try {
updateVariables(project);
} catch (CoreException e) {
WPILibJavaPlugin.logError("Error updating projects.", e);
}
try {
if(project.hasNature("edu.wpi.first.wpilib.plugins.core.nature.FRCProjectNature")){
WPILibJavaPlugin.logInfo("Updating project");
updateVariables(project);
} else {
}
} catch (CoreException e) {
WPILibJavaPlugin.logError("Error updating projects.", e);
}
}
}

View File

@@ -19,10 +19,8 @@
<!-- Targets -->
<target name="get-target-ip">
<math result="ip.upper" operand1="${team-number}" operation="/" operand2="100" datatype="int"/>
<math result="ip.lower" operand1="${team-number}" operation="%" operand2="100" datatype="int"/>
<property name="target" value="10.${ip.upper}.${ip.lower}.2" />
<echo>Target IP: ${target}</echo>
<property name="target" value="roboRIO-${team-number}.local" />
<echo>Target: ${target}</echo>
</target>
<target name="compile" description="Compile the source code.">
@@ -78,13 +76,13 @@
username="${username}"
password="${password}"
trust="true"
command=". /etc/profile.d/natinst-path.sh; chmod a+x run*program; ${deploy.kill.command};"/>
command=". /etc/profile.d/natinst-path.sh; ${deploy.kill.command};"/>
<sshexec host="${target}"
username="${username}"
password="${password}"
trust="true"
command="tail -f -s 0 -n 1 ${deploy.log.file}"/>
command="tail -F -s 0 -n 0 ${deploy.log.file}"/>
</target>
<target name="debug-deploy" depends="get-target-ip,jar" description="Deploy the jar and start the program running.">

View File

@@ -2,13 +2,12 @@ cmake_minimum_required(VERSION 2.8)
project(HAL)
file(GLOB_RECURSE SRC_FILES lib/Athena/*.cpp)
include_directories(lib/Athena include)
include_directories(lib/Athena lib/Athena/FRC_FPGA_ChipObject include)
add_library(HALAthena STATIC ${SRC_FILES})
target_link_libraries(HALAthena ${NI_LIBS})
INSTALL(TARGETS HALAthena ARCHIVE DESTINATION lib COMPONENT lib)
INSTALL(FILES ${NI_LIBS} DESTINATION lib COMPONENT ni_lib)
INSTALL(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers)
# lib/ c m gcc_s ld-linux
# usr/lib stdc++
# usr/lib
# FRC_NetworkCommunication FRC_FPGA_ChipObject RoboRIO_FRC_ChipObject

View File

@@ -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();
}

View File

@@ -26,11 +26,9 @@ extern "C"
void* initializeAnalogInputPort(void* port_pointer, int32_t *status);
bool checkAnalogModule(uint8_t module);
bool checkAnalogInputChannel(uint32_t pin);
void setAnalogSampleRate(double samplesPerSecond, int32_t *status);
float getAnalogSampleRate(int32_t *status);
void setAnalogSampleRateWithModule(uint8_t module, double samplesPerSecond, int32_t *status);
float getAnalogSampleRateWithModule(uint8_t module, 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);
@@ -71,14 +69,11 @@ extern "C"
//// Float JNA Hack
// Float
int getAnalogSampleRateIntHack(int32_t *status);
int getAnalogSampleRateWithModuleIntHack(uint8_t module, 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);
void setAnalogSampleRateWithModuleIntHack(uint8_t module, 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);

View File

@@ -1,15 +1,26 @@
#pragma once
#ifdef __vxworks
#include <vxWorks.h>
#else
#include <stdint.h>
#endif
#include "NetworkCommunication/CANSessionMux.h"
extern "C"
{
void JaguarCANSendMessage(uint32_t messageID, const uint8_t *data, uint8_t dataSize,
int32_t *status);
void JaguarCANReceiveMessage(uint32_t *messageID, uint8_t *data, uint8_t *dataSize,
uint32_t timeoutMs, int32_t *status);
}
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);

View File

@@ -4,6 +4,7 @@
#else
#include <stdint.h>
#endif
#include "HAL/cpp/Synchronized.hpp"
enum Mode
{
@@ -12,40 +13,23 @@ enum Mode
kPulseLength = 2,
kExternalDirection = 3
};
enum tSPIConstants
{
kReceiveFIFODepth = 512,
kTransmitFIFODepth = 512
};
enum tFrameMode
{
kChipSelect,
kPreLatchPulse,
kPostLatchPulse,
kPreAndPostLatchPulse
};
extern "C"
{
void* initializeDigitalPort(void* port_pointer, int32_t *status);
bool checkDigitalModule(uint8_t module);
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 setPWMPeriodScale(void* digital_port_pointer, uint32_t squelchMask, int32_t *status);
void* allocatePWM(int32_t *status);
void* allocatePWMWithModule(uint8_t module, int32_t *status);
void freePWM(void* pwmGenerator, int32_t *status);
void freePWMWithModule(uint8_t module, void* pwmGenerator, int32_t *status);
void setPWMRate(double rate, int32_t *status);
void setPWMRateWithModule(uint8_t module, double rate, int32_t *status);
void setPWMDutyCycle(void* pwmGenerator, double dutyCycle, int32_t *status);
void setPWMDutyCycleWithModule(uint8_t module, void* pwmGenerator, double dutyCycle,
int32_t *status);
void setPWMOutputChannel(void* pwmGenerator, uint32_t pin, int32_t *status);
void setPWMOutputChannelWithModule(uint8_t module, 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);
@@ -60,18 +44,15 @@ extern "C"
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);
bool isAnyPulsingWithModule(uint8_t module, 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 setCounterUpSourceWithModule(void* counter_pointer, uint8_t module, uint32_t pin,
bool analogTrigger, int32_t *status); // TODO: Without Module
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 setCounterDownSourceWithModule(void* counter_pointer, uint8_t module, uint32_t pin,
bool analogTrigger, int32_t *status); // TODO: Without Module
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);
@@ -110,48 +91,30 @@ extern "C"
uint32_t getEncoderSamplesToAverage(void* encoder_pointer, int32_t *status);
uint16_t getLoopTiming(int32_t *status);
uint16_t getLoopTimingWithModule(uint8_t module, int32_t *status);
void* initializeSPI(uint8_t sclk_routing_module, uint32_t sclk_routing_pin,
uint8_t mosi_routing_module, uint32_t mosi_routing_pin, uint8_t miso_routing_module,
uint32_t miso_routing_pin, int32_t *status);
void cleanSPI(void* spi_pointer, int32_t *status);
void setSPIBitsPerWord(void* spi_pointer, uint32_t bits, int32_t *status);
uint32_t getSPIBitsPerWord(void* spi_pointer, int32_t *status);
void setSPIClockRate(void* spi_pointer, double hz, int32_t *status);
void setSPIMSBFirst(void* spi_pointer, int32_t *status);
void setSPILSBFirst(void* spi_pointer, int32_t *status);
void setSPISampleDataOnFalling(void* spi_pointer, int32_t *status);
void setSPISampleDataOnRising(void* spi_pointer, int32_t *status);
void setSPISlaveSelect(void* spi_pointer, uint8_t ss_routing_module, uint32_t ss_routing_pin,
int32_t *status);
void setSPILatchMode(void* spi_pointer, tFrameMode mode, int32_t *status);
tFrameMode getSPILatchMode(void* spi_pointer, int32_t *status);
void setSPIFramePolarity(void* spi_pointer, bool activeLow, int32_t *status);
bool getSPIFramePolarity(void* spi_pointer, int32_t *status);
void setSPIClockActiveLow(void* spi_pointer, int32_t *status);
void setSPIClockActiveHigh(void* spi_pointer, int32_t *status);
void applySPIConfig(void* spi_pointer, int32_t *status);
uint16_t getSPIOutputFIFOAvailable(void* spi_pointer, int32_t *status);
uint16_t getSPINumReceived(void* spi_pointer, int32_t *status);
bool isSPIDone(void* spi_pointer, int32_t *status);
bool hadSPIReceiveOverflow(void* spi_pointer, int32_t *status);
void writeSPI(void* spi_pointer, uint32_t data, int32_t *status);
uint32_t readSPI(void* spi_pointer, bool initiate, int32_t *status);
void resetSPI(void* spi_pointer, int32_t *status);
void clearSPIReceivedData(void* spi_pointer, 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 spiSetBitsPerWord(uint8_t port, uint8_t bpw);
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);
MUTEX_ID spiGetSemaphore(uint8_t port);
void spiSetSemaphore(uint8_t port, MUTEX_ID semaphore);
void i2CInitialize(uint8_t port, int32_t *status);
int i2CTransaction(uint8_t port, uint8_t deviceAddress, uint8_t *dataToSend, uint8_t sendSize, uint8_t *dataReceived, uint8_t receiveSize);
int i2CWrite(uint8_t port, uint8_t deviceAddress, uint8_t *dataToSend, uint8_t sendSize);
int i2CRead(uint8_t port, uint8_t deviceAddress, uint8_t *buffer, uint8_t count);
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 setPWMRateWithModuleIntHack(uint8_t module, int32_t rate, int32_t *status);
void setPWMDutyCycleIntHack(void* pwmGenerator, int32_t dutyCycle, int32_t *status);
void setPWMDutyCycleWithModuleIntHack(uint8_t module, void* pwmGenerator, int32_t dutyCycle,
int32_t *status);
}

View File

@@ -3,7 +3,7 @@
#define SAMPLE_RATE_TOO_HIGH 1
#define SAMPLE_RATE_TOO_HIGH_MESSAGE "Analog module sample rate is too high"
#define VOLTAGE_OUT_OF_RANGE 2
#define VOLTAGE_OUT_OF_RANGE_MESSAGE "Voltage to convert to raw value is out of range [-10; 10]"
#define VOLTAGE_OUT_OF_RANGE_MESSAGE "Voltage to convert to raw value is out of range [0; 5]"
#define LOOP_TIMING_ERROR 4
#define LOOP_TIMING_ERROR_MESSAGE "Digital module loop timing is not the expected value"
#define SPI_WRITE_NO_MOSI 12

View File

@@ -12,7 +12,9 @@
#endif
#include <cmath>
#include "Accelerometer.hpp"
#include "Analog.hpp"
#include "CAN.hpp"
#include "Compressor.hpp"
#include "Digital.hpp"
#include "Solenoid.hpp"
@@ -20,6 +22,7 @@
#include "Interrupts.hpp"
#include "Errors.hpp"
#include "PDP.hpp"
#include "Power.hpp"
#include "Utilities.hpp"
#include "Semaphore.hpp"
@@ -28,7 +31,6 @@
#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 HAL_USER_DS_LCD_DATA_SIZE 128
#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
@@ -140,119 +142,32 @@ namespace HALUsageReporting
};
}
struct HALCommonControlData
{
uint16_t packetIndex;
union
{
uint8_t control;
#ifndef __vxworks
struct
{
uint8_t checkVersions :1;
uint8_t test :1;
uint8_t resync :1;
uint8_t fmsAttached :1;
uint8_t autonomous :1;
uint8_t enabled :1;
uint8_t notEStop :1;
uint8_t reset :1;
};
#else
struct
{
uint8_t reset : 1;
uint8_t notEStop : 1;
uint8_t enabled : 1;
uint8_t autonomous : 1;
uint8_t fmsAttached:1;
uint8_t resync : 1;
uint8_t test :1;
uint8_t checkVersions :1;
};
#endif
};
uint8_t dsDigitalIn;
uint16_t teamID;
char dsID_Alliance;
char dsID_Position;
union
{
int8_t stick0Axes[6];
struct
{ // TODO: ???
int8_t stick0Axis1;
int8_t stick0Axis2;
int8_t stick0Axis3;
int8_t stick0Axis4;
int8_t stick0Axis5;
int8_t stick0Axis6;
};
};
uint16_t stick0Buttons; // Left-most 4 bits are unused
union
{
int8_t stick1Axes[6];
struct
{ // TODO: ???
int8_t stick1Axis1;
int8_t stick1Axis2;
int8_t stick1Axis3;
int8_t stick1Axis4;
int8_t stick1Axis5;
int8_t stick1Axis6;
};
};
uint16_t stick1Buttons; // Left-most 4 bits are unused
union
{
int8_t stick2Axes[6];
struct
{ // TODO: ???
int8_t stick2Axis1;
int8_t stick2Axis2;
int8_t stick2Axis3;
int8_t stick2Axis4;
int8_t stick2Axis5;
int8_t stick2Axis6;
};
};
uint16_t stick2Buttons; // Left-most 4 bits are unused
union
{
int8_t stick3Axes[6];
struct
{ // TODO: ???
int8_t stick3Axis1;
int8_t stick3Axis2;
int8_t stick3Axis3;
int8_t stick3Axis4;
int8_t stick3Axis5;
int8_t stick3Axis6;
};
};
uint16_t stick3Buttons; // Left-most 4 bits are unused
//Analog inputs are 10 bit right-justified
uint16_t analog1;
uint16_t analog2;
uint16_t analog3;
uint16_t analog4;
uint64_t cRIOChecksum;
uint32_t FPGAChecksum0;
uint32_t FPGAChecksum1;
uint32_t FPGAChecksum2;
uint32_t FPGAChecksum3;
char versionData[8];
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,
};
struct HALJoystickAxes {
uint16_t count;
int16_t axes[6];
};
typedef uint32_t HALJoystickButtons;
inline float intToFloat(int value)
{
return (float)value;
@@ -278,18 +193,16 @@ extern "C"
uint32_t getFPGARevision(int32_t *status);
uint32_t getFPGATime(int32_t *status);
void setFPGALED(uint32_t state, int32_t *status);
int32_t getFPGALED(int32_t *status);
bool getFPGAButton(int32_t *status);
int HALSetErrorData(const char *errors, int errorsLength, int wait_ms);
int HALSetUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
int HALOverrideIOConfig(const char *ioConfig, int wait_ms);
int HALGetDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
int HALGetCommonControlData(HALCommonControlData *data, int wait_ms);
int HALGetControlWord(HALControlWord *data);
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation);
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes);
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
void HALSetNewDataSem(pthread_mutex_t *);
int HALSetStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength, const char *userDataLow,
int userDataLowLength, int wait_ms);
int HALInitialize(int mode = 0);
void HALNetworkCommunicationObserveUserProgramStarting();
@@ -311,4 +224,3 @@ extern "C"
void EDVR_CreateReference();
void Occur();
}

15
hal/include/HAL/Power.hpp Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
extern "C"
{
float getVinVoltage(int32_t *status);
float getVinCurrent(int32_t *status);
float getUserVoltage6V(int32_t *status);
float getUserCurrent6V(int32_t *status);
float getUserVoltage5V(int32_t *status);
float getUserCurrent5V(int32_t *status);
float getUserVoltage3V3(int32_t *status);
float getUserCurrent3V3(int32_t *status);
}

View File

@@ -1,13 +0,0 @@
#pragma once
#ifdef __vxworks
#include <vxWorks.h>
#else
#include <stdint.h>
#endif
extern "C"
{
void printCurrentStackTrace();
bool getErrnoToName(int32_t errNo, char* name);
}

View File

@@ -0,0 +1,234 @@
#include "HAL/Accelerometer.hpp"
#include "ChipObject.h"
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
// The 7-bit I2C address with a 0 "send" bit
static const uint8_t kSendAddress = (0x1c << 1) | 0;
// The 7-bit I2C address with a 1 "receive" bit
static const uint8_t kReceiveAddress = (0x1c << 1) | 1;
static const uint8_t kControlTxRx = 1;
static const uint8_t kControlStart = 2;
static const uint8_t kControlStop = 4;
static tAccel *accel = 0;
static AccelerometerRange accelerometerRange;
// Register addresses
enum Register {
kReg_Status = 0x00,
kReg_OutXMSB = 0x01,
kReg_OutXLSB = 0x02,
kReg_OutYMSB = 0x03,
kReg_OutYLSB = 0x04,
kReg_OutZMSB = 0x05,
kReg_OutZLSB = 0x06,
kReg_Sysmod = 0x0B,
kReg_IntSource = 0x0C,
kReg_WhoAmI = 0x0D,
kReg_XYZDataCfg = 0x0E,
kReg_HPFilterCutoff = 0x0F,
kReg_PLStatus = 0x10,
kReg_PLCfg = 0x11,
kReg_PLCount = 0x12,
kReg_PLBfZcomp = 0x13,
kReg_PLThsReg = 0x14,
kReg_FFMtCfg = 0x15,
kReg_FFMtSrc = 0x16,
kReg_FFMtThs = 0x17,
kReg_FFMtCount = 0x18,
kReg_TransientCfg = 0x1D,
kReg_TransientSrc = 0x1E,
kReg_TransientThs = 0x1F,
kReg_TransientCount = 0x20,
kReg_PulseCfg = 0x21,
kReg_PulseSrc = 0x22,
kReg_PulseThsx = 0x23,
kReg_PulseThsy = 0x24,
kReg_PulseThsz = 0x25,
kReg_PulseTmlt = 0x26,
kReg_PulseLtcy = 0x27,
kReg_PulseWind = 0x28,
kReg_ASlpCount = 0x29,
kReg_CtrlReg1 = 0x2A,
kReg_CtrlReg2 = 0x2B,
kReg_CtrlReg3 = 0x2C,
kReg_CtrlReg4 = 0x2D,
kReg_CtrlReg5 = 0x2E,
kReg_OffX = 0x2F,
kReg_OffY = 0x30,
kReg_OffZ = 0x31
};
extern "C" uint32_t getFPGATime(int32_t *status);
static void writeRegister(Register reg, uint8_t data);
static uint8_t readRegister(Register reg);
/**
* Initialize the accelerometer.
*/
static void initializeAccelerometer() {
int32_t status;
if(!accel) {
accel = tAccel::create(&status);
// Enable I2C
accel->writeCNFG(1, &status);
// Set the counter to 100 kbps
accel->writeCNTR(213, &status);
// The device identification number should be 0x2a
assert(readRegister(kReg_WhoAmI) == 0x2a);
}
}
static void writeRegister(Register reg, uint8_t data) {
int32_t status = 0;
uint32_t initialTime;
accel->writeADDR(kSendAddress, &status);
// Send a start transmit/receive message with the register address
accel->writeCNTL(kControlStart | kControlTxRx, &status);
accel->writeDATO(reg, &status);
accel->strobeGO(&status);
// Execute and wait until it's done (up to a millisecond)
initialTime = getFPGATime(&status);
while(accel->readSTAT(&status) & 1) {
if(getFPGATime(&status) > initialTime + 1000) break;
}
// Send a stop transmit/receive message with the data
accel->writeCNTL(kControlStop | kControlTxRx, &status);
accel->writeDATO(data, &status);
accel->strobeGO(&status);
// Execute and wait until it's done (up to a millisecond)
initialTime = getFPGATime(&status);
while(accel->readSTAT(&status) & 1) {
if(getFPGATime(&status) > initialTime + 1000) break;
}
fflush(stdout);
}
static uint8_t readRegister(Register reg) {
int32_t status = 0;
uint32_t initialTime;
// Send a start transmit/receive message with the register address
accel->writeADDR(kSendAddress, &status);
accel->writeCNTL(kControlStart | kControlTxRx, &status);
accel->writeDATO(reg, &status);
accel->strobeGO(&status);
// Execute and wait until it's done (up to a millisecond)
initialTime = getFPGATime(&status);
while(accel->readSTAT(&status) & 1) {
if(getFPGATime(&status) > initialTime + 1000) break;
}
// Receive a message with the data and stop
accel->writeADDR(kReceiveAddress, &status);
accel->writeCNTL(kControlStart | kControlStop | kControlTxRx, &status);
accel->strobeGO(&status);
// Execute and wait until it's done (up to a millisecond)
initialTime = getFPGATime(&status);
while(accel->readSTAT(&status) & 1) {
if(getFPGATime(&status) > initialTime + 1000) break;
}
fflush(stdout);
return accel->readDATI(&status);
}
/**
* Convert a 12-bit raw acceleration value into a scaled double in units of
* 1 g-force, taking into account the accelerometer range.
*/
static double unpackAxis(int16_t raw) {
// The raw value is actually 12 bits, not 16, so we need to propogate the
// 2's complement sign bit to the unused 4 bits for this to work with
// negative numbers.
raw <<= 4;
raw >>= 4;
switch(accelerometerRange) {
case kRange_2G: return raw / 1024.0;
case kRange_4G: return raw / 512.0;
case kRange_8G: return raw / 256.0;
default: return 0.0;
}
}
/**
* Set the accelerometer to active or standby mode. It must be in standby
* mode to change any configuration.
*/
void setAccelerometerActive(bool active) {
initializeAccelerometer();
uint8_t ctrlReg1 = readRegister(kReg_CtrlReg1);
ctrlReg1 &= ~1; // Clear the existing active bit
writeRegister(kReg_CtrlReg1, ctrlReg1 | (active? 1 : 0));
}
/**
* Set the range of values that can be measured (either 2, 4, or 8 g-forces).
* The accelerometer should be in standby mode when this is called.
*/
void setAccelerometerRange(AccelerometerRange range) {
initializeAccelerometer();
accelerometerRange = range;
uint8_t xyzDataCfg = readRegister(kReg_XYZDataCfg);
xyzDataCfg &= ~3; // Clear the existing two range bits
writeRegister(kReg_XYZDataCfg, xyzDataCfg | range);
}
/**
* Get the x-axis acceleration
*
* This is a floating point value in units of 1 g-force
*/
double getAccelerometerX() {
initializeAccelerometer();
int raw = (readRegister(kReg_OutXMSB) << 4) | (readRegister(kReg_OutXLSB) >> 4);
return unpackAxis(raw);
}
/**
* Get the y-axis acceleration
*
* This is a floating point value in units of 1 g-force
*/
double getAccelerometerY() {
initializeAccelerometer();
int raw = (readRegister(kReg_OutYMSB) << 4) | (readRegister(kReg_OutYLSB) >> 4);
return unpackAxis(raw);
}
/**
* Get the z-axis acceleration
*
* This is a floating point value in units of 1 g-force
*/
double getAccelerometerZ() {
initializeAccelerometer();
int raw = (readRegister(kReg_OutZMSB) << 4) | (readRegister(kReg_OutZLSB) >> 4);
return unpackAxis(raw);
}

View File

@@ -102,7 +102,7 @@ bool checkAnalogModule(uint8_t module) {
* @return Analog channel is valid
*/
bool checkAnalogInputChannel(uint32_t pin) {
if (pin >= 0 && pin < kAnalogInputPins)
if (pin < kAnalogInputPins)
return true;
return false;
}
@@ -115,7 +115,7 @@ bool checkAnalogInputChannel(uint32_t pin) {
* @return Analog channel is valid
*/
bool checkAnalogOutputChannel(uint32_t pin) {
if (pin >= 0 && pin < kAnalogOutputPins)
if (pin < kAnalogOutputPins)
return true;
return false;
}
@@ -185,40 +185,6 @@ float getAnalogSampleRate(int32_t *status) {
return (float)kTimebase / (float)ticksPerSample;
}
/**
* Set the sample rate on the module.
*
* This is a global setting for the module and effects all channels.
*
* @param module The module to use
* @param samplesPerSecond The number of samples per channel per second.
*/
void setAnalogSampleRateWithModule(uint8_t module, double samplesPerSecond, int32_t *status) {
if (checkAnalogModule(module)) {
setAnalogSampleRate(samplesPerSecond, status);
} else {
// XXX: Set error status
}
}
/**
* Get the current sample rate on the module.
*
* This assumes one entry in the scan list.
* This is a global setting for the module and effects all channels.
*
* @param module The module to use
* @return Sample rate.
*/
float getAnalogSampleRateWithModule(uint8_t module, int32_t *status) {
if (checkAnalogModule(module)) {
return getAnalogSampleRate(status);
} else {
return -1; // XXX: Set error status
}
}
/**
* Set the number of averaging bits.
*
@@ -283,7 +249,7 @@ uint32_t getAnalogOversampleBits(void* analog_port_pointer, int32_t *status) {
/**
* Get a sample straight from the channel on this module.
*
* The sample is a 12-bit value representing the -10V to 10V range of the A/D converter in the module.
* The sample is a 12-bit value representing the 0V to 5V range of the A/D converter in the module.
* The units are in A/D converter codes. Use GetVoltage() to get the analog value in calibrated units.
*
* @param analog_port_pointer Pointer to the analog port to use.
@@ -322,7 +288,7 @@ int16_t getAnalogValue(void* analog_port_pointer, int32_t *status) {
*/
int32_t getAnalogAverageValue(void* analog_port_pointer, int32_t *status) {
AnalogPort* port = (AnalogPort*) analog_port_pointer;
int16_t value;
int32_t value;
checkAnalogInputChannel(port->port.pin);
tAI::tReadSelect readSelect;
@@ -333,7 +299,7 @@ int32_t getAnalogAverageValue(void* analog_port_pointer, int32_t *status) {
Synchronized sync(analogRegisterWindowSemaphore);
analogInputSystem->writeReadSelect(readSelect, status);
analogInputSystem->strobeLatchOutput(status);
value = (int16_t) analogInputSystem->readOutput(status);
value = (int32_t) analogInputSystem->readOutput(status);
}
return value;
@@ -387,12 +353,12 @@ float getAnalogAverageVoltage(void* analog_port_pointer, int32_t *status) {
* @return The raw value for the channel.
*/
int32_t getAnalogVoltsToValue(void* analog_port_pointer, double voltage, int32_t *status) {
if (voltage > 10.0) {
voltage = 10.0;
if (voltage > 5.0) {
voltage = 5.0;
*status = VOLTAGE_OUT_OF_RANGE;
}
if (voltage < -10.0) {
voltage = -10.0;
if (voltage < 0.0) {
voltage = 0.0;
*status = VOLTAGE_OUT_OF_RANGE;
}
uint32_t LSBWeight = getAnalogLSBWeight(analog_port_pointer, status);
@@ -736,10 +702,6 @@ int getAnalogSampleRateIntHack(int32_t *status) {
return floatToInt(getAnalogSampleRate(status));
}
int getAnalogSampleRateWithModuleIntHack(uint8_t module, int32_t *status) {
return floatToInt(getAnalogSampleRateWithModuleIntHack(module, status));
}
int getAnalogVoltageIntHack(void* analog_port_pointer, int32_t *status) {
return floatToInt(getAnalogVoltage(analog_port_pointer, status));
}
@@ -754,10 +716,6 @@ void setAnalogSampleRateIntHack(int samplesPerSecond, int32_t *status) {
setAnalogSampleRate(intToFloat(samplesPerSecond), status);
}
void setAnalogSampleRateWithModuleIntHack(uint8_t module, int samplesPerSecond, int32_t *status) {
setAnalogSampleRateWithModule(module, intToFloat(samplesPerSecond), status);
}
int32_t getAnalogVoltsToValueIntHack(void* analog_port_pointer, int voltage, int32_t *status) {
return getAnalogVoltsToValue(analog_port_pointer, intToFloat(voltage), status);
}

232
hal/lib/Athena/CAN.cpp Normal file
View File

@@ -0,0 +1,232 @@
#include "HAL/CAN.hpp"
#include <map>
struct CANMessage
{
uint8_t data[8];
};
static std::map<uint32_t, CANMessage> outgoingMessages;
static std::map<uint32_t, CANMessage> incomingMessages;
static const uint32_t kFullMessageIDMask = 0x1fffffff;
/**
* Gets the data from the outgoing hashmap and calls
* CANSessionMux...sendMessage.
*/
void canTxSend(uint32_t arbID, uint8_t length, int32_t period)
{
CANMessage &message = outgoingMessages[arbID];
int32_t status;
FRC_NetworkCommunication_CANSessionMux_sendMessage(
arbID, message.data, length, period, &status);
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time an single byte field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt8(uint32_t arbID, uint8_t offset, uint8_t value)
{
CANMessage &message = outgoingMessages[arbID];
message.data[offset] = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a short integer field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt16(uint32_t arbID, uint8_t offset, uint16_t value)
{
CANMessage &message = outgoingMessages[arbID];
*(uint16_t *)(message.data + offset) = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a long integer field changes in a message.data,
* such as when a setter on a CAN device is called.
*/
void canTxPackInt32(uint32_t arbID, uint8_t offset, uint32_t value)
{
CANMessage &message = outgoingMessages[arbID];
*(uint32_t *)(message.data + offset) = value;
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time an 8.8 fixed point field changes in a message,
* such as when a setter on a CAN device is called.
*/
void canTxPackFXP16(uint32_t arbID, uint8_t offset, double value)
{
int16_t raw = value * 255.0;
canTxPackInt16(arbID, offset, raw);
}
/**
* Updates a field in the outgoing hashmap.
*
* This is called every time a 16.16 fixed point field changes in a message,
* such as when a setter on a CAN device is called.
*/
void canTxPackFXP32(uint32_t arbID, uint8_t offset, double value)
{
int32_t raw = value * 65535.0;
canTxPackInt32(arbID, offset, raw);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint8_t canTxUnpackInt8(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return message.data[offset];
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint16_t canTxUnpackInt16(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return *reinterpret_cast<uint16_t *>(message.data + offset);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
uint32_t canTxUnpackInt32(uint32_t arbID, uint8_t offset)
{
CANMessage &message = outgoingMessages[arbID];
return *reinterpret_cast<uint32_t *>(message.data + offset);
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
double canTxUnpackFXP16(uint32_t arbID, uint8_t offset)
{
int16_t raw = canTxUnpackInt16(arbID, offset);
return raw / 255.0;
}
/**
* Unpack a field from the outgoing hashmap.
*
* This is called in getters for configuration data.
*/
double canTxUnpackFXP32(uint32_t arbID, uint8_t offset)
{
int32_t raw = canTxUnpackInt32(arbID, offset);
return raw / 65535.0;
}
/**
* Get data from CANSessionMux (if it's available) and put it in the incoming
* hashmap.
*
* @return true if there's new data. Otherwise, the last received value should
* still be in the hashmap.
*/
bool canRxReceive(uint32_t arbID)
{
CANMessage &message = incomingMessages[arbID];
uint8_t length;
uint32_t timestamp;
int32_t status;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(
&arbID, kFullMessageIDMask, message.data, &length, &timestamp, &status);
return status != ERR_CANSessionMux_MessageNotFound;
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint8_t canRxUnpackInt8(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return message.data[offset];
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint16_t canRxUnpackInt16(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return *reinterpret_cast<uint16_t *>(message.data + offset);
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
uint32_t canRxUnpackInt32(uint32_t arbID, uint8_t offset)
{
CANMessage &message = incomingMessages[arbID];
return *reinterpret_cast<uint32_t *>(message.data + offset);
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
double canRxUnpackFXP16(uint32_t arbID, uint8_t offset)
{
int16_t raw = canRxUnpackInt16(arbID, offset);
return raw / 255.0;
}
/**
* Unpack a field from the incoming hashmap.
*
* This is called in getters for status data.
*/
double canRxUnpackFXP32(uint32_t arbID, uint8_t offset)
{
int32_t raw = canRxUnpackInt32(arbID, offset);
return raw / 65535.0;
}

View File

@@ -4,33 +4,35 @@
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
/*----------------------------------------------------------------------------*/
#pragma once
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
#include <stdint.h>
#include "ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
#include "ChipObject/tDMAManager.h"
#include "ChipObject/tInterruptManager.h"
#include "ChipObject/tSystem.h"
#include "ChipObject/tSystemInterface.h"
#include "ChipObject/nInterfaceGlobals.h"
#include "ChipObject/tAccel.h"
#include "ChipObject/tAccumulator.h"
#include "ChipObject/tAI.h"
#include "ChipObject/tAlarm.h"
#include "ChipObject/tAnalogTrigger.h"
#include "ChipObject/tAO.h"
#include "ChipObject/tBIST.h"
#include "ChipObject/tCounter.h"
#include "ChipObject/tDIO.h"
#include "ChipObject/tDMA.h"
#include "ChipObject/tEncoder.h"
#include "ChipObject/tGlobal.h"
#include "ChipObject/tInterrupt.h"
#include "ChipObject/tPower.h"
#include "ChipObject/tPWM.h"
#include "ChipObject/tRelay.h"
#include "ChipObject/tSPI.h"
#include "ChipObject/tSysWatchdog.h"
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.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;

View File

@@ -1,15 +0,0 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_5_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2015_1_0_5
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2015_1_0_5_nInterfaceGlobals_h__

View File

@@ -1,107 +0,0 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Power_h__
#define __nFRC_2015_1_0_5_Power_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
{
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 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
{
} 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
{
} 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;
typedef enum
{
} tIndicateOutOfRange_IfaceConstants;
virtual void writeIndicateOutOfRange(bool value, tRioStatusCode *status) = 0;
virtual bool readIndicateOutOfRange(tRioStatusCode *status) = 0;
private:
tPower(const tPower&);
void operator=(const tPower&);
};
}
}
#endif // __nFRC_2015_1_0_5_Power_h__

View File

@@ -2,21 +2,20 @@
#include "ctre/PCM.h"
#include <iostream>
static const int NUM_PCMS = 2;
extern PCM *modules[NUM_PCMS];
extern void initializePCM();
static const int NUM_MODULE_NUMBERS = 63;
extern PCM *modules[NUM_MODULE_NUMBERS];
extern void initializePCM(int module);
void *initializeCompressor(uint8_t module) {
initializePCM();
initializePCM(module);
return modules[module - 1];
return modules[module];
}
bool checkCompressorModule(uint8_t module) {
return module > 0 and module <= NUM_PCMS;
return module < NUM_MODULE_NUMBERS;
}
bool getCompressor(void *pcm_pointer, int32_t *status) {
PCM *module = (PCM *)pcm_pointer;
bool value;

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,6 @@
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
#define __RoboRIO_FRC_ChipObject_Aliases_h__
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_5
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_7
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -0,0 +1,15 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_7_nInterfaceGlobals_h__
#define __nFRC_2015_1_0_7_nInterfaceGlobals_h__
namespace nFPGA
{
namespace nFRC_2015_1_0_7
{
extern unsigned int g_currentTargetClass;
}
}
#endif // __nFRC_2015_1_0_7_nInterfaceGlobals_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_AI_h__
#define __nFRC_2015_1_0_5_AI_h__
#ifndef __nFRC_2015_1_0_7_AI_h__
#define __nFRC_2015_1_0_7_AI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAI
@@ -140,4 +140,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_AI_h__
#endif // __nFRC_2015_1_0_7_AI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_AO_h__
#define __nFRC_2015_1_0_5_AO_h__
#ifndef __nFRC_2015_1_0_7_AO_h__
#define __nFRC_2015_1_0_7_AO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAO
@@ -47,4 +47,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_AO_h__
#endif // __nFRC_2015_1_0_7_AO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Accel_h__
#define __nFRC_2015_1_0_5_Accel_h__
#ifndef __nFRC_2015_1_0_7_Accel_h__
#define __nFRC_2015_1_0_7_Accel_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAccel
@@ -99,4 +99,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Accel_h__
#endif // __nFRC_2015_1_0_7_Accel_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Accumulator_h__
#define __nFRC_2015_1_0_5_Accumulator_h__
#ifndef __nFRC_2015_1_0_7_Accumulator_h__
#define __nFRC_2015_1_0_7_Accumulator_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAccumulator
@@ -84,4 +84,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Accumulator_h__
#endif // __nFRC_2015_1_0_7_Accumulator_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Alarm_h__
#define __nFRC_2015_1_0_5_Alarm_h__
#ifndef __nFRC_2015_1_0_7_Alarm_h__
#define __nFRC_2015_1_0_7_Alarm_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAlarm
@@ -54,4 +54,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Alarm_h__
#endif // __nFRC_2015_1_0_7_Alarm_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_AnalogTrigger_h__
#define __nFRC_2015_1_0_5_AnalogTrigger_h__
#ifndef __nFRC_2015_1_0_7_AnalogTrigger_h__
#define __nFRC_2015_1_0_7_AnalogTrigger_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tAnalogTrigger
@@ -126,4 +126,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_AnalogTrigger_h__
#endif // __nFRC_2015_1_0_7_AnalogTrigger_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_BIST_h__
#define __nFRC_2015_1_0_5_BIST_h__
#ifndef __nFRC_2015_1_0_7_BIST_h__
#define __nFRC_2015_1_0_7_BIST_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tBIST
@@ -87,4 +87,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_BIST_h__
#endif // __nFRC_2015_1_0_7_BIST_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Counter_h__
#define __nFRC_2015_1_0_5_Counter_h__
#ifndef __nFRC_2015_1_0_7_Counter_h__
#define __nFRC_2015_1_0_7_Counter_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tCounter
@@ -216,4 +216,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Counter_h__
#endif // __nFRC_2015_1_0_7_Counter_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_DIO_h__
#define __nFRC_2015_1_0_5_DIO_h__
#ifndef __nFRC_2015_1_0_7_DIO_h__
#define __nFRC_2015_1_0_7_DIO_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tDIO
@@ -137,15 +137,6 @@ public:
virtual unsigned char readFilterSelectHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterPeriodMXPElements = 3,
} tFilterPeriodMXP_IfaceConstants;
virtual void writeFilterPeriodMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readFilterPeriodMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tOutputEnable_IfaceConstants;
@@ -218,15 +209,6 @@ public:
virtual unsigned char readPulseLength(tRioStatusCode *status) = 0;
typedef enum
{
kNumFilterPeriodHdrElements = 3,
} tFilterPeriodHdr_IfaceConstants;
virtual void writeFilterPeriodHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
virtual unsigned char readFilterPeriodHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
typedef enum
{
} tPWMPeriodPower_IfaceConstants;
@@ -237,6 +219,24 @@ public:
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&);
@@ -245,4 +245,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_DIO_h__
#endif // __nFRC_2015_1_0_7_DIO_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_DMA_h__
#define __nFRC_2015_1_0_5_DMA_h__
#ifndef __nFRC_2015_1_0_7_DMA_h__
#define __nFRC_2015_1_0_7_DMA_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tDMA
@@ -185,4 +185,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_DMA_h__
#endif // __nFRC_2015_1_0_7_DMA_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Encoder_h__
#define __nFRC_2015_1_0_5_Encoder_h__
#ifndef __nFRC_2015_1_0_7_Encoder_h__
#define __nFRC_2015_1_0_7_Encoder_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tEncoder
@@ -196,4 +196,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Encoder_h__
#endif // __nFRC_2015_1_0_7_Encoder_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Global_h__
#define __nFRC_2015_1_0_5_Global_h__
#ifndef __nFRC_2015_1_0_7_Global_h__
#define __nFRC_2015_1_0_7_Global_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tGlobal
@@ -101,4 +101,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Global_h__
#endif // __nFRC_2015_1_0_7_Global_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Interrupt_h__
#define __nFRC_2015_1_0_5_Interrupt_h__
#ifndef __nFRC_2015_1_0_7_Interrupt_h__
#define __nFRC_2015_1_0_7_Interrupt_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tInterrupt
@@ -90,4 +90,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Interrupt_h__
#endif // __nFRC_2015_1_0_7_Interrupt_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_PWM_h__
#define __nFRC_2015_1_0_5_PWM_h__
#ifndef __nFRC_2015_1_0_7_PWM_h__
#define __nFRC_2015_1_0_7_PWM_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tPWM
@@ -108,4 +108,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_PWM_h__
#endif // __nFRC_2015_1_0_7_PWM_h__

View File

@@ -0,0 +1,217 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_7_Power_h__
#define __nFRC_2015_1_0_7_Power_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_7
{
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 : 10;
unsigned OverCurrentFaultCount5V : 10;
unsigned OverCurrentFaultCount6V : 10;
#else
unsigned OverCurrentFaultCount6V : 10;
unsigned OverCurrentFaultCount5V : 10;
unsigned OverCurrentFaultCount3V3 : 10;
#endif
};
struct{
unsigned value : 30;
};
} tOverCurrentFaultCounts;
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
{
} tOverCurrentFaultCounts_IfaceConstants;
virtual tOverCurrentFaultCounts readOverCurrentFaultCounts(tRioStatusCode *status) = 0;
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount3V3(tRioStatusCode *status) = 0;
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount5V(tRioStatusCode *status) = 0;
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount6V(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
{
} 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_2015_1_0_7_Power_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_Relay_h__
#define __nFRC_2015_1_0_5_Relay_h__
#ifndef __nFRC_2015_1_0_7_Relay_h__
#define __nFRC_2015_1_0_7_Relay_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tRelay
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_Relay_h__
#endif // __nFRC_2015_1_0_7_Relay_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_SPI_h__
#define __nFRC_2015_1_0_5_SPI_h__
#ifndef __nFRC_2015_1_0_7_SPI_h__
#define __nFRC_2015_1_0_7_SPI_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tSPI
@@ -65,4 +65,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_SPI_h__
#endif // __nFRC_2015_1_0_7_SPI_h__

View File

@@ -1,14 +1,14 @@
// Copyright (c) National Instruments 2008. All Rights Reserved.
// Do Not Edit... this file is generated!
#ifndef __nFRC_2015_1_0_5_SysWatchdog_h__
#define __nFRC_2015_1_0_5_SysWatchdog_h__
#ifndef __nFRC_2015_1_0_7_SysWatchdog_h__
#define __nFRC_2015_1_0_7_SysWatchdog_h__
#include "tSystemInterface.h"
namespace nFPGA
{
namespace nFRC_2015_1_0_5
namespace nFRC_2015_1_0_7
{
class tSysWatchdog
@@ -98,4 +98,4 @@ private:
}
}
#endif // __nFRC_2015_1_0_5_SysWatchdog_h__
#endif // __nFRC_2015_1_0_7_SysWatchdog_h__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -12,9 +12,9 @@ public:
tSystemInterface(){}
virtual ~tSystemInterface(){}
virtual uint16_t getExpectedFPGAVersion()=0;
virtual uint32_t getExpectedFPGARevision()=0;
virtual uint32_t * getExpectedFPGASignature()=0;
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;
@@ -23,4 +23,3 @@ public:
}
#endif // __tSystemInterface_h__

View File

@@ -6,7 +6,6 @@
#include "NetworkCommunication/FRCComm.h"
#include "NetworkCommunication/UsageReporting.h"
#include "NetworkCommunication/LoadOut.h"
#include "ChipObject/nInterfaceGlobals.h"
#include <fstream>
#include <iostream>
#include <unistd.h>
@@ -16,6 +15,8 @@ const uint32_t dio_kNumSystems = tDIO::kNumSystems;
const uint32_t interrupt_kNumSystems = tInterrupt::kNumSystems;
const uint32_t kSystemClockTicksPerMicrosecond = 40;
static tGlobal *global;
void* getPort(uint8_t pin)
{
Port* port = new Port();
@@ -74,10 +75,7 @@ const char* getHALErrorMessage(int32_t code)
*/
uint16_t getFPGAVersion(int32_t *status)
{
tGlobal *global = tGlobal::create(status);
uint16_t version = global->readVersion(status);
delete global;
return version;
return global->readVersion(status);
}
/**
@@ -90,48 +88,26 @@ uint16_t getFPGAVersion(int32_t *status)
*/
uint32_t getFPGARevision(int32_t *status)
{
tGlobal *global = tGlobal::create(status);
uint32_t revision = global->readRevision(status);
delete global;
return revision;
return global->readRevision(status);
}
/**
* Read the microsecond-resolution timer on the FPGA.
*
*
* @return The current time in microseconds according to the FPGA (since FPGA reset).
*/
uint32_t getFPGATime(int32_t *status)
{
tGlobal *global = tGlobal::create(status);
uint32_t time = global->readLocalTime(status);
delete global;
return time;
return global->readLocalTime(status);
}
/**
* Set the state of the FPGA status LED on the cRIO.
* Get the state of the "USER" button on the RoboRIO
* @return true if the button is currently pressed down
*/
void setFPGALED(uint32_t state, int32_t *status)
bool getFPGAButton(int32_t *status)
{
// XXX: Not supported?
// tGlobal *global = tGlobal::create(status);
// global->writeFPGA_LED(state, status);
// delete global;
}
/**
* Get the current state of the FPGA status LED on the cRIO.
* @return The curent state of the FPGA LED.
*/
int32_t getFPGALED(int32_t *status)
{
// XXX: Not supported?
// tGlobal *global = tGlobal::create(status);
// bool ledValue = global->readFPGA_LED(status);
// delete global;
// return ledValue;
return 0; // XXX: Dummy value
return global->readUserButton(status);
}
int HALSetErrorData(const char *errors, int errorsLength, int wait_ms)
@@ -139,26 +115,24 @@ int HALSetErrorData(const char *errors, int errorsLength, int wait_ms)
return setErrorData(errors, errorsLength, wait_ms);
}
int HALSetUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength,
int wait_ms)
int HALGetControlWord(HALControlWord *data)
{
return setUserDsLcdData(userDsLcdData, userDsLcdDataLength, wait_ms);
return FRC_NetworkCommunication_getControlWord((ControlWord_t*) data);
}
int HALOverrideIOConfig(const char *ioConfig, int wait_ms)
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation)
{
return overrideIOConfig(ioConfig, wait_ms);
return FRC_NetworkCommunication_getAllianceStation((AllianceStationID_t*) allianceStation);
}
int HALGetDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength,
int wait_ms)
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes)
{
return getDynamicControlData(type, dynamicData, maxLength, wait_ms);
return FRC_NetworkCommunication_getJoystickAxes(joystickNum, (JoystickAxes_t*) axes, maxAxes);
}
int HALGetCommonControlData(HALCommonControlData *data, int wait_ms)
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count)
{
return getRecentCommonControlData((FRCCommonControlData*) data, wait_ms);
return FRC_NetworkCommunication_getJoystickButtons(joystickNum, buttons, count);
}
void HALSetNewDataSem(pthread_mutex_t * param)
@@ -166,14 +140,6 @@ void HALSetNewDataSem(pthread_mutex_t * param)
setNewDataSem(param);
}
int HALSetStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
const char *userDataHigh, int userDataHighLength,
const char *userDataLow, int userDataLowLength, int wait_ms)
{
return setStatusData(battery, dsDigitalOut, updateNumber, userDataHigh,
userDataHighLength, userDataLow, userDataLowLength, wait_ms);
}
/**
* Call this to start up HAL. This is required for robot programs.
*/
@@ -183,9 +149,13 @@ int HALInitialize(int mode)
nFPGA::nRoboRIO_FPGANamespace::g_currentTargetClass =
nLoadOut::kTargetClass_RoboRIO;
int32_t status;
global = tGlobal::create(&status);
// Kill any previous robot programs
std::fstream fs;
fs.open("/var/lock/frc.pid", std::fstream::in | std::fstream::out); // By making this both in/out, it won't give us an error if it doesnt exist
// By making this both in/out, it won't give us an error if it doesnt exist
fs.open("/var/lock/frc.pid", std::fstream::in | std::fstream::out);
if (fs.bad())
return 0;
@@ -259,8 +229,12 @@ void HALNetworkCommunicationObserveUserProgramTest(void)
uint32_t HALReport(uint8_t resource, uint8_t instanceNumber, uint8_t context,
const char *feature)
{
//return FRC_NetworkCommunication_nUsageReporting_report( resource, instanceNumber, context, feature);
return 0;
if(feature == NULL)
{
feature = "";
}
return FRC_NetworkCommunication_nUsageReporting_report(resource, instanceNumber, context, feature);
}
// TODO: HACKS
@@ -286,12 +260,3 @@ void imaqGetLastError()
void niTimestamp64()
{
}
#include "NetworkCommunication/LoadOut.h"
namespace nLoadOut
{
bool getModulePresence(tModuleType moduleType, uint8_t moduleNumber)
{
return true;
}
}

View File

@@ -50,6 +50,23 @@ public:
* @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;
/**
* 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;}
};
/**

View File

@@ -41,6 +41,7 @@ namespace nCANSessionMux
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
@@ -53,6 +54,7 @@ extern "C"
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
}

View File

@@ -32,133 +32,52 @@
#endif
#endif
// Commandeer some bytes at the end for advanced I/O feedback.
#define IO_CONFIG_DATA_SIZE 32
#define SYS_STATUS_DATA_SIZE 44
#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE)
#define USER_DS_LCD_DATA_SIZE 128
struct FRCCommonControlData{
uint16_t packetIndex;
union {
uint8_t control;
#ifndef __vxworks
struct {
uint8_t checkVersions :1;
uint8_t test :1;
uint8_t resync : 1;
uint8_t fmsAttached:1;
uint8_t autonomous : 1;
uint8_t enabled : 1;
uint8_t notEStop : 1;
uint8_t reset : 1;
};
#else
struct {
uint8_t reset : 1;
uint8_t notEStop : 1;
uint8_t enabled : 1;
uint8_t autonomous : 1;
uint8_t fmsAttached:1;
uint8_t resync : 1;
uint8_t test :1;
uint8_t checkVersions :1;
};
#endif
};
uint8_t dsDigitalIn;
uint16_t teamID;
char dsID_Alliance;
char dsID_Position;
union {
int8_t stick0Axes[6];
struct {
int8_t stick0Axis1;
int8_t stick0Axis2;
int8_t stick0Axis3;
int8_t stick0Axis4;
int8_t stick0Axis5;
int8_t stick0Axis6;
};
};
uint16_t stick0Buttons; // Left-most 4 bits are unused
union {
int8_t stick1Axes[6];
struct {
int8_t stick1Axis1;
int8_t stick1Axis2;
int8_t stick1Axis3;
int8_t stick1Axis4;
int8_t stick1Axis5;
int8_t stick1Axis6;
};
};
uint16_t stick1Buttons; // Left-most 4 bits are unused
union {
int8_t stick2Axes[6];
struct {
int8_t stick2Axis1;
int8_t stick2Axis2;
int8_t stick2Axis3;
int8_t stick2Axis4;
int8_t stick2Axis5;
int8_t stick2Axis6;
};
};
uint16_t stick2Buttons; // Left-most 4 bits are unused
union {
int8_t stick3Axes[6];
struct {
int8_t stick3Axis1;
int8_t stick3Axis2;
int8_t stick3Axis3;
int8_t stick3Axis4;
int8_t stick3Axis5;
int8_t stick3Axis6;
};
};
uint16_t stick3Buttons; // Left-most 4 bits are unused
//Analog inputs are 10 bit right-justified
uint16_t analog1;
uint16_t analog2;
uint16_t analog3;
uint16_t analog4;
uint64_t cRIOChecksum;
uint32_t FPGAChecksum0;
uint32_t FPGAChecksum1;
uint32_t FPGAChecksum2;
uint32_t FPGAChecksum3;
char versionData[8];
enum AllianceStationID_t {
kAllianceStationID_red1,
kAllianceStationID_red2,
kAllianceStationID_red3,
kAllianceStationID_blue1,
kAllianceStationID_blue2,
kAllianceStationID_blue3,
};
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
struct ControlWord_t {
#ifndef __vxworks
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;
#else
uint32_t control_reserved : 26;
uint32_t dsAttached:1;
uint32_t fmsAttached:1;
uint32_t eStop : 1;
uint32_t test :1;
uint32_t autonomous : 1;
uint32_t enabled : 1;
#endif
};
struct JoystickAxes_t {
uint16_t count;
int16_t axes[1];
};
struct JoystickPOV_t {
uint16_t count;
uint16_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 getCommonControlData(struct FRCCommonControlData *data, int wait_ms);
int EXPORT_FUNC getRecentCommonControlData(struct FRCCommonControlData *commonData, int wait_ms);
int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms);
int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
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);
@@ -166,30 +85,28 @@ extern "C" {
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);
int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms);
#ifdef SIMULATION
void EXPORT_FUNC setNewDataSem(HANDLE);
#else
# if defined (__vxworks)
void EXPORT_FUNC setNewDataSem(SEM_ID);
void EXPORT_FUNC setResyncSem(SEM_ID);
# else
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
void EXPORT_FUNC setResyncSem(pthread_mutex_t *);
# endif
void EXPORT_FUNC signalResyncActionDone(void);
#endif
// this uint32_t is really a LVRefNum
void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
#ifndef SIMULATION
void EXPORT_FUNC setResyncOccurRef(uint32_t refnum);
#endif
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_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);
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
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);

View File

@@ -16,6 +16,7 @@
#define kMaxModuleNumber 2
namespace nLoadOut
{
#if defined(__vxworks) || defined(SIMULATION)
typedef enum {
kModuleType_Unknown = 0x00,
kModuleType_Analog = 0x01,
@@ -23,15 +24,18 @@ namespace nLoadOut
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;
@@ -42,7 +46,9 @@ namespace nLoadOut
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

74
hal/lib/Athena/Power.cpp Normal file
View File

@@ -0,0 +1,74 @@
#include "HAL/Power.hpp"
#include "ChipObject.h"
static tPower *power = NULL;
static void initializePower(int32_t *status) {
if(power == NULL) {
power = tPower::create(status);
}
}
/**
* Get the roboRIO input voltage
*/
float getVinVoltage(int32_t *status) {
initializePower(status);
return power->readVinVoltage(status) / 4.096f * 0.025733f - 0.029f;
}
/**
* Get the roboRIO input current
*/
float getVinCurrent(int32_t *status) {
initializePower(status);
return power->readVinCurrent(status) / 4.096f * 0.017042 - 0.071f;
}
/**
* Get the 6V rail voltage
*/
float getUserVoltage6V(int32_t *status) {
initializePower(status);
return power->readUserVoltage6V(status) / 4.096f * 0.007019f - 0.014f;
}
/**
* Get the 6V rail current
*/
float getUserCurrent6V(int32_t *status) {
initializePower(status);
return power->readUserCurrent6V(status) / 4.096f * 0.005566f - 0.009f;
}
/**
* Get the 5V rail voltage
*/
float getUserVoltage5V(int32_t *status) {
initializePower(status);
return power->readUserVoltage5V(status) / 4.096f * 0.004962f - 0.013f;
}
/**
* Get the 5V rail current
*/
float getUserCurrent5V(int32_t *status) {
initializePower(status);
return power->readUserCurrent5V(status) / 4.096f * 0.001996f - 0.002f;
}
/**
* Get the 3.3V rail voltage
*/
float getUserVoltage3V3(int32_t *status) {
initializePower(status);
return power->readUserVoltage3V3(status) / 4.096f * 0.004902f - 0.01f;
}
/**
* Get the 3.3V rail current
*/
float getUserCurrent3V3(int32_t *status) {
initializePower(status);
return power->readUserCurrent3V3(status) / 4.096f * 0.002486f - 0.003f;
}

View File

@@ -8,39 +8,34 @@
#include "NetworkCommunication/LoadOut.h"
#include "ctre/PCM.h"
bool pcmModulesInitialized = false;
static const int NUM_MODULE_NUMBERS = 63;
static const int NUM_PCMS = 2;
PCM *modules[NUM_PCMS];
PCM *modules[NUM_MODULE_NUMBERS] = { NULL };
struct solenoid_port_t {
PCM *module;
uint32_t pin;
};
void initializePCM() {
if(!pcmModulesInitialized) {
modules[0] = new PCM(50);
modules[1] = new PCM(51);
pcmModulesInitialized = true;
void initializePCM(int module) {
if(!modules[module]) {
modules[module] = new PCM(module);
}
}
void* initializeSolenoidPort(void *port_pointer, int32_t *status) {
initializePCM();
Port* port = (Port*) port_pointer;
initializePCM(port->module);
solenoid_port_t *solenoid_port = new solenoid_port_t;
solenoid_port->module = modules[port->module - 1];
solenoid_port->module = modules[port->module];
solenoid_port->pin = port->pin;
return solenoid_port;
}
bool checkSolenoidModule(uint8_t module) {
return module > 0 and module <= NUM_PCMS;
return module < NUM_MODULE_NUMBERS;
}
bool getSolenoid(void* solenoid_port_pointer, int32_t *status) {

View File

@@ -1,13 +0,0 @@
#include "HAL/cpp/StackTrace.hpp"
#include <stdio.h>
void printCurrentStackTrace() {
// TODO: Implement
}
bool getErrnoToName(int32_t errNo, char* name) {
return false; // TODO: Implement
}

View File

@@ -0,0 +1,98 @@
#include "CtreCanNode.h"
#include "NetworkCommunication/CANSessionMux.h"
#include <string.h> // memset
#include <unistd.h> // usleep
static const UINT32 kFullMessageIDMask = 0x1fffffff;
CtreCanNode::CtreCanNode(UINT8 deviceNumber)
{
_deviceNumber = deviceNumber;
}
CtreCanNode::~CtreCanNode()
{
}
void CtreCanNode::RegisterRx(uint32_t arbId)
{
/* no need to do anything, we just use new API to poll last received message */
}
void CtreCanNode::RegisterTx(uint32_t arbId, uint32_t periodMs)
{
int32_t status = 0;
txJob_t job;
job.arbId = arbId;
job.periodMs = periodMs;
_txJobs[arbId] = job;
FRC_NetworkCommunication_CANSessionMux_sendMessage( job.arbId,
job.toSend,
8,
job.periodMs,
&status);
}
timespec diff(const timespec & start, const timespec & end)
{
timespec temp;
if ((end.tv_nsec-start.tv_nsec)<0) {
temp.tv_sec = end.tv_sec-start.tv_sec-1;
temp.tv_nsec = 1000000000+end.tv_nsec-start.tv_nsec;
} else {
temp.tv_sec = end.tv_sec-start.tv_sec;
temp.tv_nsec = end.tv_nsec-start.tv_nsec;
}
return temp;
}
CTR_Code CtreCanNode::GetRx(uint32_t arbId,uint8_t * dataBytes, uint32_t timeoutMs)
{
CTR_Code retval = CTR_OKAY;
int32_t status = 0;
uint8_t len = 0;
uint32_t timeStamp;
/* cap timeout at 999ms */
if(timeoutMs > 999)
timeoutMs = 999;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(&arbId,kFullMessageIDMask,dataBytes,&len,&timeStamp,&status);
if(status == 0){
/* fresh update */
rxEvent_t & r = _rxRxEvents[arbId]; /* lookup entry or make a default new one with all zeroes */
clock_gettime(2,&r.time); /* fill in time */
memcpy(r.bytes, dataBytes, 8); /* fill in databytes */
}else{
/* did not get the message */
rxRxEvents_t::iterator i = _rxRxEvents.find(arbId);
if(i == _rxRxEvents.end()){
/* we've never gotten this mesage */
retval = CTR_RxTimeout;
/* fill caller's buffer with zeros */
memset(dataBytes,0,8);
}else{
/* we've gotten this message before but not recently */
memcpy(dataBytes,i->second.bytes,8);
/* get the time now */
struct timespec temp;
clock_gettime(2,&temp); /* get now */
/* how long has it been? */
temp = diff(i->second.time,temp); /* temp = now - last */
if(temp.tv_sec > 0){
retval = CTR_RxTimeout;
}else if(temp.tv_nsec > ((int32_t)timeoutMs*1000*1000)){
retval = CTR_RxTimeout;
}else {
/* our last update was recent enough */
}
}
}
return retval;
}
void CtreCanNode::FlushTx(uint32_t arbId)
{
int32_t status = 0;
txJobs_t::iterator iter = _txJobs.find(arbId);
if(iter != _txJobs.end())
FRC_NetworkCommunication_CANSessionMux_sendMessage( iter->second.arbId,
iter->second.toSend,
8,
iter->second.periodMs,
&status);
}

View File

@@ -0,0 +1,116 @@
#ifndef CtreCanNode_H_
#define CtreCanNode_H_
#include "ctre.h" //BIT Defines + Typedefs
#include "NetworkCommunication/CANSessionMux.h" //CAN Comm
#include <pthread.h>
#include <map>
#include <string.h> // memcpy
#include <sys/time.h>
class CtreCanNode
{
public:
CtreCanNode(UINT8 deviceNumber);
~CtreCanNode();
UINT8 GetDeviceNumber()
{
return _deviceNumber;
}
protected:
template <typename T> 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 <typename T> 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);
void RegisterTx(uint32_t arbId, uint32_t periodMs);
CTR_Code GetRx(uint32_t arbId,uint8_t * dataBytes,uint32_t timeoutMs);
void FlushTx(uint32_t arbId);
template<typename T> txTask<T> GetTx(uint32_t arbId)
{
txTask<T> retval = {0};
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<class T> void FlushTx(T & par)
{
FlushTx(par.arbId);
}
template<class T> recMsg<T> GetRx(uint32_t arbId, uint32_t timeoutMs)
{
recMsg<T> 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;
};
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<uint32_t,txJob_t> txJobs_t;
txJobs_t _txJobs;
typedef std::map<uint32_t,rxEvent_t> rxRxEvents_t;
rxRxEvents_t _rxRxEvents;
};
#endif

View File

@@ -4,13 +4,89 @@
#include "NetworkCommunication/CANSessionMux.h"
#include <string.h> // memset
#include <unistd.h> // usleep
static const UINT32 kFullMessageIDMask = 0x1fffffff;
/* This can be a constant, as long as nobody needs to updatie solenoids within
1/50 of a second. */
static const INT32 kCANPeriod = 20;
#define STATUS_1 0x9041400
#define STATUS_SOL_FAULTS 0x9041440
#define STATUS_DEBUG 0x9041480
#define EXPECTED_RESPONSE_TIMEOUT_MS (50)
#define GET_PCM_STATUS() CtreCanNode::recMsg<PcmStatus_t> rx = GetRx<PcmStatus_t> (STATUS_1,EXPECTED_RESPONSE_TIMEOUT_MS)
#define GET_PCM_SOL_FAULTS() CtreCanNode::recMsg<PcmStatusFault_t> rx = GetRx<PcmStatusFault_t> (STATUS_SOL_FAULTS,EXPECTED_RESPONSE_TIMEOUT_MS)
#define GET_PCM_DEBUG() CtreCanNode::recMsg<PcmDebug_t> rx = GetRx<PcmDebug_t> (STATUS_DEBUG,EXPECTED_RESPONSE_TIMEOUT_MS)
#define CONTROL_1 0x09041C00
/* encoder/decoders */
typedef struct _PcmStatus_t{
/* Byte 0 */
unsigned SolenoidBits:8;
/* Byte 1 */
unsigned compressorOn:1;
unsigned stickyFaultFuseTripped:1;
unsigned stickyFaultCompCurrentTooHigh:1;
unsigned faultCompCurrentTooHigh:1;
unsigned faultFuseTripped:1;
unsigned faultHardwareFailure:1;
unsigned isCloseloopEnabled:1;
unsigned pressureSwitchEn:1;
/* Byte 2*/
unsigned battVoltage:8;
/* Byte 3 */
unsigned solenoidVoltageTop8:8;
/* Byte 4 */
unsigned compressorCurrentTop6:6;
unsigned solenoidVoltageBtm2:2;
/* Byte 5 */
unsigned reserved:2;
unsigned moduleEnabled:1;
unsigned closedLoopOutput:1;
unsigned compressorCurrentBtm4:4;
/* Byte 6 */
unsigned tokenSeedTop8:8;
/* Byte 7 */
unsigned tokenSeedBtm8:8;
}PcmStatus_t;
typedef struct _PcmControl_t{
/* Byte 0 */
unsigned tokenTop8:8;
/* Byte 1 */
unsigned tokenBtm8:8;
/* Byte 2 */
unsigned solenoidBits:8;
/* Byte 3*/
unsigned reserved:4;
unsigned closeLoopOutput:1;
unsigned compressorOn:1;
unsigned closedLoopEnable:1;
unsigned clearStickyFaults:1;
}PcmControl_t;
typedef struct _PcmStatusFault_t{
/* Byte 0 */
unsigned SolenoidBlacklist:8;
/* Byte 1 */
unsigned reserved1:8;
unsigned reserved2:8;
unsigned reserved3:8;
unsigned reserved4:8;
unsigned reserved5:8;
unsigned reserved6:8;
unsigned reserved7:8;
}PcmStatusFault_t;
typedef struct _PcmDebug_t{
unsigned tokFailsTop8:8;
unsigned tokFailsBtm8:8;
unsigned lastFailedTokTop8:8;
unsigned lastFailedTokBtm8:8;
unsigned tokSuccessTop8:8;
unsigned tokSuccessBtm8:8;
}PcmDebug_t;
/* PCM Constructor - Clears all vars, establishes default settings, starts PCM background process
*
@@ -18,60 +94,39 @@ static const INT32 kCANPeriod = 20;
*
* @Param - deviceNumber - Device ID of PCM to be controlled
*/
PCM::PCM(UINT8 deviceNumber)
PCM::PCM(UINT8 deviceNumber): CtreCanNode(deviceNumber)
{
memset(&_PcmDebug, 0, sizeof(_PcmDebug));
memset(&_PcmControl, 0, sizeof(_PcmControl));
memset(&_PcmStatus, 0, sizeof(_PcmStatus));
memset(&_PcmStatusFault,0, sizeof(_PcmStatusFault));
/* setup arbids */
SetDeviceNumber(deviceNumber);
/* clear error info */
_timeSinceLastRx = 0;
_timeSinceLastTx = 0;
_numFailedRxs = 0;
_numFailedTxs = 0;
/* start thread */
_threadIsRunning = 1;
_threadErr = pthread_create( &_thread, NULL, ThreadFunc, (void*) this);
RegisterRx(STATUS_1 | deviceNumber );
RegisterRx(STATUS_SOL_FAULTS | deviceNumber );
RegisterRx(STATUS_DEBUG | deviceNumber );
RegisterTx(CONTROL_1 | deviceNumber, kCANPeriod);
/* enable close loop */
CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
toFill->closedLoopEnable = 1;
}
/* PCM D'tor
*/
PCM::~PCM() {
/* wait for thread to finish */
_threadIsRunning = 0;
pthread_join( _thread, NULL);
_thread = 0;
}
/* Set PCM Device Number and according CAN frame IDs
*
* @Return - void
*
* @Param - deviceNumber - Device number of PCM to control
*/
void PCM::SetDeviceNumber(UINT8 deviceNumber) {
PCM_settings.deviceNumber = deviceNumber;
PCM_settings.controlFrameID = 0x9041C00 + (deviceNumber) + (UINT32) (0 * BIT6);
PCM_settings.statusFrameID = 0x9041400 + (deviceNumber) + (UINT32) (0 * BIT6);
PCM_settings.statusFaultFrameID = 0x9041400 + (deviceNumber) + (UINT32) (1 * BIT6);
PCM_settings.debugFrameID = 0x9041400 + (deviceNumber) + (UINT32) (2 * BIT6);
PCM::~PCM()
{
}
/* Set PCM solenoid state
*
* @Return - CTR_Code - Error code (if any) for setting solenoid
*
* @Param - idx - ID of solenoid (1-8)
* @Param - idx - ID of solenoid (0-7)
* @Param - en - Enable / Disable identified solenoid
*/
CTR_Code PCM::SetSolenoid(unsigned char idx, bool en) {
idx--; /* make it zero based */
CTR_Code PCM::SetSolenoid(unsigned char idx, bool en)
{
CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
if(toFill.IsEmpty())return CTR_UnexpectedArbId;
if (en)
_PcmControl.solenoidBits |= (1ul << (7-idx));
toFill->solenoidBits |= (1ul << (idx));
else
_PcmControl.solenoidBits &= ~(1ul << (7-idx));
if (GetTimeSinceLastTx() >= 50)
return CTR_TxTimeout;
toFill->solenoidBits &= ~(1ul << (idx));
FlushTx(toFill);
return CTR_OKAY;
}
@@ -81,10 +136,12 @@ CTR_Code PCM::SetSolenoid(unsigned char idx, bool en) {
*
* @Param - clr - Clear / do not clear faults
*/
CTR_Code PCM::ClearStickyFaults(bool clr) {
_PcmControl.clearStickyFaults = clr;
if (GetTimeSinceLastTx() >= 50)
return CTR_TxTimeout;
CTR_Code PCM::ClearStickyFaults(bool clr)
{
CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
if(toFill.IsEmpty())return CTR_UnexpectedArbId;
toFill->clearStickyFaults = clr;
FlushTx(toFill);
return CTR_OKAY;
}
@@ -94,10 +151,12 @@ CTR_Code PCM::ClearStickyFaults(bool clr) {
*
* @Param - en - Enable / Disable Closed Loop Control
*/
CTR_Code PCM::SetClosedLoopControl(bool en) {
_PcmControl.closedLoopEnable = en;
if (GetTimeSinceLastTx() >= 50)
return CTR_TxTimeout;
CTR_Code PCM::SetClosedLoopControl(bool en)
{
CtreCanNode::txTask<PcmControl_t> toFill = GetTx<PcmControl_t>(CONTROL_1 | GetDeviceNumber());
if(toFill.IsEmpty())return CTR_UnexpectedArbId;
toFill->closedLoopEnable = en;
FlushTx(toFill);
return CTR_OKAY;
}
@@ -105,121 +164,119 @@ CTR_Code PCM::SetClosedLoopControl(bool en) {
*
* @Return - True/False - True if solenoid enabled, false otherwise
*
* @Param - idx - ID of solenoid (1-8) to return status of
* @Param - idx - ID of solenoid (0-7) to return status of
*/
CTR_Code PCM::GetSolenoid(UINT8 idx, bool &status) {
idx--;
status = (_PcmStatus.SolenoidBits & (1ul<<(7-idx))) ? 1 : 0;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetSolenoid(UINT8 idx, bool &status)
{
GET_PCM_STATUS();
status = (rx->SolenoidBits & (1ul<<(idx)) ) ? 1 : 0;
return rx.err;
}
/* Get pressure switch state
*
* @Return - True/False - True if pressure adequate, false if low
*/
CTR_Code PCM::GetPressure(bool &status) {
status = _PcmStatus.pressureSwitchEn;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetPressure(bool &status)
{
GET_PCM_STATUS();
status = (rx->pressureSwitchEn ) ? 1 : 0;
return rx.err;
}
/* Get compressor state
*
* @Return - True/False - True if enabled, false if otherwise
*/
CTR_Code PCM::GetCompressor(bool &status) {
status = _PcmStatus.compressorOn;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetCompressor(bool &status)
{
GET_PCM_STATUS();
status = (rx->compressorOn);
return rx.err;
}
/* Get closed loop control state
*
* @Return - True/False - True if closed loop enabled, false if otherwise
*/
CTR_Code PCM::GetClosedLoopControl(bool &status) {
status = _PcmStatus.isCloseloopEnabled;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetClosedLoopControl(bool &status)
{
GET_PCM_STATUS();
status = (rx->isCloseloopEnabled);
return rx.err;
}
/* Get compressor current draw
*
* @Return - Amperes - Compressor current
*/
CTR_Code PCM::GetCompressorCurrent(float &status) {
uint16_t bt = _PcmStatus.compressorCurrentTop6;
bt <<= 4;
bt |= _PcmStatus.compressorCurrentBtm4;
status = 0.0201612903225806 * bt;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetCompressorCurrent(float &status)
{
GET_PCM_STATUS();
uint32_t temp =(rx->compressorCurrentTop6);
temp <<= 4;
temp |= rx->compressorCurrentBtm4;
status = 20.1612903225806 * temp;
return rx.err;
}
/* Get voltage across solenoid rail
*
* @Return - Volts - Voltage across solenoid rail
*/
CTR_Code PCM::GetSolenoidVoltage(float &status) {
uint32_t raw = _PcmStatus.solenoidVoltageTop8;
CTR_Code PCM::GetSolenoidVoltage(float &status)
{
GET_PCM_STATUS();
uint32_t raw =(rx->solenoidVoltageTop8);
raw <<= 2;
raw |= _PcmStatus.solenoidVoltageBtm2;
raw |= rx->solenoidVoltageBtm2;
status = (double) raw * 24.7800586510264 / 1000;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
return rx.err;
}
/* Get hardware fault value
*
* @Return - True/False - True if hardware failure detected, false if otherwise
*/
CTR_Code PCM::GetHardwareFault(bool &status) {
status = _PcmStatus.faultHardwareFailure;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetHardwareFault(bool &status)
{
GET_PCM_STATUS();
status = rx->faultHardwareFailure;
return rx.err;
}
/* Get compressor fault value
*
* @Return - True/False - True if shorted compressor detected, false if otherwise
*/
CTR_Code PCM::GetCompressorFault(bool &status) {
status = _PcmStatus.faultCompCurrentTooHigh;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetCompressorFault(bool &status)
{
GET_PCM_STATUS();
status = rx->faultCompCurrentTooHigh;
return rx.err;
}
/* Get solenoid fault value
*
* @Return - True/False - True if shorted solenoid detected, false if otherwise
*/
CTR_Code PCM::GetSolenoidFault(bool &status) {
status = _PcmStatus.faultFuseTripped;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetSolenoidFault(bool &status)
{
GET_PCM_STATUS();
status = rx->faultFuseTripped;
return rx.err;
}
// Past Faults
/* Get compressor sticky fault value
*
* @Return - True/False - True if solenoid had previously been shorted
* (and sticky fault was not cleared), false if otherwise
*/
CTR_Code PCM::GetCompressorStickyFault(bool &status) {
status = _PcmStatus.stickyFaultCompCurrentTooHigh;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetCompressorStickyFault(bool &status)
{
GET_PCM_STATUS();
status = rx->stickyFaultCompCurrentTooHigh;
return rx.err;
}
/* Get solenoid sticky fault value
@@ -227,21 +284,31 @@ CTR_Code PCM::GetCompressorStickyFault(bool &status) {
* @Return - True/False - True if compressor had previously been shorted
* (and sticky fault was not cleared), false if otherwise
*/
CTR_Code PCM::GetSolenoidStickyFault(bool &status) { /* fix this */
status = _PcmStatus.stickyFaultFuseTripped;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetSolenoidStickyFault(bool &status)
{
GET_PCM_STATUS();
status = rx->stickyFaultFuseTripped;
return rx.err;
}
/* Get battery voltage
*
* @Return - Volts - Voltage across PCM power ports
*/
CTR_Code PCM::GetBatteryVoltage(float &status) {
status = (float)_PcmStatus.battVoltage * ((59.0420332355816) / 1000.0);;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetBatteryVoltage(float &status)
{
GET_PCM_STATUS();
status = (float)rx->battVoltage * ((59.0420332355816) / 1000.0);;
return rx.err;
}
/* Return status of module enable/disable
*
* @Return - bool - Returns TRUE if PCM is enabled, FALSE if disabled
*/
CTR_Code PCM::isModuleEnabled(bool &status)
{
GET_PCM_STATUS();
status = rx->moduleEnabled;
return rx.err;
}
/* Get number of total failed PCM Control Frame
*
@@ -251,13 +318,13 @@ CTR_Code PCM::GetBatteryVoltage(float &status) {
* See function SeekDebugFrames
* See function EnableSeekDebugFrames
*/
CTR_Code PCM::GetNumberOfFailedControlFrames(UINT16 &status) {
status = _PcmDebug.tokFailsTop8;
CTR_Code PCM::GetNumberOfFailedControlFrames(UINT16 &status)
{
GET_PCM_DEBUG();
status = rx->tokFailsTop8;
status <<= 8;
status |= _PcmDebug.tokFailsBtm8;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
status |= rx->tokFailsBtm8;
return rx.err;
}
/* Get raw Solenoid Blacklist
*
@@ -268,125 +335,28 @@ CTR_Code PCM::GetNumberOfFailedControlFrames(UINT16 &status) {
* See function SeekStatusFaultFrames
* See function EnableSeekStatusFaultFrames
*/
CTR_Code PCM::GetSolenoidBlackList(UINT8 &status) {
status = _PcmStatusFault.SolenoidBlacklist;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
CTR_Code PCM::GetSolenoidBlackList(UINT8 &status)
{
GET_PCM_SOL_FAULTS();
status = rx->SolenoidBlacklist;
return rx.err;
}
/* Get solenoid Blacklist status
* - Blacklisted solenoids cannot be enabled until PCM is power cycled
*
* @Return - True/False - True if Solenoid is blacklisted, false if otherwise
*
* @Param - idx - ID of solenoid
* @Param - idx - ID of solenoid [0,7]
*
* @WARNING - Return only valid if [SeekStatusFaultFrames] is enabled
* See function SeekStatusFaultFrames
* See function EnableSeekStatusFaultFrames
*/
CTR_Code PCM::IsSolenoidBlacklisted(UINT8 idx, bool &status) {
idx--;
if(_PcmStatusFault.SolenoidBlacklist & (1ul<<(7-idx)))
status = 1;
else
status = 0;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
}
/* Return status of module enable/disable
*
* @Return - bool - Returns TRUE if PCM is enabled, FALSE if disabled
*/
CTR_Code PCM::isModuleEnabled(bool &status) {
status = _PcmStatus.moduleEnabled;
if (GetTimeSinceLastRx() >= 50)
return CTR_RxTimeout;
return CTR_OKAY;
}
void PCM::GetErrorInfo( uint32_t * timeSinceLastRx,
uint32_t * timeSinceLastTx,
uint32_t * numFailedRxs,
uint32_t * numFailedTxs)
CTR_Code PCM::IsSolenoidBlacklisted(UINT8 idx, bool &status)
{
if(timeSinceLastRx) *timeSinceLastRx = _timeSinceLastRx;
if(timeSinceLastTx) *timeSinceLastTx = _timeSinceLastTx;
if(numFailedRxs) *numFailedRxs = _numFailedRxs;
if(numFailedTxs) *numFailedTxs = _numFailedTxs;
}
//------------------ CAN interface and thread --------------------------------------------//
/* Search for PCM Status Frame on CAN bus */
void PCM::ReadStatusFrame(void) {
PcmStatus_t frame = {0};
UINT8 size = 0;
INT32 status = 0;
UINT32 timeStamp = 0;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(&PCM_settings.statusFrameID, kFullMessageIDMask, (uint8_t *)&frame, &size, &timeStamp, &status);
if (status == 0) {
_timeSinceLastRx = 0;
_PcmStatus = frame;
} else {
++_numFailedRxs;
}
}
/* Search for PCM Status Fault Frame on CAN bus */
void PCM::ReadStatusFaultFrame(void) {
PcmStatusFault_t frame= {0};
UINT8 size = 0;
INT32 status = 0;
UINT32 timeStamp = 0;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(&PCM_settings.statusFaultFrameID, kFullMessageIDMask, (uint8_t *)&frame, &size, &timeStamp, &status);
if (status == 0) {
_timeSinceLastRx = 0;
_PcmStatusFault = frame;
} else {
++_numFailedRxs;
}
}
/* Search for PCM Debug Frame on CAN bus */
void PCM::ReadDebugFrame(void) {
PcmDebug_t frame= {0};
UINT8 size = 0;
INT32 status = 0;
UINT32 timeStamp = 0;
FRC_NetworkCommunication_CANSessionMux_receiveMessage(&PCM_settings.debugFrameID, kFullMessageIDMask, (uint8_t *)&frame, &size, &timeStamp, &status);
if (status == 0) {
_timeSinceLastRx = 0;
_PcmDebug = frame;
} else {
++_numFailedRxs;
}
}
void * PCM::ThreadFunc()
{
while(_threadIsRunning){
int32_t status = 0;
FRC_NetworkCommunication_CANSessionMux_sendMessage(PCM_settings.controlFrameID, (const uint8_t *)&_PcmControl, sizeof(_PcmControl), kCANPeriod, &status);
if(status == 0){
/* success */
_timeSinceLastTx = 0;
}else {
/* something is wrong */
++_numFailedTxs;
}
/* reads */
ReadStatusFrame();
ReadStatusFaultFrame();
ReadDebugFrame();
/* yield for 25ms */
usleep(25e3);
/* incrememnt times since comm without overflow */
if(_timeSinceLastTx < 60000)
_timeSinceLastTx += 25;
if(_timeSinceLastRx < 60000)
_timeSinceLastRx += 25;
}
return 0;
}
void * PCM::ThreadFunc( void *ptr )
{
return ((PCM*)ptr)->ThreadFunc();
GET_PCM_SOL_FAULTS();
status = (rx->SolenoidBlacklist & (1ul<<(idx)) )? 1 : 0;
return rx.err;
}
//------------------ C interface --------------------------------------------//
extern "C" {
@@ -430,7 +400,6 @@ extern "C" {
CTR_Code retval = ((PCM*) handle)->GetCompressorCurrent(*status);
return retval;
}
CTR_Code c_GetSolenoidVoltage(void * handle, float*status) {
return ((PCM*) handle)->GetSolenoidVoltage(*status);
}
@@ -469,7 +438,6 @@ extern "C" {
return retval;
}
void c_SetDeviceNumber_PCM(void * handle, UINT8 deviceNumber) {
return ((PCM*) handle)->SetDeviceNumber(deviceNumber);
}
CTR_Code c_GetNumberOfFailedControlFrames(void * handle, UINT16*status) {
return ((PCM*) handle)->GetNumberOfFailedControlFrames(*status);

View File

@@ -1,84 +1,19 @@
#ifndef PCM_H_
#define PCM_H_
#include "ctre.h" //BIT Defines + Typedefs
#include "ctre.h" //BIT Defines + Typedefs
#include <NetworkCommunication/CANSessionMux.h> //CAN Comm
#include "CtreCanNode.h"
#include <pthread.h>
/* encoder/decoders */
typedef struct _PcmStatus_t{
/* Byte 0 */
unsigned SolenoidBits:8;
/* Byte 1 */
unsigned compressorOn:1;
unsigned stickyFaultFuseTripped:1;
unsigned stickyFaultCompCurrentTooHigh:1;
unsigned faultCompCurrentTooHigh:1;
unsigned faultFuseTripped:1;
unsigned faultHardwareFailure:1;
unsigned isCloseloopEnabled:1;
unsigned pressureSwitchEn:1;
/* Byte 2*/
unsigned battVoltage:8;
/* Byte 3 */
unsigned solenoidVoltageTop8:8;
/* Byte 4 */
unsigned compressorCurrentTop6:6;
unsigned solenoidVoltageBtm2:2;
/* Byte 5 */
unsigned reserved:2;
unsigned moduleEnabled:1;
unsigned closedLoopOutput:1;
unsigned compressorCurrentBtm4:4;
/* Byte 6 */
unsigned tokenSeedTop8:8;
/* Byte 7 */
unsigned tokenSeedBtm8:8;
}PcmStatus_t;
typedef struct _PcmControl_t{
/* Byte 0 */
unsigned tokenTop8:8;
/* Byte 1 */
unsigned tokenBtm8:8;
/* Byte 2 */
unsigned solenoidBits:8;
/* Byte 3*/
unsigned reserved:5;
unsigned CompressorOn_deprecated:1; //!< This is ignored by PCM firm now.
unsigned closedLoopEnable:1;
unsigned clearStickyFaults:1;
}PcmControl_t;
typedef struct _PcmStatusFault_t{
/* Byte 0 */
unsigned SolenoidBlacklist:8;
/* Byte 1 */
unsigned reserved1:8;
unsigned reserved2:8;
unsigned reserved3:8;
unsigned reserved4:8;
unsigned reserved5:8;
unsigned reserved6:8;
unsigned reserved7:8;
}PcmStatusFault_t;
typedef struct _PcmDebug_t{
unsigned tokFailsTop8:8;
unsigned tokFailsBtm8:8;
unsigned lastFailedTokTop8:8;
unsigned lastFailedTokBtm8:8;
unsigned tokSuccessTop8:8;
unsigned tokSuccessBtm8:8;
}PcmDebug_t;
class PCM
class PCM : public CtreCanNode
{
public:
PCM(UINT8 deviceNumber=50);
PCM(UINT8 deviceNumber=0);
~PCM();
/* Set PCM solenoid state
*
* @Return - CTR_Code - Error code (if any) for setting solenoid
* @Param - idx - ID of solenoid (1-8)
* @Param - idx - ID of solenoid (0-7)
* @Param - en - Enable / Disable identified solenoid
*/
CTR_Code SetSolenoid(unsigned char idx, bool en);
@@ -94,14 +29,12 @@ public:
* @Param - clr - Clear / do not clear faults
*/
CTR_Code ClearStickyFaults(bool clr);
/* Get solenoid state
*
* @Return - CTR_Code - Error code (if any)
* @Param - idx - ID of solenoid (1-8) to return status of
* @Param - status - True if solenoid output is set to be enabled, false otherwise.
* If the phsyical output led still isn't on, then check webdash for
* any faults/is PCM enabled.
* @Param - idx - ID of solenoid (0-7) to return if solenoid is on.
* @Param - status - OK if solenoid enabled, false otherwise
*/
CTR_Code GetSolenoid(UINT8 idx, bool &status);
@@ -172,7 +105,7 @@ public:
* @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
@@ -186,7 +119,7 @@ public:
* 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
@@ -200,7 +133,7 @@ public:
/* 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
* @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
@@ -213,70 +146,6 @@ public:
* @Param - status - Returns TRUE if PCM is enabled, FALSE if disabled
*/
CTR_Code isModuleEnabled(bool &status);
/* Get time since last sent frame
* @Return - int - Returns time in milliseconds (ms) since last sent PCM frame
*/
int GetTimeSinceLastTx(void) { return _timeSinceLastTx;}
/* Get time since last received frame
* @Return - int - Returns time in milliseconds (ms) since last received PCM frame
*/
int GetTimeSinceLastRx(void) { return _timeSinceLastRx;}
private:
/* Seek PCM Status Frames on CAN bus
* @Return - void
* @Param - en - Enable / Disable seeking of PCM Status Frame
* @Notes - Status Frames identify
*/
void EnableSeekStatusFrames(bool en);
/* Seek PCM Status Fault Frames on CAN bus
* @Return - void
* @Param - en - Enable / Disable seeking of PCM Status Fault Frame
* @Notes - Status Fault Frames identify Blacklisted Solenoids
*/
void EnableSeekStatusFaultFrames(bool en);
/* Seek PCM Debug Frames on CAN bus
* @Return - void
* @Param - en - Enable / Disable seeking of PCM Debug Frame
* @Notes - Debug Frames identify the number of failed tokens (for exclusive, secure control of PCM by RoboRIO)
*/
void EnableSeekDebugFrames(bool en);
/* frames to receive */
PcmDebug_t _PcmDebug;
PcmStatus_t _PcmStatus;
PcmStatusFault_t _PcmStatusFault;
/* frames to send */
PcmControl_t _PcmControl;
/* tracking health and error info */
uint32_t _timeSinceLastRx;
uint32_t _timeSinceLastTx;
uint32_t _numFailedRxs;
uint32_t _numFailedTxs;
/* threading */
pthread_t _thread;
int _threadErr;
int _threadIsRunning;
/** arbids */
struct PCM_SETTINGS{
UINT8 deviceNumber;
UINT32 controlFrameID;
UINT32 statusFrameID;
UINT32 statusFaultFrameID;
UINT32 debugFrameID;
}PCM_settings;
void ReadStatusFrame(void);
void ReadStatusFaultFrame(void);
void ReadDebugFrame(void);
void GetErrorInfo( uint32_t * timeSinceLastRx,
uint32_t * timeSinceLastTx,
uint32_t * numFailedRxs,
uint32_t * numFailedTxs);
static void * ThreadFunc(void *);
void * ThreadFunc();
};
//------------------ C interface --------------------------------------------//
extern "C" {

Some files were not shown because too many files have changed in this diff Show More