mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Compare commits
211 Commits
2014-simul
...
test-tag
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8856927fd8 | ||
|
|
66e1f2a184 | ||
|
|
1301d76d61 | ||
|
|
a72ea14f92 | ||
|
|
14b2f14669 | ||
|
|
d2cd5f3571 | ||
|
|
7ecde3a33a | ||
|
|
81143fc534 | ||
|
|
c58a86a3ab | ||
|
|
2f655bb49d | ||
|
|
657054c9e2 | ||
|
|
f4d542b212 | ||
|
|
8db11a4c6c | ||
|
|
14d784bca1 | ||
|
|
7c8124d76c | ||
|
|
b371600f0f | ||
|
|
6c3b002a87 | ||
|
|
0f93247641 | ||
|
|
54439e7198 | ||
|
|
5b8279f404 | ||
|
|
8abbcf53f4 | ||
|
|
b8eeeabbb5 | ||
|
|
9a2bd8c49b | ||
|
|
4db634b342 | ||
|
|
57e670c18d | ||
|
|
59473ab7a7 | ||
|
|
d1d4c75210 | ||
|
|
2356008d8c | ||
|
|
deb335d96d | ||
|
|
1ce03b9c46 | ||
|
|
a09f75934a | ||
|
|
aab98c0638 | ||
|
|
741e28b855 | ||
|
|
f817f6d041 | ||
|
|
7442a7ed7d | ||
|
|
765198f5f5 | ||
|
|
ed08ab2989 | ||
|
|
4b22742cdc | ||
|
|
45f93e9aba | ||
|
|
049377c9ea | ||
|
|
f4ace4a36d | ||
|
|
9ff420547a | ||
|
|
1be31431bc | ||
|
|
32cafd0efc | ||
|
|
0216d1b336 | ||
|
|
43c566bd86 | ||
|
|
b86c747226 | ||
|
|
60a3fd0698 | ||
|
|
b86c114939 | ||
|
|
14f201cd36 | ||
|
|
c49ea255b9 | ||
|
|
065e1c24eb | ||
|
|
ecdb77e4be | ||
|
|
10aad6d1c8 | ||
|
|
e73c8d06eb | ||
|
|
dc341a448e | ||
|
|
d521eb79b9 | ||
|
|
f57a2dc5a9 | ||
|
|
7006d1ebc4 | ||
|
|
c32e5707d4 | ||
|
|
c27da3587d | ||
|
|
f18cccbc30 | ||
|
|
b91b681430 | ||
|
|
b26667f866 | ||
|
|
792e3b6ccc | ||
|
|
fd4379a946 | ||
|
|
a40cdf5197 | ||
|
|
ba4e74d299 | ||
|
|
38583789be | ||
|
|
45e43b627f | ||
|
|
e837d9083a | ||
|
|
e0e2b498a5 | ||
|
|
8fe888dbc9 | ||
|
|
41bb0da4e6 | ||
|
|
97ade3606e | ||
|
|
2735406bfb | ||
|
|
ab04e19aae | ||
|
|
a58288ae6d | ||
|
|
7905259e21 | ||
|
|
f018689d0e | ||
|
|
0bb13d86ea | ||
|
|
526df3679a | ||
|
|
d8da3e5f1f | ||
|
|
c0af235050 | ||
|
|
7f6ca6824e | ||
|
|
231bb55b2a | ||
|
|
76e488061d | ||
|
|
5e8ea38465 | ||
|
|
a5b72d62a1 | ||
|
|
a5e15b16fd | ||
|
|
264c38a674 | ||
|
|
20de3abe80 | ||
|
|
3536d47835 | ||
|
|
60a294fbad | ||
|
|
dc42a1129f | ||
|
|
386dc1f16b | ||
|
|
038478e437 | ||
|
|
26e90a988b | ||
|
|
d5cd47bfa1 | ||
|
|
1e35ef7802 | ||
|
|
65607b5bc1 | ||
|
|
30c0cc0561 | ||
|
|
92bd697417 | ||
|
|
ed0df5432f | ||
|
|
6deb196e90 | ||
|
|
8b612f713b | ||
|
|
d66bafb687 | ||
|
|
78d2ccd299 | ||
|
|
06d59447be | ||
|
|
3475a4a8c6 | ||
|
|
6af242b556 | ||
|
|
c72e704396 | ||
|
|
89fe909ae6 | ||
|
|
c1d8e4ef4b | ||
|
|
338120c3a5 | ||
|
|
a7efbe0d7a | ||
|
|
4c78280308 | ||
|
|
5a3889a3aa | ||
|
|
2fd4964b62 | ||
|
|
6ae6394548 | ||
|
|
310151132d | ||
|
|
7f4e1e39ae | ||
|
|
eebdc3d20c | ||
|
|
980ea96b05 | ||
|
|
1038f98e83 | ||
|
|
326aa2e85c | ||
|
|
6071fc7fb3 | ||
|
|
f958b65ba6 | ||
|
|
f4f7588cfb | ||
|
|
80ecff6bdb | ||
|
|
e487c950e9 | ||
|
|
191e9d5d6b | ||
|
|
40fc8326aa | ||
|
|
fdbe750d3d | ||
|
|
3ec797a8cf | ||
|
|
78e6cf7208 | ||
|
|
2481e98bc8 | ||
|
|
c81d510ebe | ||
|
|
3fb4159101 | ||
|
|
2e1bd171a5 | ||
|
|
25e7a077c1 | ||
|
|
dc48dc7f7b | ||
|
|
2dd45c3ea6 | ||
|
|
461e359484 | ||
|
|
78dac49cf6 | ||
|
|
66ba9a728e | ||
|
|
c3d1e80a62 | ||
|
|
01ca19f78f | ||
|
|
202bfb2959 | ||
|
|
b0369342e9 | ||
|
|
26d101caf9 | ||
|
|
e84e0ebab8 | ||
|
|
0704a697ce | ||
|
|
13f97bb6e3 | ||
|
|
5eddb69aa0 | ||
|
|
41c2b9402c | ||
|
|
99632e003b | ||
|
|
fe12394c93 | ||
|
|
fbf196763f | ||
|
|
b5fb35c0c4 | ||
|
|
48e8b2136e | ||
|
|
e962c770bb | ||
|
|
1b7a352cbb | ||
|
|
1a77cea13a | ||
|
|
afa39deec5 | ||
|
|
f27e16735f | ||
|
|
d8a5ced015 | ||
|
|
8fe606a4b1 | ||
|
|
6053a0cc24 | ||
|
|
be106b3527 | ||
|
|
ebaf2ef058 | ||
|
|
9f1a9a07c9 | ||
|
|
ec2a455bc7 | ||
|
|
3d740a9a25 | ||
|
|
1dd1e0be1e | ||
|
|
437e3ff266 | ||
|
|
f373c8708d | ||
|
|
54a657a7d4 | ||
|
|
60d8508a65 | ||
|
|
02a28c8f04 | ||
|
|
b128828977 | ||
|
|
1a1a12316b | ||
|
|
d0fdb3e704 | ||
|
|
5d2e20eaec | ||
|
|
fc0eb4e956 | ||
|
|
968b69d37d | ||
|
|
343c7f4f3e | ||
|
|
80c5c09f77 | ||
|
|
cb9df310dc | ||
|
|
f566c087dc | ||
|
|
7ca1b498e4 | ||
|
|
8bba58b9ab | ||
|
|
8ae64a12ea | ||
|
|
3b4718fc92 | ||
|
|
5800af49bc | ||
|
|
63fc4f6cfb | ||
|
|
8b770ffb41 | ||
|
|
55fde6b616 | ||
|
|
5ddacb43c1 | ||
|
|
65c3c0ba09 | ||
|
|
fc3ed33f77 | ||
|
|
255a3a5b12 | ||
|
|
0ef5c3adfa | ||
|
|
37ebcabc4a | ||
|
|
244ee8d920 | ||
|
|
b97d2eb0c3 | ||
|
|
ae8d22b0f2 | ||
|
|
ff8016c088 | ||
|
|
f0fb3023ad | ||
|
|
1d33edffee | ||
|
|
5bd546f1fd |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -11,6 +11,7 @@ bin/
|
||||
.cproject
|
||||
.settings/
|
||||
.classpath
|
||||
**/dependency-reduced-pom.xml
|
||||
|
||||
#Java File extentions
|
||||
*.class
|
||||
|
||||
13
.hgignore
13
.hgignore
@@ -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
|
||||
*~
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 |
@@ -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=""${workspace_loc:/${ProjName}}/src""/>
|
||||
<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"/>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
ExampleSubsystem* CommandBase::examplesubsystem = NULL;
|
||||
OI* CommandBase::oi = NULL;
|
||||
|
||||
CommandBase::CommandBase(std::string name) :
|
||||
CommandBase::CommandBase(char const *name) :
|
||||
Command(name)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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);
|
||||
}};
|
||||
|
||||
@@ -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 >bamiller@wpi.edu<
|
||||
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>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
/home/admin/FRCUserProgram
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package $package;
|
||||
|
||||
import edu.wpi.first.wpilibj.command.Trigger;
|
||||
import edu.wpi.first.wpilibj.buttons.Trigger;
|
||||
|
||||
/**
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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() {
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.">
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
15
hal/include/HAL/Accelerometer.hpp
Normal file
15
hal/include/HAL/Accelerometer.hpp
Normal 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();
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
15
hal/include/HAL/Power.hpp
Normal 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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
234
hal/lib/Athena/Accelerometer.cpp
Normal file
234
hal/lib/Athena/Accelerometer.cpp
Normal 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);
|
||||
}
|
||||
@@ -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
232
hal/lib/Athena/CAN.cpp
Normal 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, ×tamp, &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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
149
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h
Normal file
149
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h
Normal 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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
330
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h
Normal file
330
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h
Normal 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__
|
||||
188
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h
Normal file
188
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h
Normal 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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
228
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h
Normal file
228
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h
Normal 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__
|
||||
@@ -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__
|
||||
@@ -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__
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
74
hal/lib/Athena/Power.cpp
Normal 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;
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
98
hal/lib/Athena/ctre/CtreCanNode.cpp
Normal file
98
hal/lib/Athena/ctre/CtreCanNode.cpp
Normal 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);
|
||||
}
|
||||
116
hal/lib/Athena/ctre/CtreCanNode.h
Normal file
116
hal/lib/Athena/ctre/CtreCanNode.h
Normal 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
|
||||
@@ -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);
|
||||
|
||||
@@ -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
Reference in New Issue
Block a user