#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__) || defined (__AVR_ATmega8__)
#if defined (__AVR_ATmega8__) || \
defined(__AVR_ATmega48__)|| \
defined(__AVR_ATmega48P__)|| \
defined(__AVR_ATmega88__)|| \
defined(__AVR_ATmega88P__)|| \
defined(__AVR_ATmega168__)|| \
defined(__AVR_ATmega168P__)|| \
defined(__AVR_ATmega328__)|| \
defined(__AVR_ATmega328P__)|| \
defined(__AVR_ATmega1280__)|| \
defined(__AVR_ATmega2560__)
# if F_CPU < CUTOFF(8)
# if F_CPU < CUTOFF(8)
# define FASTPRESCALER (_BV(CS20)) // 1
# define FASTPRESCALER (_BV(CS20)) // 1
# define SLOWPRESCALER (_BV(CS21)) // 8
# define SLOWPRESCALER (_BV(CS21)) // 8
@ -848,9 +858,19 @@ ISR(TIMER1_COMPA_vect) {
// NOTE: a "plane" in the Borgware is the same as a "page" in Jimmie's lib
// NOTE: a "plane" in the Borgware is the same as a "page" in Jimmie's lib
staticuint8_tplane=0;
staticuint8_tplane=0;
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
#if defined (__AVR_ATmega48__) || \
defined(__AVR_ATmega48P__)|| \
defined(__AVR_ATmega88__)|| \
defined(__AVR_ATmega88P__)|| \
defined(__AVR_ATmega168__)|| \
defined(__AVR_ATmega168P__)|| \
defined(__AVR_ATmega328__)|| \
defined(__AVR_ATmega328P__)|| \
defined(__AVR_ATmega1280__)|| \
defined(__AVR_ATmega2560__)
TCCR2B=prescaler[plane];
TCCR2B=prescaler[plane];
#elif defined (__AVR_ATmega8__) || defined (__AVR_ATmega128__)
#elif defined (__AVR_ATmega8__) \
defined(__AVR_ATmega128__)
TCCR2=prescaler[page];
TCCR2=prescaler[page];
#elif defined (__AVR_ATmega32U4__)
#elif defined (__AVR_ATmega32U4__)
TCCR1B=prescaler[plane];
TCCR1B=prescaler[plane];
@ -876,7 +896,16 @@ ISR(TIMER1_COMPA_vect) {
voidborg_hw_init(){
voidborg_hw_init(){
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
#if defined (__AVR_ATmega48__) || \
defined(__AVR_ATmega48P__)|| \
defined(__AVR_ATmega88__)|| \
defined(__AVR_ATmega88P__)|| \
defined(__AVR_ATmega168__)|| \
defined(__AVR_ATmega168P__)|| \
defined(__AVR_ATmega328__)|| \
defined(__AVR_ATmega328P__)|| \
defined(__AVR_ATmega1280__)|| \
defined(__AVR_ATmega2560__)
TIMSK2&=~(_BV(TOIE2)|_BV(OCIE2A));
TIMSK2&=~(_BV(TOIE2)|_BV(OCIE2A));
TCCR2A&=~(_BV(WGM21)|_BV(WGM20));
TCCR2A&=~(_BV(WGM21)|_BV(WGM20));
TCCR2B&=~_BV(WGM22);
TCCR2B&=~_BV(WGM22);
@ -899,10 +928,20 @@ void borg_hw_init() {
setBrightness();
setBrightness();
// Then start the display
// Then start the display
#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega48__) || defined (__AVR_ATmega88__) || defined (__AVR_ATmega328P__) || defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
#if defined (__AVR_ATmega48__) || \
defined(__AVR_ATmega48P__)|| \
defined(__AVR_ATmega88__)|| \
defined(__AVR_ATmega88P__)|| \
defined(__AVR_ATmega168__)|| \
defined(__AVR_ATmega168P__)|| \
defined(__AVR_ATmega328__)|| \
defined(__AVR_ATmega328P__)|| \
defined(__AVR_ATmega1280__)|| \
defined(__AVR_ATmega2560__)
TIMSK2|=_BV(TOIE2);
TIMSK2|=_BV(TOIE2);
TCCR2B=FASTPRESCALER;
TCCR2B=FASTPRESCALER;
#elif defined (__AVR_ATmega8__) || defined (__AVR_ATmega128__)