semf
|
This class scans a given address range on an I2C master hardware to identify available devices. More...
#include <i2cscanner.h>
Public Types | |
enum class | ErrorCode : uint8_t { StartScan_IsBusy = 0 } |
Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring). More... | |
Public Member Functions | |
I2cScanner (I2cMasterHardware &hardware) | |
Constructor. More... | |
I2cScanner (const I2cScanner &other)=delete | |
virtual | ~I2cScanner ()=default |
void | startScan (uint16_t firstAddress=0, uint16_t lastAddress=0x7F) |
Starts scan process for the address range from firstAddress to lastAddress . For all found devices, the deviceFound signal including the address of the found device is emitted. After all addresses are tested, the finished signal is emitted. More... | |
Public Attributes | |
Signal< uint16_t > | deviceFound |
Signal | finished |
Signal< Error > | error |
This class scans a given address range on an I2C master hardware to identify available devices.
This is done by setting an empty write command to every address and evaluating the I2cMasterHardware
dataWritten
and error
signal.
startScan()
function call will start the scan process. For every available device, the deviceFound
signal is emitted. After the total address range is tested, the finished
signal is emitted.
I2cScannerPrinter
Definition at line 31 of file i2cscanner.h.
|
strong |
Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).
Enumerator | |
---|---|
StartScan_IsBusy |
Definition at line 37 of file i2cscanner.h.
|
explicit |
Constructor.
hardware | I2C communication hardware to scan on. |
Definition at line 15 of file i2cscanner.cpp.
|
explicitdelete |
|
virtualdefault |
void semf::I2cScanner::startScan | ( | uint16_t | firstAddress = 0 , |
uint16_t | lastAddress = 0x7F |
||
) |
Starts scan process for the address range from firstAddress
to lastAddress
. For all found devices, the deviceFound
signal including the address of the found device is emitted. After all addresses are tested, the finished
signal is emitted.
firstAddress | First I2C address of the address range to get tested. |
lastAddress | Last I2C address of the address range to get tested. |
StartScan_IsBusy | If this is allready scanning. |
Definition at line 20 of file i2cscanner.cpp.
Signal<uint16_t> semf::I2cScanner::deviceFound |
Signal is emitted after an device is found while scanning. The signal delivers the I2C address of the found device.
Definition at line 61 of file i2cscanner.h.
Signal is emitted if startScan()
function is called and I2C hardware is busy.
Definition at line 65 of file i2cscanner.h.
Signal semf::I2cScanner::finished |
Signal is emitted after all addresses in the given address range by startScan()
function are tested.
Definition at line 63 of file i2cscanner.h.