Ejemplo n.º 1
0
void EffFadeOneByOne_t::SetupAndStart(int32_t ThrLo, int32_t ThrHi) {
//    Printf("ThrLo: %d; ThrHi: %d\r", ThrLo, ThrHi);
    // Setup ColorLo
    for(int32_t i=0; i < ThrLo; i++) DesiredClr[i] = IClrLo;
    // Setup ColorHi
    for(int32_t i=ThrHi; i < LED_CNT; i++) DesiredClr[i] = IClrHi;
    // Setup gradient
    if(ThrHi > ThrLo) {
        int32_t Len = ThrHi - ThrLo;
        int32_t BrtStep = (255 * 1024) / Len;   // 255 is top brightness, 1024 is scaling coef
        for(int32_t i=0; i<Len; i++) {
            int32_t Indx = ThrLo + i;
            if(Indx >=0 and Indx < LED_CNT) {
                int32_t Brt = (i * BrtStep) / 1024;
//                Printf("%d Brt: %d\r", Indx, Brt);
                DesiredClr[Indx].BeMixOf(IClrHi, IClrLo, Brt);
            }
        }
    } // if(ThrHi > ThrLo)
    // Start processing
    chSysLock();
    PCurrentEff = this;
    chThdResumeS(&PThd, MSG_OK);
    chSysUnlock();
}
Ejemplo n.º 2
0
void EffAllTogetherSmoothly_t::SetupAndStart(Color_t Color, uint32_t ASmoothValue) {
    if(ASmoothValue == 0) EffAllTogetherNow.SetupAndStart(Color);
    else {
        chSysLock();
        ISmoothValue = ASmoothValue;
        for(int32_t i=0; i<LED_CNT; i++) DesiredClr[i] = Color;
        PCurrentEff = this;
        chThdResumeS(&PThd, MSG_OK);
        chSysUnlock();
    }
}
Ejemplo n.º 3
0
/**
 * @brief   Wakes up a thread waiting on a thread reference object.
 * @note    This function must reschedule, it can only be called from thread
 *          context.
 *
 * @param[in] trp       a pointer to a thread reference object
 * @param[in] msg       the message code
 *
 * @api
 */
void chThdResume(thread_reference_t *trp, msg_t msg) {

  chSysLock();
  chThdResumeS(trp, msg);
  chSysUnlock();
}
Ejemplo n.º 4
0
Archivo: ch.cpp Proyecto: sdalu/ChibiOS
  void ThreadStayPoint::resumeS(msg_t msg) {

    chThdResumeS(&thread_ref, msg);
  }