kernels: add slider
This commit is contained in:
parent
2466656eea
commit
11a4fe4ceb
6 changed files with 1845 additions and 0 deletions
3
kernels/slider/Makefile
Normal file
3
kernels/slider/Makefile
Normal file
|
@ -0,0 +1,3 @@
|
|||
NAME = slider
|
||||
SRCS = main.c image.S
|
||||
include $(AM_HOME)/Makefile
|
7
kernels/slider/image.S
Normal file
7
kernels/slider/image.S
Normal file
|
@ -0,0 +1,7 @@
|
|||
.section .data
|
||||
.global image, image_end
|
||||
.p2align 3
|
||||
image:
|
||||
.incbin "images/projectn.bin"
|
||||
.incbin "images/litenes.bin"
|
||||
image_end:
|
1
kernels/slider/images/.gitignore
vendored
Normal file
1
kernels/slider/images/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!*.bin
|
1583
kernels/slider/images/litenes.bin
Executable file
1583
kernels/slider/images/litenes.bin
Executable file
File diff suppressed because one or more lines are too long
219
kernels/slider/images/projectn.bin
Executable file
219
kernels/slider/images/projectn.bin
Executable file
File diff suppressed because one or more lines are too long
32
kernels/slider/main.c
Normal file
32
kernels/slider/main.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <am.h>
|
||||
#include <klib.h>
|
||||
#include <klib-macros.h>
|
||||
|
||||
extern uint32_t image[][400][300];
|
||||
extern uint32_t image_end[][400][300];
|
||||
#define NR_IMG (image_end - image)
|
||||
|
||||
void display_image(int i) {
|
||||
io_write(AM_GPU_FBDRAW, 0, 0, &image[i][0][0], 400, 300, true);
|
||||
}
|
||||
|
||||
int main() {
|
||||
ioe_init();
|
||||
|
||||
int i = 0;
|
||||
unsigned long last = 0;
|
||||
unsigned long current;
|
||||
|
||||
display_image(i);
|
||||
|
||||
while (1) {
|
||||
current = io_read(AM_TIMER_UPTIME).us / 1000;
|
||||
if (current - last > 5000) {
|
||||
// change image every 5s
|
||||
i = (i + 1) % NR_IMG;
|
||||
display_image(i);
|
||||
last = current;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Reference in a new issue