Skip to content

Commit

Permalink
🎨 Refactoring skeleton code
Browse files Browse the repository at this point in the history
  • Loading branch information
obono committed Nov 19, 2024
1 parent c1f6e31 commit c076ede
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions skeleton/skeleton.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
#include "common.h"

/* Defines */

#define callInitFunc(idx) ((void (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].initFunc))()
#define callUpdateFunc(idx) ((MODE_T (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].updateFunc))()
#define callDrawFunc(idx) ((void (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].drawFunc))()

/* Typedefs */

typedef struct {
Expand All @@ -22,6 +16,12 @@ PROGMEM static const MODULE_FUNCS moduleTable[] = {
{ initGame, updateGame, drawGame },
};

/* Local Functions (macros) */

#define callInitFunc(idx) ((void (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].initFunc))()
#define callUpdateFunc(idx) ((MODE_T (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].updateFunc))()
#define callDrawFunc(idx) ((void (*)(void)) pgm_read_word((uint16_t) &moduleTable[idx].drawFunc))()

/* Local Variables */

static MODE_T mode;
Expand Down

0 comments on commit c076ede

Please sign in to comment.