refactor so we only use as many layers as we need
parent
91e2e9f41f
commit
445e25b01b
|
@ -231,6 +231,7 @@ HEADER
|
||||||
|
|
||||||
File.open(LayoutFile, "w+") do |f|
|
File.open(LayoutFile, "w+") do |f|
|
||||||
f.puts header
|
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 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_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} };"
|
f.puts "static const void_funptr_t PROGMEM _kb_layout_release[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { #{ups} };"
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#define KB_ROWS 6 // must match real life
|
#define KB_ROWS 6 // must match real life
|
||||||
#define KB_COLUMNS 14 // must match real life
|
#define KB_COLUMNS 14 // must match real life
|
||||||
#define KB_LAYERS 10
|
|
||||||
|
|
||||||
// Name ID // PC Mac Unix Boot Keyboard Req.
|
// Name ID // PC Mac Unix Boot Keyboard Req.
|
||||||
// --------------------------- ---- -- --- ---- ---------------------
|
// --------------------------- ---- -- --- ---- ---------------------
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// ergoDOX layout : saneo (generated)
|
// ergoDOX layout : saneo (generated)
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define KB_LAYERS 4
|
||||||
static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { KB_MATRIX_LAYER(
|
static const uint8_t PROGMEM _kb_layout[KB_LAYERS][KB_ROWS][KB_COLUMNS] = { KB_MATRIX_LAYER(
|
||||||
(uint8_t) KEY_NULL,
|
(uint8_t) KEY_NULL,
|
||||||
(uint8_t) KEY_0_RightParenthesis,
|
(uint8_t) KEY_0_RightParenthesis,
|
||||||
|
|
21
src/main.c
21
src/main.c
|
@ -21,16 +21,25 @@ typedef enum StickyState {
|
||||||
StickyNone,
|
StickyNone,
|
||||||
StickyOnceDown,
|
StickyOnceDown,
|
||||||
StickyOnceUp,
|
StickyOnceUp,
|
||||||
StickyLock
|
StickyLock,
|
||||||
} StickyState;
|
} StickyState;
|
||||||
|
|
||||||
// layer data
|
|
||||||
#include "./main.h"
|
#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
|
// globals
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static bool _kb_is_pressed[KB_ROWS][KB_COLUMNS];
|
static bool _kb_is_pressed[KB_ROWS][KB_COLUMNS];
|
||||||
static bool (*kb_is_pressed)[KB_ROWS][KB_COLUMNS] = &_kb_is_pressed;
|
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 bool kb_was_transparent[KB_ROWS][KB_COLUMNS];
|
||||||
static uint8_t layers_pressed[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 current_layer;
|
||||||
static uint8_t layer_offset;
|
static uint8_t layer_offset;
|
||||||
static uint8_t current_row;
|
static uint8_t current_row;
|
||||||
|
@ -573,5 +578,3 @@ void main_key_loop() {
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
// generated keyboard layout
|
// generated keyboard layout
|
||||||
// ---------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "./keyboard/layout.c"
|
|
||||||
|
|
Loading…
Reference in New Issue