// // Created by lidong on 25-8-4. // #include "rgb.h" #include "py32f0xx_hal.h" /** * @brief Configures LED GPIO. * @param Led Specifies the Led to be configured. * This parameter can be one of following parameters: * @arg LED3 * @retval None */ void RGB_Init() { GPIO_InitTypeDef GPIO_InitStruct; __HAL_RCC_GPIOA_CLK_ENABLE(); /* Configure the GPIO_LED pin */ GPIO_InitStruct.Pin = LED4_PIN; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; HAL_GPIO_Init(LED4_GPIO_PORT, &GPIO_InitStruct); HAL_GPIO_WritePin(LED4_GPIO_PORT, LED4_PIN, GPIO_PIN_SET); } /** * @brief DeInitialize LED GPIO. * @param Led Specifies the Led to be deconfigured. * This parameter can be one of the following values: * @arg LED3 * @note BSP_LED_DeInit() does not disable the GPIO clock * @retval None */ void BSP_LED_DeInit() { GPIO_InitTypeDef GPIO_InitStruct; /* Turn off LED */ HAL_GPIO_WritePin(LED4_GPIO_PORT, LED4_PIN, GPIO_PIN_RESET); /* DeInit the GPIO_LED pin */ GPIO_InitStruct.Pin = LED4_PIN; HAL_GPIO_DeInit(LED4_GPIO_PORT, GPIO_InitStruct.Pin); } /** * @brief Turns selected LED On. * @param Led Specifies the Led to be set on. * This parameter can be one of following parameters: * @arg LED3 * @retval None */ void BSP_LED_On() { HAL_GPIO_WritePin(LED4_GPIO_PORT, LED4_PIN, GPIO_PIN_RESET); } /** * @brief Turns selected LED Off. * @param Led Specifies the Led to be set off. * This parameter can be one of following parameters: * @arg LED3 * @retval None */ void BSP_LED_Off() { HAL_GPIO_WritePin(LED4_GPIO_PORT, LED4_PIN, GPIO_PIN_SET); } /** * @brief Toggles the selected LED. * @param Led Specifies the Led to be toggled. * This parameter can be one of following parameters: * @arg LED3 * @retval None */ void BSP_LED_Toggle() { HAL_GPIO_TogglePin(LED4_GPIO_PORT, LED4_PIN); }