int eth32_set_analog_state(eth32 handle, int state);
This function enables or disables the Analog to Digital Converter (ADC) portion of the ETH32 device. The ADC must first be enabled before any valid analog readings can be taken obtained.
handle - The value returned by the eth32_open function.
state - Whether to enable (1) or disable (0) the ADC. The constants ADC_ENABLED and ADC_DISABLED may be used for this parameter.
This function returns zero on success and a negative error code on failure. Please see the Error Codes section for possible error codes.
Because the analog channels use the same physical pins as digital I/O port 3, enabling the ADC forces port 3 into input mode and sets the output value of port 3 to zero. Changes to the direction register or output value of port 3 are disabled while the ADC remains enabled. Note that regardless of what port 3's direction register and output value were at the time the ADC was enabled, if the ADC is later disabled, port 3 will be left in input mode with an output value of zero.