I am using a lithium ion (~100mAh) battery in my application, which is almost all the time powered up by 12 V source. The 12V gets converted to 4.2 V through SMPS, which then further powers up the 3.3V through LDO. The purpose of battery is to act as an alternate power source for the LDO, when the 4.2 V output is absent. The battery also comes with an inbuilt circuit which is described in the diagram below
The reason for choosing 4.2V as the SMPS voltage, is that the charging voltage of the battery +circuit combination is recommended to be 4.2-4.3 Volts. Now, given the above circuit, the under voltage, over voltage protection is already present. I am looking for a simple circuit which can do following purposes 1) Control the charging by enabling / disabling the 4.2 V output fed to battery+circuit combo. 2) Switch the power input from battery, in absence of the 12V input (hence the 4.2V SMPS output). Hooking the battery all the time on 4.2V output looks to be a workable, but not-so-safe option. Also, the 3.3V logic powers up a MCU, so the logic can also be controlled by MCU especially for purpose 1.