foc/src/Bsp/gpio.c
2023-08-23 09:43:35 +08:00

49 lines
1.1 KiB
C

/**
* @file gpio.c
* @author jimingqing
* @date 2023-08-14
* @version 0.0.1
* @copyright XiazhiTech Copyright (c) 2023
*
* @brief
*/
/* Includes ------------------------------------------------------------------*/
#include "gpio.h"
void MX_GPIO_Init(void)
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
/* GPIO Ports Clock Enable */
__HAL_RCC_GPIOF_CLK_ENABLE();
__HAL_RCC_GPIOH_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
/*Configure GPIO pin Output Level */
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_RESET);
/*Configure GPIO pins : PFPin PFPin */
GPIO_InitStruct.Pin = LED0_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(GPIOF, &GPIO_InitStruct);
}
// INIT_BOARD_EXPORT(MX_GPIO_Init);
void led_ctrl(uint8_t cmd)
{
if (cmd)
{
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_SET);
}
else
{
HAL_GPIO_WritePin(GPIOF, LED0_Pin | LED1_Pin, GPIO_PIN_RESET);
}
}
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/