| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- #ifndef _COMMON_H_
- #define _COMMON_H_
- #include <stdio.h>
- #include <stdint.h>
- #include <string.h>
- #include <stdlib.h>
- #include <math.h>
- #include <ctype.h>
- #include "gd32f10x.h"
- #include "gd32f10x_libopt.h"
- #include "delay.h"
- #include "shark_types.h"
- #define CONFIG_SOAK_ENABLE 0
- #define DEBUG_MODE (0)
-
- #define CONFIG_CAN_IAP
- #define USART_BAUND (38400)
- #define NVIC_OFFSET (0x00)
- #define THER_NUM_CON 2u
- #define SN_FLASH_ADDRESS (2048)
- #define SYLC_FLASH_ADDRESS (SN_FLASH_ADDRESS + 1024)
- #define HARD_TEST_FLASH_ADDRESS (SYLC_FLASH_ADDRESS + 1024)
- #define TEST_INFO_FLASH_ADDRESS (HARD_TEST_FLASH_ADDRESS + 1024)
- #define PS100_SERIAL_NUM_SIZE 18
- #define PS100_SOFTWARE_SIZE 20
- #define println(fmt, args ...) \
- do { \
- if (shark_printf_enabled) { \
- printf(fmt "\n", ##args); \
- } \
- } while (0)
- extern const uint8_t soft_version[];
- extern uint8_t sn[PS100_SERIAL_NUM_SIZE];
- extern shark_bool shark_battery_switch_busy;
- extern shark_bool shark_printf_enabled;
- typedef struct
- {
- uint8_t set;
- uint16_t count;
- }DELAY_COMMON;
- typedef struct
- {
- uint8_t enable;
- uint8_t set;
- uint16_t count;
- }CTR_DELAY_COMMON;
- enum
- {
- WS_BATTER_BING_LIAN,
- WS_BATTER_CHUAN_LIAN,
-
- WS_BATTER_MAX
- };
- #define NO_EVENT 0x00000000UL
- #define EVENT_CAN_RECEIVE_FINISH 0x00000002UL
- #define MEASURE_TEMPERATURE_EVENT 0x00000020UL
- #define BMS_1_RESEND_CMD_EVENT 0x00000100UL
- #define BMS_2_RESEND_CMD_EVENT 0x00000200UL
- #define END_CTR_RESEND_CMD_EVENT 0x00000400UL
- #define ADAS_RESEND_CMD_EVENT 0x00000800UL
- #define BMS_1_SELF_TIMEOUT_EVENT 0x00001000UL
- #define BMS_2_SELF_TIMEOUT_EVENT 0x00002000UL
- #define END_CTR_SELF_TIMEOUT_EVENT 0x00004000UL
- #define ADAS_SELF_TIMEOUT_EVENT 0x00008000UL
- #define ADAS_PWM_1_TIMEOUT_EVENT 0x00010000UL
- #define ADAS_PWM_2_TIMEOUT_EVENT 0x00020000UL
- #define ADAS_MEAS_1_FINISH_EVENT 0x00040000UL
- #define ADAS_MEAS_2_FINISH_EVENT 0x00080000UL
- #define RE_INITIAL_CAN_EVENT 0x00100000UL
- #define ENTER_SLEEP_EVENT 0x00200000UL
- #define DEVICE_REBOOT_EVENT 0x00400000UL
- #define SAVE_PARAM_EVENT 0x00800000UL
- extern uint32_t g_event;
- #define ST_NORMAL (0x0000u)
- #define ST_OVRCHRG_VOL (0x0001u)
- #define ST_OVRDISCHRG_VOL (0x0002u)
- #define ST_SMALL_CURRENT_OVER (0x0004u)
- #define ST_SHORT_CUR (0x0008u)
- #define ST_CHRG_CUR (0x0010u)
- #define ST_DISCHRG_CUR (0x0020u)
- #define ST_OVRCHRG_CUR (0x0040u)
- #define ST_OVRDISCHRG_CUR (0x0080u)
- #define ST_TOTAL_CHRG (0x0100u)
- #define ST_CELLDIFF_CHRG (0x0200u)
- #define ST_PSAVE (0x0400u)
- #define ST_PDOWN (0x0800u)
- #define ST_UDR_TEMPE_CHRG (0x1000u)//Detect the charge inhibit temperature (high)
- #define ST_UDR_TEMPE_DISCHRG (0x2000u)
- #define ST_OVR_TEMPE_CHRG (0x4000u)
- #define ST_OVR_TEMPE_DISCHRG (0x8000u)
- uint8_t Get_RS485_CRC(uint8_t *data,uint16_t size);
- void Writer_SN(uint8_t *data);
- #endif
|