Add routine to read and match bytes received. (Essentially strcmp replacement without requiring a large receive buffer.) Note that failed matches drop any bytes matched successfully.

git-svn-id: svn+ssh://oldsvn/home/mlalondesvn/svn/cral@79 3ee9b42a-b53c-0410-a25e-f0b6218d5d5b
master
follower 17 years ago
parent a099cfd0af
commit e732cd1a42

@ -200,6 +200,23 @@ uint8_t readByte() {
} }
int readMatch(char *stringToMatch) {
while (getSn_RX_RSR(testSocket) < strlen(stringToMatch)) {
// block
// TODO: Return error or wait or "too short"?
}
for (int currCharIdx = 0; currCharIdx < strlen(stringToMatch); currCharIdx++) {
if (readByte() != stringToMatch[currCharIdx]) {
return 0;
}
}
return 1;
}
void loop() { void loop() {
Serial.println("Test W5100 socket..."); Serial.println("Test W5100 socket...");

Loading…
Cancel
Save