vindar / tgx

tgx - a tiny/teensy 3D graphics library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compiling with STM32duino

wystewart opened this issue · comments

PC0, PC1, PC2, PC3 defined in Renderer3D.inl conflict with #define pinout definitions of the STM32.

Suggest to change to _PC0, _PC1, _PC2, _PC3. That seems to resolve the compile issue

i also added this to misc.h. i haven't checked yet if stm32 has a native sqrt implementation.

#if defined(ARDUINO_ARCH_STM32)
#include "Arduino.h"
#define TGX_ON_ARDUINO
#define TGX_USE_FAST_INV_SQRT_TRICK
#define TGX_USE_FAST_SQRT_TRICK
#define TGX_USE_FAST_INV_TRICK
#endif

and defined(ARDUINO_ARCH_STM32) to the following.

#if defined(TEENSYDUINO) || defined(ESP32) || defined(ARDUINO_ARCH_STM32)
// On teensy, 8K give good results...
#define TGX_PROGMEM_DEFAULT_CACHE_SIZE 8192
#else
// make it bigger on CPU...
#define TGX_PROGMEM_DEFAULT_CACHE_SIZE 262144
#endif

STM32 could use a bigger cache than 8192 as it has more memory, but in most applications 262144 will be too big. so for now I'm sticking to 8192.