⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mgdrv-ucosii.c

📁 这是ARM嵌入式系统的实验教程中的MINIGUI的实验源代码!
💻 C
字号:
//====================================================================
// File Name : mgdrv-ucosii.c
//====================================================================
#include "common.h"
#include "minigui.h"
#include "gdi.h"
#include "window.h"
#include "ucos_ii.h"

/* --------------------- I/O functions -------------------------- */
// for debug purpose

/* Gets a char from uart */
BYTE drv_uart_get_byte (void)
{
    //...
    return(0);
}

/* Sends a char to uart */
void drv_uart_send_byte (BYTE ch)
{
    //...
}


/* ------------------- Application entry for uC/OS-II -------------- */
/* for reference only */

/*
 * main task of MiniGUI
 */
static void* mg_main_task (void* args)
{
    /*
     * Enter entry in MiniGUI library
     */
    minigui_entry (0, NULL);
    
    while(1)
    {   
        OSTimeDly (100);
    }

    return NULL;
}

/*
 * MiniGUI entry for uC/OS-II
 * You can call this function before you call OSStart.
 */
void minigui_app_entry (void)
{
    pthread_t main_thread;

    /*
     * Should initialize heap memory management module first
     * before using MiniGUI.
     */
    if (ucos2_malloc_init ()) {
        fprintf (stderr, "Can not init our own malloc implementation for uC/OS-II.\n");
        return;
    }
    /*
     * Should initialize POSIX thread module first
     * before using MiniGUI.
     */
    if (ucos2_posix_pthread_init ()) {
        fprintf (stderr, "Can not init our own pthread implementation for uC/OS-II.\n");
        return;
    }

    /*
     * Creating a independent thread for MiniGUI main task is a good idea.
     */
	pthread_create (&main_thread, NULL, mg_main_task, NULL);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -