Power and battery switching circuit