Skip to content

Commit 3d83a64

Browse files
Merge pull request #4 from TimerOverflow/20190905
20190905
2 parents be3a946 + fb8a4db commit 3d83a64

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed

SysTypedef.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*********************************************************************************/
2+
/*
3+
* Author : Jeong Hyun Gu
4+
* File name : SysTypedef.h
5+
*/
6+
/*********************************************************************************/
7+
#ifndef __SYS_TYPEDEF_H__
8+
#define __SYS_TYPEDEF_H__
9+
/*********************************************************************************/
10+
/**Define**/
11+
12+
typedef unsigned char tU8;
13+
typedef signed char tS8;
14+
15+
typedef unsigned int tU16;
16+
typedef signed int tS16;
17+
18+
typedef unsigned long tU32;
19+
typedef signed long tS32;
20+
21+
/*********************************************************************************/
22+
/**Enum**/
23+
24+
/*********************************************************************************/
25+
/**Struct**/
26+
27+
/*********************************************************************************/
28+
/**Function**/
29+
30+
/*********************************************************************************/
31+
#endif //__SYS_TYPEDEF_H__

crc16.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/*********************************************************************************/
77
#include "crc16.h"
88
/*********************************************************************************/
9-
#if(AVR_CRC16_REVISION_DATE != 20180502)
9+
#if(AVR_CRC16_REVISION_DATE != 20190905)
1010
#error wrong include file. (crc16.h)
1111
#endif
1212
/*********************************************************************************/
@@ -87,11 +87,11 @@ const unsigned char CRC16Lo[] =
8787
0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40
8888
};
8989
/*********************************************************************************/
90-
int Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, int Length)
90+
tU16 Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, tU16 Length)
9191
{
9292
unsigned char CRCHi ;
9393
unsigned char CRCLo ;
94-
unsigned int Index ;
94+
tU16 Index ;
9595

9696
CRCHi = 0xFF ;
9797
CRCLo = 0xFF ;
@@ -107,6 +107,6 @@ int Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, int Length)
107107
}
108108
}
109109

110-
return ((unsigned int) CRCHi << 8 | CRCLo);
110+
return ((tU16) CRCHi << 8 | CRCLo);
111111
}
112112
/*********************************************************************************/

crc16.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@
77
#ifndef __CRC16_H__
88
#define __CRC16_H__
99
/*********************************************************************************/
10-
#define AVR_CRC16_REVISION_DATE 20180502
10+
#include "SysTypedef.h"
11+
/*********************************************************************************/
12+
#define AVR_CRC16_REVISION_DATE 20190905
1113
/*********************************************************************************/
1214
/** REVISION HISTORY **/
1315
/*
16+
2019. 09. 05. - SysTypedef 적용.
17+
Jeong Hyun Gu
18+
1419
2018. 05. 02. - CRC16 테이블 변수 타입 변경.
1520
Jeong Hyun Gu
1621
@@ -37,7 +42,7 @@
3742
/*********************************************************************************/
3843
/**Function**/
3944

40-
int Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, int Length);
45+
tU16 Crc16Check(char *BufCurPos, char *BufOffSet, char *BufEnd, tU16 Length);
4146

4247
/*********************************************************************************/
4348
#endif //__CRC16_H__

0 commit comments

Comments
 (0)