In the Microsoft.SPOT.Hardware.AnalogInput class...
When an AnalogInput is created, its analog channel is enabled in the MCU.
When an AnalogInput is disposed, Port.ReservePin(false) is called to release the hold on GPIOs attached to analog channels. But there is no AnalogInput_DeactiveChannel native code method, and no code is called which can deactivate the analog channel.
A workaround for some analog channels is to check if they are enabled in the GPIO ReservePin native code method. But this only works for analog channels which share pins with GPIOs. For MCU pins which are pure AnalogInputs, there is no way to deactivate them.
Additionally we like to reference count the number of channels being used...so we can shut off the ADC when no more AnalogInputs exist. Since there is no native code cleanup for the analog channel, the ADC can never be turned off.
Could we please add a deactivate native method in the .NET MF 4.3 revision to AnalogInput, and call it from the Dispose(bool) function?
Secret Labs LLC