refactor so we only use as many layers as we need

master
Stefan Dorn 2016-06-12 05:04:40 +01:00
parent 91e2e9f41f
commit 445e25b01b
4 changed files with 14 additions and 10 deletions

View File

@ -231,6 +231,7 @@ HEADER
File.open(LayoutFile, "w+") do |f|
f.puts header
f.puts "#define KB_LAYERS #{Key::Layers.size}"
f.puts "static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { #{keys} };"
f.puts "static const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { #{downs} };"
f.puts "static const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { #{ups} };"

View File

@ -25,7 +25,6 @@
#define KB_ROWS 6 // must match real life
#define KB_COLUMNS 14 // must match real life
#define KB_LAYERS 10
// Name ID // PC Mac Unix Boot Keyboard Req.
// --------------------------- ---- -- --- ---- ---------------------

View File

@ -2,6 +2,7 @@
// ergoDOX layout : saneo (generated)
// ----------------------------------------------------------------------------
#define KB_LAYERS 4
static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { KB_MATRIX_LAYER(
(uint8_t) KEY_NULL,
(uint8_t) KEY_0_RightParenthesis,

View File

@ -21,16 +21,25 @@ typedef enum StickyState {
StickyNone,
StickyOnceDown,
StickyOnceUp,
StickyLock
StickyLock,
} StickyState;
// layer data
#include "./main.h"
// ----------------------------------------------------------------------------
// layout data
// ----------------------------------------------------------------------------
#include "./keyboard/layout.c"
// defines:
// #define KB_Layers #{Layers.size}
// static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS];
// static const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS];
// static const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS];
// ----------------------------------------------------------------------------
// globals
// ----------------------------------------------------------------------------
static bool _kb_is_pressed[KB_ROWS][KB_COLUMNS];
static bool (*kb_is_pressed)[KB_ROWS][KB_COLUMNS] = &_kb_is_pressed;
@ -40,10 +49,6 @@ static bool (*kb_was_pressed)[KB_ROWS][KB_COLUMNS] = &_kb_was_pressed;
static bool kb_was_transparent[KB_ROWS][KB_COLUMNS];
static uint8_t layers_pressed[KB_ROWS][KB_COLUMNS];
static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS];
static const void_funptr_t PROGMEM _kb_layout_press[KB_LAYERS][KB_ROWS][KB_COLUMNS];
static const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS];
static uint8_t current_layer;
static uint8_t layer_offset;
static uint8_t current_row;
@ -573,5 +578,3 @@ void main_key_loop() {
// ---------------------------------------------------------------------------------
// generated keyboard layout
// ---------------------------------------------------------------------------------
#include "./keyboard/layout.c"