Merge branch 'main' into 'main'

Add MacOS support

See merge request TheJackiMonster/nrealAirLinuxDriver!10
This commit is contained in:
Tobias Frisch 2025-08-15 14:13:34 +00:00
commit 225dd4eae2
3 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,19 @@
#pragma once
#if defined(__APPLE__)
#include <libkern/OSByteOrder.h>
#define htole16(x) OSSwapHostToLittleInt16(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#elif defined(__linux__)
#include <endian.h> // or #include <sys/endian.h> on older systems
#else
#error "Endian conversion functions not defined for this platform"
#endif

View File

@ -42,6 +42,7 @@
#include "crc32.h" #include "crc32.h"
#include "hid_ids.h" #include "hid_ids.h"
#include "endian_compat.h"
#define GRAVITY_G (9.806f) #define GRAVITY_G (9.806f)

View File

@ -36,6 +36,8 @@
#include "crc32.h" #include "crc32.h"
#include "hid_ids.h" #include "hid_ids.h"
#include "endian_compat.h"
#ifndef NDEBUG #ifndef NDEBUG
#define device_mcu_error(msg) fprintf(stderr, "ERROR: %s\n", msg) #define device_mcu_error(msg) fprintf(stderr, "ERROR: %s\n", msg)