Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial commit to add launchpad and mission control into QMK. #4762

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keyboards/mechmini/v2/keymaps/lbibass_625_space/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),

[_FN2] = LAYOUT_625_space(
KC_PWR, KC_BRID, KC_BRIU, KC_NO, KC_NO, KC_NO, KC_NO, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, RESET,
KC_PWR, KC_BRID, KC_BRIU, KC_MISSION_CONTROL, KC_LAUNCHPAD, KC_NO, KC_NO, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, RESET,
MT(KC_LGUI, KC_ESC), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT, TG(1), KC_TRNS, KC_TRNS, KC_VOLD, KC_VOLU, KC_TRNS,
KC_TRNS, RGB_TOG, RGB_MOD, RGB_VAI, RGB_VAD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, KC_TRNS, KC_TRNS,
KC_CAPS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
Expand Down
8 changes: 4 additions & 4 deletions quantum/keymap_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ action_t action_for_key(uint8_t layer, keypos_t key)
uint8_t action_layer, when, mod;

switch (keycode) {
case KC_FN0 ... KC_FN31:
case KC_FN1 ... KC_FN31:
action.code = keymap_function_id_to_action(FN_INDEX(keycode));
break;
case KC_A ... KC_EXSEL:
Expand All @@ -64,9 +64,9 @@ action_t action_for_key(uint8_t layer, keypos_t key)
case KC_SYSTEM_POWER ... KC_SYSTEM_WAKE:
action.code = ACTION_USAGE_SYSTEM(KEYCODE2SYSTEM(keycode));
break;
case KC_AUDIO_MUTE ... KC_BRIGHTNESS_DOWN:
action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
break;
case KC_AUDIO_MUTE ... KC_MISSION_CONTROL:
action.code = ACTION_USAGE_CONSUMER(KEYCODE2CONSUMER(keycode));
break;
case KC_MS_UP ... KC_MS_ACCEL2:
action.code = ACTION_MOUSEKEY(keycode);
break;
Expand Down
18 changes: 11 additions & 7 deletions tmk_core/common/keycode.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

#define IS_SPECIAL(code) ((0xA5 <= (code) && (code) <= 0xDF) || (0xE8 <= (code) && (code) <= 0xFF))
#define IS_SYSTEM(code) (KC_PWR <= (code) && (code) <= KC_WAKE)
#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_BRID)
#define IS_CONSUMER(code) (KC_MUTE <= (code) && (code) <= KC_MICO)

#define IS_FN(code) (KC_FN0 <= (code) && (code) <= KC_FN31)

Expand All @@ -47,7 +47,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define MOD_INDEX(code) ((code) & 0x07)

#define FN_BIT(code) (1 << FN_INDEX(code))
#define FN_INDEX(code) ((code) - KC_FN0)
#define FN_INDEX(code) ((code) - KC_FN1)
#define FN_MIN KC_FN0
#define FN_MAX KC_FN31

Expand Down Expand Up @@ -173,6 +173,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define KC_MRWD KC_MEDIA_REWIND
#define KC_BRIU KC_BRIGHTNESS_UP
#define KC_BRID KC_BRIGHTNESS_DOWN
#define KC_MICO KC_MISSION_CONTROL
#define KC_LAUN KC_LAUNCHPAD

/* Mouse Keys */
#define KC_MS_U KC_MS_UP
Expand Down Expand Up @@ -432,9 +434,10 @@ enum hid_keyboard_keypad_usage {
};

/* Media and Function keys */
enum internal_special_keycodes {
enum internal_special_keycodes
{
/* Generic Desktop Page (0x01) */
KC_SYSTEM_POWER = 0xA5,
KC_SYSTEM_POWER = 0xA5,
KC_SYSTEM_SLEEP,
KC_SYSTEM_WAKE,

Expand All @@ -447,7 +450,7 @@ enum internal_special_keycodes {
KC_MEDIA_STOP,
KC_MEDIA_PLAY_PAUSE,
KC_MEDIA_SELECT,
KC_MEDIA_EJECT, //0xB0
KC_MEDIA_EJECT, //0xB0
KC_MAIL,
KC_CALCULATOR,
KC_MY_COMPUTER,
Expand All @@ -462,9 +465,10 @@ enum internal_special_keycodes {
KC_MEDIA_REWIND,
KC_BRIGHTNESS_UP,
KC_BRIGHTNESS_DOWN,
KC_MISSION_CONTROL,
KC_LAUNCHPAD,

/* Fn keys */
KC_FN0 = 0xC0,
KC_FN1,
KC_FN2,
KC_FN3,
Expand All @@ -480,7 +484,7 @@ enum internal_special_keycodes {
KC_FN13,
KC_FN14,
KC_FN15,
KC_FN16, //0xD0
KC_FN16, //0xD0
KC_FN17,
KC_FN18,
KC_FN19,
Expand Down
9 changes: 7 additions & 2 deletions tmk_core/common/report.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define TRANSPORT_PLAY_PAUSE 0x00CD
#define BRIGHTNESSUP 0x006F
#define BRIGHTNESSDOWN 0x0070
#define LAUNCHPAD 0x02a0
#define MISSION_CONTROL 0x029F

/* application launch */
#define AL_CC_CONFIG 0x0183
#define AL_EMAIL 0x018A
Expand Down Expand Up @@ -171,7 +174,7 @@ typedef struct {
(key == KC_SYSTEM_WAKE ? SYSTEM_WAKE_UP : 0)))

/* keycode to consumer usage */
#define KEYCODE2CONSUMER(key) \
#define KEYCODE2CONSUMER(key) \
(key == KC_AUDIO_MUTE ? AUDIO_MUTE : \
(key == KC_AUDIO_VOL_UP ? AUDIO_VOL_UP : \
(key == KC_AUDIO_VOL_DOWN ? AUDIO_VOL_DOWN : \
Expand All @@ -194,7 +197,9 @@ typedef struct {
(key == KC_WWW_REFRESH ? AC_REFRESH : \
(key == KC_BRIGHTNESS_UP ? BRIGHTNESSUP : \
(key == KC_BRIGHTNESS_DOWN ? BRIGHTNESSDOWN : \
(key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0)))))))))))))))))))))))
(key == KC_LAUNCHPAD ? LAUNCHPAD : \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the order matters, then launchpad should be last.

(key == KC_MISSION_CONTROL ? MISSION_CONTROL : \
(key == KC_WWW_FAVORITES ? AC_BOOKMARKS : 0)))))))))))))))))))))))))

uint8_t has_anykey(report_keyboard_t* keyboard_report);
uint8_t get_first_key(report_keyboard_t* keyboard_report);
Expand Down