teensy_lc_synth
commit
ee43856ff7
@ -0,0 +1,14 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
// Configure glob patterns for excluding files and folders.
|
||||
"files.exclude": {
|
||||
"**/.build": true,
|
||||
"**/*.hex": true
|
||||
},
|
||||
"files.associations": {
|
||||
"*.h": "c",
|
||||
"*.c": "c",
|
||||
"*.cpp": "cpp",
|
||||
"*.hpp": "cpp"
|
||||
}
|
||||
}
|
@ -1,24 +1,39 @@
|
||||
{
|
||||
"structure": {
|
||||
"readme": "home.md",
|
||||
"summary": "_summary.md"
|
||||
},
|
||||
"plugins" : ["toolbar", "edit-link", "anchors"],
|
||||
"plugins" : [
|
||||
"anchors",
|
||||
"edit-link",
|
||||
"forkmegithub",
|
||||
"git-author",
|
||||
"hints",
|
||||
"numbered-headings",
|
||||
"page-toc",
|
||||
"terminal",
|
||||
"toolbar"
|
||||
],
|
||||
"pluginsConfig": {
|
||||
"edit-link": {
|
||||
"base": "https://github.com/qmk/qmk_firmware/edit/master/docs",
|
||||
"label": "Suggest an edit"
|
||||
},
|
||||
"toolbar": {
|
||||
"buttons":
|
||||
[
|
||||
{
|
||||
"label": "QMK Firmware",
|
||||
"icon": "fa fa-github",
|
||||
"url": "https://github.com/qmk/qmk_firmware"
|
||||
}
|
||||
]
|
||||
}
|
||||
"edit-link": {
|
||||
"base": "https://github.com/qmk/qmk_firmware/edit/master/docs",
|
||||
"label": "Suggest an edit"
|
||||
},
|
||||
"forkmegithub": {
|
||||
"color": "red",
|
||||
"url": "https://github.com/qmk/qmk_firmware"
|
||||
},
|
||||
"page-toc": {
|
||||
"selector": ".markdown-section h1, .markdown-section h2"
|
||||
},
|
||||
"toolbar": {
|
||||
"buttons": [
|
||||
{
|
||||
"label": "QMK Firmware",
|
||||
"icon": "fa fa-github",
|
||||
"url": "https://github.com/qmk/qmk_firmware"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"root": "./docs/"
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
# Quantum Mechanical Keyboard Firmware
|
||||
|
||||
## What is QMK Firmware? {#what-is-qmk-firmware}
|
||||
|
||||
QMK (*Quantum Mechanical Keyboard*) is an open source community that maintains QMK Firmware, QMK Flasher, qmk.fm, and these docs. QMK Firmware is a keyboard firmware based on the [tmk\_keyboard](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB.
|
||||
|
||||
## How to get it {#how-to-get-it}
|
||||
|
||||
If you plan on contributing a keymap, keyboard, or features to QMK, the easiest thing to do is [fork the repo through Github](https://github.com/qmk/qmk_firmware#fork-destination-box), and clone your repo locally to make your changes, push them, then open a [Pull Request](https://github.com/qmk/qmk_firmware/pulls) from your fork.
|
||||
|
||||
Otherwise, you can either download it directly ([zip](https://github.com/qmk/qmk_firmware/zipball/master), [tar](https://github.com/qmk/qmk_firmware/tarball/master)), or clone it via git (`git@github.com:qmk/qmk_firmware.git`), or https (`https://github.com/qmk/qmk_firmware.git`).
|
||||
|
||||
## How to compile {#how-to-compile}
|
||||
|
||||
Before you are able to compile, you'll need to [install an environment](build_environment_setup.md) for AVR or/and ARM development. Once that is complete, you'll use the `make` command to build a keyboard and keymap with the following notation:
|
||||
|
||||
make planck-rev4-default
|
||||
|
||||
This would build the `rev4` revision of the `planck` with the `default` keymap. Not all keyboards have revisions (also called subprojects), in which case, it can be omitted:
|
||||
|
||||
make preonic-default
|
||||
|
||||
## How to customize {#how-to-customize}
|
||||
|
||||
QMK has lots of [features](features/README.md) to explore, and a good deal of [reference documentation](reference/README.md) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md).
|
@ -1,31 +1,45 @@
|
||||
* [Getting started](README.md)
|
||||
* [QMK Overview](qmk_overview.md)
|
||||
* [Build Environment Setup](build_environment_setup.md)
|
||||
* [Vagrant Guide](vagrant_guide.md)
|
||||
* [Make instructions](make_instructions.md)
|
||||
* [FAQ: Creating a Keymap](faq_keymap.md)
|
||||
* [FAQ: Compiling QMK](faq_build.md)
|
||||
* [How to Github](how_to_github.md)
|
||||
|
||||
### Getting started
|
||||
* [Introduction](home.md)
|
||||
* [QMK Overview](qmk_overview.md)
|
||||
* [Build Environment Setup](build_environment_setup.md)
|
||||
* [Make instructions](make_instructions.md)
|
||||
* [Features](features.md)
|
||||
* [Layer switching](key_functions.md)
|
||||
* [Leader Key](leader_key.md)
|
||||
* [Macros](macros.md)
|
||||
* [Dynamic Macros](dynamic_macros.md)
|
||||
* [Space Cadet](space_cadet_shift.md)
|
||||
* [Tap Dance](tap_dance.md)
|
||||
* [Mouse keys](mouse_keys.md)
|
||||
* [Unicode](unicode.md)
|
||||
|
||||
### Making a keymap
|
||||
* [Keymap overview](keymap.md)
|
||||
* [Custom Quantum Functions](custom_quantum_functions.md)
|
||||
* [Keycodes](keycodes.md)
|
||||
* [Layer switching](key_functions.md)
|
||||
* [Leader Key](leader_key.md)
|
||||
* [Macros](macros.md)
|
||||
* [Dynamic Macros](dynamic_macros.md)
|
||||
* [Space Cadet](space_cadet_shift.md)
|
||||
* [Tap Dance](tap_dance.md)
|
||||
* [Mouse keys](mouse_keys.md)
|
||||
* [FAQ: Creating a Keymap](faq_keymap.md)
|
||||
* [FAQ: Compiling QMK](faq_build.md)
|
||||
* Reference
|
||||
* [Glossary](glossary.md)
|
||||
* [Keymap overview](keymap.md)
|
||||
* [Keycodes](keycodes.md)
|
||||
* [Basic Keycodes](basic_keycodes.md)
|
||||
* [Quantum Keycodes](quantum_keycodes.md)
|
||||
* [The `config.h` File](config_options.md)
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Documentation Best Practices](documentation_best_practices.md)
|
||||
* [Unit Testing](unit_testing.md)
|
||||
|
||||
### For hardware makers and modders
|
||||
* [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md)
|
||||
* [Porting your keyboard to QMK](porting_your_keyboard_to_qmk.md)
|
||||
* [Modding your keyboard](modding_your_keyboard.md)
|
||||
* [Adding features to QMK](adding_features_to_qmk.md)
|
||||
* [ISP flashing guide](isp_flashing_guide.md)
|
||||
* For Makers and Modders
|
||||
* [Adding a keyboard to QMK](adding_a_keyboard_to_qmk.md)
|
||||
* [Adding features to QMK](adding_features_to_qmk.md)
|
||||
* [Hand Wiring Guide](hand_wiring.md)
|
||||
* [ISP flashing guide](isp_flashing_guide.md)
|
||||
* [Modding your keyboard](modding_your_keyboard.md)
|
||||
* [Porting your keyboard to QMK](porting_your_keyboard_to_qmk.md)
|
||||
|
||||
* For a Deeper Understanding
|
||||
* [How Keyboards Work](basic_how_keyboards_work.md)
|
||||
* [Understanding QMK](understanding_qmk.md)
|
||||
|
||||
### Other topics
|
||||
* [General FAQ](faq.md)
|
||||
* [Differences from TMK](differences_from_tmk.md)
|
||||
* Other Topics
|
||||
* [General FAQ](faq.md)
|
||||
* [Using Eclipse with QMK](eclipse.md)
|
||||
|
@ -1,7 +1,16 @@
|
||||
If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK! These are generally done via [pull request](https://github.com/qmk/qmk_firmware/pulls) after forking, and here are some things to keep in mind when creating one:
|
||||
# How To Add Features To QMK
|
||||
|
||||
* **Disable by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, [open an issue](https://github.com/qmk/qmk_firmware/issues) for everyone to discuss it!
|
||||
If you have an idea for a custom feature or extra hardware connection, we'd love to accept it into QMK!
|
||||
|
||||
Before you put a lot of work into building your new feature you should make sure you are implementing it in the best way. You can get a basic understanding of QMK by reading [Understaning QMK](understanding_qmk.html), which will take you on a tour of the QMK program flow. From here you should talk to us to get a sense of the best way to implement your idea. There are two main ways to do this:
|
||||
|
||||
* [Chat on Gitter](https://gitter.im/qmk/qmk_firmware)
|
||||
* [Open an Issue](https://github.com/qmk/qmk_firmware/issues/new)
|
||||
|
||||
Once you have implemented your new feature you will generally submit a [pull request](https://github.com/qmk/qmk_firmware/pulls). Here are some things to keep in mind when creating one:
|
||||
|
||||
* **Disabled by default** - memory is a pretty limited on most chips QMK supports, and it's important that current keymaps aren't broken, so please allow your feature to be turned **on**, rather than being turned off. If you think it should be on by default, or reduces the size of the code, please talk with us about it.
|
||||
* **Compile locally before submitting** - hopefully this one is obvious, but things need to compile! Our Travis system will catch any issues, but it's generally faster for you to compile a few keyboards locally instead of waiting for the results to come back.
|
||||
* **Consider subprojects and different chip-bases** - there are several keyboards that have subprojects that have allow for slightly different configurations, and even different chip-bases. Try to make a feature supported in ARM and AVR, or automatically disabled in one that doesn't work.
|
||||
* **Explain your feature** - submitting a markdown write-up of what your feature does with your PR may be needed, and it will allow a collaborator to easily copy it into the wiki for documentation (after proofing and editing).
|
||||
* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues).
|
||||
* **Explain your feature** - Document it in `docs/`, either as a new file or as part of an existing file. If you don't document it other people won't be able to benefit from your hard work.
|
||||
* **Don't refactor code** - to maintain a clear vision of how things are laid out in QMK, we try to plan out refactors in-depth, and have a collaborator make the changes. If you have an idea for refactoring, or suggestions, [open an issue](https://github.com/qmk/qmk_firmware/issues).
|
||||
|
@ -1,103 +0,0 @@
|
||||
# This guide has now been included in the main readme - please reference that one instead.
|
||||
|
||||
## Build Environment Setup
|
||||
|
||||
### Windows (Vista and later)
|
||||
1. If you have ever installed WinAVR, uninstall it.
|
||||
2. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**.
|
||||
3. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location.
|
||||
4. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/qmk/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer.
|
||||
5. Double-click on the 1-setup-path-win batch script to run it. You'll need to accept a User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up.
|
||||
6. Right-click on the 2-setup-environment-win batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete!
|
||||
7. Future build commands should be run from the standard Windows command prompt, which you can find by searching for "command prompt" from the start menu or start screen. Ignore the "MHV AVR Shell".
|
||||
|
||||
### Mac
|
||||
If you're using [homebrew,](http://brew.sh/) you can use the following commands:
|
||||
|
||||
brew tap osx-cross/avr
|
||||
brew install avr-libc
|
||||
brew install dfu-programmer
|
||||
|
||||
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line.
|
||||
|
||||
You can also try these instructions:
|
||||
|
||||
1. Install Xcode from the App Store.
|
||||
2. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
|
||||
3. Install [DFU-Programmer][dfu-prog].
|
||||
|
||||
### Linux
|
||||
Install AVR GCC, AVR libc, and dfu-progammer with your favorite package manager.
|
||||
|
||||
Debian/Ubuntu example:
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc-avr avr-libc dfu-programmer
|
||||
|
||||
### Vagrant
|
||||
If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [vagrant guide](vagrant_guide.md).
|
||||
|
||||
## Verify Your Installation
|
||||
1. If you haven't already, obtain this repository ([https://github.com/qmk/qmk_firmware](https://github.com/qmk/qmk_firmware)). You can either download it as a zip file and extract it, or clone it using the command line tool git or the Github Desktop application.
|
||||
2. Open up a terminal or command prompt and navigate to the `qmk_firmware` folder using the `cd` command. The command prompt will typically open to your home directory. If, for example, you cloned the repository to your Documents folder, then you would type `cd Documents/qmk_firmware`. If you extracted the file from a zip, then it may be named `qmk_firmware-master` instead.
|
||||
3. To confirm that you're in the correct location, you can display the contents of your current folder using the `dir` command on Windows, or the `ls` command on Linux or Mac. You should see several files, including `readme.md` and a `quantum` folder. From here, you need to navigate to the appropriate folder under `keyboards/`. For example, if you're building for a Planck, run `cd keyboards/planck`.
|
||||
4. Once you're in the correct keyboard-specific folder, run the `make` command. This should output a lot of information about the build process. More information about the `make` command can be found below.
|
||||
|
||||
## Customizing, Building, and Deploying Your Firmware
|
||||
|
||||
### The Make command
|
||||
|
||||
The `make` command is how you compile the firmware into a .hex file, which can be loaded by a dfu programmer (like dfu-progammer via `make dfu`) or the [Teensy loader](https://www.pjrc.com/teensy/loader.html) (only used with Teensys). You can run `make` from the root (`/`), your keyboard folder (`/keyboards/<keyboard>/`), or your keymap folder (`/keyboards/<keyboard>/keymaps/<keymap>/`) if you have a `Makefile` there (see the example [here](/doc/keymap_makefile_example.mk)).
|
||||
|
||||
By default, this will generate a `<keyboard>_<keymap>.hex` file in whichever folder you run `make` from. These files are ignored by git, so don't worry about deleting them when committing/creating pull requests.
|
||||
|
||||
* The "root" (`/`) folder is the qmk_firmware folder, in which are `doc`, `keyboard`, `quantum`, etc.
|
||||
* The "keyboard" folder is any keyboard project's folder, like `/keyboards/planck`.
|
||||
* The "keymap" folder is any keymap's folder, like `/keyboards/planck/keymaps/default`.
|
||||
|
||||
Below is a list of the useful `make` commands in QMK:
|
||||
|
||||
* `make` - cleans automatically and builds your keyboard and keymap depending on which folder you're in. This defaults to the "default" layout (unless in a keymap folder), and Planck keyboard in the root folder
|
||||
* `make keyboard=<keyboard>` - specifies the keyboard (only to be used in root)
|
||||
* `make keymap=<keymap>` - specifies the keymap (only to be used in root and keyboard folder - not needed when in keymap folder)
|
||||
* `make quick` - skips the clean step (cannot be used immediately after modifying config.h or Makefiles)
|
||||
* `make dfu` - (requires dfu-programmer) builds and flashes the keymap to your keyboard once placed in reset/dfu mode (button or press `KC_RESET`). This does not work for Teensy-based keyboards like the ErgoDox EZ.
|
||||
* `keyboard=` and `keymap=` are compatible with this
|
||||
* `make all-keyboards` - builds all keymaps for all keyboards and outputs status of each (use in root)
|
||||
* `make all-keyboards-default` - builds all default keymaps for all keyboards and outputs status of each (use in root)
|
||||
* `make all-keymaps [keyboard=<keyboard>]` - builds all of the keymaps for whatever keyboard folder you're in, or specified by `<keyboard>`
|
||||
* `make all-keyboards-quick`, `make all-keyboards-default-quick` and `make all-keymaps-quick [keyboard=<keyboard>]` - like the normal "make-all-*" commands, but they skip the clean steps
|
||||
|
||||
Other, less useful functionality:
|
||||
|
||||
* `make COLOR=false` - turns off color output
|
||||
* `make SILENT=true` - turns off output besides errors/warnings
|
||||
* `make VERBOSE=true` - outputs all of the avr-gcc stuff (not interesting)
|
||||
|
||||
### The Makefile
|
||||
|
||||
There are 3 different `make` and `Makefile` locations:
|
||||
|
||||
* root (`/`)
|
||||
* keyboard (`/keyboards/<keyboard>/`)
|
||||
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
|
||||
|
||||
The root contains the code used to automatically figure out which keymap or keymaps to compile based on your current directory and commandline arguments. It's considered stable, and shouldn't be modified. The keyboard one will contain the MCU set-up and default settings for your keyboard, and shouldn't be modified unless you are the producer of that keyboard. The keymap Makefile can be modified by users, and is optional. It is included automatically if it exists. You can see an example [here](/doc/keymap_makefile_example.mk) - the last few lines are the most important. The settings you set here will override any defaults set in the keyboard Makefile. **It is required if you want to run `make` in the keymap folder.**
|
||||
|
||||
### The `config.h` file
|
||||
|
||||
There are 2 `config.h` locations:
|
||||
|
||||
* keyboard (`/keyboards/<keyboard>/`)
|
||||
* keymap (`/keyboards/<keyboard>/keymaps/<keymap>/`)
|
||||
|
||||
The keyboard `config.h` is included only if the keymap one doesn't exist. The format to use for your custom one [is here](/doc/keymap_config_h_example.h). If you want to override a setting from the parent `config.h` file, you need to do this:
|
||||
|
||||
```
|
||||
#undef MY_SETTING
|
||||
#define MY_SETTING 4
|
||||
```
|
||||
|
||||
For a value of `4` for this imaginary setting. So we `undef` it first, then `define` it.
|
||||
|
||||
You can then override any settings, rather than having to copy and paste the whole thing.
|
@ -1,187 +0,0 @@
|
||||
Build Firmware and Program Controller
|
||||
=====================================
|
||||
|
||||
## This guide may be out-dated - use [build_guide.md](build_guide.md) instead
|
||||
|
||||
Download and Install
|
||||
--------------------
|
||||
### 1. Install Tools
|
||||
|
||||
1. **Toolchain** On Windows install [MHV AVR Tools][mhv] for AVR GCC compiler and [Cygwin][cygwin](or [MinGW][mingw]) for shell terminal. On Mac you can use [CrossPack][crosspack]. On Linux you can install AVR GCC (and avr-libc) with your favorite package manager or run the avr_setup.sh script in the root of this repository.
|
||||
|
||||
2. **Programmer** On Windows install [Atmel FLIP][flip]. On Mac and Linux install [dfu-programmer][dfu-prog].
|
||||
|
||||
3. **Driver** On Windows you start DFU bootloader on the chip first time you will see 'Found New Hardware Wizard' to install driver. If you install device driver properly you can find chip name like 'ATmega32U4' under 'LibUSB-Win32 Devices' tree on 'Device Manager'. If not you shall need to update its driver on 'Device Manager'. You will find the driver in `FLIP` install directory like: C:\Program Files (x86)\Atmel\Flip 3.4.5\usb\. In case of `dfu-programmer` use its driver.
|
||||
|
||||
If you use PJRC Teensy you don't need step 2 and 3 above, just get [Teensy loader][teensy-loader].
|
||||
|
||||
|
||||
### 2. Download source
|
||||
You can find firmware source at github:
|
||||
|
||||
- <https://github.com/tmk/tmk_keyboard>
|
||||
|
||||
If you are familiar with `Git` tools you are recommended to use it but you can also download zip archive from:
|
||||
|
||||
- <https://github.com/tmk/tmk_keyboard/archive/master.zip>
|
||||
|
||||
|
||||
Build firmware
|
||||
--------------
|
||||
### 1. Open terminal
|
||||
Open terminal window to get access to commands. Use Cygwin(or MingGW) `shell terminal` in Windows or `Terminal.app` on Mac OSX. In Windows press `Windows` key and `R` then enter `cmd` in 'Run command' dialog showing up.
|
||||
|
||||
### 2. Change directory
|
||||
Move to project directory in the firmware source.
|
||||
|
||||
cd tmk_keyboard/{'keyboard' or 'converter'}/<project>
|
||||
|
||||
### 3. Make
|
||||
Build firmware using GNU `make` command. You'll see `<project>_<variant>.hex` file in that directory unless something unexpected occurs in build process.
|
||||
|
||||
|
||||
make -f Makefile.<variant> clean
|
||||
make -f Makefile.<variant>
|
||||
|
||||
|
||||
|
||||
|
||||
Program Controller
|
||||
------------------
|
||||
Now you have **hex** file to program on current directory. This **hex** is only needed to program your controller, other files are used for development and you may leave and forget them.
|
||||
|
||||
### 1. Start bootloader
|
||||
How to program controller depends on controller chip and its board design. To program AVR USB chips you'll need to start it up in bootloader mode. Most of boards with the chip have a push button to let bootloader come up. Consult with your controller board manual.
|
||||
|
||||
### 2. Program with DFU bootloader
|
||||
Stock AVR USB chip including ATmega32U4 has DFU bootloader by factory default. `FLIP` is a DFU programmer on Windows offered by Atmel. Open source command line tool `dfu-programmer` also supports AVR chips, it runs on Linux, Mac OSX and even Windows.
|
||||
|
||||
To program AVR chip with DFU bootloader use `FLIP` or `dfu-programmer`.
|
||||
If you have a proper program command in `Makefile` just type this.
|
||||
|
||||
`FLIP` has two version of tool, GUI app and command line program. If you want GUI see tutorial below.
|
||||
To use command line tool run this command. Note that you need to set PATH variable properly.
|
||||
|
||||
$ make -f Makefile.<variant> flip
|
||||
|
||||
Or to program with `dfu-programmer` run:
|
||||
|
||||
$ make -f Makefile.<variant> dfu
|
||||
|
||||
#### FLIP GUI tutorial
|
||||
1. On menu bar click Device -> Select, then. `ATmega32u4`.
|
||||
2. On menu bar click Settings -> Communication -> USB, then click 'Open' button on 'USB Port Connection' dialog.
|
||||
At this point you'll see grey-outed widgets on the app get colored and ready.
|
||||
|
||||
3. On menu bar click File -> Load HEX File, then select your firmware hex file on File Selector dialog.
|
||||
4. On 'Operations Flow' panel click 'Run' button to load the firmware binary to the chip. Note that you should keep 'Erase', 'Blank Check', 'Program' and 'Verify' check boxes selected.
|
||||
5. Re-plug USB cord or click 'Start Application' button to restart your controller.
|
||||
Done.
|
||||
|
||||
See also these instructions if you need.
|
||||
|
||||
- <http://code.google.com/p/micropendous/wiki/LoadingFirmwareWithFLIP>
|
||||
- <http://www.atmel.com/Images/doc7769.pdf>
|
||||
|
||||
|
||||
### 3. Program with Teensy Loader
|
||||
If you have PJRC Teensy see instruction of `Teensy Loader`.
|
||||
|
||||
- <http://www.pjrc.com/teensy/loader.html>
|
||||
|
||||
Or use this command if you have command line version of Teensy Loader installed.
|
||||
|
||||
$ make -f Makefile.<variant> teensy
|
||||
|
||||
|
||||
### 4. Program with Other programmer
|
||||
You may want to use other programmer like `avrdude` with AVRISPmkII, Arduino or USBasp. In that case you can still use make target `program` for build with configuring `PROGRAM_CMD` in Makefile.
|
||||
|
||||
$ make -f Makefile.<variant> program
|
||||
|
||||
|
||||
[cygwin]: https://www.cygwin.com/
|
||||
[mingw]: http://www.mingw.org/
|
||||
[mhv]: https://infernoembedded.com/products/avr-tools
|
||||
[winavr]: http://winavr.sourceforge.net/
|
||||
[crosspack]: http://www.obdev.at/products/crosspack/index.html
|
||||
[flip]: http://www.atmel.com/tools/FLIP.aspx
|
||||
[dfu-prog]: http://dfu-programmer.sourceforge.net/
|
||||
[teensy-loader]:http://www.pjrc.com/teensy/loader.html
|
||||
|
||||
|
||||
|
||||
Makefile Options
|
||||
----------------
|
||||
### 1. MCU and Frequency.
|
||||
|
||||
MCU = atmega32u4 # Teensy 2.0
|
||||
#MCU = at90usb1286 # Teensy++ 2.0
|
||||
F_CPU = 16000000
|
||||
|
||||
Set your MCU and its clock in Hz.
|
||||
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
If you are using PJRC Teensy use `512` for `BOOTLOADER_SIZE`, otherwise use `4096` unless you are sure.
|
||||
|
||||
### 2. Features
|
||||
Optional. Note that ***comment out*** with `#` to disable them.
|
||||
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
#NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||
#BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
|
||||
### 3. Programmer
|
||||
Optional. Set proper command for your controller, bootloader and programmer. This command can be used with `make program`. Not needed if you use `FLIP`, `dfu-programmer` or `Teensy Loader`.
|
||||
|
||||
# avrdude with AVRISPmkII
|
||||
PROGRAM_CMD = avrdude -p $(MCU) -c avrispmkII -P USB -U flash:w:$(TARGET).hex
|
||||
|
||||
# avrdude with USBaspLoader
|
||||
PROGRAM_CMD = avrdude -p $(MCU) -c usbasp -U flash:w:$(TARGET).hex
|
||||
|
||||
# avrdude with arduino
|
||||
PROGRAM_CMD = avrdude -p $(MCU) -c arduino -P COM1 -b 57600 -U flash:w:$(TARGET).hex
|
||||
|
||||
|
||||
|
||||
Config.h Options
|
||||
----------------
|
||||
### 1. Magic command key combination
|
||||
|
||||
#define IS_COMMAND() (keyboard_report->mods == (MOD_BIT(KB_LSHIFT) | MOD_BIT(KB_RSHIFT)))
|
||||
|
||||
### 2. Mechanical Locking Support for CapsLock
|
||||
|
||||
/* Mechanical locking CapsLock support. Use KC_LCAP instead of KC_CAPS in keymap */
|
||||
#define CAPSLOCK_LOCKING_ENABLE
|
||||
/* Locking CapsLock re-synchronize hack */
|
||||
#define CAPSLOCK_LOCKING_RESYNC_ENABLE
|
||||
|
||||
### 3. Disable Debug and Print
|
||||
|
||||
/* disable debug print */
|
||||
#define NO_DEBUG
|
||||
|
||||
/* disable print */
|
||||
#define NO_PRINT
|
||||
|
||||
### 4. Disable Action Features
|
||||
|
||||
#define NO_ACTION_LAYER
|
||||
#define NO_ACTION_TAPPING
|
||||
#define NO_ACTION_ONESHOT
|
||||
#define NO_ACTION_MACRO
|
||||
#define NO_ACTION_FUNCTION
|
||||
|
||||
***TBD***
|
@ -0,0 +1,133 @@
|
||||
# The `config.h` file
|
||||
|
||||
This is a c header file that is one of the first things included, and will persist over the whole project (if included). Lots of variables can be set here and accessed elsewhere (namely keymaps). This file can exist at a couple different levels:
|
||||
|
||||
## Keyboard
|
||||
|
||||
```c
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
// config options
|
||||
|
||||
#ifdef SUBPROJECT_<subproject>
|
||||
#include "<subproject>/config.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
```
|
||||
|
||||
This file contains config options that should apply to the whole keyboard, and won't change in subprojects, or most keymaps. The suproject block here only applies to keyboards with subprojects.
|
||||
|
||||
## Subproject
|
||||
|
||||
```c
|
||||
#ifndef <subproject>_CONFIG_H
|
||||
#define <subproject>_CONFIG_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
// config options
|
||||
|
||||
#endif
|
||||
```
|
||||
|
||||
For keyboards that have subprojects, this file contains config options that should apply to only that subproject, and won't change in most keymaps.
|
||||
|
||||
## Keymap
|
||||
|
||||
```c
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
// config options
|
||||
|
||||
#endif
|
||||
```
|
||||
|
||||
This file contains all of the options for that particular keymap. If you wish to override a previous declaration, you can use `#undef <variable>` to undefine it, where you can then redefine it without an error.
|
||||
|
||||
# Config Options
|
||||
|
||||
```c
|
||||
#define VENDOR_ID 0x1234 // defines your VID, and for most DIY projects, can be whatever you want
|
||||
#define PRODUCT_ID 0x5678 // defines your PID, and for most DIY projects, can be whatever you want
|
||||
#define DEVICE_VER 0 // defines the device version (often used for revisions)
|
||||
|
||||
#define MANUFACTURER Me // generally who/whatever brand produced the board
|
||||
#define PRODUCT Board // the name of the keyboard
|
||||
#define DESCRIPTION a keyboard // a short description of what the keyboard is
|
||||
|
||||
#define MATRIX_ROWS 5 // the number of rows in your keyboard's matrix
|
||||
#define MATRIX_COLS 15 // the number of columns in your keyboard's matrix
|
||||
|
||||
#define MATRIX_ROW_PINS { D0, D5, B5, B6 } // pins of the rows, from top to bottom
|
||||
#define MATRIX_COL_PINS { F1, F0, B0, C7, F4, F5, F6, F7, D4, D6, B4, D7 } // pins of the columns, from left to right
|
||||
#define UNUSED_PINS { D1, D2, D3, B1, B2, B3 } // pins unused by the keyboard for reference
|
||||
#define MATRIX_HAS_GHOST // define is matrix has ghost (unlikely)
|
||||
#define DIODE_DIRECTION COL2ROW // COL2ROW or ROW2COL - how your matrix is configured
|
||||
// COL2ROW means the black mark on your diode is facing to the rows, and between the switch and the rows
|
||||
|
||||
#define AUDIO_VOICES // turns on the alternate audio voices (to cycle through)
|
||||
#define C6_AUDIO // enables audio on pin C6
|
||||
#define B5_AUDIO // enables audio on pin B5 (duophony is enable if both are enabled)
|
||||
|
||||
#define BACKLIGHT_PIN B7 // pin of the backlight - B5, B6, B7 use PWM, others use softPWM
|
||||
#define BACKLIGHT_LEVELS 3 // number of levels your backlight will have (not including off)
|
||||
|
||||
#define DEBOUNCING_DELAY 5 // the delay when reading the value of the pin (5 is default)
|
||||
|
||||
#define LOCKING_SUPPORT_ENABLE // mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap
|
||||
#define LOCKING_RESYNC_ENABLE // tries to keep switch state consistent with keyboard LED state
|
||||
|
||||
#define IS_COMMAND() ( \ // key combination that allows the use of magic commands (useful for debugging)
|
||||
keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
|
||||
)
|
||||
|
||||
// the following options can save on file size at the expense of that feature
|
||||
#define NO_DEBUG // disable debuging (saves on file size)
|
||||
#define NO_PRINT // disable printing (saves of file size)
|
||||
#define NO_ACTION_LAYER // no layers
|
||||
#define NO_ACTION_TAPPING // no tapping for layers/mods
|
||||
#define NO_ACTION_ONESHOT // no oneshot for layers/mods
|
||||
#define NO_ACTION_MACRO // no macros
|
||||
#define NO_ACTION_FUNCTION // no functions
|
||||
|
||||
#define FORCE_NKRO // NKRO by default requires to be turned on, this forces it to be on always
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS // when switching layers, this will release all mods
|
||||
|
||||
#define TAPPING_TERM 200 // how long before a tap becomes a hold
|
||||
#define TAPPING_TOGGLE 2 // how many taps before triggering the toggle
|
||||
|
||||
#define PERMISSIVE_HOLD // makes tap and hold keys work better for fast typers who don't want tapping term set above 500
|
||||
|
||||
#define LEADER_TIMEOUT 300 // how long before the leader key times out
|
||||
|
||||
#define ONESHOT_TIMEOUT 300 // how long before oneshot times out
|
||||
#define ONESHOT_TAP_TOGGLE 2 // how many taps before oneshot toggle is triggered
|
||||
|
||||
#define IGNORE_MOD_TAP_INTERRUPT // makes it possible to do rolling combos (zx) with keys that convert to other keys on hold
|
||||
|
||||
// ws2812 options
|
||||
#define RGB_DI_PIN D7 // pin the DI on the ws2812 is hooked-up to
|
||||
#define RGBLIGHT_ANIMATIONS // run RGB animations
|
||||
#define RGBLED_NUM 15 // number of LEDs
|
||||
#define RGBLIGHT_HUE_STEP 12 // units to step when in/decreasing hue
|
||||
#define RGBLIGHT_SAT_STEP 25 // units to step when in/decresing saturation
|
||||
#define RGBLIGHT_VAL_STEP 12 // units to step when in/decreasing value (brightness)
|
||||
|
||||
#define RGBW_BB_TWI // bit-bangs twi to EZ RGBW LEDs (only required for Ergodox EZ)
|
||||
|
||||
// mousekey options (self-describing)
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_DELAY 0
|
||||
#define MOUSEKEY_TIME_TO_MAX 60
|
||||
#define MOUSEKEY_MAX_SPEED 7
|
||||
#define MOUSEKEY_WHEEL_DELAY 0
|
||||
|
||||
```
|
@ -1,352 +0,0 @@
|
||||
#Planck Advanced (but not too advanced) `cygwin` Users Guide
|
||||
If you are a user of the [cygwin environment](https://cygwin.com) in Windows and want the freedom to use the latest tools available, then this is the guide for you. If compiling your own copy of the latest and greatest Gnu C Compiler makes you super happy, then this is the guide for you. If the command line make you smile, then this is the guide for you.
|
||||
|
||||
This guide was written step by step as I went through the process on a `Windows 10` `x86_64` and a `Windows 7` `amd k10` based system. This should be generally applicable to to any `Windows` environment with `cygwin`.
|
||||
|
||||
#####Do not skip steps. Do not move past a step until the previous step finishes successfully.
|
||||
|
||||
Based on [avr-libc installation guide](http://www.nongnu.org/avr-libc/user-manual/install_tools.html)
|
||||
|
||||
##Get the Required Packages
|
||||
Download the `cygwin` setup ([x86_64](https://cygwin.com/setup-x86_64.exe)) and install the default system plus the following if they are not already selected:
|
||||
- devel/git
|
||||
- devel/gcc-core
|
||||
- devel/gcc-g++
|
||||
- devel/flex
|
||||
- devel/bison
|
||||
- devel/make
|
||||
- devel/texinfo
|
||||
- devel/gettext-devel
|
||||
- devel/automake
|
||||
- devel/autoconfig
|
||||
- devel/libtool
|
||||
- text/gettext
|
||||
- libs/libgcc1
|
||||
- interpreters/m4
|
||||
- web/wget
|
||||
- archive/unzip
|
||||
|
||||
The following sources will be required:
|
||||
- [gmp](https://gmplib.org/) (6.1.0)
|
||||
- [mpfr](http://www.mpfr.org/) (3.1.4)
|
||||
- [mpc](http://www.multiprecision.org/) (1.0.3)
|
||||
- [binutils](https://www.sourceware.org/binutils/) (2.26)
|
||||
- [gcc](https://gcc.gnu.org/) (5.3.0)
|
||||
- [avr-libc](http://www.nongnu.org/avr-libc/) (2.0.0)
|
||||
|
||||
The `dfu-programmer` will be required to flash the new firmware
|
||||
- [dfu-programmer](https://dfu-programmer.github.io/) (0.7.2)
|
||||
|
||||
The set of commands below will create a directory (`~/local/avr`) for the sources you compile to be installed on the machine and a directory (`~/src`) for these source files to be stored. The commands then download the sources of the needed packages and unpack them. Note: the expand commands are different depending on if the packages are offered as a `bz2` or `gz` archive
|
||||
```
|
||||
$ mkdir ~/local
|
||||
$ mkdir ~/local/avr
|
||||
$ mkdir ~/src
|
||||
$ cd ~/src
|
||||
$ wget https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2
|
||||
$ wget http://www.mpfr.org/mpfr-3.1.4/mpfr-3.1.4.tar.bz2
|
||||
$ wget ftp://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz
|
||||
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.26.tar.gz
|
||||
$ wget http://mirror0.babylon.network/gcc/releases/gcc-5.3.0/gcc-5.3.0.tar.gz
|
||||
$ wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-2.0.0.tar.bz2
|
||||
$ tar -xjf gmp-6.1.0.tar.bz2
|
||||
$ tar -xjf mpfr-3.1.4.tar.bz2
|
||||
$ tar -zxf mpc-1.0.3.tar.gz
|
||||
$ tar -zxf binutils-2.26.tar.gz
|
||||
$ tar -zxf gcc-5.3.0.tar.gz
|
||||
$ tar -xjf avr-libc-2.0.0.tar.bz2
|
||||
```
|
||||
|
||||
##Setup the Build Environment
|
||||
These commands will set up the install directory and the `PATH` variable, which will allow you to access your installed packages. Note: if you close the `cygwin` terminal window, you will need to rerun these commands, they are not permanent.
|
||||
```
|
||||
$ PREFIX=$HOME/local/avr
|
||||
$ export PREFIX
|
||||
$ PATH=/usr/local/bin:/usr/local/lib:/usr/local/include:/bin:/lib:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS
|
||||
$ PATH=$PATH:$PREFIX/bin:$PREFIX/lib
|
||||
$ export PATH
|
||||
```
|
||||
|
||||
##The `gcc` Required Math Library Packages
|
||||
The following packages are required to be complied and installed in order to compile `gcc`. They are not sufficiently available through the `cygwin` package system, so we have to make them ourselves. They must be complied in this order because each one depends on the previous. Verfiy that for each package, `make check` returns all passing and no fails.
|
||||
|
||||
###Build and Install `gmp`
|
||||
```
|
||||
$ cd ~/src/gmp-6.1.0
|
||||
$ ./configure --enable-static --disable-shared
|
||||
$ make
|
||||
$ make check
|
||||
$ make install
|
||||
```
|
||||
|
||||
###Build and Install `mpfr`
|
||||
```
|
||||
$ cd ~/src/mpfr-3.1.4
|
||||
$ ./configure --with-gmp-build=../gmp-6.1.0 --enable-static --disable-shared
|
||||
$ make
|
||||
$ make check
|
||||
$ make install
|
||||
```
|
||||
|
||||
###Build and Install `mpc`
|
||||
```
|
||||
$ cd ~/src/mpc-1.0.3
|
||||
$ ./configure --with-gmp=/usr/local --with-mpfr=/usr/local --enable-static --disable-shared
|
||||
$ make
|
||||
$ make check
|
||||
$ make install
|
||||
```
|
||||
|
||||
##OPTIONAL Part
|
||||
You can build and install a brand new `gcc` or you can use the one supplied by `cygwin`. This will take about 4-5 hours to compile (It is a "native build", so it does the entire build **3 times**. This takes a long while).
|
||||
|
||||
###Build and Install `gcc` for Your Machine
|
||||
```
|
||||
$ cd ~/src/gcc-5.3.0
|
||||
$ mkdir obj-local
|
||||
$ cd obj-local
|
||||
$ ../configure --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
##End OPTIONAL Part
|
||||
|
||||
###Build and Install `binutils` for Your Machine
|
||||
```
|
||||
$ cd ~/src/binutils-2.26
|
||||
$ mkdir obj-local
|
||||
$ cd obj-local
|
||||
$ ../configure
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
##Buliding `binutils`, `gcc`, and `avr-libc` for the AVR system
|
||||
Now we can make the critical stuff for compiling our firmware: `binutils`, `gcc`, and `avr-libc` for the AVR architecture. These allow us to build and manipulate the firmware for the keyboard.
|
||||
|
||||
###Build `binutils` for AVR
|
||||
If you plan to build and install `avr-gdb` also, use the `gdb` install at the end of this guide as it also builds the `binutils`
|
||||
```
|
||||
$ cd ~/src/binutils-2.26
|
||||
$ mkdir obj-avr
|
||||
$ cd obj-avr
|
||||
$ ../configure --prefix=$PREFIX --target=avr --disable-nls
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
###Build `gcc` for AVR
|
||||
```
|
||||
$ cd ~/src/gcc-5.3.0
|
||||
$ mkdir obj-avr
|
||||
$ cd obj-avr
|
||||
$ ../configure --prefix=$PREFIX --target=avr --enable-languages=c,c++ --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --enable-static --disable-shared --disable-nls --disable-libssp --with-dwarf2
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
###Build `avr-libc` for AVR
|
||||
For building the `avr-libc`, we have to specify the host build system. In my case it is `x86_64-unknown-cygwin`. You can look for build system type in the `gcc` configure notes for the proper `--build` specification to pass when you configure `avr-libc`.
|
||||
```
|
||||
$ cd ~/src/avr-libc-2.0.0
|
||||
$ ./configure --prefix=$PREFIX --build=x86_64-unknown-cygwin --host=avr
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
##Building 'dfu-programmer' for flashing the firmware via USB and installing the drivers
|
||||
We can either build our own, or use the precomplied binaries. The precompiled binaries don't play well with `cygwin` so it is better to build them ourselves. The procedure for the precompiled binaries is included at the end of this guide.
|
||||
|
||||
### Build and Install the `libusb`
|
||||
The `dfu-programmer` requires `libusb` so that it can interact with the USB system. These repos must be bootstrapped in order to create an appropriate `./configure` and `Makefile` for your system.
|
||||
```
|
||||
$ cd ~/src
|
||||
$ git clone https://github.com/libusb/libusb.git
|
||||
$ cd libusb
|
||||
$ ./bootstrap.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
### Build and Install the `dfu-programmer`
|
||||
```
|
||||
$ cd ~/src
|
||||
$ git clone https://github.com/dfu-programmer/dfu-programmer.git
|
||||
$ cd dfu-programmer
|
||||
$ ./bootstrap.sh
|
||||
$ ./configure
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
Verify the installation with:
|
||||
```
|
||||
$ which dfu-programmer
|
||||
/usr/local/bin/dfu-programmer
|
||||
|
||||
$ dfu-programmer
|
||||
dfu-programmer 0.7.2
|
||||
https://github.com/dfu-programmer/dfu-programmer
|
||||
Type 'dfu-programmer --help' for a list of commands
|
||||
'dfu-programmer --targets' to list supported target devices
|
||||
```
|
||||
If you are not getting the above result, you will not be able to flash the firmware!
|
||||
|
||||
###Install the USB drivers
|
||||
The drivers are included in the windows binary version of [`dfu-programmer` 0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip).
|
||||
```
|
||||
$ cd ~/src
|
||||
$ wget http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip
|
||||
$ unzip dfu-programmer-win-0.7.2.zip -d dfu-programmer-win-0.7.2
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
The official drivers are found in [Atmel's `FLIP` installer](http://www.atmel.com/images/Flip%20Installer%20-%203.4.7.112.exe). Download and then install `FLIP`. Upon installation, the drivers will be found in `C:\Program Files (x86)\Atmel\Flip 3.4.7\usb`.
|
||||
|
||||
Then, from an **administrator-privileged** `Windows` terminal, run the following command (adjust the path for username, etc. as necessary) and accept the prompt that pops up:
|
||||
```
|
||||
C:\> pnputil -i -a C:\cygwin64\home\Kevin\src\dfu-programmer-win-0.7.2\dfu-prog-usb-1.2.2\atmel_usb_dfu.inf
|
||||
or
|
||||
C:\> pnputil -i -a "C:\Program Files (x86)\Atmel\Flip 3.4.7\usb\atmel_usb_dfu.inf"
|
||||
```
|
||||
|
||||
This should be the result:
|
||||
```
|
||||
Microsoft PnP Utility
|
||||
|
||||
Processing inf : atmel_usb_dfu.inf
|
||||
Successfully installed the driver on a device on the system.
|
||||
Driver package added successfully.
|
||||
Published name : oem104.inf
|
||||
|
||||
|
||||
Total attempted: 1
|
||||
Number successfully imported: 1
|
||||
```
|
||||
|
||||
Alternatively, the `Windows` driver can be installed when prompted by `Windows` when the keyboard is attached. Do not let `Windows` search for a driver; specify the path to search for a driver and point it to the `atmel_usb_dfu.inf` file.
|
||||
|
||||
##Building and Flashing the Planck firmware!
|
||||
If you did everything else right. This part should be a snap! Grab the latest sources from `github`, make the Plank firmware, then flash it.
|
||||
|
||||
###Build Planck and Load the Firmware
|
||||
```
|
||||
$ cd ~/src
|
||||
$ git clone https://github.com/qmk/qmk_firmware.git
|
||||
$ cd qmk_firmware/keyboards/planck
|
||||
$ make
|
||||
```
|
||||
|
||||
Make sure there are no errors. You should end up with this or something similar:
|
||||
```
|
||||
Creating load file for Flash: planck.hex
|
||||
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature planck.elf planck.hex
|
||||
|
||||
Creating load file for EEPROM: planck.eep
|
||||
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
|
||||
--change-section-lma .eeprom=0 --no-change-warnings -O ihex planck.elf planck.eep || exit 0
|
||||
|
||||
Creating Extended Listing: planck.lss
|
||||
avr-objdump -h -S -z planck.elf > planck.lss
|
||||
|
||||
Creating Symbol Table: planck.sym
|
||||
avr-nm -n planck.elf > planck.sym
|
||||
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
18602 82 155 18839 4997 planck.elf
|
||||
|
||||
-------- end --------
|
||||
```
|
||||
|
||||
If you do not get the above, you **did not** build the firmware, and you will have nothing to flash. If you have the fresh clone from `github`, it was probably something gone wrong in this install process, go check and see what didn't work and threw errors or what steps you might have missed.
|
||||
|
||||
But if everything went OK, you are ready to flash! Press the reset button on the bottom of the Planck, wait two seconds, then:
|
||||
```
|
||||
$ make dfu
|
||||
```
|
||||
.
|
||||
.
|
||||
.
|
||||
profit!!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
##extra bits...
|
||||
|
||||
###Installing Precompiled `dfu-programmer` Binaries (not recommended for `cygwin`)
|
||||
To install the `dfu-programmer` from the binaries, we must get if from [the `dfu-programmer` website](https://dfu-programmer.github.io/) ([0.7.2](http://iweb.dl.sourceforge.net/project/dfu-programmer/dfu-programmer/0.7.2/dfu-programmer-win-0.7.2.zip)).
|
||||
|
||||
Copy this file into your `cygwin` home\src directory. (For me, it is `C:\cygwin64\home\Kevin\src`), extract the files, move `dfu-programmer.exe` to `~/local/avr/bin`. Most obnoxiously, the `libusb0_x86.dll` and `libusb0.sys` need to be moved from `./dfu-prog-usb-1.2.2/x86/` to a directory in the `Windows` `PATH` and the `cygwin` `PATH`. This is because the `dfu-programmer` binary is `mingw` based, not `cygwin` based, so the `dlls` do not cooperate. I achieved acceptable pathing by moving the files to `C:\cygwin64\home\Kevin\local\avr\bin` Then, in a `WINDOWS` command prompt running (Adjusting your path for username, etc. as needed):
|
||||
```
|
||||
C:\> set PATH=%PATH%;C:\cygwin64\home\Kevin\local\avr\bin
|
||||
```
|
||||
|
||||
Then, rename `libusb0_x86.dll` to `libusb0.dll`.
|
||||
|
||||
You can tell that you were successful by trying to execute 'dfu-programmer' from the 'cygwin' prompt:
|
||||
```
|
||||
$ which dfu-programmer
|
||||
/home/Kevin/local/avr/bin/dfu-programmer
|
||||
|
||||
$ dfu-programmer
|
||||
dfu-programmer 0.7.2
|
||||
https://github.com/dfu-programmer/dfu-programmer
|
||||
Type 'dfu-programmer --help' for a list of commands
|
||||
'dfu-programmer --targets' to list supported target devices
|
||||
```
|
||||
|
||||
If you are not getting the above result, you will not be able to flash the firmware!
|
||||
- Try making sure your `PATH` variables are set correctly for both `Windows` and `cygwin`.
|
||||
- Make sure the `dll` is named correctly.
|
||||
- Do not extract it with `cygwin`'s `unzip` as it does not set the executable permission. If you did it anyway, do `chmod +x dfu-programmer.exe`.
|
||||
- Still have problems? Try building it instead.
|
||||
|
||||
|
||||
##Debugging Tools
|
||||
|
||||
These tools are for debugging your firmware, etc. before flashing. Theoretically, it can save your memory from wearing out. However, these tool do not work 100% for the Planck firmware.
|
||||
|
||||
### `gdb` for AVR
|
||||
`gdb` has a simulator for AVR but it does not support all instructions (like WDT), so it immediately crashes when running the Planck firmware (because `lufa.c` disables the WDT in the first few lines of execution). But it can still be useful in debugging example code and test cases, if you know how to use it.
|
||||
|
||||
```
|
||||
$ cd ~/src
|
||||
$ git clone git://sourceware.org/git/binutils-gdb.git
|
||||
$ cd binutils-gdb
|
||||
$ mkdir obj-avr
|
||||
$ cd obj-avr
|
||||
$ ../configure --prefix=$PREFIX --target=avr --build=x86_64-unknown-cygwin --with-gmp=/usr/local --with-mpfr=/usr/local --with-mpc=/usr/local --disable-nls --enable-static
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
### `simulavr`
|
||||
`simulavr` is an AVR simulator. It runs the complied AVR elfs. `simulavr` does not support the `atmega32u4` device... it does `atmega32` but that is not good enough for the firmware (no PORTE and other things), so you cannot run the Planck firmware. I use it to simulate ideas I have for features in separate test projects.
|
||||
|
||||
This one is a major pain in the butt because it has a lot of dependencies and it is buggy. I will do my best to explain it but... it was hard to figure out. A few things need to be changed in the 'Makefile' to make it work in `cygwin`.
|
||||
|
||||
|
||||
```
|
||||
$ cd ~/src
|
||||
$ git clone https://github.com/Traumflug/simulavr.git
|
||||
$ cd simulavr
|
||||
$ ./bootstrap
|
||||
$ ./configure --prefix=$PREFIX --enable-static --disable-tcl --disable-doxygen-doc
|
||||
```
|
||||
Edit `src/Makefile.am` now so that `-no-undefined` is included (I did this by removing the SYS_MINGW conditional surrounding `libsim_la_LDFLAGS += -no-undefined` and `libsimulavr_la_LDFLAGS += -no-undefined \ libsimulavr_la_LIBADD += $(TCL_LIB)`. Also, `$(EXEEXT)` is added after `kbdgentables` in two places.
|
||||
|
||||
```
|
||||
$ make
|
||||
$ make install
|
||||
```
|
||||
|
||||
|
||||
TODO:
|
||||
- git repos for all sources
|
||||
- command line magic for cygwin setup
|
||||
- better options for `dfu-drivers`
|
@ -1,7 +0,0 @@
|
||||
Understanding the essential changes made on the [tmk_keyboard firmware](http://github.com/tmk/tmk_keyboard) should help you understand the QMK Firmware.
|
||||
|
||||
| Firmware |TMK |QMK |
|
||||
|------------------------------|-----------------------|-------------------------|
|
||||
| Maintainer |hasu (@tmk) |Jack Humbert et al. |
|
||||
| Build path customization | `TMK_DIR = ...` | `include .../Makefile` |
|
||||
| `keymaps` array data | 3D array of `uint8_t` holding **keycode** | 3D array of `uint16_t` holding **keycode** |
|
@ -0,0 +1,39 @@
|
||||
# Documentation Best Practices
|
||||
|
||||
This page exists to document best practices when writing documentation for QMK. Following these guidelines will help to keep a consistent tone and style, which will in turn help other people more easily understand QMK.
|
||||
|
||||
# Page Opening
|
||||
|
||||
Your documentation page should generally start with an H1 heading, followed by a 1 paragrah description of what the user will find on this page. Keep in mind that this heading and paragraph will sit next to the Table of Contents, so keep the heading short and avoid long strings with no whitespace.
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
# My Page Title
|
||||
|
||||
This page covers my super cool feature. You can use this feature to make coffee, squeeze fresh oj, and have an egg mcmuffin and hashbrowns delivered from your local macca's by drone.
|
||||
```
|
||||
|
||||
# Headings
|
||||
|
||||
Your page should generally have multiple "H1" headings. Only H1 and H2 headings will included in the Table of Contents, so plan them out appropriately. Excess width should be avoided in H1 and H2 headings to prevent the Table of Contents from getting too wide.
|
||||
|
||||
# Styled Hint Blocks
|
||||
|
||||
You can have styled hint blocks drawn around text to draw attention to it.
|
||||
|
||||
{% hint style='info' %}
|
||||
This uses `hint style='info'`
|
||||
{% endhint %}
|
||||
|
||||
{% hint style='tip' %}
|
||||
This uses `hint style='tip'`
|
||||
{% endhint %}
|
||||
|
||||
{% hint style='danger' %}
|
||||
This uses `hint style='danger'`
|
||||
{% endhint %}
|
||||
|
||||
{% hint style='working' %}
|
||||
This uses `hint style='working'`
|
||||
{% endhint %}
|
@ -1,64 +0,0 @@
|
||||
# WARNING: Until issue [#173](https://github.com/tmk/tmk_keyboard/issues/173) goes through, the [core][1] repository will not be up-to-date with the latest changes and fixes, but can still be used.
|
||||
|
||||
If you want to use TMK for your own keyboard project, you've got three options for embedding the [core][1].
|
||||
The recommended option is [subtrees](#1-git-subtree).
|
||||
|
||||
After adding the embed you'll need to [modify the Makefile](#modifications-to-the-makefile) of your project to point to the core correctly.
|
||||
|
||||
## 1. git subtree
|
||||
|
||||
In order to set up the subtree in your project, first add the core repository as a remote:
|
||||
```
|
||||
git remote add -f core https://github.com/tmk/tmk_core
|
||||
```
|
||||
|
||||
Then add the core as a subtree (directory) in your local repository:
|
||||
```
|
||||
git subtree add -P tmk_core core master --squash
|
||||
```
|
||||
|
||||
And that's it!
|
||||
|
||||
When you want to update the subtree in your repository to match the master on [tmk_core][1], do this:
|
||||
```
|
||||
git subtree pull -P tmk_core core master --squash
|
||||
```
|
||||
|
||||
## 2. git submodule
|
||||
|
||||
In order to set up the submodule in your project, first add a new submodule:
|
||||
```
|
||||
git submodule add https://github.com/tmk/tmk_core tmk_core
|
||||
```
|
||||
|
||||
Then pull, sync and update the submodule:
|
||||
```
|
||||
git pull
|
||||
git submodule sync --recursive
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
And that's it!
|
||||
|
||||
When you want to update the subtree in your repository to match the master on [tmk_core][1], follow the same steps as above.
|
||||
|
||||
If you want to clone a repository from GitHub that has submodule(s) in it, pass <kbd>--recursive</kbd> when cloning, like so:
|
||||
`git clone --recursive https://github.com/<username>/<repository>`
|
||||
|
||||
## 3. Manually (without git)
|
||||
|
||||
*Note: This is not recommended in any way, but it's still possible.*
|
||||
|
||||
Download a zipped version of the [tmk_core][1] repository using this link:
|
||||
<https://github.com/tmk/tmk_core/archive/master.zip>
|
||||
|
||||
Extract the zip in your project's directory, then rename the folder to <kbd>tmk_core</kbd>.
|
||||
|
||||
## Modifications to the *Makefile*
|
||||
|
||||
The one thing you have to make sure to change in the *Makefile* (compared to [tmk_keyboard](https://github.com/tmk/tmk_keyboard) drivers' *[Makefile](https://github.com/tmk/tmk_keyboard/blob/master/keyboard/gh60/Makefile#L45)*) is the "TMK_DIR" variable, which needs to point to the embed directory:
|
||||
```Makefile
|
||||
TMK_DIR = ./tmk_core
|
||||
```
|
||||
|
||||
[1]: https://github.com/tmk/tmk_core
|
@ -0,0 +1,105 @@
|
||||
# QMK Features
|
||||
|
||||
|
||||
## Space Cadet Shift: The future, built in
|
||||
|
||||
Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](space_cadet_shift.md) page to read about it.
|
||||
|
||||
## The Leader key: A new kind of modifier
|
||||
|
||||
Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](leader_key.md) page.
|
||||
|
||||
## Tap Dance: A single key can do 3, 5, or 100 different things
|
||||
|
||||
Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](tap_dance.md) page.
|
||||
|
||||
## Temporarily setting the default layer
|
||||
|
||||
`DF(layer)` - sets default layer to _layer_. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
|
||||
|
||||
## Macro shortcuts: Send a whole string when pressing just one key
|
||||
|
||||
How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](macros.md) page to read up on all aspects of Simple and Dynamic Macros.
|
||||
|
||||
## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\)
|
||||
|
||||
Everything is assuming you're in Qwerty \(in software\) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
|
||||
|
||||
```
|
||||
#include <keymap_colemak.h>
|
||||
```
|
||||
|
||||
If you use Dvorak, use `keymap_dvorak.h` instead of `keymap_colemak.h` for this line. After including this line, you will get access to:
|
||||
|
||||
* `CM_*` for all of the Colemak-equivalent characters
|
||||
* `DV_*` for all of the Dvorak-equivalent characters
|
||||
|
||||
These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features.
|
||||
|
||||
To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F`. Using `KC_F` under these same circumstances would result in `T`.
|
||||
|
||||
## Backlight Breathing
|
||||
|
||||
In order to enable backlight breathing, the following line must be added to your config.h file.
|
||||
|
||||
```
|
||||
#define BACKLIGHT_BREATHING
|
||||
```
|
||||
|
||||
The following function calls are used to control the breathing effect.
|
||||
|
||||
* `breathing_enable()` - Enable the free-running breathing effect.
|
||||
* `breathing_disable()` - Disable the free-running breathing effect immediately.
|
||||
* `breathing_self_disable()` - Disable the free-running breathing effect after the current effect ends.
|
||||
* `breathing_toggle()` - Toggle the free-running breathing effect.
|
||||
* `breathing_defaults()` - Reset the speed and brightness settings of the breathing effect.
|
||||
|
||||
The following function calls are used to control the maximum brightness of the breathing effect.
|
||||
|
||||
* `breathing_intensity_set(value)` - Set the brightness of the breathing effect when it is at its max value.
|
||||
* `breathing_intensity_default()` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
|
||||
|
||||
The following function calls are used to control the cycling speed of the breathing effect.
|
||||
|
||||
* `breathing_speed_set(value)` - Set the speed of the breathing effect - how fast it cycles.
|
||||
* `breathing_speed_inc(value)` - Increase the speed of the breathing effect by a fixed value.
|
||||
* `breathing_speed_dec(value)` - Decrease the speed of the breathing effect by a fixed value.
|
||||
* `breathing_speed_default()` - Reset the speed of the breathing effect to the default value.
|
||||
|
||||
The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
|
||||
|
||||
```
|
||||
case MACRO_FUNCTION:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
breathing_speed_set(3);
|
||||
breathing_enable();
|
||||
layer_on(LAYER_FUNCTION);
|
||||
}
|
||||
else
|
||||
{
|
||||
breathing_speed_set(1);
|
||||
breathing_self_disable();
|
||||
layer_off(LAYER_FUNCTION);
|
||||
}
|
||||
break;
|
||||
```
|
||||
|
||||
The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
|
||||
|
||||
```
|
||||
case MACRO_RAISED:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
layer_on(LAYER_RAISED);
|
||||
breathing_speed_set(2);
|
||||
breathing_pulse();
|
||||
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
|
||||
}
|
||||
else
|
||||
{
|
||||
layer_off(LAYER_RAISED);
|
||||
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
|
||||
}
|
||||
break;
|
||||
```
|
@ -1,7 +0,0 @@
|
||||
## Update core branch procedure
|
||||
git co master
|
||||
git subtree split -P tmk_core -b <tmp_branch>
|
||||
git co core
|
||||
git merge <tmp_branch>
|
||||
git co master
|
||||
git subtree merge -P tmk_core --squash
|
@ -0,0 +1,29 @@
|
||||
# Glossary of QMK terms
|
||||
|
||||
## Dynamic Macro
|
||||
A macro which has been recorded on the keyboard and which will be lost when the keyboard is unplugged or the computer rebooted.
|
||||
|
||||
## git
|
||||
Versioning software used at the commandline
|
||||
|
||||
## Keycode
|
||||
A 2-byte number that represents a particular key. `0x00`-`0xFF` are used for [Basic Keycodes](keycodes.html) while `0x100`-`0xFFFF` are used for [Quantum Keycodes](quantum_keycodes.html).
|
||||
|
||||
## Keymap
|
||||
An array of keycodes mapped to a physical keyboard layout, which are processed on key presses and releases
|
||||
|
||||
## Matrix
|
||||
A wiring pattern of columns and rows (and usually diodes) that enables the MCU to detect keypresses with a fewer number of pins
|
||||
|
||||
## Macro
|
||||
A feature that lets you send muiltple keypress events (hid reports) after having pressed only a single key.
|
||||
|
||||
## Mousekeys
|
||||
A feature that lets you control your mouse cursor and click from your keyboard.
|
||||
|
||||
* [Mousekeys Documentation](mouse_keys.html)
|
||||
|
||||
## Tap Dance
|
||||
A feature that lets you assign muiltple keycodes to the same key based on how many times you press it.
|
||||
|
||||
* [Tap Dance Documentation](tap_dance.html)
|
@ -1,5 +0,0 @@
|
||||
# Alternative Controller for HHKB
|
||||
|
||||
* [Geekhack.org thread](https://geekhack.org/index.php?topic=12047.0)
|
||||
|
||||
* [Connector unmate](https://geekhack.org/index.php?topic=12047.msg1543860#msg1543860)
|
@ -1,134 +0,0 @@
|
||||
# Quantum Mechanical Keyboard Firmware
|
||||
|
||||
You have found the QMK Firmware documentation site. This is a keyboard firmware based on the [tmk\_keyboard firmware](http://github.com/tmk/tmk_keyboard) \([view differences](differences_from_tmk.md)\) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB.
|
||||
|
||||
# Getting started
|
||||
|
||||
Before you are able to compile, you'll need to install an environment for AVR or ARM development. You'll find the instructions for any OS below. If you find another/better way to set things up from scratch, please consider [making a pull request](https://github.com/qmk/qmk_firmware/pulls) with your changes!
|
||||
|
||||
* [Build Environment Setup](build_environment_setup.md)
|
||||
* [QMK Overview](qmk_overview.md)
|
||||
|
||||
# Configuring QMK Firmware
|
||||
|
||||
The QMK Firmware can be configured via the `keymaps` array data. For simply generating a [basic keycode](keycodes.md), you add it as an element of your `keymaps` array data. For more complicated actions, there are more advanced keycodes that are organized carefully to represent common operations, some of which can be found on the [Key Functions](key_functions.md) page.
|
||||
|
||||
For more details of the `keymaps` array, see [Keymap Overview](keymap.md) page.
|
||||
|
||||
## Space Cadet Shift: The future, built in
|
||||
|
||||
Steve Losh [described](http://stevelosh.com/blog/2012/10/a-modern-space-cadet/) the Space Cadet Shift quite well. Essentially, you hit the left Shift on its own, and you get an opening parenthesis; hit the right Shift on its own, and you get the closing one. When hit with other keys, the Shift key keeps working as it always does. Yes, it's as cool as it sounds. Head on over to the [Space Cadet Shift](space_cadet_shift.md) page to read about it.
|
||||
|
||||
## The Leader key: A new kind of modifier
|
||||
|
||||
Most modifiers have to be held or toggled. But what if you had a key that indicated the start of a sequence? You could press that key and then rapidly press 1-3 more keys to trigger a macro, or enter a special layer, or anything else you might want to do. To learn more about it check out the [Leader Key](leader_key.md) page.
|
||||
|
||||
## Tap Dance: A single key can do 3, 5, or 100 different things
|
||||
|
||||
Hit the semicolon key once, send a semicolon. Hit it twice, rapidly -- send a colon. Hit it three times, and your keyboard's LEDs do a wild dance. That's just one example of what Tap Dance can do. Read more about it on the [Tap Dance](tap_dance.md) page.
|
||||
|
||||
## Temporarily setting the default layer
|
||||
|
||||
`DF(layer)` - sets default layer to _layer_. The default layer is the one at the "bottom" of the layer stack - the ultimate fallback layer. This currently does not persist over power loss. When you plug the keyboard back in, layer 0 will always be the default. It is theoretically possible to work around that, but that's not what `DF` does.
|
||||
|
||||
## Macro shortcuts: Send a whole string when pressing just one key
|
||||
|
||||
How would you like a single keypress to send a whole word, sentence, paragraph, or even document? Head on over to the [Macros](macros.md) page to read up on all aspects of Simple and Dynamic Macros.
|
||||
|
||||
## Additional keycode aliases for software-implemented layouts \(Colemak, Dvorak, etc\)
|
||||
|
||||
Everything is assuming you're in Qwerty \(in software\) by default, but there is built-in support for using a Colemak or Dvorak layout by including this at the top of your keymap:
|
||||
|
||||
```
|
||||
#include <keymap_colemak.h>
|
||||
```
|
||||
|
||||
If you use Dvorak, use `keymap_dvorak.h` instead of `keymap_colemak.h` for this line. After including this line, you will get access to:
|
||||
|
||||
* `CM_*` for all of the Colemak-equivalent characters
|
||||
* `DV_*` for all of the Dvorak-equivalent characters
|
||||
|
||||
These implementations assume you're using Colemak or Dvorak on your OS, not on your keyboard - this is referred to as a software-implemented layout. If your computer is in Qwerty and your keymap is in Colemak or Dvorak, this is referred to as a firmware-implemented layout, and you won't need these features.
|
||||
|
||||
To give an example, if you're using software-implemented Colemak, and want to get an `F`, you would use `CM_F`. Using `KC_F` under these same circumstances would result in `T`.
|
||||
|
||||
## Backlight Breathing
|
||||
|
||||
In order to enable backlight breathing, the following line must be added to your config.h file.
|
||||
|
||||
```
|
||||
#define BACKLIGHT_BREATHING
|
||||
```
|
||||
|
||||
The following function calls are used to control the breathing effect.
|
||||
|
||||
* `breathing_enable()` - Enable the free-running breathing effect.
|
||||
* `breathing_disable()` - Disable the free-running breathing effect immediately.
|
||||
* `breathing_self_disable()` - Disable the free-running breathing effect after the current effect ends.
|
||||
* `breathing_toggle()` - Toggle the free-running breathing effect.
|
||||
* `breathing_defaults()` - Reset the speed and brightness settings of the breathing effect.
|
||||
|
||||
The following function calls are used to control the maximum brightness of the breathing effect.
|
||||
|
||||
* `breathing_intensity_set(value)` - Set the brightness of the breathing effect when it is at its max value.
|
||||
* `breathing_intensity_default()` - Reset the brightness of the breathing effect to the default value based on the current backlight intensity.
|
||||
|
||||
The following function calls are used to control the cycling speed of the breathing effect.
|
||||
|
||||
* `breathing_speed_set(value)` - Set the speed of the breathing effect - how fast it cycles.
|
||||
* `breathing_speed_inc(value)` - Increase the speed of the breathing effect by a fixed value.
|
||||
* `breathing_speed_dec(value)` - Decrease the speed of the breathing effect by a fixed value.
|
||||
* `breathing_speed_default()` - Reset the speed of the breathing effect to the default value.
|
||||
|
||||
The following example shows how to enable the backlight breathing effect when the FUNCTION layer macro button is pressed:
|
||||
|
||||
```
|
||||
case MACRO_FUNCTION:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
breathing_speed_set(3);
|
||||
breathing_enable();
|
||||
layer_on(LAYER_FUNCTION);
|
||||
}
|
||||
else
|
||||
{
|
||||
breathing_speed_set(1);
|
||||
breathing_self_disable();
|
||||
layer_off(LAYER_FUNCTION);
|
||||
}
|
||||
break;
|
||||
```
|
||||
|
||||
The following example shows how to pulse the backlight on-off-on when the RAISED layer macro button is pressed:
|
||||
|
||||
```
|
||||
case MACRO_RAISED:
|
||||
if (record->event.pressed)
|
||||
{
|
||||
layer_on(LAYER_RAISED);
|
||||
breathing_speed_set(2);
|
||||
breathing_pulse();
|
||||
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
|
||||
}
|
||||
else
|
||||
{
|
||||
layer_off(LAYER_RAISED);
|
||||
update_tri_layer(LAYER_LOWER, LAYER_RAISED, LAYER_ADJUST);
|
||||
}
|
||||
break;
|
||||
```
|
||||
|
||||
## Other firmware shortcut keycodes
|
||||
|
||||
* `RESET` - puts the MCU in DFU mode for flashing new firmware \(with `make dfu`\)
|
||||
* `DEBUG` - the firmware into debug mode - you'll need hid\_listen to see things
|
||||
* `BL_ON` - turns the backlight on
|
||||
* `BL_OFF` - turns the backlight off
|
||||
* `BL_<n>` - sets the backlight to level _n_
|
||||
* `BL_INC` - increments the backlight level by one
|
||||
* `BL_DEC` - decrements the backlight level by one
|
||||
* `BL_TOGG` - toggles the backlight
|
||||
* `BL_STEP` - steps through the backlight levels
|
||||
|
||||
Enable the backlight from the Makefile.
|
||||
|
@ -0,0 +1,63 @@
|
||||
# How to use Github with QMK
|
||||
|
||||
Github can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
|
||||
{% hint style='info' %}
|
||||
This guide assumes you're somewhat comfortable with running things at the command line, and have git installed on your system.
|
||||
{% endhint %}
|
||||
|
||||
Start on the [QMK Github page](https://github.com/qmk/qmk_firmware), and you'll see a button in the upper right that says "Fork":
|
||||
|
||||
![Fork on Github](http://i.imgur.com/8Toomz4.jpg)
|
||||
|
||||
If you're apart of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
|
||||
|
||||
![Download from Github](http://i.imgur.com/N1NYcSz.jpg)
|
||||
|
||||
And be sure to select "HTTPS", and select the link and copy it:
|
||||
|
||||
![HTTPS link](http://i.imgur.com/eGO0ohO.jpg)
|
||||
|
||||
From here, enter `git clone ` into the command line, and then paste your link:
|
||||
|
||||
```
|
||||
**[terminal]
|
||||
**[prompt you@computer]**[path ~]**[delimiter $ ]**[command git clone https://github.com/whoeveryouare/qmk_firmware.git]
|
||||
Cloning into 'qmk_firmware'...
|
||||
remote: Counting objects: 46625, done.
|
||||
remote: Compressing objects: 100% (2/2), done.
|
||||
remote: Total 46625 (delta 0), reused 0 (delta 0), pack-reused 46623
|
||||
Receiving objects: 100% (46625/46625), 84.47 MiB | 3.14 MiB/s, done.
|
||||
Resolving deltas: 100% (29362/29362), done.
|
||||
Checking out files: 100% (2799/2799), done.
|
||||
```
|
||||
|
||||
You now have your QMK fork on your local machine, and you can add your keymap, compile it and flash it to your board. Once you're happy with your changes, you can add, commit, and push them to your fork like this:
|
||||
|
||||
```
|
||||
**[terminal]
|
||||
**[prompt you@computer]**[path ~/qmk_firmware]**[delimiter $ ]**[command git add .]
|
||||
**[prompt you@computer]**[path ~/qmk_firmware]**[delimiter $ ]**[command git commit -m "adding my keymap"]
|
||||
[master cccb1608] adding my keymap
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 keyboards/planck/keymaps/mine/keymap.c
|
||||
**[prompt you@computer]**[path ~/qmk_firmware]**[delimiter $ ]**[command git push]
|
||||
Counting objects: 1, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (1/1), done.
|
||||
Writing objects: 100% (1/1), 1.64 KiB | 0 bytes/s, done.
|
||||
Total 1 (delta 1), reused 0 (delta 0)
|
||||
remote: Resolving deltas: 100% (1/1), completed with 1 local objects.
|
||||
To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
Your changes now exist on your fork on Github - if you go back there (https://github.com/<whoeveryouare>/qmk_firmware), you can create a "New Pull Request" by clicking this button:
|
||||
|
||||
![New Pull Request](http://i.imgur.com/DxMHpJ8.jpg)
|
||||
|
||||
Here you'll be able to see exactly what you've committed - if it all looks good, you can finalize it by clicking "Create Pull Request":
|
||||
|
||||
![Create Pull Request](http://i.imgur.com/Ojydlaj.jpg)
|
||||
|
||||
After submitting, we may talk to you about your changes, ask that you make changes, and eventually accept it! Thanks for contributing to QMK :)
|
@ -1,8 +0,0 @@
|
||||
#ifndef CONFIG_USER_H
|
||||
#define CONFIG_USER_H
|
||||
|
||||
#include "../../config.h"
|
||||
|
||||
// place overrides here
|
||||
|
||||
#endif
|
@ -1,37 +0,0 @@
|
||||
# Share your keymap idea here!
|
||||
https://github.com/tmk/tmk_keyboard/issues/265
|
||||
|
||||
---
|
||||
|
||||
## Reverse-shifted for numbers
|
||||
With pressing Shift and '1' key you get **1** while with just '1' key you get **!**.
|
||||
- https://geekhack.org/index.php?topic=41989.msg1959718#msg1959718
|
||||
|
||||
|
||||
## KBT Pure layout
|
||||
Keymap code on Alps64
|
||||
https://github.com/thisisshi/tmk_keyboard/blob/15fe63e8d181a8a95988dcc71929f0024df55caa/keyboard/alps64/keymap_pure.c
|
||||
|
||||
and guide.
|
||||
https://github.com/thisisshi/tmk_keyboard/blob/77ac0805ade565fb23657e3644c920ada71edccf/keyboard/alps64/Guide.md
|
||||
|
||||
## Prevent stuck modifiers
|
||||
|
||||
Consider the following scenario:
|
||||
|
||||
1. Layer 0 has a key defined as Shift.
|
||||
2. The same key is defined on layer 1 as the letter A.
|
||||
3. User presses Shift.
|
||||
4. User switches to layer 1 for whatever reason.
|
||||
5. User releases Shift, or rather the letter A.
|
||||
6. User switches back to layer 0.
|
||||
|
||||
Shift was actually never released and is still considered pressed.
|
||||
|
||||
If such situation bothers you add this to your `config.h`:
|
||||
|
||||
#define PREVENT_STUCK_MODIFIERS
|
||||
|
||||
This option uses 5 bytes of memory per every 8 keys on the keyboard
|
||||
rounded up (5 bits per key). For example on Planck (48 keys) it uses
|
||||
(48/8)\*5 = 30 bytes.
|
@ -1,21 +0,0 @@
|
||||
# Build Options
|
||||
# change to "no" to disable the options, or define them in the Makefile in
|
||||
# the appropriate keymap folder that will get included automatically
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no # Audio output on port C6
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. Do not enable this with audio at the same time.
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
ifndef QUANTUM_DIR
|
||||
include ../../../../Makefile
|
||||
endif
|
@ -1,29 +0,0 @@
|
||||
== KLL vs TMK
|
||||
1. **Shift** = Memontary
|
||||
1. Latch = One shot
|
||||
1. Lock = Toggle
|
||||
|
||||
## KLL terminology
|
||||
### Fall-through
|
||||
When a key is undefined on a particular layer, the key
|
||||
definition on the previously stacked layer will be used. Eventually
|
||||
the key definition will be set to using the default layer. If the None
|
||||
keyword is used, then the fall-through will stop and no action will
|
||||
take place.
|
||||
###Latch
|
||||
When referring to keyboards, a key function that is only enabled
|
||||
until the release of the next keypress.
|
||||
###Lock
|
||||
When referring to keyboards, a key function that is enabled until
|
||||
that key is pressed again (e.g. Caps Lock).
|
||||
### NKRO
|
||||
N-Key Rollover is the capability to press N number of keys at the
|
||||
same time on a keyboard and have them all register on the OS simultaneously.
|
||||
### Scan Code
|
||||
Row x Column code or native protocol code used by the keyboard.
|
||||
### Shift
|
||||
When referring to keyboards, a key function that is enabled while
|
||||
that key is held.
|
||||
### USB Code
|
||||
Keyboard Press/Release codes as defined by the USB HID
|
||||
Spec.
|
@ -1,38 +0,0 @@
|
||||
# Overview
|
||||
|
||||
As raised in #1038 and other issues, the licensing status of QMK is not clear. In an effort to remove ambiguity and to clarify the licensing status of the quantum code we are identifying the providence of our source code files and clarifying what license applies to each one.
|
||||
|
||||
# Signoff
|
||||
|
||||
This section documents the people who need to sign off on applying the GPL to one or more of their contributions. If your name appears below and you consent to applying the GPL to your contributions, please put today's date in the last field of your row. Please stick to the following date format: 2017 Jan 28
|
||||
|
||||
Username | Files | Sign Off Date |
|
||||
---------|-------|---------------|
|
||||
@0xdec | quantum/rgblight.c | 2017 Jan 29 |
|
||||
@algernon | quantum/quantum.c<br>quantum/quantum.h<br>quantum/process_keycode/process_tap_dance.c<br>quantum/process_keycode/process_tap_dance.h<br>quantum/process_keycode/process_unicode.c<br>quantum/process_keycode/process_unicode.h | 2017 Jan 29 |
|
||||
@cdlm | quantum/template/template.c<br>quantum/template/template.h | 2017 Feb 03 |
|
||||
@DidierLoiseau | quantum/keymap_extras/keymap_canadian_multilingual.h<br>quantum/keymap_extras/keymap_bepo.h |2017 Jan 29 |
|
||||
@eltang | quantum/config_common.h<br>quantum/matrix.c<br>quantum/quantum.c<br>quantum/quantum.h<br>quantum/rgblight.c<br>quantum/rgblight.h<br>quantum/template/config.h | 2017 Feb 28 |
|
||||
@ezuk | quantum/matrix.c<br>quantum/quantum.c<br>quantum/quantum.h<br>quantum/quantum_keycodes.h<br>quantum/rgblight.c<br>quantum/rgblight.h<br>quantum/keymap_extras/keymap_colemak.h<br>quantum/keymap_extras/keymap_nordic.h | 2017 Jan 31 |
|
||||
@fredizzimo | quantum/config_common.h<br>quantum/keycode_config.h<br>quantum/keymap.h<br>quantum/keymap_common.c<br>quantum/keymap_common.c<br>quantum/matrix.c<br>quantum/quantum.h<br>quantum/rgblight.c<br>quantum/rgblight.h<br>quantum/api/api_sysex.c | 2017 Jan 29 |
|
||||
@h-youhei | quantum/keymap_extras/keymap_jp.h | 2017 Jan 28 |
|
||||
@heartsekai | quantum/keymap_extras/keymap_german_ch.h | 2017 Jan 29 |
|
||||
@IBnobody | quantum/keycode_config.h<br>quantum/matrix.c<br>quantum/quantum.c<br>quantum/audio/audio.c<br>quantum/audio/audio.h<br>quantum/audio/audio_pwm.c<br>quantum/audio/audio_pwm.c<br>quantum/audio/voices.c<br>quantum/audio/voices.h<br>quantum/template/config.h<br>quantum/template/template.c | 2017 Jan 30 |
|
||||
@jackhumbert | quantum/config_common.h<br>quantum/keycode_config.h<br>quantum/keymap.h<br>quantum/keymap_common.c<br>quantum/light_ws2812.c<br>quantum/light_ws2812.h<br>quantum/matrix.c<br>quantum/quantum.c<br>quantum/quantum.h<br>quantum/quantum_keycodes.h<br>quantum/rgblight.c<br>quantum/rgblight.h<br>quantum/api/api_sysex.c<br>quantum/audio/audio.c<br>quantum/audio/audio.h<br>quantum/audio/audio_pwm.c<br>quantum/audio/audio_pwm.c<br>quantum/audio/voices.c<br>quantum/audio/voices.h<br>quantum/keymap_extras/keymap_colemak.h<br>quantum/keymap_extras/keymap_dvorak.h<br>quantum/keymap_extras/keymap_fr_ch.h<br>quantum/keymap_extras/keymap_french.h<br>quantum/keymap_extras/keymap_french_osx.h<br>quantum/keymap_extras/keymap_german.h<br>quantum/keymap_extras/keymap_german_ch.h<br>quantum/keymap_extras/keymap_german_osx.h<br>quantum/keymap_extras/keymap_neo2.h<br>quantum/keymap_extras/keymap_nordic.h<br>quantum/keymap_extras/keymap_plover.h<br>quantum/keymap_extras/keymap_spanish.h<br>quantum/keymap_extras/keymap_uk.h<br>quantum/process_keycode/process_midi.c<br>quantum/process_keycode/process_music.c<br>quantum/process_keycode/process_tap_dance.c<br>quantum/process_keycode/process_tap_dance.h<br>quantum/process_keycode/process_unicode.c<br>quantum/process_keycode/process_unicode.h<br>quantum/template/config.h<br>quantum/template/template.c<br>quantum/template/template.h | 2017-01-29 |
|
||||
@jakllsch | quantum/keymap_extras/keymap_dvorak.h<br>quantum/keymap_extras/keymap_fr_ch.h<br>quantum/keymap_extras/keymap_french.h<br>quantum/keymap_extras/keymap_german.h<br>quantum/keymap_extras/keymap_german_ch.h<br>quantum/keymap_extras/keymap_nordic.h<br>quantum/keymap_extras/keymap_spanish.h<br>quantum/keymap_extras/keymap_uk.h | 2017 Jan 29 |
|
||||
kuel | quantum/keymap_extras/keymap_unicode_cyrillic.h<br>quantum/keymap_extras/keymap_russian.h | |
|
||||
@lindhe | quantum/keymap_extras/keymap_nordic.h<br>quantum/keymap_extras/keymap_norwegian.h | 2017 Jan 30 |
|
||||
@matzebond | quantum/keymap_extras/keymap_german.h<br>quantum/keymap_extras/keymap_neo2.h | 2017 Jan 30 |
|
||||
@plgruener | quantum/keymap_extras/keymap_german.h<br>quantum/keymap_extras/keymap_neo2.h | 2017 Jan 30 |
|
||||
@priyadi | quantum/quantum.c<br>quantum/process_keycode/process_unicode.c<br>quantum/process_keycode/process_unicode.h | 2017 Jan 31 |
|
||||
@pvinis | quantum/quantum.c<br>quantum/quantum.h<br>quantum/process_keycode/process_tap_dance.c<br>quantum/process_keycode/process_tap_dance.h | 2017 Jan 29 |
|
||||
@Smilliam | quantum/quantum.c | 2017 Feb 25 |
|
||||
@sperochon | quantum/keymap_extras/keymap_french_osx.h | 2017 Jan 30 |
|
||||
stephan . bosebeck at holidayinsider.com | quantum/keymap_extras/keymap_german_osx.h | 2017 Feb 15 |
|
||||
@TerryMathews | quantum/quantum.c | 2017 Jan 29 |
|
||||
@Twey | quantum/keymap_extras/keymap_plover.h | |
|
||||
@Vifon | quantum/dynamic_macro.h<br>quantum/quantum.c | 2017 Feb 09 |
|
||||
@vincent-pochet | quantum/keymap_extras/keymap_fr_ch.h | 2017 Feb 09 |
|
||||
@wez | quantum/dynamic_macro.h | 2017 Jan 29 |
|
||||
@Wilba6582 | quantum/keymap.h<br>quantum/keymap_common.c<br>quantum/quantum_keycodes.h | 2017 Feb 15 |
|
||||
@yangliu | quantum/light_ws2812.c<br>quantum/light_ws2812.h<br>quantum/rgblight.c<br>quantum/rgblight.h | 2017 Jan 30 |
|
File diff suppressed because it is too large
Load Diff
@ -1,36 +0,0 @@
|
||||
## supported projects
|
||||
### PS/2 converter
|
||||
Confirmed it works on NXP LPC11U35.
|
||||
- http://developer.mbed.org/platforms/TG-LPC11U35-501/
|
||||
|
||||
### Infinity keyboard
|
||||
It runs on Freescale MK20DX128.
|
||||
|
||||
|
||||
|
||||
## compile error: cstddef
|
||||
Experienced this with arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2 on ubuntu 14.04.
|
||||
|
||||
And resolved with 4.9.3 installed from:
|
||||
- https://launchpad.net/gcc-arm-embedded
|
||||
- https://launchpad.net/~terry.guo/+archive/ubuntu/gcc-arm-embedded
|
||||
|
||||
```
|
||||
$ make -f Makefile.mbed
|
||||
mkdir -p build/.
|
||||
arm-none-eabi-g++ -include config_mbed.h -mcpu=cortex-m0 -mthumb -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -fshort-wchar -fno-builtin -MMD -MP -DNDEBUG -Os -DTARGET_LPC11U35_401 -DTARGET_M0 -DTARGET_NXP -DTARGET_LPC11UXX -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M0 -DARM_MATH_CM0 -DMBED_BUILD_TIMESTAMP=1399108688.49 -D__MBED__=1 -std=gnu++98 -I. -I../../mbed-sdk/libraries/mbed/targets -I../../mbed-sdk/libraries/mbed/targets/cmsis -I../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP -I../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX -I../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM -I../../mbed-sdk/libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_ARM/TARGET_LPC11U35_501 -I../../mbed-sdk/libraries/mbed/targets/hal -I../../mbed-sdk/libraries/mbed/targets/hal/TARGET_NXP -I../../mbed-sdk/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX -I../../mbed-sdk/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501 -I../../mbed-sdk/libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/TARGET_MCU_LPC11U35_501/TARGET_LPC11U35_501 -I../../mbed-sdk/libraries/mbed -I../../mbed-sdk/libraries/mbed/hal -I../../mbed-sdk/libraries/mbed/api -I../../mbed-sdk/libraries/mbed/common -I../../mbed-sdk/libraries/USBDevice -I../../mbed-sdk/libraries/USBDevice/USBHID -I../../mbed-sdk/libraries/USBDevice/USBDevice -I../../mbed-sdk/libraries/USBDevice/USBAudio -I../../mbed-sdk/libraries/USBDevice/USBSerial -I../../mbed-sdk/libraries/USBDevice/USBMSD -I../../mbed-sdk/libraries/USBDevice/USBMIDI -I../../protocol/mbed -I../../common -I../../protocol -o build/./main.o main.cpp
|
||||
In file included from ../../mbed-sdk/libraries/mbed/api/mbed.h:21:0,
|
||||
from main.cpp:1:
|
||||
../../mbed-sdk/libraries/mbed/api/platform.h:25:19: fatal error: cstddef: No such file or directory
|
||||
#include <cstddef>
|
||||
^
|
||||
compilation terminated.
|
||||
make: *** [build/./main.o] Error 1
|
||||
|
||||
[13:13] noname@desk:/mnt/old_root/home/noname/tmp/tmk_keyboard/converter/ps2_usb
|
||||
$ arm-none-eabi-gcc --version
|
||||
arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
|
||||
Copyright (C) 2013 Free Software Foundation, Inc.
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
```
|
@ -1,21 +0,0 @@
|
||||
In rare circumstances, your keyboard/device can become unwritable, and `dfu-programmer` will give you an error like this:
|
||||
|
||||
Erasing flash... Success
|
||||
Checking memory from 0x0 to 0x6FFF... Empty.
|
||||
Checking memory from 0x0 to 0x607F... Empty.
|
||||
0% 100% Programming 0x6080 bytes...
|
||||
[ X ERROR
|
||||
Memory write error, use debug for more info.
|
||||
|
||||
Currently the only way to solve this is to [reprogram the chip via ISP](https://www.reddit.com/r/olkb/comments/4rjzen/flashing_error_on_mac_os_x/d52rj8o/). This requires another device to be hooked up to a couple of exposed pins on the PCB. __[We now have a guide on ISP flashing](isp_flashing_guide.md)__ and [this is where things are on the Planck PCB](http://imgur.com/lvbxbHt).
|
||||
|
||||
An example command to flash the board once things are hooked up is:
|
||||
|
||||
avrdude -c usbtiny -p m32u4 -U flash:w:planck_default_rev4.hex
|
||||
|
||||
Research is still being done on why this happens, but here are some cases:
|
||||
|
||||
* [`make -f Makefile.rn42 dfu` and not the dfu-programmer commands worked for @tybenz](https://github.com/tmk/tmk_keyboard/issues/316) - also see [the hhkb keyboard on tmk](https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hhkb)
|
||||
* [Doing a force erase works here](https://geekhack.org/index.php?topic=12047.msg1520147#msg1520147)
|
||||
* [`dfu-programmer atmega32u4 erase --force` works here as well](https://forum.fhem.de/index.php?topic=29777.0) [DE]
|
||||
* [Unresolved, but some data dumps](https://github.com/dfu-programmer/dfu-programmer/issues/29)
|
@ -1,17 +1,81 @@
|
||||
# Can I increase the speed of the mouse keys?
|
||||
# Mousekeys
|
||||
|
||||
**Q:** The default speed for controlling the mouse with the keyboard is slow. I've tried increasing the mouse's sensitivity at work using xset m and it worked, although sometimes it changes by itself for some reason. At home, on Arch Linux, this does not change ti. I've looked through the forums and resolved to use libinput using xinput but using that I only manage to change the speed of the mouse using the actual mouse. The speed of the mouse using the keyboard controls remained unchanged.
|
||||
Is there perhaps something I can input in the keymap.c to change the sensitivity? Or some other surefire way of increasing the speed?
|
||||
Thanks!
|
||||
|
||||
**A:** In your keymap's config.h:
|
||||
Mousekeys is a feature that allows you to emulate a mouse using your keyboard. You can move the pointer around, click up to 5 buttons, and even scroll in all 4 directions. QMK uses the same algorithm as the X Window System MouseKeysAccel feature. You can read more about it [on Wikipedia](https://en.wikipedia.org/wiki/Mouse_keys).
|
||||
|
||||
## Adding Mousekeys To a Keymap
|
||||
|
||||
There are two steps to adding Mousekeys support to your keyboard. You must enable support in the Makefile and you must map mouse actions to keys on your keyboard.
|
||||
|
||||
### Adding Mousekeys support in the `Makefile`
|
||||
|
||||
To add support for Mousekeys you simply need to add a single line to your keymap's `Makefile`:
|
||||
|
||||
```
|
||||
MOUSEKEY_ENABLE = yes
|
||||
```
|
||||
|
||||
You can see an example here: https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/mouse_keys/Makefile
|
||||
|
||||
### Mapping Mouse Actions To Keyboard Keys
|
||||
|
||||
You can use these keycodes within your keymap to map button presses to mouse actions:
|
||||
|
||||
|Long Name|Short Name|Description|
|
||||
|---------|----------|-----------|
|
||||
|KC_MS_UP|KC_MS_U|Mouse Cursor Up|
|
||||
|KC_MS_DOWN|KC_MS_D|Mouse Cursor Down|
|
||||
|KC_MS_LEFT|KC_MS_L|Mouse Cursor Left|
|
||||
|KC_MS_RIGHT|KC_MS_R|Mouse Cursor Right|
|
||||
|KC_MS_BTN1|KC_BTN1|Mouse Button 1|
|
||||
|KC_MS_BTN2|KC_BTN2|Mouse Button 2|
|
||||
|KC_MS_BTN3|KC_BTN3|Mouse Button 3|
|
||||
|KC_MS_BTN4|KC_BTN4|Mouse Button 4|
|
||||
|KC_MS_BTN5|KC_BTN5|Mouse Button 5|
|
||||
|KC_MS_WH_UP|KC_WH_U|Mouse Wheel Up|
|
||||
|KC_MS_WH_DOWN|KC_WH_D|Mouse Wheel Down|
|
||||
|KC_MS_WH_LEFT|KC_WH_L|Mouse Wheel Left|
|
||||
|KC_MS_WH_RIGHT|KC_WH_R|Mouse Wheel Right|
|
||||
|KC_MS_ACCEL0|KC_ACL0|Set Mouse Acceleration Speed to 0|
|
||||
|KC_MS_ACCEL1|KC_ACL1|Set Mouse Acceleration Speed to 1|
|
||||
|KC_MS_ACCEL2|KC_ACL2|Set Mouse Acceleration Speed to 2|
|
||||
|
||||
You can see an example in the `_ML` here: https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/keymaps/mouse_keys/keymap.c#L46
|
||||
|
||||
## Configuring the behavior of Mousekeys
|
||||
|
||||
The default speed for controlling the mouse with the keyboard is intentionaly slow. You can adjust these parameters by adding these settings to your keymap's `config.h` file. All times are specified in miliseconds (ms).
|
||||
|
||||
```
|
||||
#define MOUSEKEY_INTERVAL 20
|
||||
#define MOUSEKEY_DELAY 0
|
||||
#define MOUSEKEY_TIME_TO_MAX 60
|
||||
#define MOUSEKEY_MAX_SPEED 7
|
||||
#define MOUSEKEY_WHEEL_DELAY 0
|
||||
#define MOUSEKEY_DELAY 300
|
||||
#define MOUSEKEY_INTERVAL 50
|
||||
#define MOUSEKEY_MAX_SPEED 10
|
||||
#define MOUSEKEY_TIME_TO_MAX 20
|
||||
#define MOUSEKEY_WHEEL_MAX_SPEED 8
|
||||
#define MOUSEKEY_WHEEL_TIME_TO_MAX 40
|
||||
```
|
||||
|
||||
Tweak away. A lower interval or higher max speed will effectively make the mouse move faster. Time-to-max controls acceleration. (See [this Reddit thread for the original discussion](https://www.reddit.com/r/ErgoDoxEZ/comments/61fwr2/a_reliable_way_to_increase_the_speed_of_the_mouse/)).
|
||||
|
||||
### `MOUSEKEY_DELAY`
|
||||
|
||||
When one of the mouse movement buttons is pressed this setting is used to define the delay between that button press and the mouse cursor moving. Some people find that small movements are impossible if this setting is too low, while settings that are too high feel sluggish.
|
||||
|
||||
### `MOUSEKEY_INTERVAL`
|
||||
|
||||
When a movement key is held down this specifies how long to wait between each movement report. Lower settings will translate into an effectively higher mouse speed.
|
||||
|
||||
### `MOUSEKEY_MAX_SPEED`
|
||||
|
||||
As a movement key is held down the speed of the mouse cursor will increase until it reaches `MOUSEKEY_MAX_SPEED`.
|
||||
|
||||
### `MOUSEKEY_TIME_TO_MAX`
|
||||
|
||||
How long you want to hold down a movement key for until `MOUSEKEY_MAX_SPEED` is reached. This controls how quickly your cursor will accelerate.
|
||||
|
||||
### `MOUSEKEY_WHEEL_MAX_SPEED`
|
||||
|
||||
The top speed for scrolling movements.
|
||||
|
||||
### `MOUSEKEY_WHEEL_TIME_TO_MAX`
|
||||
|
||||
How long you want to hold down a scroll key for until `MOUSEKEY_WHEEL_MAX_SPEED` is reached. This controls how quickling your scrolling will accelerate.
|
@ -1,62 +0,0 @@
|
||||
Other Keyboard Firmware Projects
|
||||
================================
|
||||
## PJRC USB Keyboard/Mouse Example[USB][PJRC][Teensy][AVR]
|
||||
- <http://www.pjrc.com/teensy/usb_keyboard.html>
|
||||
- <http://www.pjrc.com/teensy/usb_mouse.html>
|
||||
|
||||
## kbupgrade[USB][V-USB][AVR]
|
||||
- <http://github.com/rhomann/kbupgrade>
|
||||
- <http://geekhack.org/showwiki.php?title=Island:8406>
|
||||
|
||||
## c64key[USB][V-USB][AVR]
|
||||
- <http://symlink.dk/projects/c64key/>
|
||||
|
||||
## rump[USB][V-USB][AVR]
|
||||
- <http://mg8.org/rump/>
|
||||
- <http://github.com/clee/rump>
|
||||
|
||||
## dulcimer[USB][V-USB][AVR]
|
||||
- <http://www.schatenseite.de/dulcimer.html>
|
||||
|
||||
## humblehacker-keyboard[USB][LUFA][AVR][Ergo]
|
||||
- <http://github.com/humblehacker>
|
||||
- <http://www.humblehacker.com/keyboard/>
|
||||
- <http://geekhack.org/showwiki.php?title=Island:6292>
|
||||
|
||||
## ps2avr[PS/2][AVR]
|
||||
- <http://sourceforge.net/projects/ps2avr/>
|
||||
|
||||
## ErgoDox[Ergo][Split][USB][AVR]
|
||||
- <http://geekhack.org/index.php?topic=22780.0>
|
||||
- <https://github.com/benblazak/ergodox-firmware>
|
||||
- <https://github.com/cub-uanic/tmk_keyboard>
|
||||
|
||||
## Suka's keyboard collection[Ergo][Split][3DPrinting][USB][AVR]
|
||||
- <http://deskthority.net/workshop-f7/my-diy-keyboard-collection-or-how-i-became-a-kb-geek-t2534.html>
|
||||
- <https://github.com/frobiac/adnw>
|
||||
|
||||
## bpiphany's AVR-Keyboard[PJRC][AVR][USB]
|
||||
- <https://github.com/BathroomEpiphanies/AVR-Keyboard>
|
||||
- <http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions>
|
||||
- <http://deskthority.net/wiki/Phantom>
|
||||
|
||||
## USB-USB keyboard remapper[converter][USB-USB][AVR][Arduino]
|
||||
- <http://forum.colemak.com/viewtopic.php?pid=10837>
|
||||
- <https://github.com/darkytoothpaste/keymapper>
|
||||
|
||||
## USB-USB converter threads[converter][USB-USB]
|
||||
- <http://deskthority.net/workshop-f7/is-remapping-a-usb-keyboard-using-teensy-possible-t2841-30.html>
|
||||
- <http://geekhack.org/index.php?topic=19458.0>
|
||||
|
||||
## kbdbabel.org[converter][vintage][protocol][8051]
|
||||
Great resource of vintage keyboard protocol information and code
|
||||
|
||||
- <http://www.kbdbabel.org/>
|
||||
|
||||
## Haata's kiibohd Controller[converter][vintage][protocol][AVR][PJRC][Cortex]
|
||||
A lots of vintage keyboard protocol supports
|
||||
|
||||
- <http://gitorious.org/kiibohd-controller>
|
||||
|
||||
## Kinesis ergonomic keyboard firmware replacement[V-USB][LUFA][Ergo]
|
||||
- <https://github.com/chrisandreae/kinesis-firmware>
|
@ -1,151 +0,0 @@
|
||||
# Planck Firmware Guide
|
||||
|
||||
## Setting up the environment
|
||||
|
||||
### Windows
|
||||
1. Install [MHV AVR Tools](https://infernoembedded.com/sites/default/files/project/MHV_AVR_Tools_20131101.exe). Disable smatch, but **be sure to leave the option to add the tools to the PATH checked**.
|
||||
2. Install [MinGW](https://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download). During installation, uncheck the option to install a graphical user interface. **DO NOT change the default installation folder.** The scripts depend on the default location.
|
||||
3. Clone this repository. [This link will download it as a zip file, which you'll need to extract.](https://github.com/qmk/qmk_firmware/archive/master.zip) Open the extracted folder in Windows Explorer.
|
||||
4. Right-click on the 1-setup-path-win batch script, select "Run as administrator", and accept the User Account Control prompt. Press the spacebar to dismiss the success message in the command prompt that pops up.
|
||||
5. Right-click on the 2-setup-environment-win batch script, select "Run as administrator", and accept the User Account Control prompt. This part may take a couple of minutes, and you'll need to approve a driver installation, but once it finishes, your environment is complete!
|
||||
|
||||
|
||||
### Mac
|
||||
|
||||
If you're using homebrew, you can use the following commands:
|
||||
|
||||
brew tap osx-cross/avr
|
||||
brew install avr-libc
|
||||
brew install dfu-programmer
|
||||
|
||||
Otherwise, these instructions will work:
|
||||
|
||||
1. Install Xcode from the App Store.
|
||||
2. Install the Command Line Tools from `Xcode->Preferences->Downloads`.
|
||||
3. Install [DFU-Programmer][dfu-prog].
|
||||
|
||||
### Linux
|
||||
1. Install AVR GCC with your favorite package manager.
|
||||
2. Install [DFU-Programmer][dfu-prog].
|
||||
|
||||
Note that, since it will be directly accessing USB hardware, the
|
||||
`dfu-programmer` program needs to be run as root.
|
||||
|
||||
## Verify Your Installation
|
||||
1. Clone the following repository: https://github.com/qmk/qmk_firmware
|
||||
2. Open a Terminal and `cd` into `qmk_firmware/keyboards/planck`
|
||||
3. Run `make`. This should output a lot of information about the build process.
|
||||
|
||||
## Using the built-in functions
|
||||
|
||||
Here is a list of some of the functions available from the command line:
|
||||
|
||||
* `make clean`: clean the environment - may be required in-between builds
|
||||
* `make`: compile the code
|
||||
* `make KEYMAP=<keymap>`: compile with the extended keymap file `extended_keymaps/extended_keymap_<keymap>.c`
|
||||
* `make dfu`: build and flash the layout to the PCB
|
||||
* `make dfu-force`: build and force-flash the layout to the PCB (may be require for first flash)
|
||||
|
||||
Generally, the instructions to flash the PCB are as follows:
|
||||
|
||||
1. Make changes to the appropriate keymap file
|
||||
2. Save the file
|
||||
3. `make clean`
|
||||
4. Press the reset button on the PCB/press the key with the `RESET` keycode
|
||||
5. `make <arguments> dfu` - use the necessary `KEYMAP=<keymap>` and/or `COMMON=true` arguments here.
|
||||
|
||||
## Troubleshooting
|
||||
If you see something like this
|
||||
|
||||
0 [main] sh 13384 sync_with_child: child 9716(0x178) died before initialization with status code 0xC0000142
|
||||
440 [main] sh 13384 sync_with_child: *** child state waiting for longjmp
|
||||
/usr/bin/sh: fork: Resource temporarily unavailable
|
||||
|
||||
after running 'make' on Windows than you are encountering a very popular issue with WinAVR on Windows 8.1 and 10.
|
||||
You can easily fix this problem by replacing msys-1.0.dll in WinAVR/utils/bin with [this one](http://www.madwizard.org/download/electronics/msys-1.0-vista64.zip).
|
||||
Restart your system and everything should work fine!
|
||||
|
||||
|
||||
If you see this
|
||||
|
||||
dfu-programmer atmega32u4 erase
|
||||
process_begin: CreateProcess(NULL, dfu-programmer atmega32u4 erase, ...) failed.
|
||||
make (e=2): The system cannot find the file specified.
|
||||
make: *** [dfu] Error 2
|
||||
|
||||
when trying to 'make dfu' on Windows you need to copy the dfu-programmer.exe to qmk_firmware/keyboards/planck.
|
||||
|
||||
|
||||
## Quantum MK Firmware
|
||||
|
||||
### Keymap
|
||||
|
||||
Unlike the other keymaps, prefixing the keycodes with `KC_` is required. A full list of the keycodes is available [here](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/doc/keycode.txt). For the keycodes available only in the extended keymap, see this [header file](https://github.com/qmk/qmk_firmware/blob/master/quantum/keymap_common.h).
|
||||
|
||||
You can use modifiers with keycodes like this:
|
||||
|
||||
LCTL(KC_C)
|
||||
|
||||
Which will generate Ctrl+c. These are daisy-chainable, meaning you can do things like:
|
||||
|
||||
LCTL(LALT(KC_C))
|
||||
|
||||
That will generate Ctrl+Alt+c. The entire list of these functions is here:
|
||||
|
||||
* `LCTL()`: Left control
|
||||
* `LSFT()` / `S()`: Left shift
|
||||
* `LALT()`: Left alt/opt
|
||||
* `LGUI()`: Left win/cmd
|
||||
* `RCTL()`: Right control
|
||||
* `RSFT()`: Right shift
|
||||
* `RALT()`: Right alt/opt
|
||||
* `RGUI()`: Right win/cmd
|
||||
|
||||
`S(KC_1)`-like entries are useful in writing keymaps for the Planck.
|
||||
|
||||
### Other keycodes
|
||||
|
||||
A number of other keycodes have been added that you may find useful:
|
||||
|
||||
* `CM_<key>`: the Colemak equivalent of a key (in place of `KC_<key>`), when using Colemak in software (`CM_O` generates `KC_SCLN`)
|
||||
* `RESET`: jump to bootloader for flashing (same as press the reset button)
|
||||
* `BL_STEP`: step through the backlight brightnesses
|
||||
* `BL_<0-15>`: set backlight brightness to 0-15
|
||||
* `BL_DEC`: lower the backlight brightness
|
||||
* `BL_INC`: raise the backlight brightness
|
||||
* `BL_TOGG`: toggle the backlight on/off
|
||||
|
||||
### Function layers
|
||||
|
||||
The extended keymap extends the number of function layers from 32 to the near-infinite value of 256. Rather than using `FN<num>` notation (still available, but limited to `FN0`-`FN31`), you can use the `FUNC(<num>)` notation. `F(<num>)` is a shortcut for this.
|
||||
|
||||
The function actions are unchanged, and you can see the full list of them [here](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action_code.h). They are explained in detail [here](keymap.md#2-action).
|
||||
|
||||
### Macros
|
||||
|
||||
Macros have been setup in the `keymaps/keymap_default.c` file so that you can use `M(<num>)` to access a macro in the `action_get_macro` section on your keymap. The switch/case structure you see here is required, and is setup for `M(0)` - you'll need to copy and paste the code to look like this (e.g. to support `M(3)`):
|
||||
|
||||
switch(id) {
|
||||
case 0:
|
||||
return MACRODOWN(TYPE(KC_A), END);
|
||||
break;
|
||||
case 1:
|
||||
return MACRODOWN(TYPE(KC_B), END);
|
||||
break;
|
||||
case 2:
|
||||
return MACRODOWN(TYPE(KC_C), END);
|
||||
break;
|
||||
case 3:
|
||||
return MACRODOWN(TYPE(KC_D), END);
|
||||
break;
|
||||
}
|
||||
return MACRO_NONE;
|
||||
|
||||
`MACRODOWN()` is a shortcut for `(record->event.pressed ? MACRO(__VA_ARGS__) : MACRO_NONE)` which tells the macro to execute when the key is pressed. Without this, the macro will be executed on both the down and up stroke.
|
||||
|
||||
[cygwin]: https://www.cygwin.com/
|
||||
[mingw]: http://www.mingw.org/
|
||||
[mhv]: https://infernoembedded.com/products/avr-tools
|
||||
[winavr]: http://winavr.sourceforge.net/
|
||||
[crosspack]: http://www.obdev.at/products/crosspack/index.html
|
||||
[dfu-prog]: http://dfu-programmer.sourceforge.net/
|
@ -1,14 +0,0 @@
|
||||
= Previously Asked Questions
|
||||
:toc:
|
||||
:toc-placement: preamble
|
||||
|
||||
toc::[]
|
||||
|
||||
= Question thread
|
||||
http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html
|
||||
|
||||
= Questions
|
||||
== Columns beyond 16(uint16_t) cannot be read
|
||||
* https://github.com/tmk/tmk_keyboard/wiki/FAQ#cant-read-comlumn-of-matrix-beyond-16
|
||||
* http://deskthority.net/workshop-f7/how-to-build-your-very-own-keyboard-firmware-t7177-270.html#p247051
|
||||
* http://deskthority.net/workshop-f7/rebuilding-and-redesigning-a-classic-thinkpad-keyboard-t6181-60.html#p146279
|
@ -0,0 +1,353 @@
|
||||
# Quantum Keycodes
|
||||
|
||||
All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within your `keymap.c` it may look like you have functions and other special cases, but ultimately the C preprocessor will translate those into a single 4 byte integer. QMK has reserved `0x0000` through `0x00FF` for standard keycodes. These are keycodes such as `KC_A`, `KC_1`, and `KC_LCTL`, which are basic keys defined in the USB HID specification.
|
||||
|
||||
On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are used to implement advanced quantum features. If you define your own custom keycodes they will be put into this range as well. Keycodes above `0x00FF` may not be used with any of the mod/layer-tap keys listed
|
||||
|
||||
## QMK keycodes
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`RESET`|Put the keyboard into DFU mode for flashing|
|
||||
|`DEBUG`|Toggles debug mode|
|
||||
|`KC_GESC`/`GRAVE_ESC`|Acts as escape when pressed normally but when pressed with Shift or GUI will send a `~`|
|
||||
|`KC_LSPO`|Left shift when held, open paranthesis when tapped|
|
||||
|`KC_RSPC`|Right shift when held, close paranthesis when tapped|
|
||||
|`KC_LEAD`|The [leader key](leader_key.md)|
|
||||
|`FUNC(n)`/`F(n)`|Call `fn_action(n)`|
|
||||
|`M(n)`|to call macro n|
|
||||
|`MACROTAP(n)`|to macro-tap n idk FIXME|
|
||||
|
||||
## Bootmagic Keycodes
|
||||
|
||||
Shortcuts for bootmagic options (these work even when bootmagic is off.)
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`MAGIC_SWAP_CONTROL_CAPSLOCK`|Swap Capslock and Left Control|
|
||||
|`MAGIC_CAPSLOCK_TO_CONTROL`|Treat Capslock like a Control Key|
|
||||
|`MAGIC_SWAP_LALT_LGUI`|Swap the left Alt and GUI keys|
|
||||
|`MAGIC_SWAP_RALT_RGUI`|Swap the right Alt and GUI keys|
|
||||
|`MAGIC_NO_GUI`|Disable the GUI key|
|
||||
|`MAGIC_SWAP_GRAVE_ESC`|Swap the Grave and Esc key.|
|
||||
|`MAGIC_SWAP_BACKSLASH_BACKSPACE`|Swap backslack and backspace|
|
||||
|`MAGIC_HOST_NKRO`|Force NKRO on|
|
||||
|`MAGIC_SWAP_ALT_GUI`/`AG_SWAP`|Swap Alt and Gui on both sides|
|
||||
|`MAGIC_UNSWAP_CONTROL_CAPSLOCK`|Disable the Control/Capslock swap|
|
||||
|`MAGIC_UNCAPSLOCK_TO_CONTROL`|Disable treating Capslock like Control |
|
||||
|`MAGIC_UNSWAP_LALT_LGUI`|Disable Left Alt and GUI switching|
|
||||
|`MAGIC_UNSWAP_RALT_RGUI`|Disable Right Alt and GUI switching|
|
||||
|`MAGIC_UNNO_GUI`|Enable the GUI key |
|
||||
|`MAGIC_UNSWAP_GRAVE_ESC`|Disable the Grave/Esc swap |
|
||||
|`MAGIC_UNSWAP_BACKSLASH_BACKSPACE`|Disable the backslash/backspace swap|
|
||||
|`MAGIC_UNHOST_NKRO`|Force NKRO off|
|
||||
|`MAGIC_UNSWAP_ALT_GUI`/`AG_NORM`|Disable the Alt/GUI switching|
|
||||
|`MAGIC_TOGGLE_NKRO`|Turn NKRO on or off|
|
||||
|
||||
<!-- FIXME: this formatting needs work
|
||||
|
||||
## Audio
|
||||
|
||||
```c
|
||||
#ifdef AUDIO_ENABLE
|
||||
AU_ON,
|
||||
AU_OFF,
|
||||
AU_TOG,
|
||||
|
||||
#ifdef FAUXCLICKY_ENABLE
|
||||
FC_ON,
|
||||
FC_OFF,
|
||||
FC_TOG,
|
||||
#endif
|
||||
|
||||
// Music mode on/off/toggle
|
||||
MU_ON,
|
||||
MU_OFF,
|
||||
MU_TOG,
|
||||
|
||||
// Music voice iterate
|
||||
MUV_IN,
|
||||
MUV_DE,
|
||||
#endif
|
||||
```
|
||||
|
||||
### Midi
|
||||
|
||||
#if !MIDI_ENABLE_STRICT || (defined(MIDI_ENABLE) && defined(MIDI_BASIC))
|
||||
MI_ON, // send midi notes when music mode is enabled
|
||||
MI_OFF, // don't send midi notes when music mode is enabled
|
||||
#endif
|
||||
|
||||
MIDI_TONE_MIN,
|
||||
MIDI_TONE_MAX
|
||||
|
||||
MI_C = MIDI_TONE_MIN,
|
||||
MI_Cs,
|
||||
MI_Db = MI_Cs,
|
||||
MI_D,
|
||||
MI_Ds,
|
||||
MI_Eb = MI_Ds,
|
||||
MI_E,
|
||||
MI_F,
|
||||
MI_Fs,
|
||||
MI_Gb = MI_Fs,
|
||||
MI_G,
|
||||
MI_Gs,
|
||||
MI_Ab = MI_Gs,
|
||||
MI_A,
|
||||
MI_As,
|
||||
MI_Bb = MI_As,
|
||||
MI_B,
|
||||
|
||||
MIDI_TONE_KEYCODE_OCTAVES > 1
|
||||
|
||||
where x = 1-5:
|
||||
MI_C_x,
|
||||
MI_Cs_x,
|
||||
MI_Db_x = MI_Cs_x,
|
||||
MI_D_x,
|
||||
MI_Ds_x,
|
||||
MI_Eb_x = MI_Ds_x,
|
||||
MI_E_x,
|
||||
MI_F_x,
|
||||
MI_Fs_x,
|
||||
MI_Gb_x = MI_Fs_x,
|
||||
MI_G_x,
|
||||
MI_Gs_x,
|
||||
MI_Ab_x = MI_Gs_x,
|
||||
MI_A_x,
|
||||
MI_As_x,
|
||||
MI_Bb_x = MI_As_x,
|
||||
MI_B_x,
|
||||
|
||||
MI_OCT_Nx 1-2
|
||||
MI_OCT_x 0-7
|
||||
MIDI_OCTAVE_MIN = MI_OCT_N2,
|
||||
MIDI_OCTAVE_MAX = MI_OCT_7,
|
||||
MI_OCTD, // octave down
|
||||
MI_OCTU, // octave up
|
||||
|
||||
MI_TRNS_Nx 1-6
|
||||
MI_TRNS_x 0-6
|
||||
MIDI_TRANSPOSE_MIN = MI_TRNS_N6,
|
||||
MIDI_TRANSPOSE_MAX = MI_TRNS_6,
|
||||
MI_TRNSD, // transpose down
|
||||
MI_TRNSU, // transpose up
|
||||
|
||||
MI_VEL_x 1-10
|
||||
MIDI_VELOCITY_MIN = MI_VEL_1,
|
||||
MIDI_VELOCITY_MAX = MI_VEL_9,
|
||||
MI_VELD, // velocity down
|
||||
MI_VELU, // velocity up
|
||||
|
||||
MI_CHx 1-16
|
||||
MIDI_CHANNEL_MIN = MI_CH1
|
||||
MIDI_CHANNEL_MAX = MI_CH16,
|
||||
MI_CHD, // previous channel
|
||||
MI_CHU, // next channel
|
||||
|
||||
MI_ALLOFF, // all notes off
|
||||
|
||||
MI_SUS, // sustain
|
||||
MI_PORT, // portamento
|
||||
MI_SOST, // sostenuto
|
||||
MI_SOFT, // soft pedal
|
||||
MI_LEG, // legato
|
||||
|
||||
MI_MOD, // modulation
|
||||
MI_MODSD, // decrease modulation speed
|
||||
MI_MODSU, // increase modulation speed
|
||||
#endif // MIDI_ADVANCED
|
||||
|
||||
-->
|
||||
|
||||
## Backlight
|
||||
|
||||
These keycodes control the backlight. Most keyboards use this for single color in-switch lighting.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`BL_x`|Set a specific backlight level between 0-9|
|
||||
|`BL_ON`|An alias for `BL_9`|
|
||||
|`BL_OFF`|An alias for `BL_0`|
|
||||
|`BL_DEC`|Turn the backlight level down by 1|
|
||||
|`BL_INC`|Turn the backlight level up by 1|
|
||||
|`BL_TOGG`|Toggle the backlight on or off|
|
||||
|`BL_STEP`|Step through backlight levels, wrapping around to 0 when you reach the top.|
|
||||
|
||||
## RGBLIGHT WS2818 LEDs
|
||||
|
||||
This controls the `RGBLIGHT` functionality. Most keyboards use WS2812 (and compatible) LEDs for underlight or case lighting.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`RGB_TOG`|toggle on/off|
|
||||
|`RGB_MOD`|cycle through modes|
|
||||
|`RGB_HUI`|hue increase|
|
||||
|`RGB_HUD`|hue decrease|
|
||||
|`RGB_SAI`|saturation increase|
|
||||
|`RGB_SAD`|saturation decrease|
|
||||
|`RGB_VAI`|value increase|
|
||||
|`RGB_VAD`|value decrease|
|
||||
|
||||
## Thermal Printer (experimental)
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`PRINT_ON`|Start printing everything the user types|
|
||||
|`PRINT_OFF`|Stop printing everything the user types|
|
||||
|
||||
## Keyboard output selection
|
||||
|
||||
This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`OUT_AUTO`|auto mode|
|
||||
|`OUT_USB`|usb only|
|
||||
|`OUT_BT`|bluetooth (when `BLUETOOTH_ENABLE`)|
|
||||
|
||||
## Modifiers
|
||||
|
||||
These are special keycodes that simulate pressing several modifiers at once.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`KC_HYPR`|Hold down LCTL + LSFT + LALT + LGUI|
|
||||
|`KC_MEH`|Hold down LCTL + LSFT + LALT|
|
||||
|
||||
/* FIXME: Should we have these in QMK too?
|
||||
* |`KC_LCAG`|`LCTL` + `LALT` + `LGUI`|
|
||||
* |`KC_ALTG`|`RCTL` + `RALT`|
|
||||
* |`KC_SCMD`/`KC_SWIN`|`LGUI` + `LSFT`|
|
||||
* |`KC_LCA`|`LCTL` + `LALT`|
|
||||
*/
|
||||
|
||||
### Modifiers with keys
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`LCTL(kc)`|`LCTL` + `kc`|
|
||||
|`LSFT(kc)`/`S(kc)`|`LSFT` + `kc`|
|
||||
|`LALT(kc)`|`LALT` + `kc`|
|
||||
|`LGUI(kc)`|`LGUI` + `kc`|
|
||||
|`RCTL(kc)`|`RCTL` + `kc`|
|
||||
|`RSFT(kc)`|`RSFT` + `kc`|
|
||||
|`RALT(kc)`|`RALT` + `kc`|
|
||||
|`RGUI(kc)`|`RGUI` + `kc`|
|
||||
|`HYPR(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` + `kc`|
|
||||
|`MEH(kc)`|`LCTL` + `LSFT` + `LALT` + `kc`|
|
||||
|`LCAG(kc)`|`LCTL` + `LALT` + `LGUI` + `kc`|
|
||||
|`ALTG(kc)`|`RCTL` + `RALT` + `kc`|
|
||||
|`SCMD(kc)`/`SWIN(kc)`|`LGUI` + `LSFT` + `kc`|
|
||||
|`LCA(kc)`|`LCTL` + `LALT` + `kc`|
|
||||
|
||||
### One Shot Keys
|
||||
|
||||
Most modifiers work by being held down while you push another key. You can use `OSM()` to setup a "One Shot" modifier. When you tap a one shot mod it will remain is a pressed state until you press another key.
|
||||
|
||||
To specify a your modifier you need to pass the `MOD` form of the key. For example, if you want to setup a One Shot Control you would use `OSM(MOD_LCTL)`.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`OSM(mod)`|use mod for one keypress|
|
||||
|`OSL(layer)`|switch to layer for one keypress|
|
||||
|
||||
### Mod-tap keys
|
||||
|
||||
These keycodes will press the mod(s) when held, and the key when tapped. They only work with [basic keycodes](basic_keycodes.md).
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`CTL_T(kc)`/`LCTL_T(kc)`|`LCTL` when held, `kc` when tapped|
|
||||
|`RCTL_T(kc)`|`RCTL` when held, `kc` when tapped|
|
||||
|`SFT_T(kc)`/`LSFT_T(kc)`|`LSFT` when held, `kc` when tapped|
|
||||
|`RSFT_T(kc)`|`RSFT` when held, `kc` when tapped|
|
||||
|`ALT_T(kc)`/`LALT_T(kc)`|`LALT` when held, `kc` when tapped|
|
||||
|`RALT_T(kc)`/`ALGR_T(kc)`|`RALT` when held, `kc` when tapped|
|
||||
|`GUI_T(kc)`/`LGUI_T(kc)`|`LGUI` when held, `kc` when tapped|
|
||||
|`RGUI_T(kc)`|`RGUI` when held, `kc` when tapped|
|
||||
|`C_S_T(kc)`|`LCTL` + `LSFT` when held, `kc` when tapped|
|
||||
|`MEH_T(kc)`|`LCTL` + `LSFT` + `LALT` when held, `kc` when tapped|
|
||||
|`LCAG_T(kc)`|`LCTL` + `LALT` + `LGUI` when held, `kc` when tapped|
|
||||
|`RCAG_T(kc)`|`RCTL` + `RALT` + `RGUI` when held, `kc` when tapped|
|
||||
|`ALL_T(kc)`|`LCTL` + `LSFT` + `LALT` + `LGUI` when held, `kc` when tapped [more info](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|`SCMD_T(kc)`/`SWIN_T(kc)`|`LGUI` + `LSFT` when held, `kc` when tapped|
|
||||
|`LCA_T(kc)`|`LCTL` + `LALT` when held, `kc` when tapped|
|
||||
|
||||
## US ANSI Shifted symbols
|
||||
|
||||
These keycodes correspond to characters that are "shifted" on a standard US ANSI keyboards. They do not have dedicated keycodes but are instead typed by holding down shift and then sending a keycode.
|
||||
|
||||
It's important to remember that all of these keycodes send a left shift - this may cause unintended actions if unaccounted for. The short code is preferred in most situations.
|
||||
|
||||
|Short Name|Long Name|Description|
|
||||
|----------|---------|-----------|
|
||||
|`KC_TILD`|`KC_TILDE`|tilde `~`|
|
||||
|`KC_EXLM`|`KC_EXCLAIM`|exclamation mark `!`|
|
||||
|`KC_AT`||at sign `@`|
|
||||
|`KC_HASH`||hash sign `#`|
|
||||
|`KC_DLR`|`KC_DOLLAR`|dollar sign `$`|
|
||||
|`KC_PERC`|`KC_PERCENT`|percent sign `%`|
|
||||
|`KC_CIRC`|`KC_CIRCUMFLEX`|circumflex `^`|
|
||||
|`KC_AMPR`|`KC_AMPERSAND`|ampersand `&`|
|
||||
|`KC_ASTR`|`KC_ASTERISK`|asterisk `*`|
|
||||
|`KC_LPRN`|`KC_LEFT_PAREN`|left parenthesis `(`|
|
||||
|`KC_RPRN`|`KC_RIGHT_PAREN`|right parenthesis `)`|
|
||||
|`KC_UNDS`|`KC_UNDERSCORE`|underscore `_`|
|
||||
|`KC_PLUS`||plus sign `+`|
|
||||
|`KC_LCBR`|`KC_LEFT_CURLY_BRACE`|left curly brace `{`|
|
||||
|`KC_RCBR`|`KC_RIGHT_CURLY_BRACE`|right curly brace `}`|
|
||||
|`KC_LT`/`KC_LABK`|`KC_LEFT_ANGLE_BRACKET`|left angle bracket `<`|
|
||||
|`KC_GT`/`KC_RABK`|`KC_RIGHT_ANGLE_BRACKET`|right angle bracket `>`|
|
||||
|`KC_COLN`|`KC_COLON`|colon `:`|
|
||||
|`KC_PIPE`||pipe `\|`|
|
||||
|`KC_QUES`|`KC_QUESTION`|question mark `?`|
|
||||
|`KC_DQT`/`KC_DQUO`|`KC_DOUBLE_QUOTE`|double quote `"`|
|
||||
|
||||
## Layer Changes
|
||||
|
||||
These are keycodes that can be used to change the current layer.
|
||||
|
||||
|Name|Description|
|
||||
|----|-----------|
|
||||
|`LT(layer, kc)`|turn on layer (0-15) when held, kc ([basic keycodes](basic_keycodes.md)) when tapped|
|
||||
|`TO(layer)`|turn on layer when depressed|
|
||||
|`MO(layer)`|momentarily turn on layer when depressed (requires `KC_TRNS` on destination layer)|
|
||||
|`DF(layer)`|sets the base (default) layer|
|
||||
|`TG(layer)`|toggle layer on/off|
|
||||
|`TT(layer)`|tap toggle? idk FIXME|
|
||||
|`OSL(layer)`|switch to layer for one keycode|
|
||||
|
||||
## Unicode
|
||||
|
||||
These keycodes can be used in conjuction with the [Unicode](unicode_and_additional_language_support.md) support.
|
||||
|
||||
|`UNICODE(n)`/`UC(n)`|if `UNICODE_ENABLE`, this will send characters up to `0x7FFF`|
|
||||
|`X(n)`|if `UNICODEMAP_ENABLE`, also sends unicode via a different method|
|
||||
|
||||
# `SAFE_RANGE`, or safely defining custom keycodes
|
||||
|
||||
Sometimes you want to define your own custom keycodes to make your keymap easier to read. QMK provides `SAFE_RANGE` to help you do that. `SAFE_RANGE` is the first available keycode in the `0x0000`-`0xFFFF` range and you can use it when creating your own custom keycode enum:
|
||||
|
||||
```
|
||||
enum my_keycodes {
|
||||
FOO = SAFE_RANGE,
|
||||
BAR
|
||||
};
|
||||
```
|
||||
|
||||
You can then use `process_record_user()` to do something with your keycode:
|
||||
|
||||
```
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case FOO:
|
||||
// Do something here
|
||||
break;
|
||||
case BAR:
|
||||
// Do something here
|
||||
break;
|
||||
}
|
||||
}
|
||||
```
|
@ -1 +0,0 @@
|
||||
# Get Report Descriptor with lsusb
|
@ -1,17 +0,0 @@
|
||||
|
||||
|
||||
|
||||
.Makefile
|
||||
[source,Makefile]
|
||||
----
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = yes # Console for debug(+400)
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - not yet supported in LUFA
|
||||
----
|
@ -1,34 +0,0 @@
|
||||
## TMK based projects
|
||||
Add your project here!
|
||||
See https://github.com/tmk/tmk_keyboard/issues/173
|
||||
|
||||
### keyboards
|
||||
**S60-X**: [DIY 60% keyboard](https://www.massdrop.com/buy/sentraq-60-diy-keyboard-kit?mode=guest_open) designed by [VinnyCordeiro](https://github.com/VinnyCordeiro) for Sentraq:
|
||||
- https://github.com/VinnyCordeiro/tmk_keyboard
|
||||
|
||||
**Octagon V1**: Korean custom keyboard designed by Duck.
|
||||
- https://github.com/xauser/tmk_keyboard/tree/xauser
|
||||
|
||||
**Compact L3**: Custom keyboard designed by LifeZone and LeeKu.
|
||||
- https://github.com/xauser/tmk_keyboard/tree/xauser
|
||||
|
||||
**KMAC, 1,2 and Happy**: Custom keyboard designed by kbdmania.
|
||||
- https://github.com/ageaenes/tmk_keyboard
|
||||
|
||||
**P60**: [DIY wired 60% keyboard](https://imgur.com/a/zwsDN) by [p3lim](https://github.com/p3lim).
|
||||
- https://github.com/p3lim/keyboard_firmware
|
||||
|
||||
**Nerd, Kitten Paw, Lightsaber, Phantom, Lightpad, Ergodox** on [xauser](https://github.com/xauser)'s repository
|
||||
- https://github.com/xauser/tmk_keyboard/tree/xauser
|
||||
|
||||
**ErgoDox** on [cub-unanic](https://github.com/cub-uanic)'s repository
|
||||
- https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox
|
||||
|
||||
**Atreus** by [technomancy](https://atreus.technomancy.us)
|
||||
- https://github.com/technomancy/tmk_keyboard/tree/atreus/keyboard/atreus
|
||||
|
||||
**[mcdox](https://github.com/DavidMcEwan/mcdox)**
|
||||
- https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox
|
||||
|
||||
|
||||
### converters
|
@ -1,69 +0,0 @@
|
||||
## TMK own projects by hasu
|
||||
Located in [tmk_keyboard](https://github.com/tmk/tmk_keyboard/tree/master/) repository.
|
||||
|
||||
### converter
|
||||
* [ps2_usb] - [PS/2 keyboard to USB][GH_ps2]
|
||||
* [adb_usb] - [ADB keyboard to USB][GH_adb]
|
||||
* [m0110_usb] - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
|
||||
* [terminal_usb] - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
|
||||
* [news_usb] - [Sony NEWS keyboard to USB][GH_news]
|
||||
* [x68k_usb] - [Sharp X68000 keyboard to USB][GH_x68k]
|
||||
* [sun_usb] - [Sun] to USB(type4, 5 and 3?)
|
||||
* [pc98_usb] - [PC98] to USB
|
||||
* [usb_usb] - USB to USB(experimental)
|
||||
* [ascii_usb] - ASCII(Serial console terminal) to USB
|
||||
* [ibm4704_usb] - [IBM 4704 keyboard Converter][GH_ibm4704]
|
||||
|
||||
### keyboard
|
||||
* [hhkb] - [Happy Hacking Keyboard pro][GH_hhkb]
|
||||
* [gh60] - [GH60][GH60_diy] DIY 60% keyboard [prototype][GH60_proto]
|
||||
* [hbkb] - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
|
||||
* [hid_liber] - [HID liberation][HID_liber] controller (by alaricljs)
|
||||
* [phantom] - [Phantom] keyboard (by Tranquilite)
|
||||
* [IIgs_Standard] - Apple [IIGS] keyboard mod(by JeffreySung)
|
||||
* [macway] - [Compact keyboard mod][GH_macway] [retired]
|
||||
* [KMAC] - Korean custom keyboard
|
||||
* [Lightsaber] - Korean custom keyboard
|
||||
|
||||
[ps2_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ps2_usb/
|
||||
[adb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/adb_usb/
|
||||
[m0110_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/m0110_usb
|
||||
[terminal_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/terminal_usb/
|
||||
[news_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/news_usb/
|
||||
[x68k_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/x68k_usb/
|
||||
[sun_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/sun_usb/
|
||||
[pc98_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/pc98_usb/
|
||||
[usb_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/usb_usb/
|
||||
[ascii_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ascii_usb/
|
||||
[ibm4704_usb]: https://github.com/tmk/tmk_keyboard/tree/master/converter/ibm4704_usb
|
||||
[hhkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hhkb/
|
||||
[gh60]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/gh60/
|
||||
[hbkb]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hbkb/
|
||||
[hid_liber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/hid_liber/
|
||||
[phantom]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/phantom/
|
||||
[IIgs_Standard]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/IIgs/
|
||||
[macway]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/macway/
|
||||
[KMAC]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/kmac/
|
||||
[Lightsaber]: https://github.com/tmk/tmk_keyboard/tree/master/keyboard/lightsaber/
|
||||
|
||||
[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
|
||||
[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
|
||||
[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
|
||||
[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
|
||||
[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
|
||||
[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
|
||||
[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
|
||||
[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
|
||||
[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
|
||||
[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
|
||||
[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
|
||||
[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
|
||||
[Phantom]: http://geekhack.org/index.php?topic=26742
|
||||
[GH60_diy]: http://geekhack.org/index.php?topic=34959
|
||||
[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
|
||||
[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
|
||||
[Sun]: http://en.wikipedia.org/wiki/Sun-3
|
||||
[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
|
||||
|
||||
|
||||
See other [[TMK Based Projects]]
|
@ -1,243 +0,0 @@
|
||||
# TMK Documenation
|
||||
|
||||
Features
|
||||
--------
|
||||
These features can be used in your keyboard.
|
||||
|
||||
* Multi-layer Keymap - Multiple keyboard layouts with layer switching
|
||||
* Mouse key - Mouse control with keyboard
|
||||
* System Control Key - Power Down, Sleep, Wake Up and USB Remote Wake up
|
||||
* Media Control Key - Volume Down/Up, Mute, Next/Prev track, Play, Stop and etc
|
||||
* USB NKRO - 120 keys(+ 8 modifiers) simultaneously
|
||||
* PS/2 mouse support - PS/2 mouse(TrackPoint) as composite device
|
||||
* Keyboard protocols - PS/2, ADB, M0110, Sun and other old keyboard protocols
|
||||
* User Function - Customizable function of key with writing code
|
||||
* Macro - Very primitive at this time
|
||||
* Keyboard Tricks - Oneshot modifier and modifier with tapping feature
|
||||
* Debug Console - Messages for debug and interaction with firmware
|
||||
* Virtual DIP Switch - Configurations stored EEPROM(Boot Magic)
|
||||
* Locking CapsLock - Mechanical switch support for CapsLock
|
||||
* Breathing Sleep LED - Sleep indicator with charm during USB suspend
|
||||
* Backlight - Control backlight levels
|
||||
|
||||
|
||||
|
||||
Projects
|
||||
--------
|
||||
You can find some keyboard specific projects under `converter` and `keyboard` directory.
|
||||
|
||||
## Main projects
|
||||
|
||||
### OLKB products
|
||||
* [planck](keyboards/planck/) - [Planck] Ortholinear 40% keyboard
|
||||
* [preonic](keyboards/preonic/) - [Preonic] Ortholinear 50% keyboard
|
||||
* [atomic](keyboards/atomic/) - [Atomic] Ortholinear 60% keyboard
|
||||
|
||||
### Ergodox EZ
|
||||
* [ergodox_ez](keyboards/ergodox/ez) - [Ergodox_EZ] Assembled split keyboard
|
||||
|
||||
## Other projects
|
||||
|
||||
### converter
|
||||
* [ps2_usb](converter/ps2_usb/) - [PS/2 keyboard to USB][GH_ps2]
|
||||
* [adb_usb](converter/adb_usb/) - [ADB keyboard to USB][GH_adb]
|
||||
* [m0110_usb](converter/m0110_usb) - [Macintosh 128K/512K/Plus keyboard to USB][GH_m0110]
|
||||
* [terminal_usb](converter/terminal_usb/) - [IBM Model M terminal keyboard(PS/2 scancode set3) to USB][GH_terminal]
|
||||
* [news_usb](converter/news_usb/) - [Sony NEWS keyboard to USB][GH_news]
|
||||
* [x68k_usb](converter/x68k_usb/) - [Sharp X68000 keyboard to USB][GH_x68k]
|
||||
* [sun_usb](converter/sun_usb/) - [Sun] to USB(type4, 5 and 3?)
|
||||
* [pc98_usb](converter/pc98_usb/) - [PC98] to USB
|
||||
* [usb_usb](converter/usb_usb/) - USB to USB(experimental)
|
||||
* [ascii_usb](converter/ascii_usb/) - ASCII(Serial console terminal) to USB
|
||||
* [ibm4704_usb](converter/ibm4704_usb) - [IBM 4704 keyboard Converter][GH_ibm4704]
|
||||
|
||||
### keyboard
|
||||
* [hhkb](keyboards/hhkb/) - [Happy Hacking Keyboard pro][GH_hhkb] hasu's main board
|
||||
* [gh60](keyboards/gh60/) - [GH60] DIY 60% keyboard [prototype][GH60_proto] hasu's second board
|
||||
* [hbkb](keyboards/hbkb/) - [Happy Buckling spring keyboard][GH_hbkb](IBM Model M 60% mod)
|
||||
* [hid_liber](keyboards/hid_liber/) - [HID liberation][HID_liber] controller (by alaricljs)
|
||||
* [phantom](keyboards/phantom/) - [Phantom] keyboard (by Tranquilite)
|
||||
* [IIgs_Standard](keyboards/IIgs/) - Apple [IIGS] keyboard mod(by JeffreySung)
|
||||
* [macway](keyboards/macway/) - [Compact keyboard mod][GH_macway] [retired]
|
||||
* [KMAC](keyboards/kmac/) - Korean custom keyboard
|
||||
* [Lightsaber](keyboards/lightsaber/) - Korean custom keyboard
|
||||
* [Infinity](keyboards/infinity/) - Massdrop [Infinity keyboard][Infinity]
|
||||
* [NerD](keyboards/nerd/) - Korean custom keyboard
|
||||
* [KittenPaw](keyboards/kitten_paw) - Custom Majestouch controller
|
||||
* [Lightpad](keyboards/lightpad) - Korean custom keypad
|
||||
* [ghost_squid](keyboards/ghost_squid/) - [The Ghost Squid][ghost_squid] controller for [Cooler Master QuickFire XT][cmxt]
|
||||
|
||||
### Extenal projects using tmk_keyboard
|
||||
* [ErgoDox_cub-uanic][cub-uanic] - Split Ergonomic Keyboard [ErgoDox][ergodox_org]
|
||||
* [mcdox][mcdox_tmk] - [mcdox][mcdox]
|
||||
|
||||
|
||||
[GH_macway]: http://geekhack.org/showwiki.php?title=Island:11930
|
||||
[GH_hhkb]: http://geekhack.org/showwiki.php?title=Island:12047
|
||||
[GH_ps2]: http://geekhack.org/showwiki.php?title=Island:14618
|
||||
[GH_adb]: http://geekhack.org/showwiki.php?title=Island:14290
|
||||
[GH_hhkb_bt]: http://geekhack.org/showwiki.php?title=Island:20851
|
||||
[GH_m0110]: http://geekhack.org/showwiki.php?title=Island:24965
|
||||
[GH_news]: http://geekhack.org/showwiki.php?title=Island:25759
|
||||
[GH_terminal]: http://geekhack.org/showwiki.php?title=Island:27272
|
||||
[GH_x68k]: http://geekhack.org/showwiki.php?title=Island:29060
|
||||
[GH_hbkb]: http://geekhack.org/showwiki.php?title=Island:29483
|
||||
[GH_ibm4704]: http://geekhack.org/index.php?topic=54706.0
|
||||
[HID_liber]: http://deskthority.net/wiki/HID_Liberation_Device_-_DIY_Instructions
|
||||
[Phantom]: http://geekhack.org/index.php?topic=26742
|
||||
[GH60]: http://geekhack.org/index.php?topic=34959
|
||||
[GH60_proto]: http://geekhack.org/index.php?topic=37570.0
|
||||
[PC98]: http://en.wikipedia.org/wiki/NEC_PC-9801
|
||||
[Sun]: http://en.wikipedia.org/wiki/Sun-3
|
||||
[IIGS]: http://en.wikipedia.org/wiki/Apple_IIGS
|
||||
[Infinity]: https://www.massdrop.com/buy/infinity-keyboard-kit
|
||||
[ghost_squid]: http://deskthority.net/wiki/Costar_replacement_controllers#The_Ghost_Squid
|
||||
[cmxt]: http://gaming.coolermaster.com/en/products/keyboard/quickfirext/
|
||||
[ergodox_org]: http://ergodox.org/
|
||||
[cub-uanic]: https://github.com/cub-uanic/tmk_keyboard/tree/master/keyboard/ergodox
|
||||
[mcdox]: https://github.com/DavidMcEwan/mcdox
|
||||
[mcdox_tmk]: https://github.com/DavidMcEwan/tmk_keyboard/tree/master/keyboard/mcdox
|
||||
[Planck]: http://olkb.co/planck
|
||||
[Preonic]: http://olkb.co/preonic
|
||||
[Atomic]: http://olkb.co/atomic
|
||||
[Ergodox_EZ]: https://www.indiegogo.com/projects/ergodox-ez-an-incredible-mechanical-keyboard
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
**GPLv2** or later. Some protocol files are under **Modified BSD License**.
|
||||
|
||||
Third party libraries like LUFA, PJRC and V-USB have their own license respectively.
|
||||
|
||||
|
||||
|
||||
Build Firmware and Program Controller
|
||||
-------------------------------------
|
||||
See [build environment setup](build_environment_setup.md), or the readme in the particular keyboards/* folder.
|
||||
|
||||
|
||||
|
||||
Change your keymap
|
||||
------------------
|
||||
See [keymap.md](keymap.md).
|
||||
|
||||
|
||||
|
||||
Magic Commands
|
||||
--------------
|
||||
To see help press `Magic` + `H`.
|
||||
|
||||
`Magic` key combination is `LShift` + `RShift` in many project, but `Power` key on ADB converter.
|
||||
`Magic` keybind can be vary on each project, check `config.h` in project directory.
|
||||
|
||||
Following commands can be also executed with `Magic` + key. In console mode `Magic` keybind is not needed.
|
||||
|
||||
----- Command Help -----
|
||||
c: enter console mode
|
||||
d: toggle debug enable
|
||||
x: toggle matrix debug
|
||||
k: toggle keyboard debug
|
||||
m: toggle mouse debug
|
||||
v: print device version & info
|
||||
t: print timer count
|
||||
s: print status
|
||||
e: print eeprom config
|
||||
n: toggle NKRO
|
||||
0/F10: switch to Layer0
|
||||
1/F1: switch to Layer1
|
||||
2/F2: switch to Layer2
|
||||
3/F3: switch to Layer3
|
||||
4/F4: switch to Layer4
|
||||
PScr: power down/remote wake-up
|
||||
Caps: Lock Keyboard(Child Proof)
|
||||
Paus: jump to bootloader
|
||||
|
||||
|
||||
|
||||
Boot Magic Configuration - Virtual DIP Switch
|
||||
---------------------------------------------
|
||||
Boot Magic are executed during boot up time. Press Magic key below then plug in keyboard cable.
|
||||
Note that you must use keys of **Layer 0** as Magic keys. These settings are stored in EEPROM so that retain your configure over power cycles.
|
||||
|
||||
To avoid configuring accidentally additive salt key `KC_SPACE` also needs to be pressed along with the following configuration keys. The salt key is configurable in `config.h`. See [tmk_core/common/bootmagic.h](/tmk_core/common/bootmagic.h).
|
||||
|
||||
#### General
|
||||
- Skip reading EEPROM to start with default configuration(`ESC`)
|
||||
- Clear configuration stored in EEPROM to reset configuration(`Backspace`)
|
||||
|
||||
#### Bootloader
|
||||
- Kick up Bootloader(`B`)
|
||||
|
||||
#### Debug
|
||||
- Debug enable(`D`)
|
||||
- Debug matrix enable(`D`+`X`)
|
||||
- Debug keyboard enable(`D`+`K`)
|
||||
- Debug mouse enable(`D`+`M`)
|
||||
|
||||
#### Keymap
|
||||
- Swap Control and CapsLock(`Left Control`)
|
||||
- Change CapsLock to Control(`Caps Lock`)
|
||||
- Swap LeftAlt and Gui(`Left Alt`)
|
||||
- Swap RightAlt and Gui(`Right Alt`)
|
||||
- Disable Gui(`Left Gui`)
|
||||
- Swap Grave and Escape(`Grave`)
|
||||
- Swap BackSlash and BackSpace(`Back Slash`)
|
||||
- Enable NKRO on boot(`N`)
|
||||
|
||||
#### Default Layer
|
||||
- Set Default Layer to 0(`0`)
|
||||
- Set Default Layer to 1(`1`)
|
||||
- Set Default Layer to 2(`2`)
|
||||
- Set Default Layer to 3(`3`)
|
||||
- Set Default Layer to 4(`4`)
|
||||
- Set Default Layer to 5(`5`)
|
||||
- Set Default Layer to 6(`6`)
|
||||
- Set Default Layer to 7(`7`)
|
||||
|
||||
|
||||
|
||||
Mechanical Locking support
|
||||
--------------------------
|
||||
This feature makes it possible for you to use mechanical locking switch for `CapsLock`, `NumLock`
|
||||
or `ScrollLock`. To enable this feature define these macros in `config.h` and use `KC_LCAP`, `KC_LN
|
||||
UM` or `KC_LSCR` in keymap for locking key instead of normal `KC_CAPS`, `KC_NLCK` or `KC_SLCK`. Res
|
||||
ync option tries to keep switch state consistent with keyboard LED state.
|
||||
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
#define LOCKING_RESYNC_ENABLE
|
||||
|
||||
|
||||
|
||||
Start Your Own Project
|
||||
-----------------------
|
||||
**TBD**
|
||||
|
||||
|
||||
|
||||
Debugging
|
||||
--------
|
||||
Use PJRC's `hid_listen` to see debug messages. You can use the tool for debug even if firmware use LUFA stack.
|
||||
|
||||
You can use xprintf() to display debug info on `hid_listen`, see `tmk_core/common/xprintf.h`.
|
||||
|
||||
|
||||
|
||||
Files and Directories
|
||||
-------------------
|
||||
### Top
|
||||
* tmk_core/ - core library
|
||||
* keyboards/ - keyboard projects
|
||||
* converter/ - protocol converter projects
|
||||
* doc/ - documents
|
||||
|
||||
|
||||
|
||||
Coding Style
|
||||
-------------
|
||||
- Doesn't use Tab to indent, use 4-spaces instead.
|
||||
|
||||
|
||||
|
||||
Other Keyboard Firmware Projects
|
||||
------------------
|
||||
You can learn a lot about keyboard firmware from these. See [docs/other_projects.md](other_projects.md).
|
@ -0,0 +1,172 @@
|
||||
# Understanding QMK's Code
|
||||
|
||||
This document attempts to explain how the QMK firmware works from a very high level. It assumes you understand basic programming concepts but does not (except where needed to demonstrate) assume familiarity with C. It assumes that you have a basic understanding of the following documents:
|
||||
|
||||
* [QMK Overview](qmk_overview.md)
|
||||
* [How Keyboards Work](basic_how_keyboards_work.md)
|
||||
* [FAQ](faq.md)
|
||||
|
||||
## Startup
|
||||
|
||||
You can think of QMK as no different from any other computer program. It is started, performs its tasks, and then ends. The entry point for the program is the `main()` function, just like it is on any other C program. However, for a newcomer to QMK it can be confusing because the `main()` function appears in multiple places, and it can be hard to tell which one to look at.
|
||||
|
||||
The reason for this is the different platforms that QMK supports. The most common platform is `lufa`, which runs on AVR processors such at the atmega32u4. We also support `chibios` and `vusb`.
|
||||
|
||||
We'll focus on AVR processors for the moment, which use the `lufa` platform. You can find the `main()` function in [tmk_core/protocol/lufa/lufa.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1129). If you browse through that function you'll find that it initializes any hardware that has been configured (including USB to the host) and then it starts the core part of the program with a [`while(1)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/protocol/lufa/lufa.c#L1182). This is [The Main Loop](#the_main_loop).
|
||||
|
||||
## The Main Loop
|
||||
|
||||
This section of code is called "The Main Loop" because it's responsible for looping over the same set of instructions forever. This is where QMK dispatches out to the functions responsible for making the keyboard do everything it is supposed to do. At first glance it can look like a lot of functionality but most of the time the code will be disabled by `#define`'s.
|
||||
|
||||
```
|
||||
keyboard_task();
|
||||
```
|
||||
|
||||
This is where all the keyboard specific functionality is dispatched. The source code for `keyboard_task()` can be found in [tmk_core/common/keyboard.c](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/keyboard.c#L154), and it is responsible for detecting changes in the matrix and turning status LED's on and off.
|
||||
|
||||
Within `keyboard_task()` you'll find code to handle:
|
||||
|
||||
* [Matrix Scanning](#matrix-scanning)
|
||||
* Mouse Handling
|
||||
* Serial Link(s)
|
||||
* Visualizer
|
||||
* Keyboard status LED's (Caps Lock, Num Lock, Scroll Lock)
|
||||
|
||||
#### Matrix Scanning
|
||||
|
||||
Matrix scanning is the core function of a keyboard firmware. It is the process of detecting which keys are currently pressed, and your keyboard runs this function many times a second. It's no exaggeration to say that 99% of your firmware's CPU time is spent on matrix scanning.
|
||||
|
||||
While there are different strategies for doing the actual matrix detection, they are out of scope for this document. It is sufficient to treat matrix scanning as a black box, you ask for the matrix's current state and get back a datastructure that looks like this:
|
||||
|
||||
|
||||
```
|
||||
{
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0}
|
||||
}
|
||||
```
|
||||
|
||||
That datastructure is a direct representation of the matrix for a 4 row by 5 column numpad. When a key is pressed that key's position within the matrix will be returned as `1` instead of `0`.
|
||||
|
||||
Matrix Scanning runs many times per second. The exact rate varies but typically it runs at least 10 times per second to avoid perceptible lag.
|
||||
|
||||
##### Matrix to Physical Layout Map
|
||||
|
||||
Once we know the state of every switch on our keyboard we have to map that to a keycode. In QMK this is done by making use of C macros to allow us to separate the definition of the physical layout from the definition of keycodes.
|
||||
|
||||
At the keyboard level we define a C macro (typically named `KEYMAP()`) which maps our keyboard's matrix to physical keys. Sometimes the matrix does not have a switch in every location, and we can use this macro to pre-populate those with KC_NO, making the keymap definition easier to work with. Here's an example `KEYMAP()` macro for a numpad:
|
||||
|
||||
```c
|
||||
#define KEYMAP( \
|
||||
k00, k01, k02, k03, \
|
||||
k10, k11, k12, k13, \
|
||||
k20, k21, k22, \
|
||||
k30, k31, k32, k33, \
|
||||
k40, k42 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03, }, \
|
||||
{ k10, k11, k12, k13, }, \
|
||||
{ k20, k21, k22, KC_NO, }, \
|
||||
{ k30, k31, k32, k33, }, \
|
||||
{ k40, KC_NO, k42, KC_NO } \
|
||||
}
|
||||
```
|
||||
|
||||
Notice how the second block of our `KEYMAP()` macro matches the Matrix Scanning array above? This macro is what will map the matrix scanning array to keycodes. However, if you look at a 17 key numpad you'll notice that it has 3 places where the matrix could have a switch but doesn't, due to larger keys. We have populated those spaces with `KC_NO` so that our keymap definition doesn't have to.
|
||||
|
||||
You can also use this macro to handle unusual matrix layouts, for example the [Clueboard rev 2](https://github.com/qmk/qmk_firmware/blob/master/keyboards/clueboard/rev2/rev2.h). Explaining that is outside the scope of this document.
|
||||
|
||||
##### Keycode Assignment
|
||||
|
||||
At the keymap level we make use of our `KEYMAP()` macro above to map keycodes to physical locations to matrix locations. It looks like this:
|
||||
|
||||
```
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = KEYMAP(
|
||||
KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
|
||||
KC_P7, KC_P8, KC_P9, KC_PPLS, \
|
||||
KC_P4, KC_P5, KC_P6, \
|
||||
KC_P1, KC_P2, KC_P3, KC_PENT, \
|
||||
KC_P0, KC_PDOT)
|
||||
}
|
||||
```
|
||||
|
||||
Notice how all of these arguments match up with the first half of the `KEYMAP()` macro from the last section? This is how we take a keycode and map it to our Matrix Scan from earlier.
|
||||
|
||||
##### State Change Detection
|
||||
|
||||
The matrix scanning described above tells us the state of the matrix at a given moment, but your computer only wants to know about changes, it doesn't care about the current state. QMK stores the results from the last matrix scan and compares the results from this matrix to determine when a key has been pressed or released.
|
||||
|
||||
Let's look at an example. We'll hop into the middle of a keyboard scanning loop to find that our previous scan looks like this:
|
||||
|
||||
```
|
||||
{
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0}
|
||||
}
|
||||
```
|
||||
|
||||
And when our current scan completes it will look like this:
|
||||
|
||||
```
|
||||
{
|
||||
{1,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0},
|
||||
{0,0,0,0}
|
||||
}
|
||||
```
|
||||
|
||||
Comparing against our keymap we can see that the pressed key is KC_NLCK. From here we dispatch to the `process_record` set of functions.
|
||||
|
||||
<!-- FIXME: Magic happens between here and process_record -->
|
||||
|
||||
##### Process Record
|
||||
|
||||
The `process_record()` function itself is deceptively simple, but hidden within is a gateway to overriding functionality at various levels of QMK. The chain of events is described below, using cluecard whenever we need to look at the keyboard/keymap level functions.
|
||||
|
||||
* [`void process_record(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action.c#L128)
|
||||
* [`bool process_record_quantum(keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L140)
|
||||
* [Map this record to a keycode](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L143)
|
||||
* [`bool process_record_kb(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/cluecard.c#L20)
|
||||
* [`bool process_record_user(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/keyboards/cluecard/keymaps/default/keymap.c#L58)
|
||||
* [`bool process_midi(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_midi.c#L102)
|
||||
* [`bool process_audio(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_audio.c#L10)
|
||||
* [`bool process_music(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_music.c#L69)
|
||||
* [`bool process_tap_dance(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_tap_dance.c#L75)
|
||||
* [`bool process_leader(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_leader.c#L32)
|
||||
* [`bool process_chording(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_chording.c#L41)
|
||||
* [`bool process_combo(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_combo.c#L115)
|
||||
* [`bool process_unicode(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicode.c#L22)
|
||||
* [`bool process_ucis(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_ucis.c#L91)
|
||||
* [`bool process_printer(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_printer.c#L77)
|
||||
* [`bool process_unicode_map(uint16_t keycode, keyrecord_t *record)`](https://github.com/qmk/qmk_firmware/blob/master/quantum/process_keycode/process_unicodemap.c#L47)
|
||||
* [Identify and process quantum specific keycodes](https://github.com/qmk/qmk_firmware/blob/master/quantum/quantum.c#L211)
|
||||
|
||||
At any step during this chain of events a function (such as `process_record_kb()`) can `return false` to halt all further processing.
|
||||
|
||||
<!--
|
||||
#### Mouse Handling
|
||||
|
||||
FIXME: This needs to be written
|
||||
|
||||
#### Serial Link(s)
|
||||
|
||||
FIXME: This needs to be written
|
||||
|
||||
#### Visualizer
|
||||
|
||||
FIXME: This needs to be written
|
||||
|
||||
#### Keyboard state LED's (Caps Lock, Num Lock, Scroll Lock)
|
||||
|
||||
FIXME: This needs to be written
|
||||
|
||||
-->
|
@ -0,0 +1,54 @@
|
||||
# Unicode support
|
||||
|
||||
There are three Unicode keymap definition method available in QMK:
|
||||
|
||||
## UNICODE_ENABLE
|
||||
|
||||
Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in
|
||||
keymap file, where *n* is a 4 digit hexadecimal.
|
||||
|
||||
## UNICODEMAP_ENABLE
|
||||
|
||||
Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping
|
||||
table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file.
|
||||
The keycode function is `X(n)` where *n* is the array index of the mapping
|
||||
table.
|
||||
|
||||
## UCIS_ENABLE
|
||||
|
||||
TBD
|
||||
|
||||
Unicode input in QMK works by inputing a sequence of characters to the OS,
|
||||
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.
|
||||
|
||||
This is the current list of Unicode input method in QMK:
|
||||
|
||||
* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
|
||||
* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
|
||||
* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
|
||||
* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
|
||||
|
||||
# Additional language support
|
||||
|
||||
In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware.
|
||||
|
||||
# International Characters on Windows
|
||||
|
||||
[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.
|
||||
|
||||
The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.
|
||||
|
||||
First you need to select a modifier combination that is not in use by any of your programs.
|
||||
CtrlAltWin is not used very widely and should therefore be perfect for this.
|
||||
There is a macro defined for a mod-tab combo `LCAG_T`.
|
||||
Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`.
|
||||
This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key.
|
||||
|
||||
In the default script of AutoHotkey you can define custom hotkeys.
|
||||
|
||||
<^<!<#a::Send, ä
|
||||
<^<!<#<+a::Send, Ä
|
||||
|
||||
The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
|
||||
AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
|
||||
|
@ -1,54 +0,0 @@
|
||||
## Unicode support
|
||||
|
||||
There are three Unicode keymap definition method available in QMK:
|
||||
|
||||
### UNICODE_ENABLE
|
||||
|
||||
Supports Unicode input up to 0xFFFF. The keycode function is `UC(n)` in
|
||||
keymap file, where *n* is a 4 digit hexadecimal.
|
||||
|
||||
### UNICODEMAP_ENABLE
|
||||
|
||||
Supports Unicode up to 0xFFFFFFFF. You need to maintain a separate mapping
|
||||
table `const uint32_t PROGMEM unicode_map[] = {...}` in your keymap file.
|
||||
The keycode function is `X(n)` where *n* is the array index of the mapping
|
||||
table.
|
||||
|
||||
### UCIS_ENABLE
|
||||
|
||||
TBD
|
||||
|
||||
Unicode input in QMK works by inputing a sequence of characters to the OS,
|
||||
sort of like macro. Unfortunately, each OS has different ideas on how Unicode is inputted.
|
||||
|
||||
This is the current list of Unicode input method in QMK:
|
||||
|
||||
* UC_OSX: MacOS Unicode Hex Input support. Works only up to 0xFFFF. Disabled by default. To enable: go to System Preferences -> Keyboard -> Input Sources, and enable Unicode Hex.
|
||||
* UC_LNX: Unicode input method under Linux. Works up to 0xFFFFF. Should work almost anywhere on ibus enabled distros. Without ibus, this works under GTK apps, but rarely anywhere else.
|
||||
* UC_WIN: (not recommended) Windows built-in Unicode input. To enable: create registry key under `HKEY_CURRENT_USER\Control Panel\Input Method\EnableHexNumpad` of type `REG_SZ` called `EnableHexNumpad`, set its value to 1, and reboot. This method is not recommended because of reliability and compatibility issue, use WinCompose method below instead.
|
||||
* UC_WINC: Windows Unicode input using WinCompose. Requires [WinCompose](https://github.com/samhocevar/wincompose). Works reliably under many (all?) variations of Windows.
|
||||
|
||||
## Additional language support
|
||||
|
||||
In `quantum/keymap_extras/`, you'll see various language files - these work the same way as the alternative layout ones do. Most are defined by their two letter country/language code followed by an underscore and a 4-letter abbreviation of its name. `FR_UGRV` which will result in a `ù` when using a software-implemented AZERTY layout. It's currently difficult to send such characters in just the firmware.
|
||||
|
||||
## International Characters on Windows
|
||||
|
||||
[AutoHotkey](https://autohotkey.com) allows Windows users to create custom hotkeys among others.
|
||||
|
||||
The method does not require Unicode support in the keyboard itself but depends instead of AutoHotkey running in the background.
|
||||
|
||||
First you need to select a modifier combination that is not in use by any of your programs.
|
||||
CtrlAltWin is not used very widely and should therefore be perfect for this.
|
||||
There is a macro defined for a mod-tab combo `LCAG_T`.
|
||||
Add this mod-tab combo to a key on your keyboard, e.g.: `LCAG_T(KC_TAB)`.
|
||||
This makes the key behave like a tab key if pressed and released immediately but changes it to the modifier if used with another key.
|
||||
|
||||
In the default script of AutoHotkey you can define custom hotkeys.
|
||||
|
||||
<^<!<#a::Send, ä
|
||||
<^<!<#<+a::Send, Ä
|
||||
|
||||
The hotkeys above are for the combination CtrlAltGui and CtrlAltGuiShift plus the letter a.
|
||||
AutoHotkey inserts the Text right of `Send, ` when this combination is pressed.
|
||||
|
@ -1,11 +0,0 @@
|
||||
# Getting Report Descriptor
|
||||
```
|
||||
$ cd /sys/bus/usb/drivers/usbhid
|
||||
$ ls
|
||||
1-1.3.4:1.0 1-1.3.4:1.2 bind new_id uevent
|
||||
1-1.3.4:1.1 1-1.3.4:1.3 module remove_id unbind
|
||||
$ echo -n 1-1.4\:1.0 | sudo tee unbind
|
||||
$ sudo lsusb -vvv -d 046d:c01d
|
||||
$ echo -n 1-1.4\:1.0 | sudo tee bind
|
||||
```
|
||||
|
@ -0,0 +1,325 @@
|
||||
#ifdef SSD1306OLED
|
||||
|
||||
#include "ssd1306.h"
|
||||
#include "i2c.h"
|
||||
#include <string.h>
|
||||
#include "print.h"
|
||||
#include "glcdfont.c"
|
||||
#ifdef ADAFRUIT_BLE_ENABLE
|
||||
#include "adafruit_ble.h"
|
||||
#endif
|
||||
#ifdef PROTOCOL_LUFA
|
||||
#include "lufa.h"
|
||||
#endif
|
||||
#include "sendchar.h"
|
||||
#include "timer.h"
|
||||
|
||||
// Set this to 1 to help diagnose early startup problems
|
||||
// when testing power-on with ble. Turn it off otherwise,
|
||||
// as the latency of printing most of the debug info messes
|
||||
// with the matrix scan, causing keys to drop.
|
||||
#define DEBUG_TO_SCREEN 0
|
||||
|
||||
//static uint16_t last_battery_update;
|
||||
//static uint32_t vbat;
|
||||
//#define BatteryUpdateInterval 10000 /* milliseconds */
|
||||
#define ScreenOffInterval 300000 /* milliseconds */
|
||||
#if DEBUG_TO_SCREEN
|
||||
static uint8_t displaying;
|
||||
#endif
|
||||
static uint16_t last_flush;
|
||||
|
||||
// Write command sequence.
|
||||
// Returns true on success.
|
||||
static inline bool _send_cmd1(uint8_t cmd) {
|
||||
bool res = false;
|
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
xprintf("failed to start write to %d\n", SSD1306_ADDRESS);
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (i2c_master_write(0x0 /* command byte follows */)) {
|
||||
print("failed to write control byte\n");
|
||||
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (i2c_master_write(cmd)) {
|
||||
xprintf("failed to write command %d\n", cmd);
|
||||
goto done;
|
||||
}
|
||||
res = true;
|
||||
done:
|
||||
i2c_master_stop();
|
||||
return res;
|
||||
}
|
||||
|
||||
// Write 2-byte command sequence.
|
||||
// Returns true on success
|
||||
static inline bool _send_cmd2(uint8_t cmd, uint8_t opr) {
|
||||
if (!_send_cmd1(cmd)) {
|
||||
return false;
|
||||
}
|
||||
return _send_cmd1(opr);
|
||||
}
|
||||
|
||||
// Write 3-byte command sequence.
|
||||
// Returns true on success
|
||||
static inline bool _send_cmd3(uint8_t cmd, uint8_t opr1, uint8_t opr2) {
|
||||
if (!_send_cmd1(cmd)) {
|
||||
return false;
|
||||
}
|
||||
if (!_send_cmd1(opr1)) {
|
||||
return false;
|
||||
}
|
||||
return _send_cmd1(opr2);
|
||||
}
|
||||
|
||||
#define send_cmd1(c) if (!_send_cmd1(c)) {goto done;}
|
||||
#define send_cmd2(c,o) if (!_send_cmd2(c,o)) {goto done;}
|
||||
#define send_cmd3(c,o1,o2) if (!_send_cmd3(c,o1,o2)) {goto done;}
|
||||
|
||||
static void clear_display(void) {
|
||||
matrix_clear(&display);
|
||||
|
||||
// Clear all of the display bits (there can be random noise
|
||||
// in the RAM on startup)
|
||||
send_cmd3(PageAddr, 0, (DisplayHeight / 8) - 1);
|
||||
send_cmd3(ColumnAddr, 0, DisplayWidth - 1);
|
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
goto done;
|
||||
}
|
||||
if (i2c_master_write(0x40)) {
|
||||
// Data mode
|
||||
goto done;
|
||||
}
|
||||
for (uint8_t row = 0; row < MatrixRows; ++row) {
|
||||
for (uint8_t col = 0; col < DisplayWidth; ++col) {
|
||||
i2c_master_write(0);
|
||||
}
|
||||
}
|
||||
|
||||
display.dirty = false;
|
||||
|
||||
done:
|
||||
i2c_master_stop();
|
||||
}
|
||||
|
||||
#if DEBUG_TO_SCREEN
|
||||
#undef sendchar
|
||||
static int8_t capture_sendchar(uint8_t c) {
|
||||
sendchar(c);
|
||||
iota_gfx_write_char(c);
|
||||
|
||||
if (!displaying) {
|
||||
iota_gfx_flush();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool iota_gfx_init(void) {
|
||||
bool success = false;
|
||||
|
||||
send_cmd1(DisplayOff);
|
||||
send_cmd2(SetDisplayClockDiv, 0x80);
|
||||
send_cmd2(SetMultiPlex, DisplayHeight - 1);
|
||||
|
||||
send_cmd2(SetDisplayOffset, 0);
|
||||
|
||||
|
||||
send_cmd1(SetStartLine | 0x0);
|
||||
send_cmd2(SetChargePump, 0x14 /* Enable */);
|
||||
send_cmd2(SetMemoryMode, 0 /* horizontal addressing */);
|
||||
|
||||
#ifdef OLED_ROTATE180
|
||||
// the following Flip the display orientation 180 degrees
|
||||
send_cmd1(SegRemap);
|
||||
send_cmd1(ComScanInc);
|
||||
#endif
|
||||
#ifndef OLED_ROTATE180
|
||||
// Flips the display orientation 0 degrees
|
||||
send_cmd1(SegRemap | 0x1);
|
||||
send_cmd1(ComScanDec);
|
||||
#endif
|
||||
|
||||
send_cmd2(SetComPins, 0x2);
|
||||
send_cmd2(SetContrast, 0x8f);
|
||||
send_cmd2(SetPreCharge, 0xf1);
|
||||
send_cmd2(SetVComDetect, 0x40);
|
||||
send_cmd1(DisplayAllOnResume);
|
||||
send_cmd1(NormalDisplay);
|
||||
send_cmd1(DeActivateScroll);
|
||||
send_cmd1(DisplayOn);
|
||||
|
||||
send_cmd2(SetContrast, 0); // Dim
|
||||
|
||||
clear_display();
|
||||
|
||||
success = true;
|
||||
|
||||
iota_gfx_flush();
|
||||
|
||||
#if DEBUG_TO_SCREEN
|
||||
print_set_sendchar(capture_sendchar);
|
||||
#endif
|
||||
|
||||
done:
|
||||
return success;
|
||||
}
|
||||
|
||||
bool iota_gfx_off(void) {
|
||||
bool success = false;
|
||||
|
||||
send_cmd1(DisplayOff);
|
||||
success = true;
|
||||
|
||||
done:
|
||||
return success;
|
||||
}
|
||||
|
||||
bool iota_gfx_on(void) {
|
||||
bool success = false;
|
||||
|
||||
send_cmd1(DisplayOn);
|
||||
success = true;
|
||||
|
||||
done:
|
||||
return success;
|
||||
}
|
||||
|
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
*matrix->cursor = c;
|
||||
++matrix->cursor;
|
||||
|
||||
if (matrix->cursor - &matrix->display[0][0] == sizeof(matrix->display)) {
|
||||
// We went off the end; scroll the display upwards by one line
|
||||
memmove(&matrix->display[0], &matrix->display[1],
|
||||
MatrixCols * (MatrixRows - 1));
|
||||
matrix->cursor = &matrix->display[MatrixRows - 1][0];
|
||||
memset(matrix->cursor, ' ', MatrixCols);
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c) {
|
||||
matrix->dirty = true;
|
||||
|
||||
if (c == '\n') {
|
||||
// Clear to end of line from the cursor and then move to the
|
||||
// start of the next line
|
||||
uint8_t cursor_col = (matrix->cursor - &matrix->display[0][0]) % MatrixCols;
|
||||
|
||||
while (cursor_col++ < MatrixCols) {
|
||||
matrix_write_char_inner(matrix, ' ');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
matrix_write_char_inner(matrix, c);
|
||||
}
|
||||
|
||||
void iota_gfx_write_char(uint8_t c) {
|
||||
matrix_write_char(&display, c);
|
||||
}
|
||||
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data) {
|
||||
const char *end = data + strlen(data);
|
||||
while (data < end) {
|
||||
matrix_write_char(matrix, *data);
|
||||
++data;
|
||||
}
|
||||
}
|
||||
|
||||
void iota_gfx_write(const char *data) {
|
||||
matrix_write(&display, data);
|
||||
}
|
||||
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data) {
|
||||
while (true) {
|
||||
uint8_t c = pgm_read_byte(data);
|
||||
if (c == 0) {
|
||||
return;
|
||||
}
|
||||
matrix_write_char(matrix, c);
|
||||
++data;
|
||||
}
|
||||
}
|
||||
|
||||
void iota_gfx_write_P(const char *data) {
|
||||
matrix_write_P(&display, data);
|
||||
}
|
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix) {
|
||||
memset(matrix->display, ' ', sizeof(matrix->display));
|
||||
matrix->cursor = &matrix->display[0][0];
|
||||
matrix->dirty = true;
|
||||
}
|
||||
|
||||
void iota_gfx_clear_screen(void) {
|
||||
matrix_clear(&display);
|
||||
}
|
||||
|
||||
void matrix_render(struct CharacterMatrix *matrix) {
|
||||
last_flush = timer_read();
|
||||
iota_gfx_on();
|
||||
#if DEBUG_TO_SCREEN
|
||||
++displaying;
|
||||
#endif
|
||||
|
||||
// Move to the home position
|
||||
send_cmd3(PageAddr, 0, MatrixRows - 1);
|
||||
send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
|
||||
|
||||
if (i2c_start_write(SSD1306_ADDRESS)) {
|
||||
goto done;
|
||||
}
|
||||
if (i2c_master_write(0x40)) {
|
||||
// Data mode
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (uint8_t row = 0; row < MatrixRows; ++row) {
|
||||
for (uint8_t col = 0; col < MatrixCols; ++col) {
|
||||
const uint8_t *glyph = font + (matrix->display[row][col] * (FontWidth - 1));
|
||||
|
||||
for (uint8_t glyphCol = 0; glyphCol < FontWidth - 1; ++glyphCol) {
|
||||
uint8_t colBits = pgm_read_byte(glyph + glyphCol);
|
||||
i2c_master_write(colBits);
|
||||
}
|
||||
|
||||
// 1 column of space between chars (it's not included in the glyph)
|
||||
i2c_master_write(0);
|
||||
}
|
||||
}
|
||||
|
||||
matrix->dirty = false;
|
||||
|
||||
done:
|
||||
i2c_master_stop();
|
||||
#if DEBUG_TO_SCREEN
|
||||
--displaying;
|
||||
#endif
|
||||
}
|
||||
|
||||
void iota_gfx_flush(void) {
|
||||
matrix_render(&display);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void iota_gfx_task_user(void) {
|
||||
}
|
||||
|
||||
void iota_gfx_task(void) {
|
||||
iota_gfx_task_user();
|
||||
|
||||
if (display.dirty) {
|
||||
iota_gfx_flush();
|
||||
}
|
||||
|
||||
if (timer_elapsed(last_flush) > ScreenOffInterval) {
|
||||
iota_gfx_off();
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,93 @@
|
||||
#ifndef SSD1306_H
|
||||
#define SSD1306_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include "pincontrol.h"
|
||||
#include "config.h"
|
||||
|
||||
enum ssd1306_cmds {
|
||||
DisplayOff = 0xAE,
|
||||
DisplayOn = 0xAF,
|
||||
|
||||
SetContrast = 0x81,
|
||||
DisplayAllOnResume = 0xA4,
|
||||
|
||||
DisplayAllOn = 0xA5,
|
||||
NormalDisplay = 0xA6,
|
||||
InvertDisplay = 0xA7,
|
||||
SetDisplayOffset = 0xD3,
|
||||
SetComPins = 0xda,
|
||||
SetVComDetect = 0xdb,
|
||||
SetDisplayClockDiv = 0xD5,
|
||||
SetPreCharge = 0xd9,
|
||||
SetMultiPlex = 0xa8,
|
||||
SetLowColumn = 0x00,
|
||||
SetHighColumn = 0x10,
|
||||
SetStartLine = 0x40,
|
||||
|
||||
SetMemoryMode = 0x20,
|
||||
ColumnAddr = 0x21,
|
||||
PageAddr = 0x22,
|
||||
|
||||
ComScanInc = 0xc0,
|
||||
ComScanDec = 0xc8,
|
||||
SegRemap = 0xa0,
|
||||
SetChargePump = 0x8d,
|
||||
ExternalVcc = 0x01,
|
||||
SwitchCapVcc = 0x02,
|
||||
|
||||
ActivateScroll = 0x2f,
|
||||
DeActivateScroll = 0x2e,
|
||||
SetVerticalScrollArea = 0xa3,
|
||||
RightHorizontalScroll = 0x26,
|
||||
LeftHorizontalScroll = 0x27,
|
||||
VerticalAndRightHorizontalScroll = 0x29,
|
||||
VerticalAndLeftHorizontalScroll = 0x2a,
|
||||
};
|
||||
|
||||
// Controls the SSD1306 128x32 OLED display via i2c
|
||||
|
||||
#ifndef SSD1306_ADDRESS
|
||||
#define SSD1306_ADDRESS 0x3C
|
||||
#endif
|
||||
|
||||
#define DisplayHeight 32
|
||||
#define DisplayWidth 128
|
||||
|
||||
#define FontHeight 8
|
||||
#define FontWidth 6
|
||||
|
||||
#define MatrixRows (DisplayHeight / FontHeight)
|
||||
#define MatrixCols (DisplayWidth / FontWidth)
|
||||
|
||||
struct CharacterMatrix {
|
||||
uint8_t display[MatrixRows][MatrixCols];
|
||||
uint8_t *cursor;
|
||||
bool dirty;
|
||||
};
|
||||
|
||||
struct CharacterMatrix display;
|
||||
|
||||
bool iota_gfx_init(void);
|
||||
void iota_gfx_task(void);
|
||||
bool iota_gfx_off(void);
|
||||
bool iota_gfx_on(void);
|
||||
void iota_gfx_flush(void);
|
||||
void iota_gfx_write_char(uint8_t c);
|
||||
void iota_gfx_write(const char *data);
|
||||
void iota_gfx_write_P(const char *data);
|
||||
void iota_gfx_clear_screen(void);
|
||||
|
||||
void iota_gfx_task_user(void);
|
||||
|
||||
void matrix_clear(struct CharacterMatrix *matrix);
|
||||
void matrix_write_char_inner(struct CharacterMatrix *matrix, uint8_t c);
|
||||
void matrix_write_char(struct CharacterMatrix *matrix, uint8_t c);
|
||||
void matrix_write(struct CharacterMatrix *matrix, const char *data);
|
||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||
void matrix_render(struct CharacterMatrix *matrix);
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,342 @@
|
||||
/*
|
||||
* light weight WS2812 lib V2.0b
|
||||
*
|
||||
* Controls WS2811/WS2812/WS2812B RGB-LEDs
|
||||
* Author: Tim (cpldcpu@gmail.com)
|
||||
*
|
||||
* Jan 18th, 2014 v2.0b Initial Version
|
||||
* Nov 29th, 2015 v2.3 Added SK6812RGBW support
|
||||
*
|
||||
* 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 "ws2812.h"
|
||||
#include <avr/interrupt.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "debug.h"
|
||||
|
||||
#ifdef RGBW_BB_TWI
|
||||
|
||||
// Port for the I2C
|
||||
#define I2C_DDR DDRD
|
||||
#define I2C_PIN PIND
|
||||
#define I2C_PORT PORTD
|
||||
|
||||
// Pins to be used in the bit banging
|
||||
#define I2C_CLK 0
|
||||
#define I2C_DAT 1
|
||||
|
||||
#define I2C_DATA_HI()\
|
||||
I2C_DDR &= ~ (1 << I2C_DAT);\
|
||||
I2C_PORT |= (1 << I2C_DAT);
|
||||
#define I2C_DATA_LO()\
|
||||
I2C_DDR |= (1 << I2C_DAT);\
|
||||
I2C_PORT &= ~ (1 << I2C_DAT);
|
||||
|
||||
#define I2C_CLOCK_HI()\
|
||||
I2C_DDR &= ~ (1 << I2C_CLK);\
|
||||
I2C_PORT |= (1 << I2C_CLK);
|
||||
#define I2C_CLOCK_LO()\
|
||||
I2C_DDR |= (1 << I2C_CLK);\
|
||||
I2C_PORT &= ~ (1 << I2C_CLK);
|
||||
|
||||
#define I2C_DELAY 1
|
||||
|
||||
void I2C_WriteBit(unsigned char c)
|
||||
{
|
||||
if (c > 0)
|
||||
{
|
||||
I2C_DATA_HI();
|
||||
}
|
||||
else
|
||||
{
|
||||
I2C_DATA_LO();
|
||||
}
|
||||
|
||||
I2C_CLOCK_HI();
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
I2C_CLOCK_LO();
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
if (c > 0)
|
||||
{
|
||||
I2C_DATA_LO();
|
||||
}
|
||||
|
||||
_delay_us(I2C_DELAY);
|
||||
}
|
||||
|
||||
// Inits bitbanging port, must be called before using the functions below
|
||||
//
|
||||
void I2C_Init(void)
|
||||
{
|
||||
I2C_PORT &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
||||
|
||||
I2C_CLOCK_HI();
|
||||
I2C_DATA_HI();
|
||||
|
||||
_delay_us(I2C_DELAY);
|
||||
}
|
||||
|
||||
// Send a START Condition
|
||||
//
|
||||
void I2C_Start(void)
|
||||
{
|
||||
// set both to high at the same time
|
||||
I2C_DDR &= ~ ((1 << I2C_DAT) | (1 << I2C_CLK));
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
I2C_DATA_LO();
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
I2C_CLOCK_LO();
|
||||
_delay_us(I2C_DELAY);
|
||||
}
|
||||
|
||||
// Send a STOP Condition
|
||||
//
|
||||
void I2C_Stop(void)
|
||||
{
|
||||
I2C_CLOCK_HI();
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
I2C_DATA_HI();
|
||||
_delay_us(I2C_DELAY);
|
||||
}
|
||||
|
||||
// write a byte to the I2C slave device
|
||||
//
|
||||
unsigned char I2C_Write(unsigned char c)
|
||||
{
|
||||
for (char i = 0; i < 8; i++)
|
||||
{
|
||||
I2C_WriteBit(c & 128);
|
||||
|
||||
c <<= 1;
|
||||
}
|
||||
|
||||
|
||||
I2C_WriteBit(0);
|
||||
_delay_us(I2C_DELAY);
|
||||
_delay_us(I2C_DELAY);
|
||||
|
||||
// _delay_us(I2C_DELAY);
|
||||
//return I2C_ReadBit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
// Setleds for standard RGB
|
||||
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
|
||||
{
|
||||
// ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin));
|
||||
ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF));
|
||||
}
|
||||
|
||||
void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask)
|
||||
{
|
||||
// ws2812_DDRREG |= pinmask; // Enable DDR
|
||||
// new universal format (DDR)
|
||||
_SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask;
|
||||
|
||||
ws2812_sendarray_mask((uint8_t*)ledarray,leds+leds+leds,pinmask);
|
||||
_delay_us(50);
|
||||
}
|
||||
|
||||
// Setleds for SK6812RGBW
|
||||
void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds)
|
||||
{
|
||||
|
||||
#ifdef RGBW_BB_TWI
|
||||
uint8_t sreg_prev, twcr_prev;
|
||||
sreg_prev=SREG;
|
||||
twcr_prev=TWCR;
|
||||
cli();
|
||||
TWCR &= ~(1<<TWEN);
|
||||
I2C_Init();
|
||||
I2C_Start();
|
||||
I2C_Write(0x84);
|
||||
uint16_t datlen = leds<<2;
|
||||
uint8_t curbyte;
|
||||
uint8_t * data = (uint8_t*)ledarray;
|
||||
while (datlen--) {
|
||||
curbyte=*data++;
|
||||
I2C_Write(curbyte);
|
||||
}
|
||||
I2C_Stop();
|
||||
SREG=sreg_prev;
|
||||
TWCR=twcr_prev;
|
||||
#endif
|
||||
|
||||
|
||||
// ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
|
||||
// new universal format (DDR)
|
||||
_SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF);
|
||||
|
||||
ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF));
|
||||
|
||||
|
||||
#ifndef RGBW_BB_TWI
|
||||
_delay_us(80);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ws2812_sendarray(uint8_t *data,uint16_t datlen)
|
||||
{
|
||||
ws2812_sendarray_mask(data,datlen,_BV(RGB_DI_PIN & 0xF));
|
||||
}
|
||||
|
||||
/*
|
||||
This routine writes an array of bytes with RGB values to the Dataout pin
|
||||
using the fast 800kHz clockless WS2811/2812 protocol.
|
||||
*/
|
||||
|
||||
// Timing in ns
|
||||
#define w_zeropulse 350
|
||||
#define w_onepulse 900
|
||||
#define w_totalperiod 1250
|
||||
|
||||
// Fixed cycles used by the inner loop
|
||||
#define w_fixedlow 2
|
||||
#define w_fixedhigh 4
|
||||
#define w_fixedtotal 8
|
||||
|
||||
// Insert NOPs to match the timing, if possible
|
||||
#define w_zerocycles (((F_CPU/1000)*w_zeropulse )/1000000)
|
||||
#define w_onecycles (((F_CPU/1000)*w_onepulse +500000)/1000000)
|
||||
#define w_totalcycles (((F_CPU/1000)*w_totalperiod +500000)/1000000)
|
||||
|
||||
// w1 - nops between rising edge and falling edge - low
|
||||
#define w1 (w_zerocycles-w_fixedlow)
|
||||
// w2 nops between fe low and fe high
|
||||
#define w2 (w_onecycles-w_fixedhigh-w1)
|
||||
// w3 nops to complete loop
|
||||
#define w3 (w_totalcycles-w_fixedtotal-w1-w2)
|
||||
|
||||
#if w1>0
|
||||
#define w1_nops w1
|
||||
#else
|
||||
#define w1_nops 0
|
||||
#endif
|
||||
|
||||
// The only critical timing parameter is the minimum pulse length of the "0"
|
||||
// Warn or throw error if this timing can not be met with current F_CPU settings.
|
||||
#define w_lowtime ((w1_nops+w_fixedlow)*1000000)/(F_CPU/1000)
|
||||
#if w_lowtime>550
|
||||
#error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?"
|
||||
#elif w_lowtime>450
|
||||
#warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)."
|
||||
#warning "Please consider a higher clockspeed, if possible"
|
||||
#endif
|
||||
|
||||
#if w2>0
|
||||
#define w2_nops w2
|
||||
#else
|
||||
#define w2_nops 0
|
||||
#endif
|
||||
|
||||
#if w3>0
|
||||
#define w3_nops w3
|
||||
#else
|
||||
#define w3_nops 0
|
||||
#endif
|
||||
|
||||
#define w_nop1 "nop \n\t"
|
||||
#define w_nop2 "rjmp .+0 \n\t"
|
||||
#define w_nop4 w_nop2 w_nop2
|
||||
#define w_nop8 w_nop4 w_nop4
|
||||
#define w_nop16 w_nop8 w_nop8
|
||||
|
||||
void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi)
|
||||
{
|
||||
uint8_t curbyte,ctr,masklo;
|
||||
uint8_t sreg_prev;
|
||||
|
||||
// masklo =~maskhi&ws2812_PORTREG;
|
||||
// maskhi |= ws2812_PORTREG;
|
||||
masklo =~maskhi&_SFR_IO8((RGB_DI_PIN >> 4) + 2);
|
||||
maskhi |= _SFR_IO8((RGB_DI_PIN >> 4) + 2);
|
||||
sreg_prev=SREG;
|
||||
cli();
|
||||
|
||||
while (datlen--) {
|
||||
curbyte=(*data++);
|
||||
|
||||
asm volatile(
|
||||
" ldi %0,8 \n\t"
|
||||
"loop%=: \n\t"
|
||||
" out %2,%3 \n\t" // '1' [01] '0' [01] - re
|
||||
#if (w1_nops&1)
|
||||
w_nop1
|
||||
#endif
|
||||
#if (w1_nops&2)
|
||||
w_nop2
|
||||
#endif
|
||||
#if (w1_nops&4)
|
||||
w_nop4
|
||||
#endif
|
||||
#if (w1_nops&8)
|
||||
w_nop8
|
||||
#endif
|
||||
#if (w1_nops&16)
|
||||
w_nop16
|
||||
#endif
|
||||
" sbrs %1,7 \n\t" // '1' [03] '0' [02]
|
||||
" out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low
|
||||
" lsl %1 \n\t" // '1' [04] '0' [04]
|
||||
#if (w2_nops&1)
|
||||
w_nop1
|
||||
#endif
|
||||
#if (w2_nops&2)
|
||||
w_nop2
|
||||
#endif
|
||||
#if (w2_nops&4)
|
||||
w_nop4
|
||||
#endif
|
||||
#if (w2_nops&8)
|
||||
w_nop8
|
||||
#endif
|
||||
#if (w2_nops&16)
|
||||
w_nop16
|
||||
#endif
|
||||
" out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high
|
||||
#if (w3_nops&1)
|
||||
w_nop1
|
||||
#endif
|
||||
#if (w3_nops&2)
|
||||
w_nop2
|
||||
#endif
|
||||
#if (w3_nops&4)
|
||||
w_nop4
|
||||
#endif
|
||||
#if (w3_nops&8)
|
||||
w_nop8
|
||||
#endif
|
||||
#if (w3_nops&16)
|
||||
w_nop16
|
||||
#endif
|
||||
|
||||
" dec %0 \n\t" // '1' [+2] '0' [+2]
|
||||
" brne loop%=\n\t" // '1' [+3] '0' [+4]
|
||||
: "=&d" (ctr)
|
||||
: "r" (curbyte), "I" (_SFR_IO_ADDR(_SFR_IO8((RGB_DI_PIN >> 4) + 2))), "r" (maskhi), "r" (masklo)
|
||||
);
|
||||
}
|
||||
|
||||
SREG=sreg_prev;
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
/*
|
||||
Copyright 2016 Fred Sundvik <fsundvik@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/>.
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
static const I2CConfig i2ccfg = {
|
||||
400000 // clock speed (Hz); 400kHz max for IS31
|
||||
};
|
||||
|
||||
static const uint8_t led_mask[] = {
|
||||
0xFF, 0x00, /* C1-1 -> C1-16 */
|
||||
0xFF, 0x00, /* C2-1 -> C2-16 */
|
||||
0xFF, 0x00, /* C3-1 -> C3-16 */
|
||||
0xFF, 0x00, /* C4-1 -> C4-16 */
|
||||
0x3F, 0x00, /* C5-1 -> C5-16 */
|
||||
0x00, 0x00, /* C6-1 -> C6-16 */
|
||||
0x00, 0x00, /* C7-1 -> C7-16 */
|
||||
0x00, 0x00, /* C8-1 -> C8-16 */
|
||||
0x00, 0x00, /* C9-1 -> C9-16 */
|
||||
};
|
||||
|
||||
// The address of the LED
|
||||
#define LA(c, r) (c + r * 16 )
|
||||
// Need to be an address that is not mapped, but inside the range of the controller matrix
|
||||
#define NA LA(8, 8)
|
||||
|
||||
// The numbers in the comments are the led numbers DXX on the PCB
|
||||
// The mapping is taken from the schematic of left hand side
|
||||
static const uint8_t led_mapping[GDISP_SCREEN_HEIGHT][GDISP_SCREEN_WIDTH] = {
|
||||
// 45 44 43 42 41 40 39
|
||||
{ LA(1, 1), LA(1, 0), LA(0, 4), LA(0, 3), LA(0, 2), LA(0, 1), LA(0, 0)},
|
||||
// 52 51 50 49 48 47 46
|
||||
{ LA(2, 3), LA(2, 2), LA(2, 1), LA(2, 0), LA(1, 4), LA(1, 3), LA(1, 2) },
|
||||
// 58 57 56 55 54 53 N/A
|
||||
{ LA(3, 4), LA(3, 3), LA(3, 2), LA(3, 1), LA(3, 0), LA(2, 4), NA },
|
||||
// 67 66 65 64 63 62 61
|
||||
{ LA(5, 3), LA(5, 2), LA(5, 1), LA(5, 0), LA(4, 4), LA(4, 3), LA(4, 2) },
|
||||
// 76 75 74 73 72 60 59
|
||||
{ LA(7, 3), LA(7, 2), LA(7, 1), LA(7, 0), LA(6, 3), LA(4, 1), LA(4, 0) },
|
||||
// N/A N/A N/A N/A N/A N/A 68
|
||||
{ NA, NA, NA, NA, NA, NA, LA(5, 4) },
|
||||
// N/A N/A N/A N/A 71 70 69
|
||||
{ NA, NA, NA, NA, LA(6, 2), LA(6, 1), LA(6, 0) },
|
||||
};
|
||||
|
||||
|
||||
#define IS31_ADDR_DEFAULT 0x74 // AD connected to GND
|
||||
#define IS31_TIMEOUT 5000
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
/* I2C pins */
|
||||
palSetPadMode(GPIOB, 0, PAL_MODE_ALTERNATIVE_2); // PTB0/I2C0/SCL
|
||||
palSetPadMode(GPIOB, 1, PAL_MODE_ALTERNATIVE_2); // PTB1/I2C0/SDA
|
||||
palSetPadMode(GPIOB, 16, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palClearPad(GPIOB, 16);
|
||||
/* start I2C */
|
||||
i2cStart(&I2CD1, &i2ccfg);
|
||||
// try high drive (from kiibohd)
|
||||
I2CD1.i2c->C2 |= I2Cx_C2_HDRS;
|
||||
// try glitch fixing (from kiibohd)
|
||||
I2CD1.i2c->FLT = 4;
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE const uint8_t* get_led_mask(GDisplay* g) {
|
||||
(void) g;
|
||||
return led_mask;
|
||||
}
|
||||
|
||||
static GFXINLINE uint8_t get_led_address(GDisplay* g, uint16_t x, uint16_t y)
|
||||
{
|
||||
(void) g;
|
||||
return led_mapping[y][x];
|
||||
}
|
||||
|
||||
static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
|
||||
(void) g;
|
||||
if(!shutdown) {
|
||||
palSetPad(GPIOB, 16);
|
||||
}
|
||||
else {
|
||||
palClearPad(GPIOB, 16);
|
||||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
|
||||
(void) g;
|
||||
i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT));
|
||||
}
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
@ -0,0 +1,3 @@
|
||||
GFXINC += drivers/ugfx/gdisp/is31fl3731c
|
||||
GFXSRC += drivers/ugfx/gdisp/is31fl3731c/gdisp_is31fl3731c.c
|
||||
GDISP_DRIVER_LIST += GDISPVMT_IS31FL3731C_QMK
|
@ -0,0 +1,308 @@
|
||||
/*
|
||||
Copyright 2016 Fred Sundvik <fsundvik@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/>.
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_IS31FL3731C_QMK
|
||||
#define GDISP_SCREEN_HEIGHT LED_HEIGHT
|
||||
#define GDISP_SCREEN_WIDTH LED_WIDTH
|
||||
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_is31fl3731c.h"
|
||||
|
||||
|
||||
// Can't include led_tables from here
|
||||
extern const uint8_t CIE1931_CURVE[];
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 0
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 0
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
#define IS31_ADDR_DEFAULT 0x74
|
||||
|
||||
#define IS31_REG_CONFIG 0x00
|
||||
// bits in reg
|
||||
#define IS31_REG_CONFIG_PICTUREMODE 0x00
|
||||
#define IS31_REG_CONFIG_AUTOPLAYMODE 0x08
|
||||
#define IS31_REG_CONFIG_AUDIOPLAYMODE 0x18
|
||||
// D2:D0 bits are starting frame for autoplay mode
|
||||
|
||||
#define IS31_REG_PICTDISP 0x01 // D2:D0 frame select for picture mode
|
||||
|
||||
#define IS31_REG_AUTOPLAYCTRL1 0x02
|
||||
// D6:D4 number of loops (000=infty)
|
||||
// D2:D0 number of frames to be used
|
||||
|
||||
#define IS31_REG_AUTOPLAYCTRL2 0x03 // D5:D0 delay time (*11ms)
|
||||
|
||||
#define IS31_REG_DISPLAYOPT 0x05
|
||||
#define IS31_REG_DISPLAYOPT_INTENSITY_SAME 0x20 // same intensity for all frames
|
||||
#define IS31_REG_DISPLAYOPT_BLINK_ENABLE 0x8
|
||||
// D2:D0 bits blink period time (*0.27s)
|
||||
|
||||
#define IS31_REG_AUDIOSYNC 0x06
|
||||
#define IS31_REG_AUDIOSYNC_ENABLE 0x1
|
||||
|
||||
#define IS31_REG_FRAMESTATE 0x07
|
||||
|
||||
#define IS31_REG_BREATHCTRL1 0x08
|
||||
// D6:D4 fade out time (26ms*2^i)
|
||||
// D2:D0 fade in time (26ms*2^i)
|
||||
|
||||
#define IS31_REG_BREATHCTRL2 0x09
|
||||
#define IS31_REG_BREATHCTRL2_ENABLE 0x10
|
||||
// D2:D0 extinguish time (3.5ms*2^i)
|
||||
|
||||
#define IS31_REG_SHUTDOWN 0x0A
|
||||
#define IS31_REG_SHUTDOWN_OFF 0x0
|
||||
#define IS31_REG_SHUTDOWN_ON 0x1
|
||||
|
||||
#define IS31_REG_AGCCTRL 0x0B
|
||||
#define IS31_REG_ADCRATE 0x0C
|
||||
|
||||
#define IS31_COMMANDREGISTER 0xFD
|
||||
#define IS31_FUNCTIONREG 0x0B // helpfully called 'page nine'
|
||||
#define IS31_FUNCTIONREG_SIZE 0xD
|
||||
|
||||
#define IS31_FRAME_SIZE 0xB4
|
||||
|
||||
#define IS31_PWM_REG 0x24
|
||||
#define IS31_PWM_SIZE 0x90
|
||||
|
||||
#define IS31_LED_MASK_SIZE 0x12
|
||||
|
||||
#define IS31
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
typedef struct{
|
||||
uint8_t write_buffer_offset;
|
||||
uint8_t write_buffer[IS31_FRAME_SIZE];
|
||||
uint8_t frame_buffer[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH];
|
||||
uint8_t page;
|
||||
}__attribute__((__packed__)) PrivData;
|
||||
|
||||
// Some common routines and macros
|
||||
#define PRIV(g) ((PrivData*)g->priv)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static GFXINLINE void write_page(GDisplay* g, uint8_t page) {
|
||||
uint8_t tx[2] __attribute__((aligned(2)));
|
||||
tx[0] = IS31_COMMANDREGISTER;
|
||||
tx[1] = page;
|
||||
write_data(g, tx, 2);
|
||||
}
|
||||
|
||||
static GFXINLINE void write_register(GDisplay* g, uint8_t page, uint8_t reg, uint8_t data) {
|
||||
uint8_t tx[2] __attribute__((aligned(2)));
|
||||
tx[0] = reg;
|
||||
tx[1] = data;
|
||||
write_page(g, page);
|
||||
write_data(g, tx, 2);
|
||||
}
|
||||
|
||||
static GFXINLINE void write_ram(GDisplay *g, uint8_t page, uint16_t offset, uint16_t length) {
|
||||
PRIV(g)->write_buffer_offset = offset;
|
||||
write_page(g, page);
|
||||
write_data(g, (uint8_t*)PRIV(g), length + 1);
|
||||
}
|
||||
|
||||
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(sizeof(PrivData));
|
||||
__builtin_memset(PRIV(g), 0, sizeof(PrivData));
|
||||
PRIV(g)->page = 0;
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// zero function page, all registers (assuming full_page is all zeroes)
|
||||
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
|
||||
set_hardware_shutdown(g, false);
|
||||
gfxSleepMilliseconds(10);
|
||||
// software shutdown
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
gfxSleepMilliseconds(10);
|
||||
// zero function page, all registers
|
||||
write_ram(g, IS31_FUNCTIONREG, 0, IS31_FUNCTIONREG_SIZE);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
|
||||
// zero all LED registers on all 8 pages, and enable the mask
|
||||
__builtin_memcpy(PRIV(g)->write_buffer, get_led_mask(g), IS31_LED_MASK_SIZE);
|
||||
for(uint8_t i=0; i<8; i++) {
|
||||
write_ram(g, i, 0, IS31_FRAME_SIZE);
|
||||
gfxSleepMilliseconds(1);
|
||||
}
|
||||
|
||||
// software shutdown disable (i.e. turn stuff on)
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
gfxSleepMilliseconds(10);
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
PRIV(g)->page++;
|
||||
PRIV(g)->page %= 2;
|
||||
// TODO: some smarter algorithm for this
|
||||
// We should run only one physical page at a time
|
||||
// This way we don't need to send so much data, and
|
||||
// we could use slightly less memory
|
||||
uint8_t* src = PRIV(g)->frame_buffer;
|
||||
for (int y=0;y<GDISP_SCREEN_HEIGHT;y++) {
|
||||
for (int x=0;x<GDISP_SCREEN_WIDTH;x++) {
|
||||
uint8_t val = (uint16_t)*src * g->g.Backlight / 100;
|
||||
PRIV(g)->write_buffer[get_led_address(g, x, y)]=CIE1931_CURVE[val];
|
||||
++src;
|
||||
}
|
||||
}
|
||||
write_ram(g, PRIV(g)->page, IS31_PWM_REG, IS31_PWM_SIZE);
|
||||
gfxSleepMilliseconds(1);
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_PICTDISP, PRIV(g)->page);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x] = gdispColor2Native(g->p.color);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
}
|
||||
return gdispNative2Color(PRIV(g)->frame_buffer[y * GDISP_SCREEN_WIDTH + x]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g) {
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
case powerOff:
|
||||
case powerSleep:
|
||||
case powerDeepSleep:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_OFF);
|
||||
break;
|
||||
case powerOn:
|
||||
write_register(g, IS31_FUNCTIONREG, IS31_REG_SHUTDOWN, IS31_REG_SHUTDOWN_ON);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (powermode_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
/* Rotation is handled by the drawing routines */
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Orientation = (orientation_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if (g->g.Backlight == (unsigned)g->p.ptr)
|
||||
return;
|
||||
unsigned val = (unsigned)g->p.ptr;
|
||||
g->g.Backlight = val > 100 ? 100 : val;
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
Copyright 2016 Fred Sundvik <fsundvik@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/>.
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_CONFIG_H
|
||||
#define _GDISP_LLD_CONFIG_H
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_BOARD_H
|
||||
#define _GDISP_LLD_BOARD_H
|
||||
|
||||
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_9 // actually 6
|
||||
#define ST7565_ADC ST7565_ADC_NORMAL
|
||||
#define ST7565_COM_SCAN ST7565_COM_SCAN_DEC
|
||||
#define ST7565_PAGE_ORDER 0,1,2,3
|
||||
/*
|
||||
* Custom page order for several LCD boards, e.g. HEM12864-99
|
||||
* #define ST7565_PAGE_ORDER 4,5,6,7,0,1,2,3
|
||||
*/
|
||||
|
||||
#define ST7565_GPIOPORT GPIOC
|
||||
#define ST7565_PORT PORTC
|
||||
#define ST7565_A0_PIN 7
|
||||
#define ST7565_RST_PIN 8
|
||||
#define ST7565_MOSI_PIN 6
|
||||
#define ST7565_SLCK_PIN 5
|
||||
#define ST7565_SS_PIN 4
|
||||
|
||||
#define palSetPadModeRaw(portname, bits) \
|
||||
ST7565_PORT->PCR[ST7565_##portname##_PIN] = bits
|
||||
|
||||
#define palSetPadModeNamed(portname, portmode) \
|
||||
palSetPadMode(ST7565_GPIOPORT, ST7565_##portname##_PIN, portmode)
|
||||
|
||||
#define ST7565_SPI_MODE PORTx_PCRn_DSE | PORTx_PCRn_MUX(2)
|
||||
// DSPI Clock and Transfer Attributes
|
||||
// Frame Size: 8 bits
|
||||
// MSB First
|
||||
// CLK Low by default
|
||||
static const SPIConfig spi1config = {
|
||||
// Operation complete callback or @p NULL.
|
||||
.end_cb = NULL,
|
||||
//The chip select line port - when not using pcs.
|
||||
.ssport = ST7565_GPIOPORT,
|
||||
// brief The chip select line pad number - when not using pcs.
|
||||
.sspad=ST7565_SS_PIN,
|
||||
// SPI initialization data.
|
||||
.tar0 =
|
||||
SPIx_CTARn_FMSZ(7) // Frame size = 8 bytes
|
||||
| SPIx_CTARn_ASC(1) // After SCK Delay Scaler (min 50 ns) = 55.56ns
|
||||
| SPIx_CTARn_DT(0) // Delay After Transfer Scaler (no minimum)= 27.78ns
|
||||
| SPIx_CTARn_CSSCK(0) // PCS to SCK Delay Scaler (min 20 ns) = 27.78ns
|
||||
| SPIx_CTARn_PBR(0) // Baud Rate Prescaler = 2
|
||||
| SPIx_CTARn_BR(0) // Baud rate (min 50ns) = 55.56ns
|
||||
};
|
||||
|
||||
static GFXINLINE void acquire_bus(GDisplay *g) {
|
||||
(void) g;
|
||||
// Only the LCD is using the SPI bus, so no need to acquire
|
||||
// spiAcquireBus(&SPID1);
|
||||
spiSelect(&SPID1);
|
||||
}
|
||||
|
||||
static GFXINLINE void release_bus(GDisplay *g) {
|
||||
(void) g;
|
||||
// Only the LCD is using the SPI bus, so no need to release
|
||||
//spiReleaseBus(&SPID1);
|
||||
spiUnselect(&SPID1);
|
||||
}
|
||||
|
||||
static GFXINLINE void init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
palSetPadModeNamed(A0, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
palSetPadModeNamed(RST, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
palSetPadModeRaw(MOSI, ST7565_SPI_MODE);
|
||||
palSetPadModeRaw(SLCK, ST7565_SPI_MODE);
|
||||
palSetPadModeNamed(SS, PAL_MODE_OUTPUT_PUSHPULL);
|
||||
|
||||
spiInit();
|
||||
spiStart(&SPID1, &spi1config);
|
||||
release_bus(g);
|
||||
}
|
||||
|
||||
static GFXINLINE void post_init_board(GDisplay *g) {
|
||||
(void) g;
|
||||
}
|
||||
|
||||
static GFXINLINE void setpin_reset(GDisplay *g, bool_t state) {
|
||||
(void) g;
|
||||
if (state) {
|
||||
palClearPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
}
|
||||
else {
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_RST_PIN);
|
||||
}
|
||||
}
|
||||
|
||||
static GFXINLINE void enter_data_mode(GDisplay *g) {
|
||||
palSetPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
}
|
||||
|
||||
static GFXINLINE void enter_cmd_mode(GDisplay *g) {
|
||||
palClearPad(ST7565_GPIOPORT, ST7565_A0_PIN);
|
||||
}
|
||||
|
||||
|
||||
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
|
||||
(void) g;
|
||||
spiSend(&SPID1, length, data);
|
||||
}
|
||||
|
||||
#endif /* _GDISP_LLD_BOARD_H */
|
@ -0,0 +1,3 @@
|
||||
GFXINC += drivers/ugfx/gdisp/st7565
|
||||
GFXSRC += drivers/ugfx/gdisp/st7565/gdisp_lld_ST7565.c
|
||||
GDISP_DRIVER_LIST += GDISPVMT_ST7565_QMK
|
@ -0,0 +1,329 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_ST7565_QMK
|
||||
#include "gdisp_lld_config.h"
|
||||
#include "src/gdisp/gdisp_driver.h"
|
||||
|
||||
#include "board_st7565.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#ifndef GDISP_SCREEN_HEIGHT
|
||||
#define GDISP_SCREEN_HEIGHT LCD_HEIGHT
|
||||
#endif
|
||||
#ifndef GDISP_SCREEN_WIDTH
|
||||
#define GDISP_SCREEN_WIDTH LCD_WIDTH
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_CONTRAST
|
||||
#define GDISP_INITIAL_CONTRAST 35
|
||||
#endif
|
||||
#ifndef GDISP_INITIAL_BACKLIGHT
|
||||
#define GDISP_INITIAL_BACKLIGHT 100
|
||||
#endif
|
||||
|
||||
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
|
||||
|
||||
#include "st7565.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver config defaults for backward compatibility. */
|
||||
/*===========================================================================*/
|
||||
#ifndef ST7565_LCD_BIAS
|
||||
#define ST7565_LCD_BIAS ST7565_LCD_BIAS_7
|
||||
#endif
|
||||
#ifndef ST7565_ADC
|
||||
#define ST7565_ADC ST7565_ADC_NORMAL
|
||||
#endif
|
||||
#ifndef ST7565_COM_SCAN
|
||||
#define ST7565_COM_SCAN ST7565_COM_SCAN_INC
|
||||
#endif
|
||||
#ifndef ST7565_PAGE_ORDER
|
||||
#define ST7565_PAGE_ORDER 0,1,2,3
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
typedef struct{
|
||||
bool_t buffer2;
|
||||
uint8_t data_pos;
|
||||
uint8_t data[16];
|
||||
uint8_t ram[GDISP_SCREEN_HEIGHT * GDISP_SCREEN_WIDTH / 8];
|
||||
}PrivData;
|
||||
|
||||
// Some common routines and macros
|
||||
#define PRIV(g) ((PrivData*)g->priv)
|
||||
#define RAM(g) (PRIV(g)->ram)
|
||||
|
||||
static GFXINLINE void write_cmd(GDisplay* g, uint8_t cmd) {
|
||||
PRIV(g)->data[PRIV(g)->data_pos++] = cmd;
|
||||
}
|
||||
|
||||
static GFXINLINE void flush_cmd(GDisplay* g) {
|
||||
write_data(g, PRIV(g)->data, PRIV(g)->data_pos);
|
||||
PRIV(g)->data_pos = 0;
|
||||
}
|
||||
|
||||
#define write_cmd2(g, cmd1, cmd2) { write_cmd(g, cmd1); write_cmd(g, cmd2); }
|
||||
#define write_cmd3(g, cmd1, cmd2, cmd3) { write_cmd(g, cmd1); write_cmd(g, cmd2); write_cmd(g, cmd3); }
|
||||
|
||||
// Some common routines and macros
|
||||
#define delay(us) gfxSleepMicroseconds(us)
|
||||
#define delay_ms(ms) gfxSleepMilliseconds(ms)
|
||||
|
||||
#define xyaddr(x, y) ((x) + ((y)>>3)*GDISP_SCREEN_WIDTH)
|
||||
#define xybit(y) (1<<((y)&7))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* As this controller can't update on a pixel boundary we need to maintain the
|
||||
* the entire display surface in memory so that we can do the necessary bit
|
||||
* operations. Fortunately it is a small display in monochrome.
|
||||
* 64 * 128 / 8 = 1024 bytes.
|
||||
*/
|
||||
|
||||
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
|
||||
// The private area is the display surface.
|
||||
g->priv = gfxAlloc(sizeof(PrivData));
|
||||
PRIV(g)->buffer2 = false;
|
||||
PRIV(g)->data_pos = 0;
|
||||
|
||||
// Initialise the board interface
|
||||
init_board(g);
|
||||
|
||||
// Hardware reset
|
||||
setpin_reset(g, TRUE);
|
||||
gfxSleepMilliseconds(20);
|
||||
setpin_reset(g, FALSE);
|
||||
gfxSleepMilliseconds(20);
|
||||
acquire_bus(g);
|
||||
enter_cmd_mode(g);
|
||||
|
||||
write_cmd(g, ST7565_RESET);
|
||||
write_cmd(g, ST7565_LCD_BIAS);
|
||||
write_cmd(g, ST7565_ADC);
|
||||
write_cmd(g, ST7565_COM_SCAN);
|
||||
|
||||
write_cmd(g, ST7565_RESISTOR_RATIO | 0x1);
|
||||
write_cmd2(g, ST7565_CONTRAST, GDISP_INITIAL_CONTRAST);
|
||||
|
||||
// turn on internal power supply (VC=1, VR=1, VF=1)
|
||||
write_cmd(g, ST7565_POWER_CONTROL | 0x07);
|
||||
|
||||
write_cmd(g, ST7565_INVERT_DISPLAY);
|
||||
write_cmd(g, ST7565_ALLON_NORMAL);
|
||||
|
||||
write_cmd(g, ST7565_START_LINE | 0);
|
||||
write_cmd(g, ST7565_RMW);
|
||||
flush_cmd(g);
|
||||
|
||||
// Finish Init
|
||||
post_init_board(g);
|
||||
|
||||
// Release the bus
|
||||
release_bus(g);
|
||||
|
||||
/* Initialise the GDISP structure */
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Orientation = GDISP_ROTATE_0;
|
||||
g->g.Powermode = powerOff;
|
||||
g->g.Backlight = GDISP_INITIAL_BACKLIGHT;
|
||||
g->g.Contrast = GDISP_INITIAL_CONTRAST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if GDISP_HARDWARE_FLUSH
|
||||
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
|
||||
unsigned p;
|
||||
|
||||
// Don't flush if we don't need it.
|
||||
if (!(g->flags & GDISP_FLG_NEEDFLUSH))
|
||||
return;
|
||||
|
||||
acquire_bus(g);
|
||||
enter_cmd_mode(g);
|
||||
unsigned dstOffset = (PRIV(g)->buffer2 ? 4 : 0);
|
||||
for (p = 0; p < 4; p++) {
|
||||
write_cmd(g, ST7565_PAGE | (p + dstOffset));
|
||||
write_cmd(g, ST7565_COLUMN_MSB | 0);
|
||||
write_cmd(g, ST7565_COLUMN_LSB | 0);
|
||||
write_cmd(g, ST7565_RMW);
|
||||
flush_cmd(g);
|
||||
enter_data_mode(g);
|
||||
write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
|
||||
enter_cmd_mode(g);
|
||||
}
|
||||
unsigned line = (PRIV(g)->buffer2 ? 32 : 0);
|
||||
write_cmd(g, ST7565_START_LINE | line);
|
||||
flush_cmd(g);
|
||||
PRIV(g)->buffer2 = !PRIV(g)->buffer2;
|
||||
release_bus(g);
|
||||
|
||||
g->flags &= ~GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_DRAWPIXEL
|
||||
LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_270:
|
||||
x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
if (gdispColor2Native(g->p.color) != Black)
|
||||
RAM(g)[xyaddr(x, y)] |= xybit(y);
|
||||
else
|
||||
RAM(g)[xyaddr(x, y)] &= ~xybit(y);
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GDISP_HARDWARE_PIXELREAD
|
||||
LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
|
||||
coord_t x, y;
|
||||
|
||||
switch(g->g.Orientation) {
|
||||
default:
|
||||
case GDISP_ROTATE_0:
|
||||
x = g->p.x;
|
||||
y = g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
x = g->p.y;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
|
||||
break;
|
||||
case GDISP_ROTATE_180:
|
||||
x = GDISP_SCREEN_WIDTH-1 - g->p.x;
|
||||
y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
break;
|
||||
case GDISP_ROTATE_270:
|
||||
x = GDISP_SCREEN_HEIGHT-1 - g->p.y;
|
||||
y = g->p.x;
|
||||
break;
|
||||
}
|
||||
return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
|
||||
}
|
||||
#endif
|
||||
|
||||
LLDSPEC void gdisp_lld_blit_area(GDisplay *g) {
|
||||
uint8_t* buffer = (uint8_t*)g->p.ptr;
|
||||
int linelength = g->p.cx;
|
||||
for (int i = 0; i < g->p.cy; i++) {
|
||||
unsigned dstx = g->p.x;
|
||||
unsigned dsty = g->p.y + i;
|
||||
unsigned srcx = g->p.x1;
|
||||
unsigned srcy = g->p.y1 + i;
|
||||
unsigned srcbit = srcy * g->p.x2 + srcx;
|
||||
for(int j=0; j < linelength; j++) {
|
||||
uint8_t src = buffer[srcbit / 8];
|
||||
uint8_t bit = 7-(srcbit % 8);
|
||||
uint8_t bitset = (src >> bit) & 1;
|
||||
uint8_t* dst = &(RAM(g)[xyaddr(dstx, dsty)]);
|
||||
if (bitset) {
|
||||
*dst |= xybit(dsty);
|
||||
}
|
||||
else {
|
||||
*dst &= ~xybit(dsty);
|
||||
}
|
||||
dstx++;
|
||||
srcbit++;
|
||||
}
|
||||
}
|
||||
g->flags |= GDISP_FLG_NEEDFLUSH;
|
||||
}
|
||||
|
||||
#if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
|
||||
LLDSPEC void gdisp_lld_control(GDisplay *g) {
|
||||
switch(g->p.x) {
|
||||
case GDISP_CONTROL_POWER:
|
||||
if (g->g.Powermode == (powermode_t)g->p.ptr)
|
||||
return;
|
||||
switch((powermode_t)g->p.ptr) {
|
||||
case powerOff:
|
||||
case powerSleep:
|
||||
case powerDeepSleep:
|
||||
acquire_bus(g);
|
||||
enter_cmd_mode(g);
|
||||
write_cmd(g, ST7565_DISPLAY_OFF);
|
||||
flush_cmd(g);
|
||||
release_bus(g);
|
||||
break;
|
||||
case powerOn:
|
||||
acquire_bus(g);
|
||||
enter_cmd_mode(g);
|
||||
write_cmd(g, ST7565_DISPLAY_ON);
|
||||
flush_cmd(g);
|
||||
release_bus(g);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Powermode = (powermode_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if (g->g.Orientation == (orientation_t)g->p.ptr)
|
||||
return;
|
||||
switch((orientation_t)g->p.ptr) {
|
||||
/* Rotation is handled by the drawing routines */
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
g->g.Height = GDISP_SCREEN_HEIGHT;
|
||||
g->g.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
g->g.Height = GDISP_SCREEN_WIDTH;
|
||||
g->g.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
g->g.Orientation = (orientation_t)g->p.ptr;
|
||||
return;
|
||||
|
||||
case GDISP_CONTROL_CONTRAST:
|
||||
g->g.Contrast = (unsigned)g->p.ptr & 63;
|
||||
acquire_bus(g);
|
||||
enter_cmd_mode(g);
|
||||
write_cmd2(g, ST7565_CONTRAST, g->g.Contrast);
|
||||
flush_cmd(g);
|
||||
release_bus(g);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif // GDISP_NEED_CONTROL
|
||||
|
||||
#endif // GFX_USE_GDISP
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#ifndef _GDISP_LLD_CONFIG_H
|
||||
#define _GDISP_LLD_CONFIG_H
|
||||
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver hardware support. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
|
||||
#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
#define GDISP_HARDWARE_CONTROL TRUE
|
||||
#define GDISP_HARDWARE_BITFILLS TRUE
|
||||
|
||||
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
|
||||
|
||||
#endif /* GFX_USE_GDISP */
|
||||
|
||||
#endif /* _GDISP_LLD_CONFIG_H */
|
@ -1,8 +1,8 @@
|
||||
#BOOTMAGIC_ENABLE = yes # 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
|
||||
SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE ?= yes # USB Nkey Rollover
|
||||
CUSTOM_MATRIX ?= yes # Custom matrix file
|
||||
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
|
||||
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover
|
||||
CUSTOM_MATRIX = yes # Custom matrix file
|
@ -1,97 +1,17 @@
|
||||
Clueboard keyboard firmware
|
||||
======================
|
||||
# Clueboard 66%
|
||||
|
||||
DIY/Assembled compact 66% keyboard by [Clueboard](http://clueboard.co).
|
||||
![Clueboard](https://static1.squarespace.com/static/55c13bdee4b099be5dcb82eb/t/5867eeaad2b857fd0d196f4b/1494021396651/IMGP4201.jpg?format=1500w)
|
||||
|
||||
For the full Quantum Mechanical Keyboard feature list, see [the parent readme.md](/readme.md).
|
||||
A fully customizable 66% keyboard.
|
||||
|
||||
## First Time Setup
|
||||
* Keyboard Maintainer: [Zach White](https://github.com/skullydazed)
|
||||
* Hardware Supported: Clueboard 66% PCB
|
||||
* rev1 (1.0)
|
||||
* rev2 (2.0, 2.0.1, 2.1, 2.5, 2.5.1, 2.6)
|
||||
* Hardware Availability: [clueboard.co](https://clueboard.co/)
|
||||
|
||||
Download or clone the whole firmware and navigate to the keyboards/clueboard directory. Once your dev env is setup, you'll be able to generate the default .hex:
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
```
|
||||
$ make
|
||||
```
|
||||
make cluepad-default
|
||||
|
||||
You will see a lot of output and if everything worked correctly you will see something similar to this:
|
||||
|
||||
```
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
0 19992 0 19992 4e18 clueboard_rev2_default.hex
|
||||
```
|
||||
|
||||
At this point you can press RESET on your Clueboard and flash your keyboard with this command:
|
||||
|
||||
```
|
||||
$ make dfu
|
||||
```
|
||||
|
||||
If you would like to use one of the alternative keymaps, or create your own, see below.
|
||||
|
||||
## Clueboard 1.0
|
||||
|
||||
If you have a first generation Clueboard (one with a black PCB) you will need to use the revision 1 code. To do so add `rev1` to your make command, like this:
|
||||
|
||||
```
|
||||
$ make rev1
|
||||
```
|
||||
|
||||
And when flashing your keyboard:
|
||||
|
||||
```
|
||||
$ make rev1-dfu
|
||||
```
|
||||
|
||||
If you are flashing an alternative layout to your rev1, include both `rev1` and `<keymap>` in your command, for example when flashing max:
|
||||
|
||||
```
|
||||
$ make rev1-max-dfu
|
||||
```
|
||||
|
||||
## Alternate Keymaps
|
||||
|
||||
There are many alternative and user-contributed layouts available in the [keymaps/](keymaps/) directory. To compile and flash an alternative you will want to add `<keymap>` to your command:
|
||||
|
||||
```
|
||||
$ make skully
|
||||
```
|
||||
|
||||
And when flashing your keyboard, put `<keymap>` between "make" and "dfu":
|
||||
|
||||
```
|
||||
$ make skully-dfu
|
||||
```
|
||||
|
||||
### Notable Layouts
|
||||
|
||||
These layouts are notable for one reason or another. If you are looking for ideas or inspiration you should look at these first:
|
||||
|
||||
* [keymaps/default](keymaps/default) - The default Clueboard layout
|
||||
* [keymaps/max](keymaps/max) - A maximised layout that makes use of every key and feature of the Clueboard 2.0 PCB.
|
||||
* [keymaps/skully](keymaps/skully) - The layout that @skullydazed uses on his own Clueboards.
|
||||
|
||||
## Create Your Own Keymap
|
||||
|
||||
There are a lot of possibilities when creating your own keymap, and the primary documentation for doing that is [Customizing Your Keymap](/readme.md##customizing-your-keymap) in the main readme.md. As a way to get started, here is the procedure I recommend:
|
||||
|
||||
* Copy `[keymaps/default](keymaps/default/)` to `keymaps/<your_layout>`.
|
||||
* Compile the firmware (`$ make <your_layout>`)
|
||||
* Flash the firmware (`$ make <your_layout>-dfu`)
|
||||
* Make sure everything works like the default keyboard
|
||||
* Modify `keymaps/<your_layout>/readme.md` to tell others about your layout.
|
||||
* Modify `keymaps/<your_layout>/keymap.c` to reflect your desired layout.
|
||||
* Compile your new custom firmware (`$ make <your_layout>`)
|
||||
** If you have warnings you may flash without fixing them, but something may not work right.
|
||||
** If you have any errors you must fix them before continuing.
|
||||
* Flash the firmware (`$ make <your_layout>-dfu`)
|
||||
|
||||
## Share Your Keymap
|
||||
|
||||
Got your layout dialed in? Please share it with the world so we can benefit from your work! Simply submit a pull request with your layout and we'll include it in the official repository. Please use the following guidelines when putting together your pull request:
|
||||
|
||||
* Include a readme.md that states what your primary keyboard use is, how your layout differs from the default, and highlights anything you think makes your layout particularly great.
|
||||
* If your layout requires certain features (EG, RGB underlight or backlighting) ensure you have a Makefile and config.h that reflects that
|
||||
* If your layout requires special hardware to be added, please describe that in the readme.md
|
||||
|
||||
TODO: Write up or link quick how-to on creating and submitting a PR. (Pull requests accepted. :)
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||
|
@ -1,28 +1,13 @@
|
||||
cluecard keyboard firmware
|
||||
======================
|
||||
# Cluecard
|
||||
|
||||
## Quantum MK Firmware
|
||||
A simple QMK dev kit.
|
||||
|
||||
For the full Quantum feature list, see [the parent readme.md](/doc/readme.md).
|
||||
* Keyboard Maintainer: [Zach White](https://github.com/skullydazed)
|
||||
* Hardware Supported: Cluecard 1.0
|
||||
* Hardware Availability: Special gift from [skullydazed](https://github.com/skullydazed)
|
||||
|
||||
## Building
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
Download or clone the whole firmware and navigate to the keyboards/cluecard folder. Once your dev env is setup, you'll be able to type `make` to generate your .hex - you can then use the Teensy Loader to program your .hex file.
|
||||
make cluecard-default
|
||||
|
||||
Depending on which keymap you would like to use, you will have to compile slightly differently.
|
||||
|
||||
### Default
|
||||
|
||||
To build with the default keymap, simply run `make default`.
|
||||
|
||||
### Other Keymaps
|
||||
|
||||
Several version of keymap are available in advance but you are recommended to define your favorite layout yourself. To define your own keymap create a folder with the name of your keymap in the keymaps folder, and see keymap documentation (you can find in top readme.md) and existant keymap files.
|
||||
|
||||
To build the firmware binary hex file with a keymap just do `make` with a keymap like this:
|
||||
|
||||
```
|
||||
$ make [default|jack|<name>]
|
||||
```
|
||||
|
||||
Keymaps follow the format **__keymap.c__** and are stored in folders in the `keymaps` folder, eg `keymaps/my_keymap/`
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||
|
@ -1,4 +1,15 @@
|
||||
Cluepad number pad firmware
|
||||
======================
|
||||
# Cluepad
|
||||
|
||||
TODO: to be updated.
|
||||
![Cluepad](https://static1.squarespace.com/static/55c13bdee4b099be5dcb82eb/5842fbdce3df28eae5ec557e/5844fb2cb8a79bbdfd63bad1/1498501250178/IMGP3931.jpg?format=750w)
|
||||
|
||||
A basic 17 key numpad PCB.
|
||||
|
||||
* Keyboard Maintainer: [Zach White](https://github.com/skullydazed)
|
||||
* Hardware Supported: Cluepad PCB 1.0
|
||||
* Hardware Availability: [clueboard.co](https://clueboard.co/)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make cluepad-default
|
||||
|
||||
See [build environment setup](https://docs.qmk.fm/build_environment_setup.html) then the [make instructions](https://docs.qmk.fm/make_instructions.html) for more information.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue