This reverts commit aebddfc1a8
.
pull/5509/head
parent
4d7310f712
commit
c8d1c83b3b
@ -1,244 +0,0 @@
|
|||||||
// This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0.
|
|
||||||
// See gfxfont.h for newer custom bitmap font info.
|
|
||||||
|
|
||||||
#ifndef FONT5X7_H
|
|
||||||
#define FONT5X7_H
|
|
||||||
|
|
||||||
#ifdef __AVR__
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <avr/pgmspace.h>
|
|
||||||
#elif defined(ESP8266)
|
|
||||||
#include <pgmspace.h>
|
|
||||||
#else
|
|
||||||
#define PROGMEM
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Standard ASCII 5x7 font
|
|
||||||
|
|
||||||
static const unsigned char font[] PROGMEM = {
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 0x00,
|
|
||||||
0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 0x00,
|
|
||||||
0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 0x00,
|
|
||||||
0x18, 0x3C, 0x7E, 0x3C, 0x18, 0x00,
|
|
||||||
0x1C, 0x57, 0x7D, 0x57, 0x1C, 0x00,
|
|
||||||
0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 0x00,
|
|
||||||
0x00, 0x18, 0x3C, 0x18, 0x00, 0x00,
|
|
||||||
0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 0x00,
|
|
||||||
0x00, 0x18, 0x24, 0x18, 0x00, 0x00,
|
|
||||||
0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 0x00,
|
|
||||||
0x30, 0x48, 0x3A, 0x06, 0x0E, 0x00,
|
|
||||||
0x26, 0x29, 0x79, 0x29, 0x26, 0x00,
|
|
||||||
0x40, 0x7F, 0x05, 0x05, 0x07, 0x00,
|
|
||||||
0x40, 0x7F, 0x05, 0x25, 0x3F, 0x00,
|
|
||||||
0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 0x00,
|
|
||||||
0x7F, 0x3E, 0x1C, 0x1C, 0x08, 0x00,
|
|
||||||
0x08, 0x1C, 0x1C, 0x3E, 0x7F, 0x00,
|
|
||||||
0x14, 0x22, 0x7F, 0x22, 0x14, 0x00,
|
|
||||||
0x5F, 0x5F, 0x00, 0x5F, 0x5F, 0x00,
|
|
||||||
0x06, 0x09, 0x7F, 0x01, 0x7F, 0x00,
|
|
||||||
0x00, 0x66, 0x89, 0x95, 0x6A, 0x00,
|
|
||||||
0x60, 0x60, 0x60, 0x60, 0x60, 0x00,
|
|
||||||
0x94, 0xA2, 0xFF, 0xA2, 0x94, 0x00,
|
|
||||||
0x08, 0x04, 0x7E, 0x04, 0x08, 0x00,
|
|
||||||
0x10, 0x20, 0x7E, 0x20, 0x10, 0x00,
|
|
||||||
0x08, 0x08, 0x2A, 0x1C, 0x08, 0x00,
|
|
||||||
0x08, 0x1C, 0x2A, 0x08, 0x08, 0x00,
|
|
||||||
0x1E, 0x10, 0x10, 0x10, 0x10, 0x00,
|
|
||||||
0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 0x00,
|
|
||||||
0x30, 0x38, 0x3E, 0x38, 0x30, 0x00,
|
|
||||||
0x06, 0x0E, 0x3E, 0x0E, 0x06, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x5F, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x07, 0x00, 0x07, 0x00, 0x00,
|
|
||||||
0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00,
|
|
||||||
0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00,
|
|
||||||
0x23, 0x13, 0x08, 0x64, 0x62, 0x00,
|
|
||||||
0x36, 0x49, 0x56, 0x20, 0x50, 0x00,
|
|
||||||
0x00, 0x08, 0x07, 0x03, 0x00, 0x00,
|
|
||||||
0x00, 0x1C, 0x22, 0x41, 0x00, 0x00,
|
|
||||||
0x00, 0x41, 0x22, 0x1C, 0x00, 0x00,
|
|
||||||
0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 0x00,
|
|
||||||
0x08, 0x08, 0x3E, 0x08, 0x08, 0x00,
|
|
||||||
0x00, 0x80, 0x70, 0x30, 0x00, 0x00,
|
|
||||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x00,
|
|
||||||
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
|
|
||||||
0x20, 0x10, 0x08, 0x04, 0x02, 0x00,
|
|
||||||
0x3E, 0x51, 0x49, 0x45, 0x3E, 0x00,
|
|
||||||
0x00, 0x42, 0x7F, 0x40, 0x00, 0x00,
|
|
||||||
0x72, 0x49, 0x49, 0x49, 0x46, 0x00,
|
|
||||||
0x21, 0x41, 0x49, 0x4D, 0x33, 0x00,
|
|
||||||
0x18, 0x14, 0x12, 0x7F, 0x10, 0x00,
|
|
||||||
0x27, 0x45, 0x45, 0x45, 0x39, 0x00,
|
|
||||||
0x3C, 0x4A, 0x49, 0x49, 0x31, 0x00,
|
|
||||||
0x41, 0x21, 0x11, 0x09, 0x07, 0x00,
|
|
||||||
0x36, 0x49, 0x49, 0x49, 0x36, 0x00,
|
|
||||||
0x46, 0x49, 0x49, 0x29, 0x1E, 0x00,
|
|
||||||
0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x40, 0x34, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
|
|
||||||
0x14, 0x14, 0x14, 0x14, 0x14, 0x00,
|
|
||||||
0x00, 0x41, 0x22, 0x14, 0x08, 0x00,
|
|
||||||
0x02, 0x01, 0x59, 0x09, 0x06, 0x00,
|
|
||||||
0x3E, 0x41, 0x5D, 0x59, 0x4E, 0x00,
|
|
||||||
0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00,
|
|
||||||
0x7F, 0x49, 0x49, 0x49, 0x36, 0x00,
|
|
||||||
0x3E, 0x41, 0x41, 0x41, 0x22, 0x00,
|
|
||||||
0x7F, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
|
||||||
0x7F, 0x49, 0x49, 0x49, 0x41, 0x00,
|
|
||||||
0x7F, 0x09, 0x09, 0x09, 0x01, 0x00,
|
|
||||||
0x3E, 0x41, 0x41, 0x51, 0x73, 0x00,
|
|
||||||
0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00,
|
|
||||||
0x00, 0x41, 0x7F, 0x41, 0x00, 0x00,
|
|
||||||
0x20, 0x40, 0x41, 0x3F, 0x01, 0x00,
|
|
||||||
0x7F, 0x08, 0x14, 0x22, 0x41, 0x00,
|
|
||||||
0x7F, 0x40, 0x40, 0x40, 0x40, 0x00,
|
|
||||||
0x7F, 0x02, 0x1C, 0x02, 0x7F, 0x00,
|
|
||||||
0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00,
|
|
||||||
0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00,
|
|
||||||
0x7F, 0x09, 0x09, 0x09, 0x06, 0x00,
|
|
||||||
0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00,
|
|
||||||
0x7F, 0x09, 0x19, 0x29, 0x46, 0x00,
|
|
||||||
0x26, 0x49, 0x49, 0x49, 0x32, 0x00,
|
|
||||||
0x03, 0x01, 0x7F, 0x01, 0x03, 0x00,
|
|
||||||
0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00,
|
|
||||||
0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00,
|
|
||||||
0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00,
|
|
||||||
0x63, 0x14, 0x08, 0x14, 0x63, 0x00,
|
|
||||||
0x03, 0x04, 0x78, 0x04, 0x03, 0x00,
|
|
||||||
0x61, 0x59, 0x49, 0x4D, 0x43, 0x00,
|
|
||||||
0x00, 0x7F, 0x41, 0x41, 0x41, 0x00,
|
|
||||||
0x02, 0x04, 0x08, 0x10, 0x20, 0x00,
|
|
||||||
0x00, 0x41, 0x41, 0x41, 0x7F, 0x00,
|
|
||||||
0x04, 0x02, 0x01, 0x02, 0x04, 0x00,
|
|
||||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
|
|
||||||
0x00, 0x03, 0x07, 0x08, 0x00, 0x00,
|
|
||||||
0x20, 0x54, 0x54, 0x78, 0x40, 0x00,
|
|
||||||
0x7F, 0x28, 0x44, 0x44, 0x38, 0x00,
|
|
||||||
0x38, 0x44, 0x44, 0x44, 0x28, 0x00,
|
|
||||||
0x38, 0x44, 0x44, 0x28, 0x7F, 0x00,
|
|
||||||
0x38, 0x54, 0x54, 0x54, 0x18, 0x00,
|
|
||||||
0x00, 0x08, 0x7E, 0x09, 0x02, 0x00,
|
|
||||||
0x18, 0xA4, 0xA4, 0x9C, 0x78, 0x00,
|
|
||||||
0x7F, 0x08, 0x04, 0x04, 0x78, 0x00,
|
|
||||||
0x00, 0x44, 0x7D, 0x40, 0x00, 0x00,
|
|
||||||
0x20, 0x40, 0x40, 0x3D, 0x00, 0x00,
|
|
||||||
0x7F, 0x10, 0x28, 0x44, 0x00, 0x00,
|
|
||||||
0x00, 0x41, 0x7F, 0x40, 0x00, 0x00,
|
|
||||||
0x7C, 0x04, 0x78, 0x04, 0x78, 0x00,
|
|
||||||
0x7C, 0x08, 0x04, 0x04, 0x78, 0x00,
|
|
||||||
0x38, 0x44, 0x44, 0x44, 0x38, 0x00,
|
|
||||||
0xFC, 0x18, 0x24, 0x24, 0x18, 0x00,
|
|
||||||
0x18, 0x24, 0x24, 0x18, 0xFC, 0x00,
|
|
||||||
0x7C, 0x08, 0x04, 0x04, 0x08, 0x00,
|
|
||||||
0x48, 0x54, 0x54, 0x54, 0x24, 0x00,
|
|
||||||
0x04, 0x04, 0x3F, 0x44, 0x24, 0x00,
|
|
||||||
0x3C, 0x40, 0x40, 0x20, 0x7C, 0x00,
|
|
||||||
0x1C, 0x20, 0x40, 0x20, 0x1C, 0x00,
|
|
||||||
0x3C, 0x40, 0x30, 0x40, 0x3C, 0x00,
|
|
||||||
0x44, 0x28, 0x10, 0x28, 0x44, 0x00,
|
|
||||||
0x4C, 0x90, 0x90, 0x90, 0x7C, 0x00,
|
|
||||||
0x44, 0x64, 0x54, 0x4C, 0x44, 0x00,
|
|
||||||
0x00, 0x08, 0x36, 0x41, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x77, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x41, 0x36, 0x08, 0x00, 0x00,
|
|
||||||
0x02, 0x01, 0x02, 0x04, 0x02, 0x00,
|
|
||||||
0x3C, 0x26, 0x23, 0x26, 0x3C, 0x00,
|
|
||||||
0x03, 0x07, 0x1F, 0x7F, 0xFF, 0xFF,
|
|
||||||
0xFE, 0xF8, 0xF0, 0xC0, 0x20, 0xF8,
|
|
||||||
0xFE, 0xFF, 0xFE, 0x79, 0x27, 0x1F,
|
|
||||||
0x7F, 0xFF, 0xFF, 0xFE, 0xF8, 0xF0,
|
|
||||||
0xC0, 0x20, 0xF8, 0xFE, 0xFF, 0xFF,
|
|
||||||
0x7F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFE,
|
|
||||||
0xF8, 0xF0, 0xC0, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0xFF, 0x7F, 0x7F, 0x7F,
|
|
||||||
0xBF, 0xBF, 0xC0, 0xC0, 0xC0, 0xE0,
|
|
||||||
0xE0, 0xE0, 0xE0, 0xF0, 0xF0, 0xF0,
|
|
||||||
0xF8, 0x78, 0x78, 0x7C, 0x3C, 0x3C,
|
|
||||||
0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x80, 0x80,
|
|
||||||
0xBF, 0xBF, 0xDF, 0xDF, 0xEF, 0xEF,
|
|
||||||
0x00, 0x03, 0x07, 0x1F, 0x7F, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFE, 0xF8, 0xE0, 0xC0,
|
|
||||||
0xE0, 0xF8, 0xFE, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x7F, 0x1F, 0x07, 0x03, 0x00, 0x00,
|
|
||||||
0xE0, 0xF0, 0xF0, 0xF0, 0xE0, 0xEC,
|
|
||||||
0xEE, 0xF7, 0xF3, 0x70, 0x20, 0x00,
|
|
||||||
0x7C, 0x7C, 0x7C, 0x7E, 0x00, 0x7E,
|
|
||||||
0x7E, 0x7E, 0x7F, 0x7F, 0x7F, 0x00,
|
|
||||||
0x00, 0x80, 0xC0, 0xE0, 0x7E, 0x5B,
|
|
||||||
0x4F, 0x5B, 0xFE, 0xC0, 0x00, 0x00,
|
|
||||||
0xC0, 0x00, 0xDC, 0xD7, 0xDE, 0xDE,
|
|
||||||
0xDE, 0xD7, 0xDC, 0x00, 0xC0, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0xC1, 0xF3,
|
|
||||||
0xCF, 0xBF, 0x7F, 0xFF, 0xFF, 0xFC,
|
|
||||||
0xFB, 0xE7, 0x81, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x80, 0xE3, 0xCF, 0x3F, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFC, 0xFB, 0xE7, 0x81,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x81, 0xE7,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0x3C, 0x00,
|
|
||||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xF8, 0xF8, 0xFC, 0x7C, 0x7E,
|
|
||||||
0x7E, 0x3E, 0xFE, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xF7, 0xF7, 0xF7, 0xFB,
|
|
||||||
0xFB, 0x7D, 0x7D, 0x7D, 0xBE, 0xBE,
|
|
||||||
0xBE, 0xDF, 0xDF, 0xE0, 0xE0, 0x00,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x00, 0xFC, 0xFC, 0x7C, 0x7E, 0x7E,
|
|
||||||
0x3E, 0x3E, 0x1F, 0x1F, 0x1F, 0x0F,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x81,
|
|
||||||
0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF, 0xE7, 0x81,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x0F, 0x1F, 0x3F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7F, 0x7F, 0x3F, 0x1E, 0x0C, 0x00,
|
|
||||||
0x1F, 0x1F, 0x1F, 0x3F, 0x00, 0x3F,
|
|
||||||
0x3F, 0x3F, 0x7F, 0x7F, 0x7F, 0x00,
|
|
||||||
0x30, 0x7B, 0x7F, 0x78, 0x30, 0x20,
|
|
||||||
0x20, 0x30, 0x78, 0x7F, 0x3B, 0x00,
|
|
||||||
0x03, 0x00, 0x0F, 0x7F, 0x0F, 0x0F,
|
|
||||||
0x0F, 0x7F, 0x0F, 0x00, 0x03, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x60, 0x70, 0x7C, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7F, 0x1F, 0x06, 0x01, 0x03, 0x0F,
|
|
||||||
0x3F, 0x7F, 0x7F, 0x7E, 0x7C, 0x7C,
|
|
||||||
0x7E, 0x7F, 0x7F, 0x7F, 0x1F, 0x06,
|
|
||||||
0x01, 0x07, 0x0F, 0x3F, 0x7F, 0x7F,
|
|
||||||
0x7E, 0x7C, 0x7C, 0x7E, 0x7F, 0x7F,
|
|
||||||
0x3F, 0x0F, 0x03, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7F, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7F, 0x7F, 0x7D, 0x7D, 0x3D, 0x3E,
|
|
||||||
0x1E, 0x1F, 0x1F, 0x1F, 0x0F, 0x0F,
|
|
||||||
0x07, 0x07, 0x07, 0x03, 0x03, 0x00,
|
|
||||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x7C,
|
|
||||||
0x7C, 0x7C, 0x7C, 0x7C, 0x7C, 0x00,
|
|
||||||
0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x00, 0x40, 0x70, 0x78, 0x7E, 0x7F,
|
|
||||||
0x7F, 0x7F, 0x3F, 0x0F, 0x03, 0x01,
|
|
||||||
0x03, 0x0F, 0x3F, 0x7F, 0x7F, 0x7F,
|
|
||||||
0x7E, 0x78, 0x70, 0x40, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
||||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
|
||||||
};
|
|
||||||
#endif // FONT5X7_H
|
|
@ -1,243 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2018 'mtei'
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
#include "config_common.h"
|
|
||||||
|
|
||||||
/* USB Device descriptor parameter */
|
|
||||||
#define VENDOR_ID 0xFEED
|
|
||||||
#define PRODUCT_ID 0x0000
|
|
||||||
#define DEVICE_VER 0x0001
|
|
||||||
#define MANUFACTURER You
|
|
||||||
#define PRODUCT pdhelix
|
|
||||||
#define DESCRIPTION A custom keyboard
|
|
||||||
|
|
||||||
/* key matrix size */
|
|
||||||
#define MATRIX_ROWS 10
|
|
||||||
#define MATRIX_COLS 7
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Keyboard Matrix Assignments
|
|
||||||
*
|
|
||||||
* Change this to how you wired your keyboard
|
|
||||||
* COLS: AVR pins used for columns, left to right
|
|
||||||
* ROWS: AVR pins used for rows, top to bottom
|
|
||||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
|
||||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define MATRIX_ROW_PINS { D4, C6, D7, E6, B4 }
|
|
||||||
#define MATRIX_COL_PINS { F4, F5, F6, F7, B1, B3, B2 }
|
|
||||||
#define UNUSED_PINS
|
|
||||||
|
|
||||||
/* COL2ROW, ROW2COL, or CUSTOM_MATRIX */
|
|
||||||
#define DIODE_DIRECTION COL2ROW
|
|
||||||
|
|
||||||
// #define BACKLIGHT_PIN B7
|
|
||||||
// #define BACKLIGHT_BREATHING
|
|
||||||
// #define BACKLIGHT_LEVELS 3
|
|
||||||
|
|
||||||
/* ws2812 RGB LED */
|
|
||||||
#define RGB_DI_PIN D3
|
|
||||||
#ifdef RGB_DI_PIN
|
|
||||||
#define RGBLED_NUM 32
|
|
||||||
#define RGBLIGHT_HUE_STEP 8
|
|
||||||
#define RGBLIGHT_SAT_STEP 8
|
|
||||||
#define RGBLIGHT_VAL_STEP 8
|
|
||||||
#define RGBLIGHT_LIMIT_VAL 120 /* The maximum brightness level */
|
|
||||||
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
|
||||||
// /*== all animations enable ==*/
|
|
||||||
// #define RGBLIGHT_ANIMATIONS
|
|
||||||
// /*== or choose animations ==*/
|
|
||||||
#define RGBLIGHT_EFFECT_BREATHING
|
|
||||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
|
||||||
#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
|
||||||
#define RGBLIGHT_EFFECT_SNAKE
|
|
||||||
#define RGBLIGHT_EFFECT_KNIGHT
|
|
||||||
#define RGBLIGHT_EFFECT_CHRISTMAS
|
|
||||||
#define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
|
||||||
#define RGBLIGHT_EFFECT_RGB_TEST
|
|
||||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//#define WAIT_FOR_USB //debug
|
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
|
||||||
#define DEBOUNCING_DELAY 5
|
|
||||||
|
|
||||||
/* define if matrix has ghost (lacks anti-ghosting diodes) */
|
|
||||||
//#define MATRIX_HAS_GHOST
|
|
||||||
|
|
||||||
/* number of backlight levels */
|
|
||||||
|
|
||||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
|
||||||
#define LOCKING_SUPPORT_ENABLE
|
|
||||||
/* Locking resynchronize hack */
|
|
||||||
#define LOCKING_RESYNC_ENABLE
|
|
||||||
|
|
||||||
/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
|
|
||||||
* This is userful for the Windows task manager shortcut (ctrl+shift+esc).
|
|
||||||
*/
|
|
||||||
// #define GRAVE_ESC_CTRL_OVERRIDE
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Force NKRO
|
|
||||||
*
|
|
||||||
* Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
|
|
||||||
* state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
|
|
||||||
* makefile for this to work.)
|
|
||||||
*
|
|
||||||
* If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
|
|
||||||
* until the next keyboard reset.
|
|
||||||
*
|
|
||||||
* NKRO may prevent your keystrokes from being detected in the BIOS, but it is
|
|
||||||
* fully operational during normal computer usage.
|
|
||||||
*
|
|
||||||
* For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
|
|
||||||
* or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
|
|
||||||
* bootmagic, NKRO mode will always be enabled until it is toggled again during a
|
|
||||||
* power-up.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
//#define FORCE_NKRO
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Magic Key Options
|
|
||||||
*
|
|
||||||
* Magic keys are hotkey commands that allow control over firmware functions of
|
|
||||||
* the keyboard. They are best used in combination with the HID Listen program,
|
|
||||||
* found here: https://www.pjrc.com/teensy/hid_listen.html
|
|
||||||
*
|
|
||||||
* The options below allow the magic key functionality to be changed. This is
|
|
||||||
* useful if your keyboard/keypad is missing keys and you want magic key support.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* key combination for magic key command */
|
|
||||||
#define IS_COMMAND() ( \
|
|
||||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
|
||||||
)
|
|
||||||
|
|
||||||
/* control how magic key switches layers */
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS true
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS true
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM false
|
|
||||||
|
|
||||||
/* override magic key keymap */
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_FKEYS
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_NKEYS
|
|
||||||
//#define MAGIC_KEY_SWITCH_LAYER_WITH_CUSTOM
|
|
||||||
//#define MAGIC_KEY_HELP1 H
|
|
||||||
//#define MAGIC_KEY_HELP2 SLASH
|
|
||||||
//#define MAGIC_KEY_DEBUG D
|
|
||||||
//#define MAGIC_KEY_DEBUG_MATRIX X
|
|
||||||
//#define MAGIC_KEY_DEBUG_KBD K
|
|
||||||
//#define MAGIC_KEY_DEBUG_MOUSE M
|
|
||||||
//#define MAGIC_KEY_VERSION V
|
|
||||||
//#define MAGIC_KEY_STATUS S
|
|
||||||
//#define MAGIC_KEY_CONSOLE C
|
|
||||||
//#define MAGIC_KEY_LAYER0_ALT1 ESC
|
|
||||||
//#define MAGIC_KEY_LAYER0_ALT2 GRAVE
|
|
||||||
//#define MAGIC_KEY_LAYER0 0
|
|
||||||
//#define MAGIC_KEY_LAYER1 1
|
|
||||||
//#define MAGIC_KEY_LAYER2 2
|
|
||||||
//#define MAGIC_KEY_LAYER3 3
|
|
||||||
//#define MAGIC_KEY_LAYER4 4
|
|
||||||
//#define MAGIC_KEY_LAYER5 5
|
|
||||||
//#define MAGIC_KEY_LAYER6 6
|
|
||||||
//#define MAGIC_KEY_LAYER7 7
|
|
||||||
//#define MAGIC_KEY_LAYER8 8
|
|
||||||
//#define MAGIC_KEY_LAYER9 9
|
|
||||||
//#define MAGIC_KEY_BOOTLOADER PAUSE
|
|
||||||
//#define MAGIC_KEY_LOCK CAPS
|
|
||||||
//#define MAGIC_KEY_EEPROM E
|
|
||||||
//#define MAGIC_KEY_NKRO N
|
|
||||||
//#define MAGIC_KEY_SLEEP_LED Z
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Feature disable options
|
|
||||||
* These options are also useful to firmware size reduction.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* disable debug print */
|
|
||||||
//#define NO_DEBUG
|
|
||||||
|
|
||||||
/* disable print */
|
|
||||||
//#define NO_PRINT
|
|
||||||
|
|
||||||
/* disable action features */
|
|
||||||
//#define NO_ACTION_LAYER
|
|
||||||
//#define NO_ACTION_TAPPING
|
|
||||||
//#define NO_ACTION_ONESHOT
|
|
||||||
//#define NO_ACTION_MACRO
|
|
||||||
//#define NO_ACTION_FUNCTION
|
|
||||||
|
|
||||||
/*
|
|
||||||
* MIDI options
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Prevent use of disabled MIDI features in the keymap */
|
|
||||||
//#define MIDI_ENABLE_STRICT 1
|
|
||||||
|
|
||||||
/* enable basic MIDI features:
|
|
||||||
- MIDI notes can be sent when in Music mode is on
|
|
||||||
*/
|
|
||||||
//#define MIDI_BASIC
|
|
||||||
|
|
||||||
/* enable advanced MIDI features:
|
|
||||||
- MIDI notes can be added to the keymap
|
|
||||||
- Octave shift and transpose
|
|
||||||
- Virtual sustain, portamento, and modulation wheel
|
|
||||||
- etc.
|
|
||||||
*/
|
|
||||||
//#define MIDI_ADVANCED
|
|
||||||
|
|
||||||
/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */
|
|
||||||
//#define MIDI_TONE_KEYCODE_OCTAVES 1
|
|
||||||
|
|
||||||
/*
|
|
||||||
* HD44780 LCD Display Configuration
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
#define LCD_LINES 2 //< number of visible lines of the display
|
|
||||||
#define LCD_DISP_LENGTH 16 //< visibles characters per line of the display
|
|
||||||
|
|
||||||
#define LCD_IO_MODE 1 //< 0: memory mapped mode, 1: IO port mode
|
|
||||||
|
|
||||||
#if LCD_IO_MODE
|
|
||||||
#define LCD_PORT PORTB //< port for the LCD lines
|
|
||||||
#define LCD_DATA0_PORT LCD_PORT //< port for 4bit data bit 0
|
|
||||||
#define LCD_DATA1_PORT LCD_PORT //< port for 4bit data bit 1
|
|
||||||
#define LCD_DATA2_PORT LCD_PORT //< port for 4bit data bit 2
|
|
||||||
#define LCD_DATA3_PORT LCD_PORT //< port for 4bit data bit 3
|
|
||||||
#define LCD_DATA0_PIN 4 //< pin for 4bit data bit 0
|
|
||||||
#define LCD_DATA1_PIN 5 //< pin for 4bit data bit 1
|
|
||||||
#define LCD_DATA2_PIN 6 //< pin for 4bit data bit 2
|
|
||||||
#define LCD_DATA3_PIN 7 //< pin for 4bit data bit 3
|
|
||||||
#define LCD_RS_PORT LCD_PORT //< port for RS line
|
|
||||||
#define LCD_RS_PIN 3 //< pin for RS line
|
|
||||||
#define LCD_RW_PORT LCD_PORT //< port for RW line
|
|
||||||
#define LCD_RW_PIN 2 //< pin for RW line
|
|
||||||
#define LCD_E_PORT LCD_PORT //< port for Enable line
|
|
||||||
#define LCD_E_PIN 1 //< pin for Enable line
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Bootmagic Lite key configuration */
|
|
||||||
// #define BOOTMAGIC_LITE_ROW 0
|
|
||||||
// #define BOOTMAGIC_LITE_COLUMN 0
|
|
@ -1,161 +0,0 @@
|
|||||||
#include <util/twi.h>
|
|
||||||
#include <avr/io.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <avr/interrupt.h>
|
|
||||||
#include <util/twi.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include "i2c.h"
|
|
||||||
|
|
||||||
|
|
||||||
// Limits the amount of we wait for any one i2c transaction.
|
|
||||||
// Since were running SCL line 100kHz (=> 10μs/bit), and each transactions is
|
|
||||||
// 9 bits, a single transaction will take around 90μs to complete.
|
|
||||||
//
|
|
||||||
// (F_CPU/SCL_CLOCK) => # of μC cycles to transfer a bit
|
|
||||||
// poll loop takes at least 8 clock cycles to execute
|
|
||||||
#define I2C_LOOP_TIMEOUT (9+1)*(F_CPU/SCL_CLOCK)/8
|
|
||||||
|
|
||||||
#define BUFFER_POS_INC() (slave_buffer_pos = (slave_buffer_pos+1)%SLAVE_BUFFER_SIZE)
|
|
||||||
|
|
||||||
volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
|
||||||
|
|
||||||
static volatile uint8_t slave_buffer_pos;
|
|
||||||
static volatile bool slave_has_register_set = false;
|
|
||||||
|
|
||||||
// Wait for an i2c operation to finish
|
|
||||||
inline static
|
|
||||||
void i2c_delay(void) {
|
|
||||||
uint16_t lim = 0;
|
|
||||||
while(!(TWCR & (1<<TWINT)) && lim < I2C_LOOP_TIMEOUT)
|
|
||||||
lim++;
|
|
||||||
|
|
||||||
// easier way, but will wait slightly longer
|
|
||||||
// _delay_us(100);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Setup twi to run at 100kHz or 400kHz (see ./i2c.h SCL_CLOCK)
|
|
||||||
void i2c_master_init(void) {
|
|
||||||
// no prescaler
|
|
||||||
TWSR = 0;
|
|
||||||
// Set TWI clock frequency to SCL_CLOCK. Need TWBR>10.
|
|
||||||
// Check datasheets for more info.
|
|
||||||
TWBR = ((F_CPU/SCL_CLOCK)-16)/2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start a transaction with the given i2c slave address. The direction of the
|
|
||||||
// transfer is set with I2C_READ and I2C_WRITE.
|
|
||||||
// returns: 0 => success
|
|
||||||
// 1 => error
|
|
||||||
uint8_t i2c_master_start(uint8_t address) {
|
|
||||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTA);
|
|
||||||
|
|
||||||
i2c_delay();
|
|
||||||
|
|
||||||
// check that we started successfully
|
|
||||||
if ( (TW_STATUS != TW_START) && (TW_STATUS != TW_REP_START))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
TWDR = address;
|
|
||||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
|
||||||
|
|
||||||
i2c_delay();
|
|
||||||
|
|
||||||
if ( (TW_STATUS != TW_MT_SLA_ACK) && (TW_STATUS != TW_MR_SLA_ACK) )
|
|
||||||
return 1; // slave did not acknowledge
|
|
||||||
else
|
|
||||||
return 0; // success
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Finish the i2c transaction.
|
|
||||||
void i2c_master_stop(void) {
|
|
||||||
TWCR = (1<<TWINT) | (1<<TWEN) | (1<<TWSTO);
|
|
||||||
|
|
||||||
uint16_t lim = 0;
|
|
||||||
while(!(TWCR & (1<<TWSTO)) && lim < I2C_LOOP_TIMEOUT)
|
|
||||||
lim++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write one byte to the i2c slave.
|
|
||||||
// returns 0 => slave ACK
|
|
||||||
// 1 => slave NACK
|
|
||||||
uint8_t i2c_master_write(uint8_t data) {
|
|
||||||
TWDR = data;
|
|
||||||
TWCR = (1<<TWINT) | (1<<TWEN);
|
|
||||||
|
|
||||||
i2c_delay();
|
|
||||||
|
|
||||||
// check if the slave acknowledged us
|
|
||||||
return (TW_STATUS == TW_MT_DATA_ACK) ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read one byte from the i2c slave. If ack=1 the slave is acknowledged,
|
|
||||||
// if ack=0 the acknowledge bit is not set.
|
|
||||||
// returns: byte read from i2c device
|
|
||||||
uint8_t i2c_master_read(int ack) {
|
|
||||||
TWCR = (1<<TWINT) | (1<<TWEN) | (ack<<TWEA);
|
|
||||||
|
|
||||||
i2c_delay();
|
|
||||||
return TWDR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void i2c_reset_state(void) {
|
|
||||||
TWCR = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void i2c_slave_init(uint8_t address) {
|
|
||||||
TWAR = address << 0; // slave i2c address
|
|
||||||
// TWEN - twi enable
|
|
||||||
// TWEA - enable address acknowledgement
|
|
||||||
// TWINT - twi interrupt flag
|
|
||||||
// TWIE - enable the twi interrupt
|
|
||||||
TWCR = (1<<TWIE) | (1<<TWEA) | (1<<TWINT) | (1<<TWEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(TWI_vect);
|
|
||||||
|
|
||||||
ISR(TWI_vect) {
|
|
||||||
uint8_t ack = 1;
|
|
||||||
switch(TW_STATUS) {
|
|
||||||
case TW_SR_SLA_ACK:
|
|
||||||
// this device has been addressed as a slave receiver
|
|
||||||
slave_has_register_set = false;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TW_SR_DATA_ACK:
|
|
||||||
// this device has received data as a slave receiver
|
|
||||||
// The first byte that we receive in this transaction sets the location
|
|
||||||
// of the read/write location of the slaves memory that it exposes over
|
|
||||||
// i2c. After that, bytes will be written at slave_buffer_pos, incrementing
|
|
||||||
// slave_buffer_pos after each write.
|
|
||||||
if(!slave_has_register_set) {
|
|
||||||
slave_buffer_pos = TWDR;
|
|
||||||
// don't acknowledge the master if this memory loctaion is out of bounds
|
|
||||||
if ( slave_buffer_pos >= SLAVE_BUFFER_SIZE ) {
|
|
||||||
ack = 0;
|
|
||||||
slave_buffer_pos = 0;
|
|
||||||
}
|
|
||||||
slave_has_register_set = true;
|
|
||||||
} else {
|
|
||||||
i2c_slave_buffer[slave_buffer_pos] = TWDR;
|
|
||||||
BUFFER_POS_INC();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TW_ST_SLA_ACK:
|
|
||||||
case TW_ST_DATA_ACK:
|
|
||||||
// master has addressed this device as a slave transmitter and is
|
|
||||||
// requesting data.
|
|
||||||
TWDR = i2c_slave_buffer[slave_buffer_pos];
|
|
||||||
BUFFER_POS_INC();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case TW_BUS_ERROR: // something went wrong, reset twi state
|
|
||||||
TWCR = 0;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// Reset everything, so we are ready for the next TWI interrupt
|
|
||||||
TWCR |= (1<<TWIE) | (1<<TWINT) | (ack<<TWEA) | (1<<TWEN);
|
|
||||||
}
|
|
||||||
|
|
@ -1,49 +0,0 @@
|
|||||||
#ifndef I2C_H
|
|
||||||
#define I2C_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifndef F_CPU
|
|
||||||
#define F_CPU 16000000UL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define I2C_READ 1
|
|
||||||
#define I2C_WRITE 0
|
|
||||||
|
|
||||||
#define I2C_ACK 1
|
|
||||||
#define I2C_NACK 0
|
|
||||||
|
|
||||||
#define SLAVE_BUFFER_SIZE 0x10
|
|
||||||
|
|
||||||
// i2c SCL clock frequency 400kHz
|
|
||||||
#define SCL_CLOCK 400000L
|
|
||||||
|
|
||||||
extern volatile uint8_t i2c_slave_buffer[SLAVE_BUFFER_SIZE];
|
|
||||||
|
|
||||||
void i2c_master_init(void);
|
|
||||||
uint8_t i2c_master_start(uint8_t address);
|
|
||||||
void i2c_master_stop(void);
|
|
||||||
uint8_t i2c_master_write(uint8_t data);
|
|
||||||
uint8_t i2c_master_read(int);
|
|
||||||
void i2c_reset_state(void);
|
|
||||||
void i2c_slave_init(uint8_t address);
|
|
||||||
|
|
||||||
|
|
||||||
static inline unsigned char i2c_start_read(unsigned char addr) {
|
|
||||||
return i2c_master_start((addr << 1) | I2C_READ);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline unsigned char i2c_start_write(unsigned char addr) {
|
|
||||||
return i2c_master_start((addr << 1) | I2C_WRITE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// from SSD1306 scrips
|
|
||||||
extern unsigned char i2c_rep_start(unsigned char addr);
|
|
||||||
extern void i2c_start_wait(unsigned char addr);
|
|
||||||
extern unsigned char i2c_readAck(void);
|
|
||||||
extern unsigned char i2c_readNak(void);
|
|
||||||
extern unsigned char i2c_read(unsigned char ack);
|
|
||||||
|
|
||||||
#define i2c_read(ack) (ack) ? i2c_readAck() : i2c_readNak();
|
|
||||||
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
#define USE_I2C
|
|
@ -1,3 +0,0 @@
|
|||||||
# Patched Helix I2C
|
|
||||||
![Patchd Helix I2C](https://i.imgur.com/aCktPxO.jpg)
|
|
||||||
![Patchd Helix I2C fig](https://i.imgur.com/jgCHkYN.jpg)
|
|
@ -1,3 +0,0 @@
|
|||||||
#define USE_I2C
|
|
||||||
|
|
||||||
#define SSD1306OLED
|
|
@ -1,4 +0,0 @@
|
|||||||
# Patched Helix I2C with one OLED
|
|
||||||
![Patchd Helix I2C with one OLED](https://i.imgur.com/ARJj1RV.jpg)
|
|
||||||
![Patchd Helix I2C with one OLED fig](https://i.imgur.com/sm7H1CW.jpg)
|
|
||||||
![Patchd Helix I2C bad OLED](https://i.imgur.com/GFqYxby.jpg)
|
|
@ -1 +0,0 @@
|
|||||||
SRC += ssd1306.c
|
|
@ -1,24 +0,0 @@
|
|||||||
/* Copyright 2018 'mtei'
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
// place overrides here
|
|
||||||
|
|
||||||
#define TAPPING_TERM 300
|
|
||||||
#define PERMISSIVE_HOLD
|
|
||||||
/* when TAPPING_TERM >= 500 same effect PERMISSIVE_HOLD.
|
|
||||||
see tmk_core/common/action_tapping.c */
|
|
@ -1,304 +0,0 @@
|
|||||||
/* Copyright 2018 'mtei'
|
|
||||||
*
|
|
||||||
* 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
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
//Following line allows macro to read current RGB settings
|
|
||||||
extern rgblight_config_t rgblight_config;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "split_util.h"
|
|
||||||
#ifdef SSD1306OLED
|
|
||||||
#include "ssd1306.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KC_RBSCP LT(_RAISE,KC_BSPC)
|
|
||||||
#define KC_RENT LT(_RAISE,KC_ENT)
|
|
||||||
#define KC_LOWER MO(_LOWER)
|
|
||||||
|
|
||||||
enum layer_number {
|
|
||||||
_QWERTY = 0,
|
|
||||||
_LOWER,
|
|
||||||
_RAISE,
|
|
||||||
_ADJUST,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Defines the keycodes used by our macros in process_record_user
|
|
||||||
enum custom_keycodes {
|
|
||||||
EISU = SAFE_RANGE,
|
|
||||||
KANA,
|
|
||||||
RGBRST
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|
||||||
/* Qwerty
|
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
|
||||||
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BS |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | Tab | Q | W | E | R | T | | Y | U | I | O | P | \ |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | Ctrl | A | S | D | F | G | | H | J | K | L | ; | Ctrl |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | Shift| Z | X | C | V | B | ` | ' | N | M | , | . | / | Shift|
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* |Lower | Lower| Caps | Alt | GUI | Space| BS | Enter| Space| GUI | Alt | Menu |Lower |Lower |
|
|
||||||
* `-------------------------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_QWERTY] = LAYOUT_kc( /* Base */
|
|
||||||
ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, BSPC, \
|
|
||||||
TAB, Q, W, E, R, T, Y, U, I, O, P, BSLS, \
|
|
||||||
LCTL, A, S, D, F, G, H, J, K, L, SCLN, RCTL, \
|
|
||||||
LSFT, Z, X, C, V, B, GRV, QUOT, N, M, COMM, DOT, SLSH, RSFT, \
|
|
||||||
LOWER,LOWER,CAPS,LALT, LGUI, SPC, RBSCP, RENT, SPC, RGUI, RALT, APP, LOWER, LOWER \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Lower
|
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
|
||||||
* | | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10 | F11 |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | |Pause | ScrLk| Ins | | | | Ins | ScrLk|Pause | | F12 |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | PgUp | | Up |Delete| Home | | Home |Delete| Up | | PgUp | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | PgDn | Left | Down | Right| End | | | End | Left | Down | Right| PgDn | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | PrtSc| | | |Adjust|Adjust| | | | PrtSc| | |
|
|
||||||
* `-------------------------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_LOWER] = LAYOUT( \
|
|
||||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, \
|
|
||||||
XXXXXXX, XXXXXXX, KC_PAUS, KC_SLCK, KC_INS, XXXXXXX, XXXXXXX, KC_INS, KC_SLCK, KC_PAUS, XXXXXXX, KC_F12, \
|
|
||||||
_______, KC_HOME, XXXXXXX, KC_UP, KC_DEL, KC_PGUP, KC_PGUP, KC_DEL, KC_UP, XXXXXXX, KC_HOME, _______, \
|
|
||||||
_______, KC_END, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, XXXXXXX, XXXXXXX,KC_PGDN, KC_LEFT, KC_DOWN, KC_RGHT, KC_END, _______, \
|
|
||||||
_______, _______, KC_PSCR, _______, _______, _______, MO(_ADJUST),
|
|
||||||
MO(_ADJUST), _______, _______, _______, KC_PSCR, _______, _______ \
|
|
||||||
),
|
|
||||||
/* Raise
|
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
|
||||||
* | | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | | | | _ | - | | = | + | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | | | | { | [ | | ] | } | | | | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | | | | EISU | EISU | KANA | KANA | Next | Vol- | Vol+ | Play | |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | | | | |
|
|
||||||
* `-------------------------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_RAISE] = LAYOUT( \
|
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, LSFT(KC_MINS), KC_MINS, KC_EQL, LSFT(KC_EQL), XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
|
||||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, LSFT(KC_LBRC), KC_LBRC, KC_RBRC, LSFT(KC_RBRC), XXXXXXX, XXXXXXX, XXXXXXX, _______, \
|
|
||||||
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EISU, EISU, KANA, KANA, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY, _______, \
|
|
||||||
MO(_ADJUST),MO(_ADJUST),XXXXXXX, _______, _______, XXXXXXX, _______,
|
|
||||||
_______, XXXXXXX, _______, _______, XXXXXXX,MO(_ADJUST),MO(_ADJUST) \
|
|
||||||
),
|
|
||||||
|
|
||||||
/* Adjust (Lower + Raise)
|
|
||||||
* ,-----------------------------------------. ,-----------------------------------------.
|
|
||||||
* | | | | | | | | | | | | | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | | Reset|RGBRST|RGB ON|Aud on| Win | | Win |Aud on|RGB ON|RGBRST| | |
|
|
||||||
* |------+------+------+------+------+------| |------+------+------+------+------+------|
|
|
||||||
* | HUE+ | SAT+ | VAL+ |RGB md|Audoff| Mac | | Mac |Audoff|RGB md| VAL+ | SAT+ | HUE+ |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | HUE- | SAT- | VAL- | | | | | | | | | VAL- | SAT- | HUE- |
|
|
||||||
* |------+------+------+------+------+------+------+------+------+------+------+------+------+------|
|
|
||||||
* | | | | | | | | | | | | | | |
|
|
||||||
* `-------------------------------------------------------------------------------------------------'
|
|
||||||
*/
|
|
||||||
[_ADJUST] = LAYOUT( \
|
|
||||||
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, \
|
|
||||||
XXXXXXX, RESET, RGBRST, RGB_TOG, AU_ON, AG_SWAP, AG_SWAP, AU_ON, RGB_TOG, RGBRST, XXXXXXX, XXXXXXX, \
|
|
||||||
RGB_HUI, RGB_SAI, RGB_VAI, RGB_MOD, AU_OFF, AG_NORM, AG_NORM, AU_OFF, RGB_MOD, RGB_VAI, RGB_SAI, RGB_HUI, \
|
|
||||||
RGB_HUD, RGB_SAD, RGB_VAD, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, \
|
|
||||||
_______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______ \
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
switch (keycode) {
|
|
||||||
case EISU:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
if(keymap_config.swap_lalt_lgui==false){
|
|
||||||
register_code(KC_LANG2);
|
|
||||||
}else{
|
|
||||||
SEND_STRING(SS_LALT("`"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unregister_code(KC_LANG2);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case KANA:
|
|
||||||
if (record->event.pressed) {
|
|
||||||
if(keymap_config.swap_lalt_lgui==false){
|
|
||||||
register_code(KC_LANG1);
|
|
||||||
}else{
|
|
||||||
SEND_STRING(SS_LALT("`"));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unregister_code(KC_LANG1);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
break;
|
|
||||||
case RGBRST:
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
|
||||||
if (record->event.pressed) {
|
|
||||||
eeconfig_update_rgblight_default();
|
|
||||||
rgblight_enable();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_init_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void led_set_user(uint8_t usb_led) {
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SSD1306OLED
|
|
||||||
|
|
||||||
bool use_OLED = 0;
|
|
||||||
|
|
||||||
void matrix_init_OLED (void) {
|
|
||||||
use_OLED = 1;
|
|
||||||
iota_gfx_init(!isLeftHand); // turns on the display
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_user(void) {
|
|
||||||
if( use_OLED )
|
|
||||||
iota_gfx_task(); // this is what updates the display continuously
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_slave_scan_user(void) {
|
|
||||||
if( use_OLED )
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void render_logo(struct CharacterMatrix *matrix) {
|
|
||||||
|
|
||||||
static char logo[]={
|
|
||||||
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
|
|
||||||
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
|
|
||||||
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,
|
|
||||||
0};
|
|
||||||
matrix_write(matrix, logo);
|
|
||||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_ANIMATIONS)
|
|
||||||
char buf[30];
|
|
||||||
if(rgblight_config.enable) {
|
|
||||||
snprintf(buf, sizeof(buf), " LED %2d: %d,%d,%d ",
|
|
||||||
rgblight_config.mode,
|
|
||||||
rgblight_config.hue/RGBLIGHT_HUE_STEP,
|
|
||||||
rgblight_config.sat/RGBLIGHT_SAT_STEP,
|
|
||||||
rgblight_config.val/RGBLIGHT_VAL_STEP);
|
|
||||||
matrix_write(matrix, buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
//matrix_write_P(&matrix, PSTR(" Split keyboard kit"));
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char Qwerty_name[] PROGMEM = " Qwerty";
|
|
||||||
static const char Lower_name[] PROGMEM = ":Func";
|
|
||||||
static const char Raise_name[] PROGMEM = ":Extra";
|
|
||||||
static const char Adjust_name[] PROGMEM = ":Adjust";
|
|
||||||
|
|
||||||
static const char *layer_names[] = {
|
|
||||||
[_QWERTY] = Qwerty_name,
|
|
||||||
[_LOWER] = Lower_name,
|
|
||||||
[_RAISE] = Raise_name,
|
|
||||||
[_ADJUST] = Adjust_name
|
|
||||||
};
|
|
||||||
|
|
||||||
void render_status(struct CharacterMatrix *matrix) {
|
|
||||||
|
|
||||||
// Render to mode icon
|
|
||||||
static char logo[][2][3]={{{0x95,0x96,0},{0xb5,0xb6,0}},{{0x97,0x98,0},{0xb7,0xb8,0}}};
|
|
||||||
if(keymap_config.swap_lalt_lgui==false){
|
|
||||||
matrix_write(matrix, logo[0][0]);
|
|
||||||
matrix_write_P(matrix, PSTR("\n"));
|
|
||||||
matrix_write(matrix, logo[0][1]);
|
|
||||||
}else{
|
|
||||||
matrix_write(matrix, logo[1][0]);
|
|
||||||
matrix_write_P(matrix, PSTR("\n"));
|
|
||||||
matrix_write(matrix, logo[1][1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
|
|
||||||
int name_num;
|
|
||||||
uint32_t lstate;
|
|
||||||
matrix_write_P(matrix, layer_names[0]);
|
|
||||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLIGHT_ANIMATIONS)
|
|
||||||
char buf[30];
|
|
||||||
if(rgblight_config.enable) {
|
|
||||||
snprintf(buf, sizeof(buf), " LED %2d",
|
|
||||||
rgblight_config.mode);
|
|
||||||
matrix_write(matrix, buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
matrix_write_P(matrix, PSTR("\n"));
|
|
||||||
for( lstate = layer_state, name_num = 0;
|
|
||||||
lstate && name_num < sizeof(layer_names)/sizeof(char *);
|
|
||||||
lstate >>=1, name_num++ ) {
|
|
||||||
if( (lstate & 1) != 0 ) {
|
|
||||||
if( layer_names[name_num] ) {
|
|
||||||
matrix_write_P(matrix, layer_names[name_num]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Host Keyboard LED Status
|
|
||||||
char led[40];
|
|
||||||
snprintf(led, sizeof(led), "\n%s %s %s",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) ? "NUMLOCK" : " ",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_CAPS_LOCK)) ? "CAPS" : " ",
|
|
||||||
(host_keyboard_leds() & (1<<USB_LED_SCROLL_LOCK)) ? "SCLK" : " ");
|
|
||||||
matrix_write(matrix, led);
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_task_user(void) {
|
|
||||||
struct CharacterMatrix matrix;
|
|
||||||
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
if (debug_enable) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
matrix_clear(&matrix);
|
|
||||||
if(isLeftHand){
|
|
||||||
render_status(&matrix);
|
|
||||||
}else{
|
|
||||||
render_logo(&matrix);
|
|
||||||
}
|
|
||||||
matrix_update(&display, &matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
# The default keymap for pdhelix
|
|
@ -1,5 +0,0 @@
|
|||||||
#ifndef SOFT_SERIAL_PIN
|
|
||||||
/* Soft Serial defines */
|
|
||||||
#define SOFT_SERIAL_PIN D0
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
# Patched Helix PD0
|
|
||||||
![Patchd Helix PD0](https://i.imgur.com/PWos3kD.jpg)
|
|
@ -1,4 +0,0 @@
|
|||||||
#ifndef SOFT_SERIAL_PIN
|
|
||||||
/* Soft Serial defines */
|
|
||||||
#define SOFT_SERIAL_PIN D2
|
|
||||||
#endif
|
|
@ -1,2 +0,0 @@
|
|||||||
# Patched Helix PD2
|
|
||||||
![Patchd Helix PD2](https://i.imgur.com/pGUT2II.jpg)
|
|
@ -1,6 +0,0 @@
|
|||||||
#ifndef SOFT_SERIAL_PIN
|
|
||||||
/* Soft Serial defines */
|
|
||||||
#define SOFT_SERIAL_PIN D2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SSD1306OLED
|
|
@ -1,3 +0,0 @@
|
|||||||
# Patched Helix PD2 with two OLED
|
|
||||||
![Patchd Helix PD2 with two OLED](https://i.imgur.com/NVYyNuf.jpg)
|
|
||||||
![Patchd Helix PD2 with two OLED fig](https://i.imgur.com/Ee1WQrs.jpg)
|
|
@ -1,2 +0,0 @@
|
|||||||
SRC += i2c.c
|
|
||||||
SRC += ssd1306.c
|
|
@ -1,65 +0,0 @@
|
|||||||
/* Copyright 2018 'mtei'
|
|
||||||
*
|
|
||||||
* 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 "pdhelix.h"
|
|
||||||
#include "split_util.h"
|
|
||||||
|
|
||||||
#if defined(SSD1306OLED)
|
|
||||||
extern void matrix_init_OLED(void);
|
|
||||||
|
|
||||||
void matrix_master_OLED_init (void) {
|
|
||||||
//dummy for quantum/split_common/split_util.c:keyboard_master_setup() call
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void matrix_init_kb(void) {
|
|
||||||
// put your keyboard start-up code here
|
|
||||||
// runs once when the firmware starts up
|
|
||||||
|
|
||||||
#if defined(SSD1306OLED)
|
|
||||||
#if SOFT_SERIAL_PIN != D0 && SOFT_SERIAL_PIN != D1
|
|
||||||
#ifndef USE_I2C
|
|
||||||
matrix_init_OLED();
|
|
||||||
#else
|
|
||||||
if (isLeftHand) {
|
|
||||||
matrix_init_OLED();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#error OLED cant init 'SOFT_SERIAL_PIN == D0 || SOFT_SERIAL_PIN == D1'
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
matrix_init_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
// put your looping keyboard code here
|
|
||||||
// runs every cycle (a lot)
|
|
||||||
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
// put your per-action keyboard code here
|
|
||||||
// runs for every action, just before processing by the firmware
|
|
||||||
|
|
||||||
return process_record_user(keycode, record);
|
|
||||||
}
|
|
||||||
|
|
||||||
void led_set_kb(uint8_t usb_led) {
|
|
||||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
|
||||||
|
|
||||||
led_set_user(usb_led);
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/* Copyright 2018 'mtei'
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
#ifndef PDHELIX_H
|
|
||||||
#define PDHELIX_H
|
|
||||||
|
|
||||||
#include "quantum.h"
|
|
||||||
|
|
||||||
/* This a shortcut to help you visually see your layout.
|
|
||||||
*
|
|
||||||
* The first section contains all of the arguments representing the physical
|
|
||||||
* layout of the board and position of the keys.
|
|
||||||
*
|
|
||||||
* The second converts the arguments into a two-dimensional array which
|
|
||||||
* represents the switch matrix.
|
|
||||||
*/
|
|
||||||
#define LAYOUT( \
|
|
||||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
|
||||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
|
||||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
|
||||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \
|
|
||||||
L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \
|
|
||||||
) \
|
|
||||||
{ \
|
|
||||||
{ L00, L01, L02, L03, L04, L05, KC_NO }, \
|
|
||||||
{ L10, L11, L12, L13, L14, L15, KC_NO }, \
|
|
||||||
{ L20, L21, L22, L23, L24, L25, KC_NO }, \
|
|
||||||
{ L30, L31, L32, L33, L34, L35, L36 }, \
|
|
||||||
{ L40, L41, L42, L43, L44, L45, L46 }, \
|
|
||||||
{ R05, R04, R03, R02, R01, R00, KC_NO }, \
|
|
||||||
{ R15, R14, R13, R12, R11, R10, KC_NO }, \
|
|
||||||
{ R25, R24, R23, R22, R21, R20, KC_NO }, \
|
|
||||||
{ R35, R34, R33, R32, R31, R30, R36 }, \
|
|
||||||
{ R45, R44, R43, R42, R41, R40, R46 } \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define LAYOUT_kc( \
|
|
||||||
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
|
|
||||||
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
|
|
||||||
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
|
|
||||||
L30, L31, L32, L33, L34, L35, L36, R36, R30, R31, R32, R33, R34, R35, \
|
|
||||||
L40, L41, L42, L43, L44, L45, L46, R46, R40, R41, R42, R43, R44, R45 \
|
|
||||||
) \
|
|
||||||
LAYOUT( \
|
|
||||||
KC_##L00,KC_##L01,KC_##L02,KC_##L03,KC_##L04,KC_##L05, KC_##R00,KC_##R01,KC_##R02,KC_##R03,KC_##R04,KC_##R05, \
|
|
||||||
KC_##L10,KC_##L11,KC_##L12,KC_##L13,KC_##L14,KC_##L15, KC_##R10,KC_##R11,KC_##R12,KC_##R13,KC_##R14,KC_##R15, \
|
|
||||||
KC_##L20,KC_##L21,KC_##L22,KC_##L23,KC_##L24,KC_##L25, KC_##R20,KC_##R21,KC_##R22,KC_##R23,KC_##R24,KC_##R25, \
|
|
||||||
KC_##L30,KC_##L31,KC_##L32,KC_##L33,KC_##L34,KC_##L35,KC_##L36, KC_##R36,KC_##R30,KC_##R31,KC_##R32,KC_##R33,KC_##R34,KC_##R35, \
|
|
||||||
KC_##L40,KC_##L41,KC_##L42,KC_##L43,KC_##L44,KC_##L45,KC_##L46, KC_##R46,KC_##R40,KC_##R41,KC_##R42,KC_##R43,KC_##R44,KC_##R45 \
|
|
||||||
)
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,15 +0,0 @@
|
|||||||
# pdhelix (Patched Helix)
|
|
||||||
|
|
||||||
![Patchd Helix PD0](https://i.imgur.com/OvchUjl.jpg)
|
|
||||||
|
|
||||||
This is a provisional Helix implementation to test the quantum/split_common code. It is not intended to make Helix implementation correspond to quantum/split_common.
|
|
||||||
|
|
||||||
Firmware Maintainer: [mtei](https://github.com/mtei)
|
|
||||||
Hardware Supported: Helix PCB with patch, Pro Micro
|
|
||||||
Hardware Availability: links to where you can find this hardware
|
|
||||||
|
|
||||||
Make example for this keyboard (after setting up your build environment):
|
|
||||||
|
|
||||||
make handwired/pdhelix:default
|
|
||||||
|
|
||||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
|
@ -1,91 +0,0 @@
|
|||||||
# MCU name
|
|
||||||
#MCU = at90usb1286
|
|
||||||
MCU = atmega32u4
|
|
||||||
|
|
||||||
# Processor frequency.
|
|
||||||
# This will define a symbol, F_CPU, in all source code files equal to the
|
|
||||||
# processor frequency in Hz. You can then use this symbol in your source code to
|
|
||||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done
|
|
||||||
# automatically to create a 32-bit value in your source code.
|
|
||||||
#
|
|
||||||
# This will be an integer division of F_USB below, as it is sourced by
|
|
||||||
# F_USB after it has run through any CPU prescalers. Note that this value
|
|
||||||
# does not *change* the processor frequency - it should merely be updated to
|
|
||||||
# reflect the processor speed set externally so that the code can use accurate
|
|
||||||
# software delays.
|
|
||||||
F_CPU = 16000000
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# LUFA specific
|
|
||||||
#
|
|
||||||
# Target architecture (see library "Board Types" documentation).
|
|
||||||
ARCH = AVR8
|
|
||||||
|
|
||||||
# Input clock frequency.
|
|
||||||
# This will define a symbol, F_USB, in all source code files equal to the
|
|
||||||
# input clock frequency (before any prescaling is performed) in Hz. This value may
|
|
||||||
# differ from F_CPU if prescaling is used on the latter, and is required as the
|
|
||||||
# raw input clock is fed directly to the PLL sections of the AVR for high speed
|
|
||||||
# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
|
|
||||||
# at the end, this will be done automatically to create a 32-bit value in your
|
|
||||||
# source code.
|
|
||||||
#
|
|
||||||
# If no clock division is performed on the input clock inside the AVR (via the
|
|
||||||
# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
|
|
||||||
F_USB = $(F_CPU)
|
|
||||||
|
|
||||||
# Interrupt driven control endpoint task(+60)
|
|
||||||
OPT_DEFS += -DINTERRUPT_CONTROL_ENDPOINT
|
|
||||||
|
|
||||||
|
|
||||||
# Bootloader selection
|
|
||||||
# Teensy halfkay
|
|
||||||
# Pro Micro caterina
|
|
||||||
# Atmel DFU atmel-dfu
|
|
||||||
# LUFA DFU lufa-dfu
|
|
||||||
# QMK DFU qmk-dfu
|
|
||||||
# atmega32a bootloadHID
|
|
||||||
BOOTLOADER = atmel-dfu
|
|
||||||
|
|
||||||
|
|
||||||
# If you don't know the bootloader type, then you can specify the
|
|
||||||
# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
|
|
||||||
# Teensy halfKay 512
|
|
||||||
# Teensy++ halfKay 1024
|
|
||||||
# Atmel DFU loader 4096
|
|
||||||
# LUFA bootloader 4096
|
|
||||||
# USBaspLoader 2048
|
|
||||||
# OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
|
||||||
|
|
||||||
|
|
||||||
# Build Options
|
|
||||||
# change yes to no to disable
|
|
||||||
#
|
|
||||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
|
||||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
|
||||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
|
||||||
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
|
||||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
|
||||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
|
||||||
NKRO_ENABLE = no # USB Nkey Rollover
|
|
||||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
|
||||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
|
||||||
MIDI_ENABLE = no # MIDI support (+2400 to 4200, depending on config)
|
|
||||||
UNICODE_ENABLE = no # Unicode
|
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
|
||||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
|
||||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs (+400)
|
|
||||||
|
|
||||||
|
|
||||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
|
||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
|
||||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
|
||||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
|
||||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
|
||||||
|
|
||||||
SPLIT_KEYBOARD = yes
|
|
||||||
DEFAULT_FOLDER = handwired/pdhelix/pd0
|
|
@ -1,342 +0,0 @@
|
|||||||
|
|
||||||
#ifdef SSD1306OLED
|
|
||||||
|
|
||||||
#include "ssd1306.h"
|
|
||||||
#include "i2c.h"
|
|
||||||
#include <string.h>
|
|
||||||
#include "print.h"
|
|
||||||
#ifndef LOCAL_GLCDFONT
|
|
||||||
#include "common/glcdfont.c"
|
|
||||||
#else
|
|
||||||
#include <helixfont.h>
|
|
||||||
#endif
|
|
||||||
#ifdef ADAFRUIT_BLE_ENABLE
|
|
||||||
#include "adafruit_ble.h"
|
|
||||||
#endif
|
|
||||||
#ifdef PROTOCOL_LUFA
|
|
||||||
#include "lufa.h"
|
|
||||||
#endif
|
|
||||||
#include "sendchar.h"
|
|
||||||
#include "timer.h"
|
|
||||||
|
|
||||||
// Set this to 1 to help diagnose early startup problems
|
|
||||||
// when testing power-on with ble. Turn it off otherwise,
|
|
||||||
// as the latency of printing most of the debug info messes
|
|
||||||
// with the matrix scan, causing keys to drop.
|
|
||||||
#define DEBUG_TO_SCREEN 0
|
|
||||||
|
|
||||||
//static uint16_t last_battery_update;
|
|
||||||
//static uint32_t vbat;
|
|
||||||
//#define BatteryUpdateInterval 10000 /* milliseconds */
|
|
||||||
|
|
||||||
// 'last_flush' is declared as uint16_t,
|
|
||||||
// so this must be less than 65535
|
|
||||||
#define ScreenOffInterval 60000 /* milliseconds */
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
static uint8_t displaying;
|
|
||||||
#endif
|
|
||||||
static uint16_t last_flush;
|
|
||||||
|
|
||||||
static bool force_dirty = true;
|
|
||||||
|
|
||||||
// Write command sequence.
|
|
||||||
// Returns true on success.
|
|
||||||
static inline bool _send_cmd1(uint8_t cmd) {
|
|
||||||
bool res = false;
|
|
||||||
|
|
||||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
|
||||||
xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i2c_master_write(0x0 /* command byte follows */)) {
|
|
||||||
print("failed to write control byte\n");
|
|
||||||
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i2c_master_write(cmd)) {
|
|
||||||
xprintf("failed to write command %d\n", cmd);
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
res = true;
|
|
||||||
done:
|
|
||||||
i2c_master_stop();
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write 2-byte command sequence.
|
|
||||||
// Returns true on success
|
|
||||||
static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
|
|
||||||
if (!_send_cmd1(cmd)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _send_cmd1(opr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write 3-byte command sequence.
|
|
||||||
// Returns true on success
|
|
||||||
static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
|
|
||||||
if (!_send_cmd1(cmd)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!_send_cmd1(opr1)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return _send_cmd1(opr2);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
|
|
||||||
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
|
|
||||||
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
|
|
||||||
|
|
||||||
static void clear_display(void) {
|
|
||||||
matrix_clear(&display);
|
|
||||||
|
|
||||||
// Clear all of the display bits (there can be random noise
|
|
||||||
// in the RAM on startup)
|
|
||||||
send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
|
|
||||||
send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
|
|
||||||
|
|
||||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (i2c_master_write(0x40)) {
|
|
||||||
// Data mode
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
for (uint8_t row = 0; row < MatrixRows; ++row) {
|
|
||||||
for (uint8_t col = 0; col < DisplayWidth; ++col) {
|
|
||||||
i2c_master_write(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
display.dirty = false;
|
|
||||||
|
|
||||||
done:
|
|
||||||
i2c_master_stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
#undef sendchar
|
|
||||||
static int8_t capture_sendchar(uint8_t c) {
|
|
||||||
sendchar(c);
|
|
||||||
iota_gfx_write_char(c);
|
|
||||||
|
|
||||||
if (!displaying) {
|
|
||||||
iota_gfx_flush();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool iota_gfx_init(bool rotate) {
|
|
||||||
bool success = false;
|
|
||||||
|
|
||||||
i2c_master_init();
|
|
||||||
send_cmd1(DisplayOff);
|
|
||||||
send_cmd2(SetDisplayClockDiv, 0x80);
|
|
||||||
send_cmd2(SetMultiPlex, DisplayHeight - 1);
|
|
||||||
|
|
||||||
send_cmd2(SetDisplayOffset, 0);
|
|
||||||
|
|
||||||
|
|
||||||
send_cmd1(SetStartLine | 0x0);
|
|
||||||
send_cmd2(SetChargePump, 0x14 /* Enable */);
|
|
||||||
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
|
|
||||||
|
|
||||||
if(rotate){
|
|
||||||
// the following Flip the display orientation 180 degrees
|
|
||||||
send_cmd1(SegRemap);
|
|
||||||
send_cmd1(ComScanInc);
|
|
||||||
}else{
|
|
||||||
// Flips the display orientation 0 degrees
|
|
||||||
send_cmd1(SegRemap | 0x1);
|
|
||||||
send_cmd1(ComScanDec);
|
|
||||||
}
|
|
||||||
|
|
||||||
send_cmd2(SetComPins, 0x2);
|
|
||||||
send_cmd2(SetContrast, 0x8f);
|
|
||||||
send_cmd2(SetPreCharge, 0xf1);
|
|
||||||
send_cmd2(SetVComDetect, 0x40);
|
|
||||||
send_cmd1(DisplayAllOnResume);
|
|
||||||
send_cmd1(NormalDisplay);
|
|
||||||
send_cmd1(DeActivateScroll);
|
|
||||||
send_cmd1(DisplayOn);
|
|
||||||
|
|
||||||
send_cmd2(SetContrast, 0); // Dim
|
|
||||||
|
|
||||||
clear_display();
|
|
||||||
|
|
||||||
success = true;
|
|
||||||
|
|
||||||
iota_gfx_flush();
|
|
||||||
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
print_set_sendchar(capture_sendchar);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
done:
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool iota_gfx_off(void) {
|
|
||||||
bool success = false;
|
|
||||||
|
|
||||||
send_cmd1(DisplayOff);
|
|
||||||
success = true;
|
|
||||||
|
|
||||||
done:
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool iota_gfx_on(void) {
|
|
||||||
bool success = false;
|
|
||||||
|
|
||||||
send_cmd1(DisplayOn);
|
|
||||||
success = true;
|
|
||||||
|
|
||||||
done:
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
|
|
||||||
*matrix->cursor = c;
|
|
||||||
++matrix->cursor;
|
|
||||||
|
|
||||||
if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
|
|
||||||
// We went off the end; scroll the display upwards by one line
|
|
||||||
memmove(&matrix->display[0], &matrix->display[1],
|
|
||||||
MatrixCols * (MatrixRows - 1));
|
|
||||||
matrix->cursor = &matrix->display[MatrixRows - 1][0];
|
|
||||||
memset(matrix->cursor, ' ', MatrixCols);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
|
|
||||||
matrix->dirty = true;
|
|
||||||
|
|
||||||
if (c == '\n') {
|
|
||||||
// Clear to end of line from the cursor and then move to the
|
|
||||||
// start of the next line
|
|
||||||
uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
|
|
||||||
|
|
||||||
while (cursor_col++ < MatrixCols) {
|
|
||||||
matrix_write_char_inner(matrix, ' ');
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
matrix_write_char_inner(matrix, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_write_char(uint8_t c) {
|
|
||||||
matrix_write_char(&display, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
|
||||||
const char *end = data + strlen(data);
|
|
||||||
while (data < end) {
|
|
||||||
matrix_write_char(matrix, *data);
|
|
||||||
++data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_write(const char *data) {
|
|
||||||
matrix_write(&display, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
|
||||||
while (true) {
|
|
||||||
uint8_t c = pgm_read_byte(data);
|
|
||||||
if (c == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
matrix_write_char(matrix, c);
|
|
||||||
++data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_write_P(const char *data) {
|
|
||||||
matrix_write_P(&display, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_clear(struct CharacterMatrix *matrix) {
|
|
||||||
memset(matrix->display, ' ', sizeof(matrix->display));
|
|
||||||
matrix->cursor = &matrix->display[0][0];
|
|
||||||
matrix->dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_clear_screen(void) {
|
|
||||||
matrix_clear(&display);
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_render(struct CharacterMatrix *matrix) {
|
|
||||||
last_flush = timer_read();
|
|
||||||
iota_gfx_on();
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
++displaying;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Move to the home position
|
|
||||||
send_cmd3(PageAddr, 0, MatrixRows - 1);
|
|
||||||
send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
|
|
||||||
|
|
||||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
if (i2c_master_write(0x40)) {
|
|
||||||
// Data mode
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (uint8_t row = 0; row < MatrixRows; ++row) {
|
|
||||||
for (uint8_t col = 0; col < MatrixCols; ++col) {
|
|
||||||
const uint8_t *glyph = font + (matrix->display[row][col] * FontWidth);
|
|
||||||
|
|
||||||
for (uint8_t glyphCol = 0; glyphCol < FontWidth; ++glyphCol) {
|
|
||||||
uint8_t colBits = pgm_read_byte(glyph + glyphCol);
|
|
||||||
i2c_master_write(colBits);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 1 column of space between chars (it's not included in the glyph)
|
|
||||||
//i2c_master_write(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
matrix->dirty = false;
|
|
||||||
|
|
||||||
done:
|
|
||||||
i2c_master_stop();
|
|
||||||
#if DEBUG_TO_SCREEN
|
|
||||||
--displaying;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_flush(void) {
|
|
||||||
matrix_render(&display);
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__ ((weak))
|
|
||||||
void iota_gfx_task_user(void) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void iota_gfx_task(void) {
|
|
||||||
iota_gfx_task_user();
|
|
||||||
|
|
||||||
if (display.dirty|| force_dirty) {
|
|
||||||
iota_gfx_flush();
|
|
||||||
force_dirty = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (timer_elapsed(last_flush) > ScreenOffInterval) {
|
|
||||||
iota_gfx_off();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record) {
|
|
||||||
force_dirty = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,93 +0,0 @@
|
|||||||
#ifndef SSD1306_H
|
|
||||||
#define SSD1306_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
|
||||||
DisplayOff = 0xAE,
|
|
||||||
DisplayOn = 0xAF,
|
|
||||||
|
|
||||||
SetContrast = 0x81,
|
|
||||||
DisplayAllOnResume = 0xA4,
|
|
||||||
|
|
||||||
DisplayAllOn = 0xA5,
|
|
||||||
NormalDisplay = 0xA6,
|
|
||||||
InvertDisplay = 0xA7,
|
|
||||||
SetDisplayOffset = 0xD3,
|
|
||||||
SetComPins = 0xda,
|
|
||||||
SetVComDetect = 0xdb,
|
|
||||||
SetDisplayClockDiv = 0xD5,
|
|
||||||
SetPreCharge = 0xd9,
|
|
||||||
SetMultiPlex = 0xa8,
|
|
||||||
SetLowColumn = 0x00,
|
|
||||||
SetHighColumn = 0x10,
|
|
||||||
SetStartLine = 0x40,
|
|
||||||
|
|
||||||
SetMemoryMode = 0x20,
|
|
||||||
ColumnAddr = 0x21,
|
|
||||||
PageAddr = 0x22,
|
|
||||||
|
|
||||||
ComScanInc = 0xc0,
|
|
||||||
ComScanDec = 0xc8,
|
|
||||||
SegRemap = 0xa0,
|
|
||||||
SetChargePump = 0x8d,
|
|
||||||
ExternalVcc = 0x01,
|
|
||||||
SwitchCapVcc = 0x02,
|
|
||||||
|
|
||||||
ActivateScroll = 0x2f,
|
|
||||||
DeActivateScroll = 0x2e,
|
|
||||||
SetVerticalScrollArea = 0xa3,
|
|
||||||
RightHorizontalScroll = 0x26,
|
|
||||||
LeftHorizontalScroll = 0x27,
|
|
||||||
VerticalAndRightHorizontalScroll = 0x29,
|
|
||||||
VerticalAndLeftHorizontalScroll = 0x2a,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Controls the SSD1306 128x32 OLED display via i2c
|
|
||||||
|
|
||||||
#ifndef SSD1306_ADDRESS
|
|
||||||
#define SSD1306_ADDRESS 0x3C
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DisplayHeight 32
|
|
||||||
#define DisplayWidth 128
|
|
||||||
|
|
||||||
#define FontHeight 8
|
|
||||||
#define FontWidth 6
|
|
||||||
|
|
||||||
#define MatrixRows (DisplayHeight / FontHeight)
|
|
||||||
#define MatrixCols (DisplayWidth / FontWidth)
|
|
||||||
|
|
||||||
struct CharacterMatrix {
|
|
||||||
uint8_t display[MatrixRows][MatrixCols];
|
|
||||||
uint8_t *cursor;
|
|
||||||
bool dirty;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct CharacterMatrix display;
|
|
||||||
|
|
||||||
bool iota_gfx_init(bool rotate);
|
|
||||||
void iota_gfx_task(void);
|
|
||||||
bool iota_gfx_off(void);
|
|
||||||
bool iota_gfx_on(void);
|
|
||||||
void iota_gfx_flush(void);
|
|
||||||
void iota_gfx_write_char(uint8_t c);
|
|
||||||
void iota_gfx_write(const char *data);
|
|
||||||
void iota_gfx_write_P(const char *data);
|
|
||||||
void iota_gfx_clear_screen(void);
|
|
||||||
|
|
||||||
void iota_gfx_task_user(void);
|
|
||||||
|
|
||||||
void matrix_clear(struct CharacterMatrix *matrix);
|
|
||||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
|
|
||||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
|
|
||||||
void matrix_write(struct CharacterMatrix *matrix, const char *data);
|
|
||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in new issue