Direct charging of lead-acid batteries and lithium batteries