File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,8 @@ void PDMClass::setBufferSize(int bufferSize)
152
152
153
153
void PDMClass::IrqHandler (bool halftranfer)
154
154
{
155
+ static int cutSamples = 100 ;
156
+
155
157
// Clear the interrupt request.
156
158
dma_hw->ints0 = 1u << dmaChannel;
157
159
// Restart dma pointing to the other buffer
@@ -166,6 +168,11 @@ void PDMClass::IrqHandler(bool halftranfer)
166
168
// fill final buffer with PCM samples
167
169
Open_PDM_Filter_64 (rawBuffer[rawBufferIndex], finalBuffer, 1 , &filter);
168
170
171
+ if (cutSamples) {
172
+ memset (finalBuffer, 0 , cutSamples);
173
+ cutSamples = 0 ;
174
+ }
175
+
169
176
// swap final buffer and raw buffers' indexes
170
177
finalBuffer = (int16_t *)_doubleBuffer.data ();
171
178
_doubleBuffer.swap (filter.nSamples * sizeof (int16_t ));
You can’t perform that action at this time.
0 commit comments