"FlexIO_t4.h" FLEXIO2 fails to freeShifter

JoCaGoVi

Member
While using FLEXIO2, if I call freeShifter(2) and the shifter does not get removed from _used_shifters. freeShifter(0) works fine. I did not debug FLEXIO1 since I did not get any errors on FLEXIO1
I changed the code to this and now it works!
Code:
void FlexIOHandler::freeShifter(uint8_t n) {
    --if (n > 0xff) return;    // don't free if we did not allocate
    ++if (n > 7) return;    // don't free if we did not allocate or invalid
    ++ uint8_t mask = 1 << n;
    -- uint8_t mask = 0x1;
    -- for (;n < 0; n--) mask <<= 1;
    _used_shifters &= ~mask;
}
 
Back
Top