1 /* Copyright (C) 2013 Czech Technical University in Prague
4 * - Carlos Jenkins <carlos@jenkins.co.cr>
6 * This document contains proprietary information belonging to Czech
7 * Technical University in Prague. Passing on and copying of this
8 * document, and communication of its contents is not permitted
9 * without prior written authorization.
13 * Power Output (12V, 2A, Push/Pull) RPP API implementation file.
17 * RPP API documentation.
23 #if rppCONFIG_INCLUDE_MOUT == 1
25 #if rppCONFIG_DRV == 1
29 static boolean_t initialized = FALSE;
31 int8_t rpp_mout_init()
42 static uint8_t cache[] = {
43 LOW, LOW, LOW, LOW, LOW, LOW
46 int8_t rpp_mout_set(uint8_t pin, uint8_t val)
49 if((pin < 1) || (pin > 6)) {
54 if((val != HIGH) && (val != LOW)) {
58 uint8_t idx = pin - 1;
60 #if rppCONFIG_DRV == 1
61 // Set and store value
62 if(drv_mout_set(idx, val) != SUCCESS) {
67 // FIXME Wait some time for synchronization
68 // Don't use vTaskDelay() here because the minimum time to wait is one tick,
69 // and depending of the configuration of the user model one tick can overrun
72 for(wait = 0; wait < 10; wait++) {
76 // Get value back and compare
77 if(drv_mout_diag(idx) == FAILURE) {
88 int8_t rpp_mout_get(uint8_t pin)
91 if((pin < 1) || (pin > 6)) {
95 return cache[pin - 1];
99 int8_t rpp_mout_diag(uint8_t pin)
102 if((pin < 1) || (pin > 6)) {
106 #if rppCONFIG_DRV == 1
107 if(drv_mout_diag(pin - 1) == 0) {
115 #endif /* rppCONFIG_INCLUDE_MOUT */