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

Add corne keyboard #3119

Merged
merged 33 commits into from
Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ddbc561
Fork from helix
foostan Apr 24, 2018
1ae492d
Move rev2 to rev1
foostan Apr 25, 2018
e543d77
Remove unused settings
foostan Apr 25, 2018
9edcc43
Move split_util to outof rev
foostan Apr 25, 2018
d5cadf1
Setup KEYMAP for crkbd
foostan Apr 25, 2018
a8529ce
Remove old image
foostan Apr 25, 2018
558ea64
Move keymaps directory and glcdfont.c
foostan Apr 26, 2018
454dcba
Remove AUDIO in keymap
foostan May 9, 2018
5e9e5b6
Show keylog
foostan May 9, 2018
60c6157
Show keylogs
foostan May 9, 2018
fdc4c44
Show time log
foostan May 9, 2018
903ea18
Remove EISU/KANA
foostan May 9, 2018
b89f273
Use KEYMAP_kc
foostan May 9, 2018
86d6036
Remove iota_gfx_record_user wrapping
foostan May 10, 2018
124be9c
Remove unused settings for layer
foostan May 10, 2018
045e987
Add keylogger.c
foostan May 14, 2018
cfe061a
Fix uppercase letters to lower
foostan May 14, 2018
576fa42
Add timelogger.c
foostan May 14, 2018
f48f0c8
Default RGBLED_NUM = 27
foostan May 14, 2018
17a3744
Remove unused setting
foostan May 14, 2018
8d7eef4
Add mode icon reader
foostan May 14, 2018
7b218be
Add matrix_write_ln
foostan May 14, 2018
fe50fc3
Add layer_state_reader
foostan May 14, 2018
a4883c1
Move to lib directory
foostan May 14, 2018
5278d0a
Rename functions
foostan May 14, 2018
c73adbb
Add host_led_state_reader
foostan May 14, 2018
0ea736f
Add logo_reader
foostan May 14, 2018
b781283
Cleaning of iota_gfx_task
foostan May 14, 2018
baab9a0
Fix bugs and add key defines
foostan May 22, 2018
3cdaac4
Remove unnecessary comments
foostan Jun 3, 2018
abb9be7
Update crkbd readme
foostan Jun 3, 2018
06a244a
Move libs to lib directories
foostan Jun 3, 2018
0f74fd8
Rename KEYMAP to LAYOUT
foostan Jun 5, 2018
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
Prev Previous commit
Next Next commit
Add keylogger.c
  • Loading branch information
foostan committed May 14, 2018
commit 045e98792417bdd4e179dd4bca4b4dd80e2db0f6
50 changes: 50 additions & 0 deletions keyboards/crkbd/keymaps/default/keylogger.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#include "crkbd.h"

char KEYLOG[40] = {};
char KEYLOGS[21] = {};
int KEYLOGS_IDX = 0;
char TIMELOG[40] = {};

char code_to_name[60] = {
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'R', 'E', 'B', 'T', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ';', '\'', ' ', ',', '.', '/', ' ', ' ', ' '};

void keylog_set(uint16_t keycode, keyrecord_t *record)
{
char name = ' ';
if (keycode < 60)
{
name = code_to_name[keycode];
}

// update keylog
snprintf(KEYLOG, sizeof(KEYLOG), "%dx%d, k%2d : %c",
record->event.key.row,
record->event.key.col,
keycode,
name);

// update keylogs
if (KEYLOGS_IDX == sizeof(KEYLOGS) - 1)
{
KEYLOGS_IDX = 0;
for (int i = 0; i < sizeof(KEYLOGS) - 1; i++)
{
KEYLOGS[i] = ' ';
}
}
KEYLOGS[KEYLOGS_IDX] = name;
KEYLOGS_IDX++;
}

char *keylog_read(void) {
return KEYLOG;
}

char *keylogs_read(void) {
return KEYLOGS;
}
41 changes: 4 additions & 37 deletions keyboards/crkbd/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif
#include "keylogger.c"

extern keymap_config_t keymap_config;

Expand Down Expand Up @@ -109,10 +110,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};

int RGB_current_mode;
char KEYLOG[40] = {};
char KEYLOGS[21] = {};
int KEYLOGS_IDX = 0;
char TIMELOG[40] = {};
int LAST_TIME = 0;
int ELAPSED_TIME = 0;

Expand Down Expand Up @@ -181,38 +178,8 @@ static void render_logo(struct CharacterMatrix *matrix) {

void update_status(uint16_t keycode, keyrecord_t *record) {

char code_to_name[60] = {
' ', ' ', ' ', ' ', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'R', 'E', 'B', 'T', ' ', ' ', ' ', ' ', ' ', ' ',
' ', ';', '\'', ' ', ',', '.', '/', ' ', ' ', ' '
};

if (record->event.pressed) {
char name = ' ';
if (keycode < 60) {
name = code_to_name[keycode];
}

// update keylog
snprintf(KEYLOG, sizeof(KEYLOG), "%dx%d, k%2d : %c",
record->event.key.row,
record->event.key.col,
keycode,
name
);

// update keylogs
if (KEYLOGS_IDX == sizeof(KEYLOGS)-1) {
KEYLOGS_IDX = 0;
for (int i = 0; i < sizeof(KEYLOGS)-1; i++) {
KEYLOGS[i] = ' ';
}
}
KEYLOGS[KEYLOGS_IDX] = name;
KEYLOGS_IDX++;
keylog_set(keycode, record);

// update timelog
ELAPSED_TIME = timer_elapsed(LAST_TIME);
Expand Down Expand Up @@ -286,11 +253,11 @@ void render_status(struct CharacterMatrix *matrix) {

// key log
matrix_write_P(matrix, PSTR("\n"));
matrix_write(matrix, KEYLOG);
matrix_write(matrix, keylog_read());

// key logs
matrix_write_P(matrix, PSTR("\n"));
matrix_write(matrix, KEYLOGS);
matrix_write(matrix, keylogs_read());

// time log
matrix_write_P(matrix, PSTR("\n"));
Expand Down