I've got this code from the MultiWii project, which is relevant to the hardware, ATmega32u4, I have. It is part of a function called initOutput()
.
In the comment it says "connect pin 6", which is the bit of that which specifies pin 6 as I would like to change it to another pin, specifically A0.
// Enhanced PWM mode
TCCR4E |= (1<<ENHC4);
// Prescaler to 16
TCCR4B &= ~(1<<CS41);
TCCR4B |= (1<<CS42) | (1<<CS40);
// Phase and frequency correct mode and top to 1023, but
// with enhanced PWM mode we have 2047.
TCCR4D |= (1<<WGM40);
TC4H = 0x3;
OCR4C = 0xFF;
// Connect pin 6 to timer 4 channel D
TCCR4C |= (1<<COM4D1) | (1<<PWM4D);