Skip to content

Commit 50859ad

Browse files
Merge pull request #2 from TimerOverflow/20161108
20161108
2 parents 6bfa155 + 4defc31 commit 50859ad

File tree

2 files changed

+17
-32
lines changed

2 files changed

+17
-32
lines changed

crc16.c

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
/*********************************************************************************/
22
/*
3-
* Author : Jung Hyun Gu
3+
* Author : Jeong Hyun Gu
44
* File name : crc16.c
55
*/
66
/*********************************************************************************/
7-
#include "include/crc16.h"
7+
#include "crc16.h"
8+
/*********************************************************************************/
9+
#if(AVR_CRC16_REVISION_DATE != 20161108)
10+
#error wrong include file. (crc16.h)
11+
#endif
812
/*********************************************************************************/
913
/** Global variable **/
1014

1115

1216
/* CRC16 Table High byte */
13-
const unsigned char __flash CRC16Hi[] =
17+
const unsigned char __flash CRC16Hi[] =
1418
{
1519
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
1620
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
@@ -96,23 +100,13 @@ int Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, int Length)
96100
Index = CRCHi ^ *BufCurPos++;
97101
CRCHi = CRCLo ^ CRC16Hi[Index];
98102
CRCLo = CRC16Lo[Index];
99-
103+
100104
if(BufCurPos > BufEnd)
101105
{
102106
BufCurPos = BufOffSet;
103107
}
104-
}
105-
108+
}
109+
106110
return ((unsigned int) CRCHi << 8 | CRCLo);
107-
}
111+
}
108112
/*********************************************************************************/
109-
110-
111-
112-
113-
114-
115-
116-
117-
118-

crc16.h

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
/*********************************************************************************/
22
/*
3-
* Author : Jung Hyun Gu
3+
* Author : Jeong Hyun Gu
44
* File name : crc16.h
55
*/
66
/*********************************************************************************/
77
#ifndef __CRC16_H__
88
#define __CRC16_H__
99
/*********************************************************************************/
10+
#define AVR_CRC16_REVISION_DATE 20161108
11+
/*********************************************************************************/
1012
/** REVISION HISTORY **/
1113
/*
14+
2016. 11. 08. - revision valid check 추가.
15+
Jung Hyun Gu
16+
1217
2016. 10. 28. - 초기버전.
1318
Jung Hyun Gu
14-
15-
16-
1719
*/
1820
/*********************************************************************************/
1921
/**Define**/
@@ -36,14 +38,3 @@ int Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, int Length);
3638

3739
/*********************************************************************************/
3840
#endif //__CRC16_H__
39-
40-
41-
42-
43-
44-
45-
46-
47-
48-
49-

0 commit comments

Comments
 (0)