int main( void ) { bsp_gpio_init(); bsp_temp_init(); bsp_serial_init(NULL); while (1) { LED_Toggle(); delay_ms(100); printf("chip temperature : %.2f degC\r\n", TEMP_GetTemperature()); } }
void TEMP_TaskMain (void * pvParams) { // Declare a tick type to get the last tick TickType_t xLastWakeTime = xTaskGetTickCount(); // Command to be sent to the comm task COMM_Command_t cmd; // Main loop of the task while(true) { cmd = COMM_SEND_TEMP; if (!TEMP_GetTemperature(&TEMP_Value)) { Serial.println("TEMP : Error reading temperature"); } else { // DEBUG_Print("TEMP : Current temperature is "); // DEBUG_Print(TEMP_Value); // DEBUG_Println("°C"); // Tell the COMM task to send the value to the DB xQueueSend(COMM_CommandQueue, &cmd, 0); } // Wait for a delay of 2s vTaskDelayUntil(&xLastWakeTime, (30000 / portTICK_PERIOD_MS)); } }