From 47cc6216ac455ba0b7d9ff8a96e603bb14708b24 Mon Sep 17 00:00:00 2001 From: lilvinz Date: Sat, 22 Sep 2012 10:02:15 +0200 Subject: [PATCH] use constants for receivers and updated function description --- flight/PiOS/Common/pios_gcsrcvr.c | 9 ++++++++- flight/PiOS/STM32F10x/pios_ppm.c | 11 ++++++----- flight/PiOS/STM32F10x/pios_pwm.c | 11 ++++++----- flight/PiOS/STM32F10x/pios_sbus.c | 2 +- flight/PiOS/STM32F4xx/pios_ppm.c | 11 ++++++----- flight/PiOS/STM32F4xx/pios_pwm.c | 11 ++++++----- 6 files changed, 33 insertions(+), 22 deletions(-) diff --git a/flight/PiOS/Common/pios_gcsrcvr.c b/flight/PiOS/Common/pios_gcsrcvr.c index e3e34db5b..709eeef76 100644 --- a/flight/PiOS/Common/pios_gcsrcvr.c +++ b/flight/PiOS/Common/pios_gcsrcvr.c @@ -137,11 +137,18 @@ extern int32_t PIOS_GCSRCVR_Init(uint32_t *gcsrcvr_id) return 0; } +/** + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_GCSRCVR_Get(uint32_t rcvr_id, uint8_t channel) { if (channel >= GCSRECEIVER_CHANNEL_NUMELEM) { /* channel is out of range */ - return -1; + return PIOS_RCVR_INVALID; } return (gcsreceiverdata.Channel[channel]); diff --git a/flight/PiOS/STM32F10x/pios_ppm.c b/flight/PiOS/STM32F10x/pios_ppm.c index b47a2d6c2..4893d56a9 100644 --- a/flight/PiOS/STM32F10x/pios_ppm.c +++ b/flight/PiOS/STM32F10x/pios_ppm.c @@ -200,11 +200,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_ppm_dev * ppm_dev = (struct pios_ppm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F10x/pios_pwm.c b/flight/PiOS/STM32F10x/pios_pwm.c index 4e7c98b14..497a5d19b 100644 --- a/flight/PiOS/STM32F10x/pios_pwm.c +++ b/flight/PiOS/STM32F10x/pios_pwm.c @@ -170,11 +170,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_pwm_dev * pwm_dev = (struct pios_pwm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F10x/pios_sbus.c b/flight/PiOS/STM32F10x/pios_sbus.c index 53730b16b..50d0480c3 100644 --- a/flight/PiOS/STM32F10x/pios_sbus.c +++ b/flight/PiOS/STM32F10x/pios_sbus.c @@ -166,7 +166,7 @@ out_fail: * \param[in] channel Number of the channel desired (zero based) * \output PIOS_RCVR_INVALID channel not available * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver - * \output >0 channel value + * \output >=0 channel value */ static int32_t PIOS_SBus_Get(uint32_t rcvr_id, uint8_t channel) { diff --git a/flight/PiOS/STM32F4xx/pios_ppm.c b/flight/PiOS/STM32F4xx/pios_ppm.c index 048377ebd..9acaca017 100644 --- a/flight/PiOS/STM32F4xx/pios_ppm.c +++ b/flight/PiOS/STM32F4xx/pios_ppm.c @@ -200,11 +200,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_ppm_dev * ppm_dev = (struct pios_ppm_dev *)rcvr_id; diff --git a/flight/PiOS/STM32F4xx/pios_pwm.c b/flight/PiOS/STM32F4xx/pios_pwm.c index 5bbec32aa..2c67ad465 100644 --- a/flight/PiOS/STM32F4xx/pios_pwm.c +++ b/flight/PiOS/STM32F4xx/pios_pwm.c @@ -170,11 +170,12 @@ out_fail: } /** -* Get the value of an input channel -* \param[in] Channel Number of the channel desired -* \output -1 Channel not available -* \output >0 Channel value -*/ + * Get the value of an input channel + * \param[in] channel Number of the channel desired (zero based) + * \output PIOS_RCVR_INVALID channel not available + * \output PIOS_RCVR_TIMEOUT failsafe condition or missing receiver + * \output >=0 channel value + */ static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel) { struct pios_pwm_dev * pwm_dev = (struct pios_pwm_dev *)rcvr_id;