| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #ifndef __BSP_H__
- #define __BSP_H__
- #if defined (GD32F30X_HD) || defined (GD32F30X_XD) || defined (GD32F30X_CL)
- #include "gd32f30x.h"
- #elif defined GD32E10x
- #include "gd32e10x.h"
- #endif
- #include "bsp/gpio.h"
- #include "bsp/gd32_bkp.h"
- #include "bsp/gd32_rtc.h"
- #include "bsp/can.h"
- #include "bsp/i2c.h"
- #include "bsp/fmc_flash.h"
- #include "bsp/can.h"
- #define SYSTEM_CLOCK (120000000u) //system clk 120M Hz
- #define TIM_CLOCK (SYSTEM_CLOCK) /*SystemClock_Config��TIM1��clk��sys PLL �������̶�2����PLLƵ��*/
- #define TIM_CLOCK_MHz (120u)
- #define ADC_CLOCK (30000000u)
- #define ADC_CLOCK_MHz (30u)
- #define NS_PER_TCLK (8u) /* (1/120000000 * 1000000000) */
- #define NS_2_TCLK(ns) (((ns)/NS_PER_TCLK) + 1u) //ns תΪpwmʹ�õ��Ǹ�TIM��clk count
- #define FOC_PWM_FS (16000u)
- #define FOC_PWM_period (TIM_CLOCK/FOC_PWM_FS)
- #define FOC_PWM_Half_Period (FOC_PWM_period/2)
- #define FOC_CTRL_US (1.0f/(float)FOC_PWM_FS)
- #define ADC_REGCHAN_SAMPLE_TIME ADC_SAMPLETIME_239POINT5
- #define ADC_TRIG_CONV_LATENCY_CYCLES 12.5f
- #define ADC_SAMPLING_CYCLES 13.5f
- #define TIMER_UP_IRQ_PRIORITY 0
- #define ADC_IRQ_PRIORITY 1
- #define HALL_IRQ_PRIORITY 2
- #define SCHED_TIMER_IRQ_PRIORITY 3
- #define EBREAK_IRQ_PRIORITY 2
- #define CAN_IRQ_PRIORITY 6
- #define RTC_IRQ_PRIORITY 7
- #define UART_IRQ_PRIORITY 6
- #define ENC_TIMER_IRQ_PRIORITY 2
- #define ENC_PWM_IRQ_PRIORITY 2
- #define ENC_I_EXIT_IRQ_PRIORITY 2
- #define ENC_OTHER_IRQ_PRIORITY 8
- #define THREE_SHUNTS_SAMPLE 1
- #define ONE_SHUNT_SAMPLE 2
- #define GPIO_HIGH_BRK_MODE 1
- #define GPIO_LOW_BRK_MODE 2
- #define ENCODER_MPS 1
- #define ENCODER_MT 2
- #define MOTOR_BLUESHARK_NEW1 1//蓝鲨大功率电机,双I形
- #define MOTOR_BLUESHARK_NEW2 2//蓝鲨大功率电机,V形
- #define MOTOR_BLUESHARK_OLD 3//目前量产的电机
- #define MOTOR_BLUESHARK_ZD_100 4//中动100码编码器电机样品
- #define MOTOR_BLUESHARK_A1 5
- #ifdef GD32_FOC_DEMO
- #include "bsp/board_gd32demo.h"
- #elif defined (YUANQU_HW_V1)
- #include "bsp/board_yuanqu.h"
- #elif defined (MC100_HW_V1)
- #include "bsp/board_mc100_v1.h"
- #define CONFIG_BOARD_MCXXX
- #define CONFIG_BOARD_NAME "MC100"
- #define CONFIG_HW_VERSION 2
- #elif defined (MC105_HW_V3)
- #include "bsp/board_mc105_v3.h"
- #define CONFIG_BOARD_MCXXX
- #define CONFIG_BOARD_NAME "MC105"
- #define CONFIG_HW_VERSION 3
- #endif
- void bsp_init(void);
- void wdog_reload(void);
- void system_reboot(void);
- int wdog_set_timeout(int wdog_time);
- void systick_open(void);
- u8 mcu_chip_id(u8 *buff);
- #endif /* __BSP_H__ */
|