Compare commits

..

No commits in common. "master" and "main" have entirely different histories.
master ... main

3 changed files with 9 additions and 39 deletions

View File

@ -2,11 +2,9 @@ module omdazz_WS2812b #(
parameter integer WS2812_NUM = 10 - 1, parameter integer WS2812_NUM = 10 - 1,
parameter integer WS2812_WIDTH = 24, parameter integer WS2812_WIDTH = 24,
parameter integer CLK_FRE = 50_000_000 parameter integer CLK_FRE = 50_000_000
//parameter [WS2812_NUM:0] LED_MASK
)( )(
input wire CLOCK_50, input wire CLOCK_50,
input wire [WS2812_NUM-1:0] LED_MASK, output reg WS2812
output reg WS2812
); );
@ -29,10 +27,6 @@ reg [ 8:0] data_send = 0; // amount of data words sent // increase it for larg
reg [31:0] clk_count = 0; // delay control reg [31:0] clk_count = 0; // delay control
reg [23:0] WS2812_data = 24'd1; // WS2812 color data reg [23:0] WS2812_data = 24'd1; // WS2812 color data
wire send_bit;
assign send_bit = WS2812_data[bit_send] & LED_MASK[data_send];
//assign send_bit = (data_send == 0) ? WS2812_data[bit_send] : 1'b0;
always@(posedge CLOCK_50) always@(posedge CLOCK_50)
case (state) case (state)
RESET:begin RESET:begin
@ -65,7 +59,7 @@ always@(posedge CLOCK_50)
BIT_SEND_HIGH:begin BIT_SEND_HIGH:begin
WS2812 <= 1; WS2812 <= 1;
if (send_bit) if (WS2812_data[bit_send])
if (clk_count < DELAY_1_HIGH) if (clk_count < DELAY_1_HIGH)
clk_count <= clk_count + 1; clk_count <= clk_count + 1;
else begin else begin
@ -84,7 +78,7 @@ always@(posedge CLOCK_50)
BIT_SEND_LOW:begin BIT_SEND_LOW:begin
WS2812 <= 0; WS2812 <= 0;
if (send_bit) if (WS2812_data[bit_send])
if (clk_count < DELAY_1_LOW) if (clk_count < DELAY_1_LOW)
clk_count <= clk_count + 1; clk_count <= clk_count + 1;
else begin else begin

View File

@ -6,6 +6,6 @@ Page_0 0x00000000 0x00059D8A
Notes: Notes:
- Data checksum for this conversion is 0x1A5DDC5D - Data checksum for this conversion is 0x1A5EBC7A
- All the addresses in this file are byte addresses - All the addresses in this file are byte addresses

34
top.v
View File

@ -1,38 +1,14 @@
module top( module top(
input wire CLOCK_50, input wire CLOCK_50,
output wire WS2812_OUT input wire [4:4] D_INP,
output wire WS2812_OUT
); );
localparam integer LED_NUM = 10;
localparam integer TICK_1SEC = 50_000_000;
localparam integer COUNTER_WIDTH = 26;
reg [COUNTER_WIDTH-1:0] sec_count;
reg [LED_NUM-1:0] led_mask;
initial begin
sec_count = 0;
led_mask = 10'b0000000001;
end
always @(posedge CLOCK_50) begin
if (sec_count == TICK_1SEC - 1) begin
sec_count <= 0;
// LED0 -> LED1 -> ... -> LED9 -> LED0
led_mask <= {led_mask[LED_NUM-2:0], led_mask[LED_NUM-1]};
end
else begin
sec_count <= sec_count + 1'b1;
end
end
omdazz_WS2812b #( omdazz_WS2812b #(
.WS2812_NUM(LED_NUM), .WS2812_NUM(10 - 1),
.CLK_FRE (50_000_000) .CLK_FRE(50_000_000)
) u_ws2812 ( ) u_ws2812 (
.CLOCK_50(CLOCK_50), .CLOCK_50(CLOCK_50),
.LED_MASK(led_mask),
.WS2812 (WS2812_OUT) .WS2812 (WS2812_OUT)
); );