-
Notifications
You must be signed in to change notification settings - Fork 23
/
Common.h
70 lines (57 loc) · 1.89 KB
/
Common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//////////////////////////////////////////////////////////////////////////////
//
// Filename: Common.h
// Version:
// Data:
//
// Author: Liu, Zemin
// Company: JYE Tech
//
//-----------------------------------------------------------------------------
//
// Target: STM32F103C8
// Tool chain: CodeSourcery G++
//
//
//-----------------------------------------------------------------------------
// Required files:
//
//-----------------------------------------------------------------------------
// Notes:
//
//
//-----------------------------------------------------------------------------
// Revision History:
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef Common_h
#define Common_h
typedef unsigned char U8;
typedef signed char S8;
typedef unsigned short int U16;
typedef signed short int S16;
typedef unsigned long U32;
typedef signed long S32;
typedef void (*FuncPointer)(U8);
typedef void (*CmdFuncPointer)(void);
typedef void (*StateAction)(void);
// -- Control debug code generation
//#define _Debug_
// ============= Macro definitions ===========================
#define BitSet(word, bit_mask) ((word) |= (bit_mask))
#define BitClr(word, bit_mask) ((word) &= ~(bit_mask))
#define BitTest(word, bit_mask) ((word) & (bit_mask))
#define BitAnd(word, bit_mask) ((word) &= (bit_mask))
#define BitOr(word, bit_mask) ((word) |= (bit_mask))
#define BitXor(word, bit_mask) ((word) ^= (bit_mask))
#define Port_BitSet(port, bit_mask) (port->BSRR = bit_mask)
#define Port_BitClr(port, bit_mask) (port->BRR = bit_mask)
#define SetToLow(port, bit_mask) (port->BRR = bit_mask)
#define SetToHigh(port, bit_mask) (port->BSRR = bit_mask)
// ===========================================================
// Function Prototype Declarations
// ===========================================================
//
void Delay(U16 count);
#endif // Common_h