Beispiel #1
0
/******************************************************************************
* Name       : uint8 Task_PT_Demo_Process(uint8 u8Evt, void *pPara)
* Function   : A demo task for PT application
* Input      : uint8  u8Evt  1~254     Event for the task
*              void  *pPara            Pointer of parameter

* Output:    : None
* Return     : SW_OK   Successful operation
*            : SW_ERR  Failed operation
*              1~254   Event which is not processed.
* description: To be done
* Version    : V1.00
* Author     : Ian
* Date       : 8th Jul 2016
******************************************************************************/
uint8 Task_PT_Demo_Process(uint8 u8Evt, void *pPara)
{   
    PT_INIT();
    
    PT_BEGIN();

    /******************************************************************/
    MOE_MANDATORY_INIT();  /* Mandatory init, shout call it here only */
    /******************************************************************/

    while(1)
    {
        TASK_PT_DEMO_LED_On(LED_RED);
        PT_DELAY(1000);
        TASK_PT_DEMO_LED_Off(LED_RED);

        TASK_PT_DEMO_LED_On(LED_GREEN);
        PT_DELAY(1000);
        TASK_PT_DEMO_LED_Off(LED_GREEN);

        TASK_PT_DEMO_LED_On(LED_BLUE);
        PT_DELAY(1000);
        TASK_PT_DEMO_LED_Off(LED_BLUE);
    }

    PT_END();

    return SW_OK;

}
Beispiel #2
0
/******************************************************************************
* Name       : uint8 Task_PT_IEC870_PL_Process(uint8 u8Evt)
* Function   : IEC870 physical layer test
* Input      : uint8 u8Evt  1~254     Event for the task
* Output:    : None
* Return     : SW_OK   Successful operation
*            : SW_ERR  Failed operation
*              1~254   Event which is not processed.
* description: To be done
* Version    : V1.00
* Author     : Ian
* Date       : 13th Jul 2016
******************************************************************************/
uint8 Task_PT_IEC870_PL_Process(uint8 u8Evt)
{   
    PT_INIT();
    
    PT_BEGIN();

    /******************************************************************/
    MOE_MANDATORY_INIT();  /* Mandatory init, shout call it here only */
    /******************************************************************/

    CC1101_Init();
    PT_DELAY(1000);

    CC1101_Global_Config(sg_au8RxConfig);
    CC1101_PA_Config(sg_au8PaTabal);

    while(1)
    {
#ifdef __PL_RCV_ENABLE
        //TASK_PT_DEMO_LED_On(LED_RED);
        PL_RECEIVE(sg_au8RxFIFO);
        TASK_PT_DEMO_LED_Off(LED_RED);

        Manchester_Decode(&(sg_au8RxFIFO[1]), sg_au8RxData);

        Print_RF_Info();
#endif

#ifdef __PL_SND_ENABLE
        PT_DELAY(1000);
           
        TASK_PT_DEMO_LED_On(LED_BLUE);
#if defined (__PL_RCV_ENABLE) && defined (__PL_RCV_ENABLE)        
        PL_SEND(sg_au8RxFIFO);
#else
        PL_SEND(sg_au8Test);
#endif 
        TASK_PT_DEMO_LED_Off(LED_BLUE);
        
        PT_DELAY(500);
#endif
    }

    PT_END();

    return SW_OK;

}