void Keyb_Task(void) { char text[320]; uint8_t key = 0; while(1) { if(!OSQueuePend(qKeyboard, &key, 0)) { switch(key) { case LEFT_KEY: // Block LED RGB task UARTPutString(UART0_BASE, "Botão Esquerdo pressionado!\n\r"); OSAvailableMemory(text); UARTPutString(UART0_BASE, text); OSCPULoad(text); UARTPutString(UART0_BASE, text); UARTPutString(UART0_BASE, "\n\r"); break; case RIGHT_KEY: // UnBlock LED RGB task UARTPutString(UART0_BASE, "Botão Direito pressionado!\n\r"); OSUptimeInfo(text); UARTPutString(UART0_BASE, text); UARTPutString(UART0_BASE, "\n\r"); break; case BOTH_KEY: UARTPutString(UART0_BASE, "Ambos os botões pressionados!\n\r"); OSTaskList(text); UARTPutString(UART0_BASE, text); UARTPutString(UART0_BASE, "\n\r"); break; default: break; } } } }
void Task_Serial(void) { /* task setup */ INT8U pedido = 0; strcpy_P(BufferText, (PGM_P)pgm_read_word(&(BRTOSStringTable[0]))); Serial_Envia_Frase((CHAR8*)BufferText); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); // task main loop for (;;) { if(!OSQueuePend(Serial, &pedido, 0)) { switch(pedido) { #if (COMPUTES_CPU_LOAD == 1) case '1': Transmite_CPU_Load(); //OSCPULoad(BufferTextDebug); //Serial_Envia_Frase((CHAR8*)BufferTextDebug); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); break; #endif case '2': Transmite_Uptime(); //OSUptimeInfo(BufferTextDebug); //Serial_Envia_Frase((CHAR8*)BufferTextDebug); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); break; case '3': strcpy_P(BufferText, (PGM_P)pgm_read_word(&(BRTOSStringTable[0]))); Serial_Envia_Frase((CHAR8*)BufferText); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); break; case '4': //Transmite_RAM_Ocupada(); OSAvailableMemory(BufferTextDebug); Serial_Envia_Frase((CHAR8*)BufferTextDebug); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); break; case '5': Transmite_Task_Stacks(); //OSTaskList(BufferTextDebug); //Serial_Envia_Frase((CHAR8*)BufferTextDebug); Serial_Envia_Caracter(10); Serial_Envia_Caracter(13); break; #if (OSTRACE == 1) case '6': Send_OSTrace(); Serial_Envia_Caracter(LF); Serial_Envia_Caracter(CR); break; #endif default: Serial_Envia_Caracter(pedido); break; } } } }