30 m_addressBegin = firstAddress;
31 m_addressEnd = lastAddress + 1;
32 m_addressIterator = firstAddress;
34 m_hardware.
error.connect(m_onI2cNotAcknowledgeSlot);
40void I2cScanner::testAddress()
42 if (m_addressIterator >= m_addressEnd)
44 m_hardware.
error.disconnect(m_onI2cNotAcknowledgeSlot);
51 m_hardware.
checkAddress(
static_cast<uint8_t
>(m_addressIterator));
55void I2cScanner::onI2cAcknowledge()
57 SEMF_INFO(
"I2c device found on: 0x%02x\n", m_addressIterator);
62void I2cScanner::onI2cNotAcknowledge(Error thrown)
Class for representing errors. Every error should have a unique source code. As a user feel encourage...
For using the I2C in master mode.
virtual void checkAddress(uint8_t address)=0
Checks if the given address is available on the bus. Emits address found if successful (ACK)....
bool isBusyWriting() const override
Communication hardware is busy writing at the moment.
semf::Signal addressFound
I2cScanner(I2cMasterHardware &hardware)
Constructor.
Signal< uint16_t > deviceFound
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,...
void connect(SlotBase< Arguments... > &slot)
Connect a method to the signal.
void disconnect(SlotBase< Arguments... > &slot)
Disonnect a method from the signal.