#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. Mysql 数据库文件存储在哪个目录

    也就是说我在mysql里建了一个叫 ac 的数据库,但是我找不到其存储位置,Mysql里面的数据库是怎么存储的,是否也像sqlserver 那样,有一个日志文件和数据文件? mysql数据库在系统上是 ...

  2. OpenLayers调用arcgis server发布的地图服务

    有两种方式可以调用arcgis server发布的地图服务,一种是rest,一种是wms.  地图的投影为900913,arcgis server为10.0版本,地图服务的空间参考为3857.   与 ...

  3. MSSQL 查询分组前N条记录

    sql语句中,查询分组中前n条记录的sql语句如下 第一种方法 select * from consultingfeebill awhere n>(select count(*) from co ...

  4. 10分钟搞定react-router

    1.路由的安装: $ npm install -S react-router 2.引入路由文件 import {Router, Route, browserHistory} from 'react-r ...

  5. DHCP工作过程详解

    DHCP动态主机配置协议的作用我想作为网管的兄弟们都应该知道了,这里我就不多废话了,今天我要谈的是DHCP的工作过程,了解了工作过程,要排除故障就容易了.   一.DHCP客户机初始化: 1. 寻找D ...

  6. CString-int-string-char-BSTR之间的转换

    一.CString, int, string, char*之间的转换 string 转 CString CString.Format("%s", string.c_str());c ...

  7. 【原创译文】基于Docker和Rancher的超融合容器云架构

    基于Docker和Rancher的超融合容器云架构 ---来自Rancher和Redapt 超融合架构在现代数据中心是一项巨大的变革.Nutanix公司发明了超融合架构理论,自从我听说他们的“iPho ...

  8. JS认证Exchange

    function ExchangeLogin() { vstrServer='<%=LocationUrl %>' vstrDomain = '<%=userLogin.AD %&g ...

  9. openstack-dbs

    真正的服务器派生出线程 和子进程处理多个连接当允许客户端加入聊天室,他发送的任何一条文本都将广播给聊天室中的每个用户,除非文本是服务器CLI当广播一条消息,消息前面将加上发送者的昵称 以尖括号括住昵称 ...

  10. HD1046An Easy Task

    Problem Description Ignatius was born in a leap year, so he want to know when he could hold his birt ...