File tree 3 files changed +16
-1
lines changed
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -49,5 +49,6 @@ void rxDataReceived()
49
49
while (CurieI2S.available ())
50
50
{
51
51
dataBuff[count++] = CurieI2S.requestdword ();
52
+ count %= 256 ; // prevent buffer overflow and just write data in front of the buffer.
52
53
}
53
54
}
Original file line number Diff line number Diff line change @@ -222,7 +222,8 @@ static void i2sInterruptHandler(void)
222
222
// TXFIFO and tx buffer empty
223
223
224
224
// last frame delay
225
- delayTicks (960 );
225
+ // delayTicks(960);
226
+ CurieI2S.lastFrameDelay ();
226
227
// stop transmission
227
228
*I2S_CTRL = *I2S_CTRL & 0xFDFFFFFE ;
228
229
@@ -357,6 +358,9 @@ void Curie_I2S::setSampleRate(uint32_t dividerValue)
357
358
i2s_srr &= I2S_SAMPLERATE_MASK;
358
359
i2s_srr |= dividerValue;
359
360
*I2S_SRR = i2s_srr;
361
+
362
+ // set frameDelay value.
363
+ frameDelay = (dividerValue&0x000000FF )*32 *2 ;
360
364
}
361
365
362
366
void Curie_I2S::setResolution (uint32_t resolution)
@@ -632,6 +636,11 @@ uint8_t Curie_I2S::getRxFIFOLength()
632
636
return fifolength;
633
637
}
634
638
639
+ void Curie_I2S::lastFrameDelay ()
640
+ {
641
+ delayTicks (frameDelay);
642
+ }
643
+
635
644
void Curie_I2S::attachRxInterrupt (void (*userCallBack)())
636
645
{
637
646
i2s_rxCB = userCallBack;
Original file line number Diff line number Diff line change @@ -96,6 +96,9 @@ class Curie_I2S
96
96
{
97
97
private:
98
98
uint32_t clock;
99
+
100
+ int frameDelay = 0 ;
101
+
99
102
bool useDMA;
100
103
101
104
// initializes i2s interface
@@ -202,6 +205,8 @@ class Curie_I2S
202
205
203
206
uint8_t getRxFIFOLength ();
204
207
208
+ void lastFrameDelay ();
209
+
205
210
// Attach user callback that is triggered when there is data pushed into the rx buffer from the RX_FIFO
206
211
void attachRxInterrupt (void (*userCallBack)());
207
212
You can’t perform that action at this time.
0 commit comments