forked from mirrors/qmk_userspace
Remove *_CALLBACK_ENABLE related code; Fix V2 Max device name
This commit is contained in:
parent
0b812c9dc0
commit
f9f4cf410f
21 changed files with 67 additions and 435 deletions
|
@ -296,14 +296,6 @@ bool factory_test_task(void) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
void factory_test_init(void) {
|
|
||||||
register_keychron_task(factory_test_task, false);
|
|
||||||
register_record_process(process_record_factory_test, false);
|
|
||||||
register_led_indicator_task(factory_test_indicator, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void factory_test_send(uint8_t *payload, uint8_t length) {
|
void factory_test_send(uint8_t *payload, uint8_t length) {
|
||||||
#ifdef RAW_ENABLE
|
#ifdef RAW_ENABLE
|
||||||
uint16_t checksum = 0;
|
uint16_t checksum = 0;
|
||||||
|
|
|
@ -22,139 +22,18 @@
|
||||||
# include "factory_test.h"
|
# include "factory_test.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
|
|
||||||
typedef struct lk_node {
|
|
||||||
keychron_cb lk_cb;
|
|
||||||
struct lk_node *next;
|
|
||||||
} lk_Node;
|
|
||||||
|
|
||||||
typedef struct lk_process_node {
|
|
||||||
keychron_record_process_cb process_cb;
|
|
||||||
struct lk_process_node *next;
|
|
||||||
} lk_process_Node;
|
|
||||||
|
|
||||||
lk_Node *p;
|
|
||||||
lk_Node *lk_task_list = NULL;
|
|
||||||
lk_process_Node *p_process;
|
|
||||||
lk_process_Node *lk_record_process_list = NULL;
|
|
||||||
|
|
||||||
# if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
lk_Node *led_indicator_task_list = NULL;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
void register_keychron_cb(lk_Node **head, keychron_cb cb, bool priority) {
|
|
||||||
/* Create task node */
|
|
||||||
lk_Node *task = (lk_Node *)malloc(sizeof(lk_Node));
|
|
||||||
task->lk_cb = cb;
|
|
||||||
task->next = NULL;
|
|
||||||
|
|
||||||
/* Add to the list*/
|
|
||||||
if (*head) {
|
|
||||||
if (priority) {
|
|
||||||
task->next = *head;
|
|
||||||
*head = task;
|
|
||||||
} else {
|
|
||||||
p = *head;
|
|
||||||
while (p->next)
|
|
||||||
p = p->next;
|
|
||||||
p->next = task;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
*head = task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void deregister_keychron_cb(lk_Node **head, keychron_cb cb) {
|
|
||||||
p = *head;
|
|
||||||
while (p) {
|
|
||||||
if (p->lk_cb == cb) {
|
|
||||||
// lk_Node* temp = p;
|
|
||||||
// if
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_keychron_task(keychron_cb cb, bool priority) {
|
|
||||||
register_keychron_cb(&lk_task_list, cb, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_led_indicator_task(keychron_cb cb, bool priority) {
|
|
||||||
register_keychron_cb(&led_indicator_task_list, cb, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_record_process(keychron_record_process_cb cb, bool priority) {
|
|
||||||
lk_process_Node *process = (lk_process_Node *)malloc(sizeof(lk_process_Node));
|
|
||||||
process->process_cb = cb;
|
|
||||||
process->next = NULL;
|
|
||||||
|
|
||||||
/* Add to the list*/
|
|
||||||
if (lk_record_process_list) {
|
|
||||||
if (priority) {
|
|
||||||
process->next = lk_record_process_list;
|
|
||||||
lk_record_process_list = process;
|
|
||||||
} else {
|
|
||||||
p_process = lk_record_process_list;
|
|
||||||
while (p_process->next)
|
|
||||||
p_process = p_process->next;
|
|
||||||
p_process->next = process;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lk_record_process_list = process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void keychron_task(void) {
|
|
||||||
p = lk_task_list;
|
|
||||||
while (p) {
|
|
||||||
p->lk_cb();
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
p_process = lk_record_process_list;
|
|
||||||
while (p_process) {
|
|
||||||
if (!p_process->process_cb(keycode, record)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
p_process = p_process->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
# if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
# if defined(LED_MATRIX_ENABLE)
|
|
||||||
inline bool led_matrix_indicators_keychron(void) {
|
|
||||||
# else
|
|
||||||
inline bool rgb_matrix_indicators_keychron(void) {
|
|
||||||
# endif
|
|
||||||
|
|
||||||
p = led_indicator_task_list;
|
|
||||||
while (p) {
|
|
||||||
p->lk_cb();
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__attribute__((weak)) bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record) {
|
__attribute__((weak)) bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
|
||||||
# ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool process_record_wireless(uint16_t keycode, keyrecord_t * record);
|
extern bool process_record_wireless(uint16_t keycode, keyrecord_t * record);
|
||||||
if (!process_record_wireless(keycode, record)) return false;
|
if (!process_record_wireless(keycode, record)) return false;
|
||||||
# endif
|
#endif
|
||||||
# ifdef FACTORY_TEST_ENABLE
|
#ifdef FACTORY_TEST_ENABLE
|
||||||
if (!process_record_factory_test(keycode, record)) return false;
|
if (!process_record_factory_test(keycode, record)) return false;
|
||||||
# endif
|
#endif
|
||||||
// extern bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record);
|
// extern bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
if (!process_record_keychron_kb(keycode, record)) return false;
|
if (!process_record_keychron_kb(keycode, record)) return false;
|
||||||
|
@ -162,49 +41,48 @@ bool process_record_keychron(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
# if defined(LED_MATRIX_ENABLE)
|
#if defined(LED_MATRIX_ENABLE)
|
||||||
bool led_matrix_indicators_keychron(void) {
|
bool led_matrix_indicators_keychron(void) {
|
||||||
# ifdef LK_WIRELESS_ENABLE
|
# ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool led_matrix_indicators_bt(void);
|
extern bool led_matrix_indicators_bt(void);
|
||||||
led_matrix_indicators_bt();
|
led_matrix_indicators_bt();
|
||||||
# endif
|
# endif
|
||||||
# ifdef FACTORY_TEST_ENABLE
|
# ifdef FACTORY_TEST_ENABLE
|
||||||
factory_test_indicator();
|
factory_test_indicator();
|
||||||
# endif
|
# endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# if defined(RGB_MATRIX_ENABLE)
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
bool rgb_matrix_indicators_keychron(void) {
|
bool rgb_matrix_indicators_keychron(void) {
|
||||||
# ifdef LK_WIRELESS_ENABLE
|
# ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool rgb_matrix_indicators_bt(void);
|
extern bool rgb_matrix_indicators_bt(void);
|
||||||
rgb_matrix_indicators_bt();
|
rgb_matrix_indicators_bt();
|
||||||
# endif
|
# endif
|
||||||
# ifdef FACTORY_TEST_ENABLE
|
# ifdef FACTORY_TEST_ENABLE
|
||||||
factory_test_indicator();
|
factory_test_indicator();
|
||||||
# endif
|
# endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
__attribute__((weak)) bool keychron_task_kb(void) {
|
__attribute__((weak)) bool keychron_task_kb(void) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void keychron_task(void) {
|
void keychron_task(void) {
|
||||||
# ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
extern void wireless_tasks(void);
|
extern void wireless_tasks(void);
|
||||||
wireless_tasks();
|
wireless_tasks();
|
||||||
# endif
|
#endif
|
||||||
# ifdef FACTORY_TEST_ENABLE
|
#ifdef FACTORY_TEST_ENABLE
|
||||||
factory_test_task();
|
factory_test_task();
|
||||||
# endif
|
#endif
|
||||||
keychron_common_task();
|
keychron_common_task();
|
||||||
|
|
||||||
keychron_task_kb();
|
keychron_task_kb();
|
||||||
}
|
}
|
||||||
#endif // #ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (!process_record_user(keycode, record)) return false;
|
if (!process_record_user(keycode, record)) return false;
|
||||||
|
|
|
@ -13,29 +13,13 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
typedef bool (*keychron_cb)(void);
|
|
||||||
typedef bool (*keychron_record_process_cb)(uint16_t keycode, keyrecord_t *record);
|
|
||||||
|
|
||||||
|
|
||||||
bool process_record_keychron(uint16_t keycode, keyrecord_t *record);
|
|
||||||
|
|
||||||
void register_keychron_task(keychron_cb cb, bool priority);
|
|
||||||
void register_record_process(keychron_record_process_cb cb, bool priority);
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
void register_led_indicator_task(keychron_cb cb, bool priority);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
bool keychron_task_kb(void);
|
bool keychron_task_kb(void);
|
||||||
bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record);
|
bool process_record_keychron_kb(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#endif
|
|
||||||
void keychron_task(void);
|
void keychron_task(void);
|
||||||
|
|
||||||
|
|
|
@ -180,9 +180,6 @@ void indicator_init(void) {
|
||||||
setPinOutput(BAT_LOW_LED_PIN);
|
setPinOutput(BAT_LOW_LED_PIN);
|
||||||
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
register_led_indicator_task(LED_INDICATORS_KB, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||||
|
|
|
@ -59,10 +59,6 @@ void report_buffer_init(void) {
|
||||||
report_buffer_queue_tail = 0;
|
report_buffer_queue_tail = 0;
|
||||||
retry = 0;
|
retry = 0;
|
||||||
report_timer_buffer = timer_read32();
|
report_timer_buffer = timer_read32();
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
register_keychron_task(report_buffer_task, true);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool report_buffer_enqueue(report_buffer_t *report) {
|
bool report_buffer_enqueue(report_buffer_t *report) {
|
||||||
|
|
|
@ -113,10 +113,6 @@ void wireless_init(void) {
|
||||||
nkro.bluetooth = keymap_config.nkro;
|
nkro.bluetooth = keymap_config.nkro;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
register_wt_tasks();
|
|
||||||
register_record_process(process_record_wireless, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,9 +34,3 @@ bool wireless_tasks(void) {
|
||||||
if (get_transport() == TRANSPORT_USB) usb_remote_wakeup();
|
if (get_transport() == TRANSPORT_USB) usb_remote_wakeup();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
void register_wt_tasks(void) {
|
|
||||||
register_keychron_task(wireless_tasks, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
# include "battery.h"
|
# include "battery.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
bool keychron_task_kb(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -55,11 +51,6 @@ void keyboard_post_init_kb(void) {
|
||||||
encoder_cb_init();
|
encoder_cb_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
factory_test_init();
|
|
||||||
register_record_process(process_record_keychron_kb, false);
|
|
||||||
register_keychron_task(keychron_task_kb, false);
|
|
||||||
#endif
|
|
||||||
keyboard_post_init_user();
|
keyboard_post_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
# include "battery.h"
|
# include "battery.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
bool keychron_task_kb(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -55,11 +51,6 @@ void keyboard_post_init_kb(void) {
|
||||||
encoder_cb_init();
|
encoder_cb_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
factory_test_init();
|
|
||||||
register_record_process(process_record_keychron_kb, false);
|
|
||||||
register_keychron_task(keychron_task_kb, false);
|
|
||||||
#endif
|
|
||||||
keyboard_post_init_user();
|
keyboard_post_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,10 +27,6 @@
|
||||||
# include "battery.h"
|
# include "battery.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
bool keychron_task_kb(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DIP_SWITCH_ENABLE
|
#ifdef DIP_SWITCH_ENABLE
|
||||||
bool dip_switch_update_kb(uint8_t index, bool active) {
|
bool dip_switch_update_kb(uint8_t index, bool active) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -55,11 +51,6 @@ void keyboard_post_init_kb(void) {
|
||||||
encoder_cb_init();
|
encoder_cb_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef KEYCHRON_CALLBACK_ENABLE
|
|
||||||
factory_test_init();
|
|
||||||
register_record_process(process_record_keychron_kb, false);
|
|
||||||
register_keychron_task(keychron_task_kb, false);
|
|
||||||
#endif
|
|
||||||
keyboard_post_init_user();
|
keyboard_post_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"keyboard_name": "Keychron Q2 Max",
|
"keyboard_name": "Keychron V2 Max",
|
||||||
"manufacturer": "Keychron",
|
"manufacturer": "Keychron",
|
||||||
"url": "https://github.com/Keychron",
|
"url": "https://github.com/Keychron",
|
||||||
"maintainer": "lokher",
|
"maintainer": "lokher",
|
||||||
|
|
|
@ -68,7 +68,6 @@ bool keychron_task_kb(void) {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
writePin(BAT_LOW_LED_PIN, BAT_LOW_LED_PIN_ON_STATE);
|
writePin(BAT_LOW_LED_PIN, BAT_LOW_LED_PIN_ON_STATE);
|
||||||
|
|
|
@ -296,14 +296,6 @@ bool factory_test_task(void) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
void factory_test_init(void) {
|
|
||||||
register_lemokey_task(factory_test_task, false);
|
|
||||||
register_record_process(process_record_factory_test, false);
|
|
||||||
register_led_indicator_task(factory_test_indicator, false);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void factory_test_send(uint8_t *payload, uint8_t length) {
|
void factory_test_send(uint8_t *payload, uint8_t length) {
|
||||||
#ifdef RAW_ENABLE
|
#ifdef RAW_ENABLE
|
||||||
uint16_t checksum = 0;
|
uint16_t checksum = 0;
|
||||||
|
|
|
@ -19,182 +19,57 @@
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "lemokey_common.h"
|
#include "lemokey_common.h"
|
||||||
#ifdef FACTORY_TEST_ENABLE
|
#ifdef FACTORY_TEST_ENABLE
|
||||||
#include "factory_test.h"
|
# include "factory_test.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
__attribute__((weak)) bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
|
||||||
typedef struct lk_node {
|
|
||||||
lemokey_cb lk_cb;
|
|
||||||
struct lk_node* next;
|
|
||||||
}lk_Node;
|
|
||||||
|
|
||||||
typedef struct lk_process_node {
|
|
||||||
lemokey_record_process_cb process_cb;
|
|
||||||
struct lk_process_node* next;
|
|
||||||
}lk_process_Node;
|
|
||||||
|
|
||||||
|
|
||||||
lk_Node *p;
|
|
||||||
lk_Node *lk_task_list = NULL;
|
|
||||||
lk_process_Node *p_process;
|
|
||||||
lk_process_Node *lk_record_process_list = NULL;
|
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
lk_Node *led_indicator_task_list = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void register_lemokey_cb(lk_Node **head, lemokey_cb cb, bool priority) {
|
|
||||||
/* Create task node */
|
|
||||||
lk_Node* task = (lk_Node*)malloc(sizeof(lk_Node));
|
|
||||||
task->lk_cb = cb;
|
|
||||||
task->next = NULL;
|
|
||||||
|
|
||||||
/* Add to the list*/
|
|
||||||
if (*head) {
|
|
||||||
if (priority) {
|
|
||||||
task->next = *head;
|
|
||||||
*head = task;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p = *head;
|
|
||||||
while (p->next) p = p->next;
|
|
||||||
p->next = task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*head = task;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void deregister_lemokey_cb(lk_Node **head, lemokey_cb cb) {
|
|
||||||
|
|
||||||
p = *head;
|
|
||||||
while (p) {
|
|
||||||
if (p->lk_cb == cb) {
|
|
||||||
// lk_Node* temp = p;
|
|
||||||
//if
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_lemokey_task(lemokey_cb cb, bool priority) {
|
|
||||||
register_lemokey_cb(&lk_task_list, cb, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_led_indicator_task(lemokey_cb cb, bool priority) {
|
|
||||||
register_lemokey_cb(&led_indicator_task_list, cb, priority);
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_record_process(lemokey_record_process_cb cb, bool priority) {
|
|
||||||
lk_process_Node* process = (lk_process_Node*)malloc(sizeof(lk_process_Node));
|
|
||||||
process->process_cb = cb;
|
|
||||||
process->next = NULL;
|
|
||||||
|
|
||||||
/* Add to the list*/
|
|
||||||
if (lk_record_process_list) {
|
|
||||||
if (priority) {
|
|
||||||
process->next = lk_record_process_list;
|
|
||||||
lk_record_process_list = process;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
p_process = lk_record_process_list;
|
|
||||||
while (p_process->next) p_process = p_process->next;
|
|
||||||
p_process->next = process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
lk_record_process_list = process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void lemokey_task(void) {
|
|
||||||
p = lk_task_list;
|
|
||||||
while (p) {
|
|
||||||
p->lk_cb();
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool process_record_lemokey(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
|
|
||||||
p_process = lk_record_process_list;
|
|
||||||
while (p_process) {
|
|
||||||
if (!p_process->process_cb(keycode, record)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
p_process = p_process->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
#if defined(LED_MATRIX_ENABLE)
|
|
||||||
inline bool led_matrix_indicators_lemokey(void) {
|
|
||||||
#else
|
|
||||||
inline bool rgb_matrix_indicators_lemokey(void) {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
p = led_indicator_task_list;
|
|
||||||
while (p) {
|
|
||||||
p->lk_cb();
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
__attribute__((weak)) bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record) { return true; }
|
|
||||||
|
|
||||||
bool process_record_lemokey(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_lemokey(uint16_t keycode, keyrecord_t *record) {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool process_record_wireless(uint16_t keycode, keyrecord_t *record);
|
extern bool process_record_wireless(uint16_t keycode, keyrecord_t * record);
|
||||||
if (!process_record_wireless(keycode, record))
|
if (!process_record_wireless(keycode, record)) return false;
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef FACTORY_TEST_ENABLE
|
#ifdef FACTORY_TEST_ENABLE
|
||||||
if (!process_record_factory_test(keycode, record))
|
if (!process_record_factory_test(keycode, record)) return false;
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
//extern bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record);
|
// extern bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
if (!process_record_lemokey_kb(keycode, record))
|
if (!process_record_lemokey_kb(keycode, record)) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE)
|
#if defined(LED_MATRIX_ENABLE)
|
||||||
bool led_matrix_indicators_lemokey(void) {
|
bool led_matrix_indicators_lemokey(void) {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
# ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool led_matrix_indicators_bt(void);
|
extern bool led_matrix_indicators_bt(void);
|
||||||
led_matrix_indicators_bt();
|
led_matrix_indicators_bt();
|
||||||
#endif
|
# endif
|
||||||
#ifdef FACTORY_TEST_ENABLE
|
# ifdef FACTORY_TEST_ENABLE
|
||||||
factory_test_indicator();
|
factory_test_indicator();
|
||||||
#endif
|
# endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RGB_MATRIX_ENABLE)
|
#if defined(RGB_MATRIX_ENABLE)
|
||||||
bool rgb_matrix_indicators_lemokey(void) {
|
bool rgb_matrix_indicators_lemokey(void) {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
# ifdef LK_WIRELESS_ENABLE
|
||||||
extern bool rgb_matrix_indicators_bt(void);
|
extern bool rgb_matrix_indicators_bt(void);
|
||||||
rgb_matrix_indicators_bt();
|
rgb_matrix_indicators_bt();
|
||||||
#endif
|
# endif
|
||||||
#ifdef FACTORY_TEST_ENABLE
|
# ifdef FACTORY_TEST_ENABLE
|
||||||
factory_test_indicator();
|
factory_test_indicator();
|
||||||
#endif
|
# endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__attribute__((weak)) bool lemokey_task_kb(void){ return true; }
|
__attribute__((weak)) bool lemokey_task_kb(void) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void lemokey_task(void) {
|
void lemokey_task(void) {
|
||||||
#ifdef LK_WIRELESS_ENABLE
|
#ifdef LK_WIRELESS_ENABLE
|
||||||
|
@ -208,22 +83,18 @@ void lemokey_task(void) {
|
||||||
|
|
||||||
lemokey_task_kb();
|
lemokey_task_kb();
|
||||||
}
|
}
|
||||||
#endif // #ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
if (!process_record_user(keycode, record))
|
if (!process_record_user(keycode, record)) return false;
|
||||||
return false;
|
|
||||||
|
if (!process_record_lemokey(keycode, record)) return false;
|
||||||
if (!process_record_lemokey(keycode, record))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RGB_MATRIX_ENABLE
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
bool rgb_matrix_indicators_kb(void) {
|
bool rgb_matrix_indicators_kb(void) {
|
||||||
if (!rgb_matrix_indicators_user())
|
if (!rgb_matrix_indicators_user()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
rgb_matrix_indicators_lemokey();
|
rgb_matrix_indicators_lemokey();
|
||||||
|
|
||||||
|
@ -233,8 +104,7 @@ bool rgb_matrix_indicators_kb(void) {
|
||||||
|
|
||||||
#ifdef LED_MATRIX_ENABLE
|
#ifdef LED_MATRIX_ENABLE
|
||||||
bool led_matrix_indicators_kb(void) {
|
bool led_matrix_indicators_kb(void) {
|
||||||
if (!led_matrix_indicators_user())
|
if (!led_matrix_indicators_user()) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
led_matrix_indicators_lemokey();
|
led_matrix_indicators_lemokey();
|
||||||
|
|
||||||
|
@ -245,4 +115,3 @@ bool led_matrix_indicators_kb(void) {
|
||||||
void housekeeping_task_kb(void) {
|
void housekeeping_task_kb(void) {
|
||||||
lemokey_task();
|
lemokey_task();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,29 +13,12 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
typedef bool (*lemokey_cb)(void);
|
|
||||||
typedef bool (*lemokey_record_process_cb)(uint16_t keycode, keyrecord_t *record);
|
|
||||||
|
|
||||||
|
|
||||||
bool process_record_lemokey(uint16_t keycode, keyrecord_t *record);
|
|
||||||
|
|
||||||
void register_lemokey_task(lemokey_cb cb, bool priority);
|
|
||||||
void register_record_process(lemokey_record_process_cb cb, bool priority);
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
|
||||||
void register_led_indicator_task(lemokey_cb cb, bool priority);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
bool lemokey_task_kb(void);
|
bool lemokey_task_kb(void);
|
||||||
bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record);
|
bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record);
|
||||||
|
|
||||||
#endif
|
|
||||||
void lemokey_task(void);
|
void lemokey_task(void);
|
||||||
|
|
||||||
|
|
|
@ -180,9 +180,6 @@ void indicator_init(void) {
|
||||||
setPinOutput(BAT_LOW_LED_PIN);
|
setPinOutput(BAT_LOW_LED_PIN);
|
||||||
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
writePin(BAT_LOW_LED_PIN, !BAT_LOW_LED_PIN_ON_STATE);
|
||||||
#endif
|
#endif
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
register_led_indicator_task(LED_INDICATORS_KB, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
#if defined(LED_MATRIX_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||||
|
|
|
@ -59,10 +59,6 @@ void report_buffer_init(void) {
|
||||||
report_buffer_queue_tail = 0;
|
report_buffer_queue_tail = 0;
|
||||||
retry = 0;
|
retry = 0;
|
||||||
report_timer_buffer = timer_read32();
|
report_timer_buffer = timer_read32();
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
register_lemokey_task(report_buffer_task, true);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool report_buffer_enqueue(report_buffer_t *report) {
|
bool report_buffer_enqueue(report_buffer_t *report) {
|
||||||
|
|
|
@ -113,10 +113,6 @@ void wireless_init(void) {
|
||||||
nkro.bluetooth = keymap_config.nkro;
|
nkro.bluetooth = keymap_config.nkro;
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
register_wt_tasks();
|
|
||||||
register_record_process(process_record_wireless, false);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -34,9 +34,3 @@ bool wireless_tasks(void) {
|
||||||
if (get_transport() == TRANSPORT_USB) usb_remote_wakeup();
|
if (get_transport() == TRANSPORT_USB) usb_remote_wakeup();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
void register_wt_tasks(void) {
|
|
||||||
register_lemokey_task(wireless_tasks, true);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,37 +1,41 @@
|
||||||
/* Copyright 2023 @ Lemokey (https://www.lemokey.com)
|
/* Copyright 2023 @ Lemokey (https://www.lemokey.com)
|
||||||
*
|
*
|
||||||
* This program is free software : you can redistribute it and /or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program.If not, see < http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "l3.h"
|
#include "lemokey_common.h"
|
||||||
#include "rgb.h"
|
|
||||||
|
enum layer_names {
|
||||||
|
BASE = 0,
|
||||||
|
FN,
|
||||||
|
};
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[BASE] = LAYOUT_iso_92(
|
[BASE] = LAYOUT_iso_tkl(
|
||||||
KC_MUTE, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SCRL, KC_PAUS,
|
KC_MUTE, KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_LOCK, RGB_MOD,
|
||||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP,
|
||||||
MC_0, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, KC_DEL, KC_END, KC_PGDN,
|
MC_0, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_DEL, KC_END, KC_PGDN,
|
||||||
MC_1, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS,
|
MC_1, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
|
||||||
MC_2, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
|
MC_2, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
|
||||||
MC_3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, MO(FN), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
MC_3, KC_LCTL, KC_LWIN, KC_LALT, KC_SPC, KC_RALT, KC_RWIN, MO(FN), KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT),
|
||||||
[FN] = LAYOUT_iso_92(
|
[FN] = LAYOUT_iso_tkl(
|
||||||
RGB_TOG, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FLXP, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______,
|
_______, _______, KC_BRID, KC_BRIU, KC_TASK, KC_FILE, RGB_VAD, RGB_VAI, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, RGB_TOG,
|
||||||
_______, BT_HST1, BT_HST2, BT_HST3, P2P4G, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, BT_HST1, BT_HST2, BT_HST3, P2P4G, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, RGB_TOG, RGB_MOD, RGB_VAI, RGB_HUI, RGB_SAI, RGB_SPI, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, RGB_RMOD, RGB_VAD, RGB_HUD, RGB_SAD, RGB_SPD, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, BAT_LVL, NK_TOGG, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, _______, BAT_LVL, NK_TOGG, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, GUI_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
_______, _______, GUI_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______),
|
||||||
};
|
};
|
||||||
|
|
|
@ -36,10 +36,6 @@ pin_t bt_led_pins[] = BT_HOST_LED_PIN_LIST;
|
||||||
pin_t p24g_led_pins[] = P24G_HOST_LED_PIN_LIST;
|
pin_t p24g_led_pins[] = P24G_HOST_LED_PIN_LIST;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
bool lemokey_task_kb(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record) {
|
bool process_record_lemokey_kb(uint16_t keycode, keyrecord_t *record) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -60,11 +56,7 @@ void keyboard_post_init_kb(void) {
|
||||||
#ifdef ENCODER_ENABLE
|
#ifdef ENCODER_ENABLE
|
||||||
encoder_cb_init();
|
encoder_cb_init();
|
||||||
#endif
|
#endif
|
||||||
#ifdef LEMOKEY_CALLBACK_ENABLE
|
|
||||||
factory_test_init();
|
|
||||||
register_record_process(process_record_lemokey_kb, false);
|
|
||||||
register_lemokey_task(lemokey_task_kb, false);
|
|
||||||
#endif
|
|
||||||
keyboard_post_init_user();
|
keyboard_post_init_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue