Migrate crkbd keymaps to oled driver (#17863)
This commit is contained in:
		
							parent
							
								
									c10c2575b8
								
							
						
					
					
						commit
						f7aaed1b57
					
				
					 40 changed files with 97 additions and 524 deletions
				
			
		| 
						 | 
				
			
			@ -28,8 +28,6 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		|||
// #define MASTER_RIGHT
 | 
			
		||||
// #define EE_HANDS
 | 
			
		||||
 | 
			
		||||
// #define SSD1306OLED
 | 
			
		||||
 | 
			
		||||
#define USE_SERIAL_PD2
 | 
			
		||||
 | 
			
		||||
#define TAPPING_FORCE_HOLD
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,13 +1,10 @@
 | 
			
		|||
#ifdef SSD1306OLED
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
#include QMK_KEYBOARD_H
 | 
			
		||||
#include "ssd1306.h"
 | 
			
		||||
#ifdef PROTOCOL_LUFA
 | 
			
		||||
#include "lufa.h"
 | 
			
		||||
#include "split_util.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
extern uint8_t is_master;
 | 
			
		||||
 | 
			
		||||
// When add source files to SRC in rules.mk, you can use functions.
 | 
			
		||||
const char *read_logo(void);
 | 
			
		||||
const char *read_keylog(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -47,7 +44,6 @@ void update_keymap_status(void) {
 | 
			
		|||
#endif
 | 
			
		||||
 | 
			
		||||
void matrix_init_user(void) {
 | 
			
		||||
  iota_gfx_init(!has_usb()); // turns on the display
 | 
			
		||||
  update_keymap_status();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,31 +70,18 @@ layer_state_t layer_state_set_user(layer_state_t state) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
static inline void render_keymap_status(struct CharacterMatrix *matrix) {
 | 
			
		||||
  matrix_write(matrix, layer_status_buf);
 | 
			
		||||
  oled_write(layer_status_buf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void matrix_render_user(struct CharacterMatrix *matrix) {
 | 
			
		||||
  if (is_master) {
 | 
			
		||||
bool oled_task_user(void) {
 | 
			
		||||
  if (is_keyboard_master()) {
 | 
			
		||||
    render_keymap_status(matrix);
 | 
			
		||||
    matrix_write_ln(matrix, read_keylog());
 | 
			
		||||
    matrix_write_ln(matrix, read_keylogs());
 | 
			
		||||
    oled_write_ln(read_keylog(), false);
 | 
			
		||||
    oled_write_ln(read_keylogs(), false);
 | 
			
		||||
  } else {
 | 
			
		||||
    matrix_write(matrix, read_logo());
 | 
			
		||||
    oled_write(read_logo(), false);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 iota_gfx_task_user(void) {
 | 
			
		||||
  struct CharacterMatrix matrix;
 | 
			
		||||
  matrix_clear(&matrix);
 | 
			
		||||
  matrix_render_user(&matrix);
 | 
			
		||||
  matrix_update(&display, &matrix);
 | 
			
		||||
  return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -25,7 +25,6 @@ SLEEP_LED_ENABLE = no    # Breathing sleep LED during USB suspend
 | 
			
		|||
 | 
			
		||||
# If you want to change the display of OLED, you need to change here
 | 
			
		||||
SRC +=  oled.c \
 | 
			
		||||
        ./lib/glcdfont.c \
 | 
			
		||||
        ./lib/rgb_state_reader.c \
 | 
			
		||||
        ./lib/layer_state_reader.c \
 | 
			
		||||
        ./lib/logo_reader.c \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue