diff --git a/src/thirdparty/SparkMax/CANSparkMaxDriver.cs b/src/thirdparty/SparkMax/CANSparkMaxDriver.cs deleted file mode 100644 index 2c9f1177..00000000 --- a/src/thirdparty/SparkMax/CANSparkMaxDriver.cs +++ /dev/null @@ -1,648 +0,0 @@ -using REV.SparkMax.Natives; -using System; -using WPIUtil.NativeUtilities; - -namespace REV.SparkMax -{ - public unsafe class CANSparkMaxDriver - { - private static CANSparkMaxDriverNative driver = null!; - private static readonly object lockObject = new object(); - - public static ErrorCode SetAnalogMode(void* handle, AnalogMode mode) - { - return driver.c_SparkMax_SetAnalogMode(handle, mode); - } - public static ErrorCode GetAnalogMode(void* handle, AnalogMode* mode) - { - return driver.c_SparkMax_GetAnalogMode(handle, mode); - } - public static ErrorCode GetEncoderPosition(void* handle, float* position) - { - return driver.c_SparkMax_GetEncoderPosition(handle, position); - } - public static ErrorCode GetEncoderVelocity(void* handle, float* velocity) - { - return driver.c_SparkMax_GetEncoderVelocity(handle, velocity); - } - public static ErrorCode SetPositionConversionFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetPositionConversionFactor(handle, conversion); - } - public static ErrorCode SetVelocityConversionFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetVelocityConversionFactor(handle, conversion); - } - public static ErrorCode GetPositionConversionFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetPositionConversionFactor(handle, conversion); - } - public static ErrorCode GetVelocityConversionFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetVelocityConversionFactor(handle, conversion); - } - public static ErrorCode SetAverageDepth(void* handle, uint depth) - { - return driver.c_SparkMax_SetAverageDepth(handle, depth); - } - public static ErrorCode GetAverageDepth(void* handle, uint* depth) - { - return driver.c_SparkMax_GetAverageDepth(handle, depth); - } - public static ErrorCode SetMeasurementPeriod(void* handle, uint samples) - { - return driver.c_SparkMax_SetMeasurementPeriod(handle, samples); - } - public static ErrorCode GetMeasurementPeriod(void* handle, uint* samples) - { - return driver.c_SparkMax_GetMeasurementPeriod(handle, samples); - } - public static ErrorCode SetCountsPerRevolution(void* handle, uint cpr) - { - return driver.c_SparkMax_SetCountsPerRevolution(handle, cpr); - } - public static ErrorCode GetCountsPerRevolution(void* handle, uint* cpr) - { - return driver.c_SparkMax_GetCountsPerRevolution(handle, cpr); - } - public static ErrorCode SetEncoderInverted(void* handle, byte inverted) - { - return driver.c_SparkMax_SetEncoderInverted(handle, inverted); - } - public static ErrorCode GetEncoderInverted(void* handle, byte* inverted) - { - return driver.c_SparkMax_GetEncoderInverted(handle, inverted); - } - public static ErrorCode GetAltEncoderPosition(void* handle, float* position) - { - return driver.c_SparkMax_GetAltEncoderPosition(handle, position); - } - public static ErrorCode GetAltEncoderVelocity(void* handle, float* velocity) - { - return driver.c_SparkMax_GetAltEncoderVelocity(handle, velocity); - } - public static ErrorCode SetAltEncoderPositionFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetAltEncoderPositionFactor(handle, conversion); - } - public static ErrorCode SetAltEncoderVelocityFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetAltEncoderVelocityFactor(handle, conversion); - } - public static ErrorCode GetAltEncoderPositionFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetAltEncoderPositionFactor(handle, conversion); - } - public static ErrorCode GetAltEncoderVelocityFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetAltEncoderVelocityFactor(handle, conversion); - } - public static ErrorCode SetAltEncoderAverageDepth(void* handle, uint depth) - { - return driver.c_SparkMax_SetAltEncoderAverageDepth(handle, depth); - } - public static ErrorCode GetAltEncoderAverageDepth(void* handle, uint* depth) - { - return driver.c_SparkMax_GetAltEncoderAverageDepth(handle, depth); - } - public static ErrorCode SetAltEncoderMeasurementPeriod(void* handle, uint samples) - { - return driver.c_SparkMax_SetAltEncoderMeasurementPeriod(handle, samples); - } - public static ErrorCode GetAltEncoderMeasurementPeriod(void* handle, uint* samples) - { - return driver.c_SparkMax_GetAltEncoderMeasurementPeriod(handle, samples); - } - public static ErrorCode SetAltEncoderCountsPerRevolution(void* handle, uint cpr) - { - return driver.c_SparkMax_SetAltEncoderCountsPerRevolution(handle, cpr); - } - public static ErrorCode GetAltEncoderCountsPerRevolution(void* handle, uint* cpr) - { - return driver.c_SparkMax_GetAltEncoderCountsPerRevolution(handle, cpr); - } - public static ErrorCode SetAltEncoderInverted(void* handle, byte inverted) - { - return driver.c_SparkMax_SetAltEncoderInverted(handle, inverted); - } - public static ErrorCode GetAltEncoderInverted(void* handle, byte* inverted) - { - return driver.c_SparkMax_GetAltEncoderInverted(handle, inverted); - } - public static ErrorCode SetDataPortConfig(void* handle, DataPortConfig config) - { - return driver.c_SparkMax_SetDataPortConfig(handle, config); - } - public static ErrorCode GetDataPortConfig(void* handle, DataPortConfig* config) - { - return driver.c_SparkMax_GetDataPortConfig(handle, config); - } - public static ErrorCode SetP(void* handle, int slotID, float gain) - { - return driver.c_SparkMax_SetP(handle, slotID, gain); - } - public static ErrorCode SetI(void* handle, int slotID, float gain) - { - return driver.c_SparkMax_SetI(handle, slotID, gain); - } - public static ErrorCode SetD(void* handle, int slotID, float gain) - { - return driver.c_SparkMax_SetD(handle, slotID, gain); - } - public static ErrorCode SetDFilter(void* handle, int slotID, float gain) - { - return driver.c_SparkMax_SetDFilter(handle, slotID, gain); - } - public static ErrorCode SetFF(void* handle, int slotID, float gain) - { - return driver.c_SparkMax_SetFF(handle, slotID, gain); - } - public static ErrorCode SetIZone(void* handle, int slotID, float IZone) - { - return driver.c_SparkMax_SetIZone(handle, slotID, IZone); - } - public static ErrorCode SetOutputRange(void* handle, int slotID, float min, float max) - { - return driver.c_SparkMax_SetOutputRange(handle, slotID, min, max); - } - public static ErrorCode GetP(void* handle, int slotID, float* gain) - { - return driver.c_SparkMax_GetP(handle, slotID, gain); - } - public static ErrorCode GetI(void* handle, int slotID, float* gain) - { - return driver.c_SparkMax_GetI(handle, slotID, gain); - } - public static ErrorCode GetD(void* handle, int slotID, float* gain) - { - return driver.c_SparkMax_GetD(handle, slotID, gain); - } - public static ErrorCode GetDFilter(void* handle, int slotID, float* gain) - { - return driver.c_SparkMax_GetDFilter(handle, slotID, gain); - } - public static ErrorCode GetFF(void* handle, int slotID, float* gain) - { - return driver.c_SparkMax_GetFF(handle, slotID, gain); - } - public static ErrorCode GetIZone(void* handle, int slotID, float* IZone) - { - return driver.c_SparkMax_GetIZone(handle, slotID, IZone); - } - public static ErrorCode GetOutputMin(void* handle, int slotID, float* min) - { - return driver.c_SparkMax_GetOutputMin(handle, slotID, min); - } - public static ErrorCode GetOutputMax(void* handle, int slotID, float* max) - { - return driver.c_SparkMax_GetOutputMax(handle, slotID, max); - } - public static ErrorCode SetSmartMotionMaxVelocity(void* handle, int slotID, float maxVel) - { - return driver.c_SparkMax_SetSmartMotionMaxVelocity(handle, slotID, maxVel); - } - public static ErrorCode SetSmartMotionMaxAccel(void* handle, int slotID, float maxAccel) - { - return driver.c_SparkMax_SetSmartMotionMaxAccel(handle, slotID, maxAccel); - } - public static ErrorCode SetSmartMotionMinOutputVelocity(void* handle, int slotID, float minVel) - { - return driver.c_SparkMax_SetSmartMotionMinOutputVelocity(handle, slotID, minVel); - } - public static ErrorCode SetSmartMotionAccelStrategy(void* handle, int slotID, AccelStrategy accelStrategy) - { - return driver.c_SparkMax_SetSmartMotionAccelStrategy(handle, slotID, accelStrategy); - } - public static ErrorCode SetSmartMotionAllowedClosedLoopError(void* handle, int slotID, float allowedError) - { - return driver.c_SparkMax_SetSmartMotionAllowedClosedLoopError(handle, slotID, allowedError); - } - public static ErrorCode GetSmartMotionMaxVelocity(void* handle, int slotID, float* maxVel) - { - return driver.c_SparkMax_GetSmartMotionMaxVelocity(handle, slotID, maxVel); - } - public static ErrorCode GetSmartMotionMaxAccel(void* handle, int slotID, float* maxAccel) - { - return driver.c_SparkMax_GetSmartMotionMaxAccel(handle, slotID, maxAccel); - } - public static ErrorCode GetSmartMotionMinOutputVelocity(void* handle, int slotID, float* minVel) - { - return driver.c_SparkMax_GetSmartMotionMinOutputVelocity(handle, slotID, minVel); - } - public static ErrorCode GetSmartMotionAccelStrategy(void* handle, int slotID, AccelStrategy* accelStrategy) - { - return driver.c_SparkMax_GetSmartMotionAccelStrategy(handle, slotID, accelStrategy); - } - public static ErrorCode GetSmartMotionAllowedClosedLoopError(void* handle, int slotID, float* allowedError) - { - return driver.c_SparkMax_GetSmartMotionAllowedClosedLoopError(handle, slotID, allowedError); - } - public static ErrorCode SetIMaxAccum(void* handle, int slotID, float iMaxAccum) - { - return driver.c_SparkMax_SetIMaxAccum(handle, slotID, iMaxAccum); - } - public static ErrorCode GetIMaxAccum(void* handle, int slotID, float* iMaxAccum) - { - return driver.c_SparkMax_GetIMaxAccum(handle, slotID, iMaxAccum); - } - public static ErrorCode SetIAccum(void* handle, float iAccum) - { - return driver.c_SparkMax_SetIAccum(handle, iAccum); - } - public static ErrorCode GetIAccum(void* handle, float* iAccum) - { - return driver.c_SparkMax_GetIAccum(handle, iAccum); - } - public static ErrorCode SetFeedbackDevice(void* handle, uint sensorID) - { - return driver.c_SparkMax_SetFeedbackDevice(handle, sensorID); - } - public static ErrorCode GetFeedbackDeviceID(void* handle, uint* id) - { - return driver.c_SparkMax_GetFeedbackDeviceID(handle, id); - } - public static ErrorCode SetFeedbackDeviceRange(void* handle, float min, float max) - { - return driver.c_SparkMax_SetFeedbackDeviceRange(handle, min, max); - } - public static APIVersion GetAPIVersion() - { - lock (lockObject) - { - if (driver == null) - { - driver = new CANSparkMaxDriverNative(NativeLibraryLoader.LoadNativeLibrary("CANSparkMaxDriver")!); - } - } - return driver.c_SparkMax_GetAPIVersion(); - } - public static void SetLastError(void* handle, ErrorCode error) - { - driver.c_SparkMax_SetLastError( - handle, error); - } - public static ErrorCode GetLastError(void* handle) - { - return driver.c_SparkMax_GetLastError(handle); - } - public static ErrorCode GenerateError(int deviceID, ErrorCode error) - { - return driver.c_SparkMax_GenerateError(deviceID, error); - } - public static void* Create(int deviceId, MotorType type) - { - lock (lockObject) - { - if (driver == null) - { - driver = new CANSparkMaxDriverNative(NativeLibraryLoader.LoadNativeLibrary("CANSparkMaxDriver")!); - } - } - return driver.c_SparkMax_Create(deviceId, type); - } - public static void* Create_Inplace(int deviceId) - { - lock (lockObject) - { - if (driver == null) - { - driver = new CANSparkMaxDriverNative(NativeLibraryLoader.LoadNativeLibrary("CANSparkMaxDriver")!); - } - } - return driver.c_SparkMax_Create_Inplace(deviceId); - } - public static void Destroy(void* handle) - { - driver.c_SparkMax_Destroy(handle); - } - public static ErrorCode GetFirmwareVersion(void* handle, FirmwareVersion* fwVersion) - { - return driver.c_SparkMax_GetFirmwareVersion(handle, fwVersion); - } - public static ErrorCode GetDeviceId(void* handle, int* deviceId) - { - return driver.c_SparkMax_GetDeviceId(handle, deviceId); - } - public static ErrorCode SetMotorType(void* handle, MotorType type) - { - return driver.c_SparkMax_SetMotorType(handle, type); - } - public static ErrorCode GetMotorType(void* handle, MotorType* type) - { - return driver.c_SparkMax_GetMotorType(handle, type); - } - public static ErrorCode SetPeriodicFramePeriod(void* handle, PeriodicFrame frameId, int periodMs) - { - return driver.c_SparkMax_SetPeriodicFramePeriod(handle, frameId, periodMs); - } - public static void SetControlFramePeriod(void* handle, int periodMs) - { - driver.c_SparkMax_SetControlFramePeriod(handle, periodMs); - } - public static int GetControlFramePeriod(void* handle) - { - return driver.c_SparkMax_GetControlFramePeriod(handle); - } - public static ErrorCode SetParameterFloat32(void* handle, ConfigParameter paramId, float value) - { - return driver.c_SparkMax_SetParameterFloat32(handle, paramId, value); - } - public static ErrorCode SetParameterInt32(void* handle, ConfigParameter paramId, int value) - { - return driver.c_SparkMax_SetParameterInt32(handle, paramId, value); - } - public static ErrorCode SetParameterUint32(void* handle, ConfigParameter paramId, uint value) - { - return driver.c_SparkMax_SetParameterUint32(handle, paramId, value); - } - public static ErrorCode SetParameterBool(void* handle, ConfigParameter paramId, byte value) - { - return driver.c_SparkMax_SetParameterBool(handle, paramId, value); - } - public static ErrorCode GetParameterFloat32(void* handle, ConfigParameter paramId, float* value) - { - return driver.c_SparkMax_GetParameterFloat32(handle, paramId, value); - } - public static ErrorCode GetParameterInt32(void* handle, ConfigParameter paramId, int* value) - { - return driver.c_SparkMax_GetParameterInt32(handle, paramId, value); - } - public static ErrorCode GetParameterUint32(void* handle, ConfigParameter paramId, uint* value) - { - return driver.c_SparkMax_GetParameterUint32(handle, paramId, value); - } - public static ErrorCode GetParameterBool(void* handle, ConfigParameter paramId, byte* value) - { - return driver.c_SparkMax_GetParameterBool(handle, paramId, value); - } - public static ErrorCode GetPeriodicStatus0(void* handle, PeriodicStatus0* rawframe) - { - return driver.c_SparkMax_GetPeriodicStatus0(handle, rawframe); - } - public static ErrorCode GetPeriodicStatus1(void* handle, PeriodicStatus1* rawframe) - { - return driver.c_SparkMax_GetPeriodicStatus1(handle, rawframe); - } - public static ErrorCode GetPeriodicStatus2(void* handle, PeriodicStatus2* rawframe) - { - return driver.c_SparkMax_GetPeriodicStatus2(handle, rawframe); - } - public static ErrorCode GetPeriodicStatus3(void* handle, PeriodicStatus3* rawframe) - { - return driver.c_SparkMax_GetPeriodicStatus3(handle, rawframe); - } - public static ErrorCode GetPeriodicStatus4(void* handle, PeriodicStatus4* rawframe) - { - return driver.c_SparkMax_GetPeriodicStatus4(handle, rawframe); - } - public static ErrorCode SetEncoderPosition(void* handle, float position) - { - return driver.c_SparkMax_SetEncoderPosition(handle, position); - } - public static ErrorCode SetAltEncoderPosition(void* handle, float position) - { - return driver.c_SparkMax_SetAltEncoderPosition(handle, position); - } - public static ErrorCode RestoreFactoryDefaults(void* handle, byte persist) - { - return driver.c_SparkMax_RestoreFactoryDefaults(handle, persist); - } - public static ErrorCode FactoryWipe(void* handle, byte persist) - { - return driver.c_SparkMax_FactoryWipe(handle, persist); - } - public static ErrorCode SetFollow(void* handle, uint followerArbId, uint followerCfg) - { - return driver.c_SparkMax_SetFollow(handle, followerArbId, followerCfg); - } - public static float SafeFloat(float f) - { - return driver.c_SparkMax_SafeFloat(f); - } - public static ErrorCode SetpointCommand(void* handle, float value, ControlType ctrl, int pidSlot, float arbFeedforward, int arbFFUnits) - { - return driver.c_SparkMax_SetpointCommand(handle, value, ctrl, pidSlot, arbFeedforward, arbFFUnits); - } - public static ErrorCode GetDRVStatus(void* handle, DRVStatus* drvStatus) - { - return driver.c_SparkMax_GetDRVStatus(handle, drvStatus); - } - public static ErrorCode SetInverted(void* handle, byte inverted) - { - return driver.c_SparkMax_SetInverted(handle, inverted); - } - public static ErrorCode GetInverted(void* handle, byte* inverted) - { - return driver.c_SparkMax_GetInverted(handle, inverted); - } - public static ErrorCode SetSmartCurrentLimit(void* handle, byte stallLimit, byte freeLimit, uint limitRPM) - { - return driver.c_SparkMax_SetSmartCurrentLimit(handle, stallLimit, freeLimit, limitRPM); - } - public static ErrorCode GetSmartCurrentLimit(void* handle, byte* stallLimit, byte* freeLimit, uint* limitRPM) - { - return driver.c_SparkMax_GetSmartCurrentLimit(handle, stallLimit, freeLimit, limitRPM); - } - public static ErrorCode SetSecondaryCurrentLimit(void* handle, float limit, int chopCycles) - { - return driver.c_SparkMax_SetSecondaryCurrentLimit(handle, limit, chopCycles); - } - public static ErrorCode GetSecondaryCurrentLimit(void* handle, float* limit, int* chopCycles) - { - return driver.c_SparkMax_GetSecondaryCurrentLimit(handle, limit, chopCycles); - } - public static ErrorCode SetIdleMode(void* handle, IdleMode idlemode) - { - return driver.c_SparkMax_SetIdleMode(handle, idlemode); - } - public static ErrorCode GetIdleMode(void* handle, IdleMode* idlemode) - { - return driver.c_SparkMax_GetIdleMode(handle, idlemode); - } - public static ErrorCode EnableVoltageCompensation(void* handle, float nominalVoltage) - { - return driver.c_SparkMax_EnableVoltageCompensation(handle, nominalVoltage); - } - public static ErrorCode GetVoltageCompensationNominalVoltage(void* handle, float* nominalVoltage) - { - return driver.c_SparkMax_GetVoltageCompensationNominalVoltage(handle, nominalVoltage); - } - public static ErrorCode DisableVoltageCompensation(void* handle) - { - return driver.c_SparkMax_DisableVoltageCompensation(handle); - } - public static ErrorCode SetOpenLoopRampRate(void* handle, float rate) - { - return driver.c_SparkMax_SetOpenLoopRampRate(handle, rate); - } - public static ErrorCode GetOpenLoopRampRate(void* handle, float* rate) - { - return driver.c_SparkMax_GetOpenLoopRampRate(handle, rate); - } - public static ErrorCode SetClosedLoopRampRate(void* handle, float rate) - { - return driver.c_SparkMax_SetClosedLoopRampRate(handle, rate); - } - public static ErrorCode GetClosedLoopRampRate(void* handle, float* rate) - { - return driver.c_SparkMax_GetClosedLoopRampRate(handle, rate); - } - public static ErrorCode IsFollower(void* handle, byte* isFollower) - { - return driver.c_SparkMax_IsFollower(handle, isFollower); - } - public static ErrorCode GetFaults(void* handle, ushort* faults) - { - return driver.c_SparkMax_GetFaults(handle, faults); - } - public static ErrorCode GetStickyFaults(void* handle, ushort* stickyFaults) - { - return driver.c_SparkMax_GetStickyFaults(handle, stickyFaults); - } - public static ErrorCode GetFault(void* handle, FaultID faultId, byte* fault) - { - return driver.c_SparkMax_GetFault(handle, faultId, fault); - } - public static ErrorCode GetStickyFault(void* handle, FaultID faultId, byte* stickyfault) - { - return driver.c_SparkMax_GetStickyFault(handle, faultId, stickyfault); - } - public static ErrorCode GetBusVoltage(void* handle, float* busVoltage) - { - return driver.c_SparkMax_GetBusVoltage(handle, busVoltage); - } - public static ErrorCode GetAppliedOutput(void* handle, float* appliedOutput) - { - return driver.c_SparkMax_GetAppliedOutput(handle, appliedOutput); - } - public static ErrorCode GetOutputCurrent(void* handle, float* outputCurrent) - { - return driver.c_SparkMax_GetOutputCurrent(handle, outputCurrent); - } - public static ErrorCode GetMotorTemperature(void* handle, float* motorTemperature) - { - return driver.c_SparkMax_GetMotorTemperature(handle, motorTemperature); - } - public static ErrorCode ClearFaults(void* handle) - { - return driver.c_SparkMax_ClearFaults(handle); - } - public static ErrorCode BurnFlash(void* handle) - { - return driver.c_SparkMax_BurnFlash(handle); - } - public static ErrorCode SetCANTimeout(void* handle, int timeoutMs) - { - return driver.c_SparkMax_SetCANTimeout(handle, timeoutMs); - } - public static ErrorCode EnableSoftLimit(void* handle, LimitDirection dir, byte enable) - { - return driver.c_SparkMax_EnableSoftLimit(handle, dir, enable); - } - public static ErrorCode IsSoftLimitEnabled(void* handle, LimitDirection dir, byte* enabled) - { - return driver.c_SparkMax_IsSoftLimitEnabled(handle, dir, enabled); - } - public static ErrorCode SetSoftLimit(void* handle, LimitDirection dir, float limit) - { - return driver.c_SparkMax_SetSoftLimit(handle, dir, limit); - } - public static ErrorCode GetSoftLimit(void* handle, LimitDirection dir, float* limit) - { - return driver.c_SparkMax_GetSoftLimit(handle, dir, limit); - } - public static ErrorCode SetSensorType(void* handle, EncoderType sensorType) - { - return driver.c_SparkMax_SetSensorType(handle, sensorType); - } - public static ErrorCode IDQuery(uint* uniqueIdArray, IntPtr uniqueIdArraySize, IntPtr* numberOfDevices) - { - return driver.c_SparkMax_IDQuery(uniqueIdArray, uniqueIdArraySize, numberOfDevices); - } - public static ErrorCode IDAssign(uint uniqueId, byte deviceId) - { - return driver.c_SparkMax_IDAssign(uniqueId, deviceId); - } - public static ErrorCode Identify(void* handle) - { - return driver.c_SparkMax_Identify(handle); - } - public static ErrorCode IdentifyUniqueId(uint uniqueId) - { - return driver.c_SparkMax_IdentifyUniqueId(uniqueId); - } - public static ErrorCode SetLimitPolarity(void* handle, LimitDirection sw, LimitPolarity polarity) - { - return driver.c_SparkMax_SetLimitPolarity(handle, sw, polarity); - } - public static ErrorCode GetLimitPolarity(void* handle, LimitDirection sw, LimitPolarity* polarity) - { - return driver.c_SparkMax_GetLimitPolarity(handle, sw, polarity); - } - public static ErrorCode GetLimitSwitch(void* handle, LimitDirection sw, byte* limit) - { - return driver.c_SparkMax_GetLimitSwitch(handle, sw, limit); - } - public static ErrorCode EnableLimitSwitch(void* handle, LimitDirection sw, byte enable) - { - return driver.c_SparkMax_EnableLimitSwitch(handle, sw, enable); - } - public static ErrorCode IsLimitEnabled(void* handle, LimitDirection sw, byte* enabled) - { - return driver.c_SparkMax_IsLimitEnabled(handle, sw, enabled); - } - public static ErrorCode GetAnalogPosition(void* handle, float* position) - { - return driver.c_SparkMax_GetAnalogPosition(handle, position); - } - public static ErrorCode GetAnalogVelocity(void* handle, float* velocity) - { - return driver.c_SparkMax_GetAnalogVelocity(handle, velocity); - } - public static ErrorCode GetAnalogVoltage(void* handle, float* voltage) - { - return driver.c_SparkMax_GetAnalogVoltage(handle, voltage); - } - public static ErrorCode SetAnalogPositionConversionFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetAnalogPositionConversionFactor(handle, conversion); - } - public static ErrorCode SetAnalogVelocityConversionFactor(void* handle, float conversion) - { - return driver.c_SparkMax_SetAnalogVelocityConversionFactor(handle, conversion); - } - public static ErrorCode GetAnalogPositionConversionFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetAnalogPositionConversionFactor(handle, conversion); - } - public static ErrorCode GetAnalogVelocityConversionFactor(void* handle, float* conversion) - { - return driver.c_SparkMax_GetAnalogVelocityConversionFactor(handle, conversion); - } - public static ErrorCode SetAnalogInverted(void* handle, byte inverted) - { - return driver.c_SparkMax_SetAnalogInverted(handle, inverted); - } - public static ErrorCode GetAnalogInverted(void* handle, byte* inverted) - { - return driver.c_SparkMax_GetAnalogInverted(handle, inverted); - } - public static ErrorCode SetAnalogAverageDepth(void* handle, uint depth) - { - return driver.c_SparkMax_SetAnalogAverageDepth(handle, depth); - } - public static ErrorCode GetAnalogAverageDepth(void* handle, uint* depth) - { - return driver.c_SparkMax_GetAnalogAverageDepth(handle, depth); - } - public static ErrorCode SetAnalogMeasurementPeriod(void* handle, uint samples) - { - return driver.c_SparkMax_SetAnalogMeasurementPeriod(handle, samples); - } - public static ErrorCode GetAnalogMeasurementPeriod(void* handle, uint* samples) - { - return driver.c_SparkMax_GetAnalogMeasurementPeriod(handle, samples); - } - - } -} diff --git a/src/thirdparty/SparkMax/CANSparkMaxLowLevel.cs b/src/thirdparty/SparkMax/CANSparkMaxLowLevel.cs deleted file mode 100644 index dd0360f9..00000000 --- a/src/thirdparty/SparkMax/CANSparkMaxLowLevel.cs +++ /dev/null @@ -1,188 +0,0 @@ -using REV.SparkMax.Natives; -using System; -using System.Text; - -namespace REV.SparkMax -{ - public unsafe class CANSparkMaxLowLevel : /*SpeedController,*/ IDisposable - { - public const byte kAPIMajorVersion = 0; - public const byte kAPIMinorVersion = 0; - public const byte kAPIBuildVersion = 0; - public const uint kAPIVersion = 0; - - public CANSparkMaxLowLevel(int deviceId, MotorType type) - { - m_deviceId = deviceId; - m_sparkMax = CANSparkMaxDriver.Create(deviceId, type); - m_motorType = type; - } - - public void Dispose() - { - CANSparkMaxDriver.Destroy(m_sparkMax); - m_sparkMax = null; - } - - public uint FirmwareVersion - { - get - { - FirmwareVersion version; - CANSparkMaxDriver.GetFirmwareVersion(m_sparkMax, &version); - return version.VersionRaw; - } - } - - public (uint version, bool isDebug) FirmwareVersionDebug - { - get - { - FirmwareVersion version; - CANSparkMaxDriver.GetFirmwareVersion(m_sparkMax, &version); - return (version.VersionRaw, version.IsDebug); - } - } - - public string FirmwareString - { - get - { - FirmwareVersion version; - CANSparkMaxDriver.GetFirmwareVersion(m_sparkMax, &version); - uint firmwareBuild = version.Build; - - bool isDebugBuild = version.IsDebug; - - StringBuilder builder = new StringBuilder(); - builder.Append('v'); - builder.Append((int)version.Major); - builder.Append('.'); - builder.Append((int)version.Minor); - builder.Append('.'); - builder.Append(firmwareBuild); - if (isDebugBuild) - { - builder.Append(" Debug Build"); - } - return builder.ToString(); - } - } - - public byte[] SerialNumber => Array.Empty(); - - public int DeviceId => m_deviceId; - - public MotorType InitialMotorType => m_motorType; - - public MotorType MotorType - { - get - { - MotorType type; - CANSparkMaxDriver.GetMotorType(m_sparkMax, &type); - return type; - } - set - { - CANSparkMaxDriver.SetMotorType(m_sparkMax, value); - } - } - - public ErrorCode SetPeriodicFramePeriod(PeriodicFrame frame, TimeSpan period) - { - return CANSparkMaxDriver.SetPeriodicFramePeriod(m_sparkMax, frame, (int)period.TotalMilliseconds); - } - - public void SetControlFramePeriod(TimeSpan period) - { - CANSparkMaxDriver.SetControlFramePeriod(m_sparkMax, (int)period.TotalMilliseconds); - } - - public ErrorCode RestoreFactoryDefaults(bool persist = false) - { - return CANSparkMaxDriver.RestoreFactoryDefaults(m_sparkMax, persist ? (byte)1 : (byte)0); - } - - //public void EnableExternalUSBControl(bool enable) - //{ - // CANSparkMaxDriver.EnableExternalControl(enable); - //} - - //public void SetEnable(bool enable) - //{ - - //} - - protected ErrorCode SetEncPosition(double value) - { - return CANSparkMaxDriver.SetEncoderPosition(m_sparkMax, (float)value); - } - - protected ErrorCode SetIAccum(double value) - { - return CANSparkMaxDriver.SetIAccum(m_sparkMax, (float)value); - } - - protected struct FollowConfig - { - public uint LeaderArbId; - public uint ConfigRaw; - } - - protected unsafe void* m_sparkMax; - - protected PeriodicStatus0 PeriodicStatus0 - { - get - { - PeriodicStatus0LowLevel cStatus0 = default; - //CANSparkMaxDriver.GetPeriodicStatus0(m_sparkMax, &cStatus0); - - return new PeriodicStatus0(cStatus0); - } - } - - protected PeriodicStatus1 PeriodicStatus1 - { - get - { - return default; - } - } - - protected PeriodicStatus2 PeriodicStatus2 - { - get - { - return default; - } - } - - protected ErrorCode SetFollow(FollowConfig config) - { - return 0; - } - - protected ErrorCode FollowerInvert(bool invert) - { - return 0; - } - - protected ErrorCode SetpointCommand(double value, ControlType ctrl = ControlType.kDutyCycle, int pidSlot = 0, double arbFeedforward = 0, int arbFFUnits = 0) - { - return 0; - } - - protected float GetSafeFloat(float f) - { - return f; - } - - protected MotorType m_motorType; - - private readonly int m_deviceId; - - - } -} diff --git a/src/thirdparty/SparkMax/Natives/CANSparkMaxDriverNative.cs b/src/thirdparty/SparkMax/Natives/CANSparkMaxDriverNative.cs deleted file mode 100644 index 21fc5226..00000000 --- a/src/thirdparty/SparkMax/Natives/CANSparkMaxDriverNative.cs +++ /dev/null @@ -1,1550 +0,0 @@ -using WPIUtil.ILGeneration; -using System.Runtime.CompilerServices; -using System; - -namespace REV.SparkMax.Natives -{ - public unsafe class CANSparkMaxDriverNative - { - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogModeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogMode(void* handle, AnalogMode mode) - { - return c_SparkMax_SetAnalogModeFunc(handle, mode); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogModeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogMode(void* handle, AnalogMode* mode) - { - return c_SparkMax_GetAnalogModeFunc(handle, mode); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetEncoderPositionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetEncoderPosition(void* handle, float* position) - { - return c_SparkMax_GetEncoderPositionFunc(handle, position); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetEncoderVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetEncoderVelocity(void* handle, float* velocity) - { - return c_SparkMax_GetEncoderVelocityFunc(handle, velocity); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetPositionConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetPositionConversionFactor(void* handle, float conversion) - { - return c_SparkMax_SetPositionConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetVelocityConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetVelocityConversionFactor(void* handle, float conversion) - { - return c_SparkMax_SetVelocityConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPositionConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPositionConversionFactor(void* handle, float* conversion) - { - return c_SparkMax_GetPositionConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetVelocityConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetVelocityConversionFactor(void* handle, float* conversion) - { - return c_SparkMax_GetVelocityConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAverageDepth(void* handle, uint depth) - { - return c_SparkMax_SetAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAverageDepth(void* handle, uint* depth) - { - return c_SparkMax_GetAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetMeasurementPeriod(void* handle, uint samples) - { - return c_SparkMax_SetMeasurementPeriodFunc(handle, samples); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetMeasurementPeriod(void* handle, uint* samples) - { - return c_SparkMax_GetMeasurementPeriodFunc(handle, samples); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetCountsPerRevolutionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetCountsPerRevolution(void* handle, uint cpr) - { - return c_SparkMax_SetCountsPerRevolutionFunc(handle, cpr); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetCountsPerRevolutionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetCountsPerRevolution(void* handle, uint* cpr) - { - return c_SparkMax_GetCountsPerRevolutionFunc(handle, cpr); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetEncoderInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetEncoderInverted(void* handle, byte inverted) - { - return c_SparkMax_SetEncoderInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetEncoderInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetEncoderInverted(void* handle, byte* inverted) - { - return c_SparkMax_GetEncoderInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderPositionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderPosition(void* handle, float* position) - { - return c_SparkMax_GetAltEncoderPositionFunc(handle, position); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderVelocity(void* handle, float* velocity) - { - return c_SparkMax_GetAltEncoderVelocityFunc(handle, velocity); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderPositionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderPositionFactor(void* handle, float conversion) - { - return c_SparkMax_SetAltEncoderPositionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderVelocityFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderVelocityFactor(void* handle, float conversion) - { - return c_SparkMax_SetAltEncoderVelocityFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderPositionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderPositionFactor(void* handle, float* conversion) - { - return c_SparkMax_GetAltEncoderPositionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderVelocityFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderVelocityFactor(void* handle, float* conversion) - { - return c_SparkMax_GetAltEncoderVelocityFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderAverageDepth(void* handle, uint depth) - { - return c_SparkMax_SetAltEncoderAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderAverageDepth(void* handle, uint* depth) - { - return c_SparkMax_GetAltEncoderAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderMeasurementPeriod(void* handle, uint samples) - { - return c_SparkMax_SetAltEncoderMeasurementPeriodFunc(handle, samples); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderMeasurementPeriod(void* handle, uint* samples) - { - return c_SparkMax_GetAltEncoderMeasurementPeriodFunc(handle, samples); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderCountsPerRevolutionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderCountsPerRevolution(void* handle, uint cpr) - { - return c_SparkMax_SetAltEncoderCountsPerRevolutionFunc(handle, cpr); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderCountsPerRevolutionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderCountsPerRevolution(void* handle, uint* cpr) - { - return c_SparkMax_GetAltEncoderCountsPerRevolutionFunc(handle, cpr); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderInverted(void* handle, byte inverted) - { - return c_SparkMax_SetAltEncoderInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAltEncoderInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAltEncoderInverted(void* handle, byte* inverted) - { - return c_SparkMax_GetAltEncoderInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetDataPortConfigFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetDataPortConfig(void* handle, DataPortConfig config) - { - return c_SparkMax_SetDataPortConfigFunc(handle, config); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetDataPortConfigFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetDataPortConfig(void* handle, DataPortConfig* config) - { - return c_SparkMax_GetDataPortConfigFunc(handle, config); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetPFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetP(void* handle, int slotID, float gain) - { - return c_SparkMax_SetPFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetIFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetI(void* handle, int slotID, float gain) - { - return c_SparkMax_SetIFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetDFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetD(void* handle, int slotID, float gain) - { - return c_SparkMax_SetDFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetDFilterFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetDFilter(void* handle, int slotID, float gain) - { - return c_SparkMax_SetDFilterFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetFFFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetFF(void* handle, int slotID, float gain) - { - return c_SparkMax_SetFFFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetIZoneFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetIZone(void* handle, int slotID, float IZone) - { - return c_SparkMax_SetIZoneFunc(handle, slotID, IZone); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetOutputRangeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetOutputRange(void* handle, int slotID, float min, float max) - { - return c_SparkMax_SetOutputRangeFunc(handle, slotID, min, max); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetP(void* handle, int slotID, float* gain) - { - return c_SparkMax_GetPFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetIFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetI(void* handle, int slotID, float* gain) - { - return c_SparkMax_GetIFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetDFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetD(void* handle, int slotID, float* gain) - { - return c_SparkMax_GetDFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetDFilterFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetDFilter(void* handle, int slotID, float* gain) - { - return c_SparkMax_GetDFilterFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetFFFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetFF(void* handle, int slotID, float* gain) - { - return c_SparkMax_GetFFFunc(handle, slotID, gain); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetIZoneFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetIZone(void* handle, int slotID, float* IZone) - { - return c_SparkMax_GetIZoneFunc(handle, slotID, IZone); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetOutputMinFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetOutputMin(void* handle, int slotID, float* min) - { - return c_SparkMax_GetOutputMinFunc(handle, slotID, min); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetOutputMaxFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetOutputMax(void* handle, int slotID, float* max) - { - return c_SparkMax_GetOutputMaxFunc(handle, slotID, max); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartMotionMaxVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartMotionMaxVelocity(void* handle, int slotID, float maxVel) - { - return c_SparkMax_SetSmartMotionMaxVelocityFunc(handle, slotID, maxVel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartMotionMaxAccelFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartMotionMaxAccel(void* handle, int slotID, float maxAccel) - { - return c_SparkMax_SetSmartMotionMaxAccelFunc(handle, slotID, maxAccel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartMotionMinOutputVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartMotionMinOutputVelocity(void* handle, int slotID, float minVel) - { - return c_SparkMax_SetSmartMotionMinOutputVelocityFunc(handle, slotID, minVel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartMotionAccelStrategyFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartMotionAccelStrategy(void* handle, int slotID, AccelStrategy accelStrategy) - { - return c_SparkMax_SetSmartMotionAccelStrategyFunc(handle, slotID, accelStrategy); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartMotionAllowedClosedLoopErrorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartMotionAllowedClosedLoopError(void* handle, int slotID, float allowedError) - { - return c_SparkMax_SetSmartMotionAllowedClosedLoopErrorFunc(handle, slotID, allowedError); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartMotionMaxVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartMotionMaxVelocity(void* handle, int slotID, float* maxVel) - { - return c_SparkMax_GetSmartMotionMaxVelocityFunc(handle, slotID, maxVel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartMotionMaxAccelFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartMotionMaxAccel(void* handle, int slotID, float* maxAccel) - { - return c_SparkMax_GetSmartMotionMaxAccelFunc(handle, slotID, maxAccel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartMotionMinOutputVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartMotionMinOutputVelocity(void* handle, int slotID, float* minVel) - { - return c_SparkMax_GetSmartMotionMinOutputVelocityFunc(handle, slotID, minVel); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartMotionAccelStrategyFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartMotionAccelStrategy(void* handle, int slotID, AccelStrategy* accelStrategy) - { - return c_SparkMax_GetSmartMotionAccelStrategyFunc(handle, slotID, accelStrategy); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartMotionAllowedClosedLoopErrorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartMotionAllowedClosedLoopError(void* handle, int slotID, float* allowedError) - { - return c_SparkMax_GetSmartMotionAllowedClosedLoopErrorFunc(handle, slotID, allowedError); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetIMaxAccumFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetIMaxAccum(void* handle, int slotID, float iMaxAccum) - { - return c_SparkMax_SetIMaxAccumFunc(handle, slotID, iMaxAccum); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetIMaxAccumFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetIMaxAccum(void* handle, int slotID, float* iMaxAccum) - { - return c_SparkMax_GetIMaxAccumFunc(handle, slotID, iMaxAccum); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetIAccumFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetIAccum(void* handle, float iAccum) - { - return c_SparkMax_SetIAccumFunc(handle, iAccum); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetIAccumFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetIAccum(void* handle, float* iAccum) - { - return c_SparkMax_GetIAccumFunc(handle, iAccum); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetFeedbackDeviceFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetFeedbackDevice(void* handle, uint sensorID) - { - return c_SparkMax_SetFeedbackDeviceFunc(handle, sensorID); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetFeedbackDeviceIDFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetFeedbackDeviceID(void* handle, uint* id) - { - return c_SparkMax_GetFeedbackDeviceIDFunc(handle, id); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetFeedbackDeviceRangeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetFeedbackDeviceRange(void* handle, float min, float max) - { - return c_SparkMax_SetFeedbackDeviceRangeFunc(handle, min, max); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAPIVersionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public APIVersion c_SparkMax_GetAPIVersion() - { - return c_SparkMax_GetAPIVersionFunc(); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetLastErrorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void c_SparkMax_SetLastError(void* handle, ErrorCode error) - { - c_SparkMax_SetLastErrorFunc(handle, error); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetLastErrorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetLastError(void* handle) - { - return c_SparkMax_GetLastErrorFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GenerateErrorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GenerateError(int deviceID, ErrorCode error) - { - return c_SparkMax_GenerateErrorFunc(deviceID, error); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_CreateFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void* c_SparkMax_Create(int deviceId, MotorType type) - { - return c_SparkMax_CreateFunc(deviceId, type); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_Create_InplaceFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void* c_SparkMax_Create_Inplace(int deviceId) - { - return c_SparkMax_Create_InplaceFunc(deviceId); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_DestroyFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void c_SparkMax_Destroy(void* handle) - { - c_SparkMax_DestroyFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetFirmwareVersionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetFirmwareVersion(void* handle, FirmwareVersion* fwVersion) - { - return c_SparkMax_GetFirmwareVersionFunc(handle, fwVersion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetDeviceIdFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetDeviceId(void* handle, int* deviceId) - { - return c_SparkMax_GetDeviceIdFunc(handle, deviceId); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetMotorTypeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetMotorType(void* handle, MotorType type) - { - return c_SparkMax_SetMotorTypeFunc(handle, type); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetMotorTypeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetMotorType(void* handle, MotorType* type) - { - return c_SparkMax_GetMotorTypeFunc(handle, type); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetPeriodicFramePeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetPeriodicFramePeriod(void* handle, PeriodicFrame frameId, int periodMs) - { - return c_SparkMax_SetPeriodicFramePeriodFunc(handle, frameId, periodMs); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetControlFramePeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void c_SparkMax_SetControlFramePeriod(void* handle, int periodMs) - { - c_SparkMax_SetControlFramePeriodFunc(handle, periodMs); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetControlFramePeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int c_SparkMax_GetControlFramePeriod(void* handle) - { - return c_SparkMax_GetControlFramePeriodFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetParameterFloat32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetParameterFloat32(void* handle, ConfigParameter paramId, float value) - { - return c_SparkMax_SetParameterFloat32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetParameterInt32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetParameterInt32(void* handle, ConfigParameter paramId, int value) - { - return c_SparkMax_SetParameterInt32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetParameterUint32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetParameterUint32(void* handle, ConfigParameter paramId, uint value) - { - return c_SparkMax_SetParameterUint32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetParameterBoolFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetParameterBool(void* handle, ConfigParameter paramId, byte value) - { - return c_SparkMax_SetParameterBoolFunc(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetParameterFloat32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetParameterFloat32(void* handle, ConfigParameter paramId, float* value) - { - return c_SparkMax_GetParameterFloat32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetParameterInt32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetParameterInt32(void* handle, ConfigParameter paramId, int* value) - { - return c_SparkMax_GetParameterInt32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetParameterUint32Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetParameterUint32(void* handle, ConfigParameter paramId, uint* value) - { - return c_SparkMax_GetParameterUint32Func(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetParameterBoolFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetParameterBool(void* handle, ConfigParameter paramId, byte* value) - { - return c_SparkMax_GetParameterBoolFunc(handle, paramId, value); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPeriodicStatus0Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPeriodicStatus0(void* handle, PeriodicStatus0* rawframe) - { - return c_SparkMax_GetPeriodicStatus0Func(handle, rawframe); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPeriodicStatus1Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPeriodicStatus1(void* handle, PeriodicStatus1* rawframe) - { - return c_SparkMax_GetPeriodicStatus1Func(handle, rawframe); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPeriodicStatus2Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPeriodicStatus2(void* handle, PeriodicStatus2* rawframe) - { - return c_SparkMax_GetPeriodicStatus2Func(handle, rawframe); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPeriodicStatus3Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPeriodicStatus3(void* handle, PeriodicStatus3* rawframe) - { - return c_SparkMax_GetPeriodicStatus3Func(handle, rawframe); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetPeriodicStatus4Func; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetPeriodicStatus4(void* handle, PeriodicStatus4* rawframe) - { - return c_SparkMax_GetPeriodicStatus4Func(handle, rawframe); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetEncoderPositionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetEncoderPosition(void* handle, float position) - { - return c_SparkMax_SetEncoderPositionFunc(handle, position); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAltEncoderPositionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAltEncoderPosition(void* handle, float position) - { - return c_SparkMax_SetAltEncoderPositionFunc(handle, position); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_RestoreFactoryDefaultsFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_RestoreFactoryDefaults(void* handle, byte persist) - { - return c_SparkMax_RestoreFactoryDefaultsFunc(handle, persist); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_FactoryWipeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_FactoryWipe(void* handle, byte persist) - { - return c_SparkMax_FactoryWipeFunc(handle, persist); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetFollowFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetFollow(void* handle, uint followerArbId, uint followerCfg) - { - return c_SparkMax_SetFollowFunc(handle, followerArbId, followerCfg); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SafeFloatFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public float c_SparkMax_SafeFloat(float f) - { - return c_SparkMax_SafeFloatFunc(f); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetpointCommandFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetpointCommand(void* handle, float value, ControlType ctrl, int pidSlot, float arbFeedforward, int arbFFUnits) - { - return c_SparkMax_SetpointCommandFunc(handle, value, ctrl, pidSlot, arbFeedforward, arbFFUnits); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetDRVStatusFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetDRVStatus(void* handle, DRVStatus* drvStatus) - { - return c_SparkMax_GetDRVStatusFunc(handle, drvStatus); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetInverted(void* handle, byte inverted) - { - return c_SparkMax_SetInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetInverted(void* handle, byte* inverted) - { - return c_SparkMax_GetInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSmartCurrentLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSmartCurrentLimit(void* handle, byte stallLimit, byte freeLimit, uint limitRPM) - { - return c_SparkMax_SetSmartCurrentLimitFunc(handle, stallLimit, freeLimit, limitRPM); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSmartCurrentLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSmartCurrentLimit(void* handle, byte* stallLimit, byte* freeLimit, uint* limitRPM) - { - return c_SparkMax_GetSmartCurrentLimitFunc(handle, stallLimit, freeLimit, limitRPM); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSecondaryCurrentLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSecondaryCurrentLimit(void* handle, float limit, int chopCycles) - { - return c_SparkMax_SetSecondaryCurrentLimitFunc(handle, limit, chopCycles); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSecondaryCurrentLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSecondaryCurrentLimit(void* handle, float* limit, int* chopCycles) - { - return c_SparkMax_GetSecondaryCurrentLimitFunc(handle, limit, chopCycles); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetIdleModeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetIdleMode(void* handle, IdleMode idlemode) - { - return c_SparkMax_SetIdleModeFunc(handle, idlemode); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetIdleModeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetIdleMode(void* handle, IdleMode* idlemode) - { - return c_SparkMax_GetIdleModeFunc(handle, idlemode); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_EnableVoltageCompensationFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_EnableVoltageCompensation(void* handle, float nominalVoltage) - { - return c_SparkMax_EnableVoltageCompensationFunc(handle, nominalVoltage); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetVoltageCompensationNominalVoltageFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetVoltageCompensationNominalVoltage(void* handle, float* nominalVoltage) - { - return c_SparkMax_GetVoltageCompensationNominalVoltageFunc(handle, nominalVoltage); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_DisableVoltageCompensationFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_DisableVoltageCompensation(void* handle) - { - return c_SparkMax_DisableVoltageCompensationFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetOpenLoopRampRateFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetOpenLoopRampRate(void* handle, float rate) - { - return c_SparkMax_SetOpenLoopRampRateFunc(handle, rate); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetOpenLoopRampRateFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetOpenLoopRampRate(void* handle, float* rate) - { - return c_SparkMax_GetOpenLoopRampRateFunc(handle, rate); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetClosedLoopRampRateFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetClosedLoopRampRate(void* handle, float rate) - { - return c_SparkMax_SetClosedLoopRampRateFunc(handle, rate); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetClosedLoopRampRateFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetClosedLoopRampRate(void* handle, float* rate) - { - return c_SparkMax_GetClosedLoopRampRateFunc(handle, rate); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IsFollowerFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IsFollower(void* handle, byte* isFollower) - { - return c_SparkMax_IsFollowerFunc(handle, isFollower); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetFaultsFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetFaults(void* handle, ushort* faults) - { - return c_SparkMax_GetFaultsFunc(handle, faults); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetStickyFaultsFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetStickyFaults(void* handle, ushort* stickyFaults) - { - return c_SparkMax_GetStickyFaultsFunc(handle, stickyFaults); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetFaultFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetFault(void* handle, FaultID faultId, byte* fault) - { - return c_SparkMax_GetFaultFunc(handle, faultId, fault); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetStickyFaultFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetStickyFault(void* handle, FaultID faultId, byte* stickyfault) - { - return c_SparkMax_GetStickyFaultFunc(handle, faultId, stickyfault); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetBusVoltageFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetBusVoltage(void* handle, float* busVoltage) - { - return c_SparkMax_GetBusVoltageFunc(handle, busVoltage); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAppliedOutputFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAppliedOutput(void* handle, float* appliedOutput) - { - return c_SparkMax_GetAppliedOutputFunc(handle, appliedOutput); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetOutputCurrentFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetOutputCurrent(void* handle, float* outputCurrent) - { - return c_SparkMax_GetOutputCurrentFunc(handle, outputCurrent); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetMotorTemperatureFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetMotorTemperature(void* handle, float* motorTemperature) - { - return c_SparkMax_GetMotorTemperatureFunc(handle, motorTemperature); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_ClearFaultsFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_ClearFaults(void* handle) - { - return c_SparkMax_ClearFaultsFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_BurnFlashFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_BurnFlash(void* handle) - { - return c_SparkMax_BurnFlashFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetCANTimeoutFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetCANTimeout(void* handle, int timeoutMs) - { - return c_SparkMax_SetCANTimeoutFunc(handle, timeoutMs); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_EnableSoftLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_EnableSoftLimit(void* handle, LimitDirection dir, byte enable) - { - return c_SparkMax_EnableSoftLimitFunc(handle, dir, enable); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IsSoftLimitEnabledFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IsSoftLimitEnabled(void* handle, LimitDirection dir, byte* enabled) - { - return c_SparkMax_IsSoftLimitEnabledFunc(handle, dir, enabled); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSoftLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSoftLimit(void* handle, LimitDirection dir, float limit) - { - return c_SparkMax_SetSoftLimitFunc(handle, dir, limit); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetSoftLimitFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetSoftLimit(void* handle, LimitDirection dir, float* limit) - { - return c_SparkMax_GetSoftLimitFunc(handle, dir, limit); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetSensorTypeFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetSensorType(void* handle, EncoderType sensorType) - { - return c_SparkMax_SetSensorTypeFunc(handle, sensorType); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IDQueryFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IDQuery(uint* uniqueIdArray, IntPtr uniqueIdArraySize, IntPtr* numberOfDevices) - { - return c_SparkMax_IDQueryFunc(uniqueIdArray, uniqueIdArraySize, numberOfDevices); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IDAssignFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IDAssign(uint uniqueId, byte deviceId) - { - return c_SparkMax_IDAssignFunc(uniqueId, deviceId); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IdentifyFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_Identify(void* handle) - { - return c_SparkMax_IdentifyFunc(handle); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IdentifyUniqueIdFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IdentifyUniqueId(uint uniqueId) - { - return c_SparkMax_IdentifyUniqueIdFunc(uniqueId); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetLimitPolarityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetLimitPolarity(void* handle, LimitDirection sw, LimitPolarity polarity) - { - return c_SparkMax_SetLimitPolarityFunc(handle, sw, polarity); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetLimitPolarityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetLimitPolarity(void* handle, LimitDirection sw, LimitPolarity* polarity) - { - return c_SparkMax_GetLimitPolarityFunc(handle, sw, polarity); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetLimitSwitchFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetLimitSwitch(void* handle, LimitDirection sw, byte* limit) - { - return c_SparkMax_GetLimitSwitchFunc(handle, sw, limit); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_EnableLimitSwitchFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_EnableLimitSwitch(void* handle, LimitDirection sw, byte enable) - { - return c_SparkMax_EnableLimitSwitchFunc(handle, sw, enable); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_IsLimitEnabledFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_IsLimitEnabled(void* handle, LimitDirection sw, byte* enabled) - { - return c_SparkMax_IsLimitEnabledFunc(handle, sw, enabled); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogPositionFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogPosition(void* handle, float* position) - { - return c_SparkMax_GetAnalogPositionFunc(handle, position); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogVelocityFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogVelocity(void* handle, float* velocity) - { - return c_SparkMax_GetAnalogVelocityFunc(handle, velocity); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogVoltageFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogVoltage(void* handle, float* voltage) - { - return c_SparkMax_GetAnalogVoltageFunc(handle, voltage); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogPositionConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogPositionConversionFactor(void* handle, float conversion) - { - return c_SparkMax_SetAnalogPositionConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogVelocityConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogVelocityConversionFactor(void* handle, float conversion) - { - return c_SparkMax_SetAnalogVelocityConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogPositionConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogPositionConversionFactor(void* handle, float* conversion) - { - return c_SparkMax_GetAnalogPositionConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogVelocityConversionFactorFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogVelocityConversionFactor(void* handle, float* conversion) - { - return c_SparkMax_GetAnalogVelocityConversionFactorFunc(handle, conversion); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogInverted(void* handle, byte inverted) - { - return c_SparkMax_SetAnalogInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogInvertedFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogInverted(void* handle, byte* inverted) - { - return c_SparkMax_GetAnalogInvertedFunc(handle, inverted); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogAverageDepth(void* handle, uint depth) - { - return c_SparkMax_SetAnalogAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogAverageDepthFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogAverageDepth(void* handle, uint* depth) - { - return c_SparkMax_GetAnalogAverageDepthFunc(handle, depth); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_SetAnalogMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_SetAnalogMeasurementPeriod(void* handle, uint samples) - { - return c_SparkMax_SetAnalogMeasurementPeriodFunc(handle, samples); - } - - - private delegate* unmanaged[Cdecl] c_SparkMax_GetAnalogMeasurementPeriodFunc; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ErrorCode c_SparkMax_GetAnalogMeasurementPeriod(void* handle, uint* samples) - { - return c_SparkMax_GetAnalogMeasurementPeriodFunc(handle, samples); - } - - - - public CANSparkMaxDriverNative(IFunctionPointerLoader loader) - { - if (loader == null) - { - throw new ArgumentNullException(nameof(loader)); - } - - c_SparkMax_SetAnalogModeFunc = (delegate* unmanaged[Cdecl] < void *, AnalogMode, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogMode"); - c_SparkMax_GetAnalogModeFunc = (delegate* unmanaged[Cdecl] < void *, AnalogMode *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogMode"); - c_SparkMax_GetEncoderPositionFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetEncoderPosition"); - c_SparkMax_GetEncoderVelocityFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetEncoderVelocity"); - c_SparkMax_SetPositionConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetPositionConversionFactor"); - c_SparkMax_SetVelocityConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetVelocityConversionFactor"); - c_SparkMax_GetPositionConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPositionConversionFactor"); - c_SparkMax_GetVelocityConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetVelocityConversionFactor"); - c_SparkMax_SetAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAverageDepth"); - c_SparkMax_GetAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAverageDepth"); - c_SparkMax_SetMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetMeasurementPeriod"); - c_SparkMax_GetMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetMeasurementPeriod"); - c_SparkMax_SetCountsPerRevolutionFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetCountsPerRevolution"); - c_SparkMax_GetCountsPerRevolutionFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetCountsPerRevolution"); - c_SparkMax_SetEncoderInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetEncoderInverted"); - c_SparkMax_GetEncoderInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetEncoderInverted"); - c_SparkMax_GetAltEncoderPositionFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderPosition"); - c_SparkMax_GetAltEncoderVelocityFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderVelocity"); - c_SparkMax_SetAltEncoderPositionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderPositionFactor"); - c_SparkMax_SetAltEncoderVelocityFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderVelocityFactor"); - c_SparkMax_GetAltEncoderPositionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderPositionFactor"); - c_SparkMax_GetAltEncoderVelocityFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderVelocityFactor"); - c_SparkMax_SetAltEncoderAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderAverageDepth"); - c_SparkMax_GetAltEncoderAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderAverageDepth"); - c_SparkMax_SetAltEncoderMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderMeasurementPeriod"); - c_SparkMax_GetAltEncoderMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderMeasurementPeriod"); - c_SparkMax_SetAltEncoderCountsPerRevolutionFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderCountsPerRevolution"); - c_SparkMax_GetAltEncoderCountsPerRevolutionFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderCountsPerRevolution"); - c_SparkMax_SetAltEncoderInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderInverted"); - c_SparkMax_GetAltEncoderInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAltEncoderInverted"); - c_SparkMax_SetDataPortConfigFunc = (delegate* unmanaged[Cdecl] < void *, DataPortConfig, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetDataPortConfig"); - c_SparkMax_GetDataPortConfigFunc = (delegate* unmanaged[Cdecl] < void *, DataPortConfig *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetDataPortConfig"); - c_SparkMax_SetPFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetP"); - c_SparkMax_SetIFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetI"); - c_SparkMax_SetDFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetD"); - c_SparkMax_SetDFilterFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetDFilter"); - c_SparkMax_SetFFFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetFF"); - c_SparkMax_SetIZoneFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetIZone"); - c_SparkMax_SetOutputRangeFunc = (delegate* unmanaged[Cdecl] < void *, int, float, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetOutputRange"); - c_SparkMax_GetPFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetP"); - c_SparkMax_GetIFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetI"); - c_SparkMax_GetDFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetD"); - c_SparkMax_GetDFilterFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetDFilter"); - c_SparkMax_GetFFFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetFF"); - c_SparkMax_GetIZoneFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetIZone"); - c_SparkMax_GetOutputMinFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetOutputMin"); - c_SparkMax_GetOutputMaxFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetOutputMax"); - c_SparkMax_SetSmartMotionMaxVelocityFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartMotionMaxVelocity"); - c_SparkMax_SetSmartMotionMaxAccelFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartMotionMaxAccel"); - c_SparkMax_SetSmartMotionMinOutputVelocityFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartMotionMinOutputVelocity"); - c_SparkMax_SetSmartMotionAccelStrategyFunc = (delegate* unmanaged[Cdecl] < void *, int, AccelStrategy, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartMotionAccelStrategy"); - c_SparkMax_SetSmartMotionAllowedClosedLoopErrorFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartMotionAllowedClosedLoopError"); - c_SparkMax_GetSmartMotionMaxVelocityFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartMotionMaxVelocity"); - c_SparkMax_GetSmartMotionMaxAccelFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartMotionMaxAccel"); - c_SparkMax_GetSmartMotionMinOutputVelocityFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartMotionMinOutputVelocity"); - c_SparkMax_GetSmartMotionAccelStrategyFunc = (delegate* unmanaged[Cdecl] < void *, int, AccelStrategy *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartMotionAccelStrategy"); - c_SparkMax_GetSmartMotionAllowedClosedLoopErrorFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartMotionAllowedClosedLoopError"); - c_SparkMax_SetIMaxAccumFunc = (delegate* unmanaged[Cdecl] < void *, int, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetIMaxAccum"); - c_SparkMax_GetIMaxAccumFunc = (delegate* unmanaged[Cdecl] < void *, int, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetIMaxAccum"); - c_SparkMax_SetIAccumFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetIAccum"); - c_SparkMax_GetIAccumFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetIAccum"); - c_SparkMax_SetFeedbackDeviceFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetFeedbackDevice"); - c_SparkMax_GetFeedbackDeviceIDFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetFeedbackDeviceID"); - c_SparkMax_SetFeedbackDeviceRangeFunc = (delegate* unmanaged[Cdecl] < void *, float, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetFeedbackDeviceRange"); - c_SparkMax_GetAPIVersionFunc = (delegate* unmanaged[Cdecl] < APIVersion >)loader.GetProcAddress("c_SparkMax_GetAPIVersion"); - c_SparkMax_SetLastErrorFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode, void >)loader.GetProcAddress("c_SparkMax_SetLastError"); - c_SparkMax_GetLastErrorFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetLastError"); - c_SparkMax_GenerateErrorFunc = (delegate* unmanaged[Cdecl] < int, ErrorCode, ErrorCode >)loader.GetProcAddress("c_SparkMax_GenerateError"); - c_SparkMax_CreateFunc = (delegate* unmanaged[Cdecl] < int, MotorType, void *>)loader.GetProcAddress("c_SparkMax_Create"); - c_SparkMax_Create_InplaceFunc = (delegate* unmanaged[Cdecl] < int, void *>)loader.GetProcAddress("c_SparkMax_Create_Inplace"); - c_SparkMax_DestroyFunc = (delegate* unmanaged[Cdecl] < void *, void >)loader.GetProcAddress("c_SparkMax_Destroy"); - c_SparkMax_GetFirmwareVersionFunc = (delegate* unmanaged[Cdecl] < void *, FirmwareVersion *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetFirmwareVersion"); - c_SparkMax_GetDeviceIdFunc = (delegate* unmanaged[Cdecl] < void *, int *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetDeviceId"); - c_SparkMax_SetMotorTypeFunc = (delegate* unmanaged[Cdecl] < void *, MotorType, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetMotorType"); - c_SparkMax_GetMotorTypeFunc = (delegate* unmanaged[Cdecl] < void *, MotorType *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetMotorType"); - c_SparkMax_SetPeriodicFramePeriodFunc = (delegate* unmanaged[Cdecl] < void *, PeriodicFrame, int, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetPeriodicFramePeriod"); - c_SparkMax_SetControlFramePeriodFunc = (delegate* unmanaged[Cdecl] < void *, int, void >)loader.GetProcAddress("c_SparkMax_SetControlFramePeriod"); - c_SparkMax_GetControlFramePeriodFunc = (delegate* unmanaged[Cdecl] < void *, int >)loader.GetProcAddress("c_SparkMax_GetControlFramePeriod"); - c_SparkMax_SetParameterFloat32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetParameterFloat32"); - c_SparkMax_SetParameterInt32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, int, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetParameterInt32"); - c_SparkMax_SetParameterUint32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetParameterUint32"); - c_SparkMax_SetParameterBoolFunc = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetParameterBool"); - c_SparkMax_GetParameterFloat32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetParameterFloat32"); - c_SparkMax_GetParameterInt32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, int *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetParameterInt32"); - c_SparkMax_GetParameterUint32Func = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetParameterUint32"); - c_SparkMax_GetParameterBoolFunc = (delegate* unmanaged[Cdecl] < void *, ConfigParameter, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetParameterBool"); - c_SparkMax_GetPeriodicStatus0Func = (delegate* unmanaged[Cdecl] < void *, PeriodicStatus0 *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPeriodicStatus0"); - c_SparkMax_GetPeriodicStatus1Func = (delegate* unmanaged[Cdecl] < void *, PeriodicStatus1 *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPeriodicStatus1"); - c_SparkMax_GetPeriodicStatus2Func = (delegate* unmanaged[Cdecl] < void *, PeriodicStatus2 *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPeriodicStatus2"); - c_SparkMax_GetPeriodicStatus3Func = (delegate* unmanaged[Cdecl] < void *, PeriodicStatus3 *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPeriodicStatus3"); - c_SparkMax_GetPeriodicStatus4Func = (delegate* unmanaged[Cdecl] < void *, PeriodicStatus4 *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetPeriodicStatus4"); - c_SparkMax_SetEncoderPositionFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetEncoderPosition"); - c_SparkMax_SetAltEncoderPositionFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAltEncoderPosition"); - c_SparkMax_RestoreFactoryDefaultsFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_RestoreFactoryDefaults"); - c_SparkMax_FactoryWipeFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_FactoryWipe"); - c_SparkMax_SetFollowFunc = (delegate* unmanaged[Cdecl] < void *, uint, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetFollow"); - c_SparkMax_SafeFloatFunc = (delegate* unmanaged[Cdecl] < float, float >)loader.GetProcAddress("c_SparkMax_SafeFloat"); - c_SparkMax_SetpointCommandFunc = (delegate* unmanaged[Cdecl] < void *, float, ControlType, int, float, int, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetpointCommand"); - c_SparkMax_GetDRVStatusFunc = (delegate* unmanaged[Cdecl] < void *, DRVStatus *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetDRVStatus"); - c_SparkMax_SetInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetInverted"); - c_SparkMax_GetInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetInverted"); - c_SparkMax_SetSmartCurrentLimitFunc = (delegate* unmanaged[Cdecl] < void *, byte, byte, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSmartCurrentLimit"); - c_SparkMax_GetSmartCurrentLimitFunc = (delegate* unmanaged[Cdecl] < void *, byte *, byte *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSmartCurrentLimit"); - c_SparkMax_SetSecondaryCurrentLimitFunc = (delegate* unmanaged[Cdecl] < void *, float, int, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSecondaryCurrentLimit"); - c_SparkMax_GetSecondaryCurrentLimitFunc = (delegate* unmanaged[Cdecl] < void *, float *, int *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSecondaryCurrentLimit"); - c_SparkMax_SetIdleModeFunc = (delegate* unmanaged[Cdecl] < void *, IdleMode, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetIdleMode"); - c_SparkMax_GetIdleModeFunc = (delegate* unmanaged[Cdecl] < void *, IdleMode *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetIdleMode"); - c_SparkMax_EnableVoltageCompensationFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_EnableVoltageCompensation"); - c_SparkMax_GetVoltageCompensationNominalVoltageFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetVoltageCompensationNominalVoltage"); - c_SparkMax_DisableVoltageCompensationFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode >)loader.GetProcAddress("c_SparkMax_DisableVoltageCompensation"); - c_SparkMax_SetOpenLoopRampRateFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetOpenLoopRampRate"); - c_SparkMax_GetOpenLoopRampRateFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetOpenLoopRampRate"); - c_SparkMax_SetClosedLoopRampRateFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetClosedLoopRampRate"); - c_SparkMax_GetClosedLoopRampRateFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetClosedLoopRampRate"); - c_SparkMax_IsFollowerFunc = (delegate* unmanaged[Cdecl] < void *, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_IsFollower"); - c_SparkMax_GetFaultsFunc = (delegate* unmanaged[Cdecl] < void *, ushort *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetFaults"); - c_SparkMax_GetStickyFaultsFunc = (delegate* unmanaged[Cdecl] < void *, ushort *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetStickyFaults"); - c_SparkMax_GetFaultFunc = (delegate* unmanaged[Cdecl] < void *, FaultID, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetFault"); - c_SparkMax_GetStickyFaultFunc = (delegate* unmanaged[Cdecl] < void *, FaultID, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetStickyFault"); - c_SparkMax_GetBusVoltageFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetBusVoltage"); - c_SparkMax_GetAppliedOutputFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAppliedOutput"); - c_SparkMax_GetOutputCurrentFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetOutputCurrent"); - c_SparkMax_GetMotorTemperatureFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetMotorTemperature"); - c_SparkMax_ClearFaultsFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode >)loader.GetProcAddress("c_SparkMax_ClearFaults"); - c_SparkMax_BurnFlashFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode >)loader.GetProcAddress("c_SparkMax_BurnFlash"); - c_SparkMax_SetCANTimeoutFunc = (delegate* unmanaged[Cdecl] < void *, int, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetCANTimeout"); - c_SparkMax_EnableSoftLimitFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_EnableSoftLimit"); - c_SparkMax_IsSoftLimitEnabledFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_IsSoftLimitEnabled"); - c_SparkMax_SetSoftLimitFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSoftLimit"); - c_SparkMax_GetSoftLimitFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetSoftLimit"); - c_SparkMax_SetSensorTypeFunc = (delegate* unmanaged[Cdecl] < void *, EncoderType, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetSensorType"); - c_SparkMax_IDQueryFunc = (delegate* unmanaged[Cdecl] < uint *, IntPtr, IntPtr *, ErrorCode >)loader.GetProcAddress("c_SparkMax_IDQuery"); - c_SparkMax_IDAssignFunc = (delegate* unmanaged[Cdecl] < uint, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_IDAssign"); - c_SparkMax_IdentifyFunc = (delegate* unmanaged[Cdecl] < void *, ErrorCode >)loader.GetProcAddress("c_SparkMax_Identify"); - c_SparkMax_IdentifyUniqueIdFunc = (delegate* unmanaged[Cdecl] < uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_IdentifyUniqueId"); - c_SparkMax_SetLimitPolarityFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, LimitPolarity, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetLimitPolarity"); - c_SparkMax_GetLimitPolarityFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, LimitPolarity *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetLimitPolarity"); - c_SparkMax_GetLimitSwitchFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetLimitSwitch"); - c_SparkMax_EnableLimitSwitchFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_EnableLimitSwitch"); - c_SparkMax_IsLimitEnabledFunc = (delegate* unmanaged[Cdecl] < void *, LimitDirection, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_IsLimitEnabled"); - c_SparkMax_GetAnalogPositionFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogPosition"); - c_SparkMax_GetAnalogVelocityFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogVelocity"); - c_SparkMax_GetAnalogVoltageFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogVoltage"); - c_SparkMax_SetAnalogPositionConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogPositionConversionFactor"); - c_SparkMax_SetAnalogVelocityConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogVelocityConversionFactor"); - c_SparkMax_GetAnalogPositionConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogPositionConversionFactor"); - c_SparkMax_GetAnalogVelocityConversionFactorFunc = (delegate* unmanaged[Cdecl] < void *, float *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogVelocityConversionFactor"); - c_SparkMax_SetAnalogInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogInverted"); - c_SparkMax_GetAnalogInvertedFunc = (delegate* unmanaged[Cdecl] < void *, byte *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogInverted"); - c_SparkMax_SetAnalogAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogAverageDepth"); - c_SparkMax_GetAnalogAverageDepthFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogAverageDepth"); - c_SparkMax_SetAnalogMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint, ErrorCode >)loader.GetProcAddress("c_SparkMax_SetAnalogMeasurementPeriod"); - c_SparkMax_GetAnalogMeasurementPeriodFunc = (delegate* unmanaged[Cdecl] < void *, uint *, ErrorCode >)loader.GetProcAddress("c_SparkMax_GetAnalogMeasurementPeriod"); - } - - } -} diff --git a/src/thirdparty/SparkMax/Natives/SparkMaxDriverTypes.cs b/src/thirdparty/SparkMax/Natives/SparkMaxDriverTypes.cs deleted file mode 100644 index a19fb950..00000000 --- a/src/thirdparty/SparkMax/Natives/SparkMaxDriverTypes.cs +++ /dev/null @@ -1,46 +0,0 @@ -namespace REV.SparkMax.Natives -{ - public struct PeriodicStatus0LowLevel - { - public float AppliedOutput; - public ushort Faults; - public ushort StickyFaults; - public MotorType MotorType; - public byte IsFollower; - public byte IsInverted; - public byte Lock; - public byte RoboRIO; - public ulong Timestamp; - } - - public struct PeriodicStatus1LowLevel - { - public float SensorVelocity; - public byte MotorTemperature; - public float BusVoltage; - public float OutputCurrrent; - public ulong Timestamp; - } - - public struct PeriodicStatus2LowLevel - { - public float SensorPostion; - public float IAccum; - public ulong Timestamp; - } - - public struct PeriodicStatus3LowLevel - { - public float AnalogVoltage; - public float AnalogVelocity; - public float AnalogPosition; - public ulong Timestamp; - } - - public struct PeriodicStatus4LowLevel - { - public float AltEncoderPosition; - public float AltEncoderVelocity; - public ulong Timestamp; - } -} diff --git a/src/thirdparty/SparkMax/SparkMax.csproj b/src/thirdparty/SparkMax/SparkMax.csproj deleted file mode 100644 index ebbbfa34..00000000 --- a/src/thirdparty/SparkMax/SparkMax.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - WPILibSharp.REV.SparkMax - REV.SparkMax - - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - diff --git a/src/thirdparty/SparkMax/SparkMaxTypes.cs b/src/thirdparty/SparkMax/SparkMaxTypes.cs deleted file mode 100644 index fba8f506..00000000 --- a/src/thirdparty/SparkMax/SparkMaxTypes.cs +++ /dev/null @@ -1,360 +0,0 @@ -using REV.SparkMax.Natives; - -namespace REV.SparkMax -{ - public struct APIVersion - { - public byte Major; - public byte Minor; - public byte Build; - public uint Version; - } - - public enum LimitDirection - { - kForward = 0, - kReverse = 1 - } - - public enum LimitPolarity - { - kNormallyOpen, - kNormallyClosed - } - - public enum EncoderType - { - kNoSensor, - kHallSensor, - kQuadrature, - kSensorless, - kAlternateQuadrature - } - - public enum IdleMode - { - kCoast, - kBrake - } - - public enum InputMode - { - kPWM, - kCAN - } - - public enum FaultID - { - kBrownout = 0, - kOvercurrent = 1, - kIWDTReset = 2, - kMotorFault = 3, - kSensorFault = 4, - kStall = 5, - kEEPROMCRC = 6, - kCANTX = 7, - kCANRX = 8, - kHasReset = 9, - kDRVFault = 10, - kOtherFault = 11, - kSoftLimitFwd = 12, - kSoftLimitRev = 13, - kHardLimitFwd = 14, - kHardLimitRev = 15 - } - - public enum MotorType - { - kBrushed, - kBrushless - } - - public enum ParameterStatus - { - kParamOK = 0, - kInvalidID = 1, - kMismatchType = 2, - kAccessMode = 3, - kInvalid = 4, - kNotImplementedDeprecated = 5 - } - - public enum ConfigParameter - { - kCanID = 0, - kInputMode = 1, - kMotorType = 2, - kCommAdvance = 3, - kSensorType = 4, - kCtrlType = 5, - kIdleMode = 6, - kInputDeadband = 7, - kFeedbackSensorPID0 = 8, - kFeedbackSensorPID1 = 9, - kPolePairs = 10, - kCurrentChop = 11, - kCurrentChopCycles = 12, - kP_0 = 13, - kI_0 = 14, - kD_0 = 15, - kF_0 = 16, - kIZone_0 = 17, - kDFilter_0 = 18, - kOutputMin_0 = 19, - kOutputMax_0 = 20, - kP_1 = 21, - kI_1 = 22, - kD_1 = 23, - kF_1 = 24, - kIZone_1 = 25, - kDFilter_1 = 26, - kOutputMin_1 = 27, - kOutputMax_1 = 28, - kP_2 = 29, - kI_2 = 30, - kD_2 = 31, - kF_2 = 32, - kIZone_2 = 33, - kDFilter_2 = 34, - kOutputMin_2 = 35, - kOutputMax_2 = 36, - kP_3 = 37, - kI_3 = 38, - kD_3 = 39, - kF_3 = 40, - kIZone_3 = 41, - kDFilter_3 = 42, - kOutputMin_3 = 43, - kOutputMax_3 = 44, - kInverted = 45, - kOutputRatio = 46, - kSerialNumberLow = 47, - kSerialNumberMid = 48, - kSerialNumberHigh = 49, - kLimitSwitchFwdPolarity = 50, - kLimitSwitchRevPolarity = 51, - kHardLimitFwdEn = 52, - kHardLimitRevEn = 53, - kSoftLimitFwdEn = 54, - kSoftLimitRevEn = 55, - kRampRate = 56, - kFollowerID = 57, - kFollowerConfig = 58, - kSmartCurrentStallLimit = 59, - kSmartCurrentFreeLimit = 60, - kSmartCurrentConfig = 61, - kSmartCurrentReserved = 62, - kMotorKv = 63, - kMotorR = 64, - kMotorL = 65, - kMotorRsvd1 = 66, - kMotorRsvd2 = 67, - kMotorRsvd3 = 68, - kEncoderCountsPerRev = 69, - kEncoderAverageDepth = 70, - kEncoderSampleDelta = 71, - kEncoderInverted = 72, - kEncoderRsvd1 = 73, - kVoltageCompMode = 74, - kCompensatedNominalVoltage = 75, - kSmartMotionMaxVelocity_0 = 76, - kSmartMotionMaxAccel_0 = 77, - kSmartMotionMinVelOutput_0 = 78, - kSmartMotionAllowedClosedLoopError_0 = 79, - kSmartMotionAccelStrategy_0 = 80, - kSmartMotionMaxVelocity_1 = 81, - kSmartMotionMaxAccel_1 = 82, - kSmartMotionMinVelOutput_1 = 83, - kSmartMotionAllowedClosedLoopError_1 = 84, - kSmartMotionAccelStrategy_1 = 85, - kSmartMotionMaxVelocity_2 = 86, - kSmartMotionMaxAccel_2 = 87, - kSmartMotionMinVelOutput_2 = 88, - kSmartMotionAllowedClosedLoopError_2 = 89, - kSmartMotionAccelStrategy_2 = 90, - kSmartMotionMaxVelocity_3 = 91, - kSmartMotionMaxAccel_3 = 92, - kSmartMotionMinVelOutput_3 = 93, - kSmartMotionAllowedClosedLoopError_3 = 94, - kSmartMotionAccelStrategy_3 = 95, - kIMaxAccum_0 = 96, - kSlot3Placeholder1_0 = 97, - kSlot3Placeholder2_0 = 98, - kSlot3Placeholder3_0 = 99, - kIMaxAccum_1 = 100, - kSlot3Placeholder1_1 = 101, - kSlot3Placeholder2_1 = 102, - kSlot3Placeholder3_1 = 103, - kIMaxAccum_2 = 104, - kSlot3Placeholder1_2 = 105, - kSlot3Placeholder2_2 = 106, - kSlot3Placeholder3_2 = 107, - kIMaxAccum_3 = 108, - kSlot3Placeholder1_3 = 109, - kSlot3Placeholder2_3 = 110, - kSlot3Placeholder3_3 = 111, - kPositionConversionFactor = 112, - kVelocityConversionFactor = 113, - kClosedLoopRampRate = 114, - kSoftLimitFwd = 115, - kSoftLimitRev = 116, - kSoftLimitRsvd0 = 117, - kSoftLimitRsvd1 = 118, - kAnalogRevPerVolt = 119, - kAnalogRotationsPerVoltSec = 120, - kAnalogAverageDepth = 121, - kAnalogSensorMode = 122, - kAnalogInverted = 123, - kAnalogSampleDelta = 124, - kAnalogRsvd0 = 125, - kAnalogRsvd1 = 126, - kDataPortConfig = 127, - kAltEncoderCountsPerRev = 128, - kAltEncoderAverageDepth = 129, - kAltEncoderSampleDelta = 130, - kAltEncoderInverted = 131, - kAltEncodePositionFactor = 132, - kAltEncoderVelocityFactor = 133 - } - - public enum ParameterType - { - kInt32, - kUint32, - kFloat32, - kBool - } - - public enum PeriodicFrame - { - kStatus0, - kStatus1, - kStatus2, - kStatus3, - kStatus4, - } - - public enum ControlType - { - kDutyCycle = 0, - kVelocity = 1, - kVoltage = 2, - kPosition = 3, - kSmartMotion = 4, - kCurrent = 5, - kSmartVelocity = 6 - } - - public enum DataPortConfig - { - kDefault, - kAltEncoder - } - - public readonly struct PeriodicStatus0 - { - public float AppliedOutput { get; } - public ushort Faults { get; } - public ushort StickyFaults { get; } - public MotorType MotorType { get; } - public bool IsFollower { get; } - public bool IsInverted { get; } - public bool Lock { get; } - public bool RoboRIO { get; } - public ulong Timestamp { get; } - - public PeriodicStatus0(PeriodicStatus0LowLevel lowLevel) - { - AppliedOutput = lowLevel.AppliedOutput; - Faults = lowLevel.Faults; - StickyFaults = lowLevel.StickyFaults; - MotorType = lowLevel.MotorType; - IsFollower = lowLevel.IsFollower != 0; - IsInverted = lowLevel.IsInverted != 0; - Lock = lowLevel.Lock != 0; - RoboRIO = lowLevel.RoboRIO != 0; - Timestamp = lowLevel.Timestamp; - } - } - - public struct PeriodicStatus1 - { - public float SensorVelocity; - public byte MotorTemperature; - public float BusVoltage; - public float OutputCurrrent; - public ulong Timestamp; - } - - public struct PeriodicStatus2 - { - public float SensorPostion; - public float IAccum; - public ulong Timestamp; - } - - public struct PeriodicStatus3 - { - public float AnalogVoltage; - public float AnalogVelocity; - public float AnalogPosition; - public ulong Timestamp; - } - - public struct PeriodicStatus4 - { - public float AltEncoderPosition; - public float AltEncoderVelocity; - public ulong Timestamp; - } - - public struct FirmwareVersion - { - public byte Major; - public byte Minor; - public ushort Build; - public bool IsDebug; - public uint VersionRaw; - } - - public enum AccelStrategy - { - kStrategyTrapezoidal = 0, - kStrategySCurve = 1 - } - - public enum AnalogMode - { - kAbsolute, - kRelative - } - - public struct DRVStatus - { - public ushort DRVStat0; - public ushort DRVStat1; - public ushort Faults; - public ushort StickyFaults; - } - - public enum ErrorCode - { - ErrorNone = 0, - ErrorGeneral, - ErrorCANTimeout, - ErrorNotImplmented, - ErrorHAL, - ErrorCantFindFirmware, - ErrorFirmwareTooOld, - ErrorFirmwareTooNew, - ErrorParamInvalidID, - ErrorParamMismatchType, - ErrorParamAccessMode, - ErrorParamInvalid, - ErrorParamNotImplementedDeprecated, - ErrorFollowConfigMismatch, - ErrorInvalid, - ErrorSetpointOutOfRange, - NumErrorCodes - } -} diff --git a/tools/CInterfaceGenerator/CInterfaceGenerator.csproj b/tools/CInterfaceGenerator/CInterfaceGenerator.csproj deleted file mode 100644 index a96cf4de..00000000 --- a/tools/CInterfaceGenerator/CInterfaceGenerator.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - Exe - net8.0 - enable - - - - - - - diff --git a/tools/CInterfaceGenerator/Program.cs b/tools/CInterfaceGenerator/Program.cs deleted file mode 100644 index f8a22cf3..00000000 --- a/tools/CInterfaceGenerator/Program.cs +++ /dev/null @@ -1,193 +0,0 @@ -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; - -namespace CInterfaceGenerator -{ - class Program - { - class FunctionsJson - { - public string[] Files { get; set; } = new string[0]; - public Function[] Functions { get; set; } = new Function[0]; - } - class Function - { - public string Name { get; set; } = ""; - public string? StatusCheck { get; set; } - - - } - - class HeaderTuple - { - public string HeaderName { get; set; } - public List HeaderText { get; } = new List(); - } - - static void Main(string[] args) - { - if (args.Length != 2) - { - Console.WriteLine("You must pass a path to where the header files are located, and the file to parse"); - return; - } - - var headerFiles = Directory.EnumerateFiles(args[0]); - var functionsFile = args[1]; - - var loadedFunctions = JsonConvert.DeserializeObject(File.ReadAllText(functionsFile)); - var filesToCheck = headerFiles.Where(x => loadedFunctions.Files.Any(y => x.EndsWith(y))) - .Select(x => (name: x, contents: File.ReadAllText(x))) - .ToArray(); - - List generatedFunctions = new List(); - - Dictionary> generatedInterfaces = new Dictionary>(); - - foreach (var functionToGenerate in loadedFunctions.Functions) - { - // Enumerate each header file looking for the function - foreach (var (name, contents) in filesToCheck) - { - - if (contents.Contains(functionToGenerate.Name)) - { - if (generatedFunctions.Contains(functionToGenerate.Name)) - { - continue; - } - generatedFunctions.Add(functionToGenerate.Name); - - var headerSpan = contents.AsSpan(); - var functionStart = headerSpan.IndexOf(functionToGenerate.Name); - while (true) - { - if (headerSpan[functionStart] == '\n') break; - functionStart--; - } - // Go back to the start of the line - var functionDef = headerSpan.Slice(functionStart); - functionDef = string.Join(' ', functionDef.Slice(0, functionDef.IndexOf(";")).ToString().Split("\n").Select(x => x.Trim())); - - functionDef = GetCSharpDef(functionDef.ToString()); - - if (!generatedInterfaces.TryGetValue(Path.GetFileName(name), out var funcList)) - { - funcList = new List(); - generatedInterfaces.Add(Path.GetFileName(name), funcList); - } - - if (functionDef.EndsWith("status)")) - { - - // Remove status, mark as a status check - if (functionDef.Contains(',')) - { - funcList.Add($"[StatusCheckLastParameter] {functionDef.Slice(0, functionDef.LastIndexOf(',')).ToString()});"); - } - else - { - funcList.Add($"[StatusCheckLastParameter] {functionDef.Slice(0, functionDef.LastIndexOf('(')).ToString()}();"); - } - - - - } - else - { - funcList.Add(functionDef.ToString() + ';'); - } - - ; - } - } - } - - var toWrite = WriteFiles(generatedInterfaces); - - - foreach (var f in toWrite) - { - File.WriteAllText(f.fileName, f.toWrite); - } - - ; - } - - public static List<(string fileName, string toWrite)> WriteFiles(Dictionary> files) - { - List<(string fileName, string toWrite)> outputFiles = new List<(string fileName, string toWrite)>(); - - foreach (var file in files) - { - string interfaceName = $"I{file.Key.Replace(".h", "")}"; - StringBuilder builder = new StringBuilder(); - builder.AppendLine("using WPIUtil.ILGeneration;\n\nnamespace Hal.Natives\n{"); - builder.AppendLine($" public unsafe interface {interfaceName}\n {{"); - - foreach (var function in file.Value) - { - builder.AppendLine($" {function}\n"); - } - - - builder.AppendLine(" }\n}"); - outputFiles.Add(($"{interfaceName}.cs", builder.ToString().Replace("\r\n", "\n"))); - } - - return outputFiles; - } - - public static Dictionary TypeMap = new Dictionary() - { - ["int32_t"] = "int", - ["int64_t"] = "long", - ["int16_t"] = "short", - ["uint8_t"] = "byte", - ["char"] = "byte", - ["const"] = "", - ["HAL_Bool"] = "int", - ["HAL_Handle"] = "int", - ["HAL_PortHandle"] = "int", - ["HAL_AnalogInputHandle"] = "int", - ["HAL_AnalogOutputHandle"] = "int", - ["HAL_AnalogTriggerHandle"] = "int", - ["HAL_CompressorHandle"] = "int", - ["HAL_CounterHandle"] = "int", - ["HAL_DigitalHandle"] = "int", - ["HAL_DigitalPWMHandle"] = "int", - ["HAL_EncoderHandle"] = "int", - ["HAL_FPGAEncoderHandle"] = "int", - ["HAL_GyroHandle"] = "int", - ["HAL_InterruptHandle"] = "int", - ["HAL_NotifierHandle"] = "int", - ["HAL_RelayHandle"] = "int", - ["HAL_SolenoidHandle"] = "int", - ["HAL_SerialPortHandle"] = "int", - ["HAL_CANHandle"] = "int", - ["HAL_SimDeviceHandle"] = "int", - ["HAL_SimValueHandle"] = "int", - ["HAL_DMAHandle"] = "int", - ["HAL_DutyCycleHandle"] = "int", - ["HAL_AddressableLEDHandle"] = "int", - ["HAL_PDPHandle"] = "int", - ["size_t"] = "IntPtr", - ["struct"] = "", - ["readonly"] = "rdonly" - - }; - - public static string GetCSharpDef(string function) - { - foreach (var t in TypeMap) - { - function = function.Replace(t.Key, t.Value); - } - return function; - } - } -} diff --git a/tools/CInterfaceGenerator/Properties/launchSettings.json b/tools/CInterfaceGenerator/Properties/launchSettings.json deleted file mode 100644 index a8b4771c..00000000 --- a/tools/CInterfaceGenerator/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "CInterfaceGenerator": { - "commandName": "Project", - "commandLineArgs": "C:\\Users\\thad.house\\GitHub\\allwpilib\\hal\\src\\main\\native\\include\\hal C:\\Users\\thad.house\\GitHub\\RobotDotNet\\WPILib\\src\\hal\\Natives\\HALFunctions.json" - } - } -} \ No newline at end of file diff --git a/tools/CalliGenerator/CalliGenerator.csproj b/tools/CalliGenerator/CalliGenerator.csproj deleted file mode 100644 index a07b810d..00000000 --- a/tools/CalliGenerator/CalliGenerator.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - Exe - net8.0 - enable - - - - - - - - - - - diff --git a/tools/CalliGenerator/Program.cs b/tools/CalliGenerator/Program.cs deleted file mode 100644 index 73b284d4..00000000 --- a/tools/CalliGenerator/Program.cs +++ /dev/null @@ -1,449 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using Hal; -using WPIUtil.ILGeneration; -using WPIUtil.NativeUtilities; - -namespace CalliGenerator -{ - class Program - { - // private unsafe delegate* unmanaged[Cdecl] NT_DisposeEntryNotificationArray; - - - - public static string GetReturnType(MethodInfo method) - { - if (method.ReturnType == typeof(void)) - { - return "void"; - } - else - { - return method.ReturnType.ToString(); - } - } - - public static void GenerateNoStatusMethod(MethodInfo method, StringBuilder builder, List inits) - { - string GenerateSignature(MethodInfo method) - { - StringBuilder builder = new StringBuilder(); - - builder.Append("delegate* unmanaged[Cdecl]<"); - - foreach (var param in method.GetParameters()) - { - builder.Append(param.ParameterType.ToString()); - builder.Append(", "); - } - builder.Append(GetReturnType(method)); - builder.Append(">"); - return builder.ToString(); - } - - inits.Add($"{method.Name}Func = ({GenerateSignature(method)})loader.GetProcAddress(\"{method.Name}\");"); - - builder.AppendLine($"private {GenerateSignature(method)} {method.Name}Func;"); - builder.AppendLine(); - - builder.AppendLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]"); - builder.Append($"public {GetReturnType(method)} {method.Name}("); - bool first = true; - foreach (var param in method.GetParameters()) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.ParameterType.ToString()); - builder.Append(" "); - builder.Append(param.Name); - } - builder.AppendLine(")"); - builder.AppendLine("{"); - - if (method.ReturnType != typeof(void)) - { - builder.Append("return "); - - } - - builder.Append($"{method.Name}Func("); - - first = true; - foreach (var param in method.GetParameters()) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.Name); - } - - builder.AppendLine(");"); - - builder.AppendLine("}"); - } - - public static void GenerateStatusCheckLastParameterMethod(MethodInfo method, StringBuilder builder, List inits) - { - string GenerateSignature(MethodInfo method) - { - StringBuilder builder = new StringBuilder(); - - builder.Append("delegate* unmanaged[Cdecl]<"); - - foreach (var param in method.GetParameters()) - { - builder.Append(param.ParameterType.ToString()); - builder.Append(", "); - } - builder.Append("int*, "); - builder.Append(GetReturnType(method)); - builder.Append(">"); - return builder.ToString(); - } - - inits.Add($"{method.Name}Func = ({GenerateSignature(method)})loader.GetProcAddress(\"{method.Name}\");"); - - builder.AppendLine($"private {GenerateSignature(method)} {method.Name}Func;"); - builder.AppendLine(); - - builder.AppendLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]"); - builder.Append($"public {GetReturnType(method)} {method.Name}("); - var parameters = method.GetParameters(); - bool first = true; - foreach (var param in parameters) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.ParameterType.ToString()); - builder.Append(" "); - builder.Append(param.Name); - } - builder.AppendLine(")"); - builder.AppendLine("{"); - - builder.AppendLine("int status = 0;"); - - if (method.ReturnType != typeof(void)) - { - builder.Append("var retVal = "); - } - - builder.Append($"{method.Name}Func("); - - first = true; - foreach (var param in parameters) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.Name); - } - - if (parameters.Length == 0) - { - builder.Append("&status"); - } - else - { - builder.Append(", &status"); - } - - builder.AppendLine(");"); - builder.AppendLine("StatusCheck(status);"); - - if (method.ReturnType != typeof(void)) - { - builder.AppendLine("return retVal;"); - } - - builder.AppendLine("}"); - } - - public static void GenerateStatusCheckReturnMethod(MethodInfo method, StringBuilder builder, List inits) - { - if (method.ReturnType == typeof(void)) - { - throw new InvalidOperationException("Cannot return status check void"); - - } - - string GenerateSignature(MethodInfo method) - { - StringBuilder builder = new StringBuilder(); - - builder.Append("delegate* unmanaged[Cdecl]<"); - - foreach (var param in method.GetParameters()) - { - builder.Append(param.ParameterType.ToString()); - builder.Append(", "); - } - builder.Append("int*>"); - return builder.ToString(); - } - - inits.Add($"{method.Name}Func = ({GenerateSignature(method)})loader.GetProcAddress(\"{method.Name}\");"); - - builder.AppendLine($"private {GenerateSignature(method)} {method.Name}Func;"); - builder.AppendLine(); - - builder.AppendLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]"); - builder.Append($"public {GetReturnType(method)} {method.Name}("); - bool first = true; - foreach (var param in method.GetParameters()) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.ParameterType.ToString()); - builder.Append(" "); - builder.Append(param.Name); - } - builder.AppendLine(")"); - builder.AppendLine("{"); - - - - builder.Append($"var statusVal = {method.Name}Func("); - - first = true; - foreach (var param in method.GetParameters()) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.Name); - } - - builder.AppendLine(");"); - builder.AppendLine("StatusCheck(statusVal);"); - - builder.AppendLine("}"); - } - - public static void GenerateStatusCheckRangeMethod(MethodInfo method, StringBuilder builder, StatusCheckRangeAttribute range, List inits) - { - string GenerateSignature(MethodInfo method) - { - StringBuilder builder = new StringBuilder(); - - builder.Append("delegate* unmanaged[Cdecl]<"); - - foreach (var param in method.GetParameters()) - { - builder.Append(param.ParameterType.ToString()); - builder.Append(", "); - } - builder.Append("int*, "); - builder.Append(GetReturnType(method)); - builder.Append(">"); - return builder.ToString(); - } - - inits.Add($"{method.Name}Func = ({GenerateSignature(method)})loader.GetProcAddress(\"{method.Name}\");"); - - builder.AppendLine($"private {GenerateSignature(method)} {method.Name}Func;"); - builder.AppendLine(); - - builder.AppendLine("[MethodImpl(MethodImplOptions.AggressiveInlining)]"); - builder.Append($"public {GetReturnType(method)} {method.Name}("); - var parameters = method.GetParameters(); - bool first = true; - foreach (var param in parameters) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.ParameterType.ToString()); - builder.Append(" "); - builder.Append(param.Name); - } - builder.AppendLine(")"); - builder.AppendLine("{"); - - builder.AppendLine("int status = 0;"); - - if (method.ReturnType != typeof(void)) - { - builder.Append("var retVal = "); - } - - builder.Append($"{method.Name}Func("); - - first = true; - foreach (var param in parameters) - { - if (first) - { - first = false; - } - else - { - builder.Append(", "); - } - builder.Append(param.Name); - } - - if (parameters.Length == 0) - { - builder.Append("&status"); - } - else - { - builder.Append(", &status"); - } - - builder.AppendLine(");"); - builder.AppendLine($"{range.RangeCheckFunctionName}(status, {parameters[range.RangeParameterNumber].Name});"); - - if (method.ReturnType != typeof(void)) - { - builder.AppendLine("return retVal;"); - } - - builder.AppendLine("}"); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void GenerateForAssembly(Assembly asm) - { - var types = asm.GetTypes() - .Select(x => (type: x, attribute: x.GetCustomAttribute())) - .Where(x => x.attribute is not null) - .ToArray(); - - var typesActual = types.Select(x => x.attribute!.InterfaceType).ToArray(); - - var folderName = asm.GetName().Name! + "Files"; - - Directory.CreateDirectory(folderName); - - foreach (var t in types) - { - StringBuilder builder = new StringBuilder(); - - builder.AppendLine("using WPIUtil.ILGeneration;"); - builder.AppendLine("using System.Runtime.CompilerServices;"); - - builder.AppendLine($"namespace {t.attribute!.InterfaceType.Namespace}"); - builder.AppendLine("{"); - - builder.AppendLine($"public unsafe class {t.type.Name}Native : {t.attribute!.InterfaceType.Name}"); - builder.AppendLine("{"); - - var methods = t.attribute!.InterfaceType.GetMethods(BindingFlags.Public | BindingFlags.Instance); - - List inits = new List(); - - foreach (var method in methods.Where(x => x.IsAbstract)) - { - var statusCheckRange = method.GetCustomAttribute(); - var statusCheckRet = method.GetCustomAttribute(); - var statusCheckLastParam = method.GetCustomAttribute(); - if (statusCheckRange != null) - { - GenerateStatusCheckRangeMethod(method, builder, statusCheckRange, inits); - } - else if (statusCheckRet != null) - { - GenerateStatusCheckReturnMethod(method, builder, inits); - } - else if (statusCheckLastParam != null) - { - GenerateStatusCheckLastParameterMethod(method, builder, inits); - } - else - { - GenerateNoStatusMethod(method, builder, inits); - } - builder.AppendLine(); - builder.AppendLine(); - } - builder.AppendLine(); - - builder.AppendLine($"public {t.type.Name}Native(IFunctionPointerLoader loader)"); - builder.AppendLine("{"); - builder.AppendLine("if (loader == null)"); - builder.AppendLine("{"); - builder.AppendLine("throw new ArgumentNullException(nameof(loader));"); - builder.AppendLine("}"); - builder.AppendLine(); - - foreach (var method in inits) - { - builder.AppendLine(method); - } - - builder.AppendLine("}"); - builder.AppendLine(); - - builder.AppendLine("}"); - - builder.AppendLine("}"); - - File.WriteAllText(Path.Join(folderName, t.type.Name + "Native.cs"), builder.ToString().Replace("System.Void", "void")); - } - } - - - static void Main(string[] args) - { - Console.WriteLine("Hello World!"); - - var types = typeof(HALLowLevel).Assembly.GetTypes().Where(x => x.GetFields(BindingFlags.NonPublic | BindingFlags.Static).Select(x => x.Name).Contains("lowLevel")).ToArray(); - - foreach (var type in types) - { - Console.WriteLine($"{type.Name}.InitializeNatives(loader);"); - } - - ; - - //GenerateForAssembly(typeof(REV.SparkMax.CANSparkMaxDriver).Assembly); - } - } -} - diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props deleted file mode 100644 index a2119370..00000000 --- a/tools/Directory.Build.props +++ /dev/null @@ -1,5 +0,0 @@ - - - false - - \ No newline at end of file