Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Need clear understanding about CAF example project

I am working on nrf52840 and using v2.7.0 SDK. in led_state_def.h (i modified it a little)

static const struct led_effect led_effect[] = {
    [LED_EFFECT_ID_OFF] = LED_EFFECT_LED_OFF(),
    [LED_EFFECT_ID_BLINK] = LED_EFFECT_LED_BLINK(2000, LED_COLOR(10, 255, 10)),
    [LED_EFFECT_ID_BREATH] = LED_EFFECT_LED_BREATH(2000, LED_COLOR(255, 255, 255)),
    [LED_EFFECT_ID_CLOCK] = LED_EFFECT_LED_CLOCK(3, LED_COLOR(255, 255, 255)),
    [LED_EFFECT_ID_BLINK_SLOW] = LED_EFFECT_LED_BLINK(10000, LED_COLOR(255,255,255)),
    [LED_EFFECT_ID_BLINK_FAST] = LED_EFFECT_LED_BLINK(50, LED_COLOR(255,255,255))

};

I dont understand the role of LED_COLOR() here. Seems like it is for RGB Led but for dev kit we have single color led. i am kind of confused because in this example overlay file have 4 pwm pins so why each pin has its own individual LED_COLOR() with 3 values. Should not it has only one value maybe telling duty cycle between 0-255 for a single pin? How is it working?

What if i want to use this program with RGB LED, i understand i can connect 3 pwm0-2 given in overlay to R, G, B of my tri color led , but again why 3 different values for each pin in LED_COLOR()?

Thanks.
Parents
  • I wouldn't worry too much about this file.

    This (the entire caf module) was written because it was intended to be used multiple places, but in reality, it is only used in our nrf_desktop example application, which is intended to run on some hardware that we have (not a DK), and this has some RGB leds.

    To be honest, I have not seen that this API existed before now.

    Best regards,

    Edvin

  • Its needed because we want to use CAF led module for our product development, that's why i am trying to understand this. I figured out many things and i still have a question do you know in CAF example this enum led_id seems like is getting mapped to pwm pins given in overlay file. but where exactly or how this mapping is happening? Thanks.

Reply Children
No Data
Related