// turn off GIs for a time void no_gi_twosec_leff (void) { gi_leff_allocate (PINIO_GI_STRINGS); gi_leff_disable (PINIO_GI_STRINGS); task_sleep_sec (2); gi_leff_enable (PINIO_GI_STRINGS); gi_leff_free (PINIO_GI_STRINGS); leff_exit (); }// end of function
void turn_off_gi_leff (void) { gi_leff_allocate (PINIO_GI_STRINGS); while (gi_off) { gi_leff_disable (PINIO_GI_STRINGS); task_sleep (TIME_1S); } gi_leff_free (PINIO_GI_STRINGS); leff_exit (); }// end of function
//flash lower left GI string void flash_ll_gi_leff (void) { U8 i; gi_leff_allocate (PINIO_GI_STRINGS); for (i = 1; i < 4; i++) { gi_leff_enable (TRIAC_GI_STRING(lower_left) ); task_sleep (TIME_100MS); gi_leff_disable (TRIAC_GI_STRING(lower_left) ); task_sleep (TIME_100MS); } gi_leff_enable (PINIO_GI_STRINGS); //turn on gi gi_leff_free (PINIO_GI_STRINGS); leff_exit(); }//end of function
void flash_gi_leff (void) { U8 i; gi_leff_allocate (PINIO_GI_STRINGS); for (i = 1; i < 4; i++) { gi_leff_disable (PINIO_GI_STRINGS); task_sleep (TIME_300MS); gi_leff_enable (PINIO_GI_STRINGS); task_sleep (TIME_300MS); }//end of loop gi_leff_enable (PINIO_GI_STRINGS); gi_leff_free (PINIO_GI_STRINGS); leff_exit (); }// end of function
void burnin_gi_thread (void) { gi_leff_allocate (PINIO_GI_STRINGS); for (;;) { U8 gi; for (gi = (1 << 0); gi <= (1 << 4); gi <<= 1) { gi_leff_enable (gi); task_sleep (TIME_500MS); gi_leff_disable (gi); } } }
/** * Start a lamp effect. */ void leff_start (leffnum_t id) { const leff_t *leff = &leff_table[id]; task_gid_t gid; /* See if the leff is already running. If so, get out now. */ gid = leff_gid_find_by_id (id); if (gid != GID_NULL) return; /* Allocate a new GID for the lamp effect process. If there are too many leffs already running, then this will fail. */ gid = leff_gid_alloc (); if (gid == GID_NULL) return; /* If the lamps can't all be allocated, then return. If the same leff is already running, this will also fail. If this does fail, note that we do not explicitly free up the GID allocated, but it will get reused implicitly since they cycle. */ page_push (MD_PAGE); if (!leff_res_can_alloc (leff_get_set (leff)) && !leff_can_preempt (leff)) { goto conflict; } /* Mark resources as in use. */ leff_res_alloc (leff_get_set (leff)); #ifdef CONFIG_GI gi_leff_allocate (leff->gi); #ifdef CONFIG_TRIAC triac_update (); #endif #endif /* Associate the GID with the lamp effect number. */ leff_running_list[gid - GID_LEFF_BASE] = id; /* Start the task to run the effect */ /* TODO - it won't start in the same page as caller! */ leff_create_task (leff, gid); dbprintf ("Started leff %d\n", id); #ifdef DEBUG_LEFFS leff_dump (); #endif conflict: page_pop (); }