#include <stdint.h>

    #include "bsp-fifisdr.h"

    #include "lpclib.h"
#include "task-gui.h" #define GUI_QUEUE_LENGTH (4) typedef struct {
uint8_t opcode;
} GUI_Message; /** Message opcodes for GUI task. */
enum {
GUI_OPCODE_LED_TICK,
}; /** Identifiers for OS timers. */
enum {
GUI_TIMERMAGIC_LED,
}; /** Local task context. */
static struct {
osMailQId queue;
osTimerId ledTick;
int led;
} gui; static void GUI_osalCallback (void const *pArgument)
{
(void) pArgument; if (gui.queue == NULL) {
return;
} GUI_Message *pMessage = osMailAlloc(gui.queue, ); if (pMessage == NULL) {
return;
} pMessage->opcode = GUI_OPCODE_LED_TICK;
osMailPut(gui.queue, pMessage);
} osMailQDef(guiQueue, GUI_QUEUE_LENGTH, GUI_Message);
osTimerDef(led, GUI_osalCallback); void GUI_task (const void *pArgs)
{
(void) pArgs;
GUI_Message *pMessage;
osEvent event; gui.queue = osMailCreate(osMailQ(guiQueue), NULL); gui.ledTick = osTimerCreate(osTimer(led), osTimerPeriodic, (void *)GUI_TIMERMAGIC_LED);
osTimerStart(gui.ledTick, ); while () {
/* Is there a new message? */
event = osMailGet(gui.queue, osWaitForever);
if (event.status == osEventMail) {
pMessage = (GUI_Message *)event.value.p;
switch (pMessage->opcode) {
case GUI_OPCODE_LED_TICK:
gui.led = gui.led ^ ;
BSP_setLed(gui.led);
break;
} osMailFree(gui.queue, pMessage);
}
}
}

CMSIS Example - Mail and Timer的更多相关文章

  1. CMSIS Example - Mail and Message

    /*---------------------------------------------------------------------------- * RL-ARM - RTX *----- ...

  2. 利用windows服务+timer或者windows任务计划程序+控制台进行进行每日邮件推送

    1.邮件发送代码 using System.Text; using System.Net; using System.Net.Mail; using System.Reflection; using ...

  3. CMSIS OS None

    /* ---------------------------------------------------------------------- * Copyright (C) 2011 ARM L ...

  4. CMSIS RTOS -- embOS segger

    #ifndef __CMSIS_OS_H__ #define __CMSIS_OS_H__ #include <stdint.h> #include <stddef.h> #i ...

  5. 几种任务调度的 Java 实现方法与比较Timer,ScheduledExecutor,Quartz,JCronTab

    几种任务调度的 Java 实现方法与比较 综观目前的 Web 应用,多数应用都具备任务调度的功能.本文由浅入深介绍了几种任务调度的 Java 实现方法,包括 Timer,Scheduler, Quar ...

  6. Python撰写mail

    版本1   指定邮箱进行发送 """ 说明:指定账户密码进行邮件发送 由312051952@qq.com-->c4kaichen@163.com "&qu ...

  7. Linux 定时任务 crontab 和 Systemd Timer

    一.说说八卦 ​ 说到定时任务,我们常用的就是 crond 服务,但是我们不知道还有另外一种定时方式,那就是 systemd,我们常用 systemd 来管理我们的服务,但是我们却不知道,我们还可以通 ...

  8. SysTick Software Timer

    #ifndef __SYSTEM_H__ #define __SYSTEM_H__ #include <stdint.h> #include <stddef.h> #inclu ...

  9. C++ Timer

    Timer机制 这里所说的Timer机制是定时器(Timer),例如在Javascript中就提供定时执行代码的功能.但是在C++标准中暂时没有实现这一功能的函数. Javascript中的Timer ...

随机推荐

  1. [转] C#中的Dictionary的使用

    txw1958 的 原文 说明    必须包含名空间System.Collection.Generic     Dictionary里面的每一个元素都是一个键值对(由二个元素组成:键和值)     键 ...

  2. @Component @Repository @Service @Controller

    Spring 2.5 中除了提供 @Component 注释外,还定义了几个拥有特殊语义的注释,它们分别是:@Repository.@Service 和 @Controller.在目前的 Spring ...

  3. delphi 中 image 控件加载bmp、JPG、GIF、PNG等图片的办法

    procedure TForm1.Button1Click(Sender: TObject);var  jpg: TJPEGImage; // 要use Jpeg单元begin  // 显示jpg大图 ...

  4. 类 .xml

    pre{ line-height:1; color:#1e1e1e; background-color:#d2d2d2; font-size:16px;}.sysFunc{color:#627cf6; ...

  5. Python在centos下的安装

    1.wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz默认下载到主目录下 2.tar xzf Python-2.6.6.tgz 3 ...

  6. Embedded之memory type

    1 Types of memory 2 Characteristics

  7. 编译python3

    安装环境 yum install gcc yum install zlib-devel yum install make 下载python版本 wget http://www.python.org/f ...

  8. Hadoop构成

    What Is Apache Hadoop? The Apache™ Hadoop® project develops open-source software for reliable, scala ...

  9. 您的IP不在有效范围 ip:port为 [10.15.22.15]

  10. 使用python获得git中分支存成list

    通过这个搜集git工程下的branch信息例子,来说明一下python和终端的信息交互,和字符串的简单处理.代码如下: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ...