diff options
110 files changed, 18629 insertions, 9261 deletions
diff --git a/1-setup-path-win.bat b/1-setup-path-win.bat index 2c15857bb7..f612d0f4a7 100644 --- a/1-setup-path-win.bat +++ b/1-setup-path-win.bat @@ -5,8 +5,14 @@ SET CMDLINERUNSTR=%SystemRoot%\system32\cmd.exe SET NEWPATH1="C:\MinGW\msys\1.0\bin" SET NEWPATH2="C:\MinGW\bin" -:: Make sure paths exist -IF NOT EXIST !NEWPATH1! (ECHO Path not found: %NEWPATH1% && GOTO ExitBatch) +:: Make sure we're running with administrator privileges +NET SESSION >nul 2>&1 +IF ERRORLEVEL 1 ( + ECHO FAILED. Run this script with administrator privileges. + GOTO ExitBatch +) + +:: Make sure the second path exists. The first path won't be created until the second script is run IF NOT EXIST !NEWPATH2! (ECHO Path not found: %NEWPATH2% && GOTO ExitBatch) :: Add paths diff --git a/2-setup-environment-win.bat b/2-setup-environment-win.bat index 91b6c91e39..905338087a 100644 --- a/2-setup-environment-win.bat +++ b/2-setup-environment-win.bat @@ -1,41 +1,63 @@ -@echo off -setx /M test test > nul 2>&1 -if NOT ["%errorlevel%"]==["0"] ( - echo FAILED. Rerun with administrator privileges. - pause - exit +@SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION +@ECHO OFF + +SET STARTINGDIR=%CD% + +:: Check for admin privilages +SETX /M test test > nul 2>&1 +IF NOT ["%ERRORLEVEL%"]==["0"] ( + ECHO FAILED. Rerun with administrator privileges. + GOTO ExitBatch ) -echo ------------------------------------------ -echo Installing wget and unzip -echo ------------------------------------------ +:: Make sure path to MinGW exists - if so, CD to it +SET MINGWPATH="C:\MinGW\bin" +IF NOT EXIST !MINGWPATH! (ECHO Path not found: %MINGWPATH% && GOTO ExitBatch) +CD /D %MINGWPATH% + + +ECHO ------------------------------------------ +ECHO Installing wget and unzip +ECHO ------------------------------------------ mingw-get install msys-wget-bin msys-unzip-bin -cd \MinGW\bin -mkdir temp -cd temp -echo ------------------------------------------ -echo Installing dfu-programmer. -echo ------------------------------------------ +MKDIR temp +CD temp + +ECHO ------------------------------------------ +ECHO Installing dfu-programmer. +ECHO ------------------------------------------ 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 -copy dfu-programmer.exe .. +COPY dfu-programmer.exe .. -echo ------------------------------------------ -echo Downloading driver -echo ------------------------------------------ +ECHO ------------------------------------------ +ECHO Downloading driver +ECHO ------------------------------------------ wget http://iweb.dl.sourceforge.net/project/libusb-win32/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip unzip libusb-win32-bin-1.2.6.0.zip -cp libusb-win32-bin-1.2.6.0\bin\x86\libusb0_x86.dll ../libusb0.dll +COPY libusb-win32-bin-1.2.6.0\bin\x86\libusb0_x86.dll ../libusb0.dll + +ECHO ------------------------------------------ +ECHO Installing driver. Accept prompt. +ECHO ------------------------------------------ +IF EXIST "%WinDir%\System32\PnPUtil.exe" (%WinDir%\System32\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND) +IF EXIST "%WinDir%\Sysnative\PnPUtil.exe" (%WinDir%\Sysnative\PnPUtil.exe -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf && GOTO PNPUTILFOUND) + +ECHO FAILED. Could not find PnPUtil.exe in "%WinDir%\System32" or "%WinDir%\Sysnative". + +:PNPUTILFOUND -echo ------------------------------------------ -echo Installing driver. Accept prompt. -echo ------------------------------------------ -pnputil -i -a dfu-prog-usb-1.2.2\atmel_usb_dfu.inf +:: Wait then delete directory +ping -n 5 127.0.0.1 > NUL 2>&1 +CD .. +RD /s /q temp -cd .. -rm -rf temp +ECHO ------------------------------------------ +ECHO Finished! -echo ------------------------------------------ -echo Finished! -pause
\ No newline at end of file +:ExitBatch +CD /D %STARTINGDIR% +ENDLOCAL +PAUSE +EXIT /b
\ No newline at end of file @@ -16,13 +16,21 @@ The documentation below explains QMK customizations and elaborates on some of th * If you're looking to customize a keyboard that currently runs QMK or TMK, find your keyboard's directory under `keyboard/` and run the make commands from there. * If you're looking to apply this firmware to an entirely new hardware project (a new kind of keyboard), you can create your own Quantum-based project by using `./new_project.sh <project_name>`, which will create `/keyboard/<project_name>` with all the necessary components for a Quantum project. +### Makefile Options + You have access to a bunch of goodies! Check out the Makefile to enable/disable some of the features. Uncomment the `#` to enable them. Setting them to `no` does nothing and will only confuse future you. BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality MIDI_ENABLE = yes # MIDI controls - # UNICODE_ENABLE = yes # Unicode support - this is commented out, just as an example. You have to use #, not // + UNICODE_ENABLE = no # <-- This is how you disable an option, just set it to "no" BLUETOOTH_ENABLE = yes # Enable Bluetooth with the Adafruit EZ-Key HID +### Customizing Makefile options on a per-keymap basis + +If your keymap directory has a file called `makefile.mk` (note the lowercase filename, and the `.mk` extension), any Makefile options you set in that file will take precedence over other Makefile options (those set for Quantum as a whole or for your particular keyboard). + +So let's say your keyboard's makefile has `CONSOLE_ENABLE = yes` (or maybe doesn't even list the `CONSOLE_ENABLE` option, which would cause it to revert to the global Quantum default). You want your particular keymap to not have the debug console, so you make a file called `makefile.mk` and specify `CONSOLE_ENABLE = no`. + ## Quick aliases to common actions Your keymap can include shortcuts to common operations (called "function actions" in tmk). @@ -199,6 +207,27 @@ This will clear all mods currently pressed. This will clear all keys besides the mods currently pressed. +* `update_tri_layer(layer_1, layer_2, layer_3);` + +If the user attempts to activate layer 1 AND layer 2 at the same time (for example, by hitting their respective layer keys), layer 3 will be activated. Layers 1 and 2 will _also_ be activated, for the purposes of fallbacks (so a given key will fall back from 3 to 2, to 1 -- and only then to 0). + +#### Naming your macros + +If you have a bunch of macros you want to refer to from your keymap, while keeping the keymap easily readable, you can just name them like so: + +``` +#define AUD_OFF M(6) +#define AUD_ON M(7) +#define MUS_OFF M(8) +#define MUS_ON M(9) +#define VC_IN M(10) +#define VC_DE M(11) +#define PLOVER M(12) +#define EXT_PLV M(13) +``` + +As was done on the [Planck default keymap](/keyboard/planck/keymaps/default/keymap.c#L33-L40) + #### Timer functionality It's possible to start timers and read values for time-specific events - here's an example: @@ -215,11 +244,91 @@ if (timer_elapsed(key_timer) < 100) { It's best to declare the `static uint16_t key_timer;` outside of the macro block (top of file, etc). +#### Example 1: Single-key copy/paste (hold to copy, tap to paste) + +With QMK, it's easy to make one key do two things, as long as one of those things is being a modifier. :) So if you want a key to act as Ctrl when held and send the letter R when tapped, that's easy: `CTL_T(KC_R)`. But what do you do when you want that key to send Ctrl-V (paste) when tapped, and Ctrl-C (copy) when held? + +Here's what you do: + + +``` +static uint16_t key_timer; + +const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) +{ + switch(id) { + case 0: { + if (record->event.pressed) { + key_timer = timer_read(); // if the key is being pressed, we start the timer. + } + else { // this means the key was just released, so we can figure out how long it was pressed for (tap or "held down"). + if (timer_elapsed(key_timer) > 150) { // 150 being 150ms, the threshhold we pick for counting something as a tap. + |