led
This commit is contained in:
parent
2013b41ecd
commit
70aa497a47
BIN
doc/ebf_brushless motordriver_20210602_原理图.pdf
Normal file
BIN
doc/ebf_brushless motordriver_20210602_原理图.pdf
Normal file
Binary file not shown.
BIN
doc/野火_F407骄阳原理图_V1.0_2020_10_10.pdf
Normal file
BIN
doc/野火_F407骄阳原理图_V1.0_2020_10_10.pdf
Normal file
Binary file not shown.
@ -4,8 +4,8 @@
|
|||||||
* @date 2023-08-14
|
* @date 2023-08-14
|
||||||
* @version 0.0.1
|
* @version 0.0.1
|
||||||
* @copyright XiazhiTech Copyright (c) 2023
|
* @copyright XiazhiTech Copyright (c) 2023
|
||||||
*
|
*
|
||||||
* @brief
|
* @brief
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
@ -17,19 +17,24 @@ void MX_GPIO_Init(void)
|
|||||||
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
GPIO_InitTypeDef GPIO_InitStruct = {0};
|
||||||
|
|
||||||
/* GPIO Ports Clock Enable */
|
/* GPIO Ports Clock Enable */
|
||||||
__HAL_RCC_GPIOF_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOH_CLK_ENABLE();
|
|
||||||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||||
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
||||||
|
|
||||||
/*Configure GPIO pin Output Level */
|
/*Configure GPIO pin Output Level */
|
||||||
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);
|
||||||
|
|
||||||
/*Configure GPIO pins : PFPin PFPin */
|
/*Configure GPIO pins : PFPin PFPin */
|
||||||
GPIO_InitStruct.Pin = LED0_Pin | LED1_Pin;
|
GPIO_InitStruct.Pin = LED0_Pin;
|
||||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);
|
HAL_GPIO_Init(LED0_GPIO_Port, &GPIO_InitStruct);
|
||||||
|
|
||||||
|
GPIO_InitStruct.Pin = LED1_Pin;
|
||||||
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||||
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||||
|
HAL_GPIO_Init(LED1_GPIO_Port, &GPIO_InitStruct);
|
||||||
}
|
}
|
||||||
// INIT_BOARD_EXPORT(MX_GPIO_Init);
|
// INIT_BOARD_EXPORT(MX_GPIO_Init);
|
||||||
|
|
||||||
@ -37,11 +42,11 @@ void led_ctrl(uint8_t cmd)
|
|||||||
{
|
{
|
||||||
if (cmd)
|
if (cmd)
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(LED1_GPIO_Port, LED0_Pin, GPIO_PIN_SET);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_RESET);
|
HAL_GPIO_WritePin(LED1_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,10 +20,10 @@ extern "C"
|
|||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
#define LED0_Pin GPIO_PIN_9
|
#define LED0_Pin GPIO_PIN_15
|
||||||
#define LED0_GPIO_Port GPIOF
|
#define LED0_GPIO_Port GPIOA
|
||||||
#define LED1_Pin GPIO_PIN_10
|
#define LED1_Pin GPIO_PIN_2
|
||||||
#define LED1_GPIO_Port GPIOF
|
#define LED1_GPIO_Port GPIOE
|
||||||
|
|
||||||
void MX_GPIO_Init(void);
|
void MX_GPIO_Init(void);
|
||||||
void led_ctrl(uint8_t cmd);
|
void led_ctrl(uint8_t cmd);
|
||||||
|
Loading…
Reference in New Issue
Block a user