void Hacklace::initialize(void) { sync_flags = 0; current_column = 0; scroll_timer = 0; delay_counter = 0; button = 0; btn_mask = BTN_MASK; // i/o initialization DDRB = DDRB_INIT; PORTB = PORTB_INIT; DDRC = DDRC_INIT; PORTC = PORTC_INIT; #ifndef ENABLE_RUN_SLEEP_MONITOR DDRD = DDRD_INIT; #else DDRD = DDRD_INIT | (1<<3); #endif PORTD = PORTD_INIT; // timer1 initialization TCNT1 = 0; OCR1A = OCR1A_CYCLE_TIME; OCR1B = OCR1B_CYCLE_TIME; TCCR1A = 0; // timer mode = normal TCCR1B = (T1_PRESC<<CS10); // set prescaler TCCR1C = 0; TIFR1 = (1<<OCF1A)|(1<<OCF1B); // clear compare-match interrupt flags TIMSK1 = (1<<OCIE1A)|(1<<OCIE1B); // enable compare-match interrupts clearDisplay(); setBrightness(0); setSpacing(1); setScrollSpeed(7, 10); setScrollMode(FORWARD, 1); }
void Hacklace_AppEngine::nextApp() { // Switch to the next app as defined by the app_list in EEPROM. byte app_id; if (app) { app->finish(); } // finish old app clearDisplay(); setSpacing(1); setScrollSpeed(7, 7); setScrollMode(FORWARD, 1); app_id = eeprom_read_byte(ee_ptr++); // read new app_id app = getApp(app_id); // get pointer to app object if (app) { ee_ptr = app->setup(ee_ptr); } else { printString_P(PSTR("bad ID")); } app_id = eeprom_read_byte(ee_ptr); // peek next app_id if (app_id == END_OF_LIST) { // end of list? ee_ptr = EE_START_ADDR; // -> restart from beginning } }