• Earle F. Philhower, III's avatar
    Set available() to 0 when Wire.requestFrom fails (#259) · cb9931f3
    Earle F. Philhower, III authored
    Wire::requestFrom() returns the number of bytes read from the slave.  In
    the case of error, the slave can end up returning a very large integer
    for PICO_GENERIC_ERROR which would then be used as the # of bytes read
    causing crashes and errors.
    
    Running TalkingToMyself without connecting the I2C ports would show
    this behavior.
    
    Now, when PICO_GENERIC_ERROR is returned, set the read-back buffer len
    to 0 explicitly.
    cb9931f3
Wire.cpp 9.41 KB