main.c

来自「蓝牙LCD显示部分的原代码」· C语言 代码 · 共 52 行

C
52
字号
#include "dismgr.h"

#include <message.h>
#include <print.h>
#include <i2c.h>
#include <pio.h>

#include <stdlib.h>

static TaskData app_task;

static const char prompt1[] = "Cambridge";
static const char prompt2[] = "Silicon";
static const char prompt3[] = "Radio";
static const char prompt4[] = "** CSR **";
static void app_handler (Task task, MessageId id, Message message)
{
    if (id % 10 == 1)
    {
        DismgrScrollType t = DISMGR_SCROLL_TYPE_NONE;
        DismgrDisplayPrompt ((const ucs2char *) prompt1, sizeof (prompt1) / sizeof (prompt1[0]) - 1 /*- (t == DISMGR_SCROLL_TYPE_NONE ? 0 : 3)*/, 10, 94, TRUE, t);
    }
	else if (id % 10 == 2)
    {
        DismgrScrollType t = DISMGR_SCROLL_TYPE_NONE;
        DismgrDisplayPrompt ((const ucs2char *) prompt2, sizeof (prompt2) / sizeof (prompt2[0]) - 1 /*- (t == DISMGR_SCROLL_TYPE_NONE ? 0 : 3)*/, 10, 94, TRUE, t);
    }
	else if (id % 10 == 3)
    {
        DismgrScrollType t = DISMGR_SCROLL_TYPE_NONE;
        DismgrDisplayPrompt ((const ucs2char *) prompt3, sizeof (prompt3) / sizeof (prompt3[0]) - 1 /*- (t == DISMGR_SCROLL_TYPE_NONE ? 0 : 3)*/, 10, 94, TRUE, t);
    }
	else if (id % 10 == 4)
    {
        DismgrScrollType t = DISMGR_SCROLL_TYPE_NONE;
        DismgrDisplayPrompt ((const ucs2char *) prompt4, sizeof (prompt4) / sizeof (prompt4[0]) - 1 /*- (t == DISMGR_SCROLL_TYPE_NONE ? 0 : 3)*/, 10, 94, TRUE, t);
    }
	else id =0;

	MessageSendLater (&app_task, id + 1, NULL, 1500);
    
}

int main (void)
{
    app_task.handler = app_handler;
	DismgrInit ();
    MessageSendLater (&app_task, 1, NULL, 0);
    MessageLoop ();
    return 0;
}

⌨️ 快捷键说明

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