mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Initial checkin of unified hierarchy of WPILib 2015
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
|
||||
#ifndef __AICalibration_h__
|
||||
#define __AICalibration_h__
|
||||
|
||||
#include "HAL/HAL.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
uint32_t FRC_NetworkCommunication_nAICalibration_getLSBWeight(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
|
||||
int32_t FRC_NetworkCommunication_nAICalibration_getOffset(const uint32_t aiSystemIndex, const uint32_t channel, int32_t *status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __AICalibration_h__
|
||||
193
wpilibc/src/main/include/NetworkCommunication/FRCComm.h
Normal file
193
wpilibc/src/main/include/NetworkCommunication/FRCComm.h
Normal file
@@ -0,0 +1,193 @@
|
||||
/*************************************************************
|
||||
* NOTICE
|
||||
*
|
||||
* These are the only externally exposed functions to the
|
||||
* NetworkCommunication library
|
||||
*
|
||||
* This is an implementation of FRC Spec for Comm Protocol
|
||||
* Revision 4.5, June 30, 2008
|
||||
*
|
||||
* Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
#ifndef __FRC_COMM_H__
|
||||
#define __FRC_COMM_H__
|
||||
|
||||
#ifdef SIMULATION
|
||||
#include <vxWorks_compat.h>
|
||||
#define EXPORT_FUNC __declspec(dllexport) __cdecl
|
||||
#else
|
||||
#if defined(__vxworks)
|
||||
#include <vxWorks.h>
|
||||
#define EXPORT_FUNC
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <pthread.h>
|
||||
#define EXPORT_FUNC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Commandeer some bytes at the end for advanced I/O feedback.
|
||||
#define IO_CONFIG_DATA_SIZE 32
|
||||
#define SYS_STATUS_DATA_SIZE 44
|
||||
#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE)
|
||||
#define USER_DS_LCD_DATA_SIZE 128
|
||||
|
||||
struct FRCCommonControlData{
|
||||
uint16_t packetIndex;
|
||||
union {
|
||||
uint8_t control;
|
||||
#ifndef __vxworks
|
||||
struct {
|
||||
uint8_t checkVersions :1;
|
||||
uint8_t test :1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t reset : 1;
|
||||
};
|
||||
#else
|
||||
struct {
|
||||
uint8_t reset : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t test :1;
|
||||
uint8_t checkVersions :1;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
uint8_t dsDigitalIn;
|
||||
uint16_t teamID;
|
||||
|
||||
char dsID_Alliance;
|
||||
char dsID_Position;
|
||||
|
||||
union {
|
||||
int8_t stick0Axes[6];
|
||||
struct {
|
||||
int8_t stick0Axis1;
|
||||
int8_t stick0Axis2;
|
||||
int8_t stick0Axis3;
|
||||
int8_t stick0Axis4;
|
||||
int8_t stick0Axis5;
|
||||
int8_t stick0Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick0Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick1Axes[6];
|
||||
struct {
|
||||
int8_t stick1Axis1;
|
||||
int8_t stick1Axis2;
|
||||
int8_t stick1Axis3;
|
||||
int8_t stick1Axis4;
|
||||
int8_t stick1Axis5;
|
||||
int8_t stick1Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick1Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick2Axes[6];
|
||||
struct {
|
||||
int8_t stick2Axis1;
|
||||
int8_t stick2Axis2;
|
||||
int8_t stick2Axis3;
|
||||
int8_t stick2Axis4;
|
||||
int8_t stick2Axis5;
|
||||
int8_t stick2Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick2Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick3Axes[6];
|
||||
struct {
|
||||
int8_t stick3Axis1;
|
||||
int8_t stick3Axis2;
|
||||
int8_t stick3Axis3;
|
||||
int8_t stick3Axis4;
|
||||
int8_t stick3Axis5;
|
||||
int8_t stick3Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick3Buttons; // Left-most 4 bits are unused
|
||||
|
||||
//Analog inputs are 10 bit right-justified
|
||||
uint16_t analog1;
|
||||
uint16_t analog2;
|
||||
uint16_t analog3;
|
||||
uint16_t analog4;
|
||||
|
||||
uint64_t cRIOChecksum;
|
||||
uint32_t FPGAChecksum0;
|
||||
uint32_t FPGAChecksum1;
|
||||
uint32_t FPGAChecksum2;
|
||||
uint32_t FPGAChecksum3;
|
||||
|
||||
char versionData[8];
|
||||
};
|
||||
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
|
||||
|
||||
extern "C" {
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision);
|
||||
#endif
|
||||
int EXPORT_FUNC getCommonControlData(FRCCommonControlData *data, int wait_ms);
|
||||
int EXPORT_FUNC getRecentCommonControlData(FRCCommonControlData *commonData, int wait_ms);
|
||||
int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms);
|
||||
int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
|
||||
int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
int EXPORT_FUNC setStatusDataFloatAsInt(int battery, uint8_t dsDigitalOut, uint8_t updateNumber,
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
|
||||
int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
|
||||
int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms);
|
||||
|
||||
#ifdef SIMULATION
|
||||
void EXPORT_FUNC setNewDataSem(HANDLE);
|
||||
#else
|
||||
# if defined (__vxworks)
|
||||
void EXPORT_FUNC setNewDataSem(SEM_ID);
|
||||
void EXPORT_FUNC setResyncSem(SEM_ID);
|
||||
# else
|
||||
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
|
||||
void EXPORT_FUNC setResyncSem(pthread_mutex_t *);
|
||||
# endif
|
||||
void EXPORT_FUNC signalResyncActionDone(void);
|
||||
#endif
|
||||
|
||||
// this uint32_t is really a LVRefNum
|
||||
void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC setResyncOccurRef(uint32_t refnum);
|
||||
#endif
|
||||
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTest(void);
|
||||
};
|
||||
|
||||
#endif
|
||||
39
wpilibc/src/main/include/NetworkCommunication/LoadOut.h
Normal file
39
wpilibc/src/main/include/NetworkCommunication/LoadOut.h
Normal file
@@ -0,0 +1,39 @@
|
||||
|
||||
#ifndef __LoadOut_h__
|
||||
#define __LoadOut_h__
|
||||
|
||||
#define kMaxModuleNumber 2
|
||||
namespace nLoadOut
|
||||
{
|
||||
typedef enum {
|
||||
kModuleType_Unknown = 0x00,
|
||||
kModuleType_Analog = 0x01,
|
||||
kModuleType_Digital = 0x02,
|
||||
kModuleType_Solenoid = 0x03,
|
||||
} tModuleType;
|
||||
bool getModulePresence(tModuleType moduleType, uint8_t moduleNumber);
|
||||
typedef enum {
|
||||
kTargetClass_Unknown = 0x00,
|
||||
kTargetClass_FRC1 = 0x10,
|
||||
kTargetClass_FRC2 = 0x20,
|
||||
kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog,
|
||||
kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital,
|
||||
kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid,
|
||||
kTargetClass_FamilyMask = 0xF0,
|
||||
kTargetClass_ModuleMask = 0x0F,
|
||||
} tTargetClass;
|
||||
tTargetClass getTargetClass();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32_t FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber);
|
||||
uint32_t FRC_NetworkCommunication_nLoadOut_getTargetClass();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __LoadOut_h__
|
||||
135
wpilibc/src/main/include/NetworkCommunication/UsageReporting.h
Normal file
135
wpilibc/src/main/include/NetworkCommunication/UsageReporting.h
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
#ifndef __UsageReporting_h__
|
||||
#define __UsageReporting_h__
|
||||
|
||||
#ifdef SIMULATION
|
||||
#include <vxWorks_compat.h>
|
||||
#define EXPORT_FUNC __declspec(dllexport) __cdecl
|
||||
#else
|
||||
#include "HAL/HAL.h"
|
||||
#define EXPORT_FUNC
|
||||
#endif
|
||||
|
||||
#define kUsageReporting_version 1
|
||||
|
||||
namespace nUsageReporting
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
kResourceType_Controller,
|
||||
kResourceType_Module,
|
||||
kResourceType_Language,
|
||||
kResourceType_CANPlugin,
|
||||
kResourceType_Accelerometer,
|
||||
kResourceType_ADXL345,
|
||||
kResourceType_AnalogChannel,
|
||||
kResourceType_AnalogTrigger,
|
||||
kResourceType_AnalogTriggerOutput,
|
||||
kResourceType_CANJaguar,
|
||||
kResourceType_Compressor,
|
||||
kResourceType_Counter,
|
||||
kResourceType_Dashboard,
|
||||
kResourceType_DigitalInput,
|
||||
kResourceType_DigitalOutput,
|
||||
kResourceType_DriverStationCIO,
|
||||
kResourceType_DriverStationEIO,
|
||||
kResourceType_DriverStationLCD,
|
||||
kResourceType_Encoder,
|
||||
kResourceType_GearTooth,
|
||||
kResourceType_Gyro,
|
||||
kResourceType_I2C,
|
||||
kResourceType_Framework,
|
||||
kResourceType_Jaguar,
|
||||
kResourceType_Joystick,
|
||||
kResourceType_Kinect,
|
||||
kResourceType_KinectStick,
|
||||
kResourceType_PIDController,
|
||||
kResourceType_Preferences,
|
||||
kResourceType_PWM,
|
||||
kResourceType_Relay,
|
||||
kResourceType_RobotDrive,
|
||||
kResourceType_SerialPort,
|
||||
kResourceType_Servo,
|
||||
kResourceType_Solenoid,
|
||||
kResourceType_SPI,
|
||||
kResourceType_Task,
|
||||
kResourceType_Ultrasonic,
|
||||
kResourceType_Victor,
|
||||
kResourceType_Button,
|
||||
kResourceType_Command,
|
||||
kResourceType_AxisCamera,
|
||||
kResourceType_PCVideoServer,
|
||||
kResourceType_SmartDashboard,
|
||||
kResourceType_Talon,
|
||||
kResourceType_HiTechnicColorSensor,
|
||||
kResourceType_HiTechnicAccel,
|
||||
kResourceType_HiTechnicCompass,
|
||||
kResourceType_SRF08,
|
||||
} tResourceType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kLanguage_LabVIEW = 1,
|
||||
kLanguage_CPlusPlus = 2,
|
||||
kLanguage_Java = 3,
|
||||
kLanguage_Python = 4,
|
||||
|
||||
kCANPlugin_BlackJagBridge = 1,
|
||||
kCANPlugin_2CAN = 2,
|
||||
|
||||
kFramework_Iterative = 1,
|
||||
kFramework_Simple = 2,
|
||||
|
||||
kRobotDrive_ArcadeStandard = 1,
|
||||
kRobotDrive_ArcadeButtonSpin = 2,
|
||||
kRobotDrive_ArcadeRatioCurve = 3,
|
||||
kRobotDrive_Tank = 4,
|
||||
kRobotDrive_MecanumPolar = 5,
|
||||
kRobotDrive_MecanumCartesian = 6,
|
||||
|
||||
kDriverStationCIO_Analog = 1,
|
||||
kDriverStationCIO_DigitalIn = 2,
|
||||
kDriverStationCIO_DigitalOut = 3,
|
||||
|
||||
kDriverStationEIO_Acceleration = 1,
|
||||
kDriverStationEIO_AnalogIn = 2,
|
||||
kDriverStationEIO_AnalogOut = 3,
|
||||
kDriverStationEIO_Button = 4,
|
||||
kDriverStationEIO_LED = 5,
|
||||
kDriverStationEIO_DigitalIn = 6,
|
||||
kDriverStationEIO_DigitalOut = 7,
|
||||
kDriverStationEIO_FixedDigitalOut = 8,
|
||||
kDriverStationEIO_PWM = 9,
|
||||
kDriverStationEIO_Encoder = 10,
|
||||
kDriverStationEIO_TouchSlider = 11,
|
||||
|
||||
kADXL345_SPI = 1,
|
||||
kADXL345_I2C = 2,
|
||||
|
||||
kCommand_Scheduler = 1,
|
||||
|
||||
kSmartDashboard_Instance = 1,
|
||||
} tInstances;
|
||||
|
||||
/**
|
||||
* Report the usage of a resource of interest.
|
||||
*
|
||||
* @param resource one of the values in the tResourceType above (max value 51).
|
||||
* @param instanceNumber an index that identifies the resource instance.
|
||||
* @param context an optional additional context number for some cases (such as module number). Set to 0 to omit.
|
||||
* @param feature a string to be included describing features in use on a specific resource. Setting the same resource more than once allows you to change the feature string.
|
||||
*/
|
||||
uint32_t EXPORT_FUNC report(tResourceType resource, uint8_t instanceNumber, uint8_t context = 0, const char *feature = NULL);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nUsageReporting_report(uint8_t resource, uint8_t instanceNumber, uint8_t context, const char *feature);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __UsageReporting_h__
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef __SYM_MODULE_LINK_H__
|
||||
#define __SYM_MODULE_LINK_H__
|
||||
|
||||
#include "HAL/HAL.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern STATUS moduleNameFindBySymbolName
|
||||
(
|
||||
const char * symbol, /* symbol name to look for */
|
||||
char * module /* where to return module name */
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user