CDL Modules
Data Structures | Variables
leds.h File Reference

Constants, types and modules for various LED drivers. More...

Detailed Description

Constants, types and modules for various LED drivers.

Header file for the types and modules controlling LEDs, including Neopixel chains.

Data Structures

struct  t_led_ws2812_data
 
struct  t_led_ws2812_request
 

Variables

constant bit[16] led_seven_seg_hex_a = 16b_1101011111101101
 
constant bit[16] led_seven_seg_hex_b = 16b_0010011110011111
 
constant bit[16] led_seven_seg_hex_c = 16b_0010111111111011
 
constant bit[16] led_seven_seg_hex_d = 16b_0111101101101101
 
constant bit[16] led_seven_seg_hex_e = 16b_1111110101000101
 
constant bit[16] led_seven_seg_hex_f = 16b_1101111101110001
 
constant bit[16] led_seven_seg_hex_g = 16b_1110111101111100
 

Data Structure Documentation

struct t_led_ws2812_data
Data Fields
bit[8] blue

The 8 bit blue component for the LED to display

bit[8] green

The 8 bit green component for the LED to display

bit last

Assert if the LED data is for the last LED in the chain

bit[8] red

The 8 bit red component for the LED to display

bit valid

Assert if the LED data supplied in this structure is valid

struct t_led_ws2812_request
Data Fields
bit first

If requesting LED data, then the first LED of the stream should be provided; indicates led_number is 0

bit[8] led_number

Number of LED data required, so that a client can use a switch statement or register file or array, for example

bit ready

Active high signal indicating if LED data is required; ignore ready if the response has valid asserted

Modules

module led_seven_segment ( input bit  hex[4],
output bit  leds[7] 
)
Parameters
[in]hexHexadecimal to display on 7-segment LED
[out]leds1 for LED on, 0 for LED off, for segments a-g in bits 0-7
module led_ws2812_chain ( clock  clk,
input bit  reset_n,
input bit  divider_400ns[8],
output t_led_ws2812_request  led_request,
input t_led_ws2812_data  led_data,
output bit  led_chain 
)
Parameters
clksystem clock - not the pin clock
reset_nasync reset
divider_400nsclock divider value to provide for generating a pulse every 400ns based on clk
led_requestLED data request
led_dataLED data, for the requested led
led_chainData in pin for LED chain

Variable Documentation

constant bit [16] led_seven_seg_hex_a = 16b_1101011111101101
constant bit [16] led_seven_seg_hex_b = 16b_0010011110011111
constant bit [16] led_seven_seg_hex_c = 16b_0010111111111011
constant bit [16] led_seven_seg_hex_d = 16b_0111101101101101
constant bit [16] led_seven_seg_hex_e = 16b_1111110101000101
constant bit [16] led_seven_seg_hex_f = 16b_1101111101110001
constant bit [16] led_seven_seg_hex_g = 16b_1110111101111100