Arduino PinStatus and PinMode errors

After a lot of digging I learned that some boards (e.g. RP2040, UNO R4) use the so called Arduino Core API. And this uses non-standard definitions for digitalRead() and pinMode().

Thus, you’ll get errors like this: 

invalid conversion from ‚int‘ to ‚PinStatus‘ 

…when you use these two functions.

This problem is know and discussed in this issue here.

One solution is to block boards that use this API. Works of course, but locks out some users.
Another option (which I chose) is to typecast the pins (see my Hardware.h):

void pinMode(int pin, int mode) {
        ::pinMode(pin, static_cast(mode));    
}    
void digitalWrite(int pin, int value) {
        ::digitalWrite(pin, static_cast(value));    
}

This solves the problem.