Skip to content

Instantly share code, notes, and snippets.

View shengwen-tw's full-sized avatar

Shengwen Cheng shengwen-tw

View GitHub Profile
@shengwen-tw
shengwen-tw / riscv-cross-file
Last active May 28, 2024 16:49
DirectFB2 Meson Cross File
[binaries]
c = 'riscv32-buildroot-linux-gnu-gcc'
strip = 'riscv32-buildroot-linux-gnu-strip'
pkgconfig = 'pkg-config'
[properties]
pkg_config_libdir = '@GLOBAL_SOURCE_ROOT@' / '../buildroot/output/host/riscv32-buildroot-linux-gnu/sysroot/usr/local/lib/pkgconfig'
sys_root = '@GLOBAL_SOURCE_ROOT@' / '../buildroot/output/host/riscv32-buildroot-linux-gnu/sysroot'
[host_machine]
@shengwen-tw
shengwen-tw / riscv-directfb2.patch
Last active May 28, 2024 15:11
DirectFB2 Cross Compilation Patch
diff --git a/lib/direct/os/linux/system.c b/lib/direct/os/linux/system.c
index fffc495b2..9d871da74 100644
--- a/lib/direct/os/linux/system.c
+++ b/lib/direct/os/linux/system.c
@@ -1,3 +1,6 @@
+#ifndef __NR_futex
+#define __NR_futex __NR_futex_time64
+#endif
/*
This file is part of DirectFB.
#include <stm32f4xx.h>
#include "sys_time.h"
#include "sys_time.h"
#include "i2c.h"
#define I2C_TIMEOUT_MS 50
enum {
I2C_READ_MODE,
I2C_WRITE_MODE
bool ahrs_compass_quality_test(float *mag_new)
{
//once the compass is detected as unstable, this flag will be trigger on for 1 seconds
static bool compass_is_stable = true;
static float last_failed_time = 0;
if(compass_is_stable == false) {
if((get_sys_time_s() - last_failed_time) > 0.5f) {
compass_is_stable = true;
}