aboutsummaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-04-15 16:19:43 -0400
committerJack Humbert <jack.humb@gmail.com>2016-04-15 16:19:43 -0400
commit91119636631f24bd1bf97f32c3d39f8828da625f (patch)
treeb301cb936ef1985a00e634fa98fa90ccdc1b98f8 /quantum
parentbdb6dceaebc358dd4aae593d51d3ba0dd61858a9 (diff)
parent2557b91644d9565c43f0e5c27d45788d4a47f3eb (diff)
downloadfirmware-91119636631f24bd1bf97f32c3d39f8828da625f.tar.gz
firmware-91119636631f24bd1bf97f32c3d39f8828da625f.tar.bz2
firmware-91119636631f24bd1bf97f32c3d39f8828da625f.zip
Merge pull request #256 from jackhumbert/new_defaults
New default planck layout, audio fixes, makefile overwrites, tri-layer quantum-wide
Diffstat (limited to 'quantum')
-rw-r--r--quantum/audio.c7
-rw-r--r--quantum/keymap_common.c18
-rw-r--r--quantum/keymap_common.h4
-rw-r--r--quantum/quantum.mk8
4 files changed, 26 insertions, 11 deletions
diff --git a/quantum/audio.c b/quantum/audio.c
index f29d941d7..50e5505fe 100644
--- a/quantum/audio.c
+++ b/quantum/audio.c
@@ -255,7 +255,12 @@ ISR(TIMER3_COMPA_vect) {
note_position++;
- if (note_position >= note_length) {
+ bool end_of_note = false;
+ if (ICR3 > 0)
+ end_of_note = (note_position >= (note_length / ICR3 * 0xFFFF));
+ else
+ end_of_note = (note_position >= (note_length * 0x7FF));
+ if (end_of_note) {
current_note++;
if (current_note >= notes_length) {
if (notes_repeat) {
diff --git a/quantum/keymap_common.c b/quantum/keymap_common.c
index ae6cddb34..3a00d36f0 100644
--- a/quantum/keymap_common.c
+++ b/quantum/keymap_common.c
@@ -33,11 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "audio.h"
float goodbye[][2] = {
- {440.0*pow(2.0,(67)/12.0), 400},
- {0, 50},
- {440.0*pow(2.0,(60)/12.0), 400},
- {0, 50},
- {440.0*pow(2.0,(55)/12.0), 600},
+ {440.0*pow(2.0,(67)/12.0), 8},
+ {440.0*pow(2.0,(60)/12.0), 8},
+ {440.0*pow(2.0,(55)/12.0), 12},
};
#endif
@@ -90,7 +88,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
action_t action;
clear_keyboard();
#ifdef AUDIO_ENABLE
- play_notes(&goodbye, 5, false);
+ play_notes(&goodbye, 3, false);
#endif
_delay_ms(250);
#ifdef ATREUS_ASTAR
@@ -293,3 +291,11 @@ action_t keymap_func_to_action(uint16_t keycode)
// For FUNC without 8bit limit
return (action_t){ .code = pgm_read_word(&fn_actions[(int)keycode]) };
}
+
+void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
+ if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
+ layer_on(layer3);
+ } else {
+ layer_off(layer3);
+ }
+}
diff --git a/quantum/keymap_common.h b/quantum/keymap_common.h
index 4a877d2a7..7452a1ff3 100644
--- a/quantum/keymap_common.h
+++ b/quantum/keymap_common.h
@@ -208,5 +208,9 @@ extern const uint16_t fn_actions[];
#define UNICODE(n) (n | 0x8000)
#define UC(n) UNICODE(n)
+// For tri-layer
+void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
+#define IS_LAYER_ON(layer) ((layer_state) & (1UL<<(layer)))
+#define IS_LAYER_OFF(layer) ((!layer_state) & (1UL<<(layer)))
#endif
diff --git a/quantum/quantum.mk b/quantum/quantum.mk
index de93af7e8..17bb50171 100644
--- a/quantum/quantum.mk
+++ b/quantum/quantum.mk
@@ -23,19 +23,19 @@ ifndef CUSTOM_MATRIX
SRC += $(QUANTUM_DIR)/matrix.c
endif
-ifdef MIDI_ENABLE
+ifeq ($(strip $(MIDI_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_midi.c
endif
-ifdef AUDIO_ENABLE
+ifeq ($(strip $(AUDIO_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/audio.c
endif
-ifdef UNICODE_ENABLE
+ifeq ($(strip $(UNICODE_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/keymap_unicode.c
endif
-ifdef RGBLIGHT_ENABLE
+ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c
SRC += $(QUANTUM_DIR)/rgblight.c
OPT_DEFS += -DRGBLIGHT_ENABLE