mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.3.0 I2C_SCANNER
This commit is contained in:
parent
a2adba097d
commit
c367b2c379
@ -6,11 +6,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.3.0] - 2023-12-05
|
||||||
|
- remove **begin(sda, scl)** to have less board specific dependencies.
|
||||||
|
|
||||||
|
|
||||||
|
----
|
||||||
|
|
||||||
## [0.2.1] - 2023-09-24
|
## [0.2.1] - 2023-09-24
|
||||||
- fix Wire1 support ESP32
|
- fix Wire1 support ESP32
|
||||||
- update keywords.txt
|
- update keywords.txt
|
||||||
|
|
||||||
|
|
||||||
## [0.2.0] - 2023-08-21
|
## [0.2.0] - 2023-08-21
|
||||||
- changed interface for **uint16_t ping(address, uint16_t count = 1)**
|
- changed interface for **uint16_t ping(address, uint16_t count = 1)**
|
||||||
- allows multiple tries, for extended diagnosis.
|
- allows multiple tries, for extended diagnosis.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: I2C_SCANNER.cpp
|
// FILE: I2C_SCANNER.cpp
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.1
|
// VERSION: 0.3.0
|
||||||
// DATE: 2022-08-29
|
// DATE: 2022-08-29
|
||||||
// PURPOSE: Arduino class to implement an I2C scanner.
|
// PURPOSE: Arduino class to implement an I2C scanner.
|
||||||
|
|
||||||
@ -21,26 +21,10 @@ I2C_SCANNER::I2C_SCANNER(TwoWire *wire)
|
|||||||
bool I2C_SCANNER::begin()
|
bool I2C_SCANNER::begin()
|
||||||
{
|
{
|
||||||
_init();
|
_init();
|
||||||
_wire->begin();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if defined (ESP8266) || defined(ESP32)
|
|
||||||
bool I2C_SCANNER::begin(int dataPin, int clockPin)
|
|
||||||
{
|
|
||||||
_init();
|
|
||||||
if ((dataPin < 255) && (clockPin < 255))
|
|
||||||
{
|
|
||||||
_wire->begin(dataPin, clockPin);
|
|
||||||
} else {
|
|
||||||
_wire->begin();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// I2C PORT
|
// I2C PORT
|
||||||
//
|
//
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
//
|
//
|
||||||
// FILE: I2C_SCANNER.h
|
// FILE: I2C_SCANNER.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// VERSION: 0.2.1
|
// VERSION: 0.3.0
|
||||||
// DATE: 2022-08-29
|
// DATE: 2022-08-29
|
||||||
// PURPOSE: Arduino class to implement an I2C scanner.
|
// PURPOSE: Arduino class to implement an I2C scanner.
|
||||||
|
|
||||||
@ -10,7 +10,7 @@
|
|||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include "Wire.h"
|
#include "Wire.h"
|
||||||
|
|
||||||
#define I2C_SCANNER_LIB_VERSION (F("0.2.1"))
|
#define I2C_SCANNER_LIB_VERSION (F("0.3.0"))
|
||||||
|
|
||||||
|
|
||||||
class I2C_SCANNER
|
class I2C_SCANNER
|
||||||
@ -21,9 +21,6 @@ public:
|
|||||||
|
|
||||||
// CONFIGURATION
|
// CONFIGURATION
|
||||||
bool begin();
|
bool begin();
|
||||||
#if defined (ESP8266) || defined(ESP32)
|
|
||||||
bool begin(int sda, int scl);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// I2C PORT
|
// I2C PORT
|
||||||
uint8_t getWirePortCount();
|
uint8_t getWirePortCount();
|
||||||
|
@ -33,6 +33,15 @@ The user may use other values for address at his own risk.
|
|||||||
If there is missing functionality in this library, please file an issue.
|
If there is missing functionality in this library, please file an issue.
|
||||||
|
|
||||||
|
|
||||||
|
#### 0.3.0 Breaking change
|
||||||
|
|
||||||
|
Version 0.3.0 introduced a breaking change.
|
||||||
|
You cannot set the pins in **begin()** any more.
|
||||||
|
This reduces the dependency of processor dependent Wire implementations.
|
||||||
|
The user has to call **Wire.begin()** and can optionally set the Wire pins
|
||||||
|
before calling **begin()**.
|
||||||
|
|
||||||
|
|
||||||
#### Testing
|
#### Testing
|
||||||
|
|
||||||
The library is tested with the following boards:
|
The library is tested with the following boards:
|
||||||
@ -63,7 +72,6 @@ Please file an issue if your board does work (or not).
|
|||||||
|
|
||||||
- **I2C_SCANNER(TwoWire \*wire = &Wire)** Constructor with the default Wire I2C bus.
|
- **I2C_SCANNER(TwoWire \*wire = &Wire)** Constructor with the default Wire I2C bus.
|
||||||
- **bool begin()** To start the Wire library.
|
- **bool begin()** To start the Wire library.
|
||||||
- **bool begin(int sda, int scl)** idem for ESP32 et al.
|
|
||||||
|
|
||||||
|
|
||||||
#### Configuration
|
#### Configuration
|
||||||
|
@ -18,6 +18,7 @@ void setup()
|
|||||||
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
||||||
Serial.println(I2C_SCANNER_LIB_VERSION);
|
Serial.println(I2C_SCANNER_LIB_VERSION);
|
||||||
|
|
||||||
|
Wire.begin();
|
||||||
scanner.begin();
|
scanner.begin();
|
||||||
|
|
||||||
int ports = scanner.getWirePortCount();
|
int ports = scanner.getWirePortCount();
|
||||||
|
@ -18,6 +18,7 @@ void setup()
|
|||||||
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
||||||
Serial.println(I2C_SCANNER_LIB_VERSION);
|
Serial.println(I2C_SCANNER_LIB_VERSION);
|
||||||
|
|
||||||
|
Wire.begin();
|
||||||
scanner.begin();
|
scanner.begin();
|
||||||
|
|
||||||
Serial.print("I2C ports: \t");
|
Serial.print("I2C ports: \t");
|
||||||
|
@ -18,6 +18,7 @@ void setup()
|
|||||||
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
||||||
Serial.println(I2C_SCANNER_LIB_VERSION);
|
Serial.println(I2C_SCANNER_LIB_VERSION);
|
||||||
|
|
||||||
|
Wire.begin();
|
||||||
scanner.begin();
|
scanner.begin();
|
||||||
|
|
||||||
for (int addr = 0; addr < 128; addr++)
|
for (int addr = 0; addr < 128; addr++)
|
||||||
|
@ -18,6 +18,7 @@ void setup()
|
|||||||
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
||||||
Serial.println(I2C_SCANNER_LIB_VERSION);
|
Serial.println(I2C_SCANNER_LIB_VERSION);
|
||||||
|
|
||||||
|
Wire.begin();
|
||||||
scanner.begin();
|
scanner.begin();
|
||||||
|
|
||||||
for (int addr = 0; addr < 128; addr++)
|
for (int addr = 0; addr < 128; addr++)
|
||||||
|
@ -18,6 +18,7 @@ void setup()
|
|||||||
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
Serial.print("I2C_SCANNER_LIB_VERSION: ");
|
||||||
Serial.println(I2C_SCANNER_LIB_VERSION);
|
Serial.println(I2C_SCANNER_LIB_VERSION);
|
||||||
|
|
||||||
|
Wire.begin();
|
||||||
scanner.begin();
|
scanner.begin();
|
||||||
|
|
||||||
for (int addr = 0; addr < 128; addr++)
|
for (int addr = 0; addr < 128; addr++)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/I2C_SCANNER.git"
|
"url": "https://github.com/RobTillaart/I2C_SCANNER.git"
|
||||||
},
|
},
|
||||||
"version": "0.2.1",
|
"version": "0.3.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=I2C_SCANNER
|
name=I2C_SCANNER
|
||||||
version=0.2.1
|
version=0.3.0
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino class to implement an I2C scanner.
|
sentence=Arduino class to implement an I2C scanner.
|
||||||
|
Loading…
Reference in New Issue
Block a user