Ensure cursor is not showing when running
This commit is contained in:
parent
1d4759d8c0
commit
fd20872250
2
Makefile
2
Makefile
|
@ -30,6 +30,8 @@ $(BUILD_DIR):
|
||||||
mkdir -p $(BUILD_DIR)
|
mkdir -p $(BUILD_DIR)
|
||||||
|
|
||||||
run: $(BIN)
|
run: $(BIN)
|
||||||
|
# NOTE: This should probably be done on the C code.
|
||||||
|
echo 0 > /sys/class/graphics/fbcon/cursor_blink
|
||||||
./$(BIN)
|
./$(BIN)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
20
src/main.c
20
src/main.c
|
@ -2,6 +2,7 @@
|
||||||
#include<stdlib.h>
|
#include<stdlib.h>
|
||||||
#include<stdint.h>
|
#include<stdint.h>
|
||||||
#include<stdbool.h>
|
#include<stdbool.h>
|
||||||
|
#include<unistd.h>
|
||||||
#include<fcntl.h>
|
#include<fcntl.h>
|
||||||
#include<linux/fb.h>
|
#include<linux/fb.h>
|
||||||
#include<sys/ioctl.h>
|
#include<sys/ioctl.h>
|
||||||
|
@ -30,14 +31,31 @@ main(void) {
|
||||||
fprintf(stderr, "couldn't mmap the framebuffer\n");
|
fprintf(stderr, "couldn't mmap the framebuffer\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Main loop.
|
||||||
uint8_t shade = 0;
|
uint8_t shade = 0;
|
||||||
|
size_t counter = 0;
|
||||||
|
size_t direction = 1;
|
||||||
while (true) {
|
while (true) {
|
||||||
for (size_t j = 0; j < height; j++) {
|
for (size_t j = 0; j < height; j++) {
|
||||||
for (size_t i = 0; i < width; i++) {
|
for (size_t i = 0; i < width; i++) {
|
||||||
buf[j * width + i] = shade;
|
buf[j * width + i] = shade;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shade++;
|
counter++;
|
||||||
|
if (counter > 10) {
|
||||||
|
shade += direction;
|
||||||
|
counter = 0;
|
||||||
}
|
}
|
||||||
|
if (shade == 0xFF) {
|
||||||
|
direction = -1;
|
||||||
|
} else if (shade == 0x00) {
|
||||||
|
direction = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cleanup.
|
||||||
|
munmap(buf, len);
|
||||||
|
close(fb);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue