]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blobdiff - rpp/src/rpp/_tms570_hdk/adc.c
Unify ADC among targets
[pes-rpp/rpp-lib.git] / rpp / src / rpp / _tms570_hdk / adc.c
diff --git a/rpp/src/rpp/_tms570_hdk/adc.c b/rpp/src/rpp/_tms570_hdk/adc.c
deleted file mode 100644 (file)
index 8f0ede0..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2013 Czech Technical University in Prague
- *
- * Authors:
- *     - Carlos Jenkins <carlos@jenkins.co.cr>
- *
- * This document contains proprietary information belonging to Czech
- * Technical University in Prague. Passing on and copying of this
- * document, and communication of its contents is not permitted
- * without prior written authorization.
- *
- * File : adc.c
- * Abstract:
- *     Analog Input RPP API implementation file.
- *
- * References:
- *     adc.h
- *     RPP API documentation.
- */
-
-
-#include "rpp/rpp.h"
-
-#ifndef FREERTOS_POSIX
-#include "drv/drv.h"
-
-// RPP has 12 ADC channels
-// See s_adcSelect and s_adcFiFoSize in ti_drv_adc.c for hardware configuration.
-#define ADC_CHANNELS 16
-static adcData_t in_cache[ADC_CHANNELS];
-#endif
-
-static boolean_t initialized = FALSE;
-
-int8_t rpp_adc_init()
-{
-       if (initialized)
-               return FAILURE;
-       initialized = TRUE;
-
-#ifndef FREERTOS_POSIX
-       drv_adc_init();
-#endif
-
-       return SUCCESS;
-}
-
-
-int16_t rpp_adc_get(uint8_t pin)
-{
-       if ((pin < 1) || (pin > 16))
-               return -1;
-
-       int16_t result = 0;
-
-#ifndef FREERTOS_POSIX
-       // This conversion uint16_t -> int16_t is safe because we know values
-       // are 12bits. Here we are masking those 12bits just in case.
-       result = (int16_t)(in_cache[pin - 1].value & 0xFFF);
-#endif
-
-       return result;
-}
-
-
-int8_t rpp_adc_update()
-{
-#ifndef FREERTOS_POSIX
-       // in_cache is thread safe because it's only write operation is mutexed
-       drv_adc_read_adc((adcData_t *)&in_cache);
-#endif
-
-       return SUCCESS;
-}