Skip to content

Commit

Permalink
Merge pull request #33 from qmk/master
Browse files Browse the repository at this point in the history
Sync to master
  • Loading branch information
duncanyoyo1 authored Jun 8, 2019
2 parents a45aff9 + 09968ba commit fbf2450
Show file tree
Hide file tree
Showing 26 changed files with 1,976 additions and 9 deletions.
9 changes: 5 additions & 4 deletions docs/feature_oled_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ void oled_task_user(void) {
|`OLED_DISPLAY_CUSTOM` |*Not defined* |Changes the display defines for use with custom displays.<br />Requires user to implement the below defines. |
|`OLED_DISPLAY_WIDTH` |`128` |The width of the OLED display. |
|`OLED_DISPLAY_HEIGHT` |`32` |The height of the OLED display. |
|`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.<br />`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`|
|`OLED_BLOCK_TYPE` |`uint16_t` |The unsigned integer type to use for dirty rendering.|
|`OLED_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.<br />`(sizeof(OLED_BLOCK_TYPE) * 8)`|
|`OLED_BLOCK_SIZE` |`32` |The size of each block for dirty rendering<br />`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`|
|`OLED_MATRIX_SIZE` |`512` |The local buffer size to allocate.<br />`(OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH)`. |
|`OLED_BLOCK_TYPE` |`uint16_t` |The unsigned integer type to use for dirty rendering. |
|`OLED_BLOCK_COUNT` |`16` |The number of blocks the display is divided into for dirty rendering.<br />`(sizeof(OLED_BLOCK_TYPE) * 8)`. |
|`OLED_BLOCK_SIZE` |`32` |The size of each block for dirty rendering<br />`(OLED_MATRIX_SIZE / OLED_BLOCK_COUNT)`. |
|`OLED_COM_PINS` |`COM_PINS_SEQ` |How the SSD1306 chip maps it's memory to display.<br />Options are `COM_PINS_SEQ`, `COM_PINS_ALT`, `COM_PINS_SEQ_LR`, & `COM_PINS_ALT_LR`. |
|`OLED_SOURCE_MAP` |`{ 0, ... N }` |Precalculated source array to use for mapping source buffer to target OLED memory in 90 degree rendering. |
|`OLED_TARGET_MAP` |`{ 24, ... N }`|Precalculated target array to use for mapping source buffer to target OLED memory in 90 degree rendering. |

Expand Down
6 changes: 5 additions & 1 deletion drivers/oled/oled_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define COM_SCAN_DEC 0xC8
#define DISPLAY_OFFSET 0xD3
#define COM_PINS 0xDA
#define COM_PINS_SEQ 0x02
#define COM_PINS_ALT 0x12
#define COM_PINS_SEQ_LR 0x22
#define COM_PINS_ALT_LR 0x32

// Timing & Driving Commands
#define DISPLAY_CLOCK 0xD5
Expand Down Expand Up @@ -182,7 +186,7 @@ bool oled_init(uint8_t rotation) {

static const uint8_t PROGMEM display_setup2[] = {
I2C_CMD,
COM_PINS, 0x02,
COM_PINS, OLED_COM_PINS,
CONTRAST, 0x8F,
PRE_CHARGE_PERIOD, 0xF1,
VCOM_DETECT, 0x40,
Expand Down
47 changes: 44 additions & 3 deletions drivers/oled/oled_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// Expected user to implement the necessary defines
#elif defined(OLED_DISPLAY_128X64)
// Double height 128x64
#ifndef OLED_DISPLAY_WIDTH
#define OLED_DISPLAY_WIDTH 128
#endif
#ifndef OLED_DISPLAY_HEIGHT
#define OLED_DISPLAY_HEIGHT 64
#endif
#ifndef OLED_MATRIX_SIZE
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 1024 (compile time mathed)
#define OLED_BLOCK_TYPE uint32_t
#endif
#ifndef OLED_BLOCK_TYPE
#define OLED_BLOCK_TYPE uint16_t
#endif
#ifndef OLED_BLOCK_COUNT
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 32 (compile time mathed)
#endif
#ifndef OLED_BLOCK_SIZE
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
#endif
#ifndef OLED_COM_PINS
#define OLED_COM_PINS COM_PINS_ALT
#endif

// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
#define OLED_SOURCE_MAP { 32, 40, 48, 56 }
#define OLED_TARGET_MAP { 24, 16, 8, 0 }
#ifndef OLED_SOURCE_MAP
#define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
#endif
#ifndef OLED_TARGET_MAP
#define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
#endif
// If OLED_BLOCK_TYPE is uint32_t, these tables would look like:
// #define OLED_SOURCE_MAP { 32, 40, 48, 56 }
// #define OLED_TARGET_MAP { 24, 16, 8, 0 }
// If OLED_BLOCK_TYPE is uint16_t, these tables would look like:
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
// #define OLED_TARGET_MAP { 56, 48, 40, 32, 24, 16, 8, 0 }
Expand All @@ -43,17 +65,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// #define OLED_TARGET_MAP { 56, 120, 48, 112, 40, 104, 32, 96, 24, 88, 16, 80, 8, 72, 0, 64 }
#else // defined(OLED_DISPLAY_128X64)
// Default 128x32
#ifndef OLED_DISPLAY_WIDTH
#define OLED_DISPLAY_WIDTH 128
#endif
#ifndef OLED_DISPLAY_HEIGHT
#define OLED_DISPLAY_HEIGHT 32
#endif
#ifndef OLED_MATRIX_SIZE
#define OLED_MATRIX_SIZE (OLED_DISPLAY_HEIGHT / 8 * OLED_DISPLAY_WIDTH) // 512 (compile time mathed)
#endif
#ifndef OLED_BLOCK_TYPE
#define OLED_BLOCK_TYPE uint16_t // Type to use for segmenting the oled display for smart rendering, use unsigned types only
#endif
#ifndef OLED_BLOCK_COUNT
#define OLED_BLOCK_COUNT (sizeof(OLED_BLOCK_TYPE) * 8) // 16 (compile time mathed)
#endif
#ifndef OLED_BLOCK_SIZE
#define OLED_BLOCK_SIZE (OLED_MATRIX_SIZE / OLED_BLOCK_COUNT) // 32 (compile time mathed)
#endif
#ifndef OLED_COM_PINS
#define OLED_COM_PINS COM_PINS_SEQ
#endif

// For 90 degree rotation, we map our internal matrix to oled matrix using fixed arrays
// The OLED writes to it's memory horizontally, starting top left, but our memory starts bottom left in this mode
#ifndef OLED_SOURCE_MAP
#define OLED_SOURCE_MAP { 0, 8, 16, 24 }
#endif
#ifndef OLED_TARGET_MAP
#define OLED_TARGET_MAP { 24, 16, 8, 0 }
#endif
// If OLED_BLOCK_TYPE is uint8_t, these tables would look like:
// #define OLED_SOURCE_MAP { 0, 8, 16, 24, 32, 40, 48, 56 }
// #define OLED_TARGET_MAP { 48, 32, 16, 0, 56, 40, 24, 8 }
Expand Down
27 changes: 27 additions & 0 deletions keyboards/dz60/dz60.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,33 @@
{ KC_NO, k41, KC_NO, k43, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, KC_NO, k4b, KC_NO, k4d, KC_NO } \
}

/* LAYOUT_60_ansi_split_bs_rshift
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
* │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0a │0b │0c │0d │0e │
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤
* │10 │12 │13 │14 │15 │16 │17 │18 │19 │1a │1b │1c │1d │1e │
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤
* │20 │22 │23 │24 │25 │26 │27 │28 │29 │2a │2b │2c │2d │
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤
* │30 │32 │33 │34 │35 │36 │37 │38 │39 │3a │3b │3d │3e │
* ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬┴───┤
* │40 │41 │43 │46 │4a │4b │4d │4e │
* └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘
*/
#define LAYOUT_60_ansi_split_bs_rshift( \
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \
k10, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
k20, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3d, k3e, \
k40, k41, k43, k46, k4a, k4b, k4d, k4e \
) { \
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e }, \
{ k10, KC_NO, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e }, \
{ k20, KC_NO, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, KC_NO }, \
{ k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, KC_NO, k3d, k3e }, \
{ k40, k41, KC_NO, k43, KC_NO, KC_NO, k46, KC_NO, KC_NO, KC_NO, k4a, k4b, KC_NO, k4d, k4e } \
}

