-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Strange behavior in TwoWire in Slave Mode #2937
Copy link
Copy link
Closed
Description
Describe the bug
it looks like not possible to directly use TwoWire in slave mode. in this case the rxbuffer is never fill.
There is a différence in having an empty user receive handler and not having a receive handler. In the first case rxbuffer is fill correctly in the second case it is not fill.
Having:
TwoWire myI2C(PB7, PB6);
setup:
myI2C.begin(0x18) ;
in this case myI2C.available() is never > 0.
to have myI2C.available() > 0 when a message is received you must have implemented:
myI2C.onReceive(onReceiveHandler);
onReceiveHandler may be an empty code {}
in this situation TwoWire works correctly.
To Reproduce
TwoWire myI2C(PB7, PB6);
setup:
myI2C.begin(0x18) ;
loop:
if (myI2C.available()>0)
{
...
}
to make the program works:
setup:
myI2C.begin(0x18) ;
myI2C.onReceive(onReceiveHandler);
void onReceiveHandler(int howMany) {
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels