Update analogin_api.c

Implemented proper self-calibration logic as per UM10736.