* -2 if val is not HIGH or LOW.\n
* -3 if pin could not be set. With current implementation this should
* never happen.\n
- * -4 if pin is confirmed to be in trouble.
- * This normally indicates a hardware failure and that the driver
- * chip pulled the diagnostic pin.
+ * -4 if a fault is indicated by DIAG pin
*/
int8_t rpp_mout_set(uint8_t pin, uint8_t val);
ret = drv_mout_set(idx, val);
if (ret == SUCCESS)
cache[idx] = val;
- RPP_MUTEX_UNLOCK(mutex_mout);
- if (ret != SUCCESS)
+ else {
+ RPP_MUTEX_UNLOCK(mutex_mout);
return -3;
-
- // FIXME Wait some time for synchronization
- // Don't use vTaskDelay() here because the minimum time to wait is one tick,
- // and depending of the configuration of the user model one tick can overrun
- // the program.
- int wait;
- for (wait = 0; wait < 10; wait++) {
- asm (" nop");
}
- RPP_MUTEX_LOCK(mutex_mout);
- // Get value back and compare
ret = drv_mout_diag(idx);
RPP_MUTEX_UNLOCK(mutex_mout);
- if (ret < 0) {
+ if (ret == 0)
return -4;
- }
-
#else
RPP_MUTEX_LOCK(mutex_mout);
cache[idx] = val;