Skip to content

Commit

Permalink
do not reinit timer when swapping handlers #49
Browse files Browse the repository at this point in the history
  • Loading branch information
SergNikitin committed May 18, 2014
1 parent 97d5e19 commit be1d853
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ void syncControlInterruptHadler(void) {
}

void enableSyncControl() {
timer0Init(&syncControlInterruptHadler);
installTimer0IntrHandler(&syncControlInterruptHadler);
}

void disableSyncControl() {
timer0Init(&emptyTimerIntrHandler);
installTimer0IntrHandler(&emptyTimerIntrHandler);
}
8 changes: 4 additions & 4 deletions firmware/SatStepperBegin/timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ interrupt void TMR0_Interrupt(void)
// PSCH:PSC is loaded with the value in the TDDRH:TDDR.
CpuTimer0Regs.TCR.bit.TRB = 1;

// Acknowledge interrupt to recieve more interrupts from PIE group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
ACKNOWLEDGE_ONE_MORE_INTERRUPT_FROM_GROUP(PIEACK_GROUP1);
}

interrupt void TMR1_Interrupt(void)
{
_tmr1Handler();
// CpuTimer1Regs.TCR.bit.TIF = 0;
CpuTimer1Regs.TCR.bit.TRB = 1;

// TINT1 is not part of any interrupt group, so it doesn't require
// acknowledgement
}
Expand Down Expand Up @@ -87,13 +87,13 @@ void timer1Init(_controlTimerInterruptHandler handler)
setTimerSettingsToDefaultByNum(1);
}

void swapTimer0IntrHandler(_controlTimerInterruptHandler handler) {
void installTimer0IntrHandler(_controlTimerInterruptHandler handler) {
if (handler != NULL) {
_tmr0Handler = handler;
}
}

void swapTimer1IntrHandler(_controlTimerInterruptHandler handler) {
void installTimer1IntrHandler(_controlTimerInterruptHandler handler) {
if (handler != NULL) {
_tmr1Handler = handler;
}
Expand Down

0 comments on commit be1d853

Please sign in to comment.