コード例 #1
0
/**
 * Returns the number of axes on a given joystick port
 *
 * @param stick The joystick port number
 * @return The number of axes on the indicated joystick
 */
int DriverStation::GetStickAxisCount(uint32_t stick) const {
  if (stick >= kJoystickPorts) {
    wpi_setWPIError(BadJoystickIndex);
    return 0;
  }
  HALJoystickAxes joystickAxes;
  HALGetJoystickAxes(stick, &joystickAxes);
  return joystickAxes.count;
}
コード例 #2
0
/**
 * Copy data from the DS task for the user.
 * If no new data exists, it will just be returned, otherwise
 * the data will be copied from the DS polling loop.
 */
void DriverStation::GetData() {
  // Get the status of all of the joysticks
  for (uint8_t stick = 0; stick < kJoystickPorts; stick++) {
    HALGetJoystickAxes(stick, &m_joystickAxes[stick]);
    HALGetJoystickPOVs(stick, &m_joystickPOVs[stick]);
    HALGetJoystickButtons(stick, &m_joystickButtons[stick]);
    HALGetJoystickDescriptor(stick, &m_joystickDescriptor[stick]);
  }
  m_newControlData.give();
}
コード例 #3
0
/**
 * Copy data from the DS task for the user.
 * If no new data exists, it will just be returned, otherwise
 * the data will be copied from the DS polling loop.
 */
void DriverStation::GetData()
{

	// Get the status of all of the joysticks
	for(uint8_t stick = 0; stick < kJoystickPorts; stick++) {
		HALGetJoystickAxes(stick, &m_joystickAxes[stick]);
		HALGetJoystickPOVs(stick, &m_joystickPOVs[stick]);
		HALGetJoystickButtons(stick, &m_joystickButtons[stick]);
	}
	giveSemaphore(m_newControlData);
}