delta-12 / LaserTag

A Bop It! style laser tag game
0 stars 2 forks source link

Statically allocate DFPlayerMini #75

Open delta-12 opened 11 months ago

delta-12 commented 11 months ago

The driver for the DFPlayerMini is written in C++, and since C does not support C++ classes when C++ code is defined with C linkage, the C++ class for the driver must be dynamically in C++, and the pointer to the class is returned so that C does not have to work with the class directly. However, dynamic allocation should be avoided whenever possible to prevent potentially exceeding the size of the memory at runtime. When static allocation is used, the size of the memory footprint can be evaluated at compile time. Therefore, the C++ class for the DFPlayerMini driver should be statically allocated if possible.