#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. Informatica9.6.1在Linux Red Hat 5.8上安装遇到的有关问题整理_3

    3.Repository Service启动后的页面编码问题 1)错误信息: 2)原因分析及解决步骤 原因分析: informatica产品安装背后AdminConsole的Code page默认为U ...

  2. C# winform打印总结 z

    http://blog.csdn.net/jing_xin/article/details/41444063 针对BEIYANG收据打印机 BTP-R580测试通过. 操作说明:http://www. ...

  3. AFNetWorking 使用记录

    1.从一个URL  GET数据 方法1: NSURL * url = [NSURL URLWithString:@"http://www.weather.com.cn/data/sk/101 ...

  4. 【转】linux下cpio命令使用

    转自:http://www.51testing.com/html/32/498132-816949.html 功能说明:备份文件. 补充说明:cpio是用来建立,还原备份档的工具程序,它可以加入,解开 ...

  5. Javascript兼容和CSS兼容总结

    javascript部分 1. document.form.item 问题问题:代码中存在 document.formName.item(“itemName”) 这样的语句,不能在FF下运行解决方法: ...

  6. (转)log4j:WARN No appenders could be found for logger 解决方案

    我们在使用Log4j的时候,总是出现: log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.Log ...

  7. Maven,预加载资源文件

    预加载资源文件需要先启用功能: <build> <resources> <resource> <directory>src/main/resources ...

  8. 解决“运行arm-linux-gcc命令,提示No such file or directory”的问题

    今天在ubuntu14.04上安装arm的交叉编译器arm-linux-gcc,环境变量配置好以后,运行arm-linux-gcc命令,总提示No such file or directory.然后去 ...

  9. [WebService]之DTD

    文档类型定义(DTD)可定义合法的XML文档构建模块.它使用一系列合法的元素来定义文档的结构.  DTD 可被成行地声明于 XML 文档中,也可作为一个外部引用. <?xml version=& ...

  10. 王家林的“云计算分布式大数据Hadoop实战高手之路---从零开始”的第十一讲Hadoop图文训练课程:MapReduce的原理机制和流程图剖析

    这一讲我们主要剖析MapReduce的原理机制和流程. “云计算分布式大数据Hadoop实战高手之路”之完整发布目录 云计算分布式大数据实战技术Hadoop交流群:312494188,每天都会在群中发 ...