// Cause the current task to return immediately void causeDeath() { printf("Causing death...\n"); INT8U return_code; killTask = TRUE; return_code = OSTimeDlyResume(0); // Cause sleep function to immediately resume if (return_code == OS_TIME_NOT_DLY) { printf("CauseDeath() returned OS_TIME_NOT_DLY\n"); } else if (return_code == OS_TASK_NOT_EXIST) { printf("CauseDeath() returned OS_TASK_NOT_EXIST\n"); } else if (return_code == OS_PRIO_INVALID) { printf("CauseDeath() returned OS_PRIO_INVALID\n"); } }
void Task_UART0TX(void *pdata){ INT8U err; INT32U Recv = 0; while(1){ Recv = (INT32U)OSMboxPend(Mbox_UART0Tx,0,&err); PackageTx0.iSave = 0x0; PackageTx0.iType = iOPcode; PackageTx0.iData = Recv; PackageTx0.iMagicNumber = MAGIC; sendbin0((INT8U*)&PackageTx0,sizeof(PackageFormat)); itos_dec(Recv,vBuffer,10); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)vBuffer); } }
void IRQ_BUTTON(void){ INT32U EINTPEND; delay(5); EINTPEND = rEINTPEND; rEINTPEND = rEINTPEND; rSRCPND = rINTPND; rINTPND = rINTPND; if (EINTPEND & (B8)) { iOPcode = TYPE_KEY; OSMboxPost(Mbox_LEDMAN,(void*)TYPE_KEY); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)" Register Key"); } else if (EINTPEND & (B11)) { iOPcode = TYPE_QUERY; OSMboxPost(Mbox_LEDMAN,(void*)TYPE_QUERY); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)" Query Status"); } else if (EINTPEND & (B13)) { iOPcode = TYPE_DEFAULT; OSMboxPost(Mbox_LEDMAN,(void*)TYPE_DEFAULT); OSMboxPost(Mbox_BEEPMAN,(void*)TYPE_BE_STOP); OSTimeDlyResume(15); } else if (EINTPEND & (B15)) { iOPcode = TYPE_INSERT; OSMboxPost(Mbox_LEDMAN,(void*)TYPE_INSERT); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)" New Record"); } else if (EINTPEND & (B14)) { OSMboxPost(Mbox_BEEPMAN,(void*)TYPE_BE_FAIL); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)"Invalid Operate"); } else if (EINTPEND & (B19)) { OSMboxPost(Mbox_BEEPMAN,(void*)TYPE_BE_FAIL); OSTimeDlyResume(15); OSMboxPost(Mbox_LCDMAN,(void*)"Invalid Operate"); } else{ } return; }