aboutsummaryrefslogtreecommitdiff
path: root/keymap-wrapper.h
blob: 9418ebb85fa5b149499b6331d3a8e5d29385627c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// -*- mode: c++ -*- 
#pragma once
 
#include "Kaleidoscope-MouseKeys.h"
#include "keymap-layers.h"
 
/* hack hack hack!
 
   for each layer, we need 2 arrays: one for the keys, one for the
   colours. But we want to defined each key next to its
   colour. Therefore we write our keymap using the CK and ColorKeymaps
   macros, and include this file.
 
   First, we define CK as "return the first argument (the key)", and
   ColorKeymaps as "a klaeidoscope keymap", and include our keymaps
   definition.
 
   Then, we *redefine* CK as "return the second argument (the colour)"
   and ColorKeymaps as "a DakkarColor color map", and include our
   keymaps definition *again* (make sure you don't add a `#pragma
   "once"` in there!)
 */
 
#define CK(k,c) k
 
#define ColorKeymaps(layers...) KEYMAPS(layers)
 
#include "keymaps.h"
 
#undef CK
#undef ColorKeymaps
 
#define CK(k,c) c
 
#define ColorKeymaps(layers...) \
  static constexpr uint8_t color_keymaps[][Kaleidoscope.device().matrix_rows * Kaleidoscope.device().matrix_columns] = { layers };
 
#include "keymaps.h"
 
#undef CK
#undef ColorKeymaps