mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
fix for issue #99
This commit is contained in:
parent
7b92d91b23
commit
25156d33a4
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: MultiSpeedI2CScanner.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.7
|
||||
// VERSION: 0.1.9
|
||||
// PURPOSE: I2C scanner at different speeds
|
||||
// DATE: 2013-11-05
|
||||
// URL: http://forum.arduino.cc/index.php?topic=197360
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
TwoWire *wi;
|
||||
|
||||
const char version[] = "0.1.7";
|
||||
const char version[] = "0.1.9";
|
||||
|
||||
|
||||
// INTERFACE COUNT (TESTED TEENSY 3.5 AND ARDUINO DUE ONLY)
|
||||
@ -77,11 +77,10 @@ void setup()
|
||||
|
||||
wi = &Wire;
|
||||
|
||||
setSpeed('0');
|
||||
setSpeed('9');
|
||||
displayHelp();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
char command = getCommand();
|
||||
@ -146,6 +145,7 @@ void loop()
|
||||
case '2':
|
||||
case '4':
|
||||
case '8':
|
||||
case '9':
|
||||
setSpeed(command);
|
||||
break;
|
||||
|
||||
@ -182,7 +182,6 @@ void loop()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void setAddress()
|
||||
{
|
||||
if (addressStart == 0)
|
||||
@ -223,6 +222,13 @@ void setSpeed(char sp)
|
||||
speed[0] = 800;
|
||||
speeds = 1;
|
||||
break;
|
||||
case '9': // limited to 400KHz
|
||||
speeds = 5;
|
||||
for (int i = 0; i < speeds; i++)
|
||||
{
|
||||
speed[i] = allSpeed[i];
|
||||
}
|
||||
break;
|
||||
case '0': // reset
|
||||
speeds = sizeof(allSpeed) / sizeof(allSpeed[0]);
|
||||
for (int i = 0; i < speeds; i++)
|
||||
@ -261,16 +267,16 @@ void displayHelp()
|
||||
Serial.println(F("\th = toggle header - noHeader."));
|
||||
Serial.println(F("\ta = toggle address range, 0..127 - 8..120"));
|
||||
Serial.println(F("Speeds:"));
|
||||
Serial.println(F("\t0 = 50 - 800 Khz"));
|
||||
Serial.println(F("\t0 = 50 - 800 Khz (warning - can block!!)"));
|
||||
Serial.println(F("\t1 = 100 KHz only"));
|
||||
Serial.println(F("\t2 = 200 KHz only"));
|
||||
Serial.println(F("\t4 = 400 KHz only"));
|
||||
Serial.println(F("\t8 = 800 KHz only"));
|
||||
Serial.println(F("\t8 = 800 KHz only (warning - can block!)"));
|
||||
Serial.println(F("\t9 = 50 - 400 Khz <<< DEFAULT >>>"));
|
||||
Serial.println(F("\n\t? = help - this page"));
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
|
||||
void I2Cscan()
|
||||
{
|
||||
startScan = millis();
|
||||
|
31
sketches/MultiSpeedI2CScanner/readme.md
Normal file
31
sketches/MultiSpeedI2CScanner/readme.md
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
MultiSpeedI2CScanner is a menu driven I2C scanner, see below.
|
||||
|
||||
|
||||
Arduino MultiSpeed I2C Scanner - 0.1.9
|
||||
|
||||
I2C ports: 1
|
||||
@ = toggle Wire - Wire1 - Wire2 [TEENSY 3.5 or Arduino Due]
|
||||
Scanmode:
|
||||
s = single scan
|
||||
c = continuous scan - 1 second delay
|
||||
q = quit continuous scan
|
||||
d = toggle latency delay between successful tests. 0 - 5 ms
|
||||
Output:
|
||||
p = toggle printAll - printFound.
|
||||
h = toggle header - noHeader.
|
||||
a = toggle address range, 0..127 - 8..120
|
||||
Speeds:
|
||||
0 = 50 - 800 Khz (warning - can block!!)
|
||||
1 = 100 KHz only
|
||||
2 = 200 KHz only
|
||||
4 = 400 KHz only
|
||||
8 = 800 KHz only (warning - can block!)
|
||||
9 = 50 - 400 Khz <<< DEFAULT >>>
|
||||
|
||||
? = help - this page
|
||||
|
||||
|
||||
TODO: explain menu options in more detail
|
||||
|
||||
|
36
sketches/MultiSpeedI2CScanner/releaseNotes.txt
Normal file
36
sketches/MultiSpeedI2CScanner/releaseNotes.txt
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
==============================
|
||||
2018-04-02 version 0.1.9
|
||||
==============================
|
||||
+ '9' command to scan up to 400 KHz only to prevent blocking
|
||||
+ changed "scan up to 400 KHz" as default at startup
|
||||
|
||||
==============================
|
||||
2017-08-03 version 0.1.8
|
||||
==============================
|
||||
+ DUE support
|
||||
|
||||
==============================
|
||||
2017-07-17 version 0.1.7
|
||||
==============================
|
||||
+ TEENSY support - multiple I2C ports
|
||||
+ '@' command to select I2C Port
|
||||
+ changed # speeds steps of 100
|
||||
|
||||
==============================
|
||||
2015-03-29 version 0.1.6
|
||||
==============================
|
||||
+ Wire.setClock as more portable way to set I2C clock
|
||||
|
||||
==============================
|
||||
2014-07-06 version 0.1.5
|
||||
==============================
|
||||
+ void setSpeed() - more control about what is scanned
|
||||
+ void setAddress() - address range
|
||||
+ extended help
|
||||
|
||||
==============================
|
||||
older versions not documented
|
||||
==============================
|
||||
|
||||
// END OF FILE
|
Loading…
Reference in New Issue
Block a user