code from Querol for DC-DC conversion control