annepro2: apply code review suggestions

This commit is contained in:
bwisn
2021-09-16 08:28:05 +02:00
parent 5ebfacb99f
commit e68f6a507f
7 changed files with 111 additions and 35 deletions
+3
View File
@@ -17,6 +17,9 @@
#pragma once
#include "quantum.h"
#include <stdint.h>
#include "qmk_ap2_led.h"
#include "config.h"
#define OVERRIDE __attribute__((noinline))
@@ -1,2 +1,20 @@
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
@@ -1,7 +1,20 @@
#include <stdint.h>
#include "annepro2.h"
#include "qmk_ap2_led.h"
#include "config.h"
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum anne_pro_layers {
_BASE_LAYER,
@@ -94,12 +107,6 @@ enum anne_pro_layers {
// clang-format on
const uint16_t keymaps_size = sizeof(keymaps);
void matrix_init_user(void) {}
void matrix_scan_user(void) {}
// Code to run after initializing the keyboard
void keyboard_post_init_user(void) {
// Here are two common functions that you can use. For more LED functions, refer to the file "qmk_ap2_led.h"
@@ -112,8 +119,6 @@ void keyboard_post_init_user(void) {
// annepro2LedSetProfile(i);
}
layer_state_t layer_state_set_user(layer_state_t layer) { return layer; }
// The function to handle the caps lock logic
bool led_update_user(led_t leds) {
if (leds.caps_lock) {
@@ -1,2 +1,20 @@
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
@@ -1,7 +1,20 @@
#include <stdint.h>
#include "annepro2.h"
#include "qmk_ap2_led.h"
#include "config.h"
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum anne_pro_layers {
_BASE_LAYER,
@@ -93,11 +106,6 @@ enum anne_pro_layers {
};
// clang-format on
const uint16_t keymaps_size = sizeof(keymaps);
void matrix_init_user(void) {}
void matrix_scan_user(void) {}
// Code to run after initializing the keyboard
void keyboard_post_init_user(void) {
@@ -111,8 +119,8 @@ void keyboard_post_init_user(void) {
// annepro2LedSetProfile(i);
}
layer_state_t layer_state_set_user(layer_state_t layer) {
switch (get_highest_layer(layer)) {
layer_state_t layer_state_set_user(layer_state_t state) {
switch (get_highest_layer(state)) {
case _FN1_LAYER:
// Set the leds to green
annepro2LedSetForegroundColor(0x00, 0xFF, 0x00);
@@ -126,7 +134,7 @@ layer_state_t layer_state_set_user(layer_state_t layer) {
annepro2LedResetForegroundColor();
break;
}
return layer;
return state;
}
// The function to handle the caps lock logic
@@ -1,2 +1,20 @@
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// Obins stock firmware has something similar to this already enabled, but disabled by default in QMK
#define PERMISSIVE_HOLD
+17 -11
View File
@@ -1,7 +1,20 @@
#include <stdint.h>
#include "annepro2.h"
#include "qmk_ap2_led.h"
#include "config.h"
/* Copyright 2021 OpenAnnePro community
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H
enum anne_pro_layers {
_BASE_LAYER,
@@ -91,11 +104,6 @@ enum anne_pro_layers {
),
};
// clang-format on
const uint16_t keymaps_size = sizeof(keymaps);
void matrix_init_user(void) {}
void matrix_scan_user(void) {}
// Code to run after initializing the keyboard
void keyboard_post_init_user(void) {
@@ -108,5 +116,3 @@ void keyboard_post_init_user(void) {
// annepro2-shine to see the order. Replace "i" with the index of your preferred profile. (i.e the RED profile is index 0)
// annepro2LedSetProfile(i);
}
layer_state_t layer_state_set_user(layer_state_t layer) { return layer; }