基于一下内容:
STM32F103VET6
STM32Cube MX
Keil 5
用LED做一个基本功能的实现,主函数如下:
- int main(void)
- {
- /* USER CODE BEGIN 1 */
- OS_ERR err;
- /* USER CODE END 1 */
- /* MCU Configuration----------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
- /* Configure the system clock */
- SystemClock_Config();
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- /* USER CODE BEGIN 2 */
- CPU_Init();
- OSInit(&err);
-
- OSTaskCreate((OS_TCB *)&MyTaskTCB,
- (CPU_CHAR *)"MyTask",
- (OS_TASK_PTR)&MyTask,
- (void *)0,
- (OS_PRIO) STARTUP_TASK_PRIO,
- (CPU_STK *)&MyTaskStk[0],
- (CPU_STK_SIZE)STARTUP_TASK_STK_SIZE / 10,
- (CPU_STK_SIZE)STARTUP_TASK_STK_SIZE,
- (OS_MSG_QTY)0,
- (OS_TICK)0,
- (void *)0,
- (OS_OPT)(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR),
- (OS_ERR *)&err);
-
- OSStart(&err);
- /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- }
- /* USER CODE END 3 */
- }
复制代码
全部资料51hei下载地址:
STM32F103VET6-HAL-uCOS III.7z
(1.32 MB, 下载次数: 58)
|