Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
526c185e7e | ||
|
c63fd051da | ||
|
b95979560c | ||
|
65150984bd | ||
|
205321c377 | ||
|
1816ad01d0 | ||
|
9c8f61dfa0 | ||
|
d1df576ece | ||
|
83ebbf57b3 | ||
|
8e1f706ac6 | ||
|
b0c780ed32 | ||
|
3ad2be52a7 | ||
|
0fbcb41c85 | ||
|
ddca422776 | ||
|
82bb7d2852 | ||
|
1044519f36 | ||
|
209942366b | ||
|
494b34b63f | ||
|
58e3b01f37 | ||
|
6c2008c688 | ||
|
bcedc80ec7 |
@ -34,7 +34,9 @@
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Driver Installation with Zadig](driver_installation_zadig.md)
|
||||
* [Keymap Overview](keymap.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* Development Environments
|
||||
* [Docker Guide](getting_started_docker.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* Flashing
|
||||
* [Flashing](flashing.md)
|
||||
* [Flashing ATmega32A (ps2avrgb)](flashing_bootloadhid.md)
|
||||
@ -126,6 +128,7 @@
|
||||
* [SPI Driver](spi_driver.md)
|
||||
* [WS2812 Driver](ws2812_driver.md)
|
||||
* [EEPROM Driver](eeprom_driver.md)
|
||||
* ['serial' Driver](serial_driver.md)
|
||||
* [GPIO Controls](internals_gpio_control.md)
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
|
||||
|
@ -44,7 +44,11 @@ To connect your host computer to your keyboard with raw HID you need four pieces
|
||||
3. Usage Page
|
||||
4. Usage
|
||||
|
||||
The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`. **Usage Page** is **`0xFF60`** and **Usage** is **`0x0061`**.
|
||||
The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`.
|
||||
|
||||
The final two can be overridden in your keyboard's `config.h` in the keyboard's main directory by redefining the values: `#define RAW_USAGE_PAGE 0xFF60` and `#define RAW_USAGE_ID 0x61`.
|
||||
|
||||
By default, **Usage Page** is `0xFF60` and **Usage** is `0x61`.
|
||||
|
||||
### Building your host
|
||||
|
||||
|
47
docs/getting_started_docker.md
Normal file
47
docs/getting_started_docker.md
Normal file
@ -0,0 +1,47 @@
|
||||
# Docker Quick Start
|
||||
|
||||
This project includes a Docker workflow that will allow you to build a new firmware for your keyboard very easily without major changes to your primary operating system. This also ensures that when you clone the project and perform a build, you have the exact same environment as anyone else and the QMK build infrastructure. This makes it much easier for people to help you troubleshoot any issues you encounter.
|
||||
|
||||
## Requirements
|
||||
|
||||
The main prerequisite is a working `docker` install.
|
||||
* [Docker CE](https://docs.docker.com/install/#supported-platforms)
|
||||
|
||||
## Usage
|
||||
|
||||
Acquire a local copy of the QMK's repository (including submodules):
|
||||
|
||||
```bash
|
||||
git clone --recurse-submodules https://github.com/qmk/qmk_firmware.git
|
||||
cd qmk_firmware
|
||||
```
|
||||
|
||||
Run the following command to build a keymap:
|
||||
```bash
|
||||
util/docker_build.sh <keyboard>:<keymap>
|
||||
# For example: util/docker_build.sh planck/rev6:default
|
||||
```
|
||||
|
||||
This will compile the desired keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, all keymaps are used. Note that the parameter format is the same as when building with `make`.
|
||||
|
||||
There is also support for building _and_ flashing the keyboard straight from Docker by specifying the `target` as well:
|
||||
|
||||
```bash
|
||||
util/docker_build.sh keyboard:keymap:target
|
||||
# For example: util/docker_build.sh planck/rev6:default:flash
|
||||
```
|
||||
|
||||
You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
|
||||
|
||||
```bash
|
||||
util/docker_build.sh
|
||||
# Reads parameters as input (leave blank for all keyboards/keymaps)
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why can't I flash on Windows/macOS
|
||||
|
||||
On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use [QMK Toolbox](https://github.com/qmk/qmk_toolbox) instead.
|
||||
|
||||
!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
|
@ -1,18 +1,41 @@
|
||||
# Flashing Your Keyboard
|
||||
# Flashing Your Keyboard
|
||||
|
||||
Now that you've built a custom firmware file you'll want to flash your keyboard.
|
||||
Now that you've built a custom firmware file you'll want to flash your keyboard.
|
||||
|
||||
## Put Your Keyboard into DFU (Bootloader) Mode
|
||||
|
||||
In order to flash your custom firmware you must first put your keyboard into a special flashing mode. While it is in this mode you will not be able to type or otherwise use your keyboard. It is very important that you do not unplug the keyboard or otherwise interrupt the flashing process while the firmware is being written.
|
||||
|
||||
Different keyboards have different ways to enter this special mode. If your PCB currently runs QMK, TMK, or PS2AVRGB (Bootmapper Client) and you have not been given specific instructions, try the following, in order:
|
||||
|
||||
* Hold down both shift keys and press `Pause`
|
||||
* Hold down both shift keys and press `B`
|
||||
* Unplug your keyboard, hold down the Spacebar and `B` at the same time, plug in your keyboard and wait a second before releasing the keys
|
||||
* Unplug your keyboard, hold down the top or bottom left key (usually Escape or Left Control) and plug in your keyboard
|
||||
* Press the physical `RESET` button, usually located on the underside of the PCB
|
||||
* Locate header pins on the PCB labeled `RESET` and `GND`, and short them together while plugging your PCB in
|
||||
|
||||
If you've attempted all of the above to no avail, and the main chip on the board says `STM32` on it, this may be a bit more complicated. Generally your best bet is to ask on [Discord](https://discord.gg/Uq7gcHh) for assistance. It's likely some photos of the board will be asked for -- if you can get them ready beforehand it'll help move things along!
|
||||
|
||||
Otherwise, you should see a message in yellow, similar to this in QMK Toolbox:
|
||||
|
||||
```
|
||||
*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)
|
||||
```
|
||||
|
||||
and this bootloader device will also be present in Device Manager, System Information.app, or `lsusb`.
|
||||
|
||||
## Flashing Your Keyboard with QMK Toolbox
|
||||
|
||||
The simplest way to flash your keyboard will be with the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases).
|
||||
The simplest way to flash your keyboard will be with the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases).
|
||||
|
||||
However, the QMK Toolbox is only available for Windows and macOS currently. If you're using Linux (or just wish to flash the firmware from the command line), proceed down to [Flash Your Keyboard From The Command Line](#flash-your-keyboard-from-the-command-line).
|
||||
However, the Toolbox is currently only available for Windows and macOS. If you're using Linux (or just wish to flash the firmware from the command line), skip to the [Flash your Keyboard from the Command Line](#flash-your-keyboard-from-the-command-line) section.
|
||||
|
||||
### Load The File Into QMK Toolbox
|
||||
### Load the File into QMK Toolbox
|
||||
|
||||
Begin by opening the QMK Toolbox application. You'll want to locate the firmware file in Finder or Explorer. Your keyboard firmware may be in one of two formats- `.hex` or `.bin`. QMK tries to copy the appropriate one for your keyboard into the root `qmk_firmware` directory.
|
||||
|
||||
If you are on Windows or macOS there are commands you can use to easily open the current firmware folder in Explorer or Finder.
|
||||
If you are on Windows or macOS, there are commands you can use to easily open the current folder in Explorer or Finder.
|
||||
|
||||
#### Windows
|
||||
|
||||
@ -38,65 +61,44 @@ For example, the `planck/rev5` with a `default` keymap will have this filename:
|
||||
planck_rev5_default.hex
|
||||
```
|
||||
|
||||
Once you have located your firmware file drag it into the "Local file" box in QMK Toolbox, or click "Open" and navigate to where your firmware file is stored.
|
||||
|
||||
### Put Your Keyboard Into DFU (Bootloader) Mode
|
||||
|
||||
In order to flash your custom firmware you have to put your keyboard into a special flashing mode. While it is in this mode you will not be able to type or otherwise use your keyboard. It is very important that you do not unplug your keyboard or otherwise interrupt the flashing process while the firmware is being written.
|
||||
|
||||
Different keyboards have different ways to enter this special mode. If your PCB currently runs QMK or TMK and you have not been given specific instructions try the following, in order:
|
||||
|
||||
* Hold down both shift keys and press `Pause`
|
||||
* Hold down both shift keys and press `B`
|
||||
* Unplug your keyboard, hold down the Spacebar and `B` at the same time, plug in your keyboard and wait a second before releasing the keys
|
||||
* Press the physical `RESET` button on the bottom of the PCB
|
||||
* Locate header pins on the PCB labeled `BOOT0` or `RESET`, short those together while plugging your PCB in
|
||||
|
||||
When you are successful you will see a message similar to this in QMK Toolbox:
|
||||
|
||||
```
|
||||
*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
|
||||
*** DFU device connected
|
||||
```
|
||||
Once you have located your firmware file drag it into the "Local file" box in QMK Toolbox, or click "Open" and navigate to where your firmware file is stored.
|
||||
|
||||
### Flash Your Keyboard
|
||||
|
||||
Click the `Flash` button in QMK Toolbox. You will see output similar to the following:
|
||||
|
||||
```
|
||||
*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
|
||||
*** DFU device connected
|
||||
*** DFU device connected: Atmel Corp. ATmega32U4 (03EB:2FF4:0000)
|
||||
*** Attempting to flash, please don't remove device
|
||||
>>> dfu-programmer atmega32u4 erase --force
|
||||
>>> dfu-programmer.exe atmega32u4 erase --force
|
||||
Erasing flash... Success
|
||||
Checking memory from 0x0 to 0x6FFF... Empty.
|
||||
>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
|
||||
Checking memory from 0x0 to 0x55FF... Empty.
|
||||
0% 100% Programming 0x5600 bytes...
|
||||
>>> dfu-programmer.exe atmega32u4 flash "D:\Git\qmk_firmware\gh60_satan_default.hex"
|
||||
Checking memory from 0x0 to 0x3F7F... Empty.
|
||||
0% 100% Programming 0x3F80 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
0% 100% Reading 0x7000 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
Validating... Success
|
||||
0x5600 bytes written into 0x7000 bytes memory (76.79%).
|
||||
>>> dfu-programmer atmega32u4 reset
|
||||
0x3F80 bytes written into 0x7000 bytes memory (56.70%).
|
||||
>>> dfu-programmer.exe atmega32u4 reset
|
||||
|
||||
*** DFU device disconnected
|
||||
*** Clueboard - Clueboard 66% HotSwap connected -- 0xC1ED:0x2390
|
||||
*** DFU device disconnected: Atmel Corp: ATmega32U4 (03EB:2FF4:0000)
|
||||
```
|
||||
|
||||
## Flash your Keyboard from the Command Line
|
||||
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
|
||||
|
||||
qmk flash
|
||||
|
||||
If you have not configured your keyboard/keymap name, or you have multiple keyboards, you can specify the keyboard and keymap:
|
||||
If you have not configured your keyboard/keymap name in the CLI, or you have multiple keyboards, you can specify the keyboard and keymap:
|
||||
|
||||
qmk flash -kb <my_keyboard> -km <my_keymap>
|
||||
|
||||
This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
|
||||
This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
|
||||
|
||||
However, this does rely on the bootloader being set by the keyboard. If this information is not configured, or you're using a board that doesn't have a supported target to flash it, you will see this error:
|
||||
However, this does rely on the bootloader being set by the keyboard. If this information is not configured, or you're using a board that doesn't have a supported target to flash it, you will see this error:
|
||||
|
||||
WARNING: This board's bootloader is not specified or is not supported by the ":flash" target at this time.
|
||||
|
||||
|
@ -69,10 +69,21 @@ You will need to install Git and Python. It's very likely that you already have
|
||||
* Fedora / Red Hat / CentOS: `sudo yum install git python3 python3-pip`
|
||||
* Arch / Manjaro: `sudo pacman -S git python python-pip python-setuptools libffi`
|
||||
|
||||
|
||||
Install the global CLI to bootstrap your system:
|
||||
|
||||
`python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`)
|
||||
`python3 -m pip install --user qmk` (on Arch-based distros you can also try the `qmk` package from AUR (**note**: it's maintained by a community member): `yay -S qmk`)
|
||||
|
||||
### FreeBSD
|
||||
|
||||
You will need to install Git and Python. It's possible that you already have both, but if not, run the following commands to install them:
|
||||
|
||||
pkg install git python3
|
||||
|
||||
Make sure that `$HOME/.local/bin` is added to your `$PATH` so that locally install Python packages are available.
|
||||
|
||||
Once installed, you can install QMK CLI:
|
||||
|
||||
python3 -m pip install --user qmk
|
||||
|
||||
## 3. Run QMK Setup :id=set-up-qmk
|
||||
|
||||
@ -88,6 +99,12 @@ This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155)
|
||||
Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562).
|
||||
Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc`
|
||||
|
||||
?>**Note on FreeBSD**:
|
||||
It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your
|
||||
base system using `pkg`. However the installation will probably fail when run as an unprivileged user.
|
||||
To manually install the base dependencies, run `./util/qmk_install.sh` either as `root`, or with `sudo`.
|
||||
Once that completes, re-run `qmk setup` to complete the setup and checks.
|
||||
|
||||
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>/qmk_firmware` to clone your personal fork. If you don't know what that means you can safely ignore this message.
|
||||
|
||||
## 4. Test Your Build Environment
|
||||
|
59
docs/serial_driver.md
Normal file
59
docs/serial_driver.md
Normal file
@ -0,0 +1,59 @@
|
||||
# 'serial' Driver
|
||||
This driver powers the [Split Keyboard](feature_split_keyboard.md) feature.
|
||||
|
||||
!> Serial in this context should be read as **sending information one bit at a time**, rather than implementing UART/USART/RS485/RS232 standards.
|
||||
|
||||
All drivers in this category have the following characteristics:
|
||||
* Provides data and signaling over a single conductor
|
||||
* Limited to single master, single slave
|
||||
|
||||
## Supported Driver Types
|
||||
|
||||
| | AVR | ARM |
|
||||
|-------------------|--------------------|--------------------|
|
||||
| bit bang | :heavy_check_mark: | Soon™ |
|
||||
| USART Half-duplex | | :heavy_check_mark: |
|
||||
|
||||
## Driver configuration
|
||||
|
||||
### Bitbang
|
||||
Default driver, the absence of configuration assumes this driver. To configure it, add this to your rules.mk:
|
||||
|
||||
```make
|
||||
SERIAL_DRIVER = bitbang
|
||||
```
|
||||
|
||||
Configure the driver via your config.h:
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
|
||||
// 0: about 189kbps (Experimental only)
|
||||
// 1: about 137kbps (default)
|
||||
// 2: about 75kbps
|
||||
// 3: about 39kbps
|
||||
// 4: about 26kbps
|
||||
// 5: about 20kbps
|
||||
```
|
||||
|
||||
### USART Half-duplex
|
||||
Targeting STM32 boards where communication is offloaded to a USART hardware device. The advantage is that this provides fast and accurate timings. `SOFT_SERIAL_PIN` for this driver is the configured USART TX pin. **The TX pin must have appropriate pull-up resistors**. To configure it, add this to your rules.mk:
|
||||
|
||||
```make
|
||||
SERIAL_DRIVER = usart
|
||||
```
|
||||
|
||||
Configure the hardware via your config.h:
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN B6 // USART TX pin
|
||||
#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5
|
||||
// 0: about 460800 baud
|
||||
// 1: about 230400 baud (default)
|
||||
// 2: about 115200 baud
|
||||
// 3: about 57600 baud
|
||||
// 4: about 38400 baud
|
||||
// 5: about 19200 baud
|
||||
#define SERIAL_USART_DRIVER SD1 // USART driver of TX pin. default: SD1
|
||||
#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
|
||||
```
|
||||
|
||||
You must also turn on the SERIAL feature in your halconf.h and mcuconf.h
|
290
drivers/chibios/serial.c
Normal file
290
drivers/chibios/serial.c
Normal file
@ -0,0 +1,290 @@
|
||||
/*
|
||||
* WARNING: be careful changing this code, it is very timing dependent
|
||||
*/
|
||||
|
||||
#include "quantum.h"
|
||||
#include "serial.h"
|
||||
#include "wait.h"
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
// TODO: resolve/remove build warnings
|
||||
#if defined(RGBLIGHT_ENABLE) && defined(RGBLED_SPLIT) && defined(PROTOCOL_CHIBIOS) && defined(WS2812_DRIVER_BITBANG)
|
||||
# warning "RGBLED_SPLIT not supported with bitbang WS2812 driver"
|
||||
#endif
|
||||
|
||||
// default wait implementation cannot be called within interrupt
|
||||
// this method seems to be more accurate than GPT timers
|
||||
#if PORT_SUPPORTS_RT == FALSE
|
||||
# error "chSysPolledDelayX method not supported on this platform"
|
||||
#else
|
||||
# undef wait_us
|
||||
# define wait_us(x) chSysPolledDelayX(US2RTC(STM32_SYSCLK, x))
|
||||
#endif
|
||||
|
||||
#ifndef SELECT_SOFT_SERIAL_SPEED
|
||||
# define SELECT_SOFT_SERIAL_SPEED 1
|
||||
// TODO: correct speeds...
|
||||
// 0: about 189kbps (Experimental only)
|
||||
// 1: about 137kbps (default)
|
||||
// 2: about 75kbps
|
||||
// 3: about 39kbps
|
||||
// 4: about 26kbps
|
||||
// 5: about 20kbps
|
||||
#endif
|
||||
|
||||
// Serial pulse period in microseconds. At the moment, going lower than 12 causes communication failure
|
||||
#if SELECT_SOFT_SERIAL_SPEED == 0
|
||||
# define SERIAL_DELAY 12
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
||||
# define SERIAL_DELAY 16
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
||||
# define SERIAL_DELAY 24
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
||||
# define SERIAL_DELAY 32
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
||||
# define SERIAL_DELAY 48
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
||||
# define SERIAL_DELAY 64
|
||||
#else
|
||||
# error invalid SELECT_SOFT_SERIAL_SPEED value
|
||||
#endif
|
||||
|
||||
inline static void serial_delay(void) { wait_us(SERIAL_DELAY); }
|
||||
inline static void serial_delay_half(void) { wait_us(SERIAL_DELAY / 2); }
|
||||
inline static void serial_delay_blip(void) { wait_us(1); }
|
||||
inline static void serial_output(void) { setPinOutput(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_input(void) { setPinInputHigh(SOFT_SERIAL_PIN); }
|
||||
inline static bool serial_read_pin(void) { return !!readPin(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_low(void) { writePinLow(SOFT_SERIAL_PIN); }
|
||||
inline static void serial_high(void) { writePinHigh(SOFT_SERIAL_PIN); }
|
||||
|
||||
void interrupt_handler(void *arg);
|
||||
|
||||
// Use thread + palWaitLineTimeout instead of palSetLineCallback
|
||||
// - Methods like setPinOutput and palEnableLineEvent/palDisableLineEvent
|
||||
// cause the interrupt to lock up, which would limit to only receiving data...
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("blinker");
|
||||
while (true) {
|
||||
palWaitLineTimeout(SOFT_SERIAL_PIN, TIME_INFINITE);
|
||||
interrupt_handler(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static SSTD_t *Transaction_table = NULL;
|
||||
static uint8_t Transaction_table_size = 0;
|
||||
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
serial_output();
|
||||
serial_high();
|
||||
}
|
||||
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
serial_input();
|
||||
|
||||
palEnablePadEvent(PAL_PORT(SOFT_SERIAL_PIN), PAL_PAD(SOFT_SERIAL_PIN), PAL_EVENT_MODE_FALLING_EDGE);
|
||||
chThdCreateStatic(waThread1, sizeof(waThread1), HIGHPRIO, Thread1, NULL);
|
||||
}
|
||||
|
||||
// Used by the master to synchronize timing with the slave.
|
||||
static void __attribute__((noinline)) sync_recv(void) {
|
||||
serial_input();
|
||||
// This shouldn't hang if the slave disconnects because the
|
||||
// serial line will float to high if the slave does disconnect.
|
||||
while (!serial_read_pin()) {
|
||||
}
|
||||
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
// Used by the slave to send a synchronization signal to the master.
|
||||
static void __attribute__((noinline)) sync_send(void) {
|
||||
serial_output();
|
||||
|
||||
serial_low();
|
||||
serial_delay();
|
||||
|
||||
serial_high();
|
||||
}
|
||||
|
||||
// Reads a byte from the serial line
|
||||
static uint8_t __attribute__((noinline)) serial_read_byte(void) {
|
||||
uint8_t byte = 0;
|
||||
serial_input();
|
||||
for (uint8_t i = 0; i < 8; ++i) {
|
||||
byte = (byte << 1) | serial_read_pin();
|
||||
serial_delay();
|
||||
}
|
||||
|
||||
return byte;
|
||||
}
|
||||
|
||||
// Sends a byte with MSB ordering
|
||||
static void __attribute__((noinline)) serial_write_byte(uint8_t data) {
|
||||
uint8_t b = 8;
|
||||
serial_output();
|
||||
while (b--) {
|
||||
if (data & (1 << b)) {
|
||||
serial_high();
|
||||
} else {
|
||||
serial_low();
|
||||
}
|
||||
serial_delay();
|
||||
}
|
||||
}
|
||||
|
||||
// interrupt handle to be used by the slave device
|
||||
void interrupt_handler(void *arg) {
|
||||
chSysLockFromISR();
|
||||
|
||||
sync_send();
|
||||
|
||||
// read mid pulses
|
||||
serial_delay_blip();
|
||||
|
||||
uint8_t checksum_computed = 0;
|
||||
int sstd_index = 0;
|
||||
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
sstd_index = serial_read_byte();
|
||||
sync_send();
|
||||
#endif
|
||||
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
for (int i = 0; i < trans->initiator2target_buffer_size; ++i) {
|
||||
trans->initiator2target_buffer[i] = serial_read_byte();
|
||||
sync_send();
|
||||
checksum_computed += trans->initiator2target_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
uint8_t checksum = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
serial_write_byte(trans->target2initiator_buffer[i]);
|
||||
sync_send();
|
||||
serial_delay_half();
|
||||
checksum += trans->target2initiator_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_send();
|
||||
|
||||
// wait for the sync to finish sending
|
||||
serial_delay();
|
||||
|
||||
*trans->status = (checksum_computed == checksum_received) ? TRANSACTION_ACCEPTED : TRANSACTION_DATA_ERROR;
|
||||
|
||||
// end transaction
|
||||
serial_input();
|
||||
|
||||
// TODO: remove extra delay between transactions
|
||||
serial_delay();
|
||||
|
||||
chSysUnlockFromISR();
|
||||
}
|
||||
|
||||
/////////
|
||||
// start transaction by initiator
|
||||
//
|
||||
// int soft_serial_transaction(int sstd_index)
|
||||
//
|
||||
// Returns:
|
||||
// TRANSACTION_END
|
||||
// TRANSACTION_NO_RESPONSE
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void) {
|
||||
int sstd_index = 0;
|
||||
#else
|
||||
int soft_serial_transaction(int sstd_index) {
|
||||
#endif
|
||||
|
||||
if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t *trans = &Transaction_table[sstd_index];
|
||||
|
||||
// TODO: remove extra delay between transactions
|
||||
serial_delay();
|
||||
|
||||
// this code is very time dependent, so we need to disable interrupts
|
||||
chSysLock();
|
||||
|
||||
// signal to the slave that we want to start a transaction
|
||||
serial_output();
|
||||
serial_low();
|
||||
serial_delay_blip();
|
||||
|
||||
// wait for the slaves response
|
||||
serial_input();
|
||||
serial_high();
|
||||
serial_delay();
|
||||
|
||||
// check if the slave is present
|
||||
if (serial_read_pin()) {
|
||||
// slave failed to pull the line low, assume not present
|
||||
dprintf("serial::NO_RESPONSE\n");
|
||||
chSysUnlock();
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
|
||||
// if the slave is present syncronize with it
|
||||
|
||||
uint8_t checksum = 0;
|
||||
// send data to the slave
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
serial_write_byte(sstd_index); // first chunk is transaction id
|
||||
sync_recv();
|
||||
#endif
|
||||
for (int i = 0; i < trans->initiator2target_buffer_size; ++i) {
|
||||
serial_write_byte(trans->initiator2target_buffer[i]);
|
||||
sync_recv();
|
||||
checksum += trans->initiator2target_buffer[i];
|
||||
}
|
||||
serial_write_byte(checksum ^ 7);
|
||||
sync_recv();
|
||||
|
||||
serial_delay();
|
||||
serial_delay(); // read mid pulses
|
||||
|
||||
// receive data from the slave
|
||||
uint8_t checksum_computed = 0;
|
||||
for (int i = 0; i < trans->target2initiator_buffer_size; ++i) {
|
||||
trans->target2initiator_buffer[i] = serial_read_byte();
|
||||
sync_recv();
|
||||
checksum_computed += trans->target2initiator_buffer[i];
|
||||
}
|
||||
checksum_computed ^= 7;
|
||||
uint8_t checksum_received = serial_read_byte();
|
||||
|
||||
sync_recv();
|
||||
serial_delay();
|
||||
|
||||
if ((checksum_computed) != (checksum_received)) {
|
||||
dprintf("serial::FAIL[%u,%u,%u]\n", checksum_computed, checksum_received, sstd_index);
|
||||
serial_output();
|
||||
serial_high();
|
||||
|
||||
chSysUnlock();
|
||||
return TRANSACTION_DATA_ERROR;
|
||||
}
|
||||
|
||||
// always, release the line when not in use
|
||||
serial_high();
|
||||
serial_output();
|
||||
|
||||
chSysUnlock();
|
||||
return TRANSACTION_END;
|
||||
}
|
62
drivers/chibios/serial.h
Normal file
62
drivers/chibios/serial.h
Normal file
@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// Need Soft Serial defines in config.h
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
// ex.
|
||||
// #define SOFT_SERIAL_PIN ?? // ?? = D0,D1,D2,D3,E6
|
||||
// OPTIONAL: #define SELECT_SOFT_SERIAL_SPEED ? // ? = 1,2,3,4,5
|
||||
// // 1: about 137kbps (default)
|
||||
// // 2: about 75kbps
|
||||
// // 3: about 39kbps
|
||||
// // 4: about 26kbps
|
||||
// // 5: about 20kbps
|
||||
//
|
||||
// //// USE simple API (using signle-type transaction function)
|
||||
// /* nothing */
|
||||
// //// USE flexible API (using multi-type transaction function)
|
||||
// #define SERIAL_USE_MULTI_TRANSACTION
|
||||
//
|
||||
// /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Soft Serial Transaction Descriptor
|
||||
typedef struct _SSTD_t {
|
||||
uint8_t *status;
|
||||
uint8_t initiator2target_buffer_size;
|
||||
uint8_t *initiator2target_buffer;
|
||||
uint8_t target2initiator_buffer_size;
|
||||
uint8_t *target2initiator_buffer;
|
||||
} SSTD_t;
|
||||
#define TID_LIMIT(table) (sizeof(table) / sizeof(SSTD_t))
|
||||
|
||||
// initiator is transaction start side
|
||||
void soft_serial_initiator_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
// target is interrupt accept side
|
||||
void soft_serial_target_init(SSTD_t *sstd_table, int sstd_table_size);
|
||||
|
||||
// initiator result
|
||||
#define TRANSACTION_END 0
|
||||
#define TRANSACTION_NO_RESPONSE 0x1
|
||||
#define TRANSACTION_DATA_ERROR 0x2
|
||||
#define TRANSACTION_TYPE_ERROR 0x4
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void);
|
||||
#else
|
||||
int soft_serial_transaction(int sstd_index);
|
||||
#endif
|
||||
|
||||
// target status
|
||||
// *SSTD_t.status has
|
||||
// initiator:
|
||||
// TRANSACTION_END
|
||||
// or TRANSACTION_NO_RESPONSE
|
||||
// or TRANSACTION_DATA_ERROR
|
||||
// target:
|
||||
// TRANSACTION_DATA_ERROR
|
||||
// or TRANSACTION_ACCEPTED
|
||||
#define TRANSACTION_ACCEPTED 0x8
|
||||
#ifdef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_get_and_clean_status(int sstd_index);
|
||||
#endif
|
234
drivers/chibios/serial_usart.c
Normal file
234
drivers/chibios/serial_usart.c
Normal file
@ -0,0 +1,234 @@
|
||||
#include "quantum.h"
|
||||
#include "serial.h"
|
||||
#include "printf.h"
|
||||
|
||||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
#ifndef USART_CR1_M0
|
||||
# define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so
|
||||
#endif
|
||||
|
||||
#ifndef USE_GPIOV1
|
||||
// The default PAL alternate modes are used to signal that the pins are used for USART
|
||||
# ifndef SERIAL_USART_TX_PAL_MODE
|
||||
# define SERIAL_USART_TX_PAL_MODE 7
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_DRIVER
|
||||
# define SERIAL_USART_DRIVER SD1
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR1
|
||||
# define SERIAL_USART_CR1 (USART_CR1_PCE | USART_CR1_PS | USART_CR1_M0) // parity enable, odd parity, 9 bit length
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR2
|
||||
# define SERIAL_USART_CR2 (USART_CR2_STOP_1) // 2 stop bits
|
||||
#endif
|
||||
|
||||
#ifndef SERIAL_USART_CR3
|
||||
# define SERIAL_USART_CR3 0
|
||||
#endif
|
||||
|
||||
#ifdef SOFT_SERIAL_PIN
|
||||
# define SERIAL_USART_TX_PIN SOFT_SERIAL_PIN
|
||||
#endif
|
||||
|
||||
#ifndef SELECT_SOFT_SERIAL_SPEED
|
||||
# define SELECT_SOFT_SERIAL_SPEED 1
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_USART_SPEED
|
||||
// Allow advanced users to directly set SERIAL_USART_SPEED
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 0
|
||||
# define SERIAL_USART_SPEED 460800
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 1
|
||||
# define SERIAL_USART_SPEED 230400
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 2
|
||||
# define SERIAL_USART_SPEED 115200
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 3
|
||||
# define SERIAL_USART_SPEED 57600
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 4
|
||||
# define SERIAL_USART_SPEED 38400
|
||||
#elif SELECT_SOFT_SERIAL_SPEED == 5
|
||||
# define SERIAL_USART_SPEED 19200
|
||||
#else
|
||||
# error invalid SELECT_SOFT_SERIAL_SPEED value
|
||||
#endif
|
||||
|
||||
#define TIMEOUT 100
|
||||
#define HANDSHAKE_MAGIC 7
|
||||
|
||||
static inline msg_t sdWriteHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size) {
|
||||
msg_t ret = sdWrite(driver, data, size);
|
||||
|
||||
// Half duplex requires us to read back the data we just wrote - just throw it away
|
||||
uint8_t dump[size];
|
||||
sdRead(driver, dump, size);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#undef sdWrite
|
||||
#define sdWrite sdWriteHalfDuplex
|
||||
|
||||
static inline msg_t sdWriteTimeoutHalfDuplex(SerialDriver* driver, uint8_t* data, uint8_t size, uint32_t timeout) {
|
||||
msg_t ret = sdWriteTimeout(driver, data, size, timeout);
|
||||
|
||||
// Half duplex requires us to read back the data we just wrote - just throw it away
|
||||
uint8_t dump[size];
|
||||
sdReadTimeout(driver, dump, size, timeout);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#undef sdWriteTimeout
|
||||
#define sdWriteTimeout sdWriteTimeoutHalfDuplex
|
||||
|
||||
static inline void sdClear(SerialDriver* driver) {
|
||||
while (sdGetTimeout(driver, TIME_IMMEDIATE) != MSG_TIMEOUT) {
|
||||
// Do nothing with the data
|
||||
}
|
||||
}
|
||||
|
||||
static SerialConfig sdcfg = {
|
||||
(SERIAL_USART_SPEED), // speed - mandatory
|
||||
(SERIAL_USART_CR1), // CR1
|
||||
(SERIAL_USART_CR2), // CR2
|
||||
(SERIAL_USART_CR3) // CR3
|
||||
};
|
||||
|
||||
void handle_soft_serial_slave(void);
|
||||
|
||||
/*
|
||||
* This thread runs on the slave and responds to transactions initiated
|
||||
* by the master
|
||||
*/
|
||||
static THD_WORKING_AREA(waSlaveThread, 2048);
|
||||
static THD_FUNCTION(SlaveThread, arg) {
|
||||
(void)arg;
|
||||
chRegSetThreadName("slave_transport");
|
||||
|
||||
while (true) {
|
||||
handle_soft_serial_slave();
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((weak)) void usart_init(void) {
|
||||
#if defined(USE_GPIOV1)
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_STM32_ALTERNATE_OPENDRAIN);
|
||||
#else
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE(SERIAL_USART_TX_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN);
|
||||
#endif
|
||||
}
|
||||
|
||||
void usart_master_init(void) {
|
||||
usart_init();
|
||||
|
||||
sdcfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(&SERIAL_USART_DRIVER, &sdcfg);
|
||||
}
|
||||
|
||||
void usart_slave_init(void) {
|
||||
usart_init();
|
||||
|
||||
sdcfg.cr3 |= USART_CR3_HDSEL;
|
||||
sdStart(&SERIAL_USART_DRIVER, &sdcfg);
|
||||
|
||||
// Start transport thread
|
||||
chThdCreateStatic(waSlaveThread, sizeof(waSlaveThread), HIGHPRIO, SlaveThread, NULL);
|
||||
}
|
||||
|
||||
static SSTD_t* Transaction_table = NULL;
|
||||
static uint8_t Transaction_table_size = 0;
|
||||
|
||||
void soft_serial_initiator_init(SSTD_t* sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
usart_master_init();
|
||||
}
|
||||
|
||||
void soft_serial_target_init(SSTD_t* sstd_table, int sstd_table_size) {
|
||||
Transaction_table = sstd_table;
|
||||
Transaction_table_size = (uint8_t)sstd_table_size;
|
||||
|
||||
usart_slave_init();
|
||||
}
|
||||
|
||||
void handle_soft_serial_slave(void) {
|
||||
uint8_t sstd_index = sdGet(&SERIAL_USART_DRIVER); // first chunk is always transaction id
|
||||
SSTD_t* trans = &Transaction_table[sstd_index];
|
||||
|
||||
// Always write back the sstd_index as part of a basic handshake
|
||||
sstd_index ^= HANDSHAKE_MAGIC;
|
||||
sdWrite(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index));
|
||||
|
||||
if (trans->initiator2target_buffer_size) {
|
||||
sdRead(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
sdWrite(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size);
|
||||
}
|
||||
|
||||
if (trans->status) {
|
||||
*trans->status = TRANSACTION_ACCEPTED;
|
||||
}
|
||||
}
|
||||
|
||||
/////////
|
||||
// start transaction by initiator
|
||||
//
|
||||
// int soft_serial_transaction(int sstd_index)
|
||||
//
|
||||
// Returns:
|
||||
// TRANSACTION_END
|
||||
// TRANSACTION_NO_RESPONSE
|
||||
// TRANSACTION_DATA_ERROR
|
||||
#ifndef SERIAL_USE_MULTI_TRANSACTION
|
||||
int soft_serial_transaction(void) {
|
||||
uint8_t sstd_index = 0;
|
||||
#else
|
||||
int soft_serial_transaction(int index) {
|
||||
uint8_t sstd_index = index;
|
||||
#endif
|
||||
|
||||
if (sstd_index > Transaction_table_size) return TRANSACTION_TYPE_ERROR;
|
||||
SSTD_t* trans = &Transaction_table[sstd_index];
|
||||
msg_t res = 0;
|
||||
|
||||
sdClear(&SERIAL_USART_DRIVER);
|
||||
|
||||
// First chunk is always transaction id
|
||||
sdWriteTimeout(&SERIAL_USART_DRIVER, &sstd_index, sizeof(sstd_index), TIME_MS2I(TIMEOUT));
|
||||
|
||||
uint8_t sstd_index_shake = 0xFF;
|
||||
|
||||
// Which we always read back first so that we can error out correctly
|
||||
// - due to the half duplex limitations on return codes, we always have to read *something*
|
||||
// - without the read, write only transactions *always* succeed, even during the boot process where the slave is not ready
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, &sstd_index_shake, sizeof(sstd_index_shake), TIME_MS2I(TIMEOUT));
|
||||
if (res < 0 || (sstd_index_shake != (sstd_index ^ HANDSHAKE_MAGIC))) {
|
||||
dprintf("serial::usart_shake NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
|
||||
if (trans->initiator2target_buffer_size) {
|
||||
res = sdWriteTimeout(&SERIAL_USART_DRIVER, trans->initiator2target_buffer, trans->initiator2target_buffer_size, TIME_MS2I(TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_transmit NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (trans->target2initiator_buffer_size) {
|
||||
res = sdReadTimeout(&SERIAL_USART_DRIVER, trans->target2initiator_buffer, trans->target2initiator_buffer_size, TIME_MS2I(TIMEOUT));
|
||||
if (res < 0) {
|
||||
dprintf("serial::usart_receive NO_RESPONSE\n");
|
||||
return TRANSACTION_NO_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRANSACTION_END;
|
||||
}
|
@ -16,7 +16,8 @@
|
||||
|
||||
|
||||
/*
|
||||
* see jj40/stevexyz for more information
|
||||
* The 25% SuperMicro keyboard: a pure - full features - "Alpha 26" keymap on Gherkin, compatible also with 28 and 30 keys layouts
|
||||
* See https://github.com/stevexyz/qmk_firmware/blob/master/keyboards/40percentclub/gherkin/keymaps/stevexyz/readme.md for more information
|
||||
*/
|
||||
|
||||
|
||||
@ -56,7 +57,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | | | | | | | | | | |
|
||||
* | Q | W | E | R | T | Y | U | I | O | P |
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* | ____ | ____ | ____ | ____ | ____ | FnNav|NumSym| Alt | Ctrl | Shift|
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | | | | | | | | | |
|
||||
* | A | S | D | F | G | H | J | K | L | Enter|
|
||||
@ -68,83 +69,73 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_HOME] = LAYOUT_ortho_3x10(
|
||||
LT(LAYER_ARROWPAD, KC_Q), LT(LAYER_NUMPAD, KC_W), LT(LAYER_MEDIAPAD, KC_E), KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P,
|
||||
MT(MOD_LSFT, KC_A), LT(LAYER_FUNC, KC_S), LT(LAYER_NUMSYM, KC_D), MT(MOD_RALT, KC_F), MT(MOD_LGUI, KC_G), MT(MOD_RGUI, KC_H), MT(MOD_RALT, KC_J), LT(LAYER_FUNC, KC_K), LT(LAYER_NUMSYM, KC_L), MT(MOD_RSFT, KC_ENT),
|
||||
XXXXXXX, MT(MOD_LCTL, KC_Z), MT(MOD_LALT, KC_X), LT(LAYER_FUNC, KC_C), LT(LAYER_NUMSYM, KC_V), MT(MOD_LSFT, KC_B), MT(MOD_LALT, KC_N), MT(MOD_RCTL, KC_M), MT(MOD_RSFT, KC_SPC), XXXXXXX ),
|
||||
LT(LAYER_ARROWPAD, KC_Q), LT(LAYER_NUMPAD, KC_W), LT(LAYER_MEDIAPAD, KC_E), KC_R, KC_T, LT(LAYER_FUNC, KC_Y), LT(LAYER_NUMSYM, KC_U), MT(MOD_LALT, KC_I), MT(MOD_RCTL, KC_O), MT(MOD_RSFT, KC_P),
|
||||
MT(MOD_LSFT, KC_A), LT(LAYER_FUNC, KC_S), LT(LAYER_NUMSYM, KC_D), MT(MOD_RALT, KC_F), MT(MOD_LGUI, KC_G), MT(MOD_RGUI, KC_H), MT(MOD_RALT, KC_J), LT(LAYER_FUNC, KC_K), LT(LAYER_NUMSYM, KC_L), MT(MOD_RSFT, KC_ENT),
|
||||
KC_DOWN, MT(MOD_LCTL, KC_Z), MT(MOD_LALT, KC_X), LT(LAYER_FUNC, KC_C), LT(LAYER_NUMSYM, KC_V), MT(MOD_LSFT, KC_B), MT(MOD_LALT, KC_N), MT(MOD_RCTL, KC_M), MT(MOD_RSFT, KC_SPC), KC_BSPC
|
||||
),
|
||||
|
||||
/* Function and Navigation Layer
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | | | | | | | | | | |
|
||||
* | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 |
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ |SysLay| Alt | Ctrl | Shift|
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | | | | | | | | | |
|
||||
* | ESC | Home | PgDn | PgUp | End | Left | Down | Up | Right| Baksp|
|
||||
* | ESC | Home | PgDn | PgUp | End | Left | Down | Up | Right|Backsp|
|
||||
* | Shift| ____ |SysLay| AltGr| OSkey| OSkey| AltGr| ____ |SysLay| Shift|
|
||||
* '------+------+------+------+------+------|------+------+------+------'
|
||||
* | | | | | | | | |
|
||||
* | ____ | ____ | | ____ | ____ | ____ | ____ | ____ |
|
||||
* | F11 | F12 | | Space|PrnScr|ScrLck|Pause |Backsp|
|
||||
* | Ctrl | Alt | ____ |SysLay| Shift| Alt | Ctrl | Shift|
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_FUNC] = LAYOUT_ortho_3x10(
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10,
|
||||
MT(MOD_LSFT, KC_ESC), KC_HOME, LT(LAYER_SYST, KC_PGDN), MT(MOD_RALT, KC_PGUP), MT(MOD_LGUI, KC_END), MT(MOD_RGUI, KC_LEFT), MT(MOD_RALT, KC_DOWN), KC_UP, LT(LAYER_SYST, KC_RGHT), MT(MOD_RSFT, KC_BSPC),
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, MO(LAYER_SYST), KC_LSFT, KC_LALT, KC_RCTL, MT(MOD_RSFT, KC_SPC), XXXXXXX ),
|
||||
KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, LT(LAYER_SYST, KC_F7), MT(MOD_LALT, KC_F8), MT(MOD_RCTL,KC_F9), MT(MOD_RSFT, KC_F10),
|
||||
MT(MOD_LSFT, KC_ESC), KC_HOME, LT(LAYER_SYST, KC_PGDN), MT(MOD_RALT, KC_PGUP), MT(MOD_LGUI, KC_END), MT(MOD_RGUI, KC_LEFT), MT(MOD_RALT, KC_DOWN), KC_UP, LT(LAYER_SYST, KC_RGHT), MT(MOD_RSFT, KC_BSPC),
|
||||
KC_DOWN, MT(KC_LCTL, KC_F11), MT(KC_LALT, KC_F12), KC_NO, LT(LAYER_SYST, KC_SPACE), MT(KC_LSFT, KC_PSCR), MT(KC_LALT, KC_SLCK), MT(KC_RCTL, KC_PAUS), MT(MOD_RSFT, KC_BSPC), KC_UP
|
||||
),
|
||||
|
||||
/* Number and Symbols Layer
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | ! | @ | # | $ | % | ^ | & | * | ( | ) |
|
||||
* | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 |
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* | ____ | ____ | ____ | ____ | ____ |SysLay| ____ | Alt | Ctrl | Shift|
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | ~ | _ | + | { | } | | | : | " | |
|
||||
* | TAB | ` | - | = | [ | ] | \ | ; | ' | Del |
|
||||
* | Shift|SysLay| ____ | AltGr| OSkey| OSkey| AltGr|SysLay| ____ | Shift|
|
||||
* ' -----+------+------+------+------+------|------+------+------+------'
|
||||
* | | | | | < | > | ? | |
|
||||
* | ____ | ____ | ____ | | , | . | / | ____ |
|
||||
* |BackSp| Del | Enter| | , | . | / | Enter|
|
||||
* | Ctrl | Alt |SysLay| ____ | Shift| Alt | Ctrl | Shift|
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_NUMSYM] = LAYOUT_ortho_3x10(
|
||||
KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0,
|
||||
MT(MOD_LSFT, KC_TAB), LT(LAYER_SYST, KC_GRV), KC_MINS, MT(MOD_RALT, KC_EQL), MT(MOD_LGUI, KC_LBRC), MT(MOD_RGUI, KC_RBRC), MT(MOD_RALT, KC_BSLS), LT(LAYER_SYST, KC_SCLN), KC_QUOT, MT(MOD_RSFT, KC_DEL),
|
||||
XXXXXXX, KC_LCTL, KC_LALT, MO(LAYER_SYST), KC_NO, MT(MOD_LSFT, KC_COMM), MT(MOD_LALT, KC_DOT), MT(MOD_RCTL, KC_SLSH), MT(MOD_RSFT, KC_SPC), XXXXXXX ),
|
||||
KC_1, KC_2, KC_3, KC_4, KC_5, LT(LAYER_SYST, KC_6), KC_7, MT(MOD_LALT, KC_8), MT(MOD_RCTL,KC_9), MT(MOD_RSFT, KC_0),
|
||||
MT(MOD_LSFT, KC_TAB), LT(LAYER_SYST, KC_GRV), KC_MINS, MT(MOD_RALT, KC_EQL), MT(MOD_LGUI, KC_LBRC), MT(MOD_RGUI, KC_RBRC), MT(MOD_RALT, KC_BSLS), LT(LAYER_SYST, KC_SCLN), KC_QUOT, MT(MOD_RSFT, KC_DEL),
|
||||
KC_LEFT, MT(KC_LCTL, KC_BSPC), MT(KC_LALT, KC_DEL), LT(LAYER_SYST, KC_ENT), KC_NO, MT(MOD_LSFT, KC_COMM), MT(MOD_LALT, KC_DOT), MT(MOD_RCTL, KC_SLSH), MT(MOD_RSFT, KC_ENT), KC_RGHT
|
||||
),
|
||||
|
||||
/* System Layer
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | | | | | | | | | | |
|
||||
* | F11 | F12 | Play | Next |MsWhlU|MsBtn1|OSMenu|SysReq|MsBtn2|Backsp|
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* | Play | Stop | Prev | Next |MsBtn1|MsLeft|MSDown| MsUp |MsRigh|MsBtn2|
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | Shift|
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | | | | | | | | | |
|
||||
* | Caps | Mute | Vol- | Vol+ |MsWhlD|MsLeft|MSDown| MsUp |MsRigh| Ins |
|
||||
* | Shift| ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | Shift|
|
||||
* |Backsp| Mute | Vol- | Vol+ |MsWhlD| Left | Down | Up | Right|Backsp|
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* '------+------+------+------+------+------|------+------+------+------'
|
||||
* | | | | | | | | |
|
||||
* | ____ | ____ | | |PrnScr|ScrLck|Pause | ____ |
|
||||
* | Ctrl | Alt | ____ | ____ | ____ | ____ | ____ | Shift|
|
||||
* '-------------------------------------------------------'
|
||||
* simplified view (for media and mouse there are dedicated layers)
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | | | | | | | | | | |
|
||||
* | F11 | F12 | | | | |OSMenu|SysReq| |Backsp|
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | | | | | | | | | |
|
||||
* | Caps | | | | | | | | | Ins |
|
||||
* | Shift| ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | Shift|
|
||||
* '------+------+------+------+------+------|------+------+------+------+
|
||||
* | | | | | | | | |
|
||||
* | | | | |PrnScr|ScrLck|Pause | |
|
||||
* | Ctrl | Alt | ____ | ____ | ____ | ____ | ____ | Shift|
|
||||
* | ____ | ____ | Enter| Space| Mute | Vol- | Vol+ | Space|
|
||||
* | Ctrl | Alt | ____ | ____ | Shift| Alt | Ctrl | ____ |
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_SYST] = LAYOUT_ortho_3x10(
|
||||
KC_F11, KC_F12, KC_MPLY, KC_MNXT, KC_MS_WH_UP, KC_MS_BTN1, KC_APP, KC_SYSREQ, KC_MS_BTN2, KC_BSPC,
|
||||
MT(MOD_LSFT, KC_CAPS), KC_MUTE, KC_VOLD, KC_VOLU, KC_MS_WH_DOWN, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, MT(MOD_RSFT, KC_INS),
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, KC_NO, KC_PSCR, KC_SLCK, KC_PAUS, MT(MOD_RSFT, KC_SPC), XXXXXXX ),
|
||||
KC_MPLY, KC_STOP, KC_MPRV, KC_MNXT, KC_MS_BTN1, KC_MS_LEFT, KC_MS_DOWN, KC_MS_UP, KC_MS_RIGHT, MT(MOD_RSFT, KC_MS_BTN2),
|
||||
KC_BSPC, KC_DEL, KC_PGDN, KC_PGUP, KC_APP, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_BSPC,
|
||||
KC_PGDN, MT(KC_LCTL, KC_CAPS), MT(KC_LALT, KC_INS), KC_ENT, KC_SPC, MT(MOD_RSFT, KC_MUTE), MT(MOD_LALT, KC_VOLD), MT(MOD_RCTL, KC_VOLU), KC_SPC, KC_PGUP
|
||||
),
|
||||
|
||||
/* ArrowPad (mod su Q) /------mouse-------\ /-----cursor-------\
|
||||
* ,---------------------------------------------------------------------.
|
||||
@ -157,23 +148,24 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* | Shift| ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* '------+------+------+------+------+------|------+------+------+------'
|
||||
* | | | | | | | | |
|
||||
* | | |MsWhlU|MsDown|MsWhlD| End | Down | PdDn |
|
||||
* | | |MsWhlU|MsDown|MsWhlD| End | PgDn | PgDn |
|
||||
* | Ctrl | Alt | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_ARROWPAD] = LAYOUT_ortho_3x10(
|
||||
KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_HOME, KC_UP, KC_PGUP, KC_BSPC,
|
||||
KC_LSFT, KC_NO, KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_ENT,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_MS_WH_UP, KC_MS_DOWN, KC_MS_WH_DOWN, KC_END, KC_DOWN, KC_PGDN, XXXXXXX ),
|
||||
KC_NO, KC_NO, KC_NO, KC_MS_BTN1, KC_MS_UP, KC_MS_BTN2, KC_HOME, KC_UP, KC_PGUP, KC_BSPC,
|
||||
KC_LSFT, KC_NO, KC_NO, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT, KC_LEFT, KC_DOWN, KC_RIGHT, KC_ENT,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_MS_WH_UP, KC_MS_DOWN, KC_MS_WH_DOWN, KC_END, KC_PGDN, KC_PGDN, XXXXXXX
|
||||
),
|
||||
|
||||
/* NumPad (mod su W)
|
||||
* ,---------------------------------------------------------------------.
|
||||
* | | | | | | | | | | |
|
||||
* | | | / | * | - |Backsp| 7 | 8 | 9 | 0 |
|
||||
* | | | 3 | * | - |Backsp| 7 | 8 | 9 | 0 |
|
||||
* | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* |------+------+------+------+-------------+------+------+------+------|
|
||||
* | | | | | | | | | | |
|
||||
* | | | | = | + | . | 4 | 5 | 6 | Enter|
|
||||
* | | | / | = | + | . | 4 | 5 | 6 | Enter|
|
||||
* | Shift| ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ | ____ |
|
||||
* '------+------+------+------+------+------|------+------+------+------'
|
||||
* | | | | | | | | |
|
||||
@ -182,9 +174,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_NUMPAD] = LAYOUT_ortho_3x10(
|
||||
KC_NO, KC_NO, KC_KP_SLASH, KC_KP_ASTERISK, KC_KP_MINUS, KC_BSPC, KC_7, KC_8, KC_9, KC_0,
|
||||
KC_LSFT, KC_NO, KC_NO, KC_KP_EQUAL, KC_KP_PLUS, KC_DOT, KC_4, KC_5, KC_6, KC_ENT,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, KC_TAB, KC_COMM, KC_1, KC_2, KC_3, XXXXXXX ),
|
||||
KC_NO, KC_NO, KC_3, KC_KP_ASTERISK, KC_KP_MINUS, KC_BSPC, KC_7, KC_8, KC_9, KC_0,
|
||||
KC_LSFT, KC_NO, KC_KP_SLASH, KC_KP_EQUAL, KC_KP_PLUS, KC_DOT, KC_4, KC_5, KC_6, KC_ENT,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, KC_TAB, KC_COMM, KC_1, KC_2, KC_3, XXXXXXX
|
||||
),
|
||||
|
||||
/* MediaPad (mod su E)
|
||||
* ,---------------------------------------------------------------------.
|
||||
@ -202,9 +195,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
* '-------------------------------------------------------'
|
||||
*/
|
||||
[LAYER_MEDIAPAD] = LAYOUT_ortho_3x10(
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU, KC_NO, KC_NO,
|
||||
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_NO, XXXXXXX ),
|
||||
KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_VOLU, KC_NO, KC_NO,
|
||||
KC_LSFT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MPRV, KC_MPLY, KC_MNXT, KC_NO,
|
||||
XXXXXXX, KC_LCTL, KC_LALT, KC_NO, KC_NO, KC_NO, KC_MUTE, KC_VOLD, KC_NO, XXXXXXX
|
||||
),
|
||||
|
||||
};
|
||||
|
||||
@ -225,15 +219,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
case CK_TRIPLEZERO:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("000");
|
||||
} // else { when released... }
|
||||
} // else { when released }
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
void keyboard_pre_init_user(void) {
|
||||
// Call the keyboard pre init code.
|
||||
|
||||
// Set our LED pins as output
|
||||
setPinOutput(D5);
|
||||
setPinOutput(B0);
|
||||
|
@ -1,11 +1,15 @@
|
||||
# gherkin super micro edition
|
||||
# The 25% SuperMicro keyboard
|
||||
## A full featured keymap on Gherkin compatible with a pure "Alpha 26" layout
|
||||
|
||||
With this configuration the "28" layout first experimented on the plank-like jj40 is being ported to a more proper board, leaving just two keys not used.
|
||||
With this configuration the "SuperMicro" layout first experimented on the plank-like jj40 is being ported to a more proper board, and with the last changes, this layout has been made compatible also to a "26 keys" one. So you can now choose to leave all 30 keys on the keyboard, or remove the two on the bottom line corners to have the "old" and comfortable 28 keys layout, or remove also space and enter to have the simplest "pure alpha" one! And even the intermediate 27 keys one is an interesting compatible option!
|
||||
|
||||
For more information please have a look at https://github.com/stevexyz/qmk_firmware/blob/master/keyboards/jj40/keymaps/stevexyz/readme.md
|
||||
This keymap is for a generic usage, trying to avoid as much gimmick as possible (considering the number of keys) and retain muscle memory from people used to the standard Qwerty 104 keys one. Functions and numbers (with related symbols) are on the first row as expected; other examples of design coherency include the symbols on the central row laid out in the same order as you'll find on a standard full keyboard, and the cursor movement aligned to the common unix vi standard ("hjkl", and for symmetry "sdfg" for home/pgdn/pgup/end). I've personally used this layout for months on my home PC in parallel to my portable work PC.
|
||||
|
||||
The image below explain the main layers. In addition to them with q, w and e there are three specific dedicated layers for cursors/mouse, numpad and media.
|
||||
![layers](https://raw.githubusercontent.com/stevexyz/qmk_firmware/master/keyboards/40percentclub/gherkin/keymaps/stevexyz/layers.jpeg)
|
||||
Relying just on the alphabetic keys this layout can be also very easily ported and tested on any qmk supported keyboard (ok, butterstick excluded).
|
||||
|
||||
The image below explains the main layers activated respectively with F, N or both modifiers pressed together. In addition to them there are available 5 layers that can be personalized as needed or completely removed without losing any functionality; three of them are currently setup in the default keymap for cursors/mouse, numpad and media (activated with q, w and e respectively).
|
||||
|
||||
![layers](https://github.com/stevexyz/qmk_firmware/blob/master/keyboards/40percentclub/gherkin/keymaps/stevexyz/newlayout26272830.jpg)
|
||||
|
||||
![prototype](https://github.com/stevexyz/qmk_firmware/blob/master/keyboards/40percentclub/gherkin/keymaps/stevexyz/gherkin28.jpeg)
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6060
|
||||
#define VENDOR_ID 0x544B //TK
|
||||
#define PRODUCT_ID 0x0003
|
||||
#define DEVICE_VER 0x0006
|
||||
#define MANUFACTURER The Key Company
|
||||
#define PRODUCT Candybar
|
||||
|
38
keyboards/candybar/lefty/keymaps/via/keymap.c
Normal file
38
keyboards/candybar/lefty/keymaps/via/keymap.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright 2018 Jack Humbert
|
||||
*
|
||||
* 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
|
||||
|
||||
#define _BL 0
|
||||
#define _FL 1
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Keymap _BL: Base Layer (Default Layer)
|
||||
*/
|
||||
[_BL] = LAYOUT(
|
||||
KC_P7 , KC_P8, KC_P9 , KC_PAST, KC_ESC , KC_Q , KC_W , KC_E, KC_R , KC_T , KC_Y, KC_U , KC_I , KC_O , KC_P , KC_DEL , KC_BSPC , \
|
||||
KC_P4 , KC_P5, KC_P6 , KC_PMNS, KC_TAB , KC_A , KC_S , KC_D, KC_F , KC_G , KC_H, KC_J , KC_K , KC_L , KC_SCLN, KC_ENT , \
|
||||
KC_P1 , KC_P2, KC_P3 , KC_PPLS, KC_LSFT, KC_Z , KC_X, KC_C , KC_V , KC_B, KC_N , KC_M , KC_COMM, KC_DOT , KC_UP ,KC_RSFT , \
|
||||
MO(_FL), KC_P0, KC_PDOT, KC_PENT, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC , KC_BSPC, KC_APP , KC_LEFT, KC_DOWN, KC_RGHT),
|
||||
|
||||
/* Keymap _FL: Function Layer
|
||||
*/
|
||||
[_FL] = LAYOUT(
|
||||
KC_P7 , KC_P8, KC_P9 , KC_VOLU, RESET , KC_Q , KC_W , KC_E, KC_R , KC_T , KC_Y, KC_U , KC_I , KC_LBRC, KC_RBRC, KC_INS , KC_BSPC , \
|
||||
KC_P4 , KC_P5, KC_P6 , KC_VOLD, KC_TAB , KC_A , KC_SLCK, KC_D, KC_F , KC_G , KC_H, KC_J , KC_K , KC_L , KC_QUOT, KC_BSLS , \
|
||||
KC_P1 , KC_P2, KC_P3 , KC_PEQL, KC_LSFT, KC_Z , KC_X, KC_CAPS, KC_V , KC_B, KC_NLCK, KC_M , KC_COMM, KC_DOT , KC_SLSH, KC_PGUP , \
|
||||
KC_END, KC_P0, KC_PDOT, KC_PENT, KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC , KC_BSPC, KC_APP , MO(_FL), KC_HOME, KC_PGDN),
|
||||
};
|
1
keyboards/candybar/lefty/keymaps/via/rules.mk
Normal file
1
keyboards/candybar/lefty/keymaps/via/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
VIA_ENABLE = yes
|
@ -7,7 +7,7 @@ MCU = STM32F072
|
||||
# EXTRAFLAGS+=-flto
|
||||
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
|
||||
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include "config_common.h"
|
||||
|
||||
/* USB Device descriptor parameter */
|
||||
#define VENDOR_ID 0xFEED
|
||||
#define PRODUCT_ID 0x6060
|
||||
#define VENDOR_ID 0x544B //TK
|
||||
#define PRODUCT_ID 0x0002
|
||||
#define DEVICE_VER 0x0006
|
||||
#define MANUFACTURER The Key Company
|
||||
#define PRODUCT Candybar
|
||||
|
38
keyboards/candybar/righty/keymaps/via/keymap.c
Normal file
38
keyboards/candybar/righty/keymaps/via/keymap.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* Copyright 2018 Jack Humbert
|
||||
*
|
||||
* 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
|
||||
|
||||
#define _BL 0
|
||||
#define _FL 1
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Keymap _BL: Base Layer (Default Layer)
|
||||
*/
|
||||
[_BL] = LAYOUT(
|
||||
KC_ESC,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_DEL,KC_BSPC,KC_P7,KC_P8,KC_P9,KC_PAST, \
|
||||
KC_TAB,KC_A,KC_S,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_SCLN,KC_ENT,KC_P4,KC_P5,KC_P6,KC_PMNS, \
|
||||
KC_LSFT,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_RSFT,KC_UP,KC_P1,KC_P2,KC_P3,KC_PPLS, \
|
||||
KC_LCTL,KC_LGUI,KC_LALT,KC_SPC,KC_SPC,KC_BSPC,KC_APP,MO(_FL),KC_LEFT,KC_DOWN,KC_RGHT,KC_P0,KC_PDOT,KC_PENT),
|
||||
|
||||
/* Keymap _FL: Function Layer
|
||||
*/
|
||||
[_FL] = LAYOUT(
|
||||
RESET,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_Y,KC_U,KC_I,KC_LBRC,KC_RBRC,KC_INS,KC_BSPC,KC_P7,KC_P8,KC_P9,KC_VOLU, \
|
||||
KC_TAB,KC_A,KC_SLCK,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_QUOT,KC_BSLS,KC_P4,KC_P5,KC_P6,KC_VOLD, \
|
||||
KC_LSFT,KC_Z,KC_X,KC_CAPS,KC_V,KC_B,KC_NLCK,KC_M,KC_COMM,KC_DOT,KC_SLSH,KC_PGUP,KC_P1,KC_P2,KC_P3,KC_PEQL, \
|
||||
KC_LCTL,KC_LGUI,KC_LALT,KC_SPC,KC_SPC,KC_BSPC,KC_APP,MO(_FL),KC_HOME,KC_PGDN,KC_END,KC_P0,KC_PDOT,KC_PENT),
|
||||
};
|
1
keyboards/candybar/righty/keymaps/via/rules.mk
Normal file
1
keyboards/candybar/righty/keymaps/via/rules.mk
Normal file
@ -0,0 +1 @@
|
||||
VIA_ENABLE = yes
|
@ -7,7 +7,7 @@ MCU = STM32F072
|
||||
# EXTRAFLAGS+=-flto
|
||||
LINK_TIME_OPTIMIZATION_ENABLE = yes
|
||||
BACKLIGHT_ENABLE = no
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
|
||||
## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
|
23
keyboards/chimera_ortho_plus/chimera_ortho_plus.c
Normal file
23
keyboards/chimera_ortho_plus/chimera_ortho_plus.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include "chimera_ortho_plus.h"
|
||||
|
||||
void uart_init(void) {
|
||||
SERIAL_UART_INIT();
|
||||
}
|
||||
|
||||
void led_init(void) {
|
||||
setPinOutput(D1);
|
||||
setPinOutput(F4);
|
||||
setPinOutput(F5);
|
||||
writePinHigh(D1);
|
||||
writePinHigh(F4);
|
||||
writePinHigh(F5);
|
||||
}
|
||||
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
matrix_init_user();
|
||||
uart_init();
|
||||
led_init();
|
||||
}
|
38
keyboards/chimera_ortho_plus/chimera_ortho_plus.h
Normal file
38
keyboards/chimera_ortho_plus/chimera_ortho_plus.h
Normal file
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
#define red_led_off PORTF |= (1<<5)
|
||||
#define red_led_on PORTF &= ~(1<<5)
|
||||
#define blu_led_off PORTF |= (1<<4)
|
||||
#define blu_led_on PORTF &= ~(1<<4)
|
||||
#define grn_led_off PORTD |= (1<<1)
|
||||
#define grn_led_on PORTD &= ~(1<<1)
|
||||
|
||||
#define set_led_off red_led_off; grn_led_off; blu_led_off
|
||||
#define set_led_red red_led_on; grn_led_off; blu_led_off
|
||||
#define set_led_blue red_led_off; grn_led_off; blu_led_on
|
||||
#define set_led_green red_led_off; grn_led_on; blu_led_off
|
||||
#define set_led_yellow red_led_on; grn_led_on; blu_led_off
|
||||
#define set_led_magenta red_led_on; grn_led_off; blu_led_on
|
||||
#define set_led_cyan red_led_off; grn_led_on; blu_led_on
|
||||
#define set_led_white red_led_on; grn_led_on; blu_led_on
|
||||
|
||||
// This a shortcut to help you visually see your layout.
|
||||
// The first section contains all of the arguements
|
||||
// The second converts the arguments into a two-dimensional array
|
||||
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k10, k11, \
|
||||
k12, k13, k14, k15, k16, k17, k18, k19, k20, k21, k22, k23, \
|
||||
k24, k25, k26, k27, k28, k29, k30, k31, k32, k33, k34, k35, \
|
||||
k36, k37, k38, k39, k40, k41, k42, k43, k44, k45, k46, k47, \
|
||||
k48, k49, k50, k51 \
|
||||
) \
|
||||
{ \
|
||||
{ k03, k40, k26, k15, k28, k01, k42, k31, k20, k33, k08, k10 }, \
|
||||
{ k00, k37, k14, k27, k16, k36, k47, k19, k32, k21, k46, k11 }, \
|
||||
{ k12, k25, k02, k39, k17, k49, k50, k18, k44, k09, k34, k23 }, \
|
||||
{ k24, k13, k38, k04, k05, k48, k51, k06, k07, k45, k22, k35 }, \
|
||||
{ k29, k41, KC_NO, KC_NO, KC_NO, KC_NO, k30, k43, KC_NO, KC_NO, KC_NO, KC_NO } \
|
||||
}
|
76
keyboards/chimera_ortho_plus/config.h
Normal file
76
keyboards/chimera_ortho_plus/config.h
Normal file
@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako <wakojun@gmail.com>
|
||||
|
||||
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 0xDE1D
|
||||
#define DEVICE_VER 0x0001
|
||||
#define MANUFACTURER unknown
|
||||
#define PRODUCT Chimera Ortho Plus
|
||||
#define DESCRIPTION q.m.k. keyboard firmware for Chimera Ortho Plus
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 6
|
||||
#define MATRIX_COLS 12
|
||||
|
||||
/* define if matrix has ghost */
|
||||
//#define MATRIX_HAS_GHOST
|
||||
|
||||
/* number of backlight levels */
|
||||
//#define BACKLIGHT_LEVELS 3
|
||||
|
||||
#define ONESHOT_TIMEOUT 500
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
||||
//UART settings for communication with the RF microcontroller
|
||||
#define SERIAL_UART_BAUD 1000000
|
||||
#define SERIAL_UART_DATA UDR1
|
||||
#define SERIAL_UART_UBRR (F_CPU / (16UL * SERIAL_UART_BAUD) - 1)
|
||||
#define SERIAL_UART_TXD_READY (UCSR1A & _BV(UDRE1))
|
||||
#define SERIAL_UART_RXD_PRESENT (UCSR1A & _BV(RXC1))
|
||||
#define SERIAL_UART_INIT() do { \
|
||||
/* baud rate */ \
|
||||
UBRR1L = SERIAL_UART_UBRR; \
|
||||
/* baud rate */ \
|
||||
UBRR1H = SERIAL_UART_UBRR >> 8; \
|
||||
/* enable TX and RX */ \
|
||||
UCSR1B = _BV(TXEN1) | _BV(RXEN1); \
|
||||
/* 8-bit data */ \
|
||||
UCSR1C = _BV(UCSZ11) | _BV(UCSZ10); \
|
||||
} while(0)
|
65
keyboards/chimera_ortho_plus/info.json
Normal file
65
keyboards/chimera_ortho_plus/info.json
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"keyboard_name": "Chimera Ortho Plus",
|
||||
"keyboard_folder": "chimera_ortho_plus",
|
||||
"maintainer": "qmk",
|
||||
"width": 13.5,
|
||||
"height": 6,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"label": "{", "x": 0, "y": 0},
|
||||
{"label": "1", "x": 1, "y": 0},
|
||||
{"label": "2", "x": 2, "y": 0},
|
||||
{"label": "3", "x": 3, "y": 0},
|
||||
{"label": "4", "x": 4, "y": 0},
|
||||
{"label": "5", "x": 5, "y": 0},
|
||||
{"label": "6", "x": 7.5, "y": 0},
|
||||
{"label": "7", "x": 8.5, "y": 0},
|
||||
{"label": "8", "x": 9.5, "y": 0},
|
||||
{"label": "9", "x": 10.5, "y": 0},
|
||||
{"label": "0", "x": 11.5, "y": 0},
|
||||
{"label": "}", "x": 12.5, "y": 0},
|
||||
{"label": "Esc", "x": 0, "y": 1},
|
||||
{"label": "Q", "x": 1, "y": 1},
|
||||
{"label": "W", "x": 2, "y": 1},
|
||||
{"label": "E", "x": 3, "y": 1},
|
||||
{"label": "R", "x": 4, "y": 1},
|
||||
{"label": "T", "x": 5, "y": 1},
|
||||
{"label": "Y", "x": 7.5, "y": 1},
|
||||
{"label": "U", "x": 8.5, "y": 1},
|
||||
{"label": "I", "x": 9.5, "y": 1},
|
||||
{"label": "O", "x": 10.5, "y": 1},
|
||||
{"label": "P", "x": 11.5, "y": 1},
|
||||
{"label": "\"", "x": 12.5, "y": 1},
|
||||
{"label": "Tab", "x": 0, "y": 2},
|
||||
{"label": "A", "x": 1, "y": 2},
|
||||
{"label": "S", "x": 2, "y": 2},
|
||||
{"label": "D", "x": 3, "y": 2},
|
||||
{"label": "F", "x": 4, "y": 2},
|
||||
{"label": "G", "x": 5, "y": 2},
|
||||
{"label": "H", "x": 7.5, "y": 2},
|
||||
{"label": "J", "x": 8.5, "y": 2},
|
||||
{"label": "K", "x": 9.5, "y": 2},
|
||||
{"label": "L", "x": 10.5, "y": 2},
|
||||
{"label": ";", "x": 11.5, "y": 2},
|
||||
{"label": "Enter", "x": 12.5, "y": 2},
|
||||
{"label": "(", "x": 0, "y": 3},
|
||||
{"label": "Z", "x": 1, "y": 3},
|
||||
{"label": "X", "x": 2, "y": 3},
|
||||
{"label": "C", "x": 3, "y": 3},
|
||||
{"label": "V", "x": 4, "y": 3},
|
||||
{"label": "B", "x": 5, "y": 3},
|
||||
{"label": "N", "x": 7.5, "y": 3},
|
||||
{"label": "M", "x": 8.5, "y": 3},
|
||||
{"label": ",", "x": 9.5, "y": 3},
|
||||
{"label": ".", "x": 10.5, "y": 3},
|
||||
{"label": "/", "x": 11.5, "y": 3},
|
||||
{"label": ")", "x": 12.5, "y": 3},
|
||||
{"label": "Num Layer", "x": 4, "y": 4},
|
||||
{"label": "Back Space", "x": 5, "y": 4},
|
||||
{"label": "Space", "x": 7.5, "y": 4},
|
||||
{"label": "Symbol Layer", "x": 8.5, "y": 4}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
5
keyboards/chimera_ortho_plus/keymaps/default/config.h
Normal file
5
keyboards/chimera_ortho_plus/keymaps/default/config.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
// place overrides here
|
||||
#define LONGPRESS_DELAY 150
|
||||
//#define LAYER_TOGGLE_DELAY 300
|
185
keyboards/chimera_ortho_plus/keymaps/default/keymap.c
Normal file
185
keyboards/chimera_ortho_plus/keymaps/default/keymap.c
Normal file
@ -0,0 +1,185 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
// Each layer gets a name for readability, which is then used in the keymap matrix below.
|
||||
// The underscores don't mean anything - you can have a layer called STUFF or any other name.
|
||||
// Layer names don't all need to be of the same length, obviously, and you can also skip them
|
||||
// entirely and just use numbers.
|
||||
enum chimera_ortho_plus_layers {
|
||||
_QWERTY,
|
||||
_CAPS,
|
||||
_NUMPAD,
|
||||
_SYMBOLS,
|
||||
_MACROS,
|
||||
_NAV
|
||||
};
|
||||
|
||||
#define KC_NMPD TG(_NUMPAD)
|
||||
#define KC_SYMB TG(_SYMBOLS)
|
||||
#define KC_SPFN LT(_NAV,KC_4)
|
||||
#define KC_SCTL MT(MOD_LCTL, KC_2)
|
||||
#define KC_SCTR MT(MOD_LCTL, KC_9)
|
||||
#define KC_SPLT MT(MOD_LALT, KC_3)
|
||||
#define KC_SPRT MT(MOD_LALT, KC_8)
|
||||
#define KC_GBRC MT(MOD_RGUI, KC_7)
|
||||
#define KC_GQOT MT(MOD_LGUI, KC_QUOT)
|
||||
#define KC_MESC LT(_MACROS, KC_ESC)
|
||||
#define KC_CAD LALT(LCTL(KC_DEL))
|
||||
|
||||
enum custom_keycodes {
|
||||
KC_INCL = SAFE_RANGE,
|
||||
KC_PULL,
|
||||
KC_PUSH,
|
||||
KC_SCAP,
|
||||
KC_SCOF
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
[_QWERTY] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
KC_LBRC, KC_1 ,KC_SCTL,KC_SPLT,KC_SPFN, KC_5 , KC_6 ,KC_GBRC,KC_SPRT,KC_SCTR, KC_0 ,KC_RBRC,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_MESC, KC_Q , KC_W , KC_E , KC_R , KC_T , KC_Y , KC_U , KC_I , KC_O , KC_P ,KC_QUOT,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_TAB , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN,KC_ENT ,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_LSPO, KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M ,KC_COMM,KC_DOT ,KC_SLSH,KC_RSPC,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_NMPD,KC_BSPC, KC_SPC ,KC_SYMB
|
||||
//|-------------------------------+-------+-------| |-------+-------+-------------------------------|
|
||||
),
|
||||
|
||||
[_CAPS] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
_______,KC_UNDS,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,KC_COLN,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_SCOF,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_SCOF,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______, _______,_______
|
||||
//|-------------------------------+-------+-------| |-------+-------+-------------------------------|
|
||||
),
|
||||
|
||||
[_NUMPAD] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,KC_MINS,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,KC_COLN,_______,_______,_______, _______, KC_7 , KC_8 , KC_9 ,KC_ASTR,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,KC_DOT ,_______,_______,_______, _______, KC_4 , KC_5 , KC_6 ,KC_PLUS,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______, KC_1 , KC_2 , KC_3 ,KC_SLSH,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______, _______, KC_0
|
||||
//|-------------------------------+-------+-------/ |-------+-------+-------------------------------|
|
||||
),
|
||||
|
||||
[_SYMBOLS] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_BSLS,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_TILD,KC_EQL ,KC_UNDS,KC_LCBR,KC_RCBR,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 , KC_GRV ,KC_PLUS,KC_MINS,KC_LBRC,KC_RBRC,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_PIPE,_______, _______,_______
|
||||
//|-------------------------------+-------+-------| |-------+-------+-------------------------------|
|
||||
),
|
||||
|
||||
[_MACROS] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
_______,_______,_______,_______,_______,_______, _______ ,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______ ,_______,KC_INCL,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,KC_CAD ,_______,_______, _______ ,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
KC_SCAP,_______,_______,_______,_______,_______, _______ ,_______,KC_PULL,KC_PUSH,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______, _______,_______
|
||||
//|-------------------------------+-------+-------| |-------+-------+-------------------------------|
|
||||
),
|
||||
|
||||
[_NAV] = LAYOUT(
|
||||
//,-------+-------+-------+-------+-------+-------. ,-------+-------+-------+-------+-------+-------.
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______,KC_PGUP, KC_UP ,KC_PGDN,KC_PSCR,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______,KC_LEFT,KC_DOWN,KC_RGHT,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______,
|
||||
//|-------+-------+-------+-------+-------+-------| |-------+-------+-------+-------+-------+-------|
|
||||
_______,KC_DEL , _______,_______
|
||||
//|-------------------------------+-------+-------| |-------+-------+-------------------------------|
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch(keycode) {
|
||||
/* include some kind of library or header */
|
||||
case KC_INCL:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("#include <>" SS_TAP(X_LEFT));
|
||||
}
|
||||
return false;
|
||||
case KC_PULL:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING("git pull\n");
|
||||
}
|
||||
return false;
|
||||
case KC_PUSH:
|
||||
if (record->event.pressed){
|
||||
SEND_STRING("git push\n");
|
||||
}
|
||||
return false;
|
||||
case KC_SCAP:
|
||||
if (record->event.pressed){
|
||||
layer_on(_CAPS);
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
return false;
|
||||
case KC_SCOF:
|
||||
if (record->event.pressed){
|
||||
layer_off(_CAPS);
|
||||
tap_code(KC_CAPS);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
void matrix_scan_user(void) {
|
||||
uint8_t layer = get_highest_layer(layer_state);
|
||||
|
||||
switch (layer) {
|
||||
case _QWERTY:
|
||||
set_led_green;
|
||||
break;
|
||||
case _CAPS:
|
||||
set_led_white;
|
||||
break;
|
||||
case _NUMPAD:
|
||||
set_led_blue;
|
||||
break;
|
||||
case _SYMBOLS:
|
||||
set_led_red;
|
||||
break;
|
||||
case _MACROS:
|
||||
set_led_cyan;
|
||||
break;
|
||||
case _NAV:
|
||||
set_led_magenta;
|
||||
break;
|
||||
default:
|
||||
set_led_green;
|
||||
break;
|
||||
}
|
||||
};
|
154
keyboards/chimera_ortho_plus/matrix.c
Normal file
154
keyboards/chimera_ortho_plus/matrix.c
Normal file
@ -0,0 +1,154 @@
|
||||
/*
|
||||
Copyright 2012 Jun Wako
|
||||
Copyright 2014 Jack Humbert
|
||||
|
||||
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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#if defined(__AVR__)
|
||||
#include <avr/io.h>
|
||||
#endif
|
||||
#include "wait.h"
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
#include "timer.h"
|
||||
|
||||
#if (MATRIX_COLS <= 8)
|
||||
# define print_matrix_header() print("\nr/c 01234567\n")
|
||||
# define print_matrix_row(row) print_bin_reverse8(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop(matrix[i])
|
||||
# define ROW_SHIFTER ((uint8_t)1)
|
||||
#elif (MATRIX_COLS <= 16)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse16(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop16(matrix[i])
|
||||
# define ROW_SHIFTER ((uint16_t)1)
|
||||
#elif (MATRIX_COLS <= 32)
|
||||
# define print_matrix_header() print("\nr/c 0123456789ABCDEF0123456789ABCDEF\n")
|
||||
# define print_matrix_row(row) print_bin_reverse32(matrix_get_row(row))
|
||||
# define matrix_bitpop(i) bitpop32(matrix[i])
|
||||
# define ROW_SHIFTER ((uint32_t)1)
|
||||
#endif
|
||||
|
||||
/* matrix state(1:on, 0:off) */
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_kb(void) {
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_rows(void) {
|
||||
return MATRIX_ROWS;
|
||||
}
|
||||
|
||||
inline
|
||||
uint8_t matrix_cols(void) {
|
||||
return MATRIX_COLS;
|
||||
}
|
||||
|
||||
void matrix_init(void) {
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void)
|
||||
{
|
||||
SERIAL_UART_INIT();
|
||||
|
||||
uint32_t timeout = 0;
|
||||
|
||||
//the s character requests the RF slave to send the matrix
|
||||
SERIAL_UART_DATA = 's';
|
||||
|
||||
//trust the external keystates entirely, erase the last data
|
||||
uint8_t uart_data[14] = {0};
|
||||
|
||||
//there are 10 bytes corresponding to 10 columns, and an end byte
|
||||
for (uint8_t i = 0; i < 14; i++) {
|
||||
//wait for the serial data, timeout if it's been too long
|
||||
//this only happened in testing with a loose wire, but does no
|
||||
//harm to leave it in here
|
||||
while(!SERIAL_UART_RXD_PRESENT){
|
||||
timeout++;
|
||||
if (timeout > 10000){
|
||||
break;
|
||||
}
|
||||
}
|
||||
uart_data[i] = SERIAL_UART_DATA;
|
||||
}
|
||||
|
||||
//check for the end packet, the key state bytes use the LSBs, so 0xE0
|
||||
//will only show up here if the correct bytes were recieved
|
||||
if (uart_data[10] == 0xE0)
|
||||
{
|
||||
//shifting and transferring the keystates to the QMK matrix variable
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
matrix[i] = (uint16_t) uart_data[i*2] | (uint16_t) uart_data[i*2+1] << 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
matrix_scan_quantum();
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline
|
||||
bool matrix_is_on(uint8_t row, uint8_t col)
|
||||
{
|
||||
return (matrix[row] & ((matrix_row_t)1<<col));
|
||||
}
|
||||
|
||||
inline
|
||||
matrix_row_t matrix_get_row(uint8_t row)
|
||||
{
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void)
|
||||
{
|
||||
print_matrix_header();
|
||||
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
phex(row); print(": ");
|
||||
print_matrix_row(row);
|
||||
print("\n");
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void)
|
||||
{
|
||||
uint8_t count = 0;
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
|
||||
count += matrix_bitpop(i);
|
||||
}
|
||||
return count;
|
||||
}
|
15
keyboards/chimera_ortho_plus/readme.md
Normal file
15
keyboards/chimera_ortho_plus/readme.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Chimera Ortho+
|
||||
|
||||
![Chimera Ortho+](https://i.imgur.com/tuDaGdTl.jpg)
|
||||
|
||||
A split wireless 50% ortholinear keyboard.
|
||||
|
||||
* Keyboard Maintainer: [William Wilson](https://github.com/GlenPickle)
|
||||
* Hardware Supported: Chimera Ortho+ PCB, WaveShare core nRF51822
|
||||
* Hardware Availability: [Gerbers](https://github.com/GlenPickle/Chimera/tree/master/ortho_plus/gerbers)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make chimera_ortho_plus: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).
|
37
keyboards/chimera_ortho_plus/rules.mk
Normal file
37
keyboards/chimera_ortho_plus/rules.mk
Normal file
@ -0,0 +1,37 @@
|
||||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader
|
||||
# Teensy halfkay
|
||||
# Pro Micro caterina
|
||||
# Atmel DFU atmel-dfu
|
||||
# LUFA DFU lufa-dfu
|
||||
# QMK DFU qmk-dfu
|
||||
# ATmega32A bootloadHID
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = caterina
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
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 = yes # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
MIDI_ENABLE = no # MIDI support
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
|
||||
UNICODE_ENABLE = yes
|
||||
CUSTOM_MATRIX = yes
|
||||
|
||||
# project specific files
|
||||
SRC = matrix.c
|
446
keyboards/ergodone/keymaps/art/keymap.c
Normal file
446
keyboards/ergodone/keymaps/art/keymap.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -37,8 +37,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define MATRIX_COL_PINS {F0,F1,E6,C7,C6,B7,D4,B1,B0,B5,B4,D7,D6,B3,F4}
|
||||
#define UNUSED_PINS
|
||||
|
||||
#define BACKLIGHT_PIN B6
|
||||
|
||||
/* COL2ROW or ROW2COL */
|
||||
#define DIODE_DIRECTION COL2ROW
|
||||
|
||||
@ -53,8 +51,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* Locking resynchronize hack */
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
/* Backlight configuration
|
||||
*/
|
||||
/* Backlight configuration */
|
||||
#define BACKLIGHT_PIN B6
|
||||
#define BACKLIGHT_BREATHING
|
||||
#define BACKLIGHT_LEVELS 4
|
||||
|
||||
/*
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user