Question/Issue:
Which one of PDMDoubleBuffer does pdm_data_ready_inference_callback really accesses?
Project ID:
Projects reference to Arduino PDM library.
Context/Use case:
I am using PlatformIO (on VSCode) to develope a audio recognition project on NANO 33 BLE.
I just have a look into the PDM library source code(under framework-arduino-mbed@3.5.4) and found that somewhere of the begin
and IrqHandler
function is beyond my understanding.
In begin
, nrf_pdm_enable
is called but SAMPLE.PTR/SAMPLE.MAXCOUNT are not well set, will this leads to an error that data incoming from PDM interface be fed to an unexpected place?
In IrqHandler
, while STARTED_EVENT is received, SAMPLE.PTR is set to the other buffer and index is swapped, but why the comment is “// make the current one available for reading”?
And, _onReceive
(=pdm_data_ready_inference_callback
) is called after swapping, in such situation, is PDM.read
actually copying data from one of the double-buffer which the PCM data is updating by PDM interface to sampleBuffer but not from the other one of the double-buffer which just filled?