Hello,
please be so kind and fill what error you are facing and try to better describe what meaning with It worked fine before
(before what?).
I remember your older post How to use Rotary-Encoder using MBED OS6.16 in Keil Studio - Mbed OS - Arm Mbed OS support forum
BR, Jan