From f296ed53d468dec180f0fcc767372d0870f8b4eb Mon Sep 17 00:00:00 2001 From: Aadi Desai <21363892+supleed2@users.noreply.github.com> Date: Tue, 7 Mar 2023 21:00:30 +0000 Subject: [PATCH] Update demo led program for PWM driver --- demo/main.c | 34 +++++++++++++++++++--------------- make.py | 14 +++++++------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/demo/main.c b/demo/main.c index 5e9f1fb..3408d82 100644 --- a/demo/main.c +++ b/demo/main.c @@ -106,35 +106,39 @@ static void reboot_cmd(void) { static void led_cmd(void) { int i; int j; + int k; printf("Led demo...\n"); printf("Counter mode...\n"); - for (i = 0; i < 128; i++) { - leds_out_write(i); - busy_wait(100); + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + for (k = 0; k < 4; k++) { + leds_out_write(0x3F0000 * i + 0x003F00 * j + 0x00003F * k); + busy_wait(100); + } + } } printf("Shift mode...\n"); - for (j = 0; j < 4; j++) { - for (i = 0; i < 4; i++) { - leds_out_write(1 << i); - busy_wait(200); - } + for (i = 0; i < 24; i++) { + leds_out_write(1 << i); + busy_wait(100); } - for (j = 0; j < 4; j++) { - for (i = 0; i < 4; i++) { - leds_out_write(1 << (3 - i)); - busy_wait(200); - } + for (i = 0; i < 24; i++) { + leds_out_write(1 << (23 - i)); + busy_wait(100); } printf("Dance mode...\n"); for (i = 0; i < 16; i++) { - leds_out_write(0x55); + leds_out_write(0x000055); busy_wait(200); - leds_out_write(0xaa); + leds_out_write(0xAAAA00); busy_wait(200); } + + printf("Clearing led...\n"); + leds_out_write(0); } #endif diff --git a/make.py b/make.py index 13fb99f..af133bd 100755 --- a/make.py +++ b/make.py @@ -196,17 +196,17 @@ class BaseSoC(SoCCore): # Leds ------------------------------------------------------------------------------------- if with_led_chaser: - self.leds = LedChaser( - pads = platform.request_all("user_led"), - sys_clk_freq = sys_clk_freq) + # self.leds = LedChaser( + # pads = platform.request_all("user_led"), + # sys_clk_freq = sys_clk_freq) # self.leds = TestLed( # platform = platform, # pads = platform.request_all("user_led") # ) - # self.leds = TestRgb( - # platform = platform, - # pads = platform.request_all("user_led") - # ) + self.leds = TestRgb( + platform = platform, + pads = platform.request_all("user_led") + ) # GPIO Pins -------------------------------------------------------------------------------- platform.add_extension([