aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKévin Redon <kredon@sysmocom.de>2018-07-11 09:23:33 +0200
committerKévin Redon <kredon@sysmocom.de>2018-07-11 22:24:46 +0200
commitac0843af836640979fa5ce62c29fb532ea82bd5b (patch)
treee0dcf76ab2101e7c352ff3335cdb33c2fac86df0
parent31ed8029b79ec789c2bedc0efdfecb06aa7a023f (diff)
make adc2uv common
when building the trace app for the simtrace board gcc was outputing the following error: libboard/common/source/boardver_adc.c:20:17: warning: 'adc2uv' defined but not used [-Wunused-function] static uint32_t adc2uv(uint16_t adc) adc2uv is used by qmod, and defined in two places: in boardver_adc.c and mode_cardemu.c. this change will have adc2uv only defined in boardver_adc.c and make available in the header to be used by mode_cardemu.c. Change-Id: I8a772638fa8dd02d8bc8b7631de5af5a22647c55
-rw-r--r--firmware/libboard/common/include/boardver_adc.h1
-rw-r--r--firmware/libboard/common/source/boardver_adc.c3
-rw-r--r--firmware/libcommon/source/mode_cardemu.c8
3 files changed, 3 insertions, 9 deletions
diff --git a/firmware/libboard/common/include/boardver_adc.h b/firmware/libboard/common/include/boardver_adc.h
index 9b01d0a..956c302 100644
--- a/firmware/libboard/common/include/boardver_adc.h
+++ b/firmware/libboard/common/include/boardver_adc.h
@@ -15,3 +15,4 @@
#pragma once
int get_board_version_adc(void);
+uint32_t adc2uv(uint16_t adc);
diff --git a/firmware/libboard/common/source/boardver_adc.c b/firmware/libboard/common/source/boardver_adc.c
index f204aa1..51db929 100644
--- a/firmware/libboard/common/source/boardver_adc.c
+++ b/firmware/libboard/common/source/boardver_adc.c
@@ -15,9 +15,8 @@
#include "board.h"
#include "boardver_adc.h"
-/* FIXME: share this with mode_cardemu.c */
#define UV_PER_LSB ((3300 * 1000) / 4096)
-static uint32_t adc2uv(uint16_t adc)
+uint32_t adc2uv(uint16_t adc)
{
uint32_t uv = (uint32_t) adc * UV_PER_LSB;
return uv;
diff --git a/firmware/libcommon/source/mode_cardemu.c b/firmware/libcommon/source/mode_cardemu.c
index c7362cf..b1d9c7a 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -17,6 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
*/
#include "board.h"
+#include "boardver_adc.h"
#include "simtrace.h"
#include "ringbuffer.h"
#include "card_emu.h"
@@ -296,7 +297,6 @@ static int card_vcc_adc_init(void)
return 0;
}
-#define UV_PER_LSB ((3300 * 1000) / 4096)
#define VCC_UV_THRESH_1V8 1500000
#define VCC_UV_THRESH_3V 2800000
@@ -316,12 +316,6 @@ static void process_vcc_adc(struct cardem_inst *ci)
ci->vcc_uv_last = ci->vcc_uv;
}
-static uint32_t adc2uv(uint16_t adc)
-{
- uint32_t uv = (uint32_t) adc * UV_PER_LSB;
- return uv;
-}
-
void ADC_IrqHandler(void)
{
#ifdef CARDEMU_SECOND_UART