Designing Control Loops for Linear and Switching Power Supplies: A Tutorial Guide