140 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			140 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #ifndef DEFINE_H_
 | |
| #define DEFINE_H_
 | |
| #include <stdio.h>
 | |
| #include <string.h>
 | |
| #include <rthw.h>
 | |
| #include <rtthread.h>
 | |
| #include "stm32f10x.h"
 | |
| #include "misc.h"
 | |
| #include "stm32f10x_adc.h"
 | |
| #include "stm32f10x_dma.h"
 | |
| #include "stm32f10x_gpio.h"
 | |
| #include "stm32f10x_usart.h"
 | |
| #include "stm32f10x_rcc.h"
 | |
| #include "stm32f10x_tim.h"
 | |
| #include "stm32f10x_dac.h"
 | |
| #include "stm32f10x_i2c.h"
 | |
| #define UNUSED(X) (void)X   
 | |
| 
 | |
| #define SoftVersion 0x000D
 | |
| 
 | |
| 
 | |
| #if __IF_PORT_UART
 | |
| //是否使用通信缓存
 | |
| #define APP_COMM_USE_FIFO   0
 | |
| //命令通信接口
 | |
| #define APP_COMD_CAN       0
 | |
| #define APP_COMD_USART     1
 | |
| 
 | |
| #else
 | |
| 
 | |
| //是否使用通信缓存
 | |
| #define APP_COMM_USE_FIFO   1
 | |
| //命令通信接口
 | |
| #define APP_COMD_CAN       1
 | |
| #define APP_COMD_USART     1
 | |
| 
 | |
| #endif
 | |
| 
 | |
| 
 | |
| typedef enum{
 | |
|         FUN_E     = ((uint8_t)0),//使能
 | |
|         FUN_D     = ((uint8_t)1) //失能
 | |
| }FUNState_e;
 | |
| 
 | |
| typedef union{
 | |
| uint32_t ul_data;
 | |
| uint16_t us_data;
 | |
| uint8_t  uc_data;
 | |
| uint16_t us_buf[2];
 | |
| uint8_t  uc_buf[4];
 | |
| }Seq_Buf_En;
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| // 模块程序地址
 | |
| // 这个地址要和 dev_flash.c 中定义的地址相对应
 | |
| #define MC_CODE_ADDR \
 | |
|   (FLASH_BASE+2048*109+128)
 | |
| 
 | |
| // 方案地址
 | |
| // 这个地址要和 dev_flash.c 中定义的地址相对应
 | |
| #define APP_TEST_PLAN_ADDR \
 | |
|   (FLASH_BASE+2048*118+128)
 | |
| 
 | |
| // 方案大小
 | |
| #define APP_TEST_PLANINFO_SIZE  2048
 | |
| 
 | |
| 
 | |
| 
 | |
| //系统事件定义
 | |
| #define U1_RX_FRAME_EVENT     0x01 
 | |
| #define UART_MC_FRAME_EVENT   0x02
 | |
| #define CAN_MC_FRAME_EVENT  	0x04
 | |
| #define TRANS_FRAME_EVENT 		0x08
 | |
| 
 | |
| #define UART_TX_END_EVENT     1
 | |
| 
 | |
| #define EP1_CMD_FRAME_EVENT   1
 | |
| #define EPJ_CMD_FRAME_EVENT   1
 | |
| #define EP2_CMD_FRAME_EVENT   1
 | |
| 
 | |
| #define USART_APP_EXCE_EVENT  1
 | |
| #define EP_HEARTBEAD_EVENT    5
 | |
| 
 | |
| 
 | |
| /******************总线电压倍率*****/
 | |
| #define VH_Mutli             21
 | |
| #define VM_Mutli						 21
 | |
| #define BOAED_SEQ_NUM_SIZE  20
 | |
| extern struct rt_event usart1_rx_event;
 | |
| #pragma pack(1)
 | |
| typedef struct {
 | |
| uint32_t bootflag; //更新标志
 | |
| uint16_t resistor_diff;//
 | |
| uint16_t hard_v;
 | |
| uint32_t mc_ICodeCrc32;
 | |
| uint8_t  sqNum[BOAED_SEQ_NUM_SIZE];
 | |
| }BoardInfo_st;
 | |
| 
 | |
| typedef union{
 | |
| BoardInfo_st boardinfo;
 | |
| uint32_t ul_buf[32];
 | |
| }BoardInfo_un;
 | |
| 
 | |
| typedef struct {
 | |
| 
 | |
| 	uint8_t app_run_flag;
 | |
| 	uint8_t device_id;
 | |
| 	uint16_t chip_temp;
 | |
| 	uint16_t v2p5_adc;
 | |
| 	uint16_t v1p25_adc;
 | |
| 	uint16_t adc_shake;
 | |
| 	uint16_t bus_5p5v;
 | |
| 	uint16_t bus_26v;
 | |
| 	uint16_t hard_v;
 | |
| 	uint16_t soft_v;
 | |
| 	uint16_t resistor_diff;
 | |
| 	uint32_t plan_id;
 | |
| 	
 | |
| }BoartCheck_st;
 | |
| 
 | |
| #pragma pack()
 | |
| 
 | |
| extern BoartCheck_st board_st;
 | |
| extern BoardInfo_un  boardinfo_un;
 | |
| 
 | |
| //检测小板初始化
 | |
| void Ye_BoardInit(void);
 | |
| /*
 | |
|  测试小板上电自检
 | |
| */
 | |
| void Ye_BoardCheck(void);
 | |
| //
 | |
| uint8_t UidCode_YM2JQ(uint8_t* pstJQUID, uint8_t* pstYMUID);
 | |
|  uint32_t GetPasswordByUidCode(uint8_t* uidcode);
 | |
| #endif
 | 
