summaryrefslogtreecommitdiff
path: root/zephyr/program/skyrim/markarth/src
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/program/skyrim/markarth/src')
-rw-r--r--zephyr/program/skyrim/markarth/src/fan.c2
-rw-r--r--zephyr/program/skyrim/markarth/src/keyboard.c45
-rw-r--r--zephyr/program/skyrim/markarth/src/keyboard_customization.c83
3 files changed, 129 insertions, 1 deletions
diff --git a/zephyr/program/skyrim/markarth/src/fan.c b/zephyr/program/skyrim/markarth/src/fan.c
index 182463f846..7dc667a6fc 100644
--- a/zephyr/program/skyrim/markarth/src/fan.c
+++ b/zephyr/program/skyrim/markarth/src/fan.c
@@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(markarth, CONFIG_SKYRIM_LOG_LEVEL);
/*
* Skyrim fan support
*/
-static void fan_init(void)
+test_export_static void fan_init(void)
{
int ret;
uint32_t val;
diff --git a/zephyr/program/skyrim/markarth/src/keyboard.c b/zephyr/program/skyrim/markarth/src/keyboard.c
index db9e5d3b69..9a3baaaebe 100644
--- a/zephyr/program/skyrim/markarth/src/keyboard.c
+++ b/zephyr/program/skyrim/markarth/src/keyboard.c
@@ -4,6 +4,24 @@
*/
#include "ec_commands.h"
+#include "keyboard_scan.h"
+#include "timer.h"
+
+/* Keyboard scan setting */
+__override struct keyboard_scan_config keyscan_config = {
+ /* Increase from 50 us, because KSO_02 passes through the H1. */
+ .output_settle_us = 80,
+ /* Other values should be the same as the default configuration. */
+ .debounce_down_us = 9 * MSEC,
+ .debounce_up_us = 30 * MSEC,
+ .scan_period_us = 3 * MSEC,
+ .min_post_scan_delay_us = 1000,
+ .poll_timeout_us = 100 * MSEC,
+ .actual_key_mask = {
+ 0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xa4, 0xff, 0xf7, 0x55, 0xfb, 0xca,
+ },
+};
static const struct ec_response_keybd_config markarth_kb = {
.num_top_row_keys = 10,
@@ -27,3 +45,30 @@ board_vivaldi_keybd_config(void)
{
return &markarth_kb;
}
+
+/*
+ * Row Column info for Top row keys T1 - T10.
+ * on markarth_kb keyboard Row Column is customization
+ * need define row col to mapping matrix layout.
+ */
+__override const struct key {
+ uint8_t row;
+ uint8_t col;
+} vivaldi_keys[] = {
+ { .row = 0, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 3, .col = 4 }, /* T5 */
+ { .row = 2, .col = 4 }, /* T6 */
+ { .row = 1, .col = 4 }, /* T7 */
+ { .row = 2, .col = 9 }, /* T8 */
+ { .row = 1, .col = 9 }, /* T9 */
+ { .row = 0, .col = 4 }, /* T10 */
+ { .row = 3, .col = 0 }, /* T11 */
+ { .row = 1, .col = 5 }, /* T12 */
+ { .row = 3, .col = 5 }, /* T13 */
+ { .row = 0, .col = 9 }, /* T14 */
+ { .row = 0, .col = 11 }, /* T15 */
+};
+BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
diff --git a/zephyr/program/skyrim/markarth/src/keyboard_customization.c b/zephyr/program/skyrim/markarth/src/keyboard_customization.c
new file mode 100644
index 0000000000..6ba279666f
--- /dev/null
+++ b/zephyr/program/skyrim/markarth/src/keyboard_customization.c
@@ -0,0 +1,83 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "gpio.h"
+#include "keyboard_customization.h"
+#include "keyboard_protocol.h"
+#include "keyboard_raw.h"
+
+#include <zephyr/drivers/gpio.h>
+
+static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
+ { 0x0000, 0x0000, 0x0014, 0x0000, 0xe014, 0x0000, 0x0000, 0x0000 },
+ { 0x0058, 0x0076, 0x000d, 0x000e, 0x001c, 0x001a, 0x0016, 0x0015 },
+ { 0x0005, 0x000c, 0x0004, 0x0006, 0x0023, 0x0021, 0x0026, 0x0024 },
+ { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x002a, 0x0025, 0x002d },
+ { 0x000a, 0x0083, 0x000b, 0x0003, 0x001b, 0x0022, 0x001e, 0x001d },
+ { 0x0051, 0x0000, 0x005b, 0x0000, 0x0042, 0x0041, 0x003e, 0x0043 },
+ { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x003a, 0x003d, 0x003c },
+ { 0x0000, 0x0000, 0x0061, 0x0000, 0x0000, 0x0012, 0x0000, 0x0059 },
+ { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x004a, 0x0045, 0x004d },
+ { 0x0000, 0x0078, 0x0009, 0x0000, 0x004b, 0x0049, 0x0046, 0x0044 },
+ { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 },
+ { 0x0000, 0x0066, 0x0000, 0x005d, 0x005a, 0x0029, 0xe072, 0xe075 },
+ { 0x0000, 0xe064, 0x0000, 0x0067, 0x0000, 0x0000, 0xe074, 0xe06b },
+};
+
+uint16_t get_scancode_set2(uint8_t row, uint8_t col)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
+ return scancode_set2[col][row];
+ return 0;
+}
+
+void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
+ scancode_set2[col][row] = val;
+}
+
+#ifdef CONFIG_KEYBOARD_DEBUG
+static uint8_t keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
+ { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' },
+ { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3,
+ KLLI_UNKNO },
+ { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC },
+ { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' },
+ { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' },
+ { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' },
+ { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_LEFT, KLLI_UNKNO },
+ { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' },
+ { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' },
+ { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
+};
+
+uint8_t get_keycap_label(uint8_t row, uint8_t col)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
+ return keycap_label[col][row];
+ return KLLI_UNKNO;
+}
+
+void set_keycap_label(uint8_t row, uint8_t col, uint8_t val)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
+ keycap_label[col][row] = val;
+}
+#endif