/** * Returns the number of POVs on a given joystick port * * @param stick The joystick port number * @return The number of POVs on the indicated joystick */ int DriverStation::GetStickPOVCount(uint32_t stick) const { if (stick >= kJoystickPorts) { wpi_setWPIError(BadJoystickIndex); return 0; } HALJoystickPOVs joystickPOVs; HALGetJoystickPOVs(stick, &joystickPOVs); return joystickPOVs.count; }
/** * 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(); }
/** * 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); }