// 带方向配列
/* Directional arrangement | LAYOUT_directional
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐
Expand Down
2 changes: 1 addition & 1 deletion keyboards/dz60/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
AUDIO_ENABLE = no
RGBLIGHT_ENABLE = yes

LAYOUTS = 60_ansi 60_iso 60_hhkb
LAYOUTS = 60_ansi 60_ansi_split_bs_rshift 60_hhkb 60_iso
14 changes: 14 additions & 0 deletions keyboards/redscarf_iiplus/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Red Scarf II+

The Red Scarf II+ is an improved version of the Red Scarf II and is available in four different sizes.

Ver A (RS Model F): 60% + Numpad on right, and Macro Keys on the left.
Ver B (RS78): 65% + Macro Keys on the left.
Ver C (RS68): 65%.
Ver D (RS77): 60% + Numpad on right.

For more information please consult [Geekhack](https://geekhack.org/index.php?topic=74400.0)

The Red Scarf II+ utilizes the same switch matrix across all its different versions. Therefore, firmware created for one will work on another. The caveat is that if you flash firmware built for the smaller boards onto a larger one, you will lose functionality of those extra keys. If you flash firmware built for a larger board onto a smaller one, the keys will operate normally.

At this time, only the Ver B and the Ver C have been confirmed working with QMK.
Loading

0 comments on commit fbf2450

Please sign in to comment.