C-kod. Bit-hantering. Vad gör koden?
Begriper inte detta...
Parametern _ucWGM120 är från en enum och satt till värdet 4 i detta fall.
Vad gör modulus-operatorn i praktiken här? Jag kan definitionen för modulus men de använder den här av en anledning och jag är blind idag.
Kan säga att koden är avsedd för en IAR men jag ska porta den till gcc (Atmel studio).
TCCR1B_WGM13 är ett macro kan man säga. WGM13 är en bit i TCCR1B....
void TC1_setWaveformGenerationMode(eTC1_wgm _ucWGM120)
{
unsigned char ucWGM120 = _ucWGM120;
TCCR1B_WGM13 = ucWGM120/8;
ucWGM120 = ucWGM120%8;
TCCR1B_WGM12 = ucWGM120/4;
ucWGM120 = ucWGM120%4;
TCCR1A_WGM11 = ucWGM120/2;
ucWGM120 = ucWGM120%2;
TCCR1A_WGM10 = ucWGM120;
}