Commit 8d11c196 authored by 时昊's avatar 时昊

增加PWM功能

parent c349acd4
...@@ -5,6 +5,8 @@ void COM_CAN_Init(void); ...@@ -5,6 +5,8 @@ void COM_CAN_Init(void);
void COM_RX_Process(void); void COM_RX_Process(void);
void Msg_Load_Init(void); void Msg_Load_Init(void);
void Execute_Specify_Step(unsigned int step); void Execute_Specify_Step(unsigned int step);
void Execute_Specify_Step_IO(unsigned int step);
void Execute_Specify_Step_PWM(unsigned int step);
unsigned int Get_Total_CheckStep(void); unsigned int Get_Total_CheckStep(void);
void COM_TX_Process(void); void COM_TX_Process(void);
......
...@@ -1731,11 +1731,6 @@ void Total_Check(void) ...@@ -1731,11 +1731,6 @@ void Total_Check(void)
HW_TFT_CHECK(0); HW_TFT_CHECK(0);
HW_LCD_CHECK(0); HW_LCD_CHECK(0);
HW_BACKLIGHT_CHECK(0); HW_BACKLIGHT_CHECK(0);
//PWM_OUT_12 = 1;
PWM_Channel_Set_Freq(10, 30000);//e
PWM_Channel_Set_Duty(10, 500);//e
PWM_Channel_Set_Freq(14, 10000);//v
PWM_Channel_Set_Duty(14, 800);//v
Function_Check_Ctrl(1); Function_Check_Ctrl(1);
HW_Static_Current_Check(0); HW_Static_Current_Check(0);
CAN_Msg_Tx_Enable = 1u; CAN_Msg_Tx_Enable = 1u;
...@@ -2040,6 +2035,11 @@ void Function_Check_Ctrl(uint32_t cmd) ...@@ -2040,6 +2035,11 @@ void Function_Check_Ctrl(uint32_t cmd)
if ( MENU_BACK != MENU_CHECK_STEP ) if ( MENU_BACK != MENU_CHECK_STEP )
{ {
Execute_Specify_Step((MENU_CHECK_STEP)); Execute_Specify_Step((MENU_CHECK_STEP));
//Execute_Specify_Step_IO(MENU_CHECK_STEP);
if(MENU_CHECK_STEP >= 1)
{
//Execute_Specify_Step_PWM(MENU_CHECK_STEP - 1);
}
MENU_BACK = MENU_CHECK_STEP; MENU_BACK = MENU_CHECK_STEP;
} }
} }
......
...@@ -253,4 +253,20 @@ void RTE_GPIO_Init(void) ...@@ -253,4 +253,20 @@ void RTE_GPIO_Init(void)
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_3; gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_3;
gpio_temp.enGPIOCharacter = GPIO_Char_Schmitt1; gpio_temp.enGPIOCharacter = GPIO_Char_Schmitt1;
GPIO_Config(&gpio_temp);//车速 GPIO_Config(&gpio_temp);//车速
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_10;
gpio_temp.enGPIOPIN = GPIO_PIN_11;
gpio_temp.enGPIOMode = GPIO_MODE_ALTER_SOFTWARE;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_4;
gpio_temp.enGPIOCharacter = GPIO_Char_Schmitt1;
GPIO_Config(&gpio_temp);//pin85
gpio_temp.enGPIOPort = GPIO_PORT_GROUP_10;
gpio_temp.enGPIOPIN = GPIO_PIN_12;
gpio_temp.enGPIOMode = GPIO_MODE_ALTER_SOFTWARE;
gpio_temp.enGPIODir = GPIO_DIR_OUT;
gpio_temp.enGPIOAltFun = GPIO_ALTER_FUN_4;
gpio_temp.enGPIOCharacter = GPIO_Char_Schmitt1;
GPIO_Config(&gpio_temp);//pin86
} }
...@@ -17,8 +17,8 @@ extern const st_Port_IO F1KM_16843_Port_IO_P [20] ; ...@@ -17,8 +17,8 @@ extern const st_Port_IO F1KM_16843_Port_IO_P [20] ;
typedef struct typedef struct
{ {
void (*PWM_Output)(unsigned char Duty, unsigned int Freq); void (*PWM_Output)(uint32_t Duty, uint32_t Freq);
} st_Port_PWM; } st_Port_PWM;
extern const st_Port_PWM F1KM_16843_Port_PWM_Out [16] ; extern const st_Port_PWM F1KM_16843_Port_PWM_Out [8] ;
#endif #endif
...@@ -80,8 +80,14 @@ void Sys_Startup_Init(void) ...@@ -80,8 +80,14 @@ void Sys_Startup_Init(void)
Display_Title_Info( ); Display_Title_Info( );
Key_Init( ); Key_Init( );
PWN_Init(); PWN_Init();
PWM_Channel_Init(10, 0, 0, 0, 0); PWM_Channel_Init(1, 0, 0, 0, 0);
PWM_Channel_Init(14, 0, 0, 0, 0); PWM_Channel_Init(3, 0, 0, 0, 0);
PWM_Channel_Init(5, 0, 0, 0, 0);
PWM_Channel_Init(7, 0, 0, 0, 0);
PWM_Channel_Init(9, 0, 0, 0, 0);
PWM_Channel_Init(11, 0, 0, 0, 0);
PWM_Channel_Init(13, 0, 0, 0, 0);
PWM_Channel_Init(15, 0, 0, 0, 0);
} }
/*********************************************************************** /***********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment