Help understand

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello all, Please have a look at this function in a Proximity Sensing regards:

   

 

   

/***** Function Name: Output_Init  *********

   

* Summary:                 *  Output_Init() performs following functions:

   

*  1: Starts PRSm        * Parameters:   *  None.               * Return:             *  None***/

   

void Output_Init(void)

   

{       

   

          /* Set up WDT to generate the wakeup/timing ISR */

   

          /* Update the match register for generating a periodic WDT ISR. */

   

          /*Note: In order to do a periodic ISR using WDT, Match value needs to be

   

                          updated every WDT ISR with the desired time value added on top of the

   

                          existing match value */

   

          #if ((0u != CapSense_IS_M0S8PERI_BLOCK) && (0u == (CY_PSOC4_4100BL || CY_PSOC4_4200BL || CY_PSOC4_4100M || CY_PSOC4_4200M)))

   

              CySysWdtWriteMatch(WATCHDOG_TIMER_COUNT);

   

          #else

   

                          CySysWdtWriteMatch(0, WATCHDOG_TIMER_COUNT);

   

          #endif /* (0u != CapSense_IS_M0S8PERI_BLOCK) */

   

         

   

          #if ((0u != CapSense_IS_M0S8PERI_BLOCK) && (0u == (CY_PSOC4_4100BL || CY_PSOC4_4200BL || CY_PSOC4_4100M || CY_PSOC4_4200M)))

   

                          /* Enable the WDT interrupt in SRSS INTR mask register */

   

                          CySysWdtUnmaskInterrupt();

   

          #else

   

                          CySysWdtClearInterrupt(0);

   

          #endif /* (0u != CapSense_IS_M0S8PERI_BLOCK) */

   

 

   

          /* Map the WatchDog_ISR vector to the WDT_ISR */

   

          WDT_ISR_StartEx(WatchDog_ISR);

   

         

   

          /* Start PRSm block */

   

          PRSm_Init();

   

 

   

        PRSm_WriteCounter(LED_OFF_DUTY);

   

         

   

          PRSm_Enable();

   

         

   

}

   

 

   

Please explain the meaning of following lines:

   

#if ((0u != CapSense_IS_M0S8PERI_BLOCK) && (0u == (CY_PSOC4_4100BL || CY_PSOC4_4200BL || CY_PSOC4_4100M || CY_PSOC4_4200M)))

   

Thanks & Regards-

   

Amit

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

#if is conditional compilation. the statement checks if you are running a PSoC 4-M version (or BLE) is used.

   

 

   

Bob

   

PS: do not care for generated code, that is usually ok.

0 Likes
Anonymous
Not applicable

Hello Bob,

   

what does M0S8PERI  -  Stand for in -->  CapSense_IS_M0S8PERI_BLOCK.

   

Can I omit it form the code? What will be result of it?

   

Thanks & Regards-

   

Amit

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Do not tamper generated code. Never.

   

 

   

Bob

0 Likes