|
Swadge ESP32-S2
APIs to develop for the Magfest Swadge
|
Go to the source code of this file.
Macros | |
| #define | CLAMP(a, l, u) |
| Clamp a number between an upper and lower bound. | |
| #define | MIN(a, b) |
| Find the smaller of two numbers. | |
| #define | MAX(a, b) |
| Find the larger of two numbers. | |
| #define | ABS(a) |
| Find the absolute value of a number. | |
| #define | IS_ARRAY(arr) |
| Return the number of elements in a fixed length array. This does not work for pointers. | |
| #define | STATIC_EXP(e) |
| Helper macro to determine the number of elements in an array. Should not be used directly. | |
| #define | ARRAY_SIZE(arr) |
| #define | POS_MODULO_ADD(a, b, d) |
| Returns (a + b) % d, but with negative values converted to equivalent positive values. The resulting value will always be in the range [0, d), assuming d > 0. | |
| #define | RUN_TIMER_EVERY(timer, period, elapsed, timer_code) |
| Run timer_code every period, using tracking it with timer. | |
| #define | NUM_FRAME_TIMES 60 |
| #define | DRAW_FPS_COUNTER(font) |
| #define CLAMP | ( | a, | |
| l, | |||
| u ) |
Clamp a number between an upper and lower bound.
| a | A number to clamp between an upper and lower bound |
| l | The lower bound, inclusive |
| u | The upper bound, inclusive |
| #define MIN | ( | a, | |
| b ) |
Find the smaller of two numbers.
| a | A number to compare |
| b | Another number to compare |
| #define MAX | ( | a, | |
| b ) |
Find the larger of two numbers.
| a | A number to compare |
| b | Another number to compare |
| #define ABS | ( | a | ) |
Find the absolute value of a number.
| a | A number to find the absolute value of |
| #define IS_ARRAY | ( | arr | ) |
Return the number of elements in a fixed length array. This does not work for pointers.
See https://stackoverflow.com/a/19455169
| arr | An array to find the number of elements in |
| #define STATIC_EXP | ( | e | ) |
Helper macro to determine the number of elements in an array. Should not be used directly.
| #define ARRAY_SIZE | ( | arr | ) |
| #define POS_MODULO_ADD | ( | a, | |
| b, | |||
| d ) |
Returns (a + b) % d, but with negative values converted to equivalent positive values. The resulting value will always be in the range [0, d), assuming d > 0.
The first modulo, (b % d) will return e.g. -90 for (-270 % 360)
| a | One number to sum |
| b | Another number to sum |
| d | The number to mod the sum by |
| #define RUN_TIMER_EVERY | ( | timer, | |
| period, | |||
| elapsed, | |||
| timer_code ) |
Run timer_code every period, using tracking it with timer.
| timer | The accumulator variable, must persist between calls |
| period | The period at which timer_code should be run |
| elapsed | The time elapsed since this was last called |
| timer_code | The code to execute every period |
| #define NUM_FRAME_TIMES 60 |
| #define DRAW_FPS_COUNTER | ( | font | ) |