MCPcopy Create free account
hub / github.com/SmingHub/Sming / readTest

Function readTest

samples/SDCard/app/application.cpp:175–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173}
174
175void readTest()
176{
177 Serial.println(_F("3. Open file \"test.txt\" and read"));
178
179 FIL file;
180 FRESULT fRes = f_open(&file, "test.txt", FA_READ);
181
182 if(fRes == FR_OK) {
183 //read back file contents
184 char buffer[64];
185
186 uint32_t actual = 0;
187 f_read(&file, buffer, sizeof(buffer), &actual);
188 buffer[actual] = 0;
189
190 Serial << _F("Read: ") << buffer << endl;
191
192 f_close(&file);
193 } else {
194 Serial << _F("fopen FAIL: ") << fRes << endl;
195 }
196}
197
198bool speedTest(unsigned num)
199{

Callers 1

runTestFunction · 0.85

Calls 4

f_openFunction · 0.85
f_readFunction · 0.85
f_closeFunction · 0.85
printlnMethod · 0.80

Tested by

no test coverage detected