/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0.  */
unsigned char PIO_Get(const Pin *pin)
/* Returns 1 if one or more PIO of the given Pin instance currently have a high level; otherwise returns 0.  */
unsigned char PIO_Get(const Pin *pin)
{
    unsigned int reg;
    if ((pin->type == PIO_OUTPUT_0) || (pin->type == PIO_OUTPUT_1)) {
        reg = READ(pin->pio, PIO_ODSR);
    }
    else {
        reg = READ(pin->pio, PIO_PDSR);
    }
    if ((reg & pin->mask) == 0) {
        return 0;
    }
    else {
        return 1;
    }
}