Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PWM library question about the init

Hello all, 

I am using the PWM library, does any of you know what does the " 5000L " stands for in this function ?

...
/* 2-channel PWM, 200 Hz, output on DK LED pins. */
app_pwm_config_t pwm1_cfg = APP_PWM_DEFAULT_CONFIG_2CH(5000L, BSP_LED_0, BSP_LED_1);
...

Indeed, it says 200 Hz, however, I do not see it :) Can anyone help me in layman terms?

Best.

Parents
  • Hello Mu234,

    I can explain the APP_PWM_DEFAULT_CONFIG_2CH macro in layman terms, sure thing!
    In essence, the default 2 channel macro needs to know which 2 channels to use, and what frequency. The first parameter is the frequency given in µs, and is given as 5000L, which translates to 5000 µs, or 5 ms - which is equal to 200 Hz.
    The L at the end of the 5000 is just a C suffix indicating 'long'.

    Please let me know if any of this still should be unclear, or if you have any additional questions! :) 

    Best regards,
    Karl

Reply
  • Hello Mu234,

    I can explain the APP_PWM_DEFAULT_CONFIG_2CH macro in layman terms, sure thing!
    In essence, the default 2 channel macro needs to know which 2 channels to use, and what frequency. The first parameter is the frequency given in µs, and is given as 5000L, which translates to 5000 µs, or 5 ms - which is equal to 200 Hz.
    The L at the end of the 5000 is just a C suffix indicating 'long'.

    Please let me know if any of this still should be unclear, or if you have any additional questions! :) 

    Best regards,
    Karl

Children
No Data
Related