Clean up some concepts regarding slots and modules.

This commit is contained in:
László Monda
2016-12-12 01:01:36 +01:00
parent 871a0ec84a
commit 1f8fc560e4
2 changed files with 14 additions and 12 deletions

View File

@@ -49,8 +49,7 @@
uint8_t pointerCount;
uint8_t keyCount;
uint8_t keyStates[MAX_KEY_COUNT_PER_MODULE];
pointer_t pointers[MAX_POINTER_COUNT_PER_MODULE];
key_action_t keyActions[LAYER_COUNT][MAX_KEY_COUNT_PER_MODULE];
uint8_t pointerRole;
} module_t;
// Variables:

View File

@@ -1,8 +1,14 @@
#ifndef __SLOT_H__
#define __SLOT_H__
// Slots provide a way to avoid I2C address collision of modules as only a single module can
// allocate a given slot.
// A slot is a physical space that can be occupied by a module. No more than a single module
// can occupy a slot. Think of the pogo pin connector of the left keyboard half or the right
// keyboard half. Given their physical design, it's impossible to mount two modules to a slot.
//
// Slots are useful for two reasons:
// 1. Every slot has a dedicated I2C address to avoid the I2C address collision of modules.
// 2. Slots denote the maximum number of modules that can be mounted at a given time, allowing
// for the allocation of static memory structures for modules.
// Macros:
@@ -10,18 +16,15 @@
#define SLOT_ID_LEFT_KEYBOARD_HALF 1
#define SLOT_ID_LEFT_MODULE 2
#define SLOT_ID_RIGHT_MODULE 3
#define SLOT_ID_BOTH_SIDED_MODULE 4
// The 7-bit I2C addresses below 0x08 are reserved.
#define SLOT_I2C_ADDRESS_LEFT_KEYBOARD_HALF 0x08
#define SLOT_I2C_ADDRESS_LEFT_MODULE 0x09
#define SLOT_I2C_ADDRESS_RIGHT_MODULE 0x0A
#define SLOT_I2C_ADDRESS_BOTH_SIDED_MODULE 0x0B
#define SLOT_I2C_ADDRESS_LEFT_KEYBOARD_HALF 0x0C
#define SLOT_I2C_ADDRESS_LEFT_KEYBOARD_HALF 0x08
#define SLOT_I2C_ADDRESS_LEFT_MODULE 0x09
#define SLOT_I2C_ADDRESS_RIGHT_MODULE 0x0A
#define SLOT_I2C_ADDRESS_MIN 0x08
#define SLOT_I2C_ADDRESS_MAX 0x0C
#define SLOT_I2C_ADDRESS_MAX 0x0A
#define SLOT_COUNT 5
#define SLOT_COUNT 4
#endif