From 6d2f9c9c1ee11445bb2eb6a92f96d0d5ed280ba4 Mon Sep 17 00:00:00 2001 From: Dmitry Nosachev Date: Fri, 17 Jun 2022 01:36:11 +0300 Subject: [Keyboard] Atreus: add STM32F103C8T6 based variant (#16846) Co-authored-by: Ryan --- keyboards/atreus/atreus.h | 2 + keyboards/atreus/f103/chconf.h | 28 ++++++ keyboards/atreus/f103/config.h | 38 ++++++++ keyboards/atreus/f103/f103.c | 17 ++++ keyboards/atreus/f103/f103.h | 17 ++++ keyboards/atreus/f103/halconf.h | 26 ++++++ keyboards/atreus/f103/mcuconf.h | 30 +++++++ keyboards/atreus/f103/rules.mk | 10 +++ keyboards/atreus/keymaps/quartz64/keymap.c | 137 +++++++++++++++++++++++++++++ keyboards/atreus/readme.md | 3 +- 10 files changed, 307 insertions(+), 1 deletion(-) create mode 100644 keyboards/atreus/f103/chconf.h create mode 100644 keyboards/atreus/f103/config.h create mode 100644 keyboards/atreus/f103/f103.c create mode 100644 keyboards/atreus/f103/f103.h create mode 100644 keyboards/atreus/f103/halconf.h create mode 100644 keyboards/atreus/f103/mcuconf.h create mode 100644 keyboards/atreus/f103/rules.mk create mode 100644 keyboards/atreus/keymaps/quartz64/keymap.c (limited to 'keyboards') diff --git a/keyboards/atreus/atreus.h b/keyboards/atreus/atreus.h index f4e7ba7f39..2753434535 100644 --- a/keyboards/atreus/atreus.h +++ b/keyboards/atreus/atreus.h @@ -28,6 +28,8 @@ #include "teensy2.h" #elif KEYBOARD_atreus_promicro #include "promicro.h" +#elif KEYBOARD_atreus_f103 + #include "f103.h" #endif // This a shortcut to help you visually see your layout. diff --git a/keyboards/atreus/f103/chconf.h b/keyboards/atreus/f103/chconf.h new file mode 100644 index 0000000000..63236f2c2c --- /dev/null +++ b/keyboards/atreus/f103/chconf.h @@ -0,0 +1,28 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_TIMEDELTA 0 + +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +#include_next diff --git a/keyboards/atreus/f103/config.h b/keyboards/atreus/f103/config.h new file mode 100644 index 0000000000..e16c9ee930 --- /dev/null +++ b/keyboards/atreus/f103/config.h @@ -0,0 +1,38 @@ +/* Copyright 2022 DmNosachev + * + * 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 . + */ + +#pragma once + +#include "config_common.h" + +/* + * 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) + * +*/ + +/* key matrix pins */ +#define MATRIX_COL_PINS { B10, B1, B0, A7, A6, B5, B4, B3, A15, A10, A9 } +#define MATRIX_ROW_PINS { A5, A4, A3, A2 } +#define UNUSED_PINS {B12, B13, B14, B15, A8, B6, B7, B8, B9, A1, A0, C15, C14, C13} + +/* COL2ROW, ROW2COL*/ +#define DIODE_DIRECTION COL2ROW diff --git a/keyboards/atreus/f103/f103.c b/keyboards/atreus/f103/f103.c new file mode 100644 index 0000000000..acac0ed71c --- /dev/null +++ b/keyboards/atreus/f103/f103.c @@ -0,0 +1,17 @@ +/* Copyright 2022 DmNosachev + * + * 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 . + */ + +#include "f103.h" diff --git a/keyboards/atreus/f103/f103.h b/keyboards/atreus/f103/f103.h new file mode 100644 index 0000000000..305b26798b --- /dev/null +++ b/keyboards/atreus/f103/f103.h @@ -0,0 +1,17 @@ +/* Copyright 2022 DmNosachev + * + * 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 . + */ + +#pragma once diff --git a/keyboards/atreus/f103/halconf.h b/keyboards/atreus/f103/halconf.h new file mode 100644 index 0000000000..923b4e52d2 --- /dev/null +++ b/keyboards/atreus/f103/halconf.h @@ -0,0 +1,26 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_PWM TRUE + +#include_next diff --git a/keyboards/atreus/f103/mcuconf.h b/keyboards/atreus/f103/mcuconf.h new file mode 100644 index 0000000000..5e94a97e21 --- /dev/null +++ b/keyboards/atreus/f103/mcuconf.h @@ -0,0 +1,30 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h` + */ + +#pragma once + +#include_next + +#undef STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 TRUE + +#undef STM32_SPI_USE_SPI2 +#define STM32_SPI_USE_SPI2 FALSE diff --git a/keyboards/atreus/f103/rules.mk b/keyboards/atreus/f103/rules.mk new file mode 100644 index 0000000000..a18b4fa231 --- /dev/null +++ b/keyboards/atreus/f103/rules.mk @@ -0,0 +1,10 @@ +# MCU name +MCU = STM32F103 + +# Bootloader selection +BOOTLOADER = stm32duino + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE + +BOOTMAGIC_ENABLE = yes \ No newline at end of file diff --git a/keyboards/atreus/keymaps/quartz64/keymap.c b/keyboards/atreus/keymaps/quartz64/keymap.c new file mode 100644 index 0000000000..c62011e4b3 --- /dev/null +++ b/keyboards/atreus/keymaps/quartz64/keymap.c @@ -0,0 +1,137 @@ +/* +Copyright 2022 DmNosachev + +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 . +*/ + +#include QMK_KEYBOARD_H + +// Defines names for use in layer keycodes and the keymap +enum layer_names { + _QW, + _RS, + _LW +}; + +#define MC1 COMP_FR_QUOTES +#define MC2 COMP_NBSP_EM_DASH +#define MC3 COMP_NBSP + +enum custom_keycodes { + COMP_FR_QUOTES = SAFE_RANGE, // Compose: french quotes + COMP_NBSP_EM_DASH, // Compose: nbsp followed by em dash + COMP_NBSP, // Compose: nbsp + PWD1, + PWD2, + PWD3, // KP password +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { +/* + ,----------------------------------. ,----------------------------------. + |Q/Alt | W | E | R | T | | Y | U | I | O | P | + |------+------+------+------+------| |------+------+------+------+------| + |A/Ctrl| S | D | F | G | | H | J | K | L |;/Ctrl| + |------+------+------+------+------|------.,------|------+------+------+------+------| + |Z/Shft| X | C | V | B |Bkspc ||Delete| N | M | , | . |?/Shft| + |------+------+------+------+------| || |------+------+------+------+------| + | ~ | Tab | - | GUI |Spc/LW|------'`------|Ent/RS| |\ | [ | ] | "' | + `----------------------------------' `----------------------------------' +*/ + [_QW] = LAYOUT( /* QWERTY */ + LALT_T(KC_Q), KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + LCTL_T(KC_A), KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, RCTL_T(KC_SCLN), + LSFT_T(KC_Z), KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, RSFT_T(KC_SLSH), + KC_GRV, KC_TAB, KC_MINS, KC_LGUI, LT(_LW, KC_SPC), KC_BSPC, KC_DEL, LT(_RS, KC_ENT), KC_BSLS, KC_LBRC, KC_RBRC, KC_QUOT + ), + +/* + ,----------------------------------. ,----------------------------------. + | PrnSc| pwd1 | up | pwd2 | PgUp | | Home | F7 | F8 | F9 | | + |------+------+------+------+------| |------+------+------+------+------| + | trns | left | down | right| PgDn | | End | F4 | F5 | F6 | trns | + |------+------+------+------+------|------.,------|------+------+------+------+------| + | trns | MC2 | MC3 | ( | ) | || | AltGr| F1 | F2 | F3 | trns | + |------+------+------+------+------| || |------+------+------+------+------| + | trns | C+S | Ins | MC1 | trns |------'`------| trns | F10 | F11 | F12 | trns | + `----------------------------------' `----------------------------------' +*/ + + [_RS] = LAYOUT( /* RAISE */ + KC_PSCR, PWD1, KC_UP, PWD2, KC_PGUP, KC_HOME, KC_F7, KC_F8, KC_F9, _______, + _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_END, KC_F4, KC_F5, KC_F6, _______, + _______, MC2, MC3, KC_LPRN, KC_RPRN, KC_RALT, KC_F1, KC_F2, KC_F3, _______, + _______, LCTL(KC_LSFT), _______, MC1, _______, _______, _______, _______, KC_F10, KC_F11, KC_F12, _______ + ), + +/* + ,----------------------------------. ,----------------------------------. + | ! | @ | # | $ | % | | / | 7 | 8 | 9 | . | + |------+------+------+------+------| |------+------+------+------+------| + | trns | ^ | & | * | PWD3 | | * | 4 | 5 | 6 | trns | + |------+------+------+------+------|------.,------|------+------+------+------+------| + | trns |r_tog | r_hue| r_sat| r_val| || | + | 1 | 2 | 3 | trns | + |------+------+------+------+------| || |------+------+------+------+------| + | trns | Esc |RESET |capslk| trns |------'`------| trns | 0 | - | += | trns | + `----------------------------------' `----------------------------------' +*/ + + [_LW] = LAYOUT( /* LOWER */ + KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_PSLS, KC_7, KC_8, KC_9, KC_PDOT, + _______, KC_CIRC, KC_AMPR, KC_ASTR, PWD3, KC_PAST, KC_4, KC_5, KC_6, _______, + _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, KC_PPLS, KC_1, KC_2, KC_3, _______, + _______, KC_ESC , RESET, KC_CAPS, _______, _______, _______, _______, KC_0, KC_PMNS, KC_EQL, _______ + ) +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case MC1: /* French quotes */ + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_RALT) SS_DELAY(100) "<<" SS_DELAY(100) SS_TAP(X_RALT) SS_DELAY(100) ">>" SS_TAP(X_LEFT)); + } + break; + + case MC2: /* NB-space + mdash + space */ + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_RALT) SS_DELAY(100) " " SS_DELAY(100) SS_TAP(X_RALT) SS_DELAY(100) "--- "); + } + break; + + case MC3: /* NB-space */ + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_RALT) SS_DELAY(100) " "); + } + break; + + case PWD1: + if (record->event.pressed) { + SEND_STRING("NakedLunch1991\n"); + } + break; + + case PWD2: + if (record->event.pressed) { + SEND_STRING("O94nx4sUWHc4akud\n"); + } + break; + + case PWD3: + if (record->event.pressed) { + SEND_STRING("Q123qQ123q\n"); + } + break; + } + return true; +}; \ No newline at end of file diff --git a/keyboards/atreus/readme.md b/keyboards/atreus/readme.md index 0f499ca2a2..84c541e8d5 100644 --- a/keyboards/atreus/readme.md +++ b/keyboards/atreus/readme.md @@ -8,7 +8,7 @@ Keyboard Maintainer: [Phil Hagelberg](https://github.com/technomancy) Hardware Supported: Atreus, PCB-based or hand-wired Hardware Availability: https://atreus.technomancy.us -These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in two variants: one powered by a Teensy 2 (usually hand-wired), one powered by an A-Star (usually using a PCB). You will need to use different `make` commands depending on the variant you have; see examples below. +These configuration files are specifically for the Atreus keyboards created by Phil Hagelberg (@technomancy). This keyboard is available in several variants: powered by a Teensy 2 or STM32F103C8T6 based MCU board (usually hand-wired), powered by an A-Star or ProMicro (usually using a PCB). You will need to use different `make` commands depending on the variant you have; see examples below. Make example for this keyboard (after setting up your build environment): @@ -19,6 +19,7 @@ If you would like to use one of the alternative controllers: make atreus/astar:default:flash make atreus/teensy2:default:flash make atreus/promicro:default:flash + make atreus/f103:default:flash If your keyboard layout is a mirror image of what you expected (i.e. you do not get QWERTY on the left but YTREWQ on the right), then you have an A-Star powered Atreus (older than March 2016) with PCB labels facing *down* instead of up. Specify that by adding `PCBDOWN=yes` to your `make` commands, e.g. -- cgit v1.2.3