aboutsummaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
Diffstat (limited to 'quantum')
-rw-r--r--quantum/keycode_config.h2
-rw-r--r--quantum/keymap.h11
-rw-r--r--quantum/keymap_common.c (renamed from quantum/keymap.c)10
-rw-r--r--quantum/matrix.c2
-rw-r--r--quantum/quantum.c2
-rw-r--r--quantum/quantum.h8
6 files changed, 24 insertions, 11 deletions
diff --git a/quantum/keycode_config.h b/quantum/keycode_config.h
index c41c08706..6216eefc9 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -18,4 +18,4 @@ typedef union {
18 }; 18 };
19} keymap_config_t; 19} keymap_config_t;
20 20
21keymap_config_t keymap_config; \ No newline at end of file 21extern keymap_config_t keymap_config;
diff --git a/quantum/keymap.h b/quantum/keymap.h
index a994f4f2e..73f99f821 100644
--- a/quantum/keymap.h
+++ b/quantum/keymap.h
@@ -21,7 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
21#include <stdint.h> 21#include <stdint.h>
22#include <stdbool.h> 22#include <stdbool.h>
23#include "action.h" 23#include "action.h"
24#if defined(__AVR__)
24#include <avr/pgmspace.h> 25#include <avr/pgmspace.h>
26#endif
25#include "keycode.h" 27#include "keycode.h"
26#include "action_macro.h" 28#include "action_macro.h"
27#include "report.h" 29#include "report.h"
@@ -30,12 +32,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30#include "debug.h" 32#include "debug.h"
31#include "keycode_config.h" 33#include "keycode_config.h"
32 34
35// ChibiOS uses RESET in its FlagStatus enumeration
36// Therefore define it as QK_RESET here, to avoid name collision
37#if defined(PROTOCOL_CHIBIOS)
38#define RESET QK_RESET
39#endif
40
33/* translates key to keycode */ 41/* translates key to keycode */
34uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key); 42uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
35 43
36/* translates Fn keycode to action */
37action_t keymap_fn_to_action(uint16_t keycode);
38
39extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS]; 44extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
40extern const uint16_t fn_actions[]; 45extern const uint16_t fn_actions[];
41 46
diff --git a/quantum/keymap.c b/quantum/keymap_common.c
index 74fd518c9..76872ac59 100644
--- a/quantum/keymap.c
+++ b/quantum/keymap_common.c
@@ -19,7 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#include "report.h" 19#include "report.h"
20#include "keycode.h" 20#include "keycode.h"
21#include "action_layer.h" 21#include "action_layer.h"
22#if defined(__AVR__)
22#include <util/delay.h> 23#include <util/delay.h>
24#include <stdio.h>
25#endif
23#include "action.h" 26#include "action.h"
24#include "action_macro.h" 27#include "action_macro.h"
25#include "debug.h" 28#include "debug.h"
@@ -32,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
32 35
33extern keymap_config_t keymap_config; 36extern keymap_config_t keymap_config;
34 37
35#include <stdio.h>
36#include <inttypes.h> 38#include <inttypes.h>
37 39
38/* converts key to action */ 40/* converts key to action */
@@ -46,10 +48,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
46 48
47 action_t action; 49 action_t action;
48 uint8_t action_layer, when, mod; 50 uint8_t action_layer, when, mod;
51 // The arm-none-eabi compiler generates out of bounds warnings when using the fn_actions directly for some reason
52 const uint16_t* actions = fn_actions;
49 53
50 switch (keycode) { 54 switch (keycode) {
51 case KC_FN0 ... KC_FN31: 55 case KC_FN0 ... KC_FN31:
52 action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]); 56 action.code = pgm_read_word(&actions[FN_INDEX(keycode)]);
53 break; 57 break;
54 case KC_A ... KC_EXSEL: 58 case KC_A ... KC_EXSEL:
55 case KC_LCTRL ... KC_RGUI: 59 case KC_LCTRL ... KC_RGUI:
@@ -75,7 +79,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
75 case QK_FUNCTION ... QK_FUNCTION_MAX: ; 79 case QK_FUNCTION ... QK_FUNCTION_MAX: ;
76 // Is a shortcut for function action_layer, pull last 12bits 80 // Is a shortcut for function action_layer, pull last 12bits
77 // This means we have 4,096 FN macros at our disposal 81 // This means we have 4,096 FN macros at our disposal
78 action.code = pgm_read_word(&fn_actions[(int)keycode & 0xFFF]); 82 action.code = pgm_read_word(&actions[(int)keycode & 0xFFF]);
79 break; 83 break;
80 case QK_MACRO ... QK_MACRO_MAX: 84 case QK_MACRO ... QK_MACRO_MAX:
81 action.code = ACTION_MACRO(keycode & 0xFF); 85 action.code = ACTION_MACRO(keycode & 0xFF);
diff --git a/quantum/matrix.c b/quantum/matrix.c
index f5744658c..a38c13f15 100644
--- a/quantum/matrix.c
+++ b/quantum/matrix.c
@@ -17,7 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18#include <stdint.h> 18#include <stdint.h>
19#include <stdbool.h> 19#include <stdbool.h>
20#if defined(__AVR__)
20#include <avr/io.h> 21#include <avr/io.h>
22#endif
21#include "wait.h" 23#include "wait.h"
22#include "print.h" 24#include "print.h"
23#include "debug.h" 25#include "debug.h"
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 270b976e3..d59bd5a3f 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -88,7 +88,7 @@ bool process_record_quantum(keyrecord_t *record) {
88 stop_all_notes(); 88 stop_all_notes();
89 shutdown_user(); 89 shutdown_user();
90 #endif 90 #endif
91 _delay_ms(250); 91 wait_ms(250);
92 #ifdef ATREUS_ASTAR 92 #ifdef ATREUS_ASTAR
93 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific 93 *(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
94 #endif 94 #endif
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 9b5d310bd..3a0b74202 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -1,7 +1,12 @@
1#ifndef QUANTUM_H 1#ifndef QUANTUM_H
2#define QUANTUM_H 2#define QUANTUM_H
3 3
4#if defined(__AVR__)
4#include <avr/pgmspace.h> 5#include <avr/pgmspace.h>
6#include <avr/io.h>
7#include <avr/interrupt.h>
8#endif
9#include "wait.h"
5#include "matrix.h" 10#include "matrix.h"
6#include "keymap.h" 11#include "keymap.h"
7#ifdef BACKLIGHT_ENABLE 12#ifdef BACKLIGHT_ENABLE
@@ -14,12 +19,9 @@
14#include "action_layer.h" 19#include "action_layer.h"
15#include "eeconfig.h" 20#include "eeconfig.h"
16#include <stddef.h> 21#include <stddef.h>
17#include <avr/io.h>
18#include <util/delay.h>
19#include "bootloader.h" 22#include "bootloader.h"
20#include "timer.h" 23#include "timer.h"
21#include "config_common.h" 24#include "config_common.h"
22#include <avr/interrupt.h>
23#include "led.h" 25#include "led.h"
24#include "action_util.h" 26#include "action_util.h"
25#include <stdlib.h> 27#include <stdlib.h>