 }
 
 void setup() {
-	// Set output pins for LED display
+	// Enable output pins for LED display
 	for (int i=0; i<ARRAY_SIZE(pin_col); i++) {
 		pinMode(pin_col[i], OUTPUT);
 	}
 	pinMode(PIN_ROW_LATCH, OUTPUT);
 	pinMode(PIN_COL_LATCH, OUTPUT);
 
-	// Initialize serial
+	// Initialize serial and SPI
 	Serial.begin(19200);
-
-	// initialize SPI
 	SPI.begin();
-	Timer1.initialize(pwm_lengths[0]);
-	Timer1.attachInterrupt(driveDisplay);
+
+	// Timer magic
+	cli();
+	TCCR1A = 0; // Do not toggle pins
+	TCCR1B = (1 << CS11 | 1 << CS10); // Clock divider 64, 64/16e6 = 40µs cycle
+	TCCR1C = 0; // not forcing output compare
+	TCNT1 = 0; // set timer counter initial value (16 bit value)
+	TIMSK1 = 1 << OCIE1A; // enable timer compare match 1A interrupt
+	OCR1A = 1; // Go to the interrupt vector ASAP
+	sei();
 }
 
 void loop() {

uint8_t col_iter = 0; // Anti-ghosting 
uint8_t row_i = 0;
volatile uint8_t may_flip = 0;
int pwm_lengths[] = { 250, 100, 40 }; // microseconds per plane
int pwm_i = 0; // Current PWM cycle
uint8_t *buf_pwm = buf_a[0];


*/

#include <SPI.h>

// Helper functions. NB! ARRAY_SIZE doesn't check if it's an array.
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
