mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
Compare commits
135 Commits
v2017.1.1-
...
v2017.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e375b4a9ff | ||
|
|
ff141ab1ff | ||
|
|
b8537be219 | ||
|
|
8f1b034b2f | ||
|
|
71d0a07e0a | ||
|
|
d322342494 | ||
|
|
bc7ab17692 | ||
|
|
7a049c29bd | ||
|
|
1fc375b31a | ||
|
|
eee7f3991c | ||
|
|
2e3503517d | ||
|
|
15e58acc76 | ||
|
|
5aa5e3e09e | ||
|
|
25ae7b2c2b | ||
|
|
4b6dc9583a | ||
|
|
64eab1f7b3 | ||
|
|
182f57216f | ||
|
|
65b091a39a | ||
|
|
ed1a94531a | ||
|
|
4e12ffb0ae | ||
|
|
4800c201e4 | ||
|
|
dc9a9e5d96 | ||
|
|
6844f05c3d | ||
|
|
8f67f2c24c | ||
|
|
cc246bb9ac | ||
|
|
bf9f0a9e6d | ||
|
|
c3160bad44 | ||
|
|
94b8ac42ca | ||
|
|
a03e3d7eb9 | ||
|
|
a42ec08d16 | ||
|
|
fddb6cd9d8 | ||
|
|
841f016017 | ||
|
|
8e4afc95c7 | ||
|
|
8cec948699 | ||
|
|
31ae7c942c | ||
|
|
d0900626da | ||
|
|
0ee4cadca0 | ||
|
|
24b5a9c389 | ||
|
|
626220e9f3 | ||
|
|
323d68d460 | ||
|
|
db2091dd94 | ||
|
|
8216d85e52 | ||
|
|
a705eb1c61 | ||
|
|
77f664a6b1 | ||
|
|
c30057e923 | ||
|
|
06108b9479 | ||
|
|
16181523c9 | ||
|
|
7e0706cf83 | ||
|
|
bff67887fd | ||
|
|
351ff5eb48 | ||
|
|
051df14046 | ||
|
|
ee0318f697 | ||
|
|
a6fb1efcbe | ||
|
|
31fecc28a4 | ||
|
|
30b1efc354 | ||
|
|
7d721eb569 | ||
|
|
d48aac5beb | ||
|
|
14b56db99e | ||
|
|
bfe429de51 | ||
|
|
57ef5cfd07 | ||
|
|
4bbb7c0bcc | ||
|
|
4de70bff5e | ||
|
|
687f0c7dc0 | ||
|
|
f3d66e92ec | ||
|
|
9a91ae54d6 | ||
|
|
69422dc063 | ||
|
|
7bcd243ec3 | ||
|
|
8f70bea899 | ||
|
|
948c4275ad | ||
|
|
03a1159915 | ||
|
|
1c8fb298b4 | ||
|
|
b25a7cb370 | ||
|
|
140c365e4b | ||
|
|
8c93ceb728 | ||
|
|
ac50d7cf8a | ||
|
|
ecb873ff45 | ||
|
|
78baa04ecc | ||
|
|
b78f580d47 | ||
|
|
b115c75226 | ||
|
|
6bc092f3ae | ||
|
|
f99a266ce4 | ||
|
|
1f724d58e0 | ||
|
|
de4a246bb4 | ||
|
|
412b80da30 | ||
|
|
47319960a5 | ||
|
|
b22d218236 | ||
|
|
6eb82bc314 | ||
|
|
a06dd25d56 | ||
|
|
e1bb05bc52 | ||
|
|
8694a020ac | ||
|
|
1efb2e4d3d | ||
|
|
861726cefa | ||
|
|
81212d80c6 | ||
|
|
2235a809c4 | ||
|
|
3fe0f49ac0 | ||
|
|
03d8f9193b | ||
|
|
5e54969f6b | ||
|
|
18ef5eb1bf | ||
|
|
b5e3d92e9d | ||
|
|
ba8761e39e | ||
|
|
78f0b1562c | ||
|
|
5c28b30028 | ||
|
|
59267da72b | ||
|
|
36ad45c07d | ||
|
|
ecb2add791 | ||
|
|
9bbdaf300b | ||
|
|
bc492bb40e | ||
|
|
81221c4874 | ||
|
|
137b3d81fb | ||
|
|
6741f47ef1 | ||
|
|
e75e9092a8 | ||
|
|
247cef5ec2 | ||
|
|
29f999e2b2 | ||
|
|
5e3755493d | ||
|
|
70343c0b3f | ||
|
|
60e199b0bd | ||
|
|
1071686d81 | ||
|
|
fdebdd520a | ||
|
|
5ca5583fc3 | ||
|
|
75463a249f | ||
|
|
7280d241f0 | ||
|
|
963391cf39 | ||
|
|
4f4c52d6d5 | ||
|
|
499da6d08d | ||
|
|
39e4d11f8e | ||
|
|
df4a2c07f0 | ||
|
|
c46c490376 | ||
|
|
f2751db5c2 | ||
|
|
2bff276adb | ||
|
|
e5e1a1a4d1 | ||
|
|
0613f1d182 | ||
|
|
8b94e0933a | ||
|
|
23ef57561d | ||
|
|
33b95816ee | ||
|
|
4c1e4fd80c |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -8,6 +8,8 @@ dependency-reduced-pom.xml
|
||||
/wpilibj/src/athena/cpp/nivision/*.java
|
||||
/wpilibj/src/athena/cpp/nivision/nivision_funcs.txt
|
||||
/wpilibj/src/athena/cpp/nivision/imaqdx_funcs.txt
|
||||
/wpilibj/src/shared/java/edu/wpi/first/wpilibj/util/WPILibVersion.java
|
||||
/wpilibc/shared/src/WPILibVersion.cpp
|
||||
doxygen.log
|
||||
|
||||
# Created by the jenkins test script
|
||||
@@ -184,3 +186,7 @@ NO
|
||||
|
||||
# VSCode
|
||||
.vscode/
|
||||
|
||||
#classpaths and projects
|
||||
.project
|
||||
.classpath
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[gerrit]
|
||||
host=usfirst.collab.net
|
||||
port=29418
|
||||
project=allwpilib
|
||||
defaultbranch=master
|
||||
@@ -1,12 +0,0 @@
|
||||
approve_by_comment: true
|
||||
approve_regex: ^(Approved|LGTM)
|
||||
reject_regex: ^Rejected
|
||||
reset_on_push: true
|
||||
reset_on_reopened: true
|
||||
|
||||
reviewers:
|
||||
-
|
||||
name: "Master Merge Approvers"
|
||||
required: 1
|
||||
teams:
|
||||
- master-merge-approvers
|
||||
@@ -15,7 +15,6 @@ otherExtensions {
|
||||
}
|
||||
|
||||
genFolderExclude {
|
||||
\.vscode
|
||||
FRC_FPGA_ChipObject
|
||||
NetworkCommunication
|
||||
ctre
|
||||
@@ -38,15 +37,11 @@ genFileExclude {
|
||||
|
||||
modifiableFolderExclude {
|
||||
\.git
|
||||
\.gradle
|
||||
__pycache__
|
||||
build
|
||||
wpilibj/src/athena/cpp/include
|
||||
wpilibj/src/athena/cpp/lib
|
||||
}
|
||||
|
||||
modifiableFileExclude {
|
||||
\.jar$
|
||||
\.patch$
|
||||
\.png$
|
||||
\.py$
|
||||
|
||||
@@ -7,8 +7,9 @@ before_install:
|
||||
- wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add -
|
||||
- sudo add-apt-repository ppa:wpilib/toolchain -y
|
||||
- sudo apt-get update -q || true
|
||||
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev -y
|
||||
|
||||
- sudo apt-get install frc-toolchain libgazebo7-dev protobuf-compiler libprotobuf-dev python3 clang-format-3.8 -y
|
||||
install:
|
||||
- pip3 install wpiformat
|
||||
|
||||
before_cache:
|
||||
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
|
||||
@@ -18,4 +19,6 @@ cache:
|
||||
- $HOME/.gradle/wrapper/
|
||||
|
||||
script:
|
||||
- wpiformat
|
||||
- git --no-pager diff --exit-code HEAD # Ensure formatter made no changes
|
||||
- ./gradlew build -PmakeSim
|
||||
|
||||
@@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Another option for C++ is running format.py in the style guide directory.
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system.
|
||||
|
||||
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
|
||||
|
||||
|
||||
18
README.md
18
README.md
@@ -22,13 +22,19 @@ The WPILib Mission is to enable FIRST Robotics teams to focus on writing game-sp
|
||||
Using Gradle makes building WPILib very straightforward. It only has a few dependencies on outside tools, such as the ARM cross compiler for creating roboRIO binaries.
|
||||
|
||||
## Requirements
|
||||
|
||||
- [ARM Compiler Toolchain](http://first.wpi.edu/FRC/roborio/toolchains/)
|
||||
- Doxygen (Only required if you want to build the C++ documentation)
|
||||
- [wpiformat](https://github.com/wpilibsuite/styleguide)
|
||||
|
||||
## Setup
|
||||
Clone the WPILib Repo. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
|
||||
|
||||
Clone the WPILib repository. If the toolchains are not installed, install them, and make sure they are available on the system PATH.
|
||||
|
||||
See the [styleguide README](https://github.com/wpilibsuite/styleguide/blob/master/README.md) for wpiformat setup instructions.
|
||||
|
||||
## Building
|
||||
|
||||
All build steps are executed using the Gradle wrapper, `gradlew`. Each target that Gradle can build is referred to as a task. The most common Gradle task to use is `build`. This will build all the outputs created by WPILib. To run, open a console and cd into the cloned WPILib directory. Then:
|
||||
|
||||
```bash
|
||||
@@ -41,6 +47,12 @@ To build a specific subproject, such as WPILibC, you must access the subproject
|
||||
./gradlew :wpilibc:build
|
||||
```
|
||||
|
||||
If you have installed the FRC Toolchain to a directory other than the default, or if the Toolchain location is not on your System PATH, you can pass the `toolChainPath` property to specify where it is located. Example:
|
||||
|
||||
```bash
|
||||
./gradlew build -PtoolChainPath=some/path/to/frc/toolchain/bin
|
||||
```
|
||||
|
||||
If you also want simulation to be built, add -PmakeSim. This requires gazebo_transport. We have tested on 14.04 and 15.05, but any correct install of Gazebo should work, even on Windows if you build Gazebo from source. Correct means CMake needs to be able to find gazebo-config.cmake. See [The Gazebo website](https://gazebosim.org/) for installation instructions.
|
||||
|
||||
```bash
|
||||
@@ -61,7 +73,10 @@ The gradlew wrapper only exists in the root of the main project, so be sure to r
|
||||
|
||||
There are a few tasks other than `build` available. To see them, run the meta-task `tasks`. This will print a list of all available tasks, with a description of each task.
|
||||
|
||||
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
|
||||
|
||||
## Publishing
|
||||
|
||||
If you are building to test with the Eclipse plugins or just want to export the build as a Maven-style dependency, simply run the `publish` task. This task will publish all available packages to ~/releases/maven/development. If you need to publish the project to a different repo, you can specify it with `-Prepo=repo_name`. Valid options are:
|
||||
|
||||
- development - The default repo.
|
||||
@@ -79,6 +94,7 @@ The following maven targets a published by this task:
|
||||
- org.gazebosim:JavaGazebo:0.1.0-SNAPSHOT - Gazebo protocol for Java.
|
||||
|
||||
## Structure and Organization
|
||||
|
||||
The main WPILib code you're probably looking for is in WPILibJ and WPILibC. Those directories are split into shared, sim, and athena. Athena contains the WPILib code meant to run on your roboRIO. Sim is WPILib code meant to run on your computer with Gazebo, and shared is code shared between the two. Shared code must be platform-independent, since it will be compiled with both the ARM cross-compiler and whatever desktop compiler you are using (g++, msvc, etc...).
|
||||
|
||||
The Simulation directory contains extra simulation tools and libraries, such as gz_msgs and JavaGazebo. See sub-directories for more information.
|
||||
|
||||
52
build.gradle
52
build.gradle
@@ -1,38 +1,37 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url "https://plugins.gradle.org/m2/"
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id 'net.ltgt.errorprone' version '0.0.8'
|
||||
id 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin' version '1.6'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
|
||||
// Ensure that the WPILibVersioningPlugin is setup by setting the release type, if releaseType wasn't
|
||||
// already specified on the command line
|
||||
if (!hasProperty('releaseType')) {
|
||||
WPILibVersion {
|
||||
releaseType = 'dev'
|
||||
}
|
||||
}
|
||||
|
||||
def enableSimulation = hasProperty('enableSimulation')
|
||||
|
||||
if (!hasProperty('repo')) {
|
||||
ext.repo = 'development'
|
||||
}
|
||||
|
||||
def repoBaseUrl = "http://first.wpi.edu/FRC/roborio/maven/${repo}"
|
||||
def publishUrl = "${System.getProperty('user.home')}/releases/maven/${repo}"
|
||||
def enableSimulation = hasProperty('makeSim')
|
||||
|
||||
ext.simulationInstallDir = "$rootDir/build/install/simulation"
|
||||
|
||||
allprojects {
|
||||
ext.enableSimulation = enableSimulation
|
||||
ext.repo = repo
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url publishUrl
|
||||
}
|
||||
maven {
|
||||
url repoBaseUrl
|
||||
}
|
||||
}
|
||||
|
||||
ext.ntcoreDep = { lang, classifier, extension = null ->
|
||||
return "edu.wpi.first.wpilib.networktables.$lang:NetworkTables:+:$classifier${extension == null ? '' : '@' + extension}"
|
||||
}
|
||||
|
||||
ext.cscoreDep = { lang, classifier, extension = null ->
|
||||
return "edu.wpi.cscore.$lang:cscore:+:$classifier${extension == null ? '' : '@' + extension}"
|
||||
}
|
||||
|
||||
ext.wpiUtilDep = { classifier ->
|
||||
return "edu.wpi.first.wpilib:wpiutil:+:$classifier@zip"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,16 +53,17 @@ subprojects {
|
||||
options.addStringOption('Xdoclint:none', '-quiet')
|
||||
}
|
||||
}
|
||||
|
||||
ext.setupWpilibRepo = { publishing ->
|
||||
publishing.repositories.maven {
|
||||
url = "${System.getProperty('user.home')}/releases/maven/${repo}"
|
||||
url = WPILibVersion.mavenLocalUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: 'cppSettings.gradle'
|
||||
|
||||
apply from: 'ni-libraries/ni-libraries.gradle'
|
||||
|
||||
task wrapper(type: Wrapper) {
|
||||
gradleVersion = '3.0'
|
||||
gradleVersion = '3.3'
|
||||
}
|
||||
|
||||
@@ -1,138 +1,179 @@
|
||||
// This regex matches either a Windows or Unix style file separator, then the lib part of the library,
|
||||
// then the name of the library itself, and finally the .so extension at the end. The name of the library
|
||||
// is in the libName capture group, which is extracted and used for the linker flags
|
||||
def libPattern = /.*((\\/|\\).*)+lib(?<libName>.+).so$/
|
||||
def niLibraryArgs = []
|
||||
def niLibraryPath = file('ni-libraries').path
|
||||
// These add the nilibraries shared library to the linker args
|
||||
def niLibraryPath = file('ni-libraries/lib').path
|
||||
def niLibrary = niLibraryPath + "/libnilibraries.so"
|
||||
|
||||
// The NI Library tree includes all non-wpi libraries, which is everything that doesn't have libwpi in the name
|
||||
def niLibraryTree = fileTree(niLibraryPath)
|
||||
niLibraryTree.include '*.so'
|
||||
niLibraryTree.exclude '*wpi*.so'
|
||||
configurations.create('armDeps')
|
||||
|
||||
// This adds all linker flags to the list of ni library linker flags
|
||||
niLibraryTree.each { lib ->
|
||||
def nameMatcher = (lib.path =~ libPattern)
|
||||
if (nameMatcher[0].size() > 1) {
|
||||
def name = nameMatcher.group('libName')
|
||||
niLibraryArgs << '-l' + name
|
||||
dependencies {
|
||||
armDeps ntcoreDep('cpp', 'arm', 'zip')
|
||||
armDeps wpiUtilDep('arm')
|
||||
armDeps cscoreDep('cpp', 'athena-uberzip', 'zip')
|
||||
}
|
||||
|
||||
def depLocation = "$buildDir/dependencies"
|
||||
|
||||
configurations.armDeps.files.each { file ->
|
||||
def depName = file.name.substring(0, file.name.indexOf('-'))
|
||||
def t = tasks.create("downloadArm${depName.capitalize()}", Copy) {
|
||||
description = "Downloads and unzips the $depName dependency."
|
||||
group = 'Dependencies'
|
||||
from zipTree(file)
|
||||
into "$depLocation/${depName.toLowerCase()}"
|
||||
}
|
||||
}
|
||||
|
||||
def armNtDependency =
|
||||
project.dependencies.create("edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:arm@zip")
|
||||
def armConfig = project.configurations.detachedConfiguration(armNtDependency)
|
||||
armConfig.setTransitive(false)
|
||||
def armNetTables = armConfig.files[0].canonicalFile
|
||||
|
||||
def desktopNetTables
|
||||
if (project.hasProperty('makeSim')) {
|
||||
def desktopNtDependency =
|
||||
project.dependencies.create("edu.wpi.first.wpilib.networktables.cpp:NetworkTables:3.0.0-SNAPSHOT:desktop@zip")
|
||||
def desktopConfig = project.configurations.detachedConfiguration(desktopNtDependency)
|
||||
desktopConfig.setTransitive(false)
|
||||
desktopNetTables = desktopConfig.files[0].canonicalFile
|
||||
task downloadNetworkTables {
|
||||
description = 'Downloads all needed versions of networktables.'
|
||||
group = 'Dependencies'
|
||||
dependsOn downloadArmNetworkTables
|
||||
}
|
||||
|
||||
def netTablesUnzipLocation = "$buildDir/networktables"
|
||||
task downloadWpiutil {
|
||||
description = 'Downloads all needed versions of WPIUtil.'
|
||||
group = 'Dependencies'
|
||||
dependsOn downloadArmWpiutil
|
||||
}
|
||||
|
||||
// Create a task that will unzip the networktables files into a temporary build directory
|
||||
task unzipNetworkTables(type: Copy) {
|
||||
description = 'Unzips the networktables maven dependency so that the include files and libraries can be used'
|
||||
group = 'WPILib'
|
||||
if (project.hasProperty('makeSim')) {
|
||||
from zipTree(desktopNetTables)
|
||||
task downloadCscore {
|
||||
description = 'Downloads all needed versions of cscore.'
|
||||
group = 'Dependencies'
|
||||
dependsOn downloadArmCscore
|
||||
}
|
||||
|
||||
if (enableSimulation) {
|
||||
configurations.create('nativeDeps')
|
||||
|
||||
dependencies {
|
||||
nativeDeps ntcoreDep('cpp', 'desktop', 'zip')
|
||||
nativeDeps wpiUtilDep('desktop')
|
||||
}
|
||||
from zipTree(armNetTables)
|
||||
into netTablesUnzipLocation
|
||||
}
|
||||
|
||||
def armWpiUtilDependency =
|
||||
project.dependencies.create("edu.wpi.first.wpilib:wpiutil:1.0.0-SNAPSHOT:arm@zip")
|
||||
def armWpiUtilConfig = project.configurations.detachedConfiguration(armWpiUtilDependency)
|
||||
armWpiUtilConfig.setTransitive(false)
|
||||
def armWpiUtil = armWpiUtilConfig.files[0].canonicalFile
|
||||
|
||||
def desktopWpiUtil
|
||||
if (project.hasProperty('makeSim')) {
|
||||
def desktopWpiUtilDependency =
|
||||
project.dependencies.create("edu.wpi.first.wpilib:wpiutil:1.0.0-SNAPSHOT:desktop@zip")
|
||||
def desktopWpiUtilConfig = project.configurations.detachedConfiguration(desktopWpiUtilDependency)
|
||||
desktopWpiUtilConfig.setTransitive(false)
|
||||
desktopWpiUtil = desktopWpiUtilConfig.files[0].canonicalFile
|
||||
}
|
||||
|
||||
def wpiUtilUnzipLocation = "$buildDir/wpiutil"
|
||||
|
||||
// Create a task that will unzip the wpiutil files into a temporary build directory
|
||||
task unzipWpiUtil(type: Copy) {
|
||||
description = 'Unzips the wpiutil maven dependency so that the include files and libraries can be used'
|
||||
group = 'WPILib'
|
||||
if (project.hasProperty('makeSim')) {
|
||||
from zipTree(desktopWpiUtil)
|
||||
configurations.nativeDeps.files.each { file ->
|
||||
def depName = file.name.substring(0, file.name.indexOf('-'))
|
||||
def t = tasks.create("downloadNative${depName.capitalize()}", Copy) {
|
||||
description = "Downloads and unzips the $depName dependency."
|
||||
group = 'Dependencies'
|
||||
from zipTree(file)
|
||||
into "$depLocation/${depName.toLowerCase()}"
|
||||
}
|
||||
}
|
||||
from zipTree(armWpiUtil)
|
||||
into wpiUtilUnzipLocation
|
||||
|
||||
downloadNetworkTables.dependsOn downloadNativeNetworkTables
|
||||
downloadWpiutil.dependsOn downloadNativeWpiutil
|
||||
}
|
||||
|
||||
def netTablesUnzipLocation = "$depLocation/networktables"
|
||||
def wpiUtilUnzipLocation = "$depLocation/wpiutil"
|
||||
def csCoreUnzipLocation = "$depLocation/cscore"
|
||||
|
||||
task clean(type: Delete) {
|
||||
description = "Deletes the build directory"
|
||||
group = "Build"
|
||||
delete buildDir
|
||||
}
|
||||
|
||||
if (!hasProperty("toolChainPath")) {
|
||||
ext.toolChainPath = null
|
||||
}
|
||||
|
||||
subprojects {
|
||||
ext.defineWpiUtilProperties = {
|
||||
ext.wpiUtil = wpiUtilUnzipLocation
|
||||
ext.wpiUtilInclude = "$wpiUtilUnzipLocation/include"
|
||||
ext.wpiUtilLibArmLocation = "$wpiUtilUnzipLocation/Linux/arm"
|
||||
if (enableSimulation) {
|
||||
ext.wpiUtilLibDesktopLocation = "$wpiUtilUnzipLocation/Linux/amd64"
|
||||
}
|
||||
ext.wpiUtilSharedLib = "$wpiUtilLibArmLocation/libwpiutil.so"
|
||||
ext.wpiUtilSharedLibDebug = "$wpiUtilLibArmLocation/libwpiutil.so.debug"
|
||||
ext.wpiUtilStaticLib = "$wpiUtilLibArmLocation/libwpiutil.a"
|
||||
|
||||
ext.addWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').downloadWpiutil
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args wpiUtilSharedLib
|
||||
}
|
||||
}
|
||||
|
||||
ext.addStaticWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').downloadWpiutil
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args wpiUtilStaticLib
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This defines a project property that projects depending on network tables can use to setup that dependency.
|
||||
ext.defineNetworkTablesProperties = {
|
||||
ext.netTables = netTablesUnzipLocation
|
||||
ext.netTablesInclude = "$netTablesUnzipLocation/include"
|
||||
ext.netLibArmLocation = "$netTablesUnzipLocation/Linux/arm"
|
||||
if (enableSimulation) {
|
||||
ext.netLibDesktopLocation = "$netTablesUnzipLocation/Linux/amd64"
|
||||
}
|
||||
ext.netSharedLib = "$netLibArmLocation/libntcore.so"
|
||||
ext.netSharedLibDebug = "$netLibArmLocation/libntcore.so.debug"
|
||||
ext.netStaticLib = "$netLibArmLocation/libntcore.a"
|
||||
|
||||
ext.addNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').downloadNetworkTables
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args netSharedLib
|
||||
}
|
||||
addWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
|
||||
}
|
||||
|
||||
ext.addStaticNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').downloadNetworkTables
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args netStaticLib
|
||||
}
|
||||
addStaticWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
|
||||
}
|
||||
}
|
||||
|
||||
// This defines a project property that projects depending on cscore can use to setup that dependency.
|
||||
ext.defineCsCoreProperties = {
|
||||
ext.csCore = csCoreUnzipLocation
|
||||
ext.csCoreInclude = "$csCoreUnzipLocation/include"
|
||||
ext.csLibArmLocation = "$csCoreUnzipLocation/lib"
|
||||
ext.csSharedLib = "$csLibArmLocation/libcscore.so"
|
||||
ext.cvSharedLib = "$csLibArmLocation/libopencv.so"
|
||||
|
||||
ext.addCsCoreLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').downloadCscore
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args << '-L' + csLibArmLocation
|
||||
linker.args csSharedLib
|
||||
linker.args cvSharedLib
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.defineCrossCompilerProperties = {
|
||||
// We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi-<util name>
|
||||
// If this ever changes, the prefix will need to be changed here
|
||||
ext.compilerPrefix = 'arm-frc-linux-gnueabi-'
|
||||
}
|
||||
|
||||
plugins.withType(CppPlugin).whenPluginAdded {
|
||||
ext.defineWpiUtilProperties = {
|
||||
ext.wpiUtil = wpiUtilUnzipLocation
|
||||
ext.wpiUtilInclude = "$wpiUtilUnzipLocation/include"
|
||||
ext.wpiUtilLibArmLocation = "$wpiUtilUnzipLocation/Linux/arm"
|
||||
if (project.hasProperty('makeSim')) {
|
||||
ext.wpiUtilLibDesktopLocation = "$wpiUtilUnzipLocation/Linux/amd64"
|
||||
}
|
||||
ext.wpiUtilStaticLib = "$wpiUtilLibArmLocation/libwpiutil.a"
|
||||
|
||||
ext.addWpiUtilLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').unzipWpiUtil
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args wpiUtilStaticLib
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This defines a project property that projects depending on network tables can use to setup that dependency.
|
||||
ext.defineNetworkTablesProperties = {
|
||||
ext.netTables = netTablesUnzipLocation
|
||||
ext.netTablesInclude = "$netTablesUnzipLocation/include"
|
||||
ext.netLibArmLocation = "$netTablesUnzipLocation/Linux/arm"
|
||||
if (project.hasProperty('makeSim')) {
|
||||
ext.netLibDesktopLocation = "$netTablesUnzipLocation/Linux/amd64"
|
||||
}
|
||||
ext.netSharedLib = "$netLibArmLocation/libntcore.so"
|
||||
ext.netStaticLib = "$netLibArmLocation/libntcore.a"
|
||||
|
||||
ext.addNetworkTablesLibraryLinks = { compileTask, linker, targetPlatform ->
|
||||
compileTask.dependsOn project(':').unzipNetworkTables
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')) {
|
||||
linker.args netStaticLib
|
||||
}
|
||||
addWpiUtilLibraryLinks(compileTask, linker, targetPlatform)
|
||||
}
|
||||
}
|
||||
|
||||
defineCrossCompilerProperties()
|
||||
model {
|
||||
buildTypes {
|
||||
debug
|
||||
}
|
||||
// Adds a custom toolchain for our compiler prefix and options
|
||||
toolChains {
|
||||
gcc(Gcc) {
|
||||
target('arm') {
|
||||
// We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi-<util name>
|
||||
// If this ever changes, the prefix will need to be changed here
|
||||
def compilerPrefix = 'arm-frc-linux-gnueabi-'
|
||||
roborioGcc(Gcc) {
|
||||
if (toolChainPath != null)
|
||||
path toolChainPath
|
||||
target('roborio-arm') {
|
||||
cCompiler.executable = compilerPrefix + cCompiler.executable
|
||||
cppCompiler.executable = compilerPrefix + cppCompiler.executable
|
||||
linker.executable = compilerPrefix + linker.executable
|
||||
assembler.executable = compilerPrefix + assembler.executable
|
||||
@@ -154,52 +195,48 @@ subprojects {
|
||||
staticLibArchiver.executable = compilerPrefix + staticLibArchiver.executable
|
||||
}
|
||||
}
|
||||
// Workaround for OS X. Macs for some reason want to use Xcode's gcc
|
||||
// (which just wraps Clang), so we have to explicitly make it so
|
||||
// that trying to compile with Clang will call gcc instead
|
||||
macGcc(Clang) {
|
||||
target('arm') {
|
||||
// We use a custom-built cross compiler with the prefix arm-frc-linux-gnueabi-<util name>
|
||||
// If this ever changes, the prefix will need to be changed here
|
||||
def compilerPrefix = 'arm-frc-linux-gnueabi-'
|
||||
cppCompiler.executable = compilerPrefix + 'g++'
|
||||
linker.executable = compilerPrefix + 'g++'
|
||||
assembler.executable = compilerPrefix + 'gcc'
|
||||
// Gradle auto-adds the -m32 argument to the linker and compiler. Our compiler only supports
|
||||
// arm, and doesn't understand this flag, so it is removed from both
|
||||
cppCompiler.withArguments { args ->
|
||||
args << '-std=c++1y' << '-Wformat=2' << '-Wall' << '-Wextra' << '-Werror' << '-pedantic'
|
||||
args << '-Wno-psabi' << '-Wno-unused-parameter' << '-fPIC' << '-Og' << '-g3' << '-rdynamic'
|
||||
//TODO: When the compiler allows us to actually call deprecated functions from within
|
||||
// deprecated function, remove this line (this will cause calling deprecated functions
|
||||
// to be treated as a warning rather than an error).
|
||||
args << '-Wno-error=deprecated-declarations'
|
||||
args.remove('-m32')
|
||||
}
|
||||
linker.withArguments { args ->
|
||||
args << '-rdynamic'
|
||||
args.remove('-m32')
|
||||
}
|
||||
staticLibArchiver.executable = compilerPrefix + 'ar'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The only platform is arm linux
|
||||
platforms {
|
||||
arm {
|
||||
'roborio-arm' {
|
||||
architecture 'arm'
|
||||
operatingSystem 'linux'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.niLibraryHeadersRoot = "${rootDir}/ni-libraries/include"
|
||||
ext.niLibraryHeadersChipObject = "${rootDir}/ni-libraries/include/FRC_FPGA_ChipObject"
|
||||
|
||||
ext.binTool = { tool ->
|
||||
if (toolChainPath != null) return "${toolChainPath}/${compilerPrefix}${tool}"
|
||||
return "${compilerPrefix}${tool}"
|
||||
}
|
||||
|
||||
// This task adds the appropriate linker flags for the NI libraries
|
||||
ext.addNiLibraryLinks = { linker, targetPlatform ->
|
||||
String architecture = targetPlatform.architecture
|
||||
if (architecture.contains('arm')){
|
||||
linker.args << '-L' + niLibraryPath
|
||||
linker.args.addAll(niLibraryArgs)
|
||||
linker.args niLibrary
|
||||
}
|
||||
}
|
||||
|
||||
// This task sets up the shared libraries to be stripped
|
||||
ext.debugStripSetup = { project->
|
||||
if (!project.hasProperty('debug')) {
|
||||
project.tasks.whenObjectAdded { task ->
|
||||
def name = task.name.toLowerCase()
|
||||
if (name.contains('link') && name.contains('sharedlibrary')) {
|
||||
def library = task.outputFile.absolutePath
|
||||
def debugLibrary = task.outputFile.absolutePath + ".debug"
|
||||
task.doLast {
|
||||
exec { commandLine binTool('objcopy'), '--only-keep-debug', library, debugLibrary }
|
||||
exec { commandLine binTool('strip'), '-g', library }
|
||||
exec { commandLine binTool('objcopy'), "--add-gnu-debuglink=$debugLibrary", library }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
12
gradle/wrapper/gradle-wrapper.properties
vendored
12
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
#Mon Aug 22 20:26:07 PDT 2016
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.0-bin.zip
|
||||
#Wed Jan 04 21:49:36 PST 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
|
||||
|
||||
19
gradlew
vendored
19
gradlew
vendored
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@@ -154,16 +154,19 @@ if $cygwin ; then
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save ( ) {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [[ "$(uname)" == "Darwin" ]] && [[ "$HOME" == "$PWD" ]]; then
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
159
hal/build.gradle
159
hal/build.gradle
@@ -2,48 +2,159 @@
|
||||
// - desktop which is used by simulation (gcc/msvc)
|
||||
// - athena which is used by the roborio (arm)
|
||||
|
||||
apply plugin: 'cpp'
|
||||
plugins {
|
||||
id 'cpp'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
defineWpiUtilProperties()
|
||||
|
||||
debugStripSetup(project)
|
||||
|
||||
model {
|
||||
components {
|
||||
HALAthena(NativeLibrarySpec) {
|
||||
targetPlatform 'arm'
|
||||
targetPlatform 'roborio-arm'
|
||||
binaries.all {
|
||||
tasks.withType(CppCompile) {
|
||||
addNiLibraryLinks(linker, targetPlatform)
|
||||
addWpiUtilLibraryLinks(it, linker, targetPlatform)
|
||||
}
|
||||
}
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
srcDirs = ["lib/athena", "lib/athena/FRC_FPGA_ChipObject", "lib/shared"]
|
||||
srcDirs = ["lib/athena", niLibraryHeadersRoot, "lib/shared"]
|
||||
includes = ["**/*.cpp"]
|
||||
}
|
||||
exportedHeaders {
|
||||
srcDirs = ["include", "lib/athena/FRC_FPGA_ChipObject"]
|
||||
srcDirs = ["include", niLibraryHeadersRoot, wpiUtilInclude]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// HALSim(NativeLibrarySpec) {
|
||||
// binaries.all {
|
||||
// if (toolChain in Gcc){
|
||||
// cppCompiler.args "-std=c++1y"
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// sources {
|
||||
// cpp {
|
||||
// source {
|
||||
// srcDirs = ["lib/sim", "lib/shared"]
|
||||
// includes = ["**/*.cpp"]
|
||||
// }
|
||||
// exportedHeaders {
|
||||
// srcDirs = ["include", "lib/sim", "lib/shared"]
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
tasks { tasks ->
|
||||
tasks.halZip.dependsOn tasks.HALAthenaSharedLibrary
|
||||
tasks.athenaRuntimeZip.dependsOn tasks.HALAthenaSharedLibrary
|
||||
}
|
||||
}
|
||||
|
||||
task halZip(type: Zip) {
|
||||
description = 'Zips the HAL'
|
||||
group = 'WPILib'
|
||||
baseName = 'hal'
|
||||
destinationDir = project.buildDir
|
||||
duplicatesStrategy = 'exclude'
|
||||
|
||||
// Include the shared library file and header files from this project
|
||||
model {
|
||||
binaries {
|
||||
withType(SharedLibraryBinarySpec) { spec ->
|
||||
spec.headerDirs.each {
|
||||
def normalizedIt = it.toString().replace('/', '\\')
|
||||
def normalizedWPIUtil = wpiUtilInclude.toString().replace('/', '\\')
|
||||
// exclude the wpiUtil library, and any NI libraries (NI libraries grabbed later)
|
||||
if (normalizedIt != normalizedWPIUtil) {
|
||||
from(it) {
|
||||
into 'include'
|
||||
// We don't want to include any of the .cpp files that are in some of the header directories
|
||||
exclude '**/*.cpp'
|
||||
}
|
||||
}
|
||||
}
|
||||
from(spec.sharedLibraryFile) {
|
||||
into 'lib'
|
||||
}
|
||||
from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
|
||||
into 'lib'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finally, include all of the shared library objects from the ni directory
|
||||
from(project.file('../ni-libraries/lib')) {
|
||||
into 'lib'
|
||||
exclude 'genlinks'
|
||||
exclude 'genlinks.bat'
|
||||
exclude 'libwpi.so'
|
||||
}
|
||||
}
|
||||
|
||||
task athenaRuntimeZip(type: Zip) {
|
||||
description = 'Zips the Athena Runtime libraries'
|
||||
group = 'WPILib'
|
||||
baseName = 'athena-runtime'
|
||||
destinationDir = project.buildDir
|
||||
duplicatesStrategy = 'exclude'
|
||||
|
||||
// Include the static library file and header files from this project
|
||||
model {
|
||||
binaries {
|
||||
withType(SharedLibraryBinarySpec) { spec ->
|
||||
spec.headerDirs.each {
|
||||
from(it) {
|
||||
into 'include'
|
||||
// We don't want to include any of the .cpp files that are in some of the header directories
|
||||
exclude '**/*.cpp'
|
||||
}
|
||||
}
|
||||
from(spec.sharedLibraryFile) {
|
||||
into 'lib'
|
||||
}
|
||||
from(new File(spec.sharedLibraryFile.absolutePath + ".debug")) {
|
||||
into 'lib'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
defineNetworkTablesProperties()
|
||||
dependsOn project(':').downloadNetworkTables
|
||||
|
||||
from(project.file(netTablesInclude)) {
|
||||
into 'include'
|
||||
}
|
||||
|
||||
from (file(netSharedLib)) {
|
||||
into 'lib'
|
||||
}
|
||||
|
||||
from (file(netSharedLibDebug)) {
|
||||
into 'lib'
|
||||
}
|
||||
|
||||
from (file(wpiUtilSharedLib)) {
|
||||
into 'lib'
|
||||
}
|
||||
|
||||
from (file(wpiUtilSharedLibDebug)) {
|
||||
into 'lib'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
hal(MavenPublication) {
|
||||
artifact halZip
|
||||
|
||||
groupId 'edu.wpi.first.wpilib'
|
||||
artifactId 'hal'
|
||||
version WPILibVersion.version
|
||||
}
|
||||
athenaruntime(MavenPublication) {
|
||||
artifact athenaRuntimeZip
|
||||
|
||||
groupId 'edu.wpi.first.wpilib'
|
||||
artifactId 'athena-runtime'
|
||||
version WPILibVersion.version
|
||||
}
|
||||
}
|
||||
|
||||
setupWpilibRepo(it)
|
||||
}
|
||||
|
||||
build.dependsOn halZip
|
||||
build.dependsOn athenaRuntimeZip
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -10,12 +10,6 @@
|
||||
#pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
||||
|
||||
#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h" // NOLINT
|
||||
#include "FRC_FPGA_ChipObject/tDMAManager.h" // NOLINT
|
||||
#include "FRC_FPGA_ChipObject/tInterruptManager.h" // NOLINT
|
||||
#include "FRC_FPGA_ChipObject/tSystem.h" // NOLINT
|
||||
#include "FRC_FPGA_ChipObject/tSystemInterface.h" // NOLINT
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
|
||||
@@ -38,8 +32,15 @@
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h"
|
||||
#include "FRC_FPGA_ChipObject/tDMAChannelDescriptor.h"
|
||||
#include "FRC_FPGA_ChipObject/tDMAManager.h"
|
||||
#include "FRC_FPGA_ChipObject/tInterruptManager.h"
|
||||
#include "FRC_FPGA_ChipObject/tSystem.h"
|
||||
#include "FRC_FPGA_ChipObject/tSystemInterface.h"
|
||||
|
||||
// FIXME: these should not be here!
|
||||
namespace hal {
|
||||
using namespace nFPGA;
|
||||
using namespace nRoboRIO_FPGANamespace;
|
||||
} // namespace hal
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2013-2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2013-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -104,6 +104,8 @@ int32_t HAL_SetJoystickOutputs(int32_t joystickNum, int64_t outputs,
|
||||
int32_t leftRumble, int32_t rightRumble);
|
||||
double HAL_GetMatchTime(int32_t* status);
|
||||
|
||||
#ifndef HAL_USE_LABVIEW
|
||||
|
||||
void HAL_WaitForDSData(void);
|
||||
void HAL_InitializeDriverStation(void);
|
||||
|
||||
@@ -112,6 +114,9 @@ void HAL_ObserveUserProgramDisabled(void);
|
||||
void HAL_ObserveUserProgramAutonomous(void);
|
||||
void HAL_ObserveUserProgramTeleop(void);
|
||||
void HAL_ObserveUserProgramTest(void);
|
||||
|
||||
#endif // HAL_USE_LABVIEW
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -83,6 +83,26 @@
|
||||
#define HAL_HANDLE_ERROR_MESSAGE \
|
||||
"HAL: A handle parameter was passed incorrectly"
|
||||
|
||||
#define HAL_SERIAL_PORT_NOT_FOUND -1123
|
||||
#define HAL_SERIAL_PORT_NOT_FOUND_MESSAGE \
|
||||
"HAL: The specified serial port device was not found"
|
||||
|
||||
#define HAL_SERIAL_PORT_OPEN_ERROR -1124
|
||||
#define HAL_SERIAL_PORT_OPEN_ERROR_MESSAGE \
|
||||
"HAL: The serial port could not be opened"
|
||||
|
||||
#define HAL_SERIAL_PORT_ERROR -1125
|
||||
#define HAL_SERIAL_PORT_ERROR_MESSAGE \
|
||||
"HAL: There was an error on the serial port"
|
||||
|
||||
#define HAL_THREAD_PRIORITY_ERROR -1152
|
||||
#define HAL_THREAD_PRIORITY_ERROR_MESSAGE \
|
||||
"HAL: Getting or setting the priority of a thread has failed";
|
||||
|
||||
#define HAL_THREAD_PRIORITY_RANGE_ERROR -1153
|
||||
#define HAL_THREAD_PRIORITY_RANGE_ERROR_MESSAGE \
|
||||
"HAL: The priority requested to be set is invalid"
|
||||
|
||||
#define VI_ERROR_SYSTEM_ERROR_MESSAGE "HAL - VISA: System Error";
|
||||
#define VI_ERROR_INV_OBJECT_MESSAGE "HAL - VISA: Invalid Object"
|
||||
#define VI_ERROR_RSRC_LOCKED_MESSAGE "HAL - VISA: Resource Locked"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2013-2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2013-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,7 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "FRC_NetworkCommunication/UsageReporting.h"
|
||||
#ifndef HAL_USE_LABVIEW
|
||||
|
||||
#include "HAL/Accelerometer.h"
|
||||
#include "HAL/AnalogAccumulator.h"
|
||||
#include "HAL/AnalogGyro.h"
|
||||
@@ -33,7 +34,10 @@
|
||||
#include "HAL/SPI.h"
|
||||
#include "HAL/SerialPort.h"
|
||||
#include "HAL/Solenoid.h"
|
||||
#include "HAL/Task.h"
|
||||
|
||||
#endif // HAL_USE_LABVIEW
|
||||
|
||||
#include "FRC_NetworkCommunication/UsageReporting.h"
|
||||
#include "HAL/Types.h"
|
||||
|
||||
namespace HALUsageReporting = nUsageReporting;
|
||||
@@ -43,13 +47,11 @@ enum HAL_RuntimeType : int32_t { HAL_Athena, HAL_Mock };
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
HAL_PortHandle HAL_GetPort(int32_t channel);
|
||||
HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
|
||||
|
||||
const char* HAL_GetErrorMessage(int32_t code);
|
||||
|
||||
int32_t HAL_GetFPGAVersion(int32_t* status);
|
||||
int64_t HAL_GetFPGARevision(int32_t* status);
|
||||
uint64_t HAL_GetFPGATime(int32_t* status);
|
||||
|
||||
HAL_RuntimeType HAL_GetRuntimeType();
|
||||
HAL_Bool HAL_GetFPGAButton(int32_t* status);
|
||||
@@ -57,6 +59,15 @@ HAL_Bool HAL_GetFPGAButton(int32_t* status);
|
||||
HAL_Bool HAL_GetSystemActive(int32_t* status);
|
||||
HAL_Bool HAL_GetBrownedOut(int32_t* status);
|
||||
|
||||
void HAL_BaseInitialize(int32_t* status);
|
||||
|
||||
#ifndef HAL_USE_LABVIEW
|
||||
|
||||
HAL_PortHandle HAL_GetPort(int32_t channel);
|
||||
HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel);
|
||||
|
||||
uint64_t HAL_GetFPGATime(int32_t* status);
|
||||
|
||||
int32_t HAL_Initialize(int32_t mode);
|
||||
|
||||
// ifdef's definition is to allow for default parameters in C++.
|
||||
@@ -67,6 +78,8 @@ int64_t HAL_Report(int32_t resource, int32_t instanceNumber,
|
||||
int64_t HAL_Report(int32_t resource, int32_t instanceNumber, int32_t context,
|
||||
const char* feature);
|
||||
#endif
|
||||
|
||||
#endif // HAL_USE_LABVIEW
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -39,6 +39,9 @@ void HAL_RequestInterrupts(HAL_InterruptHandle interruptHandle,
|
||||
void HAL_AttachInterruptHandler(HAL_InterruptHandle interruptHandle,
|
||||
HAL_InterruptHandlerFunction handler,
|
||||
void* param, int32_t* status);
|
||||
void HAL_AttachInterruptHandlerThreaded(HAL_InterruptHandle interruptHandle,
|
||||
HAL_InterruptHandlerFunction handler,
|
||||
void* param, int32_t* status);
|
||||
void HAL_SetInterruptUpSourceEdge(HAL_InterruptHandle interruptHandle,
|
||||
HAL_Bool risingEdge, HAL_Bool fallingEdge,
|
||||
int32_t* status);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,14 +7,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ColorImage.h"
|
||||
#define HAL_USE_LABVIEW
|
||||
|
||||
/**
|
||||
* A color image represented in RGB color space at 3 bytes per pixel.
|
||||
*/
|
||||
class RGBImage : public ColorImage {
|
||||
public:
|
||||
RGBImage();
|
||||
explicit RGBImage(const char* fileName);
|
||||
virtual ~RGBImage() = default;
|
||||
};
|
||||
#include "HAL/DriverStation.h"
|
||||
#include "HAL/HAL.h"
|
||||
#include "HAL/Types.h"
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -20,6 +20,8 @@ typedef void (*HAL_NotifierProcessFunction)(uint64_t currentTime,
|
||||
|
||||
HAL_NotifierHandle HAL_InitializeNotifier(HAL_NotifierProcessFunction process,
|
||||
void* param, int32_t* status);
|
||||
HAL_NotifierHandle HAL_InitializeNotifierThreaded(
|
||||
HAL_NotifierProcessFunction process, void* param, int32_t* status);
|
||||
void HAL_CleanNotifier(HAL_NotifierHandle notifierHandle, int32_t* status);
|
||||
void* HAL_GetNotifierParam(HAL_NotifierHandle notifierHandle, int32_t* status);
|
||||
void HAL_UpdateNotifierAlarm(HAL_NotifierHandle notifierHandle,
|
||||
|
||||
50
hal/include/HAL/OSSerialPort.h
Normal file
50
hal/include/HAL/OSSerialPort.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "SerialPort.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void HAL_InitializeOSSerialPort(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_SetOSSerialBaudRate(HAL_SerialPort port, int32_t baud,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialDataBits(HAL_SerialPort port, int32_t bits,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialParity(HAL_SerialPort port, int32_t parity,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialStopBits(HAL_SerialPort port, int32_t stopBits,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialWriteMode(HAL_SerialPort port, int32_t mode,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialFlowControl(HAL_SerialPort port, int32_t flow,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialTimeout(HAL_SerialPort port, double timeout,
|
||||
int32_t* status);
|
||||
void HAL_EnableOSSerialTermination(HAL_SerialPort port, char terminator,
|
||||
int32_t* status);
|
||||
void HAL_DisableOSSerialTermination(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_SetOSSerialReadBufferSize(HAL_SerialPort port, int32_t size,
|
||||
int32_t* status);
|
||||
void HAL_SetOSSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
|
||||
int32_t* status);
|
||||
int32_t HAL_GetOSSerialBytesReceived(HAL_SerialPort port, int32_t* status);
|
||||
int32_t HAL_ReadOSSerial(HAL_SerialPort port, char* buffer, int32_t count,
|
||||
int32_t* status);
|
||||
int32_t HAL_WriteOSSerial(HAL_SerialPort port, const char* buffer,
|
||||
int32_t count, int32_t* status);
|
||||
void HAL_FlushOSSerial(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_ClearOSSerial(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_CloseOSSerial(HAL_SerialPort port, int32_t* status);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -31,7 +31,6 @@ int32_t HAL_GetNumPCMModules(void);
|
||||
int32_t HAL_GetNumSolenoidChannels(void);
|
||||
int32_t HAL_GetNumPDPModules(void);
|
||||
int32_t HAL_GetNumPDPChannels(void);
|
||||
int32_t HAL_GetNumCanTalons(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,31 +9,42 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
enum HAL_SerialPort : int32_t {
|
||||
HAL_SerialPort_Onboard = 0,
|
||||
HAL_SerialPort_MXP = 1,
|
||||
HAL_SerialPort_USB1 = 2,
|
||||
HAL_SerialPort_USB2 = 3
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void HAL_InitializeSerialPort(int32_t port, int32_t* status);
|
||||
void HAL_SetSerialBaudRate(int32_t port, int32_t baud, int32_t* status);
|
||||
void HAL_SetSerialDataBits(int32_t port, int32_t bits, int32_t* status);
|
||||
void HAL_SetSerialParity(int32_t port, int32_t parity, int32_t* status);
|
||||
void HAL_SetSerialStopBits(int32_t port, int32_t stopBits, int32_t* status);
|
||||
void HAL_SetSerialWriteMode(int32_t port, int32_t mode, int32_t* status);
|
||||
void HAL_SetSerialFlowControl(int32_t port, int32_t flow, int32_t* status);
|
||||
void HAL_SetSerialTimeout(int32_t port, double timeout, int32_t* status);
|
||||
void HAL_EnableSerialTermination(int32_t port, char terminator,
|
||||
void HAL_InitializeSerialPort(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_SetSerialBaudRate(HAL_SerialPort port, int32_t baud, int32_t* status);
|
||||
void HAL_SetSerialDataBits(HAL_SerialPort port, int32_t bits, int32_t* status);
|
||||
void HAL_SetSerialParity(HAL_SerialPort port, int32_t parity, int32_t* status);
|
||||
void HAL_SetSerialStopBits(HAL_SerialPort port, int32_t stopBits,
|
||||
int32_t* status);
|
||||
void HAL_SetSerialWriteMode(HAL_SerialPort port, int32_t mode, int32_t* status);
|
||||
void HAL_SetSerialFlowControl(HAL_SerialPort port, int32_t flow,
|
||||
int32_t* status);
|
||||
void HAL_SetSerialTimeout(HAL_SerialPort port, double timeout, int32_t* status);
|
||||
void HAL_EnableSerialTermination(HAL_SerialPort port, char terminator,
|
||||
int32_t* status);
|
||||
void HAL_DisableSerialTermination(int32_t port, int32_t* status);
|
||||
void HAL_SetSerialReadBufferSize(int32_t port, int32_t size, int32_t* status);
|
||||
void HAL_SetSerialWriteBufferSize(int32_t port, int32_t size, int32_t* status);
|
||||
int32_t HAL_GetSerialBytesReceived(int32_t port, int32_t* status);
|
||||
int32_t HAL_ReadSerial(int32_t port, char* buffer, int32_t count,
|
||||
void HAL_DisableSerialTermination(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_SetSerialReadBufferSize(HAL_SerialPort port, int32_t size,
|
||||
int32_t* status);
|
||||
void HAL_SetSerialWriteBufferSize(HAL_SerialPort port, int32_t size,
|
||||
int32_t* status);
|
||||
int32_t HAL_GetSerialBytesReceived(HAL_SerialPort port, int32_t* status);
|
||||
int32_t HAL_ReadSerial(HAL_SerialPort port, char* buffer, int32_t count,
|
||||
int32_t* status);
|
||||
int32_t HAL_WriteSerial(int32_t port, const char* buffer, int32_t count,
|
||||
int32_t HAL_WriteSerial(HAL_SerialPort port, const char* buffer, int32_t count,
|
||||
int32_t* status);
|
||||
void HAL_FlushSerial(int32_t port, int32_t* status);
|
||||
void HAL_ClearSerial(int32_t port, int32_t* status);
|
||||
void HAL_CloseSerial(int32_t port, int32_t* status);
|
||||
void HAL_FlushSerial(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_ClearSerial(HAL_SerialPort port, int32_t* status);
|
||||
void HAL_CloseSerial(HAL_SerialPort port, int32_t* status);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -25,6 +25,7 @@ HAL_Bool HAL_GetSolenoid(HAL_SolenoidHandle solenoidPortHandle,
|
||||
int32_t HAL_GetAllSolenoids(int32_t module, int32_t* status);
|
||||
void HAL_SetSolenoid(HAL_SolenoidHandle solenoidPortHandle, HAL_Bool value,
|
||||
int32_t* status);
|
||||
void HAL_SetAllSolenoids(int32_t module, int32_t state, int32_t* status);
|
||||
int32_t HAL_GetPCMSolenoidBlackList(int32_t module, int32_t* status);
|
||||
HAL_Bool HAL_GetPCMSolenoidVoltageStickyFault(int32_t module, int32_t* status);
|
||||
HAL_Bool HAL_GetPCMSolenoidVoltageFault(int32_t module, int32_t* status);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef _STATUS_DEFINED
|
||||
#define _STATUS_DEFINED
|
||||
typedef int32_t STATUS;
|
||||
#endif /* _STATUS_DEFINED */
|
||||
|
||||
#ifndef OK
|
||||
#define OK 0
|
||||
#endif /* OK */
|
||||
#ifndef ERROR
|
||||
#define ERROR (-1)
|
||||
#endif /* ERROR */
|
||||
|
||||
typedef pthread_t* TASK;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
// Note: These constants used to be declared extern and were defined in
|
||||
// Task.cpp. This caused issues with the JNI bindings for java, and so the
|
||||
// instantiations were moved here.
|
||||
const int32_t HAL_TaskLib_ILLEGAL_PRIORITY = 22; // 22 is EINVAL
|
||||
|
||||
STATUS HAL_VerifyTaskID(TASK task);
|
||||
|
||||
// valid priority [1..99]
|
||||
STATUS HAL_SetTaskPriority(TASK task, int32_t priority);
|
||||
|
||||
STATUS HAL_GetTaskPriority(TASK task, int32_t* priority);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
28
hal/include/HAL/Threads.h
Normal file
28
hal/include/HAL/Threads.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HAL/Types.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#define NativeThreadHandle const HANDLE*
|
||||
#else
|
||||
#include <pthread.h>
|
||||
#define NativeThreadHandle const pthread_t*
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
int32_t HAL_GetThreadPriority(NativeThreadHandle handle, HAL_Bool* isRealTime,
|
||||
int32_t* status);
|
||||
int32_t HAL_GetCurrentThreadPriority(HAL_Bool* isRealTime, int32_t* status);
|
||||
HAL_Bool HAL_SetThreadPriority(NativeThreadHandle handle, HAL_Bool realTime,
|
||||
int32_t priority, int32_t* status);
|
||||
HAL_Bool HAL_SetCurrentThreadPriority(HAL_Bool realTime, int32_t priority,
|
||||
int32_t* status);
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -15,32 +15,32 @@ typedef int32_t HAL_Handle;
|
||||
|
||||
typedef HAL_Handle HAL_PortHandle;
|
||||
|
||||
typedef HAL_Handle HAL_InterruptHandle;
|
||||
|
||||
typedef HAL_Handle HAL_NotifierHandle;
|
||||
typedef HAL_Handle HAL_AnalogInputHandle;
|
||||
|
||||
typedef HAL_Handle HAL_AnalogOutputHandle;
|
||||
|
||||
typedef HAL_Handle HAL_AnalogInputHandle;
|
||||
|
||||
typedef HAL_Handle HAL_AnalogTriggerHandle;
|
||||
|
||||
typedef HAL_Handle HAL_RelayHandle;
|
||||
typedef HAL_Handle HAL_CompressorHandle;
|
||||
|
||||
typedef HAL_Handle HAL_CounterHandle;
|
||||
|
||||
typedef HAL_Handle HAL_DigitalHandle;
|
||||
|
||||
typedef HAL_Handle HAL_DigitalPWMHandle;
|
||||
|
||||
typedef HAL_Handle HAL_CounterHandle;
|
||||
|
||||
typedef HAL_Handle HAL_CompressorHandle;
|
||||
|
||||
typedef HAL_Handle HAL_SolenoidHandle;
|
||||
typedef HAL_Handle HAL_EncoderHandle;
|
||||
|
||||
typedef HAL_Handle HAL_FPGAEncoderHandle;
|
||||
|
||||
typedef HAL_Handle HAL_EncoderHandle;
|
||||
|
||||
typedef HAL_Handle HAL_GyroHandle;
|
||||
|
||||
typedef HAL_Handle HAL_InterruptHandle;
|
||||
|
||||
typedef HAL_Handle HAL_NotifierHandle;
|
||||
|
||||
typedef HAL_Handle HAL_RelayHandle;
|
||||
|
||||
typedef HAL_Handle HAL_SolenoidHandle;
|
||||
|
||||
typedef int32_t HAL_Bool;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -12,8 +12,11 @@
|
||||
#include <condition_variable>
|
||||
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
#include "support/deprecated.h"
|
||||
|
||||
class Semaphore {
|
||||
class WPI_DEPRECATED(
|
||||
"Semaphore scheduled for removal in 2018. Recommended to replace with a "
|
||||
"std::mutex and std::condition_variable") Semaphore {
|
||||
public:
|
||||
explicit Semaphore(int32_t count = 0);
|
||||
Semaphore(Semaphore&&);
|
||||
|
||||
51
hal/include/HAL/cpp/SerialHelper.h
Normal file
51
hal/include/HAL/cpp/SerialHelper.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/SerialPort.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
#include "llvm/SmallString.h"
|
||||
#include "llvm/SmallVector.h"
|
||||
|
||||
namespace hal {
|
||||
class SerialHelper {
|
||||
public:
|
||||
SerialHelper();
|
||||
|
||||
std::string GetVISASerialPortName(HAL_SerialPort port, int32_t* status);
|
||||
std::string GetOSSerialPortName(HAL_SerialPort port, int32_t* status);
|
||||
|
||||
std::vector<std::string> GetVISASerialPortList(int32_t* status);
|
||||
std::vector<std::string> GetOSSerialPortList(int32_t* status);
|
||||
|
||||
private:
|
||||
void SortHubPathVector();
|
||||
void CoiteratedSort(llvm::SmallVectorImpl<llvm::SmallString<16>>& vec);
|
||||
void QueryHubPaths(int32_t* status);
|
||||
|
||||
int32_t GetIndexForPort(HAL_SerialPort port, int32_t* status);
|
||||
|
||||
// Vectors to hold data before sorting.
|
||||
// Note we will most likely have at max 2 instances, and the longest string
|
||||
// is around 12, so these should never touch the heap;
|
||||
llvm::SmallVector<llvm::SmallString<16>, 4> m_visaResource;
|
||||
llvm::SmallVector<llvm::SmallString<16>, 4> m_osResource;
|
||||
llvm::SmallVector<llvm::SmallString<16>, 4> m_unsortedHubPath;
|
||||
llvm::SmallVector<llvm::SmallString<16>, 4> m_sortedHubPath;
|
||||
|
||||
int32_t m_resourceHandle;
|
||||
|
||||
static priority_mutex m_nameMutex;
|
||||
static std::string m_usbNames[2];
|
||||
};
|
||||
} // namespace hal
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -10,7 +10,7 @@
|
||||
// Allows usage with std::lock_guard without including <mutex> separately
|
||||
#include <mutex>
|
||||
|
||||
#ifdef FRC_SIMULATOR
|
||||
#if defined(FRC_SIMULATOR) || defined(_WIN32)
|
||||
// We do not want to use pthreads if in the simulator; however, in the
|
||||
// simulator, we do not care about priority inversion.
|
||||
typedef std::mutex priority_mutex;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/Errors.h"
|
||||
#include "HAL/Types.h"
|
||||
@@ -37,25 +37,19 @@ class DigitalHandleResource {
|
||||
friend class DigitalHandleResourceTest;
|
||||
|
||||
public:
|
||||
DigitalHandleResource() = default;
|
||||
DigitalHandleResource(const DigitalHandleResource&) = delete;
|
||||
DigitalHandleResource operator=(const DigitalHandleResource&) = delete;
|
||||
DigitalHandleResource();
|
||||
DigitalHandleResource& operator=(const DigitalHandleResource&) = delete;
|
||||
|
||||
THandle Allocate(int16_t index, HAL_HandleEnum enumValue, int32_t* status);
|
||||
std::shared_ptr<TStruct> Get(THandle handle, HAL_HandleEnum enumValue);
|
||||
void Free(THandle handle, HAL_HandleEnum enumValue);
|
||||
|
||||
private:
|
||||
// Dynamic array to shrink HAL file size.
|
||||
std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
|
||||
std::unique_ptr<priority_mutex[]> m_handleMutexes;
|
||||
std::array<std::shared_ptr<TStruct>, size> m_structures;
|
||||
std::array<priority_mutex, size> m_handleMutexes;
|
||||
};
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size>
|
||||
DigitalHandleResource<THandle, TStruct, size>::DigitalHandleResource() {
|
||||
m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
|
||||
m_handleMutexes = std::make_unique<priority_mutex[]>(size);
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size>
|
||||
THandle DigitalHandleResource<THandle, TStruct, size>::Allocate(
|
||||
int16_t index, HAL_HandleEnum enumValue, int32_t* status) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -42,7 +42,8 @@ enum class HAL_HandleEnum {
|
||||
Encoder = 13,
|
||||
Compressor = 14,
|
||||
Solenoid = 15,
|
||||
AnalogGyro = 16
|
||||
AnalogGyro = 16,
|
||||
Vendor = 17
|
||||
};
|
||||
|
||||
static inline int16_t getHandleIndex(HAL_Handle handle) {
|
||||
@@ -83,7 +84,15 @@ static inline int16_t getPortHandleModule(HAL_PortHandle handle) {
|
||||
return static_cast<uint8_t>((handle >> 8) & 0xff);
|
||||
}
|
||||
|
||||
// using a 16 bit value so we can store 0-255 and still report error
|
||||
static inline int16_t getPortHandleSPIEnable(HAL_PortHandle handle) {
|
||||
if (!isHandleType(handle, HAL_HandleEnum::Port)) return InvalidHandleIndex;
|
||||
return static_cast<uint8_t>((handle >> 16) & 0xff);
|
||||
}
|
||||
|
||||
HAL_PortHandle createPortHandle(uint8_t channel, uint8_t module);
|
||||
|
||||
HAL_PortHandle createPortHandleForSPI(uint8_t channel);
|
||||
|
||||
HAL_Handle createHandle(int16_t index, HAL_HandleEnum handleType);
|
||||
} // namespace hal
|
||||
|
||||
112
hal/include/HAL/handles/IndexedClassedHandleResource.h
Normal file
112
hal/include/HAL/handles/IndexedClassedHandleResource.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/Errors.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "HAL/cpp/make_unique.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
#include "HAL/handles/HandlesInternal.h"
|
||||
|
||||
namespace hal {
|
||||
|
||||
/**
|
||||
* The IndexedClassedHandleResource class is a way to track handles. This
|
||||
* version
|
||||
* allows a limited number of handles that are allocated by index.
|
||||
* Because they are allocated by index, each individual index holds its own
|
||||
* mutex, which reduces contention heavily.]
|
||||
*
|
||||
* @tparam THandle The Handle Type (Must be typedefed from HAL_Handle)
|
||||
* @tparam TStruct The struct type held by this resource
|
||||
* @tparam size The number of resources allowed to be allocated
|
||||
* @tparam enumValue The type value stored in the handle
|
||||
*
|
||||
*/
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
class IndexedClassedHandleResource {
|
||||
friend class IndexedClassedHandleResourceTest;
|
||||
|
||||
public:
|
||||
IndexedClassedHandleResource();
|
||||
IndexedClassedHandleResource(const IndexedClassedHandleResource&) = delete;
|
||||
IndexedClassedHandleResource& operator=(const IndexedClassedHandleResource&) =
|
||||
delete;
|
||||
|
||||
THandle Allocate(int16_t index, std::shared_ptr<TStruct> toSet,
|
||||
int32_t* status);
|
||||
std::shared_ptr<TStruct> Get(THandle handle);
|
||||
void Free(THandle handle);
|
||||
|
||||
private:
|
||||
// Dynamic array to shrink HAL file size.
|
||||
std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
|
||||
std::unique_ptr<priority_mutex[]> m_handleMutexes;
|
||||
};
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
IndexedClassedHandleResource<THandle, TStruct, size,
|
||||
enumValue>::IndexedClassedHandleResource() {
|
||||
m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
|
||||
m_handleMutexes = std::make_unique<priority_mutex[]>(size);
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
THandle
|
||||
IndexedClassedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
|
||||
int16_t index, std::shared_ptr<TStruct> toSet, int32_t* status) {
|
||||
// don't aquire the lock if we can fail early.
|
||||
if (index < 0 || index >= size) {
|
||||
*status = RESOURCE_OUT_OF_RANGE;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
|
||||
// check for allocation, otherwise allocate and return a valid handle
|
||||
if (m_structures[index] != nullptr) {
|
||||
*status = RESOURCE_IS_ALLOCATED;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
m_structures[index] = toSet;
|
||||
return static_cast<THandle>(hal::createHandle(index, enumValue));
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
std::shared_ptr<TStruct> IndexedClassedHandleResource<
|
||||
THandle, TStruct, size, enumValue>::Get(THandle handle) {
|
||||
// get handle index, and fail early if index out of range or wrong handle
|
||||
int16_t index = getHandleTypedIndex(handle, enumValue);
|
||||
if (index < 0 || index >= size) {
|
||||
return nullptr;
|
||||
}
|
||||
std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
|
||||
// return structure. Null will propogate correctly, so no need to manually
|
||||
// check.
|
||||
return m_structures[index];
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
void IndexedClassedHandleResource<THandle, TStruct, size, enumValue>::Free(
|
||||
THandle handle) {
|
||||
// get handle index, and fail early if index out of range or wrong handle
|
||||
int16_t index = getHandleTypedIndex(handle, enumValue);
|
||||
if (index < 0 || index >= size) return;
|
||||
// lock and deallocated handle
|
||||
std::lock_guard<priority_mutex> sync(m_handleMutexes[index]);
|
||||
m_structures[index].reset();
|
||||
}
|
||||
} // namespace hal
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/Errors.h"
|
||||
#include "HAL/Types.h"
|
||||
@@ -38,27 +38,19 @@ class IndexedHandleResource {
|
||||
friend class IndexedHandleResourceTest;
|
||||
|
||||
public:
|
||||
IndexedHandleResource() = default;
|
||||
IndexedHandleResource(const IndexedHandleResource&) = delete;
|
||||
IndexedHandleResource operator=(const IndexedHandleResource&) = delete;
|
||||
IndexedHandleResource();
|
||||
IndexedHandleResource& operator=(const IndexedHandleResource&) = delete;
|
||||
|
||||
THandle Allocate(int16_t index, int32_t* status);
|
||||
std::shared_ptr<TStruct> Get(THandle handle);
|
||||
void Free(THandle handle);
|
||||
|
||||
private:
|
||||
// Dynamic array to shrink HAL file size.
|
||||
std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
|
||||
std::unique_ptr<priority_mutex[]> m_handleMutexes;
|
||||
std::array<std::shared_ptr<TStruct>, size> m_structures;
|
||||
std::array<priority_mutex, size> m_handleMutexes;
|
||||
};
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
IndexedHandleResource<THandle, TStruct, size,
|
||||
enumValue>::IndexedHandleResource() {
|
||||
m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
|
||||
m_handleMutexes = std::make_unique<priority_mutex[]>(size);
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
THandle IndexedHandleResource<THandle, TStruct, size, enumValue>::Allocate(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/Types.h"
|
||||
#include "HAL/cpp/make_unique.h"
|
||||
@@ -36,29 +36,21 @@ class LimitedClassedHandleResource {
|
||||
friend class LimitedClassedHandleResourceTest;
|
||||
|
||||
public:
|
||||
LimitedClassedHandleResource() = default;
|
||||
LimitedClassedHandleResource(const LimitedClassedHandleResource&) = delete;
|
||||
LimitedClassedHandleResource operator=(const LimitedClassedHandleResource&) =
|
||||
LimitedClassedHandleResource& operator=(const LimitedClassedHandleResource&) =
|
||||
delete;
|
||||
LimitedClassedHandleResource();
|
||||
|
||||
THandle Allocate(std::shared_ptr<TStruct> toSet);
|
||||
std::shared_ptr<TStruct> Get(THandle handle);
|
||||
void Free(THandle handle);
|
||||
|
||||
private:
|
||||
// Dynamic array to shrink HAL file size.
|
||||
std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
|
||||
std::unique_ptr<priority_mutex[]> m_handleMutexes;
|
||||
std::array<std::shared_ptr<TStruct>, size> m_structures;
|
||||
std::array<priority_mutex, size> m_handleMutexes;
|
||||
priority_mutex m_allocateMutex;
|
||||
};
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
LimitedClassedHandleResource<THandle, TStruct, size,
|
||||
enumValue>::LimitedClassedHandleResource() {
|
||||
m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
|
||||
m_handleMutexes = std::make_unique<priority_mutex[]>(size);
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
THandle
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -9,8 +9,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "HAL/Types.h"
|
||||
#include "HAL/cpp/make_unique.h"
|
||||
@@ -35,28 +35,20 @@ class LimitedHandleResource {
|
||||
friend class LimitedHandleResourceTest;
|
||||
|
||||
public:
|
||||
LimitedHandleResource() = default;
|
||||
LimitedHandleResource(const LimitedHandleResource&) = delete;
|
||||
LimitedHandleResource operator=(const LimitedHandleResource&) = delete;
|
||||
LimitedHandleResource();
|
||||
LimitedHandleResource& operator=(const LimitedHandleResource&) = delete;
|
||||
|
||||
THandle Allocate();
|
||||
std::shared_ptr<TStruct> Get(THandle handle);
|
||||
void Free(THandle handle);
|
||||
|
||||
private:
|
||||
// Dynamic array to shrink HAL file size.
|
||||
std::unique_ptr<std::shared_ptr<TStruct>[]> m_structures;
|
||||
std::unique_ptr<priority_mutex[]> m_handleMutexes;
|
||||
std::array<std::shared_ptr<TStruct>, size> m_structures;
|
||||
std::array<priority_mutex, size> m_handleMutexes;
|
||||
priority_mutex m_allocateMutex;
|
||||
};
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
LimitedHandleResource<THandle, TStruct, size,
|
||||
enumValue>::LimitedHandleResource() {
|
||||
m_structures = std::make_unique<std::shared_ptr<TStruct>[]>(size);
|
||||
m_handleMutexes = std::make_unique<priority_mutex[]>(size);
|
||||
}
|
||||
|
||||
template <typename THandle, typename TStruct, int16_t size,
|
||||
HAL_HandleEnum enumValue>
|
||||
THandle LimitedHandleResource<THandle, TStruct, size, enumValue>::Allocate() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008-2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -37,9 +37,10 @@ class UnlimitedHandleResource {
|
||||
friend class UnlimitedHandleResourceTest;
|
||||
|
||||
public:
|
||||
UnlimitedHandleResource(const UnlimitedHandleResource&) = delete;
|
||||
UnlimitedHandleResource operator=(const UnlimitedHandleResource&) = delete;
|
||||
UnlimitedHandleResource() = default;
|
||||
UnlimitedHandleResource(const UnlimitedHandleResource&) = delete;
|
||||
UnlimitedHandleResource& operator=(const UnlimitedHandleResource&) = delete;
|
||||
|
||||
THandle Allocate(std::shared_ptr<TStruct> structure);
|
||||
std::shared_ptr<TStruct> Get(THandle handle);
|
||||
void Free(THandle handle);
|
||||
|
||||
@@ -16,6 +16,13 @@ public:
|
||||
*/
|
||||
CTR_Code SetSolenoid(unsigned char idx, bool en);
|
||||
|
||||
/* Set all PCM solenoid states
|
||||
*
|
||||
* @Return - CTR_Code - Error code (if any) for setting solenoids
|
||||
* @Param - state Bitfield to set all solenoids to
|
||||
*/
|
||||
CTR_Code SetAllSolenoids(UINT8 state);
|
||||
|
||||
/* Enables PCM Closed Loop Control of Compressor via pressure switch
|
||||
* @Return - CTR_Code - Error code (if any) for setting solenoid
|
||||
* @Param - en - Enable / Disable Closed Loop Control
|
||||
@@ -192,6 +199,7 @@ public:
|
||||
extern "C" {
|
||||
void * c_PCM_Init(void);
|
||||
CTR_Code c_SetSolenoid(void * handle,unsigned char idx,INT8 param);
|
||||
CTR_Code c_SetAllSolenoids(void * handle,UINT8 state);
|
||||
CTR_Code c_SetClosedLoopControl(void * handle,INT8 param);
|
||||
CTR_Code c_ClearStickyFaults(void * handle,INT8 param);
|
||||
CTR_Code c_GetSolenoid(void * handle,UINT8 idx,INT8 * status);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -13,9 +13,11 @@
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/HAL.h"
|
||||
|
||||
using namespace hal;
|
||||
|
||||
// The 7-bit I2C address with a 0 "send" bit
|
||||
static const uint8_t kSendAddress = (0x1c << 1) | 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -87,13 +87,13 @@ void HAL_SetupAnalogGyro(HAL_GyroHandle handle, int32_t* status) {
|
||||
if (*status != 0) return;
|
||||
HAL_SetAnalogOversampleBits(gyro->handle, kOversampleBits, status);
|
||||
if (*status != 0) return;
|
||||
float sampleRate =
|
||||
double sampleRate =
|
||||
kSamplesPerSecond * (1 << (kAverageBits + kOversampleBits));
|
||||
HAL_SetAnalogSampleRate(sampleRate, status);
|
||||
if (*status != 0) return;
|
||||
Wait(0.1);
|
||||
|
||||
HAL_SetAnalogGyroDeadband(handle, 0.0f, status);
|
||||
HAL_SetAnalogGyroDeadband(handle, 0.0, status);
|
||||
if (*status != 0) return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
using namespace hal;
|
||||
|
||||
static bool analogSampleRateSet = false;
|
||||
|
||||
extern "C" {
|
||||
/**
|
||||
* Initialize the analog input port using the given port object.
|
||||
@@ -101,30 +99,11 @@ HAL_Bool HAL_CheckAnalogInputChannel(int32_t channel) {
|
||||
*/
|
||||
void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status) {
|
||||
// TODO: This will change when variable size scan lists are implemented.
|
||||
// TODO: Need float comparison with epsilon.
|
||||
// TODO: Need double comparison with epsilon.
|
||||
// wpi_assert(!sampleRateSet || GetSampleRate() == samplesPerSecond);
|
||||
analogSampleRateSet = true;
|
||||
|
||||
// Compute the convert rate
|
||||
uint32_t ticksPerSample =
|
||||
static_cast<uint32_t>(static_cast<double>(kTimebase) / samplesPerSecond);
|
||||
uint32_t ticksPerConversion =
|
||||
ticksPerSample / getAnalogNumChannelsToActivate(status);
|
||||
// ticksPerConversion must be at least 80
|
||||
if (ticksPerConversion < 80) {
|
||||
if ((*status) >= 0) *status = SAMPLE_RATE_TOO_HIGH;
|
||||
ticksPerConversion = 80;
|
||||
}
|
||||
|
||||
// Atomically set the scan size and the convert rate so that the sample rate
|
||||
// is constant
|
||||
tAI::tConfig config;
|
||||
config.ScanSize = getAnalogNumChannelsToActivate(status);
|
||||
config.ConvertRate = ticksPerConversion;
|
||||
analogInputSystem->writeConfig(config, status);
|
||||
|
||||
// Indicate that the scan size has been commited to hardware.
|
||||
setAnalogNumChannelsToActivate(0);
|
||||
initializeAnalog(status);
|
||||
if (*status != 0) return;
|
||||
setAnalogSampleRate(samplesPerSecond, status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,6 +115,8 @@ void HAL_SetAnalogSampleRate(double samplesPerSecond, int32_t* status) {
|
||||
* @return Sample rate.
|
||||
*/
|
||||
double HAL_GetAnalogSampleRate(int32_t* status) {
|
||||
initializeAnalog(status);
|
||||
if (*status != 0) return 0;
|
||||
uint32_t ticksPerConversion = analogInputSystem->readLoopTiming(status);
|
||||
uint32_t ticksPerSample =
|
||||
ticksPerConversion * getAnalogNumActiveChannels(status);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,8 +7,10 @@
|
||||
|
||||
#include "AnalogInternal.h"
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include <atomic>
|
||||
|
||||
#include "HAL/AnalogInput.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
#include "PortsInternal.h"
|
||||
|
||||
@@ -23,18 +25,21 @@ IndexedHandleResource<HAL_AnalogInputHandle, hal::AnalogPort, kNumAnalogInputs,
|
||||
|
||||
static int32_t analogNumChannelsToActivate = 0;
|
||||
|
||||
bool analogSystemInitialized = false;
|
||||
static std::atomic<bool> analogSystemInitialized{false};
|
||||
|
||||
bool analogSampleRateSet = false;
|
||||
|
||||
/**
|
||||
* Initialize the analog System.
|
||||
*/
|
||||
void initializeAnalog(int32_t* status) {
|
||||
if (analogSystemInitialized) return;
|
||||
std::lock_guard<priority_recursive_mutex> sync(analogRegisterWindowMutex);
|
||||
if (analogSystemInitialized) return;
|
||||
analogInputSystem.reset(tAI::create(status));
|
||||
analogOutputSystem.reset(tAO::create(status));
|
||||
setAnalogNumChannelsToActivate(kNumAnalogInputs);
|
||||
HAL_SetAnalogSampleRate(kDefaultSampleRate, status);
|
||||
setAnalogSampleRate(kDefaultSampleRate, status);
|
||||
analogSystemInitialized = true;
|
||||
}
|
||||
|
||||
@@ -66,6 +71,41 @@ int32_t getAnalogNumChannelsToActivate(int32_t* status) {
|
||||
return analogNumChannelsToActivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the sample rate.
|
||||
*
|
||||
* This is a global setting for the Athena and effects all channels.
|
||||
*
|
||||
* @param samplesPerSecond The number of samples per channel per second.
|
||||
*/
|
||||
void setAnalogSampleRate(double samplesPerSecond, int32_t* status) {
|
||||
// TODO: This will change when variable size scan lists are implemented.
|
||||
// TODO: Need double comparison with epsilon.
|
||||
// wpi_assert(!sampleRateSet || GetSampleRate() == samplesPerSecond);
|
||||
analogSampleRateSet = true;
|
||||
|
||||
// Compute the convert rate
|
||||
uint32_t ticksPerSample =
|
||||
static_cast<uint32_t>(static_cast<double>(kTimebase) / samplesPerSecond);
|
||||
uint32_t ticksPerConversion =
|
||||
ticksPerSample / getAnalogNumChannelsToActivate(status);
|
||||
// ticksPerConversion must be at least 80
|
||||
if (ticksPerConversion < 80) {
|
||||
if ((*status) >= 0) *status = SAMPLE_RATE_TOO_HIGH;
|
||||
ticksPerConversion = 80;
|
||||
}
|
||||
|
||||
// Atomically set the scan size and the convert rate so that the sample rate
|
||||
// is constant
|
||||
tAI::tConfig config;
|
||||
config.ScanSize = getAnalogNumChannelsToActivate(status);
|
||||
config.ConvertRate = ticksPerConversion;
|
||||
analogInputSystem->writeConfig(config, status);
|
||||
|
||||
// Indicate that the scan size has been commited to hardware.
|
||||
setAnalogNumChannelsToActivate(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of active channels.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/Ports.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
#include "HAL/handles/IndexedHandleResource.h"
|
||||
@@ -27,6 +27,7 @@ static const uint32_t kAccumulatorChannels[] = {0, 1};
|
||||
extern std::unique_ptr<tAI> analogInputSystem;
|
||||
extern std::unique_ptr<tAO> analogOutputSystem;
|
||||
extern priority_recursive_mutex analogRegisterWindowMutex;
|
||||
extern bool analogSampleRateSet;
|
||||
|
||||
struct AnalogPort {
|
||||
uint8_t channel;
|
||||
@@ -40,7 +41,6 @@ extern IndexedHandleResource<HAL_AnalogInputHandle, hal::AnalogPort,
|
||||
int32_t getAnalogNumActiveChannels(int32_t* status);
|
||||
int32_t getAnalogNumChannelsToActivate(int32_t* status);
|
||||
void setAnalogNumChannelsToActivate(int32_t channels);
|
||||
void setAnalogSampleRate(double samplesPerSecond, int32_t* status);
|
||||
void initializeAnalog(int32_t* status);
|
||||
|
||||
extern bool analogSystemInitialized;
|
||||
} // namespace hal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -35,7 +35,7 @@ HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
|
||||
if (*status != 0) return HAL_kInvalidHandle;
|
||||
|
||||
int16_t channel = getPortHandleChannel(portHandle);
|
||||
if (channel == InvalidHandleIndex) {
|
||||
if (channel == InvalidHandleIndex || channel >= kNumDigitalChannels) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
return HAL_kInvalidHandle;
|
||||
}
|
||||
@@ -58,7 +58,24 @@ HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
|
||||
|
||||
tDIO::tOutputEnable outputEnable = digitalSystem->readOutputEnable(status);
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
if (!getPortHandleSPIEnable(portHandle)) {
|
||||
// if this flag is not set, we actually want DIO.
|
||||
uint32_t bitToSet = 1u << remapSPIChannel(port->channel);
|
||||
|
||||
uint16_t specialFunctions = spiSystem->readEnableDIO(status);
|
||||
// Set the field to enable SPI DIO
|
||||
spiSystem->writeEnableDIO(specialFunctions | bitToSet, status);
|
||||
|
||||
if (input) {
|
||||
outputEnable.SPIPort =
|
||||
outputEnable.SPIPort & (~bitToSet); // clear the field for read
|
||||
} else {
|
||||
outputEnable.SPIPort =
|
||||
outputEnable.SPIPort | bitToSet; // set the bits for write
|
||||
}
|
||||
}
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
uint32_t bitToSet = 1u << port->channel;
|
||||
if (input) {
|
||||
outputEnable.Headers =
|
||||
@@ -93,8 +110,26 @@ HAL_Bool HAL_CheckDIOChannel(int32_t channel) {
|
||||
}
|
||||
|
||||
void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle) {
|
||||
auto port = digitalChannelHandles.Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
// no status, so no need to check for a proper free.
|
||||
digitalChannelHandles.Free(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) return;
|
||||
int32_t status = 0;
|
||||
std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
// Unset the SPI flag
|
||||
int32_t bitToUnset = 1 << remapSPIChannel(port->channel);
|
||||
uint16_t specialFunctions = spiSystem->readEnableDIO(&status);
|
||||
spiSystem->writeEnableDIO(specialFunctions & ~bitToUnset, &status);
|
||||
} else if (port->channel >= kNumDigitalHeaders) {
|
||||
// Unset the MXP flag
|
||||
uint32_t bitToUnset = 1u << remapMXPChannel(port->channel);
|
||||
|
||||
uint16_t specialFunctions =
|
||||
digitalSystem->readEnableMXPSpecialFunction(&status);
|
||||
digitalSystem->writeEnableMXPSpecialFunction(specialFunctions | bitToUnset,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -142,6 +177,8 @@ void HAL_SetDigitalPWMRate(double rate, int32_t* status) {
|
||||
// Currently rounding in the log rate domain... heavy weight toward picking a
|
||||
// higher freq.
|
||||
// TODO: Round in the linear rate domain.
|
||||
initializeDigital(status);
|
||||
if (*status != 0) return;
|
||||
uint8_t pwmPeriodPower = static_cast<uint8_t>(
|
||||
std::log(1.0 / (pwmSystem->readLoopTiming(status) * 0.25E-6 * rate)) /
|
||||
std::log(2.0) +
|
||||
@@ -198,7 +235,9 @@ void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
|
||||
return;
|
||||
}
|
||||
int32_t id = *port;
|
||||
if (channel >= kNumDigitalHeaders) { // If it is on the MXP
|
||||
if (channel >= kNumDigitalHeaders &&
|
||||
channel <
|
||||
kNumDigitalHeaders + kNumDigitalMXPChannels) { // If it is on the MXP
|
||||
/* Then to write as a digital PWM channel an offset is needed to write on
|
||||
* the correct channel
|
||||
*/
|
||||
@@ -229,7 +268,15 @@ void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
|
||||
std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
|
||||
tDIO::tDO currentDIO = digitalSystem->readDO(status);
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
if (value == 0) {
|
||||
currentDIO.SPIPort =
|
||||
currentDIO.SPIPort & ~(1u << remapSPIChannel(port->channel));
|
||||
} else if (value == 1) {
|
||||
currentDIO.SPIPort =
|
||||
currentDIO.SPIPort | (1u << remapSPIChannel(port->channel));
|
||||
}
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
if (value == 0) {
|
||||
currentDIO.Headers = currentDIO.Headers & ~(1u << port->channel);
|
||||
} else if (value == 1) {
|
||||
@@ -243,12 +290,6 @@ void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
|
||||
currentDIO.MXP =
|
||||
currentDIO.MXP | (1u << remapMXPChannel(port->channel));
|
||||
}
|
||||
|
||||
int32_t bitToSet = 1 << remapMXPChannel(port->channel);
|
||||
uint16_t specialFunctions =
|
||||
digitalSystem->readEnableMXPSpecialFunction(status);
|
||||
digitalSystem->writeEnableMXPSpecialFunction(specialFunctions & ~bitToSet,
|
||||
status);
|
||||
}
|
||||
digitalSystem->writeDO(currentDIO, status);
|
||||
}
|
||||
@@ -273,16 +314,11 @@ HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
// if it == 0, then return false
|
||||
// else return true
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
return ((currentDIO.SPIPort >> remapSPIChannel(port->channel)) & 1) != 0;
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
return ((currentDIO.Headers >> port->channel) & 1) != 0;
|
||||
} else {
|
||||
// Disable special functions
|
||||
int32_t bitToSet = 1 << remapMXPChannel(port->channel);
|
||||
uint16_t specialFunctions =
|
||||
digitalSystem->readEnableMXPSpecialFunction(status);
|
||||
digitalSystem->writeEnableMXPSpecialFunction(specialFunctions & ~bitToSet,
|
||||
status);
|
||||
|
||||
return ((currentDIO.MXP >> remapMXPChannel(port->channel)) & 1) != 0;
|
||||
}
|
||||
}
|
||||
@@ -307,7 +343,10 @@ HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
// if it == 0, then return false
|
||||
// else return true
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
return ((currentOutputEnable.SPIPort >> remapSPIChannel(port->channel)) &
|
||||
1) != 0;
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
return ((currentOutputEnable.Headers >> port->channel) & 1) != 0;
|
||||
} else {
|
||||
return ((currentOutputEnable.MXP >> remapMXPChannel(port->channel)) & 1) !=
|
||||
@@ -332,7 +371,9 @@ void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
|
||||
}
|
||||
tDIO::tPulse pulse;
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
pulse.SPIPort = 1u << remapSPIChannel(port->channel);
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
pulse.Headers = 1u << port->channel;
|
||||
} else {
|
||||
pulse.MXP = 1u << remapMXPChannel(port->channel);
|
||||
@@ -358,7 +399,9 @@ HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
}
|
||||
tDIO::tPulse pulseRegister = digitalSystem->readPulse(status);
|
||||
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
return (pulseRegister.SPIPort & (1 << remapSPIChannel(port->channel))) != 0;
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
return (pulseRegister.Headers & (1 << port->channel)) != 0;
|
||||
} else {
|
||||
return (pulseRegister.MXP & (1 << remapMXPChannel(port->channel))) != 0;
|
||||
@@ -371,8 +414,11 @@ HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
* @return A pulse on some line is in progress
|
||||
*/
|
||||
HAL_Bool HAL_IsAnyPulsing(int32_t* status) {
|
||||
initializeDigital(status);
|
||||
if (*status != 0) return false;
|
||||
tDIO::tPulse pulseRegister = digitalSystem->readPulse(status);
|
||||
return pulseRegister.Headers != 0 && pulseRegister.MXP != 0;
|
||||
return pulseRegister.Headers != 0 && pulseRegister.MXP != 0 &&
|
||||
pulseRegister.SPIPort != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -392,7 +438,11 @@ void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
|
||||
}
|
||||
|
||||
std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
// Channels 10-15 are SPI channels, so subtract our MXP channels
|
||||
digitalSystem->writeFilterSelectHdr(port->channel - kNumDigitalMXPChannels,
|
||||
filterIndex, status);
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
digitalSystem->writeFilterSelectHdr(port->channel, filterIndex, status);
|
||||
} else {
|
||||
digitalSystem->writeFilterSelectMXP(remapMXPChannel(port->channel),
|
||||
@@ -416,7 +466,11 @@ int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
}
|
||||
|
||||
std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
|
||||
if (port->channel < kNumDigitalHeaders) {
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
// Channels 10-15 are SPI channels, so subtract our MXP channels
|
||||
return digitalSystem->readFilterSelectHdr(
|
||||
port->channel - kNumDigitalMXPChannels, status);
|
||||
} else if (port->channel < kNumDigitalHeaders) {
|
||||
return digitalSystem->readFilterSelectHdr(port->channel, status);
|
||||
} else {
|
||||
return digitalSystem->readFilterSelectMXP(remapMXPChannel(port->channel),
|
||||
@@ -436,6 +490,8 @@ int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
* counted as a transition.
|
||||
*/
|
||||
void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status) {
|
||||
initializeDigital(status);
|
||||
if (*status != 0) return;
|
||||
std::lock_guard<priority_recursive_mutex> sync(digitalDIOMutex);
|
||||
digitalSystem->writeFilterPeriodHdr(filterIndex, value, status);
|
||||
if (*status == 0) {
|
||||
@@ -456,6 +512,8 @@ void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status) {
|
||||
* counted as a transition.
|
||||
*/
|
||||
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status) {
|
||||
initializeDigital(status);
|
||||
if (*status != 0) return 0;
|
||||
uint32_t hdrPeriod = 0;
|
||||
uint32_t mxpPeriod = 0;
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,13 +7,14 @@
|
||||
|
||||
#include "DigitalInternal.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include "ConstantsInternal.h"
|
||||
#include "FRC_NetworkCommunication/LoadOut.h"
|
||||
#include "HAL/AnalogTrigger.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/HAL.h"
|
||||
#include "HAL/Ports.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
@@ -26,8 +27,10 @@ priority_recursive_mutex digitalPwmMutex;
|
||||
std::unique_ptr<tDIO> digitalSystem;
|
||||
std::unique_ptr<tRelay> relaySystem;
|
||||
std::unique_ptr<tPWM> pwmSystem;
|
||||
std::unique_ptr<tSPI> spiSystem;
|
||||
|
||||
bool digitalSystemsInitialized = false;
|
||||
static std::atomic<bool> digitalSystemsInitialized{false};
|
||||
static priority_mutex initializeMutex;
|
||||
|
||||
DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
|
||||
kNumDigitalChannels + kNumPWMHeaders>
|
||||
@@ -37,6 +40,11 @@ DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
|
||||
* Initialize the digital system.
|
||||
*/
|
||||
void initializeDigital(int32_t* status) {
|
||||
// Initial check, as if it's true initialization has finished
|
||||
if (digitalSystemsInitialized) return;
|
||||
|
||||
std::lock_guard<priority_mutex> lock(initializeMutex);
|
||||
// Second check in case another thread was waiting
|
||||
if (digitalSystemsInitialized) return;
|
||||
|
||||
digitalSystem.reset(tDIO::create(status));
|
||||
@@ -87,9 +95,18 @@ void initializeDigital(int32_t* status) {
|
||||
}
|
||||
}
|
||||
|
||||
// SPI setup
|
||||
spiSystem.reset(tSPI::create(status));
|
||||
|
||||
digitalSystemsInitialized = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Map SPI channel numbers from their physical number (27 to 31) to their
|
||||
* position in the bit field.
|
||||
*/
|
||||
int32_t remapSPIChannel(int32_t channel) { return channel - 26; }
|
||||
|
||||
/**
|
||||
* Map DIO channel numbers from their physical number (10 to 26) to their
|
||||
* position in the bit field.
|
||||
@@ -123,7 +140,11 @@ bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
return true;
|
||||
} else if (isHandleType(digitalSourceHandle, HAL_HandleEnum::DIO)) {
|
||||
int32_t index = getHandleIndex(digitalSourceHandle);
|
||||
if (index >= kNumDigitalHeaders) {
|
||||
if (index > kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
// channels 10-15, so need to add headers to remap index
|
||||
channel = remapSPIChannel(index) + kNumDigitalHeaders;
|
||||
module = 0;
|
||||
} else if (index >= kNumDigitalHeaders) {
|
||||
channel = remapMXPChannel(index);
|
||||
module = 1;
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include "HAL/AnalogTrigger.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/Ports.h"
|
||||
#include "HAL/Types.h"
|
||||
#include "HAL/handles/DigitalHandleResource.h"
|
||||
@@ -45,11 +45,11 @@ constexpr int32_t kExpectedLoopTiming = 40;
|
||||
* scaling is implemented as an output squelch to get longer periods for old
|
||||
* devices.
|
||||
*/
|
||||
constexpr float kDefaultPwmPeriod = 5.05;
|
||||
constexpr double kDefaultPwmPeriod = 5.05;
|
||||
/**
|
||||
* kDefaultPwmCenter is the PWM range center in ms
|
||||
*/
|
||||
constexpr float kDefaultPwmCenter = 1.5;
|
||||
constexpr double kDefaultPwmCenter = 1.5;
|
||||
/**
|
||||
* kDefaultPWMStepsDown is the number of PWM steps below the centerpoint
|
||||
*/
|
||||
@@ -62,8 +62,7 @@ extern priority_recursive_mutex digitalPwmMutex;
|
||||
extern std::unique_ptr<tDIO> digitalSystem;
|
||||
extern std::unique_ptr<tRelay> relaySystem;
|
||||
extern std::unique_ptr<tPWM> pwmSystem;
|
||||
|
||||
extern bool digitalSystemsInitialized;
|
||||
extern std::unique_ptr<tSPI> spiSystem;
|
||||
|
||||
struct DigitalPort {
|
||||
uint8_t channel;
|
||||
@@ -84,6 +83,7 @@ void initializeDigital(int32_t* status);
|
||||
bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
uint8_t& channel, uint8_t& module, bool& analogTrigger);
|
||||
int32_t remapSPIChannel(int32_t channel);
|
||||
int32_t remapMXPPWMChannel(int32_t channel);
|
||||
int32_t remapMXPChannel(int32_t channel);
|
||||
} // namespace hal
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
#include "HAL/Encoder.h"
|
||||
|
||||
#include "ChipObject.h"
|
||||
#include "EncoderInternal.h"
|
||||
#include "FPGAEncoder.h"
|
||||
#include "HAL/ChipObject.h"
|
||||
#include "HAL/Counter.h"
|
||||
#include "HAL/Errors.h"
|
||||
#include "HAL/handles/LimitedClassedHandleResource.h"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2016. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
||||
#include "FRC_NetworkCommunication/FRCComm.h"
|
||||
#include "HAL/HAL.h"
|
||||
#include "HAL/DriverStation.h"
|
||||
#include "HAL/cpp/priority_condition_variable.h"
|
||||
#include "HAL/cpp/priority_mutex.h"
|
||||
|
||||
@@ -41,16 +42,24 @@ int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
|
||||
static constexpr int KEEP_MSGS = 5;
|
||||
std::lock_guard<priority_mutex> lock(msgMutex);
|
||||
static std::string prevMsg[KEEP_MSGS];
|
||||
static uint64_t prevMsgTime[KEEP_MSGS] = {0, 0, 0};
|
||||
static std::chrono::time_point<std::chrono::steady_clock>
|
||||
prevMsgTime[KEEP_MSGS];
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
for (int i = 0; i < KEEP_MSGS; i++) {
|
||||
prevMsgTime[i] =
|
||||
std::chrono::steady_clock::now() - std::chrono::seconds(2);
|
||||
}
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
auto curTime = std::chrono::steady_clock::now();
|
||||
int i;
|
||||
for (i = 0; i < KEEP_MSGS; ++i) {
|
||||
if (prevMsg[i] == details) break;
|
||||
}
|
||||
int retval = 0;
|
||||
if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= 1000000) {
|
||||
if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= std::chrono::seconds(1)) {
|
||||
retval = FRC_NetworkCommunication_sendError(isError, errorCode, isLVCode,
|
||||
details, location, callStack);
|
||||
if (printMsg) {
|
||||
@@ -66,7 +75,7 @@ int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
|
||||
if (i == KEEP_MSGS) {
|
||||
// replace the oldest one
|
||||
i = 0;
|
||||
uint64_t first = prevMsgTime[0];
|
||||
auto first = prevMsgTime[0];
|
||||
for (int j = 1; j < KEEP_MSGS; ++j) {
|
||||
if (prevMsgTime[j] < first) {
|
||||
first = prevMsgTime[j];
|
||||
@@ -100,16 +109,16 @@ int32_t HAL_GetJoystickAxes(int32_t joystickNum, HAL_JoystickAxes* axes) {
|
||||
joystickNum, reinterpret_cast<JoystickAxes_t*>(&axesInt),
|
||||
HAL_kMaxJoystickAxes);
|
||||
|
||||
// copy integer values to float values
|
||||
// copy integer values to double values
|
||||
axes->count = axesInt.count;
|
||||
// current scaling is -128 to 127, can easily be patched in the future by
|
||||
// changing this function.
|
||||
for (int32_t i = 0; i < axesInt.count; i++) {
|
||||
int8_t value = axesInt.axes[i];
|
||||
if (value < 0) {
|
||||
axes->axes[i] = value / 128.0f;
|
||||
axes->axes[i] = value / 128.0;
|
||||
} else {
|
||||
axes->axes[i] = value / 127.0f;
|
||||
axes->axes[i] = value / 127.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __FRC_FPGA_ChipObject_Aliases_h__
|
||||
#define __FRC_FPGA_ChipObject_Aliases_h__
|
||||
|
||||
#define nRuntimeFPGANamespace nFRC_2012_1_6_4
|
||||
#define nInvariantFPGANamespace nFRC_C0EF_1_1_0
|
||||
|
||||
#endif // __FRC_FPGA_ChipObject_Aliases_h__
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
|
||||
#define __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_C0EF_1_1_0
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_C0EF_1_1_0_nInterfaceGlobals_h__
|
||||
@@ -1,73 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,69 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,79 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2016_16_1_0_nInterfaceGlobals_h__
|
||||
#define __nFRC_2016_16_1_0_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2016_16_1_0
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2016_16_1_0_nInterfaceGlobals_h__
|
||||
@@ -1,87 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2016_16_1_0_Accumulator_h__
|
||||
#define __nFRC_2016_16_1_0_Accumulator_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2016_16_1_0
|
||||
{
|
||||
|
||||
class tAccumulator
|
||||
{
|
||||
public:
|
||||
tAccumulator(){}
|
||||
virtual ~tAccumulator(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 2,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
signed long long Value;
|
||||
unsigned Count : 32;
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
unsigned value2 : 32;
|
||||
unsigned value3 : 32;
|
||||
};
|
||||
} tOutput;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual tOutput readOutput(tRioStatusCode *status) = 0;
|
||||
virtual signed long long readOutput_Value(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tCenter_IfaceConstants;
|
||||
|
||||
virtual void writeCenter(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readCenter(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDeadband_IfaceConstants;
|
||||
|
||||
virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readDeadband(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReset_IfaceConstants;
|
||||
|
||||
virtual void strobeReset(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAccumulator(const tAccumulator&);
|
||||
void operator=(const tAccumulator&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2016_16_1_0_Accumulator_h__
|
||||
@@ -1,57 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2016_16_1_0_Alarm_h__
|
||||
#define __nFRC_2016_16_1_0_Alarm_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2016_16_1_0
|
||||
{
|
||||
|
||||
class tAlarm
|
||||
{
|
||||
public:
|
||||
tAlarm(){}
|
||||
virtual ~tAlarm(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAlarm* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tEnable_IfaceConstants;
|
||||
|
||||
virtual void writeEnable(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readEnable(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTriggerTime_IfaceConstants;
|
||||
|
||||
virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAlarm(const tAlarm&);
|
||||
void operator=(const tAlarm&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2016_16_1_0_Alarm_h__
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_nInterfaceGlobals_h__
|
||||
#define __nFRC_2012_1_6_4_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_nInterfaceGlobals_h__
|
||||
@@ -1,149 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,133 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,219 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,330 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,188 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,199 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,70 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,93 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,228 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,50 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Solenoid_h__
|
||||
#define __nFRC_2012_1_6_4_Solenoid_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tSolenoid
|
||||
{
|
||||
public:
|
||||
tSolenoid(){}
|
||||
virtual ~tSolenoid(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tSolenoid* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumDO7_0Elements = 2,
|
||||
} tDO7_0_IfaceConstants;
|
||||
|
||||
virtual void writeDO7_0(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO7_0(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tSolenoid(const tSolenoid&);
|
||||
void operator=(const tSolenoid&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Solenoid_h__
|
||||
@@ -1,71 +0,0 @@
|
||||
// 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__
|
||||
@@ -1,108 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Watchdog_h__
|
||||
#define __nFRC_2012_1_6_4_Watchdog_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tWatchdog
|
||||
{
|
||||
public:
|
||||
tWatchdog(){}
|
||||
virtual ~tWatchdog(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tWatchdog* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned SystemActive : 1;
|
||||
unsigned Alive : 1;
|
||||
unsigned SysDisableCount : 15;
|
||||
unsigned DisableCount : 15;
|
||||
#else
|
||||
unsigned DisableCount : 15;
|
||||
unsigned SysDisableCount : 15;
|
||||
unsigned Alive : 1;
|
||||
unsigned SystemActive : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tStatus;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tStatus_IfaceConstants;
|
||||
|
||||
virtual tStatus readStatus(tRioStatusCode *status) = 0;
|
||||
virtual bool readStatus_SystemActive(tRioStatusCode *status) = 0;
|
||||
virtual bool readStatus_Alive(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readStatus_SysDisableCount(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readStatus_DisableCount(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tKill_IfaceConstants;
|
||||
|
||||
virtual void strobeKill(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tFeed_IfaceConstants;
|
||||
|
||||
virtual void strobeFeed(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimer_IfaceConstants;
|
||||
|
||||
virtual unsigned int readTimer(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tExpiration_IfaceConstants;
|
||||
|
||||
virtual void writeExpiration(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readExpiration(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tImmortal_IfaceConstants;
|
||||
|
||||
virtual void writeImmortal(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readImmortal(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tWatchdog(const tWatchdog&);
|
||||
void operator=(const tWatchdog&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Watchdog_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user