mirror of
https://github.com/supleed2/EIE4-FYP.git
synced 2024-12-22 14:15:50 +00:00
Update demo led program for PWM driver
This commit is contained in:
parent
5ad6a22db5
commit
f296ed53d4
34
demo/main.c
34
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
|
||||
|
||||
|
|
14
make.py
14
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([
|
||||
|
|
Loading…
Reference in a new issue