File tree 2 files changed +14
-8
lines changed
examples/I2SDMA_RXCallBack
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 20
20
21
21
#define BUFF_SIZE 128
22
22
#define OFFSET 2
23
- uint32_t dataBuff[BUFF_SIZE+OFFSET]; // extra 2 buffer is for the padding zero
23
+ uint32_t dataBuff[BUFF_SIZE+OFFSET]; // extra 2 buffers are for the padding zero
24
24
25
+ /* *
26
+ * the received data: the higher 16 bits should be equal to loop_count and the lower 16 bits should be (0x01~0x80)
27
+ * loop_count should increase by 1 in evry loop()
28
+ * for example: if first time the received data is 0x00010001~0x00010080, then next time the data should be 0x00020001~0x00020080
29
+ **/
25
30
uint8_t start_flag = 0 ;
26
- uint8_t done_flag = 0 ;
27
- uint32_t loop_count = 0 ;
28
- uint32_t shift_count = 0 ;
31
+ uint8_t done_flag = 0 ; // when done_flag is 1, the received data are correct
32
+ uint32_t loop_count = 0 ; // record the higher 16 bits of received data
33
+ uint32_t shift_count = 0 ; // the position of first non-zero
29
34
void setup ()
30
35
{
31
36
Serial.begin (115200 );
@@ -61,7 +66,8 @@ void loop()
61
66
}
62
67
if (shift_count > OFFSET)
63
68
return ;
64
-
69
+
70
+ // record the higher 16 bits of received data
65
71
if (start_flag)
66
72
{
67
73
if ((dataBuff[shift_count]>>16 ) != loop_count+1 )
@@ -73,7 +79,7 @@ void loop()
73
79
}
74
80
loop_count = (dataBuff[shift_count] >> 16 );
75
81
76
- // check data
82
+ // check data serial: the higher 16 bits should be equal to loop_count and the lower 16 bits should be (0x01~0x80)
77
83
done_flag = 1 ;
78
84
for (uint32_t i = 0 ;i < BUFF_SIZE;++i)
79
85
{
Original file line number Diff line number Diff line change 20
20
21
21
// CurieI2SDMA.h
22
22
23
- #ifndef _CURI2SDMA_H_
24
- #define _CURI2SDMA_H_
23
+ #ifndef _CURIEI2SDMA_H_
24
+ #define _CURIEI2SDMA_H_
25
25
26
26
#include < Arduino.h>
27
27
You can’t perform that action at this time.
0 commit comments