ladislas
(Ladislas de Toldi)
February 23, 2021, 3:13pm
1
Hello @jeromecoutant –
For our project, we need to use the HAL confg USE_HAL_JPEG_REGISTER_CALLBACKS
available here:
It is set to 0 and I don’t know how we can set it to one without modifying mbed-os’ files.
Do you have any idea? I can make a PR with a solution similar to this one:
Let me know
Best,
– Ladislas
Hi
To be honest I have never used CALLBACKS…
About your issue, I think your proposition is valid.
We should even make a script that updates all the USE_HAL_xxx_REGISTER_CALLBACKS…
ladislas
(Ladislas de Toldi)
February 23, 2021, 4:50pm
3
You never got the chance? Or you have a different solution?
It turns out that interfacing the HAL code with C++ is not easy… And I’m not talking about unit testing all that…
ladislas
(Ladislas de Toldi)
February 24, 2021, 9:37am
4
We ended up using a global object but that’s okay in our case. Funny enough we can now pass lambdas to the function which is quite nice
HAL_JPEG_RegisterInfoReadyCallback(corejpeg.getJpegHandle(), [](JPEG_HandleTypeDef *hjpeg, JPEG_ConfTypeDef *info) {
corejpeg.onInfoReadyCallback(hjpeg, info);
});
HAL_JPEG_RegisterGetDataCallback(corejpeg.getJpegHandle(), [](JPEG_HandleTypeDef *hjpeg, uint32_t size) {
corejpeg.onDataAvailableCallback(hjpeg, size);
});
HAL_JPEG_RegisterDataReadyCallback(corejpeg.getJpegHandle(),
[](JPEG_HandleTypeDef *hjpeg, uint8_t *pDataOut, uint32_t size) {
corejpeg.onDataReadyCallback(hjpeg, pDataOut, size);
});
HAL_JPEG_RegisterCallback(corejpeg.getJpegHandle(), HAL_JPEG_DECODE_CPLT_CB_ID,
[](JPEG_HandleTypeDef *hjpeg) { corejpeg.onDecodeCompleteCallback(hjpeg); });
HAL_JPEG_RegisterCallback(corejpeg.getJpegHandle(), HAL_JPEG_ERROR_CB_ID,
[](JPEG_HandleTypeDef *hjpeg) { corejpeg.onErrorCallback(hjpeg); });
Woah, that works? I didn’t realize you could do that. It must be only for non-capturing lambdas though right?
ladislas
(Ladislas de Toldi)
February 25, 2021, 8:46am
6
Sadly yes, but that’s better than nothing!
ladislas
(Ladislas de Toldi)
February 25, 2021, 2:57pm
7