On old Arduino hardware i did things like
Code: Select all
// ATTENTION: example code is for old Arduino boards, *not* ESP
// input or output?
reg = portModeRegister(port);
if (*reg & mask) { // digital OUTPUTS
...
// high or low?
reg = portOutputRegister(port);
if (*reg & mask) { // HIGH
...
} else { // LOW
...
}
} else { // digital INPUTS
...
// pullup, tristate
// similar code ...
}