-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'classroom_hrdwdisplay' into draft
- Loading branch information
Showing
8 changed files
with
137 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,6 +78,17 @@ endif | |
step6.si : hardware/main.si | ||
python ../tools/solutions.py -i hardware/main.si -s LED,AUDIO,SCREEN,BTN,SD,STREAM > $@ | ||
|
||
step7: step7.si | ||
make -C firmware $(FIRMWARE) DEFINES="-DHWFBUFFER" | ||
ifeq ($(BOARD),verilator) | ||
silice-make.py -s [email protected] -b $(BOARD) -p basic,oled -o BUILD_$(subst :,_,$@) $(ARGS) | ||
else | ||
silice-make.py -s [email protected] -b $(BOARD) -p basic,audio,oled,buttons,sdcard -o BUILD_$(subst :,_,$@) $(ARGS) | ||
endif | ||
|
||
step7.si : hardware/main.si | ||
python ../tools/solutions.py -i hardware/main.si -s LED,AUDIO,SCREEN,BTN,SD,STREAM,HWFBUFFER > $@ | ||
|
||
final: final.si | ||
make -C firmware $(FIRMWARE) | ||
ifeq ($(BOARD),verilator) | ||
|
@@ -87,7 +98,7 @@ else | |
endif | ||
|
||
final.si : hardware/main.si | ||
python ../tools/solutions.py -i hardware/main.si -s LED,AUDIO,SCREEN,BTN,SD,STREAM,PWM > $@ | ||
python ../tools/solutions.py -i hardware/main.si -s LED,AUDIO,SCREEN,BTN,SD,STREAM,HWFBUFFER,PWM > $@ | ||
|
||
clean: | ||
make -C firmware clean | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
learn-silice/classroom/soc_wave_player/firmware/step7_hrdw_screen.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// @sylefeb 2022-01-10 | ||
// MIT license, see LICENSE_MIT in Silice repo root | ||
// https://github.com/sylefeb/Silice/ | ||
|
||
#include "config.h" | ||
#include "std.h" | ||
#include "oled.h" | ||
#include "display.h" | ||
#include "printf.h" | ||
|
||
#ifndef HWFBUFFER | ||
#error This firmware needs HWFBUFFER defined | ||
#endif | ||
|
||
void main() | ||
{ | ||
// install putchar handler for printf | ||
f_putchar = display_putchar; | ||
// init display | ||
oled_init(); | ||
oled_fullscreen(); | ||
oled_clear(0); | ||
// print message | ||
display_set_cursor(0,0); | ||
display_set_front_back_color(255,0); | ||
|
||
// gradient background | ||
for (int i = 0 ; i < 128; ++i) { | ||
for (int j = 0 ; j < 128; ++j) { | ||
display_framebuffer()[i + (j << 7)] = i; | ||
} | ||
} | ||
|
||
// bouncing text | ||
int dx = 3; | ||
int dy = 1; | ||
int x = 0; | ||
int y = 0; | ||
while (1) { | ||
display_set_cursor(x,y); | ||
printf("Hello world!"); | ||
x += dx; | ||
if (x > 64) { | ||
x = 64; | ||
dx = -dx; | ||
} else if (x < 0) { | ||
x = 0; | ||
dx = -dx; | ||
} | ||
y += dy; | ||
if (y > 108) { | ||
y = 108; | ||
y = -dy; | ||
} else if (y < 0) { | ||
y = 0; | ||
dy = -dy; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters