error in SD.cpp int File::read(void *buf, size_t len)
Hoek67 opened this issue · comments
bytesread was a uint8_t.... which sort of made my code that returns 512 bytes die. Changed to UINT same as return type.
int File::read()
{
UINT byteread; // changed type... not critical here as should be 1
int8_t data;
f_read(_fil, (void *)&data, 1, (UINT *)&byteread);
return data;
}
/**
- @brief Read an amount of data from the file
- @param buf: an array to store the read data from the file
- @param len: the number of elements to read
- @RetVal Number of bytes read
*/
int File::read(void *buf, size_t len)
{
UINT bytesread; // was error only allowed for uint8_t!!!!
f_read(_fil, buf, len, (UINT *)&bytesread);
return bytesread;
}
fixed code below :- when reading the number of bytes was trunctated to 255.