void LogDebugInfo(void * Parameters) { while(1){ logDebugInfo(); vTaskDelay(1000); } }
/* * TIM5_IRQHandler - The interrupt handler for timer 5. There are 3 possible * interrupt channels. * * Inputs: None * Outputs: None * Modifies: None */ void TIM5_IRQHandler(void) { // Channel 1 is the interrupt for the logDebugInfo() function if (TIM_GetITStatus(TIM5, TIM_IT_CC1) != RESET) { // Clear the IRQ TIM_ClearITPendingBit(TIM5, TIM_IT_CC1); logDebugInfo(); /* * This function is supposed to happen "whenever there's time," so * it can just repeat once a second. */ // Channel 2 is the interrupt handler for the red LED } else if (TIM_GetITStatus(TIM5, TIM_IT_CC2) != RESET) { // Clear the IRQ TIM_ClearITPendingBit(TIM5, TIM_IT_CC2); // Toggle the red LED GPIO_WriteBit(GPIOB, GPIO_Pin_4, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOB, GPIO_Pin_4)); // The red LED flashes at a frequency of 0.5 Hz, which means it needs // to toggle every second. Don't reset the compare register. // Channel 3 is the interrupt handler for the green LED } else {
void vTaskLogDebugInfo(void *pvParameters) { // Initialize delay wake time portTickType wakeTime; portTickType frequency = 1000; wakeTime = xTaskGetTickCount(); // Execute & delay while(1){ logDebugInfo(); vTaskDelayUntil(&wakeTime, frequency); } }