[LPC4088] Merged bugfixes and improvments for LPC1768 target to LPC4088 target

- Cast to matching enumeration type instead of uint32_t
- Silence signed/unsigned comparison warnings in GCC
- Fix serial_clear
- Fix hardfault when attaching callback to CAN2 when CAN1 is not defined
- InterruptIn speedup