mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-29 05:21:37 +03:00
restore proper arduino Client:: & Wire:: API (#5969)
This commit is contained in:
@ -265,6 +265,13 @@ void TwoWire::onRequestService(void)
|
||||
user_onRequest();
|
||||
}
|
||||
|
||||
void TwoWire::onReceive( void (*function)(int) ) {
|
||||
// arduino api compatibility fixer:
|
||||
// really hope size parameter will not exceed 2^31 :)
|
||||
static_assert(sizeof(int) == sizeof(size_t), "something is wrong in Arduino kingdom");
|
||||
user_onReceive = reinterpret_cast<void(*)(size_t)>(function);
|
||||
}
|
||||
|
||||
void TwoWire::onReceive( void (*function)(size_t) ) {
|
||||
user_onReceive = function;
|
||||
}
|
||||
|
@ -76,7 +76,8 @@ class TwoWire : public Stream
|
||||
virtual int read(void);
|
||||
virtual int peek(void);
|
||||
virtual void flush(void);
|
||||
void onReceive( void (*)(size_t) );
|
||||
void onReceive( void (*)(int) ); // arduino api
|
||||
void onReceive( void (*)(size_t) ); // legacy esp8266 backward compatibility
|
||||
void onRequest( void (*)(void) );
|
||||
|
||||
inline size_t write(unsigned long n) { return write((uint8_t)n); }
|
||||
|
Reference in New Issue
Block a user