mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Update to the v13 headers and libraries
Add all of the most recent headers and .SOs Also make DriverStation work with the new FRC comm protocol, using the new functions for getting status data Change-Id: I1c7fc5f90e72c5fbebf87d9923ce0967ed0ef3bc Initial HAL support for v13 ds Change-Id: I9a7f37ef8e24241598fa3981cb3df30c07c52e0f New ds stuff in the HAL Change-Id: I025910625453baf63f79f49bbc70ba8b2f093f50 New ds stuff in C++ Joysticks are still todo Driver station IO is pulled out Change-Id: I1bb59037c097713bd943e7bef00e12f67f13c3ac New ds works in C++ and Java. Joysticks still todo Change-Id: Ic93f8686856761badc592eceaf05964f52355578 Make joysticks work again with the v13 image protocol Change-Id: Ief7ee95d3398c2262ca07ab7d60499af3c8f60f7
This commit is contained in:
@@ -2,13 +2,12 @@ cmake_minimum_required(VERSION 2.8)
|
||||
project(HAL)
|
||||
|
||||
file(GLOB_RECURSE SRC_FILES lib/Athena/*.cpp)
|
||||
include_directories(lib/Athena include)
|
||||
include_directories(lib/Athena lib/Athena/FRC_FPGA_ChipObject include)
|
||||
add_library(HALAthena STATIC ${SRC_FILES})
|
||||
target_link_libraries(HALAthena ${NI_LIBS})
|
||||
INSTALL(TARGETS HALAthena ARCHIVE DESTINATION lib COMPONENT lib)
|
||||
INSTALL(FILES ${NI_LIBS} DESTINATION lib COMPONENT ni_lib)
|
||||
INSTALL(DIRECTORY include DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT headers)
|
||||
# lib/ c m gcc_s ld-linux
|
||||
# usr/lib stdc++
|
||||
# usr/lib
|
||||
# FRC_NetworkCommunication FRC_FPGA_ChipObject RoboRIO_FRC_ChipObject
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#define HAL_IO_CONFIG_DATA_SIZE 32
|
||||
#define HAL_SYS_STATUS_DATA_SIZE 44
|
||||
#define HAL_USER_STATUS_DATA_SIZE (984 - HAL_IO_CONFIG_DATA_SIZE - HAL_SYS_STATUS_DATA_SIZE)
|
||||
#define HAL_USER_DS_LCD_DATA_SIZE 128
|
||||
|
||||
#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
|
||||
#define HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
|
||||
@@ -142,119 +141,32 @@ namespace HALUsageReporting
|
||||
};
|
||||
}
|
||||
|
||||
struct HALCommonControlData
|
||||
{
|
||||
uint16_t packetIndex;
|
||||
union
|
||||
{
|
||||
uint8_t control;
|
||||
#ifndef __vxworks
|
||||
struct
|
||||
{
|
||||
uint8_t checkVersions :1;
|
||||
uint8_t test :1;
|
||||
uint8_t resync :1;
|
||||
uint8_t fmsAttached :1;
|
||||
uint8_t autonomous :1;
|
||||
uint8_t enabled :1;
|
||||
uint8_t notEStop :1;
|
||||
uint8_t reset :1;
|
||||
};
|
||||
#else
|
||||
struct
|
||||
{
|
||||
uint8_t reset : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t test :1;
|
||||
uint8_t checkVersions :1;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
uint8_t dsDigitalIn;
|
||||
uint16_t teamID;
|
||||
|
||||
char dsID_Alliance;
|
||||
char dsID_Position;
|
||||
|
||||
union
|
||||
{
|
||||
int8_t stick0Axes[6];
|
||||
struct
|
||||
{ // TODO: ???
|
||||
int8_t stick0Axis1;
|
||||
int8_t stick0Axis2;
|
||||
int8_t stick0Axis3;
|
||||
int8_t stick0Axis4;
|
||||
int8_t stick0Axis5;
|
||||
int8_t stick0Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick0Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union
|
||||
{
|
||||
int8_t stick1Axes[6];
|
||||
struct
|
||||
{ // TODO: ???
|
||||
int8_t stick1Axis1;
|
||||
int8_t stick1Axis2;
|
||||
int8_t stick1Axis3;
|
||||
int8_t stick1Axis4;
|
||||
int8_t stick1Axis5;
|
||||
int8_t stick1Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick1Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union
|
||||
{
|
||||
int8_t stick2Axes[6];
|
||||
struct
|
||||
{ // TODO: ???
|
||||
int8_t stick2Axis1;
|
||||
int8_t stick2Axis2;
|
||||
int8_t stick2Axis3;
|
||||
int8_t stick2Axis4;
|
||||
int8_t stick2Axis5;
|
||||
int8_t stick2Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick2Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union
|
||||
{
|
||||
int8_t stick3Axes[6];
|
||||
struct
|
||||
{ // TODO: ???
|
||||
int8_t stick3Axis1;
|
||||
int8_t stick3Axis2;
|
||||
int8_t stick3Axis3;
|
||||
int8_t stick3Axis4;
|
||||
int8_t stick3Axis5;
|
||||
int8_t stick3Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick3Buttons; // Left-most 4 bits are unused
|
||||
|
||||
//Analog inputs are 10 bit right-justified
|
||||
uint16_t analog1;
|
||||
uint16_t analog2;
|
||||
uint16_t analog3;
|
||||
uint16_t analog4;
|
||||
|
||||
uint64_t cRIOChecksum;
|
||||
uint32_t FPGAChecksum0;
|
||||
uint32_t FPGAChecksum1;
|
||||
uint32_t FPGAChecksum2;
|
||||
uint32_t FPGAChecksum3;
|
||||
|
||||
char versionData[8];
|
||||
struct HALControlWord {
|
||||
uint32_t enabled : 1;
|
||||
uint32_t autonomous : 1;
|
||||
uint32_t test :1;
|
||||
uint32_t eStop : 1;
|
||||
uint32_t fmsAttached:1;
|
||||
uint32_t dsAttached:1;
|
||||
uint32_t control_reserved : 26;
|
||||
};
|
||||
|
||||
enum HALAllianceStationID {
|
||||
kHALAllianceStationID_red1,
|
||||
kHALAllianceStationID_red2,
|
||||
kHALAllianceStationID_red3,
|
||||
kHALAllianceStationID_blue1,
|
||||
kHALAllianceStationID_blue2,
|
||||
kHALAllianceStationID_blue3,
|
||||
};
|
||||
|
||||
struct HALJoystickAxes {
|
||||
uint16_t count;
|
||||
int16_t axes[6];
|
||||
};
|
||||
|
||||
typedef uint32_t HALJoystickButtons;
|
||||
|
||||
inline float intToFloat(int value)
|
||||
{
|
||||
return (float)value;
|
||||
@@ -283,10 +195,12 @@ extern "C"
|
||||
bool getFPGAButton(int32_t *status);
|
||||
|
||||
int HALSetErrorData(const char *errors, int errorsLength, int wait_ms);
|
||||
int HALSetUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
|
||||
int HALOverrideIOConfig(const char *ioConfig, int wait_ms);
|
||||
int HALGetDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
|
||||
int HALGetCommonControlData(HALCommonControlData *data, int wait_ms);
|
||||
|
||||
int HALGetControlWord(HALControlWord *data);
|
||||
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation);
|
||||
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes);
|
||||
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count);
|
||||
|
||||
void HALSetNewDataSem(pthread_mutex_t *);
|
||||
int HALSetStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
|
||||
const char *userDataHigh, int userDataHighLength, const char *userDataLow,
|
||||
|
||||
@@ -4,33 +4,35 @@
|
||||
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
#pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
||||
|
||||
#include <stdint.h>
|
||||
#include "ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
|
||||
#include "ChipObject/tDMAManager.h"
|
||||
#include "ChipObject/tInterruptManager.h"
|
||||
#include "ChipObject/tSystem.h"
|
||||
#include "ChipObject/tSystemInterface.h"
|
||||
|
||||
#include "ChipObject/nInterfaceGlobals.h"
|
||||
#include "ChipObject/tAccel.h"
|
||||
#include "ChipObject/tAccumulator.h"
|
||||
#include "ChipObject/tAI.h"
|
||||
#include "ChipObject/tAlarm.h"
|
||||
#include "ChipObject/tAnalogTrigger.h"
|
||||
#include "ChipObject/tAO.h"
|
||||
#include "ChipObject/tBIST.h"
|
||||
#include "ChipObject/tCounter.h"
|
||||
#include "ChipObject/tDIO.h"
|
||||
#include "ChipObject/tDMA.h"
|
||||
#include "ChipObject/tEncoder.h"
|
||||
#include "ChipObject/tGlobal.h"
|
||||
#include "ChipObject/tInterrupt.h"
|
||||
#include "ChipObject/tPower.h"
|
||||
#include "ChipObject/tPWM.h"
|
||||
#include "ChipObject/tRelay.h"
|
||||
#include "ChipObject/tSPI.h"
|
||||
#include "ChipObject/tSysWatchdog.h"
|
||||
#include "FRC_FPGA_ChipObject/RoboRIO_FRC_ChipObject_Aliases.h"
|
||||
#include "FRC_FPGA_ChipObject/tDMAManager.h"
|
||||
#include "FRC_FPGA_ChipObject/tInterruptManager.h"
|
||||
#include "FRC_FPGA_ChipObject/tSystem.h"
|
||||
#include "FRC_FPGA_ChipObject/tSystemInterface.h"
|
||||
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/nInterfaceGlobals.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccel.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAccumulator.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAI.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAlarm.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAnalogTrigger.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tAO.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tBIST.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tCounter.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDIO.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tDMA.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tEncoder.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tGlobal.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tInterrupt.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPower.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tPWM.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tRelay.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSPI.h"
|
||||
#include "FRC_FPGA_ChipObject/nRoboRIO_FPGANamespace/tSysWatchdog.h"
|
||||
|
||||
// FIXME: these should not be here!
|
||||
using namespace nFPGA;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_nInterfaceGlobals_h__
|
||||
#define __nFRC_2015_1_0_5_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_nInterfaceGlobals_h__
|
||||
@@ -1,107 +0,0 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Power_h__
|
||||
#define __nFRC_2015_1_0_5_Power_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
{
|
||||
|
||||
class tPower
|
||||
{
|
||||
public:
|
||||
tPower(){}
|
||||
virtual ~tPower(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tPower* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned User3V3 : 8;
|
||||
unsigned User5V : 8;
|
||||
unsigned User6V : 8;
|
||||
#else
|
||||
unsigned User6V : 8;
|
||||
unsigned User5V : 8;
|
||||
unsigned User3V3 : 8;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 24;
|
||||
};
|
||||
} tStatus;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned User3V3 : 1;
|
||||
unsigned User5V : 1;
|
||||
unsigned User6V : 1;
|
||||
#else
|
||||
unsigned User6V : 1;
|
||||
unsigned User5V : 1;
|
||||
unsigned User3V3 : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 3;
|
||||
};
|
||||
} tDisable;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tStatus_IfaceConstants;
|
||||
|
||||
virtual tStatus readStatus(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User3V3(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User5V(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDisable_IfaceConstants;
|
||||
|
||||
virtual void writeDisable(tDisable value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User3V3(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User5V(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User6V(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tDisable readDisable(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User3V3(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User5V(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tIndicateOutOfRange_IfaceConstants;
|
||||
|
||||
virtual void writeIndicateOutOfRange(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readIndicateOutOfRange(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tPower(const tPower&);
|
||||
void operator=(const tPower&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Power_h__
|
||||
@@ -4,6 +4,6 @@
|
||||
#ifndef __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
#define __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
|
||||
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_5
|
||||
#define nRoboRIO_FPGANamespace nFRC_2015_1_0_7
|
||||
|
||||
#endif // __RoboRIO_FRC_ChipObject_Aliases_h__
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_C0EF_1_1_0_AI_h__
|
||||
#define __nFRC_C0EF_1_1_0_AI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_C0EF_1_1_0
|
||||
{
|
||||
|
||||
class tAI
|
||||
{
|
||||
public:
|
||||
tAI(){}
|
||||
virtual ~tAI(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAI* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 2,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tCalOK_IfaceConstants;
|
||||
|
||||
virtual bool readCalOK(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDoneTime_IfaceConstants;
|
||||
|
||||
virtual unsigned int readDoneTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumOffsetRegisters = 8,
|
||||
} tOffset_IfaceConstants;
|
||||
|
||||
virtual signed int readOffset(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumLSBWeightRegisters = 8,
|
||||
} tLSBWeight_IfaceConstants;
|
||||
|
||||
virtual unsigned int readLSBWeight(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAI(const tAI&);
|
||||
void operator=(const tAI&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_C0EF_1_1_0_AI_h__
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_C0EF_1_1_0_Global_h__
|
||||
#define __nFRC_C0EF_1_1_0_Global_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_C0EF_1_1_0
|
||||
{
|
||||
|
||||
class tGlobal
|
||||
{
|
||||
public:
|
||||
tGlobal(){}
|
||||
virtual ~tGlobal(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tGlobal* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tVersion_IfaceConstants;
|
||||
|
||||
virtual unsigned short readVersion(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLocalTime_IfaceConstants;
|
||||
|
||||
virtual unsigned int readLocalTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tRevision_IfaceConstants;
|
||||
|
||||
virtual unsigned int readRevision(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReserved_IfaceConstants;
|
||||
|
||||
virtual unsigned char readReserved(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tGlobal(const tGlobal&);
|
||||
void operator=(const tGlobal&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_C0EF_1_1_0_Global_h__
|
||||
@@ -0,0 +1,79 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_C0EF_1_1_0_LoadOut_h__
|
||||
#define __nFRC_C0EF_1_1_0_LoadOut_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_C0EF_1_1_0
|
||||
{
|
||||
|
||||
class tLoadOut
|
||||
{
|
||||
public:
|
||||
tLoadOut(){}
|
||||
virtual ~tLoadOut(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tLoadOut* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReady_IfaceConstants;
|
||||
|
||||
virtual bool readReady(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDoneTime_IfaceConstants;
|
||||
|
||||
virtual unsigned int readDoneTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumVendorIDRegisters = 8,
|
||||
} tVendorID_IfaceConstants;
|
||||
|
||||
virtual unsigned short readVendorID(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSerialNumberRegisters = 8,
|
||||
} tSerialNumber_IfaceConstants;
|
||||
|
||||
virtual unsigned int readSerialNumber(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumModuleIDRegisters = 8,
|
||||
} tModuleID_IfaceConstants;
|
||||
|
||||
virtual unsigned short readModuleID(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
private:
|
||||
tLoadOut(const tLoadOut&);
|
||||
void operator=(const tLoadOut&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_C0EF_1_1_0_LoadOut_h__
|
||||
@@ -0,0 +1,15 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_7_nInterfaceGlobals_h__
|
||||
#define __nFRC_2015_1_0_7_nInterfaceGlobals_h__
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
extern unsigned int g_currentTargetClass;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_7_nInterfaceGlobals_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_AI_h__
|
||||
#define __nFRC_2015_1_0_5_AI_h__
|
||||
#ifndef __nFRC_2015_1_0_7_AI_h__
|
||||
#define __nFRC_2015_1_0_7_AI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAI
|
||||
@@ -140,4 +140,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_AI_h__
|
||||
#endif // __nFRC_2015_1_0_7_AI_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_AO_h__
|
||||
#define __nFRC_2015_1_0_5_AO_h__
|
||||
#ifndef __nFRC_2015_1_0_7_AO_h__
|
||||
#define __nFRC_2015_1_0_7_AO_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAO
|
||||
@@ -47,4 +47,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_AO_h__
|
||||
#endif // __nFRC_2015_1_0_7_AO_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Accel_h__
|
||||
#define __nFRC_2015_1_0_5_Accel_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Accel_h__
|
||||
#define __nFRC_2015_1_0_7_Accel_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAccel
|
||||
@@ -99,4 +99,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Accel_h__
|
||||
#endif // __nFRC_2015_1_0_7_Accel_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Accumulator_h__
|
||||
#define __nFRC_2015_1_0_5_Accumulator_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Accumulator_h__
|
||||
#define __nFRC_2015_1_0_7_Accumulator_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAccumulator
|
||||
@@ -84,4 +84,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Accumulator_h__
|
||||
#endif // __nFRC_2015_1_0_7_Accumulator_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Alarm_h__
|
||||
#define __nFRC_2015_1_0_5_Alarm_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Alarm_h__
|
||||
#define __nFRC_2015_1_0_7_Alarm_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAlarm
|
||||
@@ -54,4 +54,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Alarm_h__
|
||||
#endif // __nFRC_2015_1_0_7_Alarm_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_AnalogTrigger_h__
|
||||
#define __nFRC_2015_1_0_5_AnalogTrigger_h__
|
||||
#ifndef __nFRC_2015_1_0_7_AnalogTrigger_h__
|
||||
#define __nFRC_2015_1_0_7_AnalogTrigger_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tAnalogTrigger
|
||||
@@ -126,4 +126,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_AnalogTrigger_h__
|
||||
#endif // __nFRC_2015_1_0_7_AnalogTrigger_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_BIST_h__
|
||||
#define __nFRC_2015_1_0_5_BIST_h__
|
||||
#ifndef __nFRC_2015_1_0_7_BIST_h__
|
||||
#define __nFRC_2015_1_0_7_BIST_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tBIST
|
||||
@@ -87,4 +87,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_BIST_h__
|
||||
#endif // __nFRC_2015_1_0_7_BIST_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Counter_h__
|
||||
#define __nFRC_2015_1_0_5_Counter_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Counter_h__
|
||||
#define __nFRC_2015_1_0_7_Counter_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tCounter
|
||||
@@ -216,4 +216,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Counter_h__
|
||||
#endif // __nFRC_2015_1_0_7_Counter_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_DIO_h__
|
||||
#define __nFRC_2015_1_0_5_DIO_h__
|
||||
#ifndef __nFRC_2015_1_0_7_DIO_h__
|
||||
#define __nFRC_2015_1_0_7_DIO_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tDIO
|
||||
@@ -137,15 +137,6 @@ public:
|
||||
virtual unsigned char readFilterSelectHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterPeriodMXPElements = 3,
|
||||
} tFilterPeriodMXP_IfaceConstants;
|
||||
|
||||
virtual void writeFilterPeriodMXP(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readFilterPeriodMXP(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutputEnable_IfaceConstants;
|
||||
@@ -218,15 +209,6 @@ public:
|
||||
virtual unsigned char readPulseLength(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterPeriodHdrElements = 3,
|
||||
} tFilterPeriodHdr_IfaceConstants;
|
||||
|
||||
virtual void writeFilterPeriodHdr(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readFilterPeriodHdr(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tPWMPeriodPower_IfaceConstants;
|
||||
@@ -237,6 +219,24 @@ public:
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterPeriodMXPRegisters = 3,
|
||||
} tFilterPeriodMXP_IfaceConstants;
|
||||
|
||||
virtual void writeFilterPeriodMXP(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readFilterPeriodMXP(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterPeriodHdrRegisters = 3,
|
||||
} tFilterPeriodHdr_IfaceConstants;
|
||||
|
||||
virtual void writeFilterPeriodHdr(unsigned char reg_index, unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readFilterPeriodHdr(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
private:
|
||||
tDIO(const tDIO&);
|
||||
void operator=(const tDIO&);
|
||||
@@ -245,4 +245,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_DIO_h__
|
||||
#endif // __nFRC_2015_1_0_7_DIO_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_DMA_h__
|
||||
#define __nFRC_2015_1_0_5_DMA_h__
|
||||
#ifndef __nFRC_2015_1_0_7_DMA_h__
|
||||
#define __nFRC_2015_1_0_7_DMA_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tDMA
|
||||
@@ -185,4 +185,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_DMA_h__
|
||||
#endif // __nFRC_2015_1_0_7_DMA_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Encoder_h__
|
||||
#define __nFRC_2015_1_0_5_Encoder_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Encoder_h__
|
||||
#define __nFRC_2015_1_0_7_Encoder_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tEncoder
|
||||
@@ -196,4 +196,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Encoder_h__
|
||||
#endif // __nFRC_2015_1_0_7_Encoder_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Global_h__
|
||||
#define __nFRC_2015_1_0_5_Global_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Global_h__
|
||||
#define __nFRC_2015_1_0_7_Global_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tGlobal
|
||||
@@ -101,4 +101,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Global_h__
|
||||
#endif // __nFRC_2015_1_0_7_Global_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Interrupt_h__
|
||||
#define __nFRC_2015_1_0_5_Interrupt_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Interrupt_h__
|
||||
#define __nFRC_2015_1_0_7_Interrupt_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tInterrupt
|
||||
@@ -90,4 +90,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Interrupt_h__
|
||||
#endif // __nFRC_2015_1_0_7_Interrupt_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_PWM_h__
|
||||
#define __nFRC_2015_1_0_5_PWM_h__
|
||||
#ifndef __nFRC_2015_1_0_7_PWM_h__
|
||||
#define __nFRC_2015_1_0_7_PWM_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tPWM
|
||||
@@ -108,4 +108,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_PWM_h__
|
||||
#endif // __nFRC_2015_1_0_7_PWM_h__
|
||||
@@ -0,0 +1,217 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_7_Power_h__
|
||||
#define __nFRC_2015_1_0_7_Power_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tPower
|
||||
{
|
||||
public:
|
||||
tPower(){}
|
||||
virtual ~tPower(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tPower* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned User3V3 : 8;
|
||||
unsigned User5V : 8;
|
||||
unsigned User6V : 8;
|
||||
#else
|
||||
unsigned User6V : 8;
|
||||
unsigned User5V : 8;
|
||||
unsigned User3V3 : 8;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 24;
|
||||
};
|
||||
} tStatus;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned OverCurrentFaultCount3V3 : 10;
|
||||
unsigned OverCurrentFaultCount5V : 10;
|
||||
unsigned OverCurrentFaultCount6V : 10;
|
||||
#else
|
||||
unsigned OverCurrentFaultCount6V : 10;
|
||||
unsigned OverCurrentFaultCount5V : 10;
|
||||
unsigned OverCurrentFaultCount3V3 : 10;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 30;
|
||||
};
|
||||
} tOverCurrentFaultCounts;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned User3V3 : 1;
|
||||
unsigned User5V : 1;
|
||||
unsigned User6V : 1;
|
||||
#else
|
||||
unsigned User6V : 1;
|
||||
unsigned User5V : 1;
|
||||
unsigned User3V3 : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 3;
|
||||
};
|
||||
} tDisable;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserVoltage3V3_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserVoltage3V3(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tStatus_IfaceConstants;
|
||||
|
||||
virtual tStatus readStatus(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User3V3(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User5V(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readStatus_User6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserVoltage6V_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserVoltage6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOnChipTemperature_IfaceConstants;
|
||||
|
||||
virtual unsigned short readOnChipTemperature(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserVoltage5V_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserVoltage5V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tResetFaultCounts_IfaceConstants;
|
||||
|
||||
virtual void strobeResetFaultCounts(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOverCurrentFaultCounts_IfaceConstants;
|
||||
|
||||
virtual tOverCurrentFaultCounts readOverCurrentFaultCounts(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount3V3(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount5V(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readOverCurrentFaultCounts_OverCurrentFaultCount6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tIntegratedIO_IfaceConstants;
|
||||
|
||||
virtual unsigned short readIntegratedIO(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tMXP_DIOVoltage_IfaceConstants;
|
||||
|
||||
virtual unsigned short readMXP_DIOVoltage(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserCurrent3V3_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserCurrent3V3(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tVinVoltage_IfaceConstants;
|
||||
|
||||
virtual unsigned short readVinVoltage(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserCurrent6V_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserCurrent6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUserCurrent5V_IfaceConstants;
|
||||
|
||||
virtual unsigned short readUserCurrent5V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tAOVoltage_IfaceConstants;
|
||||
|
||||
virtual unsigned short readAOVoltage(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tVinCurrent_IfaceConstants;
|
||||
|
||||
virtual unsigned short readVinCurrent(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDisable_IfaceConstants;
|
||||
|
||||
virtual void writeDisable(tDisable value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User3V3(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User5V(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDisable_User6V(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tDisable readDisable(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User3V3(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User5V(tRioStatusCode *status) = 0;
|
||||
virtual bool readDisable_User6V(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tPower(const tPower&);
|
||||
void operator=(const tPower&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_7_Power_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_Relay_h__
|
||||
#define __nFRC_2015_1_0_5_Relay_h__
|
||||
#ifndef __nFRC_2015_1_0_7_Relay_h__
|
||||
#define __nFRC_2015_1_0_7_Relay_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tRelay
|
||||
@@ -65,4 +65,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_Relay_h__
|
||||
#endif // __nFRC_2015_1_0_7_Relay_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_SPI_h__
|
||||
#define __nFRC_2015_1_0_5_SPI_h__
|
||||
#ifndef __nFRC_2015_1_0_7_SPI_h__
|
||||
#define __nFRC_2015_1_0_7_SPI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tSPI
|
||||
@@ -65,4 +65,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_SPI_h__
|
||||
#endif // __nFRC_2015_1_0_7_SPI_h__
|
||||
@@ -1,14 +1,14 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2015_1_0_5_SysWatchdog_h__
|
||||
#define __nFRC_2015_1_0_5_SysWatchdog_h__
|
||||
#ifndef __nFRC_2015_1_0_7_SysWatchdog_h__
|
||||
#define __nFRC_2015_1_0_7_SysWatchdog_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2015_1_0_5
|
||||
namespace nFRC_2015_1_0_7
|
||||
{
|
||||
|
||||
class tSysWatchdog
|
||||
@@ -98,4 +98,4 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2015_1_0_5_SysWatchdog_h__
|
||||
#endif // __nFRC_2015_1_0_7_SysWatchdog_h__
|
||||
149
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h
Normal file
149
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tAI.h
Normal file
@@ -0,0 +1,149 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_AI_h__
|
||||
#define __nFRC_2012_1_6_4_AI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tAI
|
||||
{
|
||||
public:
|
||||
tAI(){}
|
||||
virtual ~tAI(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAI* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 2,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Channel : 3;
|
||||
unsigned Module : 1;
|
||||
unsigned Averaged : 1;
|
||||
#else
|
||||
unsigned Averaged : 1;
|
||||
unsigned Module : 1;
|
||||
unsigned Channel : 3;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 5;
|
||||
};
|
||||
} tReadSelect;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned ScanSize : 3;
|
||||
unsigned ConvertRate : 26;
|
||||
#else
|
||||
unsigned ConvertRate : 26;
|
||||
unsigned ScanSize : 3;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 29;
|
||||
};
|
||||
} tConfig;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ScanSize(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ConvertRate(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_ScanSize(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readConfig_ConvertRate(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLoopTiming_IfaceConstants;
|
||||
|
||||
virtual unsigned int readLoopTiming(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumOversampleBitsElements = 8,
|
||||
} tOversampleBits_IfaceConstants;
|
||||
|
||||
virtual void writeOversampleBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readOversampleBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumAverageBitsElements = 8,
|
||||
} tAverageBits_IfaceConstants;
|
||||
|
||||
virtual void writeAverageBits(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readAverageBits(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumScanListElements = 8,
|
||||
} tScanList_IfaceConstants;
|
||||
|
||||
virtual void writeScanList(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readScanList(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual signed int readOutput(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLatchOutput_IfaceConstants;
|
||||
|
||||
virtual void strobeLatchOutput(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReadSelect_IfaceConstants;
|
||||
|
||||
virtual void writeReadSelect(tReadSelect value, tRioStatusCode *status) = 0;
|
||||
virtual void writeReadSelect_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeReadSelect_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeReadSelect_Averaged(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tReadSelect readReadSelect(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readReadSelect_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readReadSelect_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readReadSelect_Averaged(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAI(const tAI&);
|
||||
void operator=(const tAI&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_AI_h__
|
||||
@@ -0,0 +1,87 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Accumulator_h__
|
||||
#define __nFRC_2012_1_6_4_Accumulator_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tAccumulator
|
||||
{
|
||||
public:
|
||||
tAccumulator(){}
|
||||
virtual ~tAccumulator(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAccumulator* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 2,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
signed long long Value;
|
||||
unsigned Count : 32;
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
unsigned value2 : 32;
|
||||
unsigned value3 : 32;
|
||||
};
|
||||
} tOutput;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual tOutput readOutput(tRioStatusCode *status) = 0;
|
||||
virtual signed long long readOutput_Value(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readOutput_Count(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tCenter_IfaceConstants;
|
||||
|
||||
virtual void writeCenter(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readCenter(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDeadband_IfaceConstants;
|
||||
|
||||
virtual void writeDeadband(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readDeadband(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReset_IfaceConstants;
|
||||
|
||||
virtual void strobeReset(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAccumulator(const tAccumulator&);
|
||||
void operator=(const tAccumulator&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Accumulator_h__
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Alarm_h__
|
||||
#define __nFRC_2012_1_6_4_Alarm_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tAlarm
|
||||
{
|
||||
public:
|
||||
tAlarm(){}
|
||||
virtual ~tAlarm(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAlarm* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tEnable_IfaceConstants;
|
||||
|
||||
virtual void writeEnable(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readEnable(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTriggerTime_IfaceConstants;
|
||||
|
||||
virtual void writeTriggerTime(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTriggerTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAlarm(const tAlarm&);
|
||||
void operator=(const tAlarm&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Alarm_h__
|
||||
@@ -0,0 +1,133 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_AnalogTrigger_h__
|
||||
#define __nFRC_2012_1_6_4_AnalogTrigger_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tAnalogTrigger
|
||||
{
|
||||
public:
|
||||
tAnalogTrigger(){}
|
||||
virtual ~tAnalogTrigger(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tAnalogTrigger* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 8,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned InHysteresis : 1;
|
||||
unsigned OverLimit : 1;
|
||||
unsigned Rising : 1;
|
||||
unsigned Falling : 1;
|
||||
#else
|
||||
unsigned Falling : 1;
|
||||
unsigned Rising : 1;
|
||||
unsigned OverLimit : 1;
|
||||
unsigned InHysteresis : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 4;
|
||||
};
|
||||
} tOutput;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Channel : 3;
|
||||
unsigned Module : 1;
|
||||
unsigned Averaged : 1;
|
||||
unsigned Filter : 1;
|
||||
unsigned FloatingRollover : 1;
|
||||
signed RolloverLimit : 8;
|
||||
#else
|
||||
signed RolloverLimit : 8;
|
||||
unsigned FloatingRollover : 1;
|
||||
unsigned Filter : 1;
|
||||
unsigned Averaged : 1;
|
||||
unsigned Module : 1;
|
||||
unsigned Channel : 3;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 15;
|
||||
};
|
||||
} tSourceSelect;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tSourceSelect_IfaceConstants;
|
||||
|
||||
virtual void writeSourceSelect(tSourceSelect value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_Averaged(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_Filter(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_FloatingRollover(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSourceSelect_RolloverLimit(signed short value, tRioStatusCode *status) = 0;
|
||||
virtual tSourceSelect readSourceSelect(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readSourceSelect_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readSourceSelect_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readSourceSelect_Averaged(tRioStatusCode *status) = 0;
|
||||
virtual bool readSourceSelect_Filter(tRioStatusCode *status) = 0;
|
||||
virtual bool readSourceSelect_FloatingRollover(tRioStatusCode *status) = 0;
|
||||
virtual signed short readSourceSelect_RolloverLimit(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tUpperLimit_IfaceConstants;
|
||||
|
||||
virtual void writeUpperLimit(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readUpperLimit(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLowerLimit_IfaceConstants;
|
||||
|
||||
virtual void writeLowerLimit(signed int value, tRioStatusCode *status) = 0;
|
||||
virtual signed int readLowerLimit(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumOutputElements = 8,
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual tOutput readOutput(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_InHysteresis(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_OverLimit(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_Rising(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_Falling(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tAnalogTrigger(const tAnalogTrigger&);
|
||||
void operator=(const tAnalogTrigger&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_AnalogTrigger_h__
|
||||
@@ -0,0 +1,219 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Counter_h__
|
||||
#define __nFRC_2012_1_6_4_Counter_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tCounter
|
||||
{
|
||||
public:
|
||||
tCounter(){}
|
||||
virtual ~tCounter(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tCounter* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 8,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Direction : 1;
|
||||
signed Value : 31;
|
||||
#else
|
||||
signed Value : 31;
|
||||
unsigned Direction : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tOutput;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned UpSource_Channel : 4;
|
||||
unsigned UpSource_Module : 1;
|
||||
unsigned UpSource_AnalogTrigger : 1;
|
||||
unsigned DownSource_Channel : 4;
|
||||
unsigned DownSource_Module : 1;
|
||||
unsigned DownSource_AnalogTrigger : 1;
|
||||
unsigned IndexSource_Channel : 4;
|
||||
unsigned IndexSource_Module : 1;
|
||||
unsigned IndexSource_AnalogTrigger : 1;
|
||||
unsigned IndexActiveHigh : 1;
|
||||
unsigned UpRisingEdge : 1;
|
||||
unsigned UpFallingEdge : 1;
|
||||
unsigned DownRisingEdge : 1;
|
||||
unsigned DownFallingEdge : 1;
|
||||
unsigned Mode : 2;
|
||||
unsigned PulseLengthThreshold : 6;
|
||||
unsigned Enable : 1;
|
||||
#else
|
||||
unsigned Enable : 1;
|
||||
unsigned PulseLengthThreshold : 6;
|
||||
unsigned Mode : 2;
|
||||
unsigned DownFallingEdge : 1;
|
||||
unsigned DownRisingEdge : 1;
|
||||
unsigned UpFallingEdge : 1;
|
||||
unsigned UpRisingEdge : 1;
|
||||
unsigned IndexActiveHigh : 1;
|
||||
unsigned IndexSource_AnalogTrigger : 1;
|
||||
unsigned IndexSource_Module : 1;
|
||||
unsigned IndexSource_Channel : 4;
|
||||
unsigned DownSource_AnalogTrigger : 1;
|
||||
unsigned DownSource_Module : 1;
|
||||
unsigned DownSource_Channel : 4;
|
||||
unsigned UpSource_AnalogTrigger : 1;
|
||||
unsigned UpSource_Module : 1;
|
||||
unsigned UpSource_Channel : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Period : 23;
|
||||
signed Count : 8;
|
||||
unsigned Stalled : 1;
|
||||
#else
|
||||
unsigned Stalled : 1;
|
||||
signed Count : 8;
|
||||
unsigned Period : 23;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tTimerOutput;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned StallPeriod : 24;
|
||||
unsigned AverageSize : 7;
|
||||
unsigned UpdateWhenEmpty : 1;
|
||||
#else
|
||||
unsigned UpdateWhenEmpty : 1;
|
||||
unsigned AverageSize : 7;
|
||||
unsigned StallPeriod : 24;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tTimerConfig;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual tOutput readOutput(tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_Direction(tRioStatusCode *status) = 0;
|
||||
virtual signed int readOutput_Value(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_UpSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_UpSource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_UpSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DownSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DownSource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DownSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_UpRisingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_UpFallingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DownRisingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DownFallingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Mode(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_PulseLengthThreshold(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_UpSource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_UpSource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_UpSource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_DownSource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_DownSource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_DownSource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_UpRisingEdge(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_UpFallingEdge(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_DownRisingEdge(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_DownFallingEdge(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_Mode(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readConfig_PulseLengthThreshold(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimerOutput_IfaceConstants;
|
||||
|
||||
virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0;
|
||||
virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0;
|
||||
virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReset_IfaceConstants;
|
||||
|
||||
virtual void strobeReset(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimerConfig_IfaceConstants;
|
||||
|
||||
virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0;
|
||||
virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tCounter(const tCounter&);
|
||||
void operator=(const tCounter&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Counter_h__
|
||||
330
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h
Normal file
330
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDIO.h
Normal file
@@ -0,0 +1,330 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_DIO_h__
|
||||
#define __nFRC_2012_1_6_4_DIO_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tDIO
|
||||
{
|
||||
public:
|
||||
tDIO(){}
|
||||
virtual ~tDIO(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tDIO* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 2,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Period : 16;
|
||||
unsigned MinHigh : 16;
|
||||
#else
|
||||
unsigned MinHigh : 16;
|
||||
unsigned Period : 16;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tPWMConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned RelayFwd : 8;
|
||||
unsigned RelayRev : 8;
|
||||
unsigned I2CHeader : 4;
|
||||
#else
|
||||
unsigned I2CHeader : 4;
|
||||
unsigned RelayRev : 8;
|
||||
unsigned RelayFwd : 8;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 20;
|
||||
};
|
||||
} tSlowValue;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Transaction : 1;
|
||||
unsigned Done : 1;
|
||||
unsigned Aborted : 1;
|
||||
unsigned DataReceivedHigh : 24;
|
||||
#else
|
||||
unsigned DataReceivedHigh : 24;
|
||||
unsigned Aborted : 1;
|
||||
unsigned Done : 1;
|
||||
unsigned Transaction : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 27;
|
||||
};
|
||||
} tI2CStatus;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Address : 8;
|
||||
unsigned BytesToRead : 3;
|
||||
unsigned BytesToWrite : 3;
|
||||
unsigned DataToSendHigh : 16;
|
||||
unsigned BitwiseHandshake : 1;
|
||||
#else
|
||||
unsigned BitwiseHandshake : 1;
|
||||
unsigned DataToSendHigh : 16;
|
||||
unsigned BytesToWrite : 3;
|
||||
unsigned BytesToRead : 3;
|
||||
unsigned Address : 8;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 31;
|
||||
};
|
||||
} tI2CConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned PeriodPower : 4;
|
||||
unsigned OutputSelect_0 : 4;
|
||||
unsigned OutputSelect_1 : 4;
|
||||
unsigned OutputSelect_2 : 4;
|
||||
unsigned OutputSelect_3 : 4;
|
||||
#else
|
||||
unsigned OutputSelect_3 : 4;
|
||||
unsigned OutputSelect_2 : 4;
|
||||
unsigned OutputSelect_1 : 4;
|
||||
unsigned OutputSelect_0 : 4;
|
||||
unsigned PeriodPower : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 20;
|
||||
};
|
||||
} tDO_PWMConfig;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterSelectElements = 16,
|
||||
} tFilterSelect_IfaceConstants;
|
||||
|
||||
virtual void writeFilterSelect(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readFilterSelect(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tI2CDataToSend_IfaceConstants;
|
||||
|
||||
virtual void writeI2CDataToSend(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readI2CDataToSend(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDO_IfaceConstants;
|
||||
|
||||
virtual void writeDO(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readDO(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumFilterPeriodElements = 3,
|
||||
} tFilterPeriod_IfaceConstants;
|
||||
|
||||
virtual void writeFilterPeriod(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readFilterPeriod(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutputEnable_IfaceConstants;
|
||||
|
||||
virtual void writeOutputEnable(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readOutputEnable(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tPulse_IfaceConstants;
|
||||
|
||||
virtual void writePulse(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readPulse(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tSlowValue_IfaceConstants;
|
||||
|
||||
virtual void writeSlowValue(tSlowValue value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSlowValue_RelayFwd(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSlowValue_RelayRev(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeSlowValue_I2CHeader(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual tSlowValue readSlowValue(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readSlowValue_RelayFwd(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readSlowValue_RelayRev(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readSlowValue_I2CHeader(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tI2CStatus_IfaceConstants;
|
||||
|
||||
virtual tI2CStatus readI2CStatus(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readI2CStatus_Transaction(tRioStatusCode *status) = 0;
|
||||
virtual bool readI2CStatus_Done(tRioStatusCode *status) = 0;
|
||||
virtual bool readI2CStatus_Aborted(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readI2CStatus_DataReceivedHigh(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tI2CDataReceived_IfaceConstants;
|
||||
|
||||
virtual unsigned int readI2CDataReceived(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDI_IfaceConstants;
|
||||
|
||||
virtual unsigned short readDI(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tPulseLength_IfaceConstants;
|
||||
|
||||
virtual void writePulseLength(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readPulseLength(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumPWMPeriodScaleElements = 10,
|
||||
} tPWMPeriodScale_IfaceConstants;
|
||||
|
||||
virtual void writePWMPeriodScale(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readPWMPeriodScale(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumDO_PWMDutyCycleElements = 4,
|
||||
} tDO_PWMDutyCycle_IfaceConstants;
|
||||
|
||||
virtual void writeDO_PWMDutyCycle(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMDutyCycle(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tBFL_IfaceConstants;
|
||||
|
||||
virtual void writeBFL(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readBFL(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tI2CConfig_IfaceConstants;
|
||||
|
||||
virtual void writeI2CConfig(tI2CConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeI2CConfig_Address(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeI2CConfig_BytesToRead(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeI2CConfig_BytesToWrite(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeI2CConfig_DataToSendHigh(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual void writeI2CConfig_BitwiseHandshake(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tI2CConfig readI2CConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readI2CConfig_Address(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readI2CConfig_BytesToRead(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readI2CConfig_BytesToWrite(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readI2CConfig_DataToSendHigh(tRioStatusCode *status) = 0;
|
||||
virtual bool readI2CConfig_BitwiseHandshake(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDO_PWMConfig_IfaceConstants;
|
||||
|
||||
virtual void writeDO_PWMConfig(tDO_PWMConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDO_PWMConfig_PeriodPower(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDO_PWMConfig_OutputSelect_0(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDO_PWMConfig_OutputSelect_1(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDO_PWMConfig_OutputSelect_2(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeDO_PWMConfig_OutputSelect_3(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual tDO_PWMConfig readDO_PWMConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMConfig_PeriodPower(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMConfig_OutputSelect_0(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMConfig_OutputSelect_1(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMConfig_OutputSelect_2(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readDO_PWMConfig_OutputSelect_3(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tI2CStart_IfaceConstants;
|
||||
|
||||
virtual void strobeI2CStart(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLoopTiming_IfaceConstants;
|
||||
|
||||
virtual unsigned short readLoopTiming(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tPWMConfig_IfaceConstants;
|
||||
|
||||
virtual void writePWMConfig(tPWMConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writePWMConfig_Period(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual void writePWMConfig_MinHigh(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual tPWMConfig readPWMConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readPWMConfig_Period(tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readPWMConfig_MinHigh(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumPWMValueRegisters = 10,
|
||||
} tPWMValue_IfaceConstants;
|
||||
|
||||
virtual void writePWMValue(unsigned char reg_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readPWMValue(unsigned char reg_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tDIO(const tDIO&);
|
||||
void operator=(const tDIO&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_DIO_h__
|
||||
188
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h
Normal file
188
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tDMA.h
Normal file
@@ -0,0 +1,188 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_DMA_h__
|
||||
#define __nFRC_2012_1_6_4_DMA_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tDMA
|
||||
{
|
||||
public:
|
||||
tDMA(){}
|
||||
virtual ~tDMA(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tDMA* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Pause : 1;
|
||||
unsigned Enable_AI0_Low : 1;
|
||||
unsigned Enable_AI0_High : 1;
|
||||
unsigned Enable_AIAveraged0_Low : 1;
|
||||
unsigned Enable_AIAveraged0_High : 1;
|
||||
unsigned Enable_AI1_Low : 1;
|
||||
unsigned Enable_AI1_High : 1;
|
||||
unsigned Enable_AIAveraged1_Low : 1;
|
||||
unsigned Enable_AIAveraged1_High : 1;
|
||||
unsigned Enable_Accumulator0 : 1;
|
||||
unsigned Enable_Accumulator1 : 1;
|
||||
unsigned Enable_DI : 1;
|
||||
unsigned Enable_AnalogTriggers : 1;
|
||||
unsigned Enable_Counters_Low : 1;
|
||||
unsigned Enable_Counters_High : 1;
|
||||
unsigned Enable_CounterTimers_Low : 1;
|
||||
unsigned Enable_CounterTimers_High : 1;
|
||||
unsigned Enable_Encoders : 1;
|
||||
unsigned Enable_EncoderTimers : 1;
|
||||
unsigned ExternalClock : 1;
|
||||
#else
|
||||
unsigned ExternalClock : 1;
|
||||
unsigned Enable_EncoderTimers : 1;
|
||||
unsigned Enable_Encoders : 1;
|
||||
unsigned Enable_CounterTimers_High : 1;
|
||||
unsigned Enable_CounterTimers_Low : 1;
|
||||
unsigned Enable_Counters_High : 1;
|
||||
unsigned Enable_Counters_Low : 1;
|
||||
unsigned Enable_AnalogTriggers : 1;
|
||||
unsigned Enable_DI : 1;
|
||||
unsigned Enable_Accumulator1 : 1;
|
||||
unsigned Enable_Accumulator0 : 1;
|
||||
unsigned Enable_AIAveraged1_High : 1;
|
||||
unsigned Enable_AIAveraged1_Low : 1;
|
||||
unsigned Enable_AI1_High : 1;
|
||||
unsigned Enable_AI1_Low : 1;
|
||||
unsigned Enable_AIAveraged0_High : 1;
|
||||
unsigned Enable_AIAveraged0_Low : 1;
|
||||
unsigned Enable_AI0_High : 1;
|
||||
unsigned Enable_AI0_Low : 1;
|
||||
unsigned Pause : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 20;
|
||||
};
|
||||
} tConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned ExternalClockSource_Channel : 4;
|
||||
unsigned ExternalClockSource_Module : 1;
|
||||
unsigned ExternalClockSource_AnalogTrigger : 1;
|
||||
unsigned RisingEdge : 1;
|
||||
unsigned FallingEdge : 1;
|
||||
#else
|
||||
unsigned FallingEdge : 1;
|
||||
unsigned RisingEdge : 1;
|
||||
unsigned ExternalClockSource_AnalogTrigger : 1;
|
||||
unsigned ExternalClockSource_Module : 1;
|
||||
unsigned ExternalClockSource_Channel : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 8;
|
||||
};
|
||||
} tExternalTriggers;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tRate_IfaceConstants;
|
||||
|
||||
virtual void writeRate(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readRate(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Pause(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AI0_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AI0_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AIAveraged0_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AIAveraged0_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AI1_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AI1_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AIAveraged1_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AIAveraged1_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_Accumulator0(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_Accumulator1(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_DI(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_AnalogTriggers(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_Counters_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_Counters_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_CounterTimers_Low(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_CounterTimers_High(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_Encoders(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable_EncoderTimers(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ExternalClock(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Pause(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AI0_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AI0_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AIAveraged0_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AIAveraged0_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AI1_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AI1_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AIAveraged1_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AIAveraged1_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_Accumulator0(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_Accumulator1(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_DI(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_AnalogTriggers(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_Counters_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_Counters_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_CounterTimers_Low(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_CounterTimers_High(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_Encoders(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable_EncoderTimers(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_ExternalClock(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumExternalTriggersElements = 4,
|
||||
} tExternalTriggers_IfaceConstants;
|
||||
|
||||
virtual void writeExternalTriggers(unsigned char bitfield_index, tExternalTriggers value, tRioStatusCode *status) = 0;
|
||||
virtual void writeExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeExternalTriggers_RisingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeExternalTriggers_FallingEdge(unsigned char bitfield_index, bool value, tRioStatusCode *status) = 0;
|
||||
virtual tExternalTriggers readExternalTriggers(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readExternalTriggers_ExternalClockSource_Channel(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readExternalTriggers_ExternalClockSource_Module(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readExternalTriggers_ExternalClockSource_AnalogTrigger(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readExternalTriggers_RisingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
virtual bool readExternalTriggers_FallingEdge(unsigned char bitfield_index, tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tDMA(const tDMA&);
|
||||
void operator=(const tDMA&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_DMA_h__
|
||||
@@ -0,0 +1,199 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Encoder_h__
|
||||
#define __nFRC_2012_1_6_4_Encoder_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tEncoder
|
||||
{
|
||||
public:
|
||||
tEncoder(){}
|
||||
virtual ~tEncoder(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tEncoder* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 4,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Direction : 1;
|
||||
signed Value : 31;
|
||||
#else
|
||||
signed Value : 31;
|
||||
unsigned Direction : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tOutput;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned ASource_Channel : 4;
|
||||
unsigned ASource_Module : 1;
|
||||
unsigned ASource_AnalogTrigger : 1;
|
||||
unsigned BSource_Channel : 4;
|
||||
unsigned BSource_Module : 1;
|
||||
unsigned BSource_AnalogTrigger : 1;
|
||||
unsigned IndexSource_Channel : 4;
|
||||
unsigned IndexSource_Module : 1;
|
||||
unsigned IndexSource_AnalogTrigger : 1;
|
||||
unsigned IndexActiveHigh : 1;
|
||||
unsigned Reverse : 1;
|
||||
unsigned Enable : 1;
|
||||
#else
|
||||
unsigned Enable : 1;
|
||||
unsigned Reverse : 1;
|
||||
unsigned IndexActiveHigh : 1;
|
||||
unsigned IndexSource_AnalogTrigger : 1;
|
||||
unsigned IndexSource_Module : 1;
|
||||
unsigned IndexSource_Channel : 4;
|
||||
unsigned BSource_AnalogTrigger : 1;
|
||||
unsigned BSource_Module : 1;
|
||||
unsigned BSource_Channel : 4;
|
||||
unsigned ASource_AnalogTrigger : 1;
|
||||
unsigned ASource_Module : 1;
|
||||
unsigned ASource_Channel : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 21;
|
||||
};
|
||||
} tConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Period : 23;
|
||||
signed Count : 8;
|
||||
unsigned Stalled : 1;
|
||||
#else
|
||||
unsigned Stalled : 1;
|
||||
signed Count : 8;
|
||||
unsigned Period : 23;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tTimerOutput;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned StallPeriod : 24;
|
||||
unsigned AverageSize : 7;
|
||||
unsigned UpdateWhenEmpty : 1;
|
||||
#else
|
||||
unsigned UpdateWhenEmpty : 1;
|
||||
unsigned AverageSize : 7;
|
||||
unsigned StallPeriod : 24;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 32;
|
||||
};
|
||||
} tTimerConfig;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tOutput_IfaceConstants;
|
||||
|
||||
virtual tOutput readOutput(tRioStatusCode *status) = 0;
|
||||
virtual bool readOutput_Direction(tRioStatusCode *status) = 0;
|
||||
virtual signed int readOutput_Value(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ASource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ASource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ASource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_BSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_BSource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_BSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexSource_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_IndexActiveHigh(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Reverse(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Enable(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_ASource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_ASource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_ASource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_BSource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_BSource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_BSource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_IndexSource_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_IndexSource_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_IndexSource_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_IndexActiveHigh(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Reverse(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Enable(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimerOutput_IfaceConstants;
|
||||
|
||||
virtual tTimerOutput readTimerOutput(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTimerOutput_Period(tRioStatusCode *status) = 0;
|
||||
virtual signed char readTimerOutput_Count(tRioStatusCode *status) = 0;
|
||||
virtual bool readTimerOutput_Stalled(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReset_IfaceConstants;
|
||||
|
||||
virtual void strobeReset(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimerConfig_IfaceConstants;
|
||||
|
||||
virtual void writeTimerConfig(tTimerConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_StallPeriod(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_AverageSize(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeTimerConfig_UpdateWhenEmpty(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tTimerConfig readTimerConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readTimerConfig_StallPeriod(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readTimerConfig_AverageSize(tRioStatusCode *status) = 0;
|
||||
virtual bool readTimerConfig_UpdateWhenEmpty(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tEncoder(const tEncoder&);
|
||||
void operator=(const tEncoder&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Encoder_h__
|
||||
@@ -0,0 +1,70 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Global_h__
|
||||
#define __nFRC_2012_1_6_4_Global_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tGlobal
|
||||
{
|
||||
public:
|
||||
tGlobal(){}
|
||||
virtual ~tGlobal(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tGlobal* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tVersion_IfaceConstants;
|
||||
|
||||
virtual unsigned short readVersion(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLocalTime_IfaceConstants;
|
||||
|
||||
virtual unsigned int readLocalTime(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tFPGA_LED_IfaceConstants;
|
||||
|
||||
virtual void writeFPGA_LED(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readFPGA_LED(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tRevision_IfaceConstants;
|
||||
|
||||
virtual unsigned int readRevision(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tGlobal(const tGlobal&);
|
||||
void operator=(const tGlobal&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Global_h__
|
||||
@@ -0,0 +1,93 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_Interrupt_h__
|
||||
#define __nFRC_2012_1_6_4_Interrupt_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tInterrupt
|
||||
{
|
||||
public:
|
||||
tInterrupt(){}
|
||||
virtual ~tInterrupt(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tInterrupt* create(unsigned char sys_index, tRioStatusCode *status);
|
||||
virtual unsigned char getSystemIndex() = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 8,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned Source_Channel : 4;
|
||||
unsigned Source_Module : 1;
|
||||
unsigned Source_AnalogTrigger : 1;
|
||||
unsigned RisingEdge : 1;
|
||||
unsigned FallingEdge : 1;
|
||||
unsigned WaitForAck : 1;
|
||||
#else
|
||||
unsigned WaitForAck : 1;
|
||||
unsigned FallingEdge : 1;
|
||||
unsigned RisingEdge : 1;
|
||||
unsigned Source_AnalogTrigger : 1;
|
||||
unsigned Source_Module : 1;
|
||||
unsigned Source_Channel : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 9;
|
||||
};
|
||||
} tConfig;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimeStamp_IfaceConstants;
|
||||
|
||||
virtual unsigned int readTimeStamp(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Source_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Source_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_Source_AnalogTrigger(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_RisingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_FallingEdge(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_WaitForAck(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_Source_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_Source_Module(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_Source_AnalogTrigger(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_RisingEdge(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_FallingEdge(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_WaitForAck(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tInterrupt(const tInterrupt&);
|
||||
void operator=(const tInterrupt&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_Interrupt_h__
|
||||
228
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h
Normal file
228
hal/lib/Athena/FRC_FPGA_ChipObject/nRuntimeFPGANamespace/tSPI.h
Normal file
@@ -0,0 +1,228 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_SPI_h__
|
||||
#define __nFRC_2012_1_6_4_SPI_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tSPI
|
||||
{
|
||||
public:
|
||||
tSPI(){}
|
||||
virtual ~tSPI(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tSPI* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned ReceivedDataOverflow : 1;
|
||||
unsigned Idle : 1;
|
||||
#else
|
||||
unsigned Idle : 1;
|
||||
unsigned ReceivedDataOverflow : 1;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 2;
|
||||
};
|
||||
} tStatus;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned BusBitWidth : 8;
|
||||
unsigned ClockHalfPeriodDelay : 8;
|
||||
unsigned MSBfirst : 1;
|
||||
unsigned DataOnFalling : 1;
|
||||
unsigned LatchFirst : 1;
|
||||
unsigned LatchLast : 1;
|
||||
unsigned FramePolarity : 1;
|
||||
unsigned WriteOnly : 1;
|
||||
unsigned ClockPolarity : 1;
|
||||
#else
|
||||
unsigned ClockPolarity : 1;
|
||||
unsigned WriteOnly : 1;
|
||||
unsigned FramePolarity : 1;
|
||||
unsigned LatchLast : 1;
|
||||
unsigned LatchFirst : 1;
|
||||
unsigned DataOnFalling : 1;
|
||||
unsigned MSBfirst : 1;
|
||||
unsigned ClockHalfPeriodDelay : 8;
|
||||
unsigned BusBitWidth : 8;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 23;
|
||||
};
|
||||
} tConfig;
|
||||
typedef
|
||||
union{
|
||||
struct{
|
||||
#ifdef __vxworks
|
||||
unsigned SCLK_Channel : 4;
|
||||
unsigned SCLK_Module : 1;
|
||||
unsigned MOSI_Channel : 4;
|
||||
unsigned MOSI_Module : 1;
|
||||
unsigned MISO_Channel : 4;
|
||||
unsigned MISO_Module : 1;
|
||||
unsigned SS_Channel : 4;
|
||||
unsigned SS_Module : 1;
|
||||
#else
|
||||
unsigned SS_Module : 1;
|
||||
unsigned SS_Channel : 4;
|
||||
unsigned MISO_Module : 1;
|
||||
unsigned MISO_Channel : 4;
|
||||
unsigned MOSI_Module : 1;
|
||||
unsigned MOSI_Channel : 4;
|
||||
unsigned SCLK_Module : 1;
|
||||
unsigned SCLK_Channel : 4;
|
||||
#endif
|
||||
};
|
||||
struct{
|
||||
unsigned value : 20;
|
||||
};
|
||||
} tChannels;
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tStatus_IfaceConstants;
|
||||
|
||||
virtual tStatus readStatus(tRioStatusCode *status) = 0;
|
||||
virtual bool readStatus_ReceivedDataOverflow(tRioStatusCode *status) = 0;
|
||||
virtual bool readStatus_Idle(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReceivedData_IfaceConstants;
|
||||
|
||||
virtual unsigned int readReceivedData(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tDataToLoad_IfaceConstants;
|
||||
|
||||
virtual void writeDataToLoad(unsigned int value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned int readDataToLoad(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tConfig_IfaceConstants;
|
||||
|
||||
virtual void writeConfig(tConfig value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_BusBitWidth(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ClockHalfPeriodDelay(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_MSBfirst(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_DataOnFalling(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_LatchFirst(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_LatchLast(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_FramePolarity(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_WriteOnly(bool value, tRioStatusCode *status) = 0;
|
||||
virtual void writeConfig_ClockPolarity(bool value, tRioStatusCode *status) = 0;
|
||||
virtual tConfig readConfig(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_BusBitWidth(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readConfig_ClockHalfPeriodDelay(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_MSBfirst(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_DataOnFalling(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_LatchFirst(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_LatchLast(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_FramePolarity(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_WriteOnly(tRioStatusCode *status) = 0;
|
||||
virtual bool readConfig_ClockPolarity(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tClearReceivedData_IfaceConstants;
|
||||
|
||||
virtual void strobeClearReceivedData(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReceivedElements_IfaceConstants;
|
||||
|
||||
virtual unsigned short readReceivedElements(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tLoad_IfaceConstants;
|
||||
|
||||
virtual void strobeLoad(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReset_IfaceConstants;
|
||||
|
||||
virtual void strobeReset(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tChannels_IfaceConstants;
|
||||
|
||||
virtual void writeChannels(tChannels value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_SCLK_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_SCLK_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_MOSI_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_MOSI_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_MISO_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_MISO_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_SS_Channel(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual void writeChannels_SS_Module(unsigned char value, tRioStatusCode *status) = 0;
|
||||
virtual tChannels readChannels(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_SCLK_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_SCLK_Module(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_MOSI_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_MOSI_Module(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_MISO_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_MISO_Module(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_SS_Channel(tRioStatusCode *status) = 0;
|
||||
virtual unsigned char readChannels_SS_Module(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tAvailableToLoad_IfaceConstants;
|
||||
|
||||
virtual unsigned short readAvailableToLoad(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tReadReceivedData_IfaceConstants;
|
||||
|
||||
virtual void strobeReadReceivedData(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tSPI(const tSPI&);
|
||||
void operator=(const tSPI&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_SPI_h__
|
||||
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) National Instruments 2008. All Rights Reserved.
|
||||
// Do Not Edit... this file is generated!
|
||||
|
||||
#ifndef __nFRC_2012_1_6_4_SysWatchdog_h__
|
||||
#define __nFRC_2012_1_6_4_SysWatchdog_h__
|
||||
|
||||
#include "tSystemInterface.h"
|
||||
|
||||
namespace nFPGA
|
||||
{
|
||||
namespace nFRC_2012_1_6_4
|
||||
{
|
||||
|
||||
class tSysWatchdog
|
||||
{
|
||||
public:
|
||||
tSysWatchdog(){}
|
||||
virtual ~tSysWatchdog(){}
|
||||
|
||||
virtual tSystemInterface* getSystemInterface() = 0;
|
||||
static tSysWatchdog* create(tRioStatusCode *status);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
kNumSystems = 1,
|
||||
} tIfaceConstants;
|
||||
|
||||
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tCommand_IfaceConstants;
|
||||
|
||||
virtual void writeCommand(unsigned short value, tRioStatusCode *status) = 0;
|
||||
virtual unsigned short readCommand(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tChallenge_IfaceConstants;
|
||||
|
||||
virtual unsigned char readChallenge(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tActive_IfaceConstants;
|
||||
|
||||
virtual void writeActive(bool value, tRioStatusCode *status) = 0;
|
||||
virtual bool readActive(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
} tTimer_IfaceConstants;
|
||||
|
||||
virtual unsigned int readTimer(tRioStatusCode *status) = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
tSysWatchdog(const tSysWatchdog&);
|
||||
void operator=(const tSysWatchdog&);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __nFRC_2012_1_6_4_SysWatchdog_h__
|
||||
@@ -12,9 +12,9 @@ public:
|
||||
tSystemInterface(){}
|
||||
virtual ~tSystemInterface(){}
|
||||
|
||||
virtual uint16_t getExpectedFPGAVersion()=0;
|
||||
virtual uint32_t getExpectedFPGARevision()=0;
|
||||
virtual uint32_t * getExpectedFPGASignature()=0;
|
||||
virtual const uint16_t getExpectedFPGAVersion()=0;
|
||||
virtual const uint32_t getExpectedFPGARevision()=0;
|
||||
virtual const uint32_t * const getExpectedFPGASignature()=0;
|
||||
virtual void getHardwareFpgaSignature(uint32_t *guid_ptr, tRioStatusCode *status)=0;
|
||||
virtual uint32_t getLVHandle(tRioStatusCode *status)=0;
|
||||
virtual uint32_t getHandle()=0;
|
||||
@@ -23,4 +23,3 @@ public:
|
||||
}
|
||||
|
||||
#endif // __tSystemInterface_h__
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "NetworkCommunication/FRCComm.h"
|
||||
#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "NetworkCommunication/LoadOut.h"
|
||||
#include "ChipObject/nInterfaceGlobals.h"
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <unistd.h>
|
||||
@@ -116,26 +115,24 @@ int HALSetErrorData(const char *errors, int errorsLength, int wait_ms)
|
||||
return setErrorData(errors, errorsLength, wait_ms);
|
||||
}
|
||||
|
||||
int HALSetUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength,
|
||||
int wait_ms)
|
||||
int HALGetControlWord(HALControlWord *data)
|
||||
{
|
||||
return setUserDsLcdData(userDsLcdData, userDsLcdDataLength, wait_ms);
|
||||
return FRC_NetworkCommunication_getControlWord((ControlWord_t*) data);
|
||||
}
|
||||
|
||||
int HALOverrideIOConfig(const char *ioConfig, int wait_ms)
|
||||
int HALGetAllianceStation(enum HALAllianceStationID *allianceStation)
|
||||
{
|
||||
return overrideIOConfig(ioConfig, wait_ms);
|
||||
return FRC_NetworkCommunication_getAllianceStation((AllianceStationID_t*) allianceStation);
|
||||
}
|
||||
|
||||
int HALGetDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength,
|
||||
int wait_ms)
|
||||
int HALGetJoystickAxes(uint8_t joystickNum, HALJoystickAxes *axes, uint8_t maxAxes)
|
||||
{
|
||||
return getDynamicControlData(type, dynamicData, maxLength, wait_ms);
|
||||
return FRC_NetworkCommunication_getJoystickAxes(joystickNum, (JoystickAxes_t*) axes, maxAxes);
|
||||
}
|
||||
|
||||
int HALGetCommonControlData(HALCommonControlData *data, int wait_ms)
|
||||
int HALGetJoystickButtons(uint8_t joystickNum, HALJoystickButtons *buttons, uint8_t *count)
|
||||
{
|
||||
return getRecentCommonControlData((FRCCommonControlData*) data, wait_ms);
|
||||
return FRC_NetworkCommunication_getJoystickButtons(joystickNum, buttons, count);
|
||||
}
|
||||
|
||||
void HALSetNewDataSem(pthread_mutex_t * param)
|
||||
@@ -240,8 +237,12 @@ void HALNetworkCommunicationObserveUserProgramTest(void)
|
||||
uint32_t HALReport(uint8_t resource, uint8_t instanceNumber, uint8_t context,
|
||||
const char *feature)
|
||||
{
|
||||
//return FRC_NetworkCommunication_nUsageReporting_report( resource, instanceNumber, context, feature);
|
||||
return 0;
|
||||
if(feature == NULL)
|
||||
{
|
||||
feature = "";
|
||||
}
|
||||
|
||||
return FRC_NetworkCommunication_nUsageReporting_report(resource, instanceNumber, context, feature);
|
||||
}
|
||||
|
||||
// TODO: HACKS
|
||||
@@ -267,12 +268,3 @@ void imaqGetLastError()
|
||||
void niTimestamp64()
|
||||
{
|
||||
}
|
||||
|
||||
#include "NetworkCommunication/LoadOut.h"
|
||||
namespace nLoadOut
|
||||
{
|
||||
bool getModulePresence(tModuleType moduleType, uint8_t moduleNumber)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,23 @@ public:
|
||||
* @return This should return 0 if a message was populated, non-0 if no message was not populated.
|
||||
*/
|
||||
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
|
||||
|
||||
/**
|
||||
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
|
||||
*
|
||||
* This function may be called from multiple contexts and must therefore be reentrant.
|
||||
*
|
||||
* This function will return detailed hardware status if available for diagnostics of the CAN interface.
|
||||
*
|
||||
* @param busOffCount The number of times that sendMessage failed with a busOff error indicating that messages
|
||||
* are not successfully transmitted on the bus.
|
||||
* @param txFullCount The number of times that sendMessage failed with a txFifoFull error indicating that messages
|
||||
* are not successfully received by any CAN device.
|
||||
* @param receiveErrorCount The count of receive errors as reported by the CAN driver.
|
||||
* @param transmitErrorCount The count of transmit errors as reported by the CAN driver.
|
||||
* @return This should return 0 if all status was retrieved successfully or an error code if not.
|
||||
*/
|
||||
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace nCANSessionMux
|
||||
void openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
|
||||
void closeStreamSession(uint32_t sessionHandle);
|
||||
void readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
|
||||
void getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -53,6 +54,7 @@ extern "C"
|
||||
void FRC_NetworkCommunication_CANSessionMux_openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
|
||||
void FRC_NetworkCommunication_CANSessionMux_closeStreamSession(uint32_t sessionHandle);
|
||||
void FRC_NetworkCommunication_CANSessionMux_readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
|
||||
void FRC_NetworkCommunication_CANSessionMux_getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -32,133 +32,52 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Commandeer some bytes at the end for advanced I/O feedback.
|
||||
#define IO_CONFIG_DATA_SIZE 32
|
||||
#define SYS_STATUS_DATA_SIZE 44
|
||||
#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE)
|
||||
#define USER_DS_LCD_DATA_SIZE 128
|
||||
|
||||
struct FRCCommonControlData{
|
||||
uint16_t packetIndex;
|
||||
union {
|
||||
uint8_t control;
|
||||
#ifndef __vxworks
|
||||
struct {
|
||||
uint8_t checkVersions :1;
|
||||
uint8_t test :1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t reset : 1;
|
||||
};
|
||||
#else
|
||||
struct {
|
||||
uint8_t reset : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t test :1;
|
||||
uint8_t checkVersions :1;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
uint8_t dsDigitalIn;
|
||||
uint16_t teamID;
|
||||
|
||||
char dsID_Alliance;
|
||||
char dsID_Position;
|
||||
|
||||
union {
|
||||
int8_t stick0Axes[6];
|
||||
struct {
|
||||
int8_t stick0Axis1;
|
||||
int8_t stick0Axis2;
|
||||
int8_t stick0Axis3;
|
||||
int8_t stick0Axis4;
|
||||
int8_t stick0Axis5;
|
||||
int8_t stick0Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick0Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick1Axes[6];
|
||||
struct {
|
||||
int8_t stick1Axis1;
|
||||
int8_t stick1Axis2;
|
||||
int8_t stick1Axis3;
|
||||
int8_t stick1Axis4;
|
||||
int8_t stick1Axis5;
|
||||
int8_t stick1Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick1Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick2Axes[6];
|
||||
struct {
|
||||
int8_t stick2Axis1;
|
||||
int8_t stick2Axis2;
|
||||
int8_t stick2Axis3;
|
||||
int8_t stick2Axis4;
|
||||
int8_t stick2Axis5;
|
||||
int8_t stick2Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick2Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick3Axes[6];
|
||||
struct {
|
||||
int8_t stick3Axis1;
|
||||
int8_t stick3Axis2;
|
||||
int8_t stick3Axis3;
|
||||
int8_t stick3Axis4;
|
||||
int8_t stick3Axis5;
|
||||
int8_t stick3Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick3Buttons; // Left-most 4 bits are unused
|
||||
|
||||
//Analog inputs are 10 bit right-justified
|
||||
uint16_t analog1;
|
||||
uint16_t analog2;
|
||||
uint16_t analog3;
|
||||
uint16_t analog4;
|
||||
|
||||
uint64_t cRIOChecksum;
|
||||
uint32_t FPGAChecksum0;
|
||||
uint32_t FPGAChecksum1;
|
||||
uint32_t FPGAChecksum2;
|
||||
uint32_t FPGAChecksum3;
|
||||
|
||||
char versionData[8];
|
||||
enum AllianceStationID_t {
|
||||
kAllianceStationID_red1,
|
||||
kAllianceStationID_red2,
|
||||
kAllianceStationID_red3,
|
||||
kAllianceStationID_blue1,
|
||||
kAllianceStationID_blue2,
|
||||
kAllianceStationID_blue3,
|
||||
};
|
||||
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
|
||||
struct ControlWord_t {
|
||||
#ifndef __vxworks
|
||||
uint32_t enabled : 1;
|
||||
uint32_t autonomous : 1;
|
||||
uint32_t test :1;
|
||||
uint32_t eStop : 1;
|
||||
uint32_t fmsAttached:1;
|
||||
uint32_t dsAttached:1;
|
||||
uint32_t control_reserved : 26;
|
||||
#else
|
||||
uint32_t control_reserved : 26;
|
||||
uint32_t dsAttached:1;
|
||||
uint32_t fmsAttached:1;
|
||||
uint32_t eStop : 1;
|
||||
uint32_t test :1;
|
||||
uint32_t autonomous : 1;
|
||||
uint32_t enabled : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct JoystickAxes_t {
|
||||
uint16_t count;
|
||||
int16_t axes[1];
|
||||
};
|
||||
|
||||
struct JoystickPOV_t {
|
||||
uint16_t count;
|
||||
uint16_t povs[1];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance);
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision);
|
||||
#endif
|
||||
int EXPORT_FUNC getCommonControlData(struct FRCCommonControlData *data, int wait_ms);
|
||||
int EXPORT_FUNC getRecentCommonControlData(struct FRCCommonControlData *commonData, int wait_ms);
|
||||
int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms);
|
||||
int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
|
||||
int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
@@ -166,30 +85,28 @@ extern "C" {
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
|
||||
int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
|
||||
int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms);
|
||||
|
||||
#ifdef SIMULATION
|
||||
void EXPORT_FUNC setNewDataSem(HANDLE);
|
||||
#else
|
||||
# if defined (__vxworks)
|
||||
void EXPORT_FUNC setNewDataSem(SEM_ID);
|
||||
void EXPORT_FUNC setResyncSem(SEM_ID);
|
||||
# else
|
||||
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
|
||||
void EXPORT_FUNC setResyncSem(pthread_mutex_t *);
|
||||
# endif
|
||||
void EXPORT_FUNC signalResyncActionDone(void);
|
||||
#endif
|
||||
|
||||
// this uint32_t is really a LVRefNum
|
||||
void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC setResyncOccurRef(uint32_t refnum);
|
||||
#endif
|
||||
int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
|
||||
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs);
|
||||
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define kMaxModuleNumber 2
|
||||
namespace nLoadOut
|
||||
{
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
typedef enum {
|
||||
kModuleType_Unknown = 0x00,
|
||||
kModuleType_Analog = 0x01,
|
||||
@@ -23,15 +24,18 @@ namespace nLoadOut
|
||||
kModuleType_Solenoid = 0x03,
|
||||
} tModuleType;
|
||||
bool EXPORT_FUNC getModulePresence(tModuleType moduleType, uint8_t moduleNumber);
|
||||
#endif
|
||||
typedef enum {
|
||||
kTargetClass_Unknown = 0x00,
|
||||
kTargetClass_FRC1 = 0x10,
|
||||
kTargetClass_FRC2 = 0x20,
|
||||
kTargetClass_FRC3 = 0x30,
|
||||
kTargetClass_RoboRIO = 0x40,
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog,
|
||||
kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital,
|
||||
kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid,
|
||||
#endif
|
||||
kTargetClass_FamilyMask = 0xF0,
|
||||
kTargetClass_ModuleMask = 0x0F,
|
||||
} tTargetClass;
|
||||
@@ -42,7 +46,9 @@ namespace nLoadOut
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber);
|
||||
#endif
|
||||
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
ni-libraries/libFRC_NetworkCommunication.so
Executable file → Normal file
BIN
ni-libraries/libFRC_NetworkCommunication.so
Executable file → Normal file
Binary file not shown.
BIN
ni-libraries/libFRC_NetworkCommunication.so.1
Executable file → Normal file
BIN
ni-libraries/libFRC_NetworkCommunication.so.1
Executable file → Normal file
Binary file not shown.
2
ni-libraries/libFRC_NetworkCommunication.so.1.5
Normal file
2
ni-libraries/libFRC_NetworkCommunication.so.1.5
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libFRC_NetworkCommunication.so.1.5.0 )
|
||||
BIN
ni-libraries/libFRC_NetworkCommunication.so.1.5.0
Executable file
BIN
ni-libraries/libFRC_NetworkCommunication.so.1.5.0
Executable file
Binary file not shown.
2
ni-libraries/libFRC_NetworkCommunicationLV.so
Normal file
2
ni-libraries/libFRC_NetworkCommunicationLV.so
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libFRC_NetworkCommunicationLV.so.1 )
|
||||
2
ni-libraries/libFRC_NetworkCommunicationLV.so.1
Normal file
2
ni-libraries/libFRC_NetworkCommunicationLV.so.1
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libFRC_NetworkCommunicationLV.so.1.5 )
|
||||
2
ni-libraries/libFRC_NetworkCommunicationLV.so.1.5
Normal file
2
ni-libraries/libFRC_NetworkCommunicationLV.so.1.5
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libFRC_NetworkCommunicationLV.so.1.5.0 )
|
||||
BIN
ni-libraries/libFRC_NetworkCommunicationLV.so.1.5.0
Executable file
BIN
ni-libraries/libFRC_NetworkCommunicationLV.so.1.5.0
Executable file
Binary file not shown.
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so
Executable file → Normal file
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so
Executable file → Normal file
Binary file not shown.
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so.1
Executable file → Normal file
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so.1
Executable file → Normal file
Binary file not shown.
2
ni-libraries/libRoboRIO_FRC_ChipObject.so.1.2
Normal file
2
ni-libraries/libRoboRIO_FRC_ChipObject.so.1.2
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libRoboRIO_FRC_ChipObject.so.1.2.0 )
|
||||
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so.1.2.0
Executable file
BIN
ni-libraries/libRoboRIO_FRC_ChipObject.so.1.2.0
Executable file
Binary file not shown.
BIN
ni-libraries/libfrccanfirmwareupdate.so
Executable file
BIN
ni-libraries/libfrccanfirmwareupdate.so
Executable file
Binary file not shown.
2
ni-libraries/libfrccansae.so
Normal file
2
ni-libraries/libfrccansae.so
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libfrccansae.so.1 )
|
||||
2
ni-libraries/libfrccansae.so.1
Normal file
2
ni-libraries/libfrccansae.so.1
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libfrccansae.so.1.0 )
|
||||
2
ni-libraries/libfrccansae.so.1.0
Normal file
2
ni-libraries/libfrccansae.so.1.0
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libfrccansae.so.1.0.0 )
|
||||
BIN
ni-libraries/libfrccansae.so.1.0.0
Executable file
BIN
ni-libraries/libfrccansae.so.1.0.0
Executable file
Binary file not shown.
BIN
ni-libraries/libi2c.so
Executable file → Normal file
BIN
ni-libraries/libi2c.so
Executable file → Normal file
Binary file not shown.
BIN
ni-libraries/libi2c.so.1
Executable file → Normal file
BIN
ni-libraries/libi2c.so.1
Executable file → Normal file
Binary file not shown.
2
ni-libraries/libi2c.so.1.0
Normal file
2
ni-libraries/libi2c.so.1.0
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libi2c.so.1.0.0 )
|
||||
BIN
ni-libraries/libi2c.so.1.0.0
Executable file
BIN
ni-libraries/libi2c.so.1.0.0
Executable file
Binary file not shown.
BIN
ni-libraries/libspi.so
Executable file → Normal file
BIN
ni-libraries/libspi.so
Executable file → Normal file
Binary file not shown.
BIN
ni-libraries/libspi.so.1
Executable file → Normal file
BIN
ni-libraries/libspi.so.1
Executable file → Normal file
Binary file not shown.
2
ni-libraries/libspi.so.1.0
Normal file
2
ni-libraries/libspi.so.1.0
Normal file
@@ -0,0 +1,2 @@
|
||||
OUTPUT_FORMAT(elf32-littlearm)
|
||||
GROUP ( libspi.so.1.0.0 )
|
||||
BIN
ni-libraries/libspi.so.1.0.0
Executable file
BIN
ni-libraries/libspi.so.1.0.0
Executable file
Binary file not shown.
Binary file not shown.
@@ -1,26 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __ANALOG_IO_BUTTON_H__
|
||||
#define __ANALOG_IO_BUTTON_H__
|
||||
|
||||
#include "Buttons/Button.h"
|
||||
|
||||
class AnalogIOButton : public Trigger
|
||||
{
|
||||
public:
|
||||
static const double kThreshold;
|
||||
|
||||
AnalogIOButton(int port);
|
||||
virtual ~AnalogIOButton() {}
|
||||
virtual bool Get();
|
||||
|
||||
private:
|
||||
int m_port;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __DIGITAL_IO_BUTTON_H__
|
||||
#define __DIGITAL_IO_BUTTON_H__
|
||||
|
||||
#include "Buttons/Button.h"
|
||||
|
||||
class DigitalIOButton: public Button
|
||||
{
|
||||
public:
|
||||
static const bool kActiveState;
|
||||
|
||||
DigitalIOButton(int port);
|
||||
virtual ~DigitalIOButton() {}
|
||||
|
||||
virtual bool Get();
|
||||
|
||||
private:
|
||||
int m_port;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,16 +1,15 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. All Rights Reserved. */
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "Dashboard.h"
|
||||
#include "DriverStationEnhancedIO.h"
|
||||
#include "SensorBase.h"
|
||||
#include "Task.h"
|
||||
|
||||
struct HALCommonControlData;
|
||||
struct HALControlWord;
|
||||
class AnalogInput;
|
||||
|
||||
/**
|
||||
@@ -29,18 +28,12 @@ public:
|
||||
virtual ~DriverStation();
|
||||
static DriverStation *GetInstance();
|
||||
|
||||
static const uint32_t kBatteryChannel = 7;
|
||||
static const uint32_t kJoystickPorts = 4;
|
||||
static const uint32_t kJoystickAxes = 6;
|
||||
|
||||
float GetStickAxis(uint32_t stick, uint32_t axis);
|
||||
short GetStickButtons(uint32_t stick);
|
||||
|
||||
float GetAnalogIn(uint32_t channel);
|
||||
bool GetDigitalIn(uint32_t channel);
|
||||
void SetDigitalOut(uint32_t channel, bool value);
|
||||
bool GetDigitalOut(uint32_t channel);
|
||||
|
||||
bool IsEnabled();
|
||||
bool IsDisabled();
|
||||
bool IsAutonomous();
|
||||
@@ -49,13 +42,11 @@ public:
|
||||
bool IsNewControlData();
|
||||
bool IsFMSAttached();
|
||||
|
||||
uint32_t GetPacketNumber();
|
||||
Alliance GetAlliance();
|
||||
uint32_t GetLocation();
|
||||
void WaitForData();
|
||||
double GetMatchTime();
|
||||
float GetBatteryVoltage();
|
||||
uint16_t GetTeamNumber();
|
||||
|
||||
// Get the default dashboard packers. These instances stay around even after
|
||||
// a call to SetHigh|LowPriorityDashboardPackerToUse() changes which packer
|
||||
@@ -92,11 +83,6 @@ public:
|
||||
m_dashboardInUseLow = db;
|
||||
}
|
||||
|
||||
DriverStationEnhancedIO& GetEnhancedIO()
|
||||
{
|
||||
return m_enhancedIO;
|
||||
}
|
||||
|
||||
void IncrementUpdateNumber()
|
||||
{
|
||||
m_updateNumber++;
|
||||
@@ -145,14 +131,15 @@ private:
|
||||
static void InitTask(DriverStation *ds);
|
||||
static DriverStation *m_instance;
|
||||
static uint8_t m_updateNumber;
|
||||
///< TODO: Get rid of this and use the semaphore signaling
|
||||
static constexpr float kUpdatePeriod = 0.02;
|
||||
|
||||
void Run();
|
||||
|
||||
struct HALCommonControlData *m_controlData;
|
||||
HALControlWord m_controlWord;
|
||||
HALAllianceStationID m_allianceStationID;
|
||||
HALJoystickAxes m_joystickAxes[kJoystickPorts];
|
||||
HALJoystickButtons m_joystickButtons[kJoystickPorts];
|
||||
|
||||
uint8_t m_digitalOut;
|
||||
AnalogInput *m_batteryChannel;
|
||||
MUTEX_ID m_statusDataSemaphore;
|
||||
Task m_task;
|
||||
Dashboard m_dashboardHigh; // the default dashboard packers
|
||||
@@ -161,7 +148,6 @@ private:
|
||||
DashboardBase* m_dashboardInUseLow;
|
||||
SEMAPHORE_ID m_newControlData;
|
||||
MUTEX_ID m_packetDataAvailableSem;
|
||||
DriverStationEnhancedIO m_enhancedIO;
|
||||
MULTIWAIT_ID m_waitForDataSem;
|
||||
double m_approxMatchTimeOffset;
|
||||
bool m_userInDisabled;
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "ErrorBase.h"
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include "HAL/HAL.hpp"
|
||||
|
||||
#include "HAL/Semaphore.hpp"
|
||||
|
||||
#define kAnalogInputResolution ((double)((1<<14)-1))
|
||||
#define kAnalogInputReference 3.3
|
||||
#define kAnalogOutputResolution ((double)((1<<8)-1))
|
||||
#define kAnalogOutputReference 4.0
|
||||
#define kAccelOffset 8300
|
||||
#define kAccelScale 3300.0
|
||||
#define kSupportedAPIVersion 1
|
||||
|
||||
/**
|
||||
* Interact with the more complete I/O available from the
|
||||
* newest driver station. Get a reference to an object
|
||||
* of this type by calling GetEnhancedIO() on the DriverStation object.
|
||||
*/
|
||||
class DriverStationEnhancedIO : public ErrorBase
|
||||
{
|
||||
// Can only be constructed by the DriverStation class.
|
||||
friend class DriverStation;
|
||||
|
||||
#pragma pack(push,1)
|
||||
// BEGIN: Definitions from the Cypress firmware
|
||||
typedef struct
|
||||
{
|
||||
uint16_t digital;
|
||||
uint16_t digital_oe;
|
||||
uint16_t digital_pe;
|
||||
uint16_t pwm_compare[4];
|
||||
uint16_t pwm_period[2];
|
||||
uint8_t dac[2];
|
||||
uint8_t leds;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
// Bits are inverted from cypress fw because of big-endian!
|
||||
uint8_t pwm_enable : 4;
|
||||
uint8_t comparator_enable : 2;
|
||||
uint8_t quad_index_enable : 2;
|
||||
};
|
||||
uint8_t enables;
|
||||
};
|
||||
uint8_t fixed_digital_out;
|
||||
} output_t; //data to IO (23 bytes)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t api_version;
|
||||
uint8_t fw_version;
|
||||
int16_t analog[8];
|
||||
uint16_t digital;
|
||||
int16_t accel[3];
|
||||
int16_t quad[2];
|
||||
uint8_t buttons;
|
||||
uint8_t capsense_slider;
|
||||
uint8_t capsense_proximity;
|
||||
} input_t; //data from IO (33 bytes)
|
||||
// END: Definitions from the Cypress firmware
|
||||
|
||||
// Dynamic block definitions
|
||||
typedef struct
|
||||
{
|
||||
uint8_t size; // Must be 25 (size remaining in the block not counting the size variable)
|
||||
uint8_t id; // Must be 18
|
||||
output_t data;
|
||||
uint8_t flags;
|
||||
} status_block_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t size; // Must be 34
|
||||
uint8_t id; // Must be 17
|
||||
input_t data;
|
||||
} control_block_t;
|
||||
#pragma pack(pop)
|
||||
|
||||
enum tBlockID
|
||||
{
|
||||
kInputBlockID = HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input,
|
||||
kOutputBlockID = HALFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output,
|
||||
};
|
||||
enum tStatusFlags {kStatusValid = 0x01, kStatusConfigChanged = 0x02, kForceEnhancedMode = 0x04};
|
||||
|
||||
public:
|
||||
enum tDigitalConfig {kUnknown, kInputFloating, kInputPullUp, kInputPullDown, kOutput, kPWM, kAnalogComparator};
|
||||
enum tAccelChannel {kAccelX = 0, kAccelY = 1, kAccelZ = 2};
|
||||
enum tPWMPeriodChannels {kPWMChannels1and2, kPWMChannels3and4};
|
||||
|
||||
double GetAcceleration(tAccelChannel channel);
|
||||
double GetAnalogIn(uint32_t channel);
|
||||
double GetAnalogInRatio(uint32_t channel);
|
||||
double GetAnalogOut(uint32_t channel);
|
||||
void SetAnalogOut(uint32_t channel, double value);
|
||||
bool GetButton(uint32_t channel);
|
||||
uint8_t GetButtons();
|
||||
void SetLED(uint32_t channel, bool value);
|
||||
void SetLEDs(uint8_t value);
|
||||
bool GetDigital(uint32_t channel);
|
||||
uint16_t GetDigitals();
|
||||
void SetDigitalOutput(uint32_t channel, bool value);
|
||||
tDigitalConfig GetDigitalConfig(uint32_t channel);
|
||||
void SetDigitalConfig(uint32_t channel, tDigitalConfig config);
|
||||
double GetPWMPeriod(tPWMPeriodChannels channels);
|
||||
void SetPWMPeriod(tPWMPeriodChannels channels, double period);
|
||||
bool GetFixedDigitalOutput(uint32_t channel);
|
||||
void SetFixedDigitalOutput(uint32_t channel, bool value);
|
||||
int16_t GetEncoder(uint32_t encoderNumber);
|
||||
void ResetEncoder(uint32_t encoderNumber);
|
||||
bool GetEncoderIndexEnable(uint32_t encoderNumber);
|
||||
void SetEncoderIndexEnable(uint32_t encoderNumber, bool enable);
|
||||
double GetTouchSlider();
|
||||
double GetPWMOutput(uint32_t channel);
|
||||
void SetPWMOutput(uint32_t channel, double value);
|
||||
uint8_t GetFirmwareVersion();
|
||||
|
||||
private:
|
||||
DriverStationEnhancedIO();
|
||||
virtual ~DriverStationEnhancedIO();
|
||||
void UpdateData();
|
||||
void MergeConfigIntoOutput(const status_block_t &dsOutputBlock, status_block_t &localCache);
|
||||
bool IsConfigEqual(const status_block_t &dsOutputBlock, const status_block_t &localCache);
|
||||
|
||||
// Usage Guidelines...
|
||||
DISALLOW_COPY_AND_ASSIGN(DriverStationEnhancedIO);
|
||||
|
||||
control_block_t m_inputData;
|
||||
status_block_t m_outputData;
|
||||
MUTEX_ID m_inputDataSemaphore;
|
||||
MUTEX_ID m_outputDataSemaphore;
|
||||
bool m_inputValid;
|
||||
bool m_outputValid;
|
||||
bool m_configChanged;
|
||||
bool m_requestEnhancedEnable;
|
||||
int16_t m_encoderOffsets[2];
|
||||
};
|
||||
@@ -1,58 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "SensorBase.h"
|
||||
#include "HAL/Semaphore.hpp"
|
||||
#include <stdarg.h>
|
||||
|
||||
/**
|
||||
* Provide access to "LCD" on the Driver Station.
|
||||
* This is the Messages box on the DS Operation tab.
|
||||
*
|
||||
* Buffer the printed data locally and then send it
|
||||
* when UpdateLCD is called.
|
||||
*/
|
||||
class DriverStationLCD : public SensorBase
|
||||
{
|
||||
public:
|
||||
static const uint32_t kSyncTimeout_ms = 20;
|
||||
static const uint16_t kFullDisplayTextCommand = 0x9FFF;
|
||||
static const int32_t kLineLength = 21;
|
||||
static const int32_t kNumLines = 6;
|
||||
enum Line
|
||||
{
|
||||
kMain_Line6 = 0,
|
||||
kUser_Line1 = 0,
|
||||
kUser_Line2 = 1,
|
||||
kUser_Line3 = 2,
|
||||
kUser_Line4 = 3,
|
||||
kUser_Line5 = 4,
|
||||
kUser_Line6 = 5
|
||||
};
|
||||
|
||||
virtual ~DriverStationLCD();
|
||||
static DriverStationLCD *GetInstance();
|
||||
|
||||
void UpdateLCD();
|
||||
void Printf(Line line, int32_t startingColumn, const char *writeFmt, ...);
|
||||
void VPrintf(Line line, int32_t startingColumn, const char *writeFmt, va_list args);
|
||||
void PrintfLine(Line line, const char *writeFmt, ...);
|
||||
void VPrintfLine(Line line, const char *writeFmt, va_list args);
|
||||
|
||||
void Clear();
|
||||
|
||||
protected:
|
||||
DriverStationLCD();
|
||||
|
||||
private:
|
||||
static void InitTask(DriverStationLCD *ds);
|
||||
static DriverStationLCD *m_instance;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DriverStationLCD);
|
||||
char *m_textBuffer;
|
||||
MUTEX_ID m_textBufferSemaphore;
|
||||
};
|
||||
@@ -50,6 +50,23 @@ public:
|
||||
* @return This should return 0 if a message was populated, non-0 if no message was not populated.
|
||||
*/
|
||||
virtual int32_t receiveMessage(uint32_t &messageID, uint8_t *data, uint8_t &dataSize) = 0;
|
||||
|
||||
/**
|
||||
* This entry-point of the CANInterfacePlugin returns status of the CAN bus.
|
||||
*
|
||||
* This function may be called from multiple contexts and must therefore be reentrant.
|
||||
*
|
||||
* This function will return detailed hardware status if available for diagnostics of the CAN interface.
|
||||
*
|
||||
* @param busOffCount The number of times that sendMessage failed with a busOff error indicating that messages
|
||||
* are not successfully transmitted on the bus.
|
||||
* @param txFullCount The number of times that sendMessage failed with a txFifoFull error indicating that messages
|
||||
* are not successfully received by any CAN device.
|
||||
* @param receiveErrorCount The count of receive errors as reported by the CAN driver.
|
||||
* @param transmitErrorCount The count of transmit errors as reported by the CAN driver.
|
||||
* @return This should return 0 if all status was retrieved successfully or an error code if not.
|
||||
*/
|
||||
virtual int32_t getStatus(uint32_t &busOffCount, uint32_t &txFullCount, uint32_t &receiveErrorCount, uint32_t &transmitErrorCount) {return 0;}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -41,6 +41,7 @@ namespace nCANSessionMux
|
||||
void openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
|
||||
void closeStreamSession(uint32_t sessionHandle);
|
||||
void readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
|
||||
void getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -53,6 +54,7 @@ extern "C"
|
||||
void FRC_NetworkCommunication_CANSessionMux_openStreamSession(uint32_t *sessionHandle, uint32_t messageID, uint32_t messageIDMask, uint32_t maxMessages, int32_t *status);
|
||||
void FRC_NetworkCommunication_CANSessionMux_closeStreamSession(uint32_t sessionHandle);
|
||||
void FRC_NetworkCommunication_CANSessionMux_readStreamSession(uint32_t sessionHandle, struct tCANStreamMessage *messages, uint32_t messagesToRead, uint32_t *messagesRead, int32_t *status);
|
||||
void FRC_NetworkCommunication_CANSessionMux_getCANStatus(float *percentBusUtilization, uint32_t *busOffCount, uint32_t *txFullCount, uint32_t *receiveErrorCount, uint32_t *transmitErrorCount, int32_t *status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -32,133 +32,52 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Commandeer some bytes at the end for advanced I/O feedback.
|
||||
#define IO_CONFIG_DATA_SIZE 32
|
||||
#define SYS_STATUS_DATA_SIZE 44
|
||||
#define USER_STATUS_DATA_SIZE (984 - IO_CONFIG_DATA_SIZE - SYS_STATUS_DATA_SIZE)
|
||||
#define USER_DS_LCD_DATA_SIZE 128
|
||||
|
||||
struct FRCCommonControlData{
|
||||
uint16_t packetIndex;
|
||||
union {
|
||||
uint8_t control;
|
||||
#ifndef __vxworks
|
||||
struct {
|
||||
uint8_t checkVersions :1;
|
||||
uint8_t test :1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t reset : 1;
|
||||
};
|
||||
#else
|
||||
struct {
|
||||
uint8_t reset : 1;
|
||||
uint8_t notEStop : 1;
|
||||
uint8_t enabled : 1;
|
||||
uint8_t autonomous : 1;
|
||||
uint8_t fmsAttached:1;
|
||||
uint8_t resync : 1;
|
||||
uint8_t test :1;
|
||||
uint8_t checkVersions :1;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
uint8_t dsDigitalIn;
|
||||
uint16_t teamID;
|
||||
|
||||
char dsID_Alliance;
|
||||
char dsID_Position;
|
||||
|
||||
union {
|
||||
int8_t stick0Axes[6];
|
||||
struct {
|
||||
int8_t stick0Axis1;
|
||||
int8_t stick0Axis2;
|
||||
int8_t stick0Axis3;
|
||||
int8_t stick0Axis4;
|
||||
int8_t stick0Axis5;
|
||||
int8_t stick0Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick0Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick1Axes[6];
|
||||
struct {
|
||||
int8_t stick1Axis1;
|
||||
int8_t stick1Axis2;
|
||||
int8_t stick1Axis3;
|
||||
int8_t stick1Axis4;
|
||||
int8_t stick1Axis5;
|
||||
int8_t stick1Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick1Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick2Axes[6];
|
||||
struct {
|
||||
int8_t stick2Axis1;
|
||||
int8_t stick2Axis2;
|
||||
int8_t stick2Axis3;
|
||||
int8_t stick2Axis4;
|
||||
int8_t stick2Axis5;
|
||||
int8_t stick2Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick2Buttons; // Left-most 4 bits are unused
|
||||
|
||||
union {
|
||||
int8_t stick3Axes[6];
|
||||
struct {
|
||||
int8_t stick3Axis1;
|
||||
int8_t stick3Axis2;
|
||||
int8_t stick3Axis3;
|
||||
int8_t stick3Axis4;
|
||||
int8_t stick3Axis5;
|
||||
int8_t stick3Axis6;
|
||||
};
|
||||
};
|
||||
uint16_t stick3Buttons; // Left-most 4 bits are unused
|
||||
|
||||
//Analog inputs are 10 bit right-justified
|
||||
uint16_t analog1;
|
||||
uint16_t analog2;
|
||||
uint16_t analog3;
|
||||
uint16_t analog4;
|
||||
|
||||
uint64_t cRIOChecksum;
|
||||
uint32_t FPGAChecksum0;
|
||||
uint32_t FPGAChecksum1;
|
||||
uint32_t FPGAChecksum2;
|
||||
uint32_t FPGAChecksum3;
|
||||
|
||||
char versionData[8];
|
||||
enum AllianceStationID_t {
|
||||
kAllianceStationID_red1,
|
||||
kAllianceStationID_red2,
|
||||
kAllianceStationID_red3,
|
||||
kAllianceStationID_blue1,
|
||||
kAllianceStationID_blue2,
|
||||
kAllianceStationID_blue3,
|
||||
};
|
||||
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Input 17
|
||||
#define kFRC_NetworkCommunication_DynamicType_DSEnhancedIO_Output 18
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Header 19
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra1 20
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices1 21
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Extra2 22
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Vertices2 23
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Joystick 24
|
||||
#define kFRC_NetworkCommunication_DynamicType_Kinect_Custom 25
|
||||
struct ControlWord_t {
|
||||
#ifndef __vxworks
|
||||
uint32_t enabled : 1;
|
||||
uint32_t autonomous : 1;
|
||||
uint32_t test :1;
|
||||
uint32_t eStop : 1;
|
||||
uint32_t fmsAttached:1;
|
||||
uint32_t dsAttached:1;
|
||||
uint32_t control_reserved : 26;
|
||||
#else
|
||||
uint32_t control_reserved : 26;
|
||||
uint32_t dsAttached:1;
|
||||
uint32_t fmsAttached:1;
|
||||
uint32_t eStop : 1;
|
||||
uint32_t test :1;
|
||||
uint32_t autonomous : 1;
|
||||
uint32_t enabled : 1;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct JoystickAxes_t {
|
||||
uint16_t count;
|
||||
int16_t axes[1];
|
||||
};
|
||||
|
||||
struct JoystickPOV_t {
|
||||
uint16_t count;
|
||||
uint16_t povs[1];
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_Reserve(void *instance);
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC getFPGAHardwareVersion(uint16_t *fpgaVersion, uint32_t *fpgaRevision);
|
||||
#endif
|
||||
int EXPORT_FUNC getCommonControlData(struct FRCCommonControlData *data, int wait_ms);
|
||||
int EXPORT_FUNC getRecentCommonControlData(struct FRCCommonControlData *commonData, int wait_ms);
|
||||
int EXPORT_FUNC getRecentStatusData(uint8_t *batteryInt, uint8_t *batteryDec, uint8_t *dsDigitalOut, int wait_ms);
|
||||
int EXPORT_FUNC getDynamicControlData(uint8_t type, char *dynamicData, int32_t maxLength, int wait_ms);
|
||||
int EXPORT_FUNC setStatusData(float battery, uint8_t dsDigitalOut, uint8_t updateNumber,
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
@@ -166,30 +85,28 @@ extern "C" {
|
||||
const char *userDataHigh, int userDataHighLength,
|
||||
const char *userDataLow, int userDataLowLength, int wait_ms);
|
||||
int EXPORT_FUNC setErrorData(const char *errors, int errorsLength, int wait_ms);
|
||||
int EXPORT_FUNC setUserDsLcdData(const char *userDsLcdData, int userDsLcdDataLength, int wait_ms);
|
||||
int EXPORT_FUNC overrideIOConfig(const char *ioConfig, int wait_ms);
|
||||
|
||||
#ifdef SIMULATION
|
||||
void EXPORT_FUNC setNewDataSem(HANDLE);
|
||||
#else
|
||||
# if defined (__vxworks)
|
||||
void EXPORT_FUNC setNewDataSem(SEM_ID);
|
||||
void EXPORT_FUNC setResyncSem(SEM_ID);
|
||||
# else
|
||||
void EXPORT_FUNC setNewDataSem(pthread_mutex_t *);
|
||||
void EXPORT_FUNC setResyncSem(pthread_mutex_t *);
|
||||
# endif
|
||||
void EXPORT_FUNC signalResyncActionDone(void);
|
||||
#endif
|
||||
|
||||
// this uint32_t is really a LVRefNum
|
||||
void EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
|
||||
#ifndef SIMULATION
|
||||
void EXPORT_FUNC setResyncOccurRef(uint32_t refnum);
|
||||
#endif
|
||||
int EXPORT_FUNC setNewDataOccurRef(uint32_t refnum);
|
||||
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getControlWord(struct ControlWord_t *controlWord);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getAllianceStation(enum AllianceStationID_t *allianceStation);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickAxes(uint8_t joystickNum, struct JoystickAxes_t *axes, uint8_t maxAxes);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickButtons(uint8_t joystickNum, uint32_t *buttons, uint8_t *count);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_getJoystickPOVs(uint8_t joystickNum, struct JoystickPOV_t *povs, uint8_t maxPOVs);
|
||||
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_getVersionString(char *version);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
|
||||
int EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramStarting(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramDisabled(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramAutonomous(void);
|
||||
void EXPORT_FUNC FRC_NetworkCommunication_observeUserProgramTeleop(void);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define kMaxModuleNumber 2
|
||||
namespace nLoadOut
|
||||
{
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
typedef enum {
|
||||
kModuleType_Unknown = 0x00,
|
||||
kModuleType_Analog = 0x01,
|
||||
@@ -23,15 +24,18 @@ namespace nLoadOut
|
||||
kModuleType_Solenoid = 0x03,
|
||||
} tModuleType;
|
||||
bool EXPORT_FUNC getModulePresence(tModuleType moduleType, uint8_t moduleNumber);
|
||||
#endif
|
||||
typedef enum {
|
||||
kTargetClass_Unknown = 0x00,
|
||||
kTargetClass_FRC1 = 0x10,
|
||||
kTargetClass_FRC2 = 0x20,
|
||||
kTargetClass_FRC3 = 0x30,
|
||||
kTargetClass_RoboRIO = 0x40,
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
kTargetClass_FRC2_Analog = kTargetClass_FRC2 | kModuleType_Analog,
|
||||
kTargetClass_FRC2_Digital = kTargetClass_FRC2 | kModuleType_Digital,
|
||||
kTargetClass_FRC2_Solenoid = kTargetClass_FRC2 | kModuleType_Solenoid,
|
||||
#endif
|
||||
kTargetClass_FamilyMask = 0xF0,
|
||||
kTargetClass_ModuleMask = 0x0F,
|
||||
} tTargetClass;
|
||||
@@ -42,7 +46,9 @@ namespace nLoadOut
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(__vxworks) || defined(SIMULATION)
|
||||
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getModulePresence(uint32_t moduleType, uint8_t moduleNumber);
|
||||
#endif
|
||||
uint32_t EXPORT_FUNC FRC_NetworkCommunication_nLoadOut_getTargetClass();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "AnalogTrigger.h"
|
||||
#include "AnalogTriggerOutput.h"
|
||||
#include "BuiltInAccelerometer.h"
|
||||
#include "Buttons/AnalogIOButton.h"
|
||||
#include "Buttons/DigitalIOButton.h"
|
||||
#include "Buttons/InternalButton.h"
|
||||
#include "Buttons/JoystickButton.h"
|
||||
#include "Buttons/NetworkButton.h"
|
||||
@@ -44,8 +42,6 @@
|
||||
#include "DigitalSource.h"
|
||||
#include "DoubleSolenoid.h"
|
||||
#include "DriverStation.h"
|
||||
#include "DriverStationEnhancedIO.h"
|
||||
#include "DriverStationLCD.h"
|
||||
#include "Encoder.h"
|
||||
#include "ErrorBase.h"
|
||||
#include "GearTooth.h"
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "Buttons/AnalogIOButton.h"
|
||||
#include "DriverStation.h"
|
||||
|
||||
const double AnalogIOButton::kThreshold = 0.5;
|
||||
|
||||
AnalogIOButton::AnalogIOButton(int port) :
|
||||
m_port(port)
|
||||
{
|
||||
}
|
||||
|
||||
bool AnalogIOButton::Get()
|
||||
{
|
||||
return DriverStation::GetInstance()->GetEnhancedIO().GetAnalogIn(m_port) < kThreshold;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2011. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "Buttons/DigitalIOButton.h"
|
||||
#include "DriverStation.h"
|
||||
|
||||
const bool DigitalIOButton::kActiveState = false;
|
||||
|
||||
DigitalIOButton::DigitalIOButton(int port) :
|
||||
m_port(port)
|
||||
{
|
||||
}
|
||||
|
||||
bool DigitalIOButton::Get()
|
||||
{
|
||||
return DriverStation::GetInstance()->GetEnhancedIO().GetDigital(m_port) == kActiveState;
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
#include "AnalogInput.h"
|
||||
#include "HAL/cpp/Synchronized.hpp"
|
||||
#include "Timer.h"
|
||||
//#include "NetworkCommunication/FRCComm.h"
|
||||
//#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "MotorSafetyHelper.h"
|
||||
#include "Utility.h"
|
||||
#include "WPIErrors.h"
|
||||
@@ -20,13 +18,11 @@
|
||||
TLogLevel dsLogLevel = logDEBUG;
|
||||
|
||||
#define DS_LOG(level) \
|
||||
if (level > dsLogLevel) ; \
|
||||
else Log().Get(level)
|
||||
if (level > dsLogLevel) ; \
|
||||
else Log().Get(level)
|
||||
|
||||
const uint32_t DriverStation::kBatteryChannel;
|
||||
const uint32_t DriverStation::kJoystickPorts;
|
||||
const uint32_t DriverStation::kJoystickAxes;
|
||||
constexpr float DriverStation::kUpdatePeriod;
|
||||
DriverStation* DriverStation::m_instance = NULL;
|
||||
uint8_t DriverStation::m_updateNumber = 0;
|
||||
|
||||
@@ -36,9 +32,7 @@ uint8_t DriverStation::m_updateNumber = 0;
|
||||
* This is only called once the first time GetInstance() is called
|
||||
*/
|
||||
DriverStation::DriverStation()
|
||||
: m_controlData (NULL)
|
||||
, m_digitalOut (0)
|
||||
, m_batteryChannel (NULL)
|
||||
: m_digitalOut (0)
|
||||
, m_statusDataSemaphore (initializeMutexNormal())
|
||||
, m_task ("DriverStation", (FUNCPTR)DriverStation::InitTask)
|
||||
, m_dashboardHigh(m_statusDataSemaphore)
|
||||
@@ -47,7 +41,6 @@ DriverStation::DriverStation()
|
||||
, m_dashboardInUseLow(&m_dashboardLow)
|
||||
, m_newControlData(0)
|
||||
, m_packetDataAvailableSem (0)
|
||||
, m_enhancedIO()
|
||||
, m_waitForDataSem(0)
|
||||
, m_approxMatchTimeOffset(-1.0)
|
||||
, m_userInDisabled(false)
|
||||
@@ -65,35 +58,6 @@ DriverStation::DriverStation()
|
||||
|
||||
m_waitForDataSem = initializeMultiWait();
|
||||
|
||||
m_controlData = new HALCommonControlData;
|
||||
|
||||
// initialize packet number and control words to zero;
|
||||
m_controlData->packetIndex = 0;
|
||||
m_controlData->control = 0;
|
||||
|
||||
// set all joystick axis values to neutral; buttons to OFF
|
||||
m_controlData->stick0Axis1 = m_controlData->stick0Axis2 = m_controlData->stick0Axis3 = 0;
|
||||
m_controlData->stick1Axis1 = m_controlData->stick1Axis2 = m_controlData->stick1Axis3 = 0;
|
||||
m_controlData->stick2Axis1 = m_controlData->stick2Axis2 = m_controlData->stick2Axis3 = 0;
|
||||
m_controlData->stick3Axis1 = m_controlData->stick3Axis2 = m_controlData->stick3Axis3 = 0;
|
||||
m_controlData->stick0Axis4 = m_controlData->stick0Axis5 = m_controlData->stick0Axis6 = 0;
|
||||
m_controlData->stick1Axis4 = m_controlData->stick1Axis5 = m_controlData->stick1Axis6 = 0;
|
||||
m_controlData->stick2Axis4 = m_controlData->stick2Axis5 = m_controlData->stick2Axis6 = 0;
|
||||
m_controlData->stick3Axis4 = m_controlData->stick3Axis5 = m_controlData->stick3Axis6 = 0;
|
||||
m_controlData->stick0Buttons = 0;
|
||||
m_controlData->stick1Buttons = 0;
|
||||
m_controlData->stick2Buttons = 0;
|
||||
m_controlData->stick3Buttons = 0;
|
||||
|
||||
// initialize the analog and digital data.
|
||||
m_controlData->analog1 = 0;
|
||||
m_controlData->analog2 = 0;
|
||||
m_controlData->analog3 = 0;
|
||||
m_controlData->analog4 = 0;
|
||||
m_controlData->dsDigitalIn = 0;
|
||||
|
||||
m_batteryChannel = new AnalogInput(kBatteryChannel);
|
||||
|
||||
AddToSingletonList();
|
||||
|
||||
if (!m_task.Start((int32_t)this))
|
||||
@@ -106,8 +70,6 @@ DriverStation::~DriverStation()
|
||||
{
|
||||
m_task.Stop();
|
||||
deleteMutex(m_statusDataSemaphore);
|
||||
delete m_batteryChannel;
|
||||
delete m_controlData;
|
||||
m_instance = NULL;
|
||||
deleteMultiWait(m_waitForDataSem);
|
||||
// Unregister our semaphore.
|
||||
@@ -127,7 +89,6 @@ void DriverStation::Run()
|
||||
{
|
||||
takeMutex(m_packetDataAvailableSem);
|
||||
SetData();
|
||||
m_enhancedIO.UpdateData();
|
||||
GetData();
|
||||
giveMultiWait(m_waitForDataSem);
|
||||
if (++period >= 4)
|
||||
@@ -139,10 +100,10 @@ void DriverStation::Run()
|
||||
HALNetworkCommunicationObserveUserProgramDisabled();
|
||||
if (m_userInAutonomous)
|
||||
HALNetworkCommunicationObserveUserProgramAutonomous();
|
||||
if (m_userInTeleop)
|
||||
HALNetworkCommunicationObserveUserProgramTeleop();
|
||||
if (m_userInTest)
|
||||
HALNetworkCommunicationObserveUserProgramTest();
|
||||
if (m_userInTeleop)
|
||||
HALNetworkCommunicationObserveUserProgramTeleop();
|
||||
if (m_userInTest)
|
||||
HALNetworkCommunicationObserveUserProgramTest();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +119,8 @@ DriverStation* DriverStation::GetInstance()
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
|
||||
/**
|
||||
* Copy data from the DS task for the user.
|
||||
* If no new data exists, it will just be returned, otherwise
|
||||
@@ -167,7 +130,19 @@ void DriverStation::GetData()
|
||||
{
|
||||
static bool lastEnabled = false;
|
||||
|
||||
HALGetCommonControlData(m_controlData, HAL_WAIT_FOREVER);
|
||||
// Get the status data
|
||||
HALGetControlWord(&m_controlWord);
|
||||
|
||||
// Get the location/alliance data
|
||||
HALGetAllianceStation(&m_allianceStationID);
|
||||
|
||||
// Get the status of all of the joysticks
|
||||
for(uint8_t stick = 0; stick < kJoystickPorts; stick++) {
|
||||
uint8_t count;
|
||||
|
||||
HALGetJoystickAxes(stick, &m_joystickAxes[stick], kJoystickAxes);
|
||||
HALGetJoystickButtons(stick, &m_joystickButtons[stick], &count);
|
||||
}
|
||||
|
||||
if (!lastEnabled && IsEnabled())
|
||||
{
|
||||
@@ -199,30 +174,23 @@ void DriverStation::SetData()
|
||||
|
||||
m_dashboardInUseHigh->GetStatusBuffer(&userStatusDataHigh, &userStatusDataHighSize);
|
||||
m_dashboardInUseLow->GetStatusBuffer(&userStatusDataLow, &userStatusDataLowSize);
|
||||
HALSetStatusData(GetBatteryVoltage(), m_digitalOut, m_updateNumber,
|
||||
userStatusDataHigh, userStatusDataHighSize, userStatusDataLow, userStatusDataLowSize, HAL_WAIT_FOREVER);
|
||||
|
||||
//TODO ???
|
||||
//HALSetStatusData(GetBatteryVoltage(), m_digitalOut, m_updateNumber,
|
||||
// userStatusDataHigh, userStatusDataHighSize, userStatusDataLow, userStatusDataLowSize, HAL_WAIT_FOREVER);
|
||||
|
||||
m_dashboardInUseHigh->Flush();
|
||||
m_dashboardInUseLow->Flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the battery voltage from the specified AnalogInput.
|
||||
*
|
||||
* This accessor assumes that the battery voltage is being measured
|
||||
* through the voltage divider on an analog breakout.
|
||||
* Read the battery voltage.
|
||||
*
|
||||
* @return The battery voltage.
|
||||
*/
|
||||
float DriverStation::GetBatteryVoltage()
|
||||
{
|
||||
if (m_batteryChannel == NULL)
|
||||
wpi_setWPIError(NullParameter);
|
||||
|
||||
// The Analog bumper has a voltage divider on the battery source.
|
||||
// Vbatt *--/\/\/\--* Vsample *--/\/\/\--* Gnd
|
||||
// 680 Ohms 1000 Ohms
|
||||
return m_batteryChannel->GetAverageVoltage() * (1680.0 / 1000.0);
|
||||
return 0.0f; // TODO
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,43 +203,28 @@ float DriverStation::GetBatteryVoltage()
|
||||
*/
|
||||
float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
{
|
||||
if (stick < 1 || stick > kJoystickPorts)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (axis < 1 || axis > kJoystickAxes)
|
||||
{
|
||||
wpi_setWPIError(BadJoystickAxis);
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
int8_t value;
|
||||
switch (stick)
|
||||
int8_t value = m_joystickAxes[stick - 1].axes[axis - 1];
|
||||
|
||||
if(value < 0)
|
||||
{
|
||||
case 1:
|
||||
value = m_controlData->stick0Axes[axis-1];
|
||||
break;
|
||||
case 2:
|
||||
value = m_controlData->stick1Axes[axis-1];
|
||||
break;
|
||||
case 3:
|
||||
value = m_controlData->stick2Axes[axis-1];
|
||||
break;
|
||||
case 4:
|
||||
value = m_controlData->stick3Axes[axis-1];
|
||||
break;
|
||||
default:
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return 0.0;
|
||||
return value / 128.0f;
|
||||
}
|
||||
|
||||
float result;
|
||||
if (value < 0)
|
||||
result = ((float) value) / 128.0;
|
||||
else
|
||||
result = ((float) value) / 127.0;
|
||||
wpi_assert(result <= 1.0 && result >= -1.0);
|
||||
if (result > 1.0)
|
||||
result = 1.0;
|
||||
else if (result < -1.0)
|
||||
result = -1.0;
|
||||
return result;
|
||||
{
|
||||
return value / 127.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,143 +236,38 @@ float DriverStation::GetStickAxis(uint32_t stick, uint32_t axis)
|
||||
*/
|
||||
short DriverStation::GetStickButtons(uint32_t stick)
|
||||
{
|
||||
if (stick < 1 || stick > 4)
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "stick must be between 1 and 4");
|
||||
|
||||
switch (stick)
|
||||
if (stick < 1 || stick > kJoystickPorts)
|
||||
{
|
||||
case 1:
|
||||
return m_controlData->stick0Buttons;
|
||||
case 2:
|
||||
return m_controlData->stick1Buttons;
|
||||
case 3:
|
||||
return m_controlData->stick2Buttons;
|
||||
case 4:
|
||||
return m_controlData->stick3Buttons;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 5V divided by 10 bits
|
||||
#define kDSAnalogInScaling ((float)(5.0 / 1023.0))
|
||||
|
||||
/**
|
||||
* Get an analog voltage from the Driver Station.
|
||||
* The analog values are returned as voltage values for the Driver Station analog inputs.
|
||||
* These inputs are typically used for advanced operator interfaces consisting of potentiometers
|
||||
* or resistor networks representing values on a rotary switch.
|
||||
*
|
||||
* @param channel The analog input channel on the driver station to read from. Valid range is 1 - 4.
|
||||
* @return The analog voltage on the input.
|
||||
*/
|
||||
float DriverStation::GetAnalogIn(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 4)
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 4");
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationCIO, channel, HALUsageReporting::kDriverStationCIO_Analog);
|
||||
reported_mask |= (1 >> channel);
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (channel)
|
||||
{
|
||||
case 1:
|
||||
return kDSAnalogInScaling * m_controlData->analog1;
|
||||
case 2:
|
||||
return kDSAnalogInScaling * m_controlData->analog2;
|
||||
case 3:
|
||||
return kDSAnalogInScaling * m_controlData->analog3;
|
||||
case 4:
|
||||
return kDSAnalogInScaling * m_controlData->analog4;
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values from the digital inputs on the Driver Station.
|
||||
* Return digital values from the Drivers Station. These values are typically used for buttons
|
||||
* and switches on advanced operator interfaces.
|
||||
* @param channel The digital input to get. Valid range is 1 - 8.
|
||||
*/
|
||||
bool DriverStation::GetDigitalIn(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 8)
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 8");
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationCIO, channel, HALUsageReporting::kDriverStationCIO_DigitalIn);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
return ((m_controlData->dsDigitalIn >> (channel-1)) & 0x1) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value for the digital outputs on the Driver Station.
|
||||
*
|
||||
* Control digital outputs on the Drivers Station. These values are typically used for
|
||||
* giving feedback on a custom operator station such as LEDs.
|
||||
*
|
||||
* @param channel The digital output to set. Valid range is 1 - 8.
|
||||
* @param value The state to set the digital output.
|
||||
*/
|
||||
void DriverStation::SetDigitalOut(uint32_t channel, bool value)
|
||||
{
|
||||
if (channel < 1 || channel > 8)
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 8");
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationCIO, channel,HALUsageReporting::kDriverStationCIO_DigitalOut);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
m_digitalOut &= ~(0x1 << (channel-1));
|
||||
m_digitalOut |= ((uint8_t)value << (channel-1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value that was set for the digital outputs on the Driver Station.
|
||||
* @param channel The digital ouput to monitor. Valid range is 1 through 8.
|
||||
* @return A digital value being output on the Drivers Station.
|
||||
*/
|
||||
bool DriverStation::GetDigitalOut(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 8)
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 8");
|
||||
|
||||
return ((m_digitalOut >> (channel-1)) & 0x1) ? true : false;
|
||||
return m_joystickButtons[stick - 1];
|
||||
}
|
||||
|
||||
bool DriverStation::IsEnabled()
|
||||
{
|
||||
return m_controlData->enabled;
|
||||
return m_controlWord.enabled;
|
||||
}
|
||||
|
||||
bool DriverStation::IsDisabled()
|
||||
{
|
||||
return !m_controlData->enabled;
|
||||
return !m_controlWord.enabled;
|
||||
}
|
||||
|
||||
bool DriverStation::IsAutonomous()
|
||||
{
|
||||
return m_controlData->autonomous;
|
||||
return m_controlWord.autonomous;
|
||||
}
|
||||
|
||||
bool DriverStation::IsOperatorControl()
|
||||
{
|
||||
return !(m_controlData->autonomous || m_controlData->test);
|
||||
return !(m_controlWord.autonomous || m_controlWord.test);
|
||||
}
|
||||
|
||||
bool DriverStation::IsTest()
|
||||
{
|
||||
return m_controlData->test;
|
||||
return m_controlWord.test;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -440,18 +288,7 @@ bool DriverStation::IsNewControlData()
|
||||
*/
|
||||
bool DriverStation::IsFMSAttached()
|
||||
{
|
||||
return m_controlData->fmsAttached;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DS packet number.
|
||||
* The packet number is the index of this set of data returned by the driver station.
|
||||
* Each time new data is received, the packet number (included with the sent data) is returned.
|
||||
* @return The driver station packet number
|
||||
*/
|
||||
uint32_t DriverStation::GetPacketNumber()
|
||||
{
|
||||
return m_controlData->packetIndex;
|
||||
return m_controlWord.fmsAttached;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -461,10 +298,19 @@ uint32_t DriverStation::GetPacketNumber()
|
||||
*/
|
||||
DriverStation::Alliance DriverStation::GetAlliance()
|
||||
{
|
||||
if (m_controlData->dsID_Alliance == 'R') return kRed;
|
||||
if (m_controlData->dsID_Alliance == 'B') return kBlue;
|
||||
wpi_assert(false);
|
||||
return kInvalid;
|
||||
switch(m_allianceStationID)
|
||||
{
|
||||
case kHALAllianceStationID_red1:
|
||||
case kHALAllianceStationID_red2:
|
||||
case kHALAllianceStationID_red3:
|
||||
return kRed;
|
||||
case kHALAllianceStationID_blue1:
|
||||
case kHALAllianceStationID_blue2:
|
||||
case kHALAllianceStationID_blue3:
|
||||
return kBlue;
|
||||
default:
|
||||
return kInvalid;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -474,8 +320,20 @@ DriverStation::Alliance DriverStation::GetAlliance()
|
||||
*/
|
||||
uint32_t DriverStation::GetLocation()
|
||||
{
|
||||
wpi_assert ((m_controlData->dsID_Position >= '1') && (m_controlData->dsID_Position <= '3'));
|
||||
return m_controlData->dsID_Position - '0';
|
||||
switch(m_allianceStationID)
|
||||
{
|
||||
case kHALAllianceStationID_red1:
|
||||
case kHALAllianceStationID_blue1:
|
||||
return 1;
|
||||
case kHALAllianceStationID_red2:
|
||||
case kHALAllianceStationID_blue2:
|
||||
return 2;
|
||||
case kHALAllianceStationID_red3:
|
||||
case kHALAllianceStationID_blue3:
|
||||
return 3;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -504,12 +362,3 @@ double DriverStation::GetMatchTime()
|
||||
return 0.0;
|
||||
return Timer::GetFPGATimestamp() - m_approxMatchTimeOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the team number that the Driver Station is configured for
|
||||
* @return The team number
|
||||
*/
|
||||
uint16_t DriverStation::GetTeamNumber()
|
||||
{
|
||||
return m_controlData->teamID;
|
||||
}
|
||||
|
||||
@@ -1,996 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "DriverStationEnhancedIO.h"
|
||||
//#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "HAL/cpp/Synchronized.hpp"
|
||||
#include "WPIErrors.h"
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* DriverStationEnhancedIO contructor.
|
||||
*
|
||||
* This is only called once when the DriverStation constructor is called.
|
||||
*/
|
||||
DriverStationEnhancedIO::DriverStationEnhancedIO()
|
||||
: m_inputValid (false)
|
||||
, m_outputValid (false)
|
||||
, m_configChanged (false)
|
||||
, m_requestEnhancedEnable (false)
|
||||
{
|
||||
bzero((char*)&m_inputData, sizeof(m_inputData));
|
||||
bzero((char*)&m_outputData, sizeof(m_outputData));
|
||||
m_outputData.size = sizeof(m_outputData) - 1;
|
||||
m_outputData.id = kOutputBlockID;
|
||||
// Expected to be active low, so initialize inactive.
|
||||
m_outputData.data.fixed_digital_out = 0x3;
|
||||
m_inputDataSemaphore = initializeMutexNormal();
|
||||
m_outputDataSemaphore = initializeMutexNormal();
|
||||
m_encoderOffsets[0] = 0;
|
||||
m_encoderOffsets[1] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* DriverStationEnhancedIO destructor.
|
||||
*
|
||||
* Called only when the DriverStation class is destroyed.
|
||||
*/
|
||||
DriverStationEnhancedIO::~DriverStationEnhancedIO()
|
||||
{
|
||||
deleteMutex(m_outputDataSemaphore);
|
||||
deleteMutex(m_inputDataSemaphore);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the DriverStation class when data is available.
|
||||
* This function will set any modified configuration / output,
|
||||
* then read the input and configuration from the IO.
|
||||
*/
|
||||
void DriverStationEnhancedIO::UpdateData()
|
||||
{
|
||||
int32_t retVal;
|
||||
{
|
||||
status_block_t tempOutputData;
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
if (m_outputValid || m_configChanged || m_requestEnhancedEnable)
|
||||
{
|
||||
m_outputData.flags = kStatusValid;
|
||||
if (m_requestEnhancedEnable)
|
||||
{
|
||||
// Someone called one of the get config APIs, but we are not in enhanced mode.
|
||||
m_outputData.flags |= kForceEnhancedMode;
|
||||
}
|
||||
if (m_configChanged)
|
||||
{
|
||||
if (!m_outputValid)
|
||||
{
|
||||
// Someone called one of the set config APIs, but we are not in enhanced mode.
|
||||
m_outputData.flags |= kForceEnhancedMode;
|
||||
}
|
||||
m_outputData.flags |= kStatusConfigChanged;
|
||||
}
|
||||
HALOverrideIOConfig((char*)&m_outputData, 5);
|
||||
}
|
||||
retVal = HALGetDynamicControlData(kOutputBlockID, (char*)&tempOutputData, sizeof(status_block_t), 5);
|
||||
if (retVal == 0)
|
||||
{
|
||||
if (m_outputValid)
|
||||
{
|
||||
if (m_configChanged)
|
||||
{
|
||||
// If our config change made the round trip then clear the flag.
|
||||
if (IsConfigEqual(tempOutputData, m_outputData))
|
||||
{
|
||||
m_configChanged = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: This won't work until artf1128 is fixed
|
||||
//if (tempOutputData.flags & kStatusConfigChanged)
|
||||
{
|
||||
// Configuration was updated on the DS, so update our local cache.
|
||||
MergeConfigIntoOutput(tempOutputData, m_outputData);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Initialize the local cache.
|
||||
MergeConfigIntoOutput(tempOutputData, m_outputData);
|
||||
}
|
||||
m_requestEnhancedEnable = false;
|
||||
m_outputValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputValid = false;
|
||||
m_inputValid = false;
|
||||
}
|
||||
}
|
||||
{
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
control_block_t tempInputData;
|
||||
retVal = HALGetDynamicControlData(kInputBlockID, (char*)&tempInputData, sizeof(control_block_t), 5);
|
||||
if (retVal == 0 && tempInputData.data.api_version == kSupportedAPIVersion)
|
||||
{
|
||||
m_inputData = tempInputData;
|
||||
m_inputValid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputValid = false;
|
||||
m_inputValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge the config portion of the DS output block into the local cache.
|
||||
*/
|
||||
void DriverStationEnhancedIO::MergeConfigIntoOutput(const status_block_t &dsOutputBlock, status_block_t &localCache)
|
||||
{
|
||||
localCache.data.digital = (localCache.data.digital & dsOutputBlock.data.digital_oe) |
|
||||
(dsOutputBlock.data.digital & ~dsOutputBlock.data.digital_oe);
|
||||
localCache.data.digital_oe = dsOutputBlock.data.digital_oe;
|
||||
localCache.data.digital_pe = dsOutputBlock.data.digital_pe;
|
||||
localCache.data.pwm_period[0] = dsOutputBlock.data.pwm_period[0];
|
||||
localCache.data.pwm_period[1] = dsOutputBlock.data.pwm_period[1];
|
||||
localCache.data.enables = dsOutputBlock.data.enables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the config portion of the output blocks.
|
||||
*/
|
||||
bool DriverStationEnhancedIO::IsConfigEqual(const status_block_t &dsOutputBlock, const status_block_t &localCache)
|
||||
{
|
||||
if (localCache.data.digital_oe != dsOutputBlock.data.digital_oe) return false;
|
||||
if ((localCache.data.digital & ~dsOutputBlock.data.digital) !=
|
||||
(dsOutputBlock.data.digital & ~dsOutputBlock.data.digital)) return false;
|
||||
if (localCache.data.digital_pe != dsOutputBlock.data.digital_pe) return false;
|
||||
if (localCache.data.pwm_period[0] != dsOutputBlock.data.pwm_period[0]) return false;
|
||||
if (localCache.data.pwm_period[1] != dsOutputBlock.data.pwm_period[1]) return false;
|
||||
if (localCache.data.enables != dsOutputBlock.data.enables) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query an accelerometer channel on the DS IO.
|
||||
*
|
||||
* @param channel The channel number to read.
|
||||
* @return The current acceleration on the channel in Gs.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetAcceleration(tAccelChannel channel)
|
||||
{
|
||||
if (channel < 1 || channel > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 2");
|
||||
return 0.0;
|
||||
}
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_Acceleration);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return (m_inputData.data.accel[channel] - kAccelOffset) / kAccelScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query an analog input channel on the DS IO.
|
||||
*
|
||||
* @param channel The channel number to read. [1,8]
|
||||
* @return The analog input voltage for the channel.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetAnalogIn(uint32_t channel)
|
||||
{
|
||||
// 3.3V is the analog reference voltage
|
||||
return GetAnalogInRatio(channel) * kAnalogInputReference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query an analog input channel on the DS IO in ratiometric form.
|
||||
*
|
||||
* @param channel The channel number to read. [1,8]
|
||||
* @return The analog input percentage for the channel.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetAnalogInRatio(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 8)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 8");
|
||||
return 0.0;
|
||||
}
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
static uint16_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_AnalogIn);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return m_inputData.data.analog[channel-1] / kAnalogInputResolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the voltage currently being output.
|
||||
*
|
||||
* AO1 is pin 11 on the top connector (P2).
|
||||
* AO2 is pin 12 on the top connector (P2).
|
||||
*
|
||||
* @param channel The analog output channel on the DS IO. [1,2]
|
||||
* @return The voltage being output on the channel.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetAnalogOut(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 2");
|
||||
return 0.0;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
return m_outputData.data.dac[channel-1] * kAnalogOutputReference / kAnalogOutputResolution;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the analog output voltage.
|
||||
*
|
||||
* AO1 is pin 11 on the top connector (P2).
|
||||
* AO2 is pin 12 on the top connector (P2).
|
||||
* AO1 is the reference voltage for the 2 analog comparators on DIO15 and DIO16.
|
||||
*
|
||||
* The output range is 0V to 4V, however due to the supply voltage don't expect more than about 3V.
|
||||
* Current supply capability is only 100uA.
|
||||
*
|
||||
* @param channel The analog output channel on the DS IO. [1,2]
|
||||
* @param value The voltage to output on the channel.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetAnalogOut(uint32_t channel, double value)
|
||||
{
|
||||
if (channel < 1 || channel > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 2");
|
||||
return;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
if (value < 0.0) value = 0.0;
|
||||
if (value > kAnalogOutputReference) value = kAnalogOutputReference;
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_AnalogOut);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
m_outputData.data.dac[channel-1] = (uint8_t)(value / kAnalogOutputReference * kAnalogOutputResolution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of a button on the IO board.
|
||||
*
|
||||
* Button1 is the physical button "S1".
|
||||
* Button2 is pin 4 on the top connector (P2).
|
||||
* Button3 is pin 6 on the top connector (P2).
|
||||
* Button4 is pin 8 on the top connector (P2).
|
||||
* Button5 is pin 10 on the top connector (P2).
|
||||
* Button6 is pin 7 on the top connector (P2).
|
||||
*
|
||||
* Button2 through Button6 are Capacitive Sense buttons.
|
||||
*
|
||||
* @param channel The button channel to read. [1,6]
|
||||
* @return The state of the selected button.
|
||||
*/
|
||||
bool DriverStationEnhancedIO::GetButton(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 6)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 6");
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_Button);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
return ((GetButtons() >> (channel-1)) & 1) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of all the button channels.
|
||||
*
|
||||
* @return The state of the 6 button channels in the 6 lsb of the returned byte.
|
||||
*/
|
||||
uint8_t DriverStationEnhancedIO::GetButtons()
|
||||
{
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0;
|
||||
}
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, 0, HALUsageReporting::kDriverStationEIO_Button);
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return m_inputData.data.buttons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of an LED on the IO board.
|
||||
*
|
||||
* @param channel The LED channel to set. [1,8]
|
||||
* @param value True to turn the LED on.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetLED(uint32_t channel, bool value)
|
||||
{
|
||||
if (channel < 1 || channel > 8)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 8");
|
||||
return;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
static uint16_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_LED);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
uint8_t leds;
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
leds = m_outputData.data.leds;
|
||||
|
||||
leds &= ~(1 << (channel-1));
|
||||
if (value) leds |= 1 << (channel-1);
|
||||
|
||||
m_outputData.data.leds = leds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of all 8 LEDs on the IO board.
|
||||
*
|
||||
* @param value The state of each LED. LED1 is lsb and LED8 is msb.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetLEDs(uint8_t value)
|
||||
{
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, 0, HALUsageReporting::kDriverStationEIO_LED);
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
m_outputData.data.leds = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current state of a DIO channel regardless of mode.
|
||||
*
|
||||
* @param channel The DIO channel to read. [1,16]
|
||||
* @return The state of the selected digital line.
|
||||
*/
|
||||
bool DriverStationEnhancedIO::GetDigital(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 16)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 16");
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint32_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_DigitalIn);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
return ((GetDigitals() >> (channel-1)) & 1) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state of all 16 DIO lines regardless of mode.
|
||||
*
|
||||
* @return The state of all DIO lines. DIO1 is lsb and DIO16 is msb.
|
||||
*/
|
||||
uint16_t DriverStationEnhancedIO::GetDigitals()
|
||||
{
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0;
|
||||
}
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, 0, HALUsageReporting::kDriverStationEIO_DigitalIn);
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return m_inputData.data.digital;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state of a DIO line that is configured for digital output.
|
||||
*
|
||||
* @param channel The DIO channel to set. [1,16]
|
||||
* @param value The state to set the selected channel to.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetDigitalOutput(uint32_t channel, bool value)
|
||||
{
|
||||
if (channel < 1 || channel > 16)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 16");
|
||||
return;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
static uint32_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_DigitalOut);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
uint16_t digital;
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
|
||||
if (m_outputData.data.digital_oe & (1 << (channel-1)))
|
||||
{
|
||||
digital = m_outputData.data.digital;
|
||||
|
||||
digital &= ~(1 << (channel-1));
|
||||
if (value) digital |= 1 << (channel-1);
|
||||
|
||||
m_outputData.data.digital = digital;
|
||||
}
|
||||
else
|
||||
{
|
||||
wpi_setWPIError(LineNotOutput);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configuration for a DIO line.
|
||||
*
|
||||
* This has the side effect of forcing the Driver Station to switch to Enhanced mode if it's not when called.
|
||||
* If Enhanced mode is not enabled when this is called, it will return kUnknown.
|
||||
*
|
||||
* @param channel The DIO channel config to get. [1,16]
|
||||
* @return The configured mode for the DIO line.
|
||||
*/
|
||||
DriverStationEnhancedIO::tDigitalConfig DriverStationEnhancedIO::GetDigitalConfig(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 16)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 16");
|
||||
return kUnknown;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
m_requestEnhancedEnable = true;
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return kUnknown;
|
||||
}
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
if ((channel >= 1) && (channel <= 4))
|
||||
{
|
||||
if (m_outputData.data.pwm_enable & (1 << (channel - 1)))
|
||||
{
|
||||
return kPWM;
|
||||
}
|
||||
}
|
||||
if ((channel >= 15) && (channel <= 16))
|
||||
{
|
||||
if (m_outputData.data.comparator_enable & (1 << (channel - 15)))
|
||||
{
|
||||
return kAnalogComparator;
|
||||
}
|
||||
}
|
||||
if (m_outputData.data.digital_oe & (1 << (channel - 1)))
|
||||
{
|
||||
return kOutput;
|
||||
}
|
||||
if (!(m_outputData.data.digital_pe & (1 << (channel - 1))))
|
||||
{
|
||||
return kInputFloating;
|
||||
}
|
||||
if (m_outputData.data.digital & (1 << (channel - 1)))
|
||||
{
|
||||
return kInputPullUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
return kInputPullDown;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the DS's configuration of a DIO line.
|
||||
*
|
||||
* If configured to kInputFloating, the selected DIO line will be tri-stated with no internal pull resistor.
|
||||
*
|
||||
* If configured to kInputPullUp, the selected DIO line will be tri-stated with a 5k-Ohm internal pull-up resistor enabled.
|
||||
*
|
||||
* If configured to kInputPullDown, the selected DIO line will be tri-stated with a 5k-Ohm internal pull-down resistor enabled.
|
||||
*
|
||||
* If configured to kOutput, the selected DIO line will actively drive to 0V or Vddio (specified by J1 and J4).
|
||||
* DIO1 through DIO12, DIO15, and DIO16 can source 4mA and can sink 8mA.
|
||||
* DIO12 and DIO13 can source 4mA and can sink 25mA.
|
||||
*
|
||||
* In addition to the common configurations, DIO1 through DIO4 can be configured to kPWM to enable PWM output.
|
||||
*
|
||||
* In addition to the common configurations, DIO15 and DIO16 can be configured to kAnalogComparator to enable
|
||||
* analog comparators on those 2 DIO lines. When enabled, the lines are tri-stated and will accept analog voltages
|
||||
* between 0V and 3.3V. If the input voltage is greater than the voltage output by AO1, the DIO will read as true,
|
||||
* if less then false.
|
||||
*
|
||||
* @param channel The DIO line to configure. [1,16]
|
||||
* @param config The mode to put the DIO line in.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetDigitalConfig(uint32_t channel, tDigitalConfig config)
|
||||
{
|
||||
if (channel < 1 || channel > 16)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 16");
|
||||
return;
|
||||
}
|
||||
if (config == kPWM && (channel < 1 || channel > 4))
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel in PWM mode must be between 1 and 4");
|
||||
return;
|
||||
}
|
||||
if (config == kAnalogComparator && (channel < 15 || channel > 16))
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel in Analog Comparator mode must be between 15 and 16");
|
||||
return;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
m_configChanged = true;
|
||||
|
||||
if ((channel >= 1) && (channel <= 4))
|
||||
{
|
||||
if (config == kPWM)
|
||||
{
|
||||
m_outputData.data.pwm_enable |= 1 << (channel - 1);
|
||||
m_outputData.data.digital &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_oe |= 1 << (channel - 1);
|
||||
m_outputData.data.digital_pe &= ~(1 << (channel - 1));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputData.data.pwm_enable &= ~(1 << (channel - 1));
|
||||
}
|
||||
}
|
||||
else if ((channel >= 15) && (channel <= 16))
|
||||
{
|
||||
if (config == kAnalogComparator)
|
||||
{
|
||||
m_outputData.data.comparator_enable |= 1 << (channel - 15);
|
||||
m_outputData.data.digital &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_oe &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_pe &= ~(1 << (channel - 1));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_outputData.data.comparator_enable &= ~(1 << (channel - 15));
|
||||
}
|
||||
}
|
||||
if (config == kInputFloating)
|
||||
{
|
||||
m_outputData.data.digital &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_oe &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_pe &= ~(1 << (channel - 1));
|
||||
}
|
||||
else if (config == kInputPullUp)
|
||||
{
|
||||
m_outputData.data.digital |= 1 << (channel - 1);
|
||||
m_outputData.data.digital_oe &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_pe |= 1 << (channel - 1);
|
||||
}
|
||||
else if (config == kInputPullDown)
|
||||
{
|
||||
m_outputData.data.digital &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_oe &= ~(1 << (channel - 1));
|
||||
m_outputData.data.digital_pe |= 1 << (channel - 1);
|
||||
}
|
||||
else if (config == kOutput)
|
||||
{
|
||||
m_outputData.data.digital_oe |= 1 << (channel - 1);
|
||||
m_outputData.data.digital_pe &= ~(1 << (channel - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Something went wrong.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the period of a PWM generator.
|
||||
*
|
||||
* This has the side effect of forcing the Driver Station to switch to Enhanced mode if it's not when called.
|
||||
* If Enhanced mode is not enabled when this is called, it will return 0.
|
||||
*
|
||||
* @param channels Select the generator by specifying the two channels to which it is connected.
|
||||
* @return The period of the PWM generator in seconds.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetPWMPeriod(tPWMPeriodChannels channels)
|
||||
{
|
||||
if (channels < kPWMChannels1and2 || channels > kPWMChannels3and4)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channels must be kPWMChannels1and2 or kPWMChannels3and4");
|
||||
return 0.0;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
m_requestEnhancedEnable = true;
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
return m_outputData.data.pwm_period[channels] / 24000000.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the period of a PWM generator.
|
||||
*
|
||||
* There are 2 PWM generators on the IO board. One can generate PWM signals on DIO1 and DIO2,
|
||||
* the other on DIO3 and DIO4. Each generator has one counter and two compare registers. As such,
|
||||
* each pair of PWM outputs share the output period but have independent duty cycles.
|
||||
*
|
||||
* @param channels Select the generator by specifying the two channels to which it is connected.
|
||||
* @param period The period of the PWM generator in seconds. [0.0,0.002731]
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetPWMPeriod(tPWMPeriodChannels channels, double period)
|
||||
{
|
||||
if (channels < kPWMChannels1and2 || channels > kPWMChannels3and4)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channels must be kPWMChannels1and2 or kPWMChannels3and4");
|
||||
return;
|
||||
}
|
||||
|
||||
// Convert to ticks based on the IO board's 24MHz clock
|
||||
double ticks = period * 24000000.0;
|
||||
// Limit the range of the ticks... warn if too big.
|
||||
if (ticks > 65534.0)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOPWMPeriodOutOfRange);
|
||||
ticks = 65534.0;
|
||||
}
|
||||
else if (ticks < 0.0) ticks = 0.0;
|
||||
// Preserve the duty cycles.
|
||||
double dutyCycles[2];
|
||||
dutyCycles[0] = GetPWMOutput((channels << 1) + 1);
|
||||
dutyCycles[1] = GetPWMOutput((channels << 1) + 2);
|
||||
{
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
// Update the period
|
||||
m_outputData.data.pwm_period[channels] = (uint16_t)ticks;
|
||||
m_configChanged = true;
|
||||
}
|
||||
// Restore the duty cycles
|
||||
SetPWMOutput((channels << 1) + 1, dutyCycles[0]);
|
||||
SetPWMOutput((channels << 1) + 2, dutyCycles[1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the state being output on a fixed digital output.
|
||||
*
|
||||
* @param channel The FixedDO line to get. [1,2]
|
||||
* @return The state of the FixedDO line.
|
||||
*/
|
||||
bool DriverStationEnhancedIO::GetFixedDigitalOutput(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 2");
|
||||
return 0;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
return ((m_outputData.data.fixed_digital_out >> (channel-1)) & 1) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the state to output on a Fixed High Current Digital Output line.
|
||||
*
|
||||
* FixedDO1 is pin 5 on the top connector (P2).
|
||||
* FixedDO2 is pin 3 on the top connector (P2).
|
||||
*
|
||||
* The FixedDO lines always output 0V and 3.3V regardless of J1 and J4.
|
||||
* They can source 4mA and can sink 25mA. Because of this, they are expected to be used
|
||||
* in an active low configuration, such as connecting to the cathode of a bright LED.
|
||||
* Because they are expected to be active low, they default to true.
|
||||
*
|
||||
* @param channel The FixedDO channel to set.
|
||||
* @param value The state to set the FixedDO.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetFixedDigitalOutput(uint32_t channel, bool value)
|
||||
{
|
||||
if (channel < 1 || channel > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 2");
|
||||
return;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_FixedDigitalOut);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
uint8_t digital;
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
digital = m_outputData.data.fixed_digital_out;
|
||||
|
||||
digital &= ~(1 << (channel-1));
|
||||
if (value) digital |= 1 << (channel-1);
|
||||
|
||||
m_outputData.data.fixed_digital_out = digital;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the position of a quadrature encoder.
|
||||
*
|
||||
* There are two signed 16-bit 4X quadrature decoders on the IO board. These decoders are always monitoring
|
||||
* the state of the lines assigned to them, but these lines do not have to be used for encoders.
|
||||
*
|
||||
* Encoder1 uses DIO4 for "A", DIO6 for "B", and DIO8 for "Index".
|
||||
* Encoder2 uses DIO5 for "A", DIO7 for "B", and DIO9 for "Index".
|
||||
*
|
||||
* The index functionality can be enabled or disabled using SetEncoderIndexEnable().
|
||||
*
|
||||
* @param encoderNumber The quadrature encoder to access. [1,2]
|
||||
* @return The current position of the quadrature encoder.
|
||||
*/
|
||||
int16_t DriverStationEnhancedIO::GetEncoder(uint32_t encoderNumber)
|
||||
{
|
||||
if (encoderNumber < 1 || encoderNumber > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "encoderNumber must be between 1 and 2");
|
||||
return 0;
|
||||
}
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> encoderNumber)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, encoderNumber, HALUsageReporting::kDriverStationEIO_Encoder);
|
||||
reported_mask |= (1 >> encoderNumber);
|
||||
}
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return m_inputData.data.quad[encoderNumber - 1] - m_encoderOffsets[encoderNumber - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the position of an encoder to 0.
|
||||
*
|
||||
* This simply stores an offset locally. It does not reset the hardware counter on the IO board.
|
||||
* If you use this method with Index enabled, you may get unexpected results.
|
||||
*
|
||||
* @param encoderNumber The quadrature encoder to reset. [1,2]
|
||||
*/
|
||||
void DriverStationEnhancedIO::ResetEncoder(uint32_t encoderNumber)
|
||||
{
|
||||
if (encoderNumber < 1 || encoderNumber > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "encoderNumber must be between 1 and 2");
|
||||
return;
|
||||
}
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
m_encoderOffsets[encoderNumber - 1] = m_inputData.data.quad[encoderNumber - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current configuration of a quadrature encoder index channel.
|
||||
*
|
||||
* This has the side effect of forcing the Driver Station to switch to Enhanced mode if it's not when called.
|
||||
* If Enhanced mode is not enabled when this is called, it will return false.
|
||||
*
|
||||
* @param encoderNumber The quadrature encoder. [1,2]
|
||||
* @return Is the index channel of the encoder enabled.
|
||||
*/
|
||||
bool DriverStationEnhancedIO::GetEncoderIndexEnable(uint32_t encoderNumber)
|
||||
{
|
||||
if (encoderNumber < 1 || encoderNumber > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "encoderNumber must be between 1 and 2");
|
||||
return false;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
m_requestEnhancedEnable = true;
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return false;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
return ((m_outputData.data.quad_index_enable >> (encoderNumber - 1)) & 1) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable the index channel of a quadrature encoder.
|
||||
*
|
||||
* The quadrature decoders on the IO board support an active-low index input.
|
||||
*
|
||||
* Encoder1 uses DIO8 for "Index".
|
||||
* Encoder2 uses DIO9 for "Index".
|
||||
*
|
||||
* When enabled, the decoder's counter will be reset to 0 when A, B, and Index are all low.
|
||||
*
|
||||
* @param encoderNumber The quadrature encoder. [1,2]
|
||||
* @param enable If true, reset the encoder in an index condition.
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetEncoderIndexEnable(uint32_t encoderNumber, bool enable)
|
||||
{
|
||||
if (encoderNumber < 1 || encoderNumber > 2)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "encoderNumber must be between 1 and 2");
|
||||
return;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
m_outputData.data.quad_index_enable &= ~(1 << (encoderNumber - 1));
|
||||
if (enable) m_outputData.data.quad_index_enable |= 1 << (encoderNumber - 1);
|
||||
m_configChanged = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the Capacitive Sense touch slider.
|
||||
*
|
||||
* @return Value between 0.0 (toward center of board) and 1.0 (toward edge of board). -1.0 means no touch detected.
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetTouchSlider()
|
||||
{
|
||||
if (!m_inputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, 1, HALUsageReporting::kDriverStationEIO_TouchSlider);
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
uint8_t value = m_inputData.data.capsense_slider;
|
||||
return value == 255 ? -1.0 : value / 254.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the percent duty-cycle that the PWM generator channel is configured to output.
|
||||
*
|
||||
* @param channel The DIO line's PWM generator to get the duty-cycle from. [1,4]
|
||||
* @return The percent duty-cycle being output (if the DIO line is configured for PWM). [0.0,1.0]
|
||||
*/
|
||||
double DriverStationEnhancedIO::GetPWMOutput(uint32_t channel)
|
||||
{
|
||||
if (channel < 1 || channel > 4)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 4");
|
||||
return 0.0;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
return (double)m_outputData.data.pwm_compare[channel - 1] / (double)m_outputData.data.pwm_period[(channel - 1) >> 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the percent duty-cycle to output on a PWM enabled DIO line.
|
||||
*
|
||||
* DIO1 through DIO4 have the ability to output a PWM signal. The period of the
|
||||
* signal can be configured in pairs using SetPWMPeriod().
|
||||
*
|
||||
* @param channel The DIO line's PWM generator to set. [1,4]
|
||||
* @param value The percent duty-cycle to output from the PWM generator. [0.0,1.0]
|
||||
*/
|
||||
void DriverStationEnhancedIO::SetPWMOutput(uint32_t channel, double value)
|
||||
{
|
||||
if (channel < 1 || channel > 4)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "channel must be between 1 and 4");
|
||||
return;
|
||||
}
|
||||
if (!m_outputValid)
|
||||
{
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return;
|
||||
}
|
||||
|
||||
static uint8_t reported_mask = 0;
|
||||
if (!(reported_mask & (1 >> channel)))
|
||||
{
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationEIO, channel, HALUsageReporting::kDriverStationEIO_PWM);
|
||||
reported_mask |= (1 >> channel);
|
||||
}
|
||||
|
||||
if (value > 1.0) value = 1.0;
|
||||
else if (value < 0.0) value = 0.0;
|
||||
Synchronized sync(m_outputDataSemaphore);
|
||||
m_outputData.data.pwm_compare[channel - 1] = (uint16_t)(value * (double)m_outputData.data.pwm_period[(channel - 1) >> 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the firmware version running on the IO board.
|
||||
*
|
||||
* This also has the side effect of forcing the driver station to switch to Enhanced mode if it is not.
|
||||
* If you plan to switch between Driver Stations with unknown IO configurations, you can call this
|
||||
* until it returns a non-0 version to ensure that this API is accessible before proceeding.
|
||||
*
|
||||
* @return The version of the firmware running on the IO board. 0 if the board is not attached or not in Enhanced mode.
|
||||
*/
|
||||
uint8_t DriverStationEnhancedIO::GetFirmwareVersion()
|
||||
{
|
||||
if (!m_inputValid)
|
||||
{
|
||||
m_requestEnhancedEnable = true;
|
||||
wpi_setWPIError(EnhancedIOMissing);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Synchronized sync(m_inputDataSemaphore);
|
||||
return m_inputData.data.fw_version;
|
||||
}
|
||||
|
||||
@@ -1,168 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008. 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 $(WIND_BASE)/WPILib. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "DriverStationLCD.h"
|
||||
|
||||
//#include <algorithm>
|
||||
#include <string.h>
|
||||
//#include "NetworkCommunication/FRCComm.h"
|
||||
//#include "NetworkCommunication/UsageReporting.h"
|
||||
#include "HAL/cpp/Synchronized.hpp"
|
||||
#include "WPIErrors.h"
|
||||
#undef min
|
||||
|
||||
const uint32_t DriverStationLCD::kSyncTimeout_ms;
|
||||
const uint16_t DriverStationLCD::kFullDisplayTextCommand;
|
||||
const int32_t DriverStationLCD::kLineLength;
|
||||
const int32_t DriverStationLCD::kNumLines;
|
||||
DriverStationLCD* DriverStationLCD::m_instance = NULL;
|
||||
|
||||
/**
|
||||
* DriverStationLCD contructor.
|
||||
*
|
||||
* This is only called once the first time GetInstance() is called
|
||||
*/
|
||||
DriverStationLCD::DriverStationLCD()
|
||||
: m_textBuffer (NULL)
|
||||
, m_textBufferSemaphore (NULL)
|
||||
{
|
||||
m_textBuffer = new char[HAL_USER_DS_LCD_DATA_SIZE];
|
||||
memset(m_textBuffer, ' ', HAL_USER_DS_LCD_DATA_SIZE);
|
||||
|
||||
*((uint16_t *)m_textBuffer) = kFullDisplayTextCommand;
|
||||
|
||||
m_textBufferSemaphore = initializeMutexNormal();
|
||||
|
||||
HALReport(HALUsageReporting::kResourceType_DriverStationLCD, 0);
|
||||
|
||||
AddToSingletonList();
|
||||
}
|
||||
|
||||
DriverStationLCD::~DriverStationLCD()
|
||||
{
|
||||
deleteMutex(m_textBufferSemaphore);
|
||||
delete [] m_textBuffer;
|
||||
m_instance = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a pointer to the singleton DriverStationLCD.
|
||||
*/
|
||||
DriverStationLCD* DriverStationLCD::GetInstance()
|
||||
{
|
||||
if (m_instance == NULL)
|
||||
{
|
||||
m_instance = new DriverStationLCD();
|
||||
}
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the text data to the Driver Station.
|
||||
*/
|
||||
void DriverStationLCD::UpdateLCD()
|
||||
{
|
||||
Synchronized sync(m_textBufferSemaphore);
|
||||
HALSetUserDsLcdData(m_textBuffer, HAL_USER_DS_LCD_DATA_SIZE, kSyncTimeout_ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print formatted text to the Driver Station LCD text bufer.
|
||||
*
|
||||
* Use UpdateLCD() periodically to actually send the text to the Driver Station.
|
||||
*
|
||||
* @param line The line on the LCD to print to.
|
||||
* @param startingColumn The column to start printing to. This is a 1-based number.
|
||||
* @param writeFmt The printf format string describing how to print.
|
||||
*/
|
||||
void DriverStationLCD::Printf(Line line, int32_t startingColumn, const char *writeFmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, writeFmt);
|
||||
VPrintf(line, startingColumn, writeFmt, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void DriverStationLCD::VPrintf(Line line, int32_t startingColumn, const char *writeFmt, va_list args)
|
||||
{
|
||||
uint32_t start = startingColumn - 1;
|
||||
int32_t maxLength = kLineLength - start;
|
||||
char lineBuffer[kLineLength + 1];
|
||||
|
||||
if (startingColumn < 1 || startingColumn > kLineLength)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "startingColumn");
|
||||
return;
|
||||
}
|
||||
|
||||
if (line < kMain_Line6 || line > kUser_Line6)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "line");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Synchronized sync(m_textBufferSemaphore);
|
||||
// snprintf appends NULL to its output. Therefore we can't write directly to the buffer.
|
||||
int32_t length = vsnprintf(lineBuffer, kLineLength + 1, writeFmt, args);
|
||||
if (length < 0) length = kLineLength;
|
||||
|
||||
memcpy(m_textBuffer + start + line * kLineLength + sizeof(uint16_t), lineBuffer, std::min(maxLength,length));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print formatted text to the Driver Station LCD text bufer. This function
|
||||
* pads the line with empty spaces.
|
||||
*
|
||||
* Use UpdateLCD() periodically to actually send the text to the Driver Station.
|
||||
*
|
||||
* @param line The line on the LCD to print to.
|
||||
* @param writeFmt The printf format string describing how to print.
|
||||
*/
|
||||
void DriverStationLCD::PrintfLine(Line line, const char *writeFmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start (args, writeFmt);
|
||||
VPrintfLine(line, writeFmt, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void DriverStationLCD::VPrintfLine(Line line, const char *writeFmt, va_list args)
|
||||
{
|
||||
char lineBuffer[kLineLength + 1];
|
||||
|
||||
if (line < kMain_Line6 || line > kUser_Line6)
|
||||
{
|
||||
wpi_setWPIErrorWithContext(ParameterOutOfRange, "line");
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Synchronized sync(m_textBufferSemaphore);
|
||||
// snprintf appends NULL to its output. Therefore we can't write directly to the buffer.
|
||||
int32_t length = std::min(vsnprintf(lineBuffer, kLineLength + 1, writeFmt, args), (int)kLineLength);
|
||||
if (length < 0) length = kLineLength;
|
||||
|
||||
// Fill the rest of the buffer
|
||||
if (length < kLineLength)
|
||||
{
|
||||
memset(lineBuffer + length, ' ', kLineLength - length);
|
||||
}
|
||||
|
||||
memcpy(m_textBuffer + line * kLineLength + sizeof(uint16_t), lineBuffer, kLineLength);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all lines on the LCD.
|
||||
*/
|
||||
void DriverStationLCD::Clear()
|
||||
{
|
||||
Synchronized sync(m_textBufferSemaphore);
|
||||
memset(m_textBuffer + sizeof(uint16_t), ' ', kLineLength*kNumLines);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ void SensorBase::DeleteSingletons()
|
||||
*/
|
||||
bool SensorBase::CheckSolenoidModule(uint8_t moduleNumber)
|
||||
{
|
||||
if (nLoadOut::getModulePresence(nLoadOut::kModuleType_Solenoid, moduleNumber - 1))
|
||||
if (moduleNumber < 64)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,8 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary;
|
||||
import edu.wpi.first.wpilibj.communication.FRCCommonControlData;
|
||||
import edu.wpi.first.wpilibj.communication.FRCCommonControlMasks;
|
||||
import edu.wpi.first.wpilibj.communication.HALControlWord;
|
||||
import edu.wpi.first.wpilibj.communication.HALAllianceStationID;
|
||||
import edu.wpi.first.wpilibj.hal.HALUtil;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
|
||||
@@ -24,14 +24,6 @@ public class DriverStation implements RobotState.Interface {
|
||||
* The size of the user status data
|
||||
*/
|
||||
public static final int USER_STATUS_DATA_SIZE = FRCNetworkCommunicationsLibrary.USER_STATUS_DATA_SIZE;
|
||||
/**
|
||||
* Slot for the analog module to read the battery
|
||||
*/
|
||||
public static final int kBatterySlot = 1;
|
||||
/**
|
||||
* Analog channel to read the battery
|
||||
*/
|
||||
public static final int kBatteryChannel = 7;
|
||||
/**
|
||||
* Number of Joystick Ports
|
||||
*/
|
||||
@@ -48,28 +40,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
/**
|
||||
* The robot alliance that the robot is a part of
|
||||
*/
|
||||
public static class Alliance {
|
||||
|
||||
/** The integer value representing this enumeration. */
|
||||
public final int value;
|
||||
/** The Alliance name. */
|
||||
public final String name;
|
||||
public static final int kRed_val = 0;
|
||||
public static final int kBlue_val = 1;
|
||||
public static final int kInvalid_val = 2;
|
||||
/** alliance: Red */
|
||||
public static final Alliance kRed = new Alliance(kRed_val, "Red");
|
||||
/** alliance: Blue */
|
||||
public static final Alliance kBlue = new Alliance(kBlue_val, "Blue");
|
||||
/** alliance: Invalid */
|
||||
public static final Alliance kInvalid = new Alliance(kInvalid_val, "invalid");
|
||||
|
||||
private Alliance(int value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
} /* Alliance */
|
||||
|
||||
public enum Alliance { Red, Blue, Invalid }
|
||||
|
||||
private static class DriverStationTask implements Runnable {
|
||||
|
||||
@@ -85,8 +56,12 @@ public class DriverStation implements RobotState.Interface {
|
||||
} /* DriverStationTask */
|
||||
|
||||
private static DriverStation instance = new DriverStation();
|
||||
private FRCCommonControlData m_controlData;
|
||||
private AnalogInput m_batteryChannel;
|
||||
|
||||
private HALControlWord m_controlWord;
|
||||
private HALAllianceStationID m_allianceStationID;
|
||||
private short[][] m_joystickAxes = new short[kJoystickAxes][kJoystickPorts];
|
||||
private int[] m_joystickButtons = new int[kJoystickPorts];
|
||||
|
||||
private Thread m_thread;
|
||||
private final Object m_semaphore;
|
||||
private final Object m_dataSem;
|
||||
@@ -121,18 +96,12 @@ public class DriverStation implements RobotState.Interface {
|
||||
* instance static member variable.
|
||||
*/
|
||||
protected DriverStation() {
|
||||
m_controlData = new FRCCommonControlData();
|
||||
m_semaphore = new Object();
|
||||
m_dataSem = new Object();
|
||||
|
||||
m_dashboardInUseHigh = m_dashboardDefaultHigh = new Dashboard(m_semaphore);
|
||||
m_dashboardInUseLow = m_dashboardDefaultLow = new Dashboard(m_semaphore);
|
||||
|
||||
// m_controlData is initialized in constructor FRCCommonControlData.
|
||||
|
||||
// XXX: Uncomment when analogChannel is fixed
|
||||
//m_batteryChannel = new AnalogChannel(kBatterySlot, kBatteryChannel);
|
||||
|
||||
m_packetDataAvailableSem = HALUtil.initializeMutexNormal();
|
||||
|
||||
// set the byte order
|
||||
@@ -216,7 +185,17 @@ public class DriverStation implements RobotState.Interface {
|
||||
* the data will be copied from the DS polling loop.
|
||||
*/
|
||||
protected synchronized void getData() {
|
||||
FRCNetworkCommunicationsLibrary.getCommonControlData(m_controlData);
|
||||
// Get the status data
|
||||
m_controlWord = FRCNetworkCommunicationsLibrary.HALGetControlWord();
|
||||
|
||||
// Get the location/alliance data
|
||||
m_allianceStationID = FRCNetworkCommunicationsLibrary.HALGetAllianceStation();
|
||||
|
||||
// Get the status of all of the joysticks
|
||||
for(byte stick = 0; stick < kJoystickPorts; stick++) {
|
||||
m_joystickButtons[stick] = FRCNetworkCommunicationsLibrary.HALGetJoystickButtons(stick);
|
||||
m_joystickAxes[stick] = FRCNetworkCommunicationsLibrary.HALGetJoystickAxes(stick);
|
||||
}
|
||||
|
||||
if (!lastEnabled && isEnabled()) {
|
||||
// If starting teleop, assume that autonomous just took up 15 seconds
|
||||
@@ -239,7 +218,8 @@ public class DriverStation implements RobotState.Interface {
|
||||
*/
|
||||
protected void setData() {
|
||||
synchronized (m_semaphore) {
|
||||
FRCNetworkCommunicationsLibrary.setStatusData((float) getBatteryVoltage(),
|
||||
// TODO ???
|
||||
/*FRCNetworkCommunicationsLibrary.setStatusData((float) getBatteryVoltage(),
|
||||
(byte) m_digitalOut,
|
||||
(byte) m_updateNumber,
|
||||
new String(m_dashboardInUseHigh.getBytes()),
|
||||
@@ -247,25 +227,17 @@ public class DriverStation implements RobotState.Interface {
|
||||
new String(m_dashboardInUseLow.getBytes()),
|
||||
m_dashboardInUseLow.getBytesLength());
|
||||
m_dashboardInUseHigh.flush();
|
||||
m_dashboardInUseLow.flush();
|
||||
m_dashboardInUseLow.flush();*/
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the battery voltage from the specified AnalogChannel.
|
||||
*
|
||||
* This accessor assumes that the battery voltage is being measured
|
||||
* through the voltage divider on an analog breakout.
|
||||
* Read the battery voltage.
|
||||
*
|
||||
* @return The battery voltage.
|
||||
*/
|
||||
public double getBatteryVoltage() {
|
||||
// The Analog bumper has a voltage divider on the battery source.
|
||||
// Vbatt *--/\/\/\--* Vsample *--/\/\/\--* Gnd
|
||||
// 680 Ohms 1000 Ohms
|
||||
// XXX: Uncomment this when analog channel is fixed
|
||||
//return m_batteryChannel.getAverageVoltage() * (1680.0 / 1000.0);
|
||||
return 12.0;
|
||||
return 0.0; // TODO
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -277,42 +249,21 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return The value of the axis on the joystick.
|
||||
*/
|
||||
public double getStickAxis(int stick, int axis) {
|
||||
if(stick < 1 || stick > kJoystickPorts) {
|
||||
throw new RuntimeException("Joystick index is out of range, should be 1-4");
|
||||
}
|
||||
|
||||
if (axis < 1 || axis > kJoystickAxes) {
|
||||
return 0.0;
|
||||
throw new RuntimeException("Joystick axis is out of range");
|
||||
}
|
||||
|
||||
int value;
|
||||
switch (stick) {
|
||||
case 1:
|
||||
value = m_controlData.stick0Axes[axis - 1];
|
||||
break;
|
||||
case 2:
|
||||
value = m_controlData.stick1Axes[axis - 1];
|
||||
break;
|
||||
case 3:
|
||||
value = m_controlData.stick2Axes[axis - 1];
|
||||
break;
|
||||
case 4:
|
||||
value = m_controlData.stick3Axes[axis - 1];
|
||||
break;
|
||||
default:
|
||||
return 0.0;
|
||||
}
|
||||
byte value = (byte)m_joystickAxes[stick - 1][axis - 1];
|
||||
|
||||
double result;
|
||||
if (value < 0) {
|
||||
result = ((double) value) / 128.0;
|
||||
if(value < 0) {
|
||||
return value / 128.0;
|
||||
} else {
|
||||
result = ((double) value) / 127.0;
|
||||
return value / 127.0;
|
||||
}
|
||||
|
||||
// wpi_assert(result <= 1.0 && result >= -1.0);
|
||||
if (result > 1.0) {
|
||||
result = 1.0;
|
||||
} else if (result < -1.0) {
|
||||
result = -1.0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,76 +274,11 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return The state of the buttons on the joystick.
|
||||
*/
|
||||
public int getStickButtons(final int stick) {
|
||||
switch (stick) {
|
||||
case 1:
|
||||
return m_controlData.stick0Buttons;
|
||||
case 2:
|
||||
return m_controlData.stick1Buttons;
|
||||
case 3:
|
||||
return m_controlData.stick2Buttons;
|
||||
case 4:
|
||||
return m_controlData.stick3Buttons;
|
||||
default:
|
||||
return 0;
|
||||
if(stick < 1 || stick > kJoystickPorts) {
|
||||
throw new RuntimeException("Joystick index is out of range, should be 1-4");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an analog voltage from the Driver Station.
|
||||
* The analog values are returned as voltage values for the Driver Station analog inputs.
|
||||
* These inputs are typically used for advanced operator interfaces consisting of potentiometers
|
||||
* or resistor networks representing values on a rotary switch.
|
||||
*
|
||||
* @param channel The analog input channel on the driver station to read from. Valid range is 1 - 4.
|
||||
* @return The analog voltage on the input.
|
||||
*/
|
||||
public double getAnalogIn(final int channel) {
|
||||
switch (channel) {
|
||||
case 1:
|
||||
return kDSAnalogInScaling * m_controlData.analog1;
|
||||
case 2:
|
||||
return kDSAnalogInScaling * m_controlData.analog2;
|
||||
case 3:
|
||||
return kDSAnalogInScaling * m_controlData.analog3;
|
||||
case 4:
|
||||
return kDSAnalogInScaling * m_controlData.analog4;
|
||||
default:
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get values from the digital inputs on the Driver Station.
|
||||
* Return digital values from the Drivers Station. These values are typically used for buttons
|
||||
* and switches on advanced operator interfaces.
|
||||
* @param channel The digital input to get. Valid range is 1 - 8.
|
||||
* @return The value of the digital input
|
||||
*/
|
||||
public boolean getDigitalIn(final int channel) {
|
||||
return ((m_controlData.dsDigitalIn >> (channel - 1)) & 0x1) == 0x1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a value for the digital outputs on the Driver Station.
|
||||
*
|
||||
* Control digital outputs on the Drivers Station. These values are typically used for
|
||||
* giving feedback on a custom operator station such as LEDs.
|
||||
*
|
||||
* @param channel The digital output to set. Valid range is 1 - 8.
|
||||
* @param value The state to set the digital output.
|
||||
*/
|
||||
public void setDigitalOut(final int channel, final boolean value) {
|
||||
m_digitalOut &= ~(0x1 << (channel - 1));
|
||||
m_digitalOut |= ((value ? 1 : 0) << (channel - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value that was set for the digital outputs on the Driver Station.
|
||||
* @param channel The digital ouput to monitor. Valid range is 1 through 8.
|
||||
* @return A digital value being output on the Drivers Station.
|
||||
*/
|
||||
public boolean getDigitalOut(final int channel) {
|
||||
return ((m_digitalOut >> (channel - 1)) & 0x1) == 0x1;
|
||||
return (int)m_joystickButtons[stick - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,7 +288,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return True if the robot is enabled, false otherwise.
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return (m_controlData.control & FRCCommonControlMasks.ENABLED) != 0;
|
||||
return m_controlWord.getEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -422,7 +308,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return True if autonomous mode should be enabled, false otherwise.
|
||||
*/
|
||||
public boolean isAutonomous() {
|
||||
return (m_controlData.control & FRCCommonControlMasks.AUTONOMOUS) != 0;
|
||||
return m_controlWord.getAutonomous();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -431,7 +317,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return True if test mode should be enabled, false otherwise.
|
||||
*/
|
||||
public boolean isTest() {
|
||||
return (m_controlData.control & FRCCommonControlMasks.TEST) != 0;
|
||||
return m_controlWord.getTest();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -454,29 +340,24 @@ public class DriverStation implements RobotState.Interface {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the DS packet number.
|
||||
* The packet number is the index of this set of data returned by the driver station.
|
||||
* Each time new data is received, the packet number (included with the sent data) is returned.
|
||||
*
|
||||
* @return The DS packet number.
|
||||
*/
|
||||
public int getPacketNumber() {
|
||||
return m_controlData.packetIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current alliance from the FMS
|
||||
* @return the current alliance
|
||||
*/
|
||||
public Alliance getAlliance() {
|
||||
switch (m_controlData.dsID_Alliance) {
|
||||
case 'R':
|
||||
return Alliance.kRed;
|
||||
case 'B':
|
||||
return Alliance.kBlue;
|
||||
default:
|
||||
return Alliance.kInvalid;
|
||||
switch (m_allianceStationID) {
|
||||
case Red1:
|
||||
case Red2:
|
||||
case Red3:
|
||||
return Alliance.Red;
|
||||
|
||||
case Blue1:
|
||||
case Blue2:
|
||||
case Blue3:
|
||||
return Alliance.Blue;
|
||||
|
||||
default:
|
||||
return Alliance.Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,15 +367,22 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return the location of the team's driver station controls: 1, 2, or 3
|
||||
*/
|
||||
public int getLocation() {
|
||||
return m_controlData.dsID_Position - '0';
|
||||
}
|
||||
switch (m_allianceStationID) {
|
||||
case Red1:
|
||||
case Blue1:
|
||||
return 1;
|
||||
|
||||
/**
|
||||
* Return the team number that the Driver Station is configured for
|
||||
* @return The team number
|
||||
*/
|
||||
public int getTeamNumber() {
|
||||
return m_controlData.teamID;
|
||||
case Red2:
|
||||
case Blue2:
|
||||
return 2;
|
||||
|
||||
case Blue3:
|
||||
case Red3:
|
||||
return 3;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -590,7 +478,7 @@ public class DriverStation implements RobotState.Interface {
|
||||
* @return True if the robot is competing on a field being controlled by a Field Management System
|
||||
*/
|
||||
public boolean isFMSAttached() {
|
||||
return (m_controlData.control & FRCCommonControlMasks.FMS_ATTATCHED) > 0;
|
||||
return m_controlWord.getFMSAttached();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008-2012. 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. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary;
|
||||
import edu.wpi.first.wpilibj.communication.FRCNetworkCommunicationsLibrary.tResourceType;
|
||||
import edu.wpi.first.wpilibj.communication.UsageReporting;
|
||||
|
||||
/**
|
||||
* Provide access to "LCD" on the Driver Station.
|
||||
* This is the Messages box on the DS Operation tab.
|
||||
*
|
||||
* Buffer the printed data locally and then send it
|
||||
* when UpdateLCD is called.
|
||||
*/
|
||||
public class DriverStationLCD extends SensorBase {
|
||||
|
||||
private static DriverStationLCD m_instance;
|
||||
/**
|
||||
* Driver station timeout in milliseconds
|
||||
*/
|
||||
public static final int kSyncTimeout_ms = 20;
|
||||
/**
|
||||
* Command to display text
|
||||
*/
|
||||
public static final int kFullDisplayTextCommand = 0x9FFF;
|
||||
/**
|
||||
* Maximum line length for Driver Station display
|
||||
*/
|
||||
public static final int kLineLength = 21;
|
||||
/**
|
||||
* Total number of lines available
|
||||
*/
|
||||
public static final int kNumLines = 6;
|
||||
|
||||
/**
|
||||
* The line number on the Driver Station LCD
|
||||
*/
|
||||
public static class Line {
|
||||
|
||||
/**
|
||||
* The integer value representing this enumeration
|
||||
*/
|
||||
public final int value;
|
||||
static final int kMain6_val = 0;
|
||||
static final int kUser1_val = 0;
|
||||
static final int kUser2_val = 1;
|
||||
static final int kUser3_val = 2;
|
||||
static final int kUser4_val = 3;
|
||||
static final int kUser5_val = 4;
|
||||
static final int kUser6_val = 5;
|
||||
/**
|
||||
* @deprecated Use kUser1
|
||||
* Line at the Top of the screen
|
||||
*/
|
||||
public static final Line kMain6 = new Line(kMain6_val);
|
||||
/**
|
||||
* Line at the Top of the screen
|
||||
*/
|
||||
public static final Line kUser1 = new Line(kUser1_val);
|
||||
/**
|
||||
* Line on the user screen
|
||||
*/
|
||||
public static final Line kUser2 = new Line(kUser2_val);
|
||||
/**
|
||||
* Line on the user screen
|
||||
*/
|
||||
public static final Line kUser3 = new Line(kUser3_val);
|
||||
/**
|
||||
* Line on the user screen
|
||||
*/
|
||||
public static final Line kUser4 = new Line(kUser4_val);
|
||||
/**
|
||||
* Line on the user screen
|
||||
*/
|
||||
public static final Line kUser5 = new Line(kUser5_val);
|
||||
/**
|
||||
* Bottom line on the user screen
|
||||
*/
|
||||
public static final Line kUser6 = new Line(kUser6_val);
|
||||
|
||||
private Line(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] m_textBuffer;
|
||||
|
||||
/**
|
||||
* Get an instance of the DriverStationLCD
|
||||
* @return an instance of the DriverStationLCD
|
||||
*/
|
||||
public static synchronized DriverStationLCD getInstance() {
|
||||
if (m_instance == null)
|
||||
m_instance = new DriverStationLCD();
|
||||
return m_instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* DriverStationLCD constructor.
|
||||
*
|
||||
* This is only called once the first time GetInstance() is called
|
||||
*/
|
||||
private DriverStationLCD() {
|
||||
m_textBuffer = new byte[FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE];
|
||||
|
||||
for (int i = 0; i < FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE; i++) {
|
||||
m_textBuffer[i] = ' ';
|
||||
}
|
||||
|
||||
m_textBuffer[0] = (byte) (kFullDisplayTextCommand >> 8);
|
||||
m_textBuffer[1] = (byte) kFullDisplayTextCommand;
|
||||
|
||||
UsageReporting.report(tResourceType.kResourceType_DriverStationLCD, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the text data to the Driver Station.
|
||||
*/
|
||||
public synchronized void updateLCD() {
|
||||
FRCNetworkCommunicationsLibrary.setUserDsLcdData(new String(m_textBuffer), FRCNetworkCommunicationsLibrary.USER_DS_LCD_DATA_SIZE, kSyncTimeout_ms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print formatted text to the Driver Station LCD text buffer.
|
||||
*
|
||||
* Use UpdateLCD() periodically to actually send the test to the Driver Station.
|
||||
*
|
||||
* @param line The line on the LCD to print to.
|
||||
* @param startingColumn The column to start printing to. This is a 1-based number.
|
||||
* @param text the text to print
|
||||
*/
|
||||
public void println(Line line, int startingColumn, String text) {
|
||||
int start = startingColumn - 1;
|
||||
int maxLength = kLineLength - start;
|
||||
|
||||
if (startingColumn < 1 || startingColumn > kLineLength) {
|
||||
throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
|
||||
}
|
||||
|
||||
int length = text.length();
|
||||
int finalLength = (length < maxLength ? length : maxLength);
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < finalLength; i++) {
|
||||
m_textBuffer[i + start + line.value * kLineLength + 2] = (byte)text.charAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Print formatted text to the Driver Station LCD text buffer.
|
||||
*
|
||||
* Use UpdateLCD() periodically to actually send the test to the Driver Station.
|
||||
*
|
||||
* @param line The line on the LCD to print to.
|
||||
* @param startingColumn The column to start printing to. This is a 1-based number.
|
||||
* @param text the text to print
|
||||
*/
|
||||
public void println(Line line, int startingColumn, StringBuffer text) {
|
||||
int start = startingColumn - 1;
|
||||
int maxLength = kLineLength - start;
|
||||
|
||||
if (startingColumn < 1 || startingColumn > kLineLength) {
|
||||
throw new IndexOutOfBoundsException("Column must be between 1 and " + kLineLength + ", inclusive");
|
||||
}
|
||||
|
||||
int length = text.length();
|
||||
int finalLength = (length < maxLength ? length : maxLength);
|
||||
synchronized (this) {
|
||||
for (int i = 0; i < finalLength; i++) {
|
||||
m_textBuffer[i + start + line.value * kLineLength + 2] = (byte) text.charAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear User Messages box on DS Operations Tab
|
||||
*
|
||||
* This method will clear all text currently displayed in the message box
|
||||
*/
|
||||
public void clear() {
|
||||
synchronized (this) {
|
||||
for (int i=0; i < kLineLength*kNumLines; i++) {
|
||||
m_textBuffer[i+2] = ' ';
|
||||
}
|
||||
}
|
||||
updateLCD();
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user