6 Replies Latest reply on Jul 19, 2013 10:57 AM by ScottA_91

    Non-obvious behaviour of PWM_Start() API routine

      I recently had a look at the following API call of a PSoC4 Pulse Width Modulation component.

      void PWM_Start(void) {   if (0u == PWM_initVar) {     PWM_Init();     PWM_initVar = 1u;   }
        PWM_Enable(); }

      The routine documentation clearly states that the PWM will be initialized upon first call to PWM_Start(), which is fine. What I don't like about this implementation is that the PWM_Start() routine sets PWM_initVar. In my opinion, this should be done within PWM_Init() because then I can initialize the PWM without immediately starting it, allowing me to defer the actual start to the point where I need it.


      Could you please fix this in the next version of PSoC Creator?