From b0f0d2e9ca18d8604225bed3c984e4cf1b4c4b3c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Wed, 10 Feb 2016 20:31:09 +0100 Subject: Initial import --- Common.h | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 Common.h (limited to 'Common.h') diff --git a/Common.h b/Common.h new file mode 100644 index 0000000..78ed5c4 --- /dev/null +++ b/Common.h @@ -0,0 +1,70 @@ +////////////////////////////////////////////////////////////////////////////// +// +// 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 + -- cgit v1.2.3