Add way to atomically check for new data, and wait otherwise (#2015)

This commit is contained in:
Thad House
2019-11-01 17:09:28 -07:00
committed by Peter Johnson
parent a769f1f227
commit 6f159d1426
3 changed files with 92 additions and 7 deletions

View File

@@ -193,6 +193,24 @@ int32_t HAL_GetMatchInfo(HAL_MatchInfo* info);
*/
void HAL_ReleaseDSMutex(void);
/**
* Checks if new control data has arrived since the last
* HAL_WaitForCachedControlData or HAL_IsNewControlData call. If new data has
* not arrived, waits for new data to arrive. Otherwise, returns immediately.
*/
void HAL_WaitForCachedControlData(void);
/**
* Checks if new control data has arrived since the last
* HAL_WaitForCachedControlData or HAL_IsNewControlData call. If new data has
* not arrived, waits for new data to arrive, or a timeout. Otherwise, returns
* immediately.
*
* @param timeout timeout in seconds
* @return true for new data, false for timeout
*/
HAL_Bool HAL_WaitForCachedControlDataTimeout(double timeout);
/**
* Has a new control packet from the driver station arrived since the last
* time this function was called?