1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #ifndef __GLOBAL_H
- #define __GLOBAL_H
- #include <stm32f4xx.h>
- /* exact-width signed integer types */
- // typedef signed char int8_t;
- // typedef signed short int int16_t;
- // typedef signed int int32_t;
- /* exact-width unsigned integer types */
- // typedef unsigned char uint8_t;
- // typedef unsigned short int uint16_t;
- // typedef unsigned int uint32_t;
- typedef uint32_t u32;
- typedef uint16_t u16;
- typedef uint8_t u8;
- typedef void (*pFunction)(void);
- typedef struct
- {
- u8 buf[8];
- u32 can_id;
- } CanData_TypeDef;
- typedef struct
- {
- u8 result;
- } updata;
- updata *var_get_info(void);
- #ifndef VAR_DEFINE
- #define VAR_FUNC_DEF(TYPE, VAR) \
- TYPE var_get_##VAR(void); \
- void var_set_##VAR(value);
- #else
- #define VAR_FUNC_DEF(TYPE, VAR) \
- TYPE var_get_##VAR(void) \
- { \
- TYPE value; \
- value = var_get_info()->VAR; \
- return value; \
- } \
- void var_set_##VAR(value) \
- { \
- var_get_info()->VAR = value; \
- }
- #endif
- #define APP_ADDRESS 0x8010000
- #define DLC_8 8
- #ifndef TRUE
- #define TRUE 1
- #endif
- #ifndef FALSE
- #define FALSE 0
- #endif
- // Ñ¡ÔñCANͨѶ²¨ÌØÂÊ
- // #define __CAN_BAUD_500K
- #define __CAN_BAUD_250K
- // VAR_FUNC_DEF(u8, result)
- u8 var_get_result(void);
- void var_set_result(u8 value);
- #endif
|