A controller (10) for a constant frequency current-mode buck-boost converter, the converter including an inductor (L), a first switch (SW1, S1) connected between an input terminal (Vin) of the converter and one end of the inductor (L), a diode or a switch (D1, S2), connected between the first end of the inductor and ground, a second diode or switch (D2, S3) connected between a second end of the inductor and an output terminal (Vout) of the converter, and a second switch (SW2, S4) coupled between the other end of the inductor and ground. A current sensor is also present for sensing current in the first switch (SW1, S1) as a measure of the inductor (L) current. The controller (10) comprises a feedback circuit for deriving a feedback signal from the output terminal (Vout) and a waveform generator (31, 32) for generating buck and boost slope compensation ramps (RMP-BUCK, RMP-BOOST) used for improving stability of operation in both buck and boost operating modes of the converter. Control logic in the controller (10) generates drive signals during every clock period to repeatedly open and close the switches at individual duty cycles determined on the basis of the feedback signal, the sensed current signal and the slope compensation ramps. The buck and boost slope compensation ramps are mutually offset with respect to one another in time, for example by 50% of a clock cycle, and the control logic uses the sensed current signal only while the first switch (SW1, S1) is closed, thus avoiding the need for additional current sensing circuitry.