File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
targets/TARGET_NXP/TARGET_MCUXpresso_MCUS/api Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,13 @@ void analogin_init(analogin_t *obj, PinName pin)
38
38
39
39
uint32_t instance = obj -> adc >> ADC_INSTANCE_SHIFT ;
40
40
adc_config_t adc_config ;
41
+ uint32_t reg ;
42
+ uint32_t pin_number = pin & 0x1F ;
43
+ uint8_t port_number = pin / 32 ;
44
+
45
+ /* Clear the DIGIMODE bit */
46
+ reg = IOCON -> PIO [port_number ][pin_number ] & ~IOCON_PIO_DIGIMODE_MASK ;
47
+ IOCON -> PIO [port_number ][pin_number ] = reg ;
41
48
42
49
ADC_ClockPower_Configuration ();
43
50
@@ -69,6 +76,7 @@ uint16_t analogin_read_u16(analogin_t *obj)
69
76
adcConvSeqConfigStruct .interruptMode = kADC_InterruptForEachSequence ;
70
77
71
78
ADC_SetConvSeqAConfig (adc_addrs [instance ], & adcConvSeqConfigStruct );
79
+ ADC_EnableConvSeqA (adc_addrs [instance ], true);
72
80
ADC_DoSoftwareTriggerConvSeqA (adc_addrs [instance ]);
73
81
74
82
/* Wait for the converter to be done. */
You can’t perform that action at this time.
0 commit comments