NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Functions
neorv32_neoled.c File Reference

Smart LED Interface (NEOLED) HW driver source file. More...

#include "neorv32.h"
#include "neorv32_neoled.h"

Functions

int neorv32_neoled_available (void)
 
void neorv32_neoled_setup (uint32_t prsc, uint32_t t_total, uint32_t t_high_zero, uint32_t t_high_one, int irq_mode)
 
void neorv32_neoled_setup_ws2812 (int irq_mode)
 
void neorv32_neoled_set_mode (uint32_t mode)
 
void neorv32_neoled_strobe_blocking (void)
 
void neorv32_neoled_strobe_nonblocking (void)
 
void neorv32_neoled_enable (void)
 
void neorv32_neoled_disable (void)
 
void neorv32_neoled_write_blocking (uint32_t data)
 
uint32_t neorv32_neoled_get_buffer_size (void)
 

Detailed Description

Smart LED Interface (NEOLED) HW driver source file.

Note
These functions should only be used if the NEOLED unit was synthesized (IO_NEOLED_EN = true).

Function Documentation

◆ neorv32_neoled_available()

int neorv32_neoled_available ( void )

Check if NEOLED unit was synthesized.

Returns
0 if NEOLED was not synthesized, 1 if NEOLED is available.

◆ neorv32_neoled_disable()

void neorv32_neoled_disable ( void )

Disable NEOLED controller.

◆ neorv32_neoled_enable()

void neorv32_neoled_enable ( void )

Enable NEOLED controller.

◆ neorv32_neoled_get_buffer_size()

uint32_t neorv32_neoled_get_buffer_size ( void )

Get NEOLED hardware buffer size.

Returns
Number of entries in NEOLED TX buffer.

◆ neorv32_neoled_set_mode()

void neorv32_neoled_set_mode ( uint32_t mode)

Set NEOLED mode (24-bit RGB / 32-bit RGBW).

Parameters
[in]mode0 = 24-bit mode (RGB), 1 = 32-bit mode (RGBW)

◆ neorv32_neoled_setup()

void neorv32_neoled_setup ( uint32_t prsc,
uint32_t t_total,
uint32_t t_high_zero,
uint32_t t_high_one,
int irq_mode )

Enable and configure NEOLED controller. The NEOLED control register bits are listed in NEORV32_NEOLED_CTRL_enum. This function performs a "raw" configuration (just configuring the according control register bit).

Parameters
[in]prscClock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum.
[in]t_totalNumber of pre-scaled clock ticks for total bit period (0..31).
[in]t_high_zeroNumber of pre-scaled clock ticks to generate high-time for sending a '0' (0..31).
[in]t_high_oneNumber of pre-scaled clock ticks to generate high-time for sending a '1' (0..31).
[in]irq_modeInterrupt condition (1=IRQ if FIFO is empty, 1=IRQ if FIFO is less than half-full).

◆ neorv32_neoled_setup_ws2812()

void neorv32_neoled_setup_ws2812 ( int irq_mode)

Configure NEOLED controller for using WS2812 LEDs (NeoPixel-compatible). This function computes all the required timings and finally calls neorv32_neoled_setup.

Note
WS2812 timing: T_period = 1.2us, T_high_zero = 0.4us, T_high_one = 0.8us. Change the constants if required.
This function uses the SYSINFO_CLK value (from the SYSINFO HW module) to do the timing computations.
Parameters
[in]irq_modeInterrupt condition (1=IRQ if FIFO is empty, 1=IRQ if FIFO is less than half-full).

◆ neorv32_neoled_strobe_blocking()

void neorv32_neoled_strobe_blocking ( void )

Send strobe command ("RESET") - blocking.

◆ neorv32_neoled_strobe_nonblocking()

void neorv32_neoled_strobe_nonblocking ( void )

Send strobe command ("RESET") - non-blocking.

◆ neorv32_neoled_write_blocking()

void neorv32_neoled_write_blocking ( uint32_t data)

Send single RGB(W) data word to NEOLED module (blocking).

Warning
This function is blocking as it polls the NEOLED FIFO full flag.
Parameters
[in]dataLSB-aligned 24-bit RGB or 32-bit RGBW data