void main (void) { SET_MAX_WDT_DELAY; // we would have 2s at 12MHz, so using 40MHz will give 0,5s delay which should be enough lcd_init(); ENABLE_XRAM_1024; // TMOD is set globally here for both timers TMOD = 0x51; //Interrupt priorities //Timer1 - the highest system priority (level 3) IPL0 |= TIMER1_PRIORITY_BIT; IPH0 |= TIMER1_PRIORITY_BIT; // IPL0 |= PCA_PRIORITY_BIT; IPH0 |= PCA_PRIORITY_BIT; IPL0 |= EXTERNAL1_PRIORITY_BIT; IPH0 |= EXTERNAL1_PRIORITY_BIT; //Timer 2 (level 2) IPH0 |= TIMER2_PRIORITY_BIT; //Timer 0 (level 1) IPL0 |= TIMER0_PRIORITY_BIT; pwm_init(); pull_init(); menu_init_blinking(); keypad_init(); holo_search_init(); main_program_workloop(); }
retvalue pull_prepare(struct distribution *alldistributions, struct pull_rule *rules, bool fast, struct pull_distribution **pd) { struct pull_distribution *pulls; retvalue r; r = pull_init(&pulls, rules, alldistributions); if (RET_WAS_ERROR(r)) return r; r = pull_loadsourcedistributions(alldistributions, rules); if (RET_WAS_ERROR(r)) { pull_freedistributions(pulls); return r; } if (!fast) pull_searchunused(alldistributions, rules); r = pull_generatetargets(pulls); if (RET_WAS_ERROR(r)) { pull_freedistributions(pulls); return r; } *pd = pulls; return RET_OK; }