int eth32_set_analog_reference(eth32 handle, int reference);
This function instructs the Analog to Digital Converter to select the specified source as the reference voltage for conversions. The reference voltage determines the voltage level that will give the highest possible analog reading value. There are three possible voltages that may be used: An externally-generated voltage supplied on the analog reference pin, internal 5V, and internally generated 2.56V.
handle - The value returned by the eth32_open function.
reference - A code indicating which voltage source to select. This may be the constants REF_EXTERNAL, REF_INTERNAL (internal 5V), or REF_256 (internal 2.56V)
This function returns zero on success and a negative error code on failure. Please see the Error Codes section for possible error codes.
Note that whatever voltage source is selected will be internally connected to the external voltage reference pin. So for example, if you have a 4V source connected to the external reference pin, you should NOT configure the reference for REF_INTERNAL or REF_256 until you have disconnected the external reference pin.
Also note that if you connect a voltage to the external reference pin, it must not exceed 5V or go below 0V.