コード例 #1
0
ファイル: sk6812.cpp プロジェクト: Kreyl/LedBandRadio
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();
}
コード例 #2
0
ファイル: sk6812.cpp プロジェクト: Kreyl/LedBandRadio
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();
    }
}
コード例 #3
0
ファイル: chthreads.c プロジェクト: sdalu/ChibiOS
/**
 * @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();
}
コード例 #4
0
ファイル: ch.cpp プロジェクト: sdalu/ChibiOS
  void ThreadStayPoint::resumeS(msg_t msg) {

    chThdResumeS(&thread_ref, msg);
  }