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()
35 #ifndef FREERTOS_POSIX
44 static uint8_t out_cache = 0x0;
46 int8_t rpp_lout_set(uint8_t pin, uint8_t val)
48 if((pin < 1) || (pin > 8)) {
52 uint8_t index = pin - 1;
54 bit_set(out_cache, index);
56 bit_clear(out_cache, index);
62 static uint8_t diag_cache = 0x0;
64 int8_t rpp_lout_diag(uint8_t pin)
66 if((pin < 1) || (pin > 8)) {
70 if(is_bit_set(diag_cache, pin - 1)) {
77 int8_t rpp_lout_update()
79 #ifndef FREERTOS_POSIX
80 // Update output values
81 lout_set_word(out_cache);
82 // FIXME: Check which SPI transfer statuses could be considered errors
85 // Read back diagnostic values
86 // FIXME: Implement. Dummy assign for now.
87 diag_cache = out_cache;
89 if(diag_cache != out_cache) {