[ion] Keyboard: specify different keyboard layouts per platform/model

This commit is contained in:
Émilie Feral
2019-04-12 14:40:48 +02:00
parent b7cdd34ec1
commit 43725bcac2
10 changed files with 63 additions and 20 deletions

View File

@@ -6,6 +6,11 @@ endif
SFLAGS += -Iion/include -DKD_CONFIG_H=1
ifndef ION_KEYBOARD_LAYOUT
$(error platform.mak should define ION_KEYBOARD_LAYOUT)
endif
SFLAGS += -Iion/include/ion/keyboard/$(ION_KEYBOARD_LAYOUT)
include ion/src/$(PLATFORM)/Makefile
include ion/src/shared/tools/Makefile

View File

@@ -6,29 +6,11 @@ extern "C" {
#include <assert.h>
}
#include <keyboard_layout.h>
namespace Ion {
namespace Keyboard {
enum class Key : uint8_t {
A1=0, A2=1, A3=2, A4=3, A5=4, A6=5,
B1=6, B2=7, B3=8, /*B4=9, B5=10, B6=11, */
C1=12, C2=13, C3=14, C4=15, C5=16, C6=17,
D1=18, D2=19, D3=20, D4=21, D5=22, D6=23,
E1=24, E2=25, E3=26, E4=27, E5=28, E6=29,
F1=30, F2=31, F3=32, F4=33, F5=34, // F6=35,
G1=36, G2=37, G3=38, G4=39, G5=40, // G6=41,
H1=42, H2=43, H3=44, H4=45, H5=46, // H6=47,
I1=48, I2=49, I3=50, I4=51, I5=52, // I6=53,
None = 54
};
#define MODEL_N0101 1
#ifdef MODEL_N0101
constexpr Key PowerKey = Key::B3;
#else
constexpr Key PowerKey = Key::B2;
#endif
constexpr Key ValidKeys[] = {
Key::A1, Key::A2, Key::A3, Key::A4, Key::A5, Key::A6, Key::B1, PowerKey,
Key::C1, Key::C2, Key::C3, Key::C4, Key::C5, Key::C6, Key::D1, Key::D2,

View File

@@ -0,0 +1,25 @@
#ifndef ION_KEYBOARD_LAYOUT_B2_H
#define ION_KEYBOARD_LAYOUT_B2_H
namespace Ion {
namespace Keyboard {
enum class Key : uint8_t {
A1=0, A2=1, A3=2, A4=3, A5=4, A6=5,
B1=6, B2=7, /*B3=8, B4=9, B5=10, B6=11, */
C1=12, C2=13, C3=14, C4=15, C5=16, C6=17,
D1=18, D2=19, D3=20, D4=21, D5=22, D6=23,
E1=24, E2=25, E3=26, E4=27, E5=28, E6=29,
F1=30, F2=31, F3=32, F4=33, F5=34, // F6=35,
G1=36, G2=37, G3=38, G4=39, G5=40, // G6=41,
H1=42, H2=43, H3=44, H4=45, H5=46, // H6=47,
I1=48, I2=49, I3=50, I4=51, I5=52, // I6=53,
None = 54
};
constexpr Key PowerKey = Key::B2;
}
}
#endif

View File

@@ -0,0 +1,25 @@
#ifndef ION_KEYBOARD_LAYOUT_B3_H
#define ION_KEYBOARD_LAYOUT_B3_H
namespace Ion {
namespace Keyboard {
enum class Key : uint8_t {
A1=0, A2=1, A3=2, A4=3, A5=4, A6=5,
B1=6, /*B2=7,*/ B3=8, /*B4=9, B5=10, B6=11, */
C1=12, C2=13, C3=14, C4=15, C5=16, C6=17,
D1=18, D2=19, D3=20, D4=21, D5=22, D6=23,
E1=24, E2=25, E3=26, E4=27, E5=28, E6=29,
F1=30, F2=31, F3=32, F4=33, F5=34, // F6=35,
G1=36, G2=37, G3=38, G4=39, G5=40, // G6=41,
H1=42, H2=43, H3=44, H4=45, H5=46, // H6=47,
I1=48, I2=49, I3=50, I4=51, I5=52, // I6=53,
None = 54
};
constexpr Key PowerKey = Key::B3;
}
}
#endif

View File

@@ -1,5 +1,6 @@
TOOLCHAIN ?= host-gcc
USE_LIBA ?= 0
ION_KEYBOARD_LAYOUT = layout_B2
EXE = bin
EPSILON_ONBOARDING_APP = 0

View File

@@ -1 +1,2 @@
TOOLCHAIN ?= arm-gcc-m4f
ION_KEYBOARD_LAYOUT = layout_B2

View File

@@ -1 +1,2 @@
TOOLCHAIN ?= arm-gcc-m7f
ION_KEYBOARD_LAYOUT = layout_B3

View File

@@ -1,5 +1,6 @@
TOOLCHAIN = emscripten
USE_LIBA = 0
ION_KEYBOARD_LAYOUT = layout_B2
EXE = js
EPSILON_ONBOARDING_APP = 0
EPSILON_GETOPT = 1

View File

@@ -1,4 +1,5 @@
USE_LIBA = 0
ION_KEYBOARD_LAYOUT = layout_B2
EPSILON_ONBOARDING_APP = 0
EPSILON_GETOPT = 1

View File

@@ -3,6 +3,7 @@ ifeq ($(OS),Windows_NT)
TOOLCHAIN = mingw
endif
USE_LIBA = 0
ION_KEYBOARD_LAYOUT = layout_B2
EXE = elf
EPSILON_ONBOARDING_APP = 0
SFLAGS += -fPIE