Intellectual H-bridge with current and voltage control