From 1f8fc560e450b7e2d5a4ef84789c3a52d6375b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Mon, 12 Dec 2016 01:01:36 +0100 Subject: [PATCH] Clean up some concepts regarding slots and modules. --- right/src/module.h | 3 +-- right/src/slot.h | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/right/src/module.h b/right/src/module.h index 487be4e..9e79620 100644 --- a/right/src/module.h +++ b/right/src/module.h @@ -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: diff --git a/right/src/slot.h b/right/src/slot.h index b7fa96f..53f57c9 100644 --- a/right/src/slot.h +++ b/right/src/slot.h @@ -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