|
XCORE SDK
XCORE Software Development Kit
|
Used to collect PDM sample data from a port. More...
#include <PdmRx.hpp>
Public Member Functions | |
| void | SetPort (port_t p_pdm_mics) |
| Set the port from which to collect PDM samples. | |
| void | ProcessNext () |
| Perform a port read and if a new block has completed, signal. | |
| void | ThreadEntry () |
| Entry point for PDM processing thread. More... | |
Static Public Attributes | |
| static constexpr unsigned | BlockSize = BLOCK_SIZE |
| Number of words of PDM data per block. | |
Protected Attributes | |
| port_t | p_pdm_mics |
| Port from which to collect PDM data. | |
| unsigned | phase = BLOCK_SIZE |
| Number of words left to capture for the current block. | |
| uint32_t | block_data [2][BLOCK_SIZE] |
| Buffers for PDM data blocks. | |
| uint32_t * | blocks [2] = {&block_data[0][0], &block_data[1][0]} |
| PDM block redirection pointers. More... | |
Used to collect PDM sample data from a port.
This class is used to collect blocks of PDM data from a port and send the data to a decimator for further processing.
PdmRxService is a base class using CRTP. Subclasses extend PdmRxService providing themselves as the template parameter SubType.
This base class provides the logic for aggregating PDM data taken from a port into blocks, and a subclass is required to provide methods SubType::ReadPort() and SubType::SendBlock().
SubType::ReadPort() is responsible for reading 1 word of data from p_pdm_mics.
SubType::SendBlock() is provided a block of PDM data as a pointer and is responsible for signaling that to the subsequent processing stage. (Called from PdmRx thread or ISR)
SubType::GetPdmBlock() (called from MicArray thread) is responsible for receiving a block of PDM data from SubType::SendBlock() as a pointer, deinterleaving the buffer contents, and returning a pointer to the PDM data in the format expected by the mic array unit's decimator component.
| BLOCK_SIZE | Number of words of PDM data per block. |
| SubType | Subclass of PdmRxService |
| void mic_array::PdmRxService< BLOCK_SIZE, SubType >::ThreadEntry |
Entry point for PDM processing thread.
This function loops forever, calling ProcessNext() with each iteration.
|
protected |
PDM block redirection pointers.
Each time a new block of data is ready, a double buffer pointer swap is performed and blocks[1] is passed to SubType::SendBlock() so that it can be signaled to the next processing stage.