mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Added support for CAN Talon SRX in C++ and Java.
Currently, the JNI bindings are generated by Swig and, unfortunately, the interface available through Java is lower-level than that for C++ (ie, direct access to the ctre code through the JNI bindings, rather than an interface on top of that), but it does work. See eclipse plugins for some short samples. There are a couple of short unit tests as placeholders. Still needs some cleaning up. Change-Id: Iae2f74693ca6b80bf7d5aca0625c66aa6e0b7f85 Added quick samples for C++/Java CAN Talon stuff. Change-Id: I3acb27d6fd5568d88931e0d678c09973d436735d
This commit is contained in:
1277
wpilibj/wpilibJavaJNI/lib/CanTalonSRXJNI.cpp
Normal file
1277
wpilibj/wpilibJavaJNI/lib/CanTalonSRXJNI.cpp
Normal file
File diff suppressed because it is too large
Load Diff
7
wpilibj/wpilibJavaJNI/swigTalon/CanTalonSRX.i
Normal file
7
wpilibj/wpilibJavaJNI/swigTalon/CanTalonSRX.i
Normal file
@@ -0,0 +1,7 @@
|
||||
%module CanTalon
|
||||
%{
|
||||
#include "ctre/CanTalonSRX.h"
|
||||
%}
|
||||
|
||||
%include "CtreCanNode.h"
|
||||
%include "CanTalonSRX.h"
|
||||
5
wpilibj/wpilibJavaJNI/swigTalon/README
Normal file
5
wpilibj/wpilibJavaJNI/swigTalon/README
Normal file
@@ -0,0 +1,5 @@
|
||||
The generateJNI.sh script explains how to use it to generate the JNI bindings
|
||||
for the CAN Talon stuff using swig. This whole directory is a temporary measure
|
||||
until I (James Kuszmaul--11/18/2014) or someone else figures out how to
|
||||
integrate the swig stuff into the build system. For now, all the generated JNI
|
||||
bindings are checked into git, so that it should work until someone goes and updates ctre/CanTalonSRX.*
|
||||
17
wpilibj/wpilibJavaJNI/swigTalon/generateJNI.sh
Executable file
17
wpilibj/wpilibJavaJNI/swigTalon/generateJNI.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
#This script should be able to generate the JNI
|
||||
# bindings for the CANTalon using swig.At some point,
|
||||
# it should be integrated into the build system,
|
||||
# but I[james 18 November 2014] don't know how to do that.
|
||||
# Assumes running from allwpilib/wpilibj/wpilibJavaJNI/swigTalon
|
||||
# Get files that we node to generate from.
|
||||
cp ../../../hal/lib/Athena/ctre/CanTalonSRX.cpp ./
|
||||
cp ../../../wpilibc/wpilibC++Devices/include/ctre/* ./
|
||||
# Clean up from previous run.
|
||||
rm *.java
|
||||
# Run SWIG.
|
||||
swig -c++ -package edu.wpi.first.wpilibj.hal -java CanTalonSRX.i
|
||||
# Stick generated files into appropriate places.
|
||||
cp CanTalonSRX_wrap.cxx ../lib/CanTalonSRXJNI.cpp
|
||||
mv CanTalonJNI.java ../../wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/hal/
|
||||
cp *.java ../../wpilibJavaDevices/src/main/java/edu/wpi/first/wpilibj/
|
||||
Reference in New Issue
Block a user