mirror of https://gerrit.osmocom.org/simtrace2
octsimtest: Adjust VCC voltage thresholds (resistive VCC divider)
octsimtest has a resistive voltage divider in front of the VCC ADC in order to also detect 5V. We must make the thresholds board-specific and adjust them for octsimtest. Change-Id: I9e4adb4f349d2d838ea4100eb49271f3a0e7a2a5
This commit is contained in:
parent
054d7ca499
commit
4996d7d634
|
@ -105,6 +105,9 @@
|
|||
#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_BUSPOWERED_NORWAKEUP
|
||||
|
||||
#define DETECT_VCC_BY_ADC
|
||||
/* we have a resistive voltage divider of 47 + 30 kOhms to also detect 5V supply power */
|
||||
#define VCC_UV_THRESH_1V8 (1500000*47)/(47+30)
|
||||
#define VCC_UV_THRESH_3V (2500000*47)/(47+30)
|
||||
|
||||
/** Supported modes */
|
||||
/* SIMtrace board supports sniffer mode */
|
||||
|
|
|
@ -109,6 +109,9 @@
|
|||
#define BOARD_USB_RELEASE 0x010
|
||||
|
||||
#define CARDEMU_SECOND_UART
|
||||
|
||||
#define DETECT_VCC_BY_ADC
|
||||
#define VCC_UV_THRESH_1V8 1500000
|
||||
#define VCC_UV_THRESH_3V 2500000
|
||||
|
||||
#define HAVE_CARDEM
|
||||
|
|
|
@ -408,6 +408,9 @@ void card_emu_uart_interrupt(uint8_t uart_chan)
|
|||
***********************************************************************/
|
||||
|
||||
#ifdef DETECT_VCC_BY_ADC
|
||||
#if !defined(VCC_UV_THRESH_1V8) || !defined(VCC_UV_THRESH_3V)
|
||||
#error "You must define VCC_UV_THRESH_{1V1,3V} if you use ADC VCC detection"
|
||||
#endif
|
||||
|
||||
static volatile int adc_triggered = 0;
|
||||
static int adc_sam3s_reva_errata = 0;
|
||||
|
@ -456,9 +459,6 @@ static int card_vcc_adc_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define VCC_UV_THRESH_1V8 1500000
|
||||
#define VCC_UV_THRESH_3V 2500000
|
||||
|
||||
static void process_vcc_adc(struct cardem_inst *ci)
|
||||
{
|
||||
if (ci->vcc_uv >= VCC_UV_THRESH_3V)
|
||||
|
|
Loading…
Reference in New Issue