Add an aditional (void *) arg to the RMT callback (much like Ticker() et.al.). (#3345)

* Add an aditional (void *) arg to the RMT callback - to allow more flexible handling of the callback (e.g. by passing a private struct or a class pointer). Same pattern as used by the Ticker() and many others. Example updated & new example with a trapoline added.

* Fix example for new API

* Fix lint warnings

* Add a second missed example.

* Correct timeout & improve socket error handling.
This commit is contained in:
Dirk-Willem van Gulik
2020-10-14 13:41:50 +02:00
committed by GitHub
parent 831f0ac29a
commit d79a1f3d10
5 changed files with 111 additions and 19 deletions

View File

@ -172,7 +172,7 @@ void parseRmt(rmt_data_t* items, size_t len, uint32_t* channels){
}
}
extern "C" void receive_data(uint32_t *data, size_t len)
extern "C" void receive_data(uint32_t *data, size_t len, void * arg)
{
parseRmt((rmt_data_t*) data, len, channels);
}
@ -192,7 +192,7 @@ void setup()
Serial.printf("real tick set to: %fns\n", realTick);
// Ask to start reading
rmtRead(rmt_recv, receive_data);
rmtRead(rmt_recv, receive_data, NULL);
}
void loop()