mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Merge "add some comments etc documenting various not-implemented things"
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#include "i2clib/i2c-lib.h"
|
||||
#include "spilib/spi-lib.h"
|
||||
|
||||
static_assert(sizeof(uint32_t) <= sizeof(void *), "This file shoves uint32_ts into pointers.");
|
||||
|
||||
static const uint32_t kExpectedLoopTiming = 40;
|
||||
static const uint32_t kDigitalPins = 26;
|
||||
static const uint32_t kPwmPins = 20;
|
||||
|
||||
@@ -121,6 +121,9 @@ void deleteMultiWait(MULTIWAIT_ID sem) {
|
||||
delete sem;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param timeout Not implemented.
|
||||
*/
|
||||
int8_t takeMultiWait(MULTIWAIT_ID sem, MUTEX_ID m, int32_t timeout) {
|
||||
takeMutex(m);
|
||||
int8_t val = pthread_cond_wait(sem, m);
|
||||
|
||||
@@ -24,6 +24,11 @@ void* startRoutine(void* data) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param priority Not implemented.
|
||||
* @param options Not implemented.
|
||||
* @param stackSize Not implemented.
|
||||
*/
|
||||
TASK spawnTask(char * name, int priority, int options, int stackSize,
|
||||
FUNCPTR entryPt, uint32_t arg0, uint32_t arg1, uint32_t arg2,
|
||||
uint32_t arg3, uint32_t arg4, uint32_t arg5, uint32_t arg6,
|
||||
|
||||
@@ -91,6 +91,7 @@ float CANTalon::Get()
|
||||
m_impl->GetSensorPosition(value);
|
||||
return value;
|
||||
case kPercentVbus:
|
||||
case kFollower:
|
||||
default:
|
||||
m_impl->GetAppliedThrottle(value);
|
||||
return (float)value / 1023.0;
|
||||
@@ -143,7 +144,11 @@ void CANTalon::Set(float value, uint8_t syncGroup)
|
||||
case CANSpeedController::kPosition:
|
||||
status = m_impl->SetDemand(value);
|
||||
break;
|
||||
case CANSpeedController::kCurrent:
|
||||
default:
|
||||
wpi_setWPIErrorWithContext(
|
||||
IncompatibleMode,
|
||||
"The CAN Talon does not support Current Mode at this time.");
|
||||
break;
|
||||
}
|
||||
if (status != CTR_OKAY) {
|
||||
@@ -511,7 +516,7 @@ double CANTalon::GetPosition()
|
||||
return (double)postition;
|
||||
}
|
||||
/**
|
||||
* If sensor and motor are out of phase, sensor can be inverted
|
||||
* If sensor and motor are out of phase, sensor can be inverted
|
||||
* (position and velocity multiplied by -1).
|
||||
* @see GetPosition and @see GetSpeed.
|
||||
*/
|
||||
@@ -568,7 +573,7 @@ double CANTalon::GetSpeed()
|
||||
* Get the position of whatever is in the analog pin of the Talon, regardless of
|
||||
* whether it is actually being used for feedback.
|
||||
*
|
||||
* @returns The 24bit analog value. The bottom ten bits is the ADC (0 - 1023) on
|
||||
* @returns The 24bit analog value. The bottom ten bits is the ADC (0 - 1023) on
|
||||
* the analog pin of the Talon. The upper 14 bits
|
||||
* tracks the overflows and underflows (continuous sensor).
|
||||
*/
|
||||
@@ -1066,7 +1071,7 @@ void CANTalon::ConfigLimitMode(LimitMode mode)
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case kLimitMode_SrxDisableSwitchInputs: /** disable both limit switches and soft limits */
|
||||
/* turn on both limits. SRX has individual enables and polarity for each limit switch.*/
|
||||
status = m_impl->SetForwardSoftEnable(false);
|
||||
|
||||
@@ -66,7 +66,11 @@ DriverStation::DriverStation()
|
||||
|
||||
AddToSingletonList();
|
||||
|
||||
if (!m_task.Start((int32_t)this))
|
||||
// They need to be identical or it could lead to runtime stack corruption if
|
||||
// the caller and callee push and pop different amounts of data on the stack.
|
||||
static_assert(sizeof(this) == sizeof(uint32_t),
|
||||
"We are passing a pointer through a uint32_t");
|
||||
if (!m_task.Start((uint32_t)this))
|
||||
{
|
||||
wpi_setWPIError(DriverStationTaskError);
|
||||
}
|
||||
@@ -84,6 +88,8 @@ DriverStation::~DriverStation()
|
||||
deleteMutex(m_waitForDataMutex);
|
||||
}
|
||||
|
||||
// XXX: This assumes that the calling convention treats pointers and uint32_ts
|
||||
// identical, which is not necessarily true.
|
||||
void DriverStation::InitTask(DriverStation *ds)
|
||||
{
|
||||
ds->Run();
|
||||
@@ -170,7 +176,7 @@ void DriverStation::ReportJoystickUnpluggedError(std::string message) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the number of axes on a given joystick port
|
||||
*
|
||||
* @param stick The joystick port number
|
||||
@@ -188,7 +194,7 @@ int DriverStation::GetStickAxisCount(uint32_t stick)
|
||||
return joystickAxes.count;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the number of POVs on a given joystick port
|
||||
*
|
||||
* @param stick The joystick port number
|
||||
@@ -206,7 +212,7 @@ int DriverStation::GetStickPOVCount(uint32_t stick)
|
||||
return joystickPOVs.count;
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the number of buttons on a given joystick port
|
||||
*
|
||||
* @param stick The joystick port number
|
||||
@@ -316,7 +322,7 @@ bool DriverStation::GetStickButton(uint32_t stick, uint8_t button)
|
||||
wpi_setWPIError(BadJoystickIndex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if(button > m_joystickButtons[stick].count)
|
||||
{
|
||||
ReportJoystickUnpluggedError("WARNING: Joystick Button missing, check if all controllers are plugged in\n");
|
||||
|
||||
@@ -107,6 +107,7 @@ Joystick::~Joystick()
|
||||
/**
|
||||
* Get the X value of the joystick.
|
||||
* This depends on the mapping of the joystick connected to the current port.
|
||||
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
|
||||
*/
|
||||
float Joystick::GetX(JoystickHand hand)
|
||||
{
|
||||
@@ -116,6 +117,7 @@ float Joystick::GetX(JoystickHand hand)
|
||||
/**
|
||||
* Get the Y value of the joystick.
|
||||
* This depends on the mapping of the joystick connected to the current port.
|
||||
* @param hand This parameter is ignored for the Joystick class and is only here to complete the GenericHID interface.
|
||||
*/
|
||||
float Joystick::GetY(JoystickHand hand)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user