|
CDL Modules
|
Files | |
| file | apb_target_led_ws2812.cdl |
| Simple APB target for driving a chain of Neopixels. | |
| module apb_target_led_ws2812::apb_target_led_ws2812 | ( | clock | clk, |
| input bit | reset_n, | ||
| input t_apb_request | apb_request, | ||
| output t_apb_response | apb_response, | ||
| input bit | divider_400ns_in[8], | ||
| output bit | led_chain | ||
| ) |
| [in] | clk | System clock |
| [in] | reset_n | Active low reset |
| [in] | apb_request | APB request |
| [out] | apb_response | APB response |
| [in] | divider_400ns_in | Default value for divider_400ns |
| [out] | led_chain | A simple module to drive a chain of Neopixel LEDs as an APB target. |
The Neopixel LEDs are 24-bit RGB LEDs that are driven through a chain, with a single control pin providing the information for the LEDs.
This module supports up to 16 LEDs in a chain, each with a 24-bit RGB value. The chain must be configured with a clock divider (which is the number of clock ticks required to generate a 400ns, approximately, clock) and the number of LEDs in the chain.
The clock divider resets to 0, but whenever it is zero it resets to the input value divider_400ns_in; hence it may be effectively 'hardwired'.
Once configured the LED colors can be individually written to address-mapped registers. The LED chain automatically updates.
The configuration register is:
| Bits | Meaning |
|---|---|
| 12;2 | zero |
| 4;16 | last LED in the chain (0 for one LED, 15 for sixteen LEDs) |
| 8;8 | zero |
| 8;0 | clock divider to create a 400ns clock enable from system clock |
Example divider values
50MHz | 20ns | 19 100MHz | 10ns | 39 20MHz | 50ns | 7
1.8.11