#ifndef __BSP_N32_H__
#define __BSP_N32_H__
#if defined N32G45X
#include "n32g45x.h"
#endif

#define SYSTEM_CLOCK (144000000u) //system clk 120M Hz
#define TIM_CLOCK (SYSTEM_CLOCK) /*SystemClock_Config��TIM1��clk��sys PLL �������̶�2����PLLƵ��*/
#define TIM_CLOCK_MHz (144u)
#define TIM_SCHED_CLK (SYSTEM_CLOCK/2)
#define TIM_SCHED_CLK_MHz (TIM_CLOCK_MHz/2)

#define TIM_PWM_CLK (SYSTEM_CLOCK/2)
#define TIM_PWM_CLK_MHz (TIM_CLOCK_MHz/2)


#define ADC_CLOCK (30000000u)
#define ADC_CLOCK_MHz (30u)
#define NS_PER_TCLK (7u) /* (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_TRIG_CONV_LATENCY_CYCLES 12.5f
#define ADC_SAMPLING_CYCLES 13.5f

#include "bsp/n32/bsp_wrapper.h"

#if defined (MC105_HW_V3)
#include "bsp/n32/board_n32_mc105_v3.h"
#define CONFIG_BOARD_MCXXX
#define CONFIG_BOARD_NAME "MC105"
#define CONFIG_HW_VERSION 3
#endif


#endif /* __BSP_N32_H__ 
*/
