In a task:
#ifdef Task_Logging
/// Indicate to "black box" what happened.
Log_Task(105); //< BlackBox.c
#endif
The logger:
// Task log with optional timestamps using T2
// T2 is initted along with T0
// in peripherals.c
//
// GENERALLY, tasks don't log unless they execute, but this is
determined by where
// the logging call is inserted. Normally the logging call should be
inserted after
// all the conditions to run the task have been met, but before the
task actually runs.
// You may want to push the logging ahead, so you can see who gets
called, but that will
// fill the buffer very quickly.
//
#ifdef Task_Logging
void Log_Task(uint8_t Task_Code){
Task_History[Task_History_Index++] = Task_Code;
if ((Task_History_Len - 1) < Task_History_Index) {
Task_History_Index = 0;
}
#ifdef Log_Timestamp
// Optionally, log a timestamp too
Task_History[Task_History_Index++] = TCNT2; //Int_Counter;
if ((Task_History_Len - 1) < Task_History_Index) {
Task_History_Index = 0;
}
#endif
}
#endif
The buffer it goesinta and its pointer.
#ifdef Task_Logging
// Write-only circular buffer showing tasks
uint8_t Task_History[Task_History_Len];
uint8_t Task_History_Index;
#endif
--
There is no computer problem which cannot be solved by proper
application of a sufficiently large hammer.Message
Re: [AVR-Chat] WatchDog Timer
2009-07-21 by David VanHorn
Attachments
- No local attachments were found for this message.