Switches refactoring (#6454)

Switches refactoring
This commit is contained in:
3djc
2019-05-27 15:58:16 +02:00
committed by Bertrand Songis
parent ac1bb2c376
commit 5411b785a9
7 changed files with 107 additions and 28 deletions
+13 -4
View File
@@ -441,23 +441,32 @@ enum EnumSwitchesPositions
#endif
NUM_SWITCHES_POSITIONS
};
#if defined(PCBXLITES)
#define NUM_SWITCHES 6
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
#elif defined(PCBXLITE)
#define NUM_SWITCHES 4
#define STORAGE_NUM_SWITCHES 6
#elif defined(PCBT12)
#define NUM_SWITCHES 6
#define STORAGE_NUM_SWITCHES 8
#elif defined(PCBX7)
#define NUM_SWITCHES 8
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
#elif defined(PCBX9LITE)
#define NUM_SWITCHES 5
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
#elif defined(PCBX9E)
#define NUM_SWITCHES 18 // yes, it's a lot!
#define NUM_SWITCHES 18 // yes, it's perfect like that !
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
#else
#define NUM_SWITCHES 8
#define STORAGE_NUM_SWITCHES NUM_SWITCHES
#endif
#if defined(__cplusplus)
static_assert(NUM_SWITCHES_POSITIONS == NUM_SWITCHES * 3, "Wrong switches positions count");
#endif
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
#define NUM_SWITCHES_POSITIONS (NUM_SWITCHES * 3)
void keysInit(void);
uint8_t keyState(uint8_t index);