mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
PIOS_RCVR: Document return values better and use enum for them
This commit is contained in:
parent
533ae9bb41
commit
82c5f9f0f4
@ -76,6 +76,15 @@ out_fail:
|
||||
return(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reads an input channel from the appropriate driver
|
||||
* @param[in] rcvr_id driver to read from
|
||||
* @param[in] channel channel to read
|
||||
* @returns Unitless input value
|
||||
* @retval PIOS_RCVR_TIMEOUT indicates a failsafe or timeout from that channel
|
||||
* @retval PIOS_RCVR_INVALID invalid channel for this driver (usually out of range supported)
|
||||
* @retval PIOS_RCVR_NODRIVER driver was not initialized
|
||||
*/
|
||||
int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel)
|
||||
{
|
||||
if (rcvr_id == 0)
|
||||
|
@ -39,9 +39,15 @@ struct pios_rcvr_driver {
|
||||
/* Public Functions */
|
||||
extern int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel);
|
||||
|
||||
#define PIOS_RCVR_TIMEOUT 0
|
||||
#define PIOS_RCVR_NODRIVER -2
|
||||
#define PIOS_RCVR_INVALID -1
|
||||
/*! Define error codes for PIOS_RCVR_Get */
|
||||
enum PIOS_RCVR_errors {
|
||||
/*! Indicates that a failsafe condition or missing receiver detected for that channel */
|
||||
PIOS_RCVR_TIMEOUT = 0,
|
||||
/*! Channel is invalid for this driver (usually out of range supported) */
|
||||
PIOS_RCVR_INVALID = -1,
|
||||
/*! Indicates that the driver for this channel has not been initialized */
|
||||
PIOS_RCVR_NODRIVER = -2
|
||||
};
|
||||
|
||||
#endif /* PIOS_RCVR_H */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user