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 * Logic Output RPP API implementation file.
17 * RPP API documentation.
23 #ifndef FREERTOS_POSIX
27 static boolean_t initialized = FALSE;
29 int8_t rpp_lout_init()
34 #ifndef FREERTOS_POSIX
43 static uint8_t out_cache = 0x0;
45 int8_t rpp_lout_set(uint8_t pin, uint8_t val)
47 if ((pin < 1) || (pin > 8))
50 uint8_t index = pin - 1;
52 bit_set(out_cache, index);
54 bit_clear(out_cache, index);
59 static uint8_t diag_cache = 0x0;
61 int8_t rpp_lout_diag(uint8_t pin)
63 if ((pin < 1) || (pin > 8))
66 if (is_bit_set(diag_cache, pin - 1))
72 int8_t rpp_lout_update()
74 #ifndef FREERTOS_POSIX
75 // Update output values
76 lout_set_word(out_cache);
77 // FIXME: Check which SPI transfer statuses could be considered errors
80 // Read back diagnostic values
81 // FIXME: Implement. Dummy assign for now.
82 diag_cache = out_cache;
84 if (diag_cache != out_cache)