MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / deviceType

Method deviceType

libraries/ANSI/ansi.cpp:154–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153
154int ANSI::deviceType(uint32_t timeout)
155{
156 int type = -1; // -1 = unknown
157 print("\033[0c");
158
159 uint32_t start = millis();
160 int read_len = 0;
161 char buffer[8];
162 while ((read_len != 3) && ((millis() - start) < timeout))
163 {
164 delay(1);
165 read_len = Serial.readBytes(buffer, 3);
166 if ((buffer[0] == '1') && (buffer[1] == ';'))
167 {
168 type = buffer[2] - '0';
169 }
170 // Serial.write(buffer, 3);
171 // Serial.println();
172 }
173 return type;
174}
175
176
177//////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 1

readBytesMethod · 0.45

Tested by

no test coverage detected