 /* -*- mode: c++; c-file-style: "linux" -*-
   Telepulssi TP-KN10 slave LED screen driver
 */
-
-#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]))

	// it down.
	digitalWrite(PIN_COL_LATCH, LOW);
	
	// Send new data via SPI. Don't need to wait it to complete
	// because it completes before the next timer interrupt.
	SPDR = buf_front[pwm_i][8*row_i+col_i];
}


unsigned int byte_i;
uint8_t bit_i;

inline static void try_buf_swap(void);
inline static void frame_store(uint8_t intensity);
inline static void set_pixel(uint8_t *plane);
static void screen_on(void);
inline static void pick_column(void);
static void try_drive_screen(void);

inline static void try_buf_swap(void) {
	if (!may_flip) return;
	uint8_t (*tmp)[56] = buf_front;
	buf_front = buf_back;
	buf_back = tmp;
	Serial.write('S');
	may_flip = 0;
}

void setup() {
