Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libraries/Wire/src/Wire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ void TwoWire::onRequest( void (*function)(void) )
user_onRequest = function;
}

bool TwoWire::isBusy(void)
{
return twi_isSollicited();
}

// Preinstantiate Objects //////////////////////////////////////////////////////

TwoWire Wire = TwoWire();

1 change: 1 addition & 0 deletions libraries/Wire/src/Wire.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class TwoWire : public Stream
virtual void flush(void);
void onReceive( void (*)(int) );
void onRequest( void (*)(void) );
bool isBusy(void);

inline size_t write(unsigned long n) { return write((uint8_t)n); }
inline size_t write(long n) { return write((uint8_t)n); }
Expand Down
4 changes: 4 additions & 0 deletions libraries/Wire/src/utility/twi.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,10 @@ bool twi_manageTimeoutFlag(bool clear_flag){
return(flag);
}

bool twi_isSollicited(void){
return twi_state == TWI_SRX || twi_state == TWI_STX;
}

ISR(TWI_vect)
{
switch(TW_STATUS){
Expand Down
1 change: 1 addition & 0 deletions libraries/Wire/src/utility/twi.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
void twi_setTimeoutInMicros(uint32_t, bool);
void twi_handleTimeout(bool);
bool twi_manageTimeoutFlag(bool);
bool twi_isSollicited(void);

#endif