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
This commit is contained in:
Kévin Redon
2018-07-11 09:23:33 +02:00
parent 31ed8029b7
commit ac0843af83
3 changed files with 3 additions and 9 deletions

View File

@@ -15,3 +15,4 @@
#pragma once
int get_board_version_adc(void);
uint32_t adc2uv(uint16_t adc);

View File

@@ -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;

View File

@@ -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