File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
examples/I2SDMA_RXCallBack Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 2020
2121#define BUFF_SIZE 128
2222#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
2424
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+ **/
2530uint8_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
2934void setup ()
3035{
3136 Serial.begin (115200 );
@@ -61,7 +66,8 @@ void loop()
6166 }
6267 if (shift_count > OFFSET)
6368 return ;
64-
69+
70+ // record the higher 16 bits of received data
6571 if (start_flag)
6672 {
6773 if ((dataBuff[shift_count]>>16 ) != loop_count+1 )
@@ -73,7 +79,7 @@ void loop()
7379 }
7480 loop_count = (dataBuff[shift_count] >> 16 );
7581
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)
7783 done_flag = 1 ;
7884 for (uint32_t i = 0 ;i < BUFF_SIZE;++i)
7985 {
Original file line number Diff line number Diff line change 2020
2121// CurieI2SDMA.h
2222
23- #ifndef _CURI2SDMA_H_
24- #define _CURI2SDMA_H_
23+ #ifndef _CURIEI2SDMA_H_
24+ #define _CURIEI2SDMA_H_
2525
2626#include < Arduino.h>
2727
You can’t perform that action at this time.
0 commit comments