summaryrefslogtreecommitdiff
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 c41c08706c..6216eefc90 100644
--- a/quantum/keycode_config.h
+++ b/quantum/keycode_config.h
@@ -18,4 +18,4 @@ typedef union {
};
} keymap_config_t;
-keymap_config_t keymap_config; \ No newline at end of file
+extern keymap_config_t keymap_config;
diff --git a/quantum/keymap.h b/quantum/keymap.h
index a994f4f2e5..73f99f8211 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/>.
#include <stdint.h>
#include <stdbool.h>
#include "action.h"
+#if defined(__AVR__)
#include <avr/pgmspace.h>
+#endif
#include "keycode.h"
#include "action_macro.h"
#include "report.h"
@@ -30,12 +32,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "debug.h"
#include "keycode_config.h"
+// ChibiOS uses RESET in its FlagStatus enumeration
+// Therefore define it as QK_RESET here, to avoid name collision
+#if defined(PROTOCOL_CHIBIOS)
+#define RESET QK_RESET
+#endif
+
/* translates key to keycode */
uint16_t keymap_key_to_keycode(uint8_t layer, keypos_t key);
-/* translates Fn keycode to action */
-action_t keymap_fn_to_action(uint16_t keycode);
-
extern const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS];
extern const uint16_t fn_actions[];
diff --git a/quantum/keymap.c b/quantum/keymap_common.c
index 74fd518c9b..76872ac592 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/>.
#include "report.h"
#include "keycode.h"
#include "action_layer.h"
+#if defined(__AVR__)
#include <util/delay.h>
+#include <stdio.h>
+#endif
#include "action.h"
#include "action_macro.h"
#include "debug.h"
@@ -32,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
extern keymap_config_t keymap_config;
-#include <stdio.h>
#include <inttypes.h>
/* converts key to action */
@@ -46,10 +48,12 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action;
uint8_t action_layer, when, mod;
+ // The arm-none-eabi compiler generates out of bounds warnings when using the fn_actions directly for some reason
+ const uint16_t* actions = fn_actions;
switch (keycode) {
case KC_FN0 ... KC_FN31:
- action.code = pgm_read_word(&fn_actions[FN_INDEX(keycode)]);
+ action.code = pgm_read_word(&actions[FN_INDEX(keycode)]);
break;
case KC_A ... KC_EXSEL:
case KC_LCTRL ... KC_RGUI:
@@ -75,7 +79,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case QK_FUNCTION ... QK_FUNCTION_MAX: ;
// Is a shortcut for function action_layer, pull last 12bits
// This means we have 4,096 FN macros at our disposal
- action.code = pgm_read_word(&fn_actions[(int)keycode & 0xFFF]);
+ action.code = pgm_read_word(&actions[(int)keycode & 0xFFF]);
break;
case QK_MACRO ... QK_MACRO_MAX:
action.code = ACTION_MACRO(keycode & 0xFF);
diff --git a/quantum/matrix.c b/quantum/matrix.c
index f5744658cf..a38c13f15b 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/>.
*/
#include <stdint.h>
#include <stdbool.h>
+#if defined(__AVR__)
#include <avr/io.h>
+#endif
#include "wait.h"
#include "print.h"
#include "debug.h"
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 270b976e36..d59bd5a3f8 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -88,7 +88,7 @@ bool process_record_quantum(keyrecord_t *record) {
stop_all_notes();
shutdown_user();
#endif
- _delay_ms(250);
+ wait_ms(250);
#ifdef ATREUS_ASTAR
*(uint16_t *)0x0800 = 0x7777; // these two are a-star-specific
#endif
diff --git a/quantum/quantum.h b/quantum/quantum.h
index 9b5d310bd4..3a0b742028 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -1,7 +1,12 @@
#ifndef QUANTUM_H
#define QUANTUM_H
+#if defined(__AVR__)
#include <avr/pgmspace.h>
+#include <avr/io.h>
+#include <avr/interrupt.h>
+#endif
+#include "wait.h"
#include "matrix.h"
#include "keymap.h"
#ifdef BACKLIGHT_ENABLE
@@ -14,12 +19,9 @@
#include "action_layer.h"
#include "eeconfig.h"
#include <stddef.h>
-#include <avr/io.h>
-#include <util/delay.h>
#include "bootloader.h"
#include "timer.h"
#include "config_common.h"
-#include <avr/interrupt.h>
#include "led.h"
#include "action_util.h"
#include <stdlib.h>