初始化验证编译通过
This commit is contained in:
@ -21,7 +21,8 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
#include "led.h"
|
||||
#include "delay.h"
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@ -42,7 +43,14 @@
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
|
||||
/* USER CODE BEGIN PV */
|
||||
/* LED configuration */
|
||||
static led_config_t led_config = {
|
||||
.gpio_port = GPIOA,
|
||||
.gpio_pin = GPIO_PIN_6
|
||||
};
|
||||
|
||||
/* LED instance */
|
||||
static led_t led;
|
||||
/* USER CODE END PV */
|
||||
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@ -87,15 +95,17 @@ int main(void)
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
/* Initialize modules */
|
||||
led_init(&led, &led_config);
|
||||
delay_init();
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/* Infinite loop */
|
||||
/* USER CODE BEGIN WHILE */
|
||||
while (1)
|
||||
{
|
||||
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6); // Toggle the state of pin PA6
|
||||
HAL_Delay(100); // Delay for 500 milliseconds
|
||||
led_toggle(&led); // Toggle the LED state
|
||||
delay_ms(500); // Delay for 500 milliseconds
|
||||
/* USER CODE END WHILE */
|
||||
|
||||
/* USER CODE BEGIN 3 */
|
||||
|
||||
Reference in New Issue
Block a user