Skip to content

Commit e3d90c1

Browse files
Christa03sys_maker
authored and
sys_maker
committed
CurieI2SDMA: Fix typo and add explanatory notes
CurieI2SDMA.h: Fix typo at line 23 and 24; I2SDMA_RXCallBack.ino: add explanatory notes to explain how to check the verification of data
1 parent fbb7b02 commit e3d90c1

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

libraries/CurieI2S/examples/I2SDMA_RXCallBack/I2SDMA_RXCallBack.ino

+12-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,17 @@
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+
**/
2530
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
2934
void 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
{

libraries/CurieI2S/src/CurieI2SDMA.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
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

0 commit comments

Comments
 (0)