54 lines
1.3 KiB
C
54 lines
1.3 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_GPIOA_CLK_ENABLE();
|
|
__HAL_RCC_GPIOE_CLK_ENABLE();
|
|
|
|
/*Configure GPIO pin Output Level */
|
|
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);
|
|
|
|
/*Configure GPIO pins : PFPin PFPin */
|
|
GPIO_InitStruct.Pin = LED0_Pin;
|
|
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
|
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
|
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
|
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);
|
|
|
|
void led_ctrl(uint8_t cmd)
|
|
{
|
|
if (cmd)
|
|
{
|
|
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_SET);
|
|
}
|
|
else
|
|
{
|
|
HAL_GPIO_WritePin(LED0_GPIO_Port, LED0_Pin, GPIO_PIN_RESET);
|
|
}
|
|
}
|
|
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|