晕,我自己在独立架构qst的系统.看看我的用户层。
#include "qst_system.h"
const char S_JSON_BARO_HEAD[]={"\"Baro\":["};
uint32_t t,json_pkg_t;
void setup(void)
{
ioMode(PB0,OUTPUT);
usbMode(0,0);
t = 0;
json_pkg_t=0;
}
void loop(void)
{
WEATHER_INFO_TYPE *w = (WEATHER_INFO_TYPE*)qstMessage(&BaroTskInfo);
if( compSystick(t) ){
if( ioRead(PB0)==LOW ){
ioWrite(PB0,HIGH);
t = msSystick()+10;
}else{
ioWrite(PB0,LOW);
t = msSystick()+990;
}
}
//
if( compSystick(json_pkg_t) ){
json_pkg_t = msSystick()+1000;
printf("]\r\n%s\r\n",S_JSON_BARO_HEAD);
}
if( w->update ){
printf("{\"t:\"%d,\"temp\":%d,\"press\":%d.%02d,\"alt\":%d}\r\n",w->t%10000,w->temp/100,w->press/100,w->press%100,w->altitude);
w->update = 0;
}
}
|