Skip to content

Commit

Permalink
Refactor satt/comet46 to use core OLED driver (qmk#17856)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored and nolanseaton committed Jan 23, 2023
1 parent 2e8a185 commit 8cb264b
Show file tree
Hide file tree
Showing 12 changed files with 54 additions and 946 deletions.
162 changes: 0 additions & 162 deletions keyboards/satt/comet46/i2c.c

This file was deleted.

46 changes: 0 additions & 46 deletions keyboards/satt/comet46/i2c.h

This file was deleted.

29 changes: 0 additions & 29 deletions keyboards/satt/comet46/keymaps/default/config.h

This file was deleted.

45 changes: 10 additions & 35 deletions keyboards/satt/comet46/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// This is the canonical layout file for the Quantum project. If you want to add another keyboard,

#include QMK_KEYBOARD_H
#ifdef SSD1306OLED
#include "ssd1306.h"
#endif


// Each layer gets a name for readability, which is then used in the keymap matrix below.
Expand Down Expand Up @@ -148,34 +145,18 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
}

//SSD1306 OLED update loop, make sure to add #define SSD1306OLED in config.h
#ifdef SSD1306OLED
#ifdef OLED_ENABLE

// You need to add source files to SRC in rules.mk when using OLED display functions
void set_keylog(uint16_t keycode);
const char *read_keylog(void);
const char *read_modifier_state(void);
const char *read_host_led_state(void);

void matrix_init_user(void) {
iota_gfx_init(false); // turns on the display
}

void matrix_scan_user(void) {
iota_gfx_task(); // this is what updates the display continuously
}

void matrix_update(struct CharacterMatrix *dest, const struct CharacterMatrix *source) {
if (memcmp(dest->display, source->display, sizeof(dest->display))) {
memcpy(dest->display, source->display, sizeof(dest->display));
dest->dirty = true;
}
}

void render_status(struct CharacterMatrix *matrix) {
bool oled_task_user(void) {
// Layer state
char layer_str[22];
matrix_write(matrix, "Layer: ");
oled_write_P(PSTR("Layer: "), false);
uint8_t layer = get_highest_layer(layer_state);
uint8_t default_layer = get_highest_layer(eeconfig_read_default_layer());
switch (layer) {
Expand Down Expand Up @@ -207,27 +188,21 @@ void render_status(struct CharacterMatrix *matrix) {
default:
snprintf(layer_str, sizeof(layer_str), "Undef-%d", layer);
}
matrix_write_ln(matrix, layer_str);
oled_write_ln(layer_str, false);
// Last entered keycode
matrix_write_ln(matrix, read_keylog());
oled_write_ln(read_keylog(), false);
// Modifier state
matrix_write_ln(matrix, read_modifier_state());
oled_write_ln(read_modifier_state(), false);
// Host Keyboard LED Status
matrix_write(matrix, read_host_led_state());
}
oled_write(read_host_led_state(), false);


void iota_gfx_task_user(void) {
struct CharacterMatrix matrix;
matrix_clear(&matrix);
render_status(&matrix);
matrix_update(&display, &matrix);
return false;
}

#endif//SSD1306OLED
#endif

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef SSD1306OLED
#ifdef OLED_ENABLE
if (record->event.pressed) {
set_keylog(keycode);
}
Expand Down
5 changes: 3 additions & 2 deletions keyboards/satt/comet46/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# If you want to change display settings of the OLED, you need to change the following lines
SRC += ./lib/glcdfont.c \
./lib/keylogger.c \
SRC += ./lib/keylogger.c \
./lib/modifier_state_reader.c \
./lib/host_led_state_reader.c

OLED_ENABLE = yes
29 changes: 0 additions & 29 deletions keyboards/satt/comet46/keymaps/satt/config.h

This file was deleted.

Loading

0 comments on commit 8cb264b

Please sign in to comment.