How do I extend the CAF LED module?

I am currently using the CAF LED modules. This works fine with a mono-color LED or a tri-color RGB LED.

question 1:
My problem is that unfortunatly my hardware board has only Bi-color LED e.g. red+green.
Is there any (hidden) configuration settings in CAF to disable the "blue" color in the LED module.

without hitting the assert in function leds_init at line 186

   __ASSERT_NO_MSG((led->color_count == 1) || (led->color_count == 3));

Question2:
An small architectural question:
How can I overload or inherit the CAF LED module correctly, without copy-paste the code to my custom sdk (as extended library to zephyr)

Any idea / hint / tip how to fix this correctly.

Thx.

Parents Reply
  • Hi Oivind

    In the file <ncs root>nrf\subsys\caf\led_effect.h
    there is a multi-channel color count
    #define
    _CAF_LED_COLOR_CHANNEL_COUNT 3
    So I can undef and redefine this into the value 2 (for a bi-color led)

    But unfortunaltly in the file <ncs root>nrf\subsys\caf\modules\leds.c
    the above define is not used  (but  replaced by a hardcoded value)
    __ASSERT_NO_MSG((led->color_count == 1) || (led->color_count == 3));

    It seems this is technical debt to be solved to support improved flexibility for multi-channel colored LEDs.


Children
Related