diff --git a/pkg/libfixmath/Kconfig b/pkg/libfixmath/Kconfig index 48eb8b0abe..1160387489 100644 --- a/pkg/libfixmath/Kconfig +++ b/pkg/libfixmath/Kconfig @@ -19,4 +19,64 @@ config MODULE_LIBFIXMATH_UNITTESTS depends on !HAS_ARCH_8BIT depends on !HAS_MSP430 +menu "Accuracy" + +config FIXMATH_NO_ROUNDING + bool "Disable rounding" + help + Say y to disable rounding. Results may round randomly up or down, i.e. + their accuracy is +-1. Runs slightly faster. + +config FIXMATH_NO_OVERFLOW + bool "Disable overflow detection" + help + Say y to disable overflow detection and saturating arithmetic support. + Overflowing computations will give garbage results. Runs slightly + faster. + +endmenu + +menu "Platform" + +config FIXMATH_NO_64BIT + bool "Disable use of uint64_t" + help + Say y to disable use of uint64_t in the code. Meant for compilers that + do not have 64-bit support. Runs the same speed or slightly slower. + +config FIXMATH_OPTIMIZE_8BIT + bool "Optimize for 8-bit architectures" + default y if HAS_ARCH_8BIT + help + Say y to use variants of the functions that are suitable for small 8- and + 16-bit processors. Much faster on those processors, much slower on 32-bit + processors. + +config FIXMATH_NO_CACHE + bool "Do not use cache" + default y + help + Say y to avoid using cache for exp etc. function results. Uses less RAM, + runs slightly slower. + +endmenu + +menu "Algorithms" + +config FIXMATH_SIN_LUT + bool "Use sin look-up table generated by fixsingen" + help + Say y to use a look-up table generated by the fixsingen tool from svn, + it is faster on some devices but the lookup table takes up ~200KiB + (205376 bytes) in memory and can be slower depending on usage. + +config FIXMATH_FAST_SIN + bool "Fast sin approximation" + help + Say y to enable a faster but less accurate approximation of the sin + function, for code where accuracy isn't as important such as games logic + or graphics rendering then this is often a worthwhile tradeoff. + +endmenu + endif # PACKAGE_LIBFIXMATH diff --git a/pkg/libfixmath/Makefile.include b/pkg/libfixmath/Makefile.include index 92e4cb6266..c85b62aef4 100644 --- a/pkg/libfixmath/Makefile.include +++ b/pkg/libfixmath/Makefile.include @@ -7,6 +7,10 @@ ifneq (,$(filter arch_8bit,$(FEATURES_USED))) CFLAGS += -DFIXMATH_OPTIMIZE_8BIT endif +# translate Kconfig options to CFLAGS for the package +libfixmath_options = $(filter CONFIG_FIXMATH_%,$(.VARIABLES)) +CFLAGS += $(libfixmath_options:CONFIG_FIXMATH_%=-DFIXMATH_%) + INCLUDES += -I$(PKG_SOURCE_DIR)/libfixmath ifneq (,$(filter libfixmath-unittests,$(USEMODULE)))