//******** Producer *************** // The Producer in this lab will be called from your ADC ISR // A timer runs at 1 kHz, started by your ADC_Collect // The timer triggers the ADC, creating the 1 kHz sampling // Your ADC ISR runs when ADC data is ready // Your ADC ISR calls this function with a 10-bit sample // sends data to the consumer, runs periodically at 1 kHz // inputs: none // outputs: none void Producer(unsigned short data){ if(NumSamples < RUNLENGTH){ // finite time run NumSamples++; // number of samples if(OS_Fifo_Put(data) == 0){ // send to consumer DataLost++; } } }
//******** Producer *************** // The Producer in this lab will be called from your ADC ISR // A timer runs at 1 kHz, started by your ADC_Collect // The timer triggers the ADC, creating the 1 kHz sampling // Your ADC ISR runs when ADC data is ready // Your ADC ISR calls this function with a 10-bit sample // sends data to the Robot, runs periodically at 1 kHz // inputs: none // outputs: none void Producer(unsigned short data){ if(Running){ if(OS_Fifo_Put(data)){ // send to Robot NumSamples++; } else{ DataLost++; } } }