Skip to content

Commit 6b6d072

Browse files
Ganesh Ramachandranadbridge
authored andcommitted
ADC Reset Conflict Fixed
ADC Reset conflict with already configured ADC pins is fixed
1 parent e445e08 commit 6b6d072

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

targets/TARGET_TOSHIBA/TARGET_TMPM066/analogin_api.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "pinmap.h"
1919
#include "mbed_wait_api.h"
2020

21+
static uint8_t adc_reset_init = 0; // Is ADC Reset happened yet?
2122
#define ADC_10BIT_RANGE 0x3FF
2223

2324
static const PinMap PinMap_ADC[] = {
@@ -43,8 +44,11 @@ void analogin_init(analogin_t *obj, PinName pin)
4344
CG_SetADCClkSupply(ENABLE);
4445
// Set pin function as ADC
4546
pinmap_pinout(pin, PinMap_ADC);
46-
// Software reset ADC
47-
ADC_SWReset();
47+
if (!adc_reset_init) {
48+
// Software reset ADC
49+
ADC_SWReset();
50+
adc_reset_init = 1;
51+
}
4852
// Set sample hold time and pre-scale clock
4953
ADC_SetClk(ADC_CONVERSION_81_CLOCK, ADC_FC_DIVIDE_LEVEL_8);
5054
// Set input channel

0 commit comments

Comments
 (0)