Example #1
0
int main()
{
	// set a default image to the display
	char smiley[] = {0x00, 0x04, 0x42, 0x02, 0x02, 0x42, 0x04, 0x00};
	char full[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

	// initialize for shift registers
	initializeShift();

	// set the clock pre-scaler value to 1
	CLKPR = 0x80; 
	CLKPR = 0x00;

	USARTInit();

	// initialize interrupts and timer0
	sei();
	timer8_enable_int();
	timer8_init(REFRESH_CYCLE_COUNT, CLOCK_SCALE_1024);
	timer8_start();

	// so we can see what's happening
	setFrame(full);

	// wait for everything to initialize.
	// UART likes to tick a bit (4x) at first sometimes
	_delay_ms(1000);
	
	// reinitialize the starting point to 0
	line = 0;
	
	setFrame(smiley);

	while(1);
}
Example #2
0
static void timer8_clock_event_start(struct timer8_priv *p, unsigned long delta)
{
	struct clock_event_device *ced = &p->ced;

	timer8_start(p);

	ced->shift = 32;
	ced->mult = div_sc(p->rate, NSEC_PER_SEC, ced->shift);
	ced->max_delta_ns = clockevent_delta2ns(0xffff, ced);
	ced->min_delta_ns = clockevent_delta2ns(0x0001, ced);

	timer8_set_next(p, delta);
}