*
* @file mout.h
*
- * @copyright Copyright (C) 2013 Czech Technical University in Prague
+ * @copyright Copyright (C) 2013, 2016 Czech Technical University in Prague
*
* @author Carlos Jenkins <carlos@jenkins.co.cr>
*/
*
* The function is thread safe, unless compiled with -DRPP_THREADSAFE=0.
*
- * Note that rpp_mout_set() calls this routine already before returning.
- *
* @param[in] pin The pin number to read [1-6].
*
- * @return SUCCESS is output is operating normally.
- * FAILURE if a faulty condition was detected.
+ * @return 0 the pin is low, i.e. fault detected,
+ * 1 the pin is high, i.e. normal operation,
+ * -RPP_EINVAL pin number out of range
*/
int8_t rpp_mout_diag(uint8_t pin);
int8_t rpp_mout_diag(uint8_t pin)
{
+ int ret;
// Check range
if ((pin < 1) || (pin > 6))
- return -1;
+ return -RPP_EINVAL;
#ifndef FREERTOS_POSIX
RPP_MUTEX_LOCK(mutex_mout);
- if (drv_mout_diag(pin - 1) == 0) {
- RPP_MUTEX_UNLOCK(mutex_mout);
- return FAILURE;
- }
+ ret = drv_mout_diag(pin - 1);
+ RPP_MUTEX_UNLOCK(mutex_mout);
#endif
- return SUCCESS;
+ return ret;
}