Update demo led program for PWM driver

This commit is contained in:
Aadi Desai 2023-03-07 21:00:30 +00:00
parent 5ad6a22db5
commit f296ed53d4
No known key found for this signature in database
2 changed files with 26 additions and 22 deletions

View file

@ -106,35 +106,39 @@ static void reboot_cmd(void) {
static void led_cmd(void) { static void led_cmd(void) {
int i; int i;
int j; int j;
int k;
printf("Led demo...\n"); printf("Led demo...\n");
printf("Counter mode...\n"); printf("Counter mode...\n");
for (i = 0; i < 128; i++) { for (i = 0; i < 4; i++) {
leds_out_write(i); for (j = 0; j < 4; j++) {
busy_wait(100); for (k = 0; k < 4; k++) {
leds_out_write(0x3F0000 * i + 0x003F00 * j + 0x00003F * k);
busy_wait(100);
}
}
} }
printf("Shift mode...\n"); printf("Shift mode...\n");
for (j = 0; j < 4; j++) { for (i = 0; i < 24; i++) {
for (i = 0; i < 4; i++) { leds_out_write(1 << i);
leds_out_write(1 << i); busy_wait(100);
busy_wait(200);
}
} }
for (j = 0; j < 4; j++) { for (i = 0; i < 24; i++) {
for (i = 0; i < 4; i++) { leds_out_write(1 << (23 - i));
leds_out_write(1 << (3 - i)); busy_wait(100);
busy_wait(200);
}
} }
printf("Dance mode...\n"); printf("Dance mode...\n");
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
leds_out_write(0x55); leds_out_write(0x000055);
busy_wait(200); busy_wait(200);
leds_out_write(0xaa); leds_out_write(0xAAAA00);
busy_wait(200); busy_wait(200);
} }
printf("Clearing led...\n");
leds_out_write(0);
} }
#endif #endif

14
make.py
View file

@ -196,17 +196,17 @@ class BaseSoC(SoCCore):
# Leds ------------------------------------------------------------------------------------- # Leds -------------------------------------------------------------------------------------
if with_led_chaser: if with_led_chaser:
self.leds = LedChaser( # self.leds = LedChaser(
pads = platform.request_all("user_led"), # pads = platform.request_all("user_led"),
sys_clk_freq = sys_clk_freq) # sys_clk_freq = sys_clk_freq)
# self.leds = TestLed( # self.leds = TestLed(
# platform = platform, # platform = platform,
# pads = platform.request_all("user_led") # pads = platform.request_all("user_led")
# ) # )
# self.leds = TestRgb( self.leds = TestRgb(
# platform = platform, platform = platform,
# pads = platform.request_all("user_led") pads = platform.request_all("user_led")
# ) )
# GPIO Pins -------------------------------------------------------------------------------- # GPIO Pins --------------------------------------------------------------------------------
platform.add_extension([ platform.add_extension([