拨弹频率修改
This commit is contained in:
parent
7a7e29cd7f
commit
539ded2a62
@ -68,8 +68,6 @@ void Error_Handler(void);
|
||||
#define LED_Green_GPIO_Port GPIOH
|
||||
#define LED_Blue_Pin GPIO_PIN_10
|
||||
#define LED_Blue_GPIO_Port GPIOH
|
||||
#define PUL_P_Pin GPIO_PIN_1
|
||||
#define PUL_P_GPIO_Port GPIOC
|
||||
#define PUL_N_Pin GPIO_PIN_2
|
||||
#define PUL_N_GPIO_Port GPIOC
|
||||
#define DIR_N_Pin GPIO_PIN_2
|
||||
|
||||
@ -32,12 +32,15 @@ extern "C" {
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern TIM_HandleTypeDef htim8;
|
||||
|
||||
extern TIM_HandleTypeDef htim10;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_TIM8_Init(void);
|
||||
void MX_TIM10_Init(void);
|
||||
|
||||
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
||||
|
||||
@ -59,9 +59,6 @@ void MX_GPIO_Init(void)
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOH, LED_Red_Pin|LED_Green_Pin|LED_Blue_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(PUL_P_GPIO_Port, PUL_P_Pin, GPIO_PIN_SET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(PUL_N_GPIO_Port, PUL_N_Pin, GPIO_PIN_RESET);
|
||||
|
||||
@ -94,12 +91,12 @@ void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(CMPS_INT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : PUL_P_Pin PUL_N_Pin */
|
||||
GPIO_InitStruct.Pin = PUL_P_Pin|PUL_N_Pin;
|
||||
/*Configure GPIO pin : PUL_N_Pin */
|
||||
GPIO_InitStruct.Pin = PUL_N_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(PUL_N_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : DIR_N_Pin DIR_P_Pin */
|
||||
GPIO_InitStruct.Pin = DIR_N_Pin|DIR_P_Pin;
|
||||
|
||||
@ -105,6 +105,7 @@ int main(void)
|
||||
MX_USART3_UART_Init();
|
||||
MX_TIM10_Init();
|
||||
MX_USART6_UART_Init();
|
||||
MX_TIM8_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
119
Core/Src/tim.c
119
Core/Src/tim.c
@ -24,8 +24,79 @@
|
||||
|
||||
/* USER CODE END 0 */
|
||||
|
||||
TIM_HandleTypeDef htim8;
|
||||
TIM_HandleTypeDef htim10;
|
||||
|
||||
/* TIM8 init function */
|
||||
void MX_TIM8_Init(void)
|
||||
{
|
||||
|
||||
/* USER CODE BEGIN TIM8_Init 0 */
|
||||
|
||||
/* USER CODE END TIM8_Init 0 */
|
||||
|
||||
TIM_ClockConfigTypeDef sClockSourceConfig = {0};
|
||||
TIM_MasterConfigTypeDef sMasterConfig = {0};
|
||||
TIM_OC_InitTypeDef sConfigOC = {0};
|
||||
TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0};
|
||||
|
||||
/* USER CODE BEGIN TIM8_Init 1 */
|
||||
|
||||
/* USER CODE END TIM8_Init 1 */
|
||||
htim8.Instance = TIM8;
|
||||
htim8.Init.Prescaler = 167;
|
||||
htim8.Init.CounterMode = TIM_COUNTERMODE_UP;
|
||||
htim8.Init.Period = 19999;
|
||||
htim8.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
|
||||
htim8.Init.RepetitionCounter = 0;
|
||||
htim8.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
|
||||
if (HAL_TIM_Base_Init(&htim8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sClockSourceConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL;
|
||||
if (HAL_TIM_ConfigClockSource(&htim8, &sClockSourceConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
if (HAL_TIM_PWM_Init(&htim8) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
|
||||
sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
|
||||
if (HAL_TIMEx_MasterConfigSynchronization(&htim8, &sMasterConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sConfigOC.OCMode = TIM_OCMODE_PWM1;
|
||||
sConfigOC.Pulse = 0;
|
||||
sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
|
||||
sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH;
|
||||
sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
|
||||
sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET;
|
||||
sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET;
|
||||
if (HAL_TIM_PWM_ConfigChannel(&htim8, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE;
|
||||
sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE;
|
||||
sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;
|
||||
sBreakDeadTimeConfig.DeadTime = 0;
|
||||
sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE;
|
||||
sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH;
|
||||
sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE;
|
||||
if (HAL_TIMEx_ConfigBreakDeadTime(&htim8, &sBreakDeadTimeConfig) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
/* USER CODE BEGIN TIM8_Init 2 */
|
||||
|
||||
/* USER CODE END TIM8_Init 2 */
|
||||
HAL_TIM_MspPostInit(&htim8);
|
||||
|
||||
}
|
||||
/* TIM10 init function */
|
||||
void MX_TIM10_Init(void)
|
||||
{
|
||||
@ -71,7 +142,18 @@ void MX_TIM10_Init(void)
|
||||
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM10)
|
||||
if(tim_baseHandle->Instance==TIM8)
|
||||
{
|
||||
/* USER CODE BEGIN TIM8_MspInit 0 */
|
||||
|
||||
/* USER CODE END TIM8_MspInit 0 */
|
||||
/* TIM8 clock enable */
|
||||
__HAL_RCC_TIM8_CLK_ENABLE();
|
||||
/* USER CODE BEGIN TIM8_MspInit 1 */
|
||||
|
||||
/* USER CODE END TIM8_MspInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM10)
|
||||
{
|
||||
/* USER CODE BEGIN TIM10_MspInit 0 */
|
||||
|
||||
@ -91,7 +173,27 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||
{
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||
if(timHandle->Instance==TIM10)
|
||||
if(timHandle->Instance==TIM8)
|
||||
{
|
||||
/* USER CODE BEGIN TIM8_MspPostInit 0 */
|
||||
|
||||
/* USER CODE END TIM8_MspPostInit 0 */
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
/**TIM8 GPIO Configuration
|
||||
PC7 ------> TIM8_CH2
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_7;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF3_TIM8;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
/* USER CODE BEGIN TIM8_MspPostInit 1 */
|
||||
|
||||
/* USER CODE END TIM8_MspPostInit 1 */
|
||||
}
|
||||
else if(timHandle->Instance==TIM10)
|
||||
{
|
||||
/* USER CODE BEGIN TIM10_MspPostInit 0 */
|
||||
|
||||
@ -118,7 +220,18 @@ void HAL_TIM_MspPostInit(TIM_HandleTypeDef* timHandle)
|
||||
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* tim_baseHandle)
|
||||
{
|
||||
|
||||
if(tim_baseHandle->Instance==TIM10)
|
||||
if(tim_baseHandle->Instance==TIM8)
|
||||
{
|
||||
/* USER CODE BEGIN TIM8_MspDeInit 0 */
|
||||
|
||||
/* USER CODE END TIM8_MspDeInit 0 */
|
||||
/* Peripheral clock disable */
|
||||
__HAL_RCC_TIM8_CLK_DISABLE();
|
||||
/* USER CODE BEGIN TIM8_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END TIM8_MspDeInit 1 */
|
||||
}
|
||||
else if(tim_baseHandle->Instance==TIM10)
|
||||
{
|
||||
/* USER CODE BEGIN TIM10_MspDeInit 0 */
|
||||
|
||||
|
||||
19298
MDK-ARM/JLinkLog.txt
19298
MDK-ARM/JLinkLog.txt
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -120,7 +120,6 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>DLGUARM</Key>
|
||||
<Name>???</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
@ -225,6 +224,21 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>cmd_chassis</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>13</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>cmd_for_shoot</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>14</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>shoot_cmd</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>15</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>shoot</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
@ -952,7 +966,7 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>component</GroupName>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -1139,18 +1153,6 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\motor_rm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>motor_rm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>68</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\bmi088.c</PathWithFileName>
|
||||
<FilenameWithoutPath>bmi088.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -1158,7 +1160,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>69</FileNumber>
|
||||
<FileNumber>68</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1170,7 +1172,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>70</FileNumber>
|
||||
<FileNumber>69</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1180,6 +1182,18 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>70</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\motor_rm.c</PathWithFileName>
|
||||
<FilenameWithoutPath>motor_rm.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>71</FileNumber>
|
||||
@ -1199,6 +1213,18 @@
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\motor_step.c</PathWithFileName>
|
||||
<FilenameWithoutPath>motor_step.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>73</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\motor_lz.c</PathWithFileName>
|
||||
<FilenameWithoutPath>motor_lz.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
@ -1206,7 +1232,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>73</FileNumber>
|
||||
<FileNumber>74</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1218,7 +1244,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>74</FileNumber>
|
||||
<FileNumber>75</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1230,7 +1256,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>75</FileNumber>
|
||||
<FileNumber>76</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1242,7 +1268,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>76</FileNumber>
|
||||
<FileNumber>77</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1254,7 +1280,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>77</FileNumber>
|
||||
<FileNumber>78</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
@ -1264,18 +1290,6 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>78</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\User\device\step_motor.c</PathWithFileName>
|
||||
<FilenameWithoutPath>step_motor.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>8</GroupNumber>
|
||||
<FileNumber>79</FileNumber>
|
||||
|
||||
@ -1838,11 +1838,6 @@
|
||||
<Group>
|
||||
<GroupName>device</GroupName>
|
||||
<Files>
|
||||
<File>
|
||||
<FileName>motor_rm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor_rm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>bmi088.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@ -1858,11 +1853,21 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>motor_rm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor_rm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>motor_dm.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor_dm.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>motor_step.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor_step.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>motor_lz.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
@ -1893,11 +1898,6 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\motor_lk.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>step_motor.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\device\step_motor.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>led.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
Binary file not shown.
@ -22,7 +22,7 @@ Dialog DLL: TCM.DLL V1.48.0.0
|
||||
|
||||
<h2>Project:</h2>
|
||||
D:\yunha\git_gimbal\RM\Steering Wheel_Infatry\MDK-ARM\Steering Wheel_Infatry.uvprojx
|
||||
Project File Date: 01/26/2026
|
||||
Project File Date: 01/28/2026
|
||||
|
||||
<h2>Output:</h2>
|
||||
*** Using Compiler 'V6.16', folder: 'D:\Keil_v5\ARM\ARMCLANG\Bin'
|
||||
@ -37,10 +37,6 @@ Note: source file '..\User\task\ET16s.c' - object file renamed from 'Steering Wh
|
||||
Note: source file '..\User\task\step_motor.c' - object file renamed from 'Steering Wheel_Infatry\step_motor.o' to 'Steering Wheel_Infatry\step_motor_1.o'.
|
||||
Note: source file '..\User\task\vofa.c' - object file renamed from 'Steering Wheel_Infatry\vofa.o' to 'Steering Wheel_Infatry\vofa_1.o'.
|
||||
Note: source file '..\User\module\cmd\cmd.c' - object file renamed from 'Steering Wheel_Infatry\cmd.o' to 'Steering Wheel_Infatry\cmd_1.o'.
|
||||
compiling config.c...
|
||||
linking...
|
||||
Program Size: Code=67504 RO-data=1720 RW-data=1224 ZI-data=119880
|
||||
FromELF: creating hex file...
|
||||
"Steering Wheel_Infatry\Steering Wheel_Infatry.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
@ -65,7 +61,7 @@ Package Vendor: Keil
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.4.0
|
||||
Include file: CMSIS\Core\Include\tz_context.h
|
||||
Build Time Elapsed: 00:00:02
|
||||
Build Time Elapsed: 00:00:01
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -65,18 +65,18 @@
|
||||
"steering wheel_infatry\bsp_rc.o"
|
||||
"steering wheel_infatry\calc_lib.o"
|
||||
"steering wheel_infatry\crc8.o"
|
||||
"steering wheel_infatry\motor_rm.o"
|
||||
"steering wheel_infatry\bmi088.o"
|
||||
"steering wheel_infatry\ist8310.o"
|
||||
"steering wheel_infatry\motor.o"
|
||||
"steering wheel_infatry\motor_rm.o"
|
||||
"steering wheel_infatry\motor_dm.o"
|
||||
"steering wheel_infatry\motor_step.o"
|
||||
"steering wheel_infatry\motor_lz.o"
|
||||
"steering wheel_infatry\ai.o"
|
||||
"steering wheel_infatry\et16s.o"
|
||||
"steering wheel_infatry\dr16.o"
|
||||
"steering wheel_infatry\oid.o"
|
||||
"steering wheel_infatry\motor_lk.o"
|
||||
"steering wheel_infatry\step_motor.o"
|
||||
"steering wheel_infatry\led.o"
|
||||
"steering wheel_infatry\vofa.o"
|
||||
"steering wheel_infatry\config.o"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -59,5 +59,6 @@ steering\ wheel_infatry/init.o: ..\User\task\init.c \
|
||||
..\User\device\motor_rm.h ..\User\device\motor.h \
|
||||
..\User\module\chassis.h ..\User\module\struct_typedef.h \
|
||||
..\User\device\bmi088.h ..\User\component\user_math.h \
|
||||
..\User\device\dr16.h ..\User\device\device.h ..\User\device\et16s.h \
|
||||
..\User\device\step_motor.h
|
||||
..\User\module\shoot.h ..\Core\Inc\main.h ..\User\device\dr16.h \
|
||||
..\User\device\device.h ..\User\device\et16s.h \
|
||||
..\User\device\motor_step.h
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
40
MDK-ARM/Steering Wheel_Infatry/motor_step.d
Normal file
40
MDK-ARM/Steering Wheel_Infatry/motor_step.d
Normal file
@ -0,0 +1,40 @@
|
||||
steering\ wheel_infatry/motor_step.o: ..\User\device\motor_step.c \
|
||||
..\Core\Inc\main.h ..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal.h \
|
||||
..\Core\Inc\stm32f4xx_hal_conf.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_def.h \
|
||||
..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f4xx.h \
|
||||
..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\stm32f407xx.h \
|
||||
..\Drivers\CMSIS\Include\core_cm4.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdint.h \
|
||||
..\Drivers\CMSIS\Include\cmsis_version.h \
|
||||
..\Drivers\CMSIS\Include\cmsis_compiler.h \
|
||||
..\Drivers\CMSIS\Include\cmsis_armclang.h \
|
||||
..\Drivers\CMSIS\Include\mpu_armv7.h \
|
||||
..\Drivers\CMSIS\Device\ST\STM32F4xx\Include\system_stm32f4xx.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy\stm32_hal_legacy.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stddef.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_rcc_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_gpio_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_exti.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_dma_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_cortex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_can.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_flash_ramfunc.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_i2c_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_pwr_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_spi.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h \
|
||||
..\User\bsp\pwm.h ..\Core\Inc\tim.h ..\Core\Inc\main.h \
|
||||
..\User\bsp\bsp.h ..\User\device\motor_step.h \
|
||||
..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h ..\User\bsp\gpio.h \
|
||||
..\User\bsp\bsp.h
|
||||
BIN
MDK-ARM/Steering Wheel_Infatry/motor_step.o
Normal file
BIN
MDK-ARM/Steering Wheel_Infatry/motor_step.o
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -33,7 +33,8 @@ steering\ wheel_infatry/step_motor.o: ..\User\device\step_motor.c \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_tim_ex.h \
|
||||
..\Drivers\STM32F4xx_HAL_Driver\Inc\stm32f4xx_hal_uart.h \
|
||||
..\User\device\step_motor.h \
|
||||
..\User\bsp\pwm.h ..\Core\Inc\tim.h ..\Core\Inc\main.h \
|
||||
..\User\bsp\bsp.h ..\User\device\step_motor.h \
|
||||
..\Middlewares\Third_Party\FreeRTOS\Source\CMSIS_RTOS_V2\cmsis_os2.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h ..\User\bsp\gpio.h \
|
||||
..\User\bsp\bsp.h
|
||||
|
||||
Binary file not shown.
@ -12,7 +12,7 @@ steering\ wheel_infatry/step_motor_1.o: ..\User\task\step_motor.c \
|
||||
..\Middlewares\Third_Party\FreeRTOS\Source\include\mpu_wrappers.h \
|
||||
..\Middlewares\Third_Party\FreeRTOS\Source\include\task.h \
|
||||
..\Middlewares\Third_Party\FreeRTOS\Source\include\list.h \
|
||||
..\User\device\step_motor.h \
|
||||
..\User\device\motor_step.h \
|
||||
D:\Keil_v5\ARM\ARMCLANG\Bin\..\include\stdbool.h \
|
||||
..\User\device\ET16s.h ..\User\device\device.h ..\User\bsp\gpio.h \
|
||||
..\User\bsp\bsp.h
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -29,7 +29,7 @@
|
||||
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Stack_Size EQU 0x400
|
||||
Stack_Size EQU 0x800
|
||||
|
||||
AREA STACK, NOINIT, READWRITE, ALIGN=3
|
||||
Stack_Mem SPACE Stack_Size
|
||||
@ -40,7 +40,7 @@ __initial_sp
|
||||
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
|
||||
; </h>
|
||||
|
||||
Heap_Size EQU 0x200
|
||||
Heap_Size EQU 0x500
|
||||
|
||||
AREA HEAP, NOINIT, READWRITE, ALIGN=3
|
||||
__heap_base
|
||||
|
||||
@ -91,11 +91,12 @@ Mcu.CPN=STM32F407IGH6
|
||||
Mcu.Family=STM32F4
|
||||
Mcu.IP0=CAN1
|
||||
Mcu.IP1=CAN2
|
||||
Mcu.IP10=TIM10
|
||||
Mcu.IP11=USART1
|
||||
Mcu.IP12=USART2
|
||||
Mcu.IP13=USART3
|
||||
Mcu.IP14=USART6
|
||||
Mcu.IP10=TIM8
|
||||
Mcu.IP11=TIM10
|
||||
Mcu.IP12=USART1
|
||||
Mcu.IP13=USART2
|
||||
Mcu.IP14=USART3
|
||||
Mcu.IP15=USART6
|
||||
Mcu.IP2=DMA
|
||||
Mcu.IP3=FREERTOS
|
||||
Mcu.IP4=I2C1
|
||||
@ -104,7 +105,7 @@ Mcu.IP6=NVIC
|
||||
Mcu.IP7=RCC
|
||||
Mcu.IP8=SPI1
|
||||
Mcu.IP9=SYS
|
||||
Mcu.IPNb=15
|
||||
Mcu.IPNb=16
|
||||
Mcu.Name=STM32F407I(E-G)Hx
|
||||
Mcu.Package=UFBGA176
|
||||
Mcu.Pin0=PB8
|
||||
@ -121,15 +122,15 @@ Mcu.Pin18=PA9
|
||||
Mcu.Pin19=PC15-OSC32_OUT
|
||||
Mcu.Pin2=PB4
|
||||
Mcu.Pin20=PH0-OSC_IN
|
||||
Mcu.Pin21=PH1-OSC_OUT
|
||||
Mcu.Pin22=PF1
|
||||
Mcu.Pin23=PG6
|
||||
Mcu.Pin24=PF6
|
||||
Mcu.Pin25=PH12
|
||||
Mcu.Pin26=PG3
|
||||
Mcu.Pin27=PH11
|
||||
Mcu.Pin28=PH10
|
||||
Mcu.Pin29=PC1
|
||||
Mcu.Pin21=PC7
|
||||
Mcu.Pin22=PH1-OSC_OUT
|
||||
Mcu.Pin23=PF1
|
||||
Mcu.Pin24=PG6
|
||||
Mcu.Pin25=PF6
|
||||
Mcu.Pin26=PH12
|
||||
Mcu.Pin27=PG3
|
||||
Mcu.Pin28=PH11
|
||||
Mcu.Pin29=PH10
|
||||
Mcu.Pin3=PB3
|
||||
Mcu.Pin30=PC2
|
||||
Mcu.Pin31=PB2
|
||||
@ -144,13 +145,14 @@ Mcu.Pin39=PB0
|
||||
Mcu.Pin4=PA14
|
||||
Mcu.Pin40=VP_FREERTOS_VS_CMSIS_V2
|
||||
Mcu.Pin41=VP_SYS_VS_Systick
|
||||
Mcu.Pin42=VP_TIM10_VS_ClockSourceINT
|
||||
Mcu.Pin42=VP_TIM8_VS_ClockSourceINT
|
||||
Mcu.Pin43=VP_TIM10_VS_ClockSourceINT
|
||||
Mcu.Pin5=PA13
|
||||
Mcu.Pin6=PB9
|
||||
Mcu.Pin7=PB7
|
||||
Mcu.Pin8=PB6
|
||||
Mcu.Pin9=PD6
|
||||
Mcu.PinsNb=43
|
||||
Mcu.PinsNb=44
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
Mcu.UserName=STM32F407IGHx
|
||||
@ -243,12 +245,6 @@ PB8.Mode=I2C
|
||||
PB8.Signal=I2C1_SCL
|
||||
PB9.Mode=I2C
|
||||
PB9.Signal=I2C1_SDA
|
||||
PC1.GPIOParameters=PinState,GPIO_PuPd,GPIO_Label
|
||||
PC1.GPIO_Label=PUL_P
|
||||
PC1.GPIO_PuPd=GPIO_PULLUP
|
||||
PC1.Locked=true
|
||||
PC1.PinState=GPIO_PIN_SET
|
||||
PC1.Signal=GPIO_Output
|
||||
PC10.Mode=Asynchronous
|
||||
PC10.Signal=USART3_TX
|
||||
PC11.Mode=Asynchronous
|
||||
@ -274,6 +270,8 @@ PC5.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_FALLING
|
||||
PC5.GPIO_PuPd=GPIO_PULLUP
|
||||
PC5.Locked=true
|
||||
PC5.Signal=GPXTI5
|
||||
PC7.Locked=true
|
||||
PC7.Signal=S_TIM8_CH2
|
||||
PCC.Checker=false
|
||||
PCC.Line=STM32F407/417
|
||||
PCC.MCU=STM32F407I(E-G)Hx
|
||||
@ -347,7 +345,7 @@ ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.28.3
|
||||
ProjectManager.FreePins=false
|
||||
ProjectManager.FreePinsContext=
|
||||
ProjectManager.HalAssertFull=false
|
||||
ProjectManager.HeapSize=0x200
|
||||
ProjectManager.HeapSize=0x500
|
||||
ProjectManager.KeepUserCode=true
|
||||
ProjectManager.LastFirmware=true
|
||||
ProjectManager.LibraryCopy=1
|
||||
@ -359,13 +357,13 @@ ProjectManager.ProjectFileName=Steering Wheel_Infatry.ioc
|
||||
ProjectManager.ProjectName=Steering Wheel_Infatry
|
||||
ProjectManager.ProjectStructure=
|
||||
ProjectManager.RegisterCallBack=
|
||||
ProjectManager.StackSize=0x400
|
||||
ProjectManager.StackSize=0x800
|
||||
ProjectManager.TargetToolchain=MDK-ARM V5.32
|
||||
ProjectManager.ToolChainLocation=
|
||||
ProjectManager.UAScriptAfterPath=
|
||||
ProjectManager.UAScriptBeforePath=
|
||||
ProjectManager.UnderRoot=false
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_CAN1_Init-CAN1-false-HAL-true,5-MX_CAN2_Init-CAN2-false-HAL-true,6-MX_I2C1_Init-I2C1-false-HAL-true,7-MX_I2C2_Init-I2C2-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true,11-MX_USART3_UART_Init-USART3-false-HAL-true,12-MX_TIM10_Init-TIM10-false-HAL-true,13-MX_USART6_UART_Init-USART6-false-HAL-true
|
||||
ProjectManager.functionlistsort=1-SystemClock_Config-RCC-false-HAL-false,2-MX_GPIO_Init-GPIO-false-HAL-true,3-MX_DMA_Init-DMA-false-HAL-true,4-MX_CAN1_Init-CAN1-false-HAL-true,5-MX_CAN2_Init-CAN2-false-HAL-true,6-MX_I2C1_Init-I2C1-false-HAL-true,7-MX_I2C2_Init-I2C2-false-HAL-true,8-MX_SPI1_Init-SPI1-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_USART2_UART_Init-USART2-false-HAL-true,11-MX_USART3_UART_Init-USART3-false-HAL-true,12-MX_TIM10_Init-TIM10-false-HAL-true,13-MX_USART6_UART_Init-USART6-false-HAL-true,14-MX_TIM8_Init-TIM8-false-HAL-true
|
||||
RCC.48MHZClocksFreq_Value=84000000
|
||||
RCC.AHBFreq_Value=168000000
|
||||
RCC.APB1CLKDivider=RCC_HCLK_DIV4
|
||||
@ -408,6 +406,8 @@ SH.GPXTI5.0=GPIO_EXTI5
|
||||
SH.GPXTI5.ConfNb=1
|
||||
SH.S_TIM10_CH1.0=TIM10_CH1,PWM Generation1 CH1
|
||||
SH.S_TIM10_CH1.ConfNb=1
|
||||
SH.S_TIM8_CH2.0=TIM8_CH2,PWM Generation2 CH2
|
||||
SH.S_TIM8_CH2.ConfNb=1
|
||||
SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_16
|
||||
SPI1.CLKPhase=SPI_PHASE_2EDGE
|
||||
SPI1.CLKPolarity=SPI_POLARITY_HIGH
|
||||
@ -419,6 +419,10 @@ SPI1.VirtualType=VM_MASTER
|
||||
TIM10.Channel=TIM_CHANNEL_1
|
||||
TIM10.IPParameters=Channel,Period
|
||||
TIM10.Period=5000
|
||||
TIM8.Channel-PWM\ Generation2\ CH2=TIM_CHANNEL_2
|
||||
TIM8.IPParameters=Channel-PWM Generation2 CH2,Prescaler,Period
|
||||
TIM8.Period=19999
|
||||
TIM8.Prescaler=167
|
||||
USART1.IPParameters=VirtualMode
|
||||
USART1.VirtualMode=VM_ASYNC
|
||||
USART2.IPParameters=VirtualMode
|
||||
@ -437,5 +441,7 @@ VP_SYS_VS_Systick.Mode=SysTick
|
||||
VP_SYS_VS_Systick.Signal=SYS_VS_Systick
|
||||
VP_TIM10_VS_ClockSourceINT.Mode=Enable_Timer
|
||||
VP_TIM10_VS_ClockSourceINT.Signal=TIM10_VS_ClockSourceINT
|
||||
VP_TIM8_VS_ClockSourceINT.Mode=Internal
|
||||
VP_TIM8_VS_ClockSourceINT.Signal=TIM8_VS_ClockSourceINT
|
||||
board=custom
|
||||
rtos.0.ip=FREERTOS
|
||||
|
||||
@ -34,11 +34,6 @@ gpio:
|
||||
ioc_label: DIR_N
|
||||
pin: PB2
|
||||
type: OUTPUT
|
||||
- custom_name: PUL_P
|
||||
has_exti: false
|
||||
ioc_label: PUL_P
|
||||
pin: PC1
|
||||
type: OUTPUT
|
||||
- custom_name: PUL_N
|
||||
has_exti: false
|
||||
ioc_label: PUL_N
|
||||
@ -91,6 +86,10 @@ mm:
|
||||
enabled: true
|
||||
pwm:
|
||||
configs:
|
||||
- channel: TIM_CHANNEL_2
|
||||
custom_name: MOTOR_STEP
|
||||
label: TIM8_CH2
|
||||
timer: TIM8
|
||||
- channel: TIM_CHANNEL_1
|
||||
custom_name: IMU_HEAT
|
||||
label: TIM10_CH1
|
||||
|
||||
@ -31,7 +31,6 @@ static const BSP_GPIO_MAP_t GPIO_Map[BSP_GPIO_NUM] = {
|
||||
{GYRO_CS_Pin, GYRO_CS_GPIO_Port},
|
||||
{DIR_P_Pin, DIR_P_GPIO_Port},
|
||||
{DIR_N_Pin, DIR_N_GPIO_Port},
|
||||
{PUL_P_Pin, PUL_P_GPIO_Port},
|
||||
{PUL_N_Pin, PUL_N_GPIO_Port},
|
||||
{ACCL_INT_Pin, ACCL_INT_GPIO_Port},
|
||||
{GYRO_INT_Pin, GYRO_INT_GPIO_Port},
|
||||
|
||||
@ -27,7 +27,6 @@ typedef enum {
|
||||
BSP_GPIO_GYRO_CS,
|
||||
BSP_GPIO_DIR_P,
|
||||
BSP_GPIO_DIR_N,
|
||||
BSP_GPIO_PUL_P,
|
||||
BSP_GPIO_PUL_N,
|
||||
BSP_GPIO_ACCL_INT,
|
||||
BSP_GPIO_GYRO_INT,
|
||||
|
||||
@ -25,6 +25,7 @@ typedef struct {
|
||||
|
||||
/* Private variables -------------------------------------------------------- */
|
||||
static const BSP_PWM_Config_t PWM_Map[BSP_PWM_NUM] = {
|
||||
{&htim8, TIM_CHANNEL_2},
|
||||
{&htim10, TIM_CHANNEL_1},
|
||||
};
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ extern "C" {
|
||||
/* Exported types ----------------------------------------------------------- */
|
||||
/* PWM通道 */
|
||||
typedef enum {
|
||||
BSP_PWM_MOTOR_STEP,
|
||||
BSP_PWM_IMU_HEAT,
|
||||
BSP_PWM_NUM,
|
||||
BSP_PWM_ERR,
|
||||
|
||||
30
User/device/motor_step.c
Normal file
30
User/device/motor_step.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* 底盘固定模组,用步进 */
|
||||
#include "main.h"
|
||||
#include "bsp/pwm.h"
|
||||
#include "motor_step.h"
|
||||
#include "bsp/gpio.h"
|
||||
#include "cmsis_os2.h"
|
||||
|
||||
int8_t Motor_Step_Init(STEP_MOTOR *param){
|
||||
|
||||
BSP_PWM_Start(BSP_PWM_MOTOR_STEP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int8_t Motor_Step_Ctrl(STEP_MOTOR *param){
|
||||
|
||||
// if(param->state==1){
|
||||
/* 控制方向 */
|
||||
BSP_GPIO_WritePin(BSP_GPIO_DIR_P, param->direction);
|
||||
osDelay(10); // 方向稳定时间
|
||||
// for(int i;i<10000;i++){
|
||||
BSP_PWM_SetComp(BSP_PWM_MOTOR_STEP,19999);
|
||||
// osDelay(200);
|
||||
// BSP_PWM_SetComp(BSP_PWM_STEP_MOTOR,0);
|
||||
// osDelay(200);
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,9 @@ typedef struct{
|
||||
int state;
|
||||
|
||||
}STEP_MOTOR;
|
||||
int8_t Step_Motor_Ctrl(STEP_MOTOR *param);
|
||||
|
||||
int8_t Motor_Step_Init(STEP_MOTOR *param);
|
||||
int8_t Motor_Step_Ctrl(STEP_MOTOR *param);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,32 +0,0 @@
|
||||
/* 底盘固定模组,用步进 */
|
||||
#include "main.h"
|
||||
#include "step_motor.h"
|
||||
#include "bsp/gpio.h"
|
||||
#include "cmsis_os2.h"
|
||||
|
||||
|
||||
|
||||
int8_t Step_Motor_Ctrl(STEP_MOTOR *param){
|
||||
|
||||
// if(param->state==1){
|
||||
/* 控制方向 */
|
||||
BSP_GPIO_WritePin(BSP_GPIO_DIR_P, param->direction);
|
||||
osDelay(10); // 方向稳定时间
|
||||
// for(int i;i >= param->pulse;i++){
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 1);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, 0);
|
||||
// BSP_GPIO_WritePin(BSP_GPIO_PUL_P,true);
|
||||
// BSP_GPIO_WritePin(BSP_GPIO_PUL_N,false);
|
||||
osDelay(param->time);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, 1);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, 0);
|
||||
// BSP_GPIO_WritePin(BSP_GPIO_PUL_P,true);
|
||||
// BSP_GPIO_WritePin(BSP_GPIO_PUL_N,false);
|
||||
osDelay(param->time);
|
||||
// }
|
||||
// param->state=1;
|
||||
//}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,22 @@ static void CMD_RC_BuildShootCmd(CMD_t *ctx) {
|
||||
} else {
|
||||
ctx->output.shoot.cmd.mode = SHOOT_MODE_SAFE;
|
||||
}
|
||||
/* 根据c拨杆控制射击 */
|
||||
switch (ctx->input.rc.sw[2]) {
|
||||
case CMD_SW_DOWN:
|
||||
ctx->output.shoot.cmd.mode = SHOOT_MODE_CONTINUE;
|
||||
break;
|
||||
case CMD_SW_MID:
|
||||
ctx->output.shoot.cmd.mode = SHOOT_MODE_SINGLE;
|
||||
break;
|
||||
case CMD_SW_UP:
|
||||
ctx->output.shoot.cmd.ready = SHOOT_MODE_SAFE;
|
||||
|
||||
// default:
|
||||
// ctx->output.shoot.cmd.ready = false;
|
||||
// ctx->output.shoot.cmd.firecmd = false;
|
||||
break;
|
||||
}
|
||||
/* 根据D拨杆控制射击 */
|
||||
switch (ctx->input.rc.sw[3]) {
|
||||
case CMD_SW_DOWN:
|
||||
|
||||
@ -28,7 +28,7 @@ Config_RobotParam_t robot_config = {
|
||||
.motor_6020_param[1]={BSP_CAN_1,0x207,MOTOR_GM6020,false,false},
|
||||
.motor_6020_param[2]={BSP_CAN_1,0x208,MOTOR_GM6020,false,false},
|
||||
.motor_6020_param[3]={BSP_CAN_1,0x209,MOTOR_GM6020,false,false},
|
||||
.chassis2006_setangle=-190,
|
||||
.chassis2006_setangle=195,
|
||||
.chassis_2006_angle_param={
|
||||
.k=1.0f,
|
||||
.p=1.0f,
|
||||
@ -143,8 +143,6 @@ Config_RobotParam_t robot_config = {
|
||||
/*是否开启限位*/
|
||||
.limit_yaw=false,
|
||||
.limit_pit=true,
|
||||
.pit_rm_motor={},
|
||||
.yaw_rm_motor={BSP_CAN_2,0x209,MOTOR_GM6020,false,false},
|
||||
/*达妙电机参数自己配*/
|
||||
.yaw_dm_motor={
|
||||
.can=BSP_CAN_1,
|
||||
@ -163,12 +161,12 @@ Config_RobotParam_t robot_config = {
|
||||
// .yaw_dm_motor={},
|
||||
},
|
||||
.dm_Params_t={
|
||||
// .yaw_dm={.kd=0.1,},
|
||||
// .yaw_dm_Reduction_ratio=1.0f,//减速比
|
||||
.yaw_dm={.kd=0.1,},
|
||||
.yaw_dm_Reduction_ratio=1.0f,//减速比
|
||||
.pit_dm={.kd=0.2,},
|
||||
.pit_dm_Reduction_ratio=1.0f,
|
||||
.major_yaw_dm={.kd=0.1,},
|
||||
.major_yaw_dm_Reduction_ratio=1.0f,//减速比
|
||||
|
||||
},
|
||||
|
||||
.low_pass_cutoff_freq = {
|
||||
@ -229,14 +227,14 @@ Config_RobotParam_t robot_config = {
|
||||
.projectileType=SHOOT_PROJECTILE_17MM,
|
||||
.fric_num=6,
|
||||
.extra_deceleration_ratio=1.0f,
|
||||
.num_trig_tooth=5,
|
||||
.shot_freq=1.0f,
|
||||
.num_trig_tooth=8,
|
||||
.shot_freq=10.0f,
|
||||
.shot_burst_num=3,
|
||||
.ratio_multilevel = {0.8f, 1.0f},
|
||||
},
|
||||
.jamDetection={
|
||||
.enable=true,
|
||||
.threshold=310.0f,
|
||||
.enable=false,
|
||||
.threshold=110.0f,
|
||||
.suspectedTime=0.5f,
|
||||
},
|
||||
.motor={
|
||||
@ -264,7 +262,7 @@ Config_RobotParam_t robot_config = {
|
||||
|
||||
},
|
||||
.trig = {
|
||||
.can = BSP_CAN_2,
|
||||
.can = BSP_CAN_1,
|
||||
.id = 0x205,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
@ -349,7 +347,7 @@ Config_RobotParam_t robot_config = {
|
||||
|
||||
.shoot_sw_up = SHOOT_MODE_SAFE,
|
||||
.shoot_sw_mid = SHOOT_MODE_SINGLE,
|
||||
.shoot_sw_down = SHOOT_MODE_BURST,
|
||||
.shoot_sw_down = SHOOT_MODE_CONTINUE,
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
@ -41,9 +41,9 @@ void Task_chassis_ctrl(void *argument) {
|
||||
/*接受cmd任务数据*/
|
||||
if(osMessageQueueGet(task_runtime.msgq.chassis.cmd, &cmd_chassis, NULL, 0)==osOK);
|
||||
|
||||
Chassis_update(&chassis);
|
||||
Chassis_Control(&chassis, &cmd_chassis,tick);
|
||||
Chassis_Setoutput(&chassis);
|
||||
// Chassis_update(&chassis);
|
||||
// Chassis_Control(&chassis, &cmd_chassis,tick);
|
||||
// Chassis_Setoutput(&chassis);
|
||||
////{
|
||||
// // 如果没有收到命令,可以执行一个安全停止的逻辑
|
||||
// // 或者什么都不做,让底盘保持上一帧的状态(取决于你的设计)
|
||||
|
||||
@ -9,9 +9,10 @@
|
||||
/* USER INCLUDE BEGIN */
|
||||
#include "module/gimbal.h"
|
||||
#include "module/chassis.h"
|
||||
#include "module/shoot.h"
|
||||
#include "device/dr16.h"
|
||||
#include "device/et16s.h"
|
||||
#include "device/step_motor.h"
|
||||
#include "device/motor_step.h"
|
||||
/* USER INCLUDE END */
|
||||
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
@ -51,6 +52,7 @@ void Task_Init(void *argument) {
|
||||
task_runtime.msgq.gimbal.imu= osMessageQueueNew(2u, sizeof(Gimbal_IMU_t), NULL);
|
||||
task_runtime.msgq.gimbal.cmd= osMessageQueueNew(2u, sizeof(Gimbal_CMD_t), NULL);
|
||||
task_runtime.msgq.chassis.cmd= osMessageQueueNew(2u, sizeof(Chassis_CMD_t), NULL);
|
||||
task_runtime.msgq.shoot.cmd= osMessageQueueNew(2u, sizeof(Shoot_CMD_t), NULL);
|
||||
task_runtime.msgq.rc.dr16= osMessageQueueNew(2u, sizeof(DR16_t), NULL);
|
||||
task_runtime.msgq.rc.et16s= osMessageQueueNew(2u, sizeof(ET16s_t), NULL);
|
||||
/* USER MESSAGE END */
|
||||
|
||||
@ -34,13 +34,13 @@ void Task_shoot_ctrl(void *argument) {
|
||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||
/* USER CODE INIT BEGIN */
|
||||
Shoot_Init(&shoot,&Config_GetRobotParam()->shoot_param,SHOOT_CTRL_FREQ);
|
||||
Shoot_SetMode(&shoot,SHOOT_MODE_BURST);
|
||||
Shoot_SetMode(&shoot,SHOOT_MODE_CONTINUE);
|
||||
/* USER CODE INIT END */
|
||||
|
||||
while (1) {
|
||||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||||
/* USER CODE BEGIN */
|
||||
osMessageQueueGet(task_runtime.msgq.shoot.cmd, &shoot_ctrl_cmd_rc, NULL, 0);
|
||||
osMessageQueueGet(task_runtime.msgq.shoot.cmd, &shoot_cmd, NULL, 0);
|
||||
// shoot_cmd.mode=true;
|
||||
// shoot.target_variable.target_rpm=4000;
|
||||
// shoot.mode=shoot_ctrl_cmd_rc.mode;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
/* Includes ----------------------------------------------------------------- */
|
||||
#include "task/user_task.h"
|
||||
/* USER INCLUDE BEGIN */
|
||||
#include "device/step_motor.h"
|
||||
#include "device/motor_step.h"
|
||||
#include "device/ET16s.h"
|
||||
#include "bsp/gpio.h"
|
||||
/* USER INCLUDE END */
|
||||
@ -41,7 +41,7 @@ void Task_step_motor(void *argument) {
|
||||
uint32_t tick = osKernelGetTickCount(); /* 控制任务运行频率的计时 */
|
||||
/* USER CODE INIT BEGIN */
|
||||
/* 当前状态变量 */
|
||||
|
||||
Motor_Step_Init(&StepMotor_param);
|
||||
// StepMotor_param.state = 0; // 初始状态为停止
|
||||
/* USER CODE INIT END */
|
||||
|
||||
@ -49,17 +49,7 @@ void Task_step_motor(void *argument) {
|
||||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||||
/* USER CODE BEGIN */
|
||||
if(osMessageQueueGet(task_runtime.msgq.chassis.SetpMotor, &Key_A, NULL, 0)==osOK);
|
||||
// /* 监听和更新拨杆状态 */
|
||||
|
||||
if (key1 == 0) {
|
||||
|
||||
} else if (key1 == 1) {
|
||||
|
||||
Step_Motor_Ctrl(&StepMotor_param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Motor_Step_Ctrl(&StepMotor_param);
|
||||
/* USER CODE END */
|
||||
osDelayUntil(tick); /* 运行结束,等待下一次唤醒 */
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user