WS2812 with LED CAF

Hi There, 

I would like to extend the NRF9160 LED CAF by using the WS2812 LED instead of 3x discrete LEDs. 

1. Where in the CAF or Zephyr or wherever, are the function calls to actually control the LEDs. - its so opaque as to be unusable. 

2. Is there a way to write and interface layer to drive the WS2812 instead of the LEDs. 

3. I have WS2812 with SPI working fine, I have the LED breathing, blinking changing colour etc, is there way in the overlay for the SPI to only use a single pin, rather than needing the 3 pins for SPI, two of which are then redundant, and I have them assigned for other stuff. 

Thanks and Regards 

Marshall

Parents
  • Thanks Michal 

    Don't worry about points 1 and 2, I figured it out, its a bit ugly at the moment, so I can't post it. 

    in the ui_module.c of the asset tracker app. I just added an extra call to my own functions so the original LEDs are still doing whatever..

    /* Static module functions. */
    static void update_led_pattern(enum led_state pattern)
    {
    #if defined(CONFIG_LED_CONTROL)
        struct led_state_event *event = new_led_state_event();
    
        event->state = pattern;
        APP_EVENT_SUBMIT(event);
    #endif
        LOG_INF("LED Pattern is now %d",pattern);
        ws2812_update(pattern);
    
    }
    Regards Marshall
Reply
  • Thanks Michal 

    Don't worry about points 1 and 2, I figured it out, its a bit ugly at the moment, so I can't post it. 

    in the ui_module.c of the asset tracker app. I just added an extra call to my own functions so the original LEDs are still doing whatever..

    /* Static module functions. */
    static void update_led_pattern(enum led_state pattern)
    {
    #if defined(CONFIG_LED_CONTROL)
        struct led_state_event *event = new_led_state_event();
    
        event->state = pattern;
        APP_EVENT_SUBMIT(event);
    #endif
        LOG_INF("LED Pattern is now %d",pattern);
        ws2812_update(pattern);
    
    }
    Regards Marshall
Children
Related