/* regAdress: Address of the register that has to be updated mask: Masks the bits of the register that have to be updated Bits masked with value 1 are read Bits masked with value 0 are set 0 shift: Amount of bits the data byte is shifted (right) after being masked return: read and processed bits or -1 on fail  */
int16_t readByteBitfield(uint8_t regAddress, uint8_t mask, uint8_t shift)
/* regAdress: Address of the register that has to be updated mask: Masks the bits of the register that have to be updated Bits masked with value 1 are read Bits masked with value 0 are set 0 shift: Amount of bits the data byte is shifted (right) after being masked return: read and processed bits or -1 on fail  */
int16_t readByteBitfield(uint8_t regAddress, uint8_t mask, uint8_t shift)
{
    int16_t ret = readByte(regAddress);
    if (ret < 0) {
        return ret;
    }
    return (((uint8_t)ret) & mask) >> shift;
}