Configure timer with C function.


I use the following code to configure Arduino Decemila Timer 2.

//Timer2 Settings: Timer Prescaler /64,
  TCCR2B |= (1<<CS22);                    // turn on CS22 bit
  TCCR2B &= ~((1<<CS21) | (1<<CS20));     // turn off CS21 and CS20 bits  
// Use normal mode
  TCCR2A &= ~((1<<WGM21) | (1<<WGM20));   // turn off WGM21 and WGM20 bits
  TCCR2B &= ~(1<<WGM22);                  // turn off WGM22
// Use internal clock - external clock not used in Arduino
  ASSR |= (0<<AS2);
  TIMSK2 |= (1<<TOIE2) | (0<<OCIE2A);     //Timer2 Overflow Interrupt Enable  

Is there a solution with C function ? Or, should I create a library ?
Do you think that this is a good approch to use Timer 2 ?
thank you

I do not understand what you are trying to do, but maybe the MsTimer2 library can do what you want, or could easily be modified to do what you want?