/* music Task */ /* Includes ----------------------------------------------------------------- */ #include "bsp/time.h" #include "task/user_task.h" /* USER INCLUDE BEGIN */ #include "device/buzzer.h" #include "bsp/pwm.h" /* USER INCLUDE END */ /* Private typedef ---------------------------------------------------------- */ /* Private define ----------------------------------------------------------- */ /* Private macro ------------------------------------------------------------ */ /* Private variables -------------------------------------------------------- */ /* USER STRUCT BEGIN */ BUZZER_t buzzer; /* USER STRUCT END */ /* Private function --------------------------------------------------------- */ /* Exported functions ------------------------------------------------------- */ void Task_music(void *argument) { (void)argument; /* 未使用argument,消除警告 */ osDelay(MUSIC_INIT_DELAY); /* 延时一段时间再开启任务 */ /* USER CODE INIT BEGIN */ BUZZER_Init(&buzzer, BSP_PWM_BUZZER); /* USER CODE INIT END */ while (1) { /* USER CODE BEGIN */ // BUZZER_PlayMusic(&buzzer, MUSIC_RM); // BUZZER_Init(&buzzer, BSP_PWM_BUZZER); BSP_TIME_Delay_ms(1000); // 等待音乐播放完成 /* USER CODE END */ } }