yan zhang
/
NB_CLOCK_180505
clock
main.cpp@3:b8766d623f01, 2018-05-22 (annotated)
- Committer:
- donghuoyinzi
- Date:
- Tue May 22 09:10:05 2018 +0000
- Revision:
- 3:b8766d623f01
- Parent:
- 2:e54d9d87c6cb
0522
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donghuoyinzi | 0:17e9016529cf | 1 | #include "main.h" |
donghuoyinzi | 0:17e9016529cf | 2 | |
donghuoyinzi | 0:17e9016529cf | 3 | /******************************* |
donghuoyinzi | 0:17e9016529cf | 4 | Fun.:Desc.:whattime/where runing |
donghuoyinzi | 0:17e9016529cf | 5 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 6 | Auth. Date.:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 7 | *******************************/ |
donghuoyinzi | 0:17e9016529cf | 8 | int main() |
donghuoyinzi | 0:17e9016529cf | 9 | { |
donghuoyinzi | 3:b8766d623f01 | 10 | //tm *tim; |
donghuoyinzi | 3:b8766d623f01 | 11 | //string strx,stry, strz; |
donghuoyinzi | 3:b8766d623f01 | 12 | //int n,f; |
donghuoyinzi | 0:17e9016529cf | 13 | |
donghuoyinzi | 3:b8766d623f01 | 14 | //f401Act::init(); //映射平台初始化 |
donghuoyinzi | 0:17e9016529cf | 15 | |
donghuoyinzi | 0:17e9016529cf | 16 | maiAct::init_scorp(); //增强硬件初始化 |
donghuoyinzi | 0:17e9016529cf | 17 | |
donghuoyinzi | 3:b8766d623f01 | 18 | //f401Act::put_rwdg(); //Refresh iwdg |
donghuoyinzi | 0:17e9016529cf | 19 | |
donghuoyinzi | 0:17e9016529cf | 20 | maiAct::init_dat(); //data initialization |
donghuoyinzi | 0:17e9016529cf | 21 | maiAct::init_star(); //start initialization |
donghuoyinzi | 0:17e9016529cf | 22 | |
donghuoyinzi | 3:b8766d623f01 | 23 | while(1){ |
donghuoyinzi | 3:b8766d623f01 | 24 | if(know::polSta[46]=='1'){ //state of tick2S |
donghuoyinzi | 3:b8766d623f01 | 25 | //time_t seconds=time(NULL); |
donghuoyinzi | 3:b8766d623f01 | 26 | //tim=localtime(&seconds); |
donghuoyinzi | 0:17e9016529cf | 27 | |
donghuoyinzi | 3:b8766d623f01 | 28 | //strx=know::task[0]; |
donghuoyinzi | 3:b8766d623f01 | 29 | //stry=strx.substr(13,12); //提取时间,从索引13开始12个字符 |
donghuoyinzi | 0:17e9016529cf | 30 | //strz="yymmddhh"+to_string(tim->tm_min)+"ss"; |
donghuoyinzi | 3:b8766d623f01 | 31 | //if(stry == strz){ //bc95动作 |
donghuoyinzi | 3:b8766d623f01 | 32 | //know::polDat[1]= tim->tm_hour; |
donghuoyinzi | 3:b8766d623f01 | 33 | //know::polDat[2]= tim->tm_min; |
donghuoyinzi | 3:b8766d623f01 | 34 | //know::polDat[3]= tim->tm_sec; |
donghuoyinzi | 0:17e9016529cf | 35 | |
donghuoyinzi | 0:17e9016529cf | 36 | bc95Act:: put(); |
donghuoyinzi | 3:b8766d623f01 | 37 | //} |
donghuoyinzi | 3:b8766d623f01 | 38 | if(know::polSta[16]=='1'&& know::polSta[15]=='0') bc95Act::get_knw(); // puts, getknwS |
donghuoyinzi | 3:b8766d623f01 | 39 | if(know::polSta[15]=='1'&& know::polSta[18]=='0') bc95Act::setrtc(); // setrtcS私有 |
donghuoyinzi | 3:b8766d623f01 | 40 | if(know::polSta[18]=='1'&& know::polSta[0]=='0') knowAct::buildtsk(); // buildtskS |
donghuoyinzi | 0:17e9016529cf | 41 | |
donghuoyinzi | 3:b8766d623f01 | 42 | //n=0; |
donghuoyinzi | 3:b8766d623f01 | 43 | //f=1; |
donghuoyinzi | 3:b8766d623f01 | 44 | //while(f==1){ |
donghuoyinzi | 3:b8766d623f01 | 45 | //n++; |
donghuoyinzi | 3:b8766d623f01 | 46 | //strx=know::task[n]; |
donghuoyinzi | 3:b8766d623f01 | 47 | //stry= strx.substr(13,12); //提取时间,从索引13开始12个字符 |
donghuoyinzi | 0:17e9016529cf | 48 | //strz= "yymmdd"+ to_string (tim->tm_hour)+to_string (tim->tm_min)+"ss"; |
donghuoyinzi | 3:b8766d623f01 | 49 | //if(stry == strz){ |
donghuoyinzi | 3:b8766d623f01 | 50 | //stry= strx. substr(12,2); //提取语音编号 |
donghuoyinzi | 0:17e9016529cf | 51 | //播放 |
donghuoyinzi | 3:b8766d623f01 | 52 | //f=0; |
donghuoyinzi | 3:b8766d623f01 | 53 | //} |
donghuoyinzi | 3:b8766d623f01 | 54 | //} |
donghuoyinzi | 0:17e9016529cf | 55 | } |
donghuoyinzi | 0:17e9016529cf | 56 | //f401Act::sys_sleepy(); //cpu sleep |
donghuoyinzi | 0:17e9016529cf | 57 | } |
donghuoyinzi | 0:17e9016529cf | 58 | } |
donghuoyinzi | 0:17e9016529cf | 59 | |
donghuoyinzi | 0:17e9016529cf | 60 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 61 | Fun.: initialization of scorp。 |
donghuoyinzi | 0:17e9016529cf | 62 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 63 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 64 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 65 | void maiAct::init_scorp(void) |
donghuoyinzi | 0:17e9016529cf | 66 | { |
donghuoyinzi | 0:17e9016529cf | 67 | bc95Act::init(); //基础初始化 |
donghuoyinzi | 0:17e9016529cf | 68 | cloDAct::init(); |
donghuoyinzi | 0:17e9016529cf | 69 | cloSAct::init(); |
donghuoyinzi | 0:17e9016529cf | 70 | } |
donghuoyinzi | 0:17e9016529cf | 71 | |
donghuoyinzi | 0:17e9016529cf | 72 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 73 | Fun.: initialization. of data |
donghuoyinzi | 0:17e9016529cf | 74 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 75 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 76 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 77 | void maiAct::init_dat(void) |
donghuoyinzi | 0:17e9016529cf | 78 | { |
donghuoyinzi | 0:17e9016529cf | 79 | bc95Act::data(); //基础初始化 |
donghuoyinzi | 0:17e9016529cf | 80 | } |
donghuoyinzi | 0:17e9016529cf | 81 | |
donghuoyinzi | 0:17e9016529cf | 82 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 83 | Fun.: initialization of ready。 |
donghuoyinzi | 0:17e9016529cf | 84 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 85 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 86 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 87 | void maiAct::init_ready(void) |
donghuoyinzi | 0:17e9016529cf | 88 | { |
donghuoyinzi | 0:17e9016529cf | 89 | set_time(1514806505);//自1970年1月1日0时0分0秒到2018年1月1日11时35分05秒 |
donghuoyinzi | 0:17e9016529cf | 90 | |
donghuoyinzi | 0:17e9016529cf | 91 | f401Act::ready(); |
donghuoyinzi | 3:b8766d623f01 | 92 | cloDAct::ready(); |
donghuoyinzi | 0:17e9016529cf | 93 | cloSAct::ready(); |
donghuoyinzi | 0:17e9016529cf | 94 | } |
donghuoyinzi | 0:17e9016529cf | 95 | |
donghuoyinzi | 0:17e9016529cf | 96 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 97 | Fun.: initialization of start。 |
donghuoyinzi | 0:17e9016529cf | 98 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 99 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 100 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 101 | void maiAct::init_star(void) |
donghuoyinzi | 0:17e9016529cf | 102 | { |
donghuoyinzi | 0:17e9016529cf | 103 | |
donghuoyinzi | 0:17e9016529cf | 104 | } |
donghuoyinzi | 0:17e9016529cf | 105 | |
donghuoyinzi | 0:17e9016529cf | 106 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 107 | Fun.: Seep judge。 |
donghuoyinzi | 0:17e9016529cf | 108 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 109 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 110 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 111 | void maiAct::judg_sleep(void) |
donghuoyinzi | 0:17e9016529cf | 112 | { |
donghuoyinzi | 0:17e9016529cf | 113 | //if(all Flag==0) deepsleep(); |
donghuoyinzi | 0:17e9016529cf | 114 | } |