Merged Thomas' comments.
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
* \file pwm_timer.c
|
||||
* \brief Controls the actual PWM-output.
|
||||
* \author Thomas Stegemann
|
||||
* \version $Id: pwm_timer.c,v 1.1 2006/09/26 18:18:27 rschaten Exp $
|
||||
* \version $Id: pwm_timer.c,v 1.2 2006/09/29 22:30:03 rschaten Exp $
|
||||
*
|
||||
* License: See documentation.
|
||||
*/
|
||||
@ -106,7 +106,14 @@ SIGNAL(SIG_OUTPUT_COMPARE1A) {
|
||||
sei();
|
||||
do {
|
||||
if((m_data.step == pwm_Channels_StepCounter_Max) || (m_data.currentCycle == pwm_Timer_Cycles_Max)) {
|
||||
/* end of current cycle reached*/
|
||||
if(m_data.readDone) {
|
||||
/*
|
||||
message received
|
||||
start a new cycle with the new values
|
||||
swap active message and message for reading
|
||||
message for reading is free for further messages from queue
|
||||
*/
|
||||
pwm_Channels_Message* pSwap= m_data.pActive;
|
||||
m_data.pActive= m_data.pRead;
|
||||
m_data.pRead= pSwap;
|
||||
@ -115,14 +122,14 @@ SIGNAL(SIG_OUTPUT_COMPARE1A) {
|
||||
m_data.step= 0;
|
||||
sleep= 0;
|
||||
} else {
|
||||
/* error could not read a new channels message in a whole cycle */
|
||||
/* wait a complete cycle for the next message */
|
||||
//sleep= pwm_Timer_Cycles_Max;
|
||||
/* could not read a new channels message in a whole cycle */
|
||||
/* restart the cycle with the old values */
|
||||
m_data.currentCycle= 0;
|
||||
m_data.step= 0;
|
||||
sleep= 0;
|
||||
}
|
||||
} else {
|
||||
/* process current step, go to next step */
|
||||
pwm_Timer_switchLed(m_data.pActive->step[m_data.step].field);
|
||||
sleep= m_data.pActive->step[m_data.step].cycle - m_data.currentCycle;
|
||||
m_data.currentCycle= m_data.pActive->step[m_data.step].cycle;
|
||||
@ -131,6 +138,9 @@ SIGNAL(SIG_OUTPUT_COMPARE1A) {
|
||||
} while(pwm_Timer_sleep(sleep));
|
||||
|
||||
if(!m_data.readDone && (sleep > pwm_Timer_Cycles_ReadMin)) {
|
||||
/*
|
||||
free space for reading and enough time to read: try to read
|
||||
*/
|
||||
if(messageQueue_read(m_data.pRead)) {
|
||||
m_data.readDone= True;
|
||||
}
|
||||
|
Reference in New Issue
Block a user