Sensing Bidirectional Current With a Single Supply Op-amp
The circuit is essential the same as an operational amplifier in a differential amplifier configuration. The important difference is, instead of connecting the non-inverting input to ground, it is connected to a buffered voltage which is equal to half of your ADC reference voltage.
In software, you retrieve an unsigned value from the ADC register, copy it to a signed integer value and subtract half of the top value. For example, for a 10-bit ADC:
int MY_SIGNED_RESULT = ADCVALUE - 512;
If your ADC supports differential conversions, You can still use the above and save a pin; or you can direct VHALF into the inverting input and the op-amp output into the non-inverting input and convert with a signed result.