Compare commits

...

4 Commits

Author SHA1 Message Date
Ryan
19b70b2737 MSYS2: Switch to bootloadHID package and bring back avrdude package (#9736)
* MSYS2: Switch to bootloadHID package and bring back avrdude package

* Update Zadig docs as well
2020-07-16 18:01:34 +01:00
Konstantin Đorđević
61b64bb82a Redefine IS_LAYER_ON/OFF() as aliases for existing layer functions (#6352)
* Add IS_LAYER_ON_STATE()/IS_LAYER_OFF_STATE() macros

* Add docs for IS_LAYER_ON/OFF(_STATE) macros

* Remove IS_LAYER_ON/OFF_STATE redefinition in userspace

* Run clang-format on quantum/quantum.h

* Redefine IS_LAYER_ON/OFF(_STATE) as aliases of existing layer functions

Also update relevant doc entries.

Needs testing to check if this breaks existing IS_LAYER_ON/OFF usage in certain
edge cases (namely calling the macros with 0).

* Reformat layer check function docs
2020-07-16 22:27:55 +10:00
Drashna Jaelre
f11437aef3 Allow for user song list (#9281) 2020-07-16 16:45:50 +10:00
Hedgestock
fc13315300 Fixed CA_DOTA key code (#9722) 2020-07-16 15:50:51 +10:00
13 changed files with 154 additions and 68 deletions

3
.gitignore vendored
View File

@@ -73,3 +73,6 @@ __pycache__
# prerequisites for updating ChibiOS
/util/fmpp*
# Allow to exist but don't include it in the repo
user_song_list.h

View File

@@ -319,7 +319,7 @@ This runs code every time that the layers get changed. This can be useful for l
### Example `layer_state_set_*` Implementation
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example
This example shows how to set the [RGB Underglow](feature_rgblight.md) lights based on the layer, using the Planck as an example.
```c
layer_state_t layer_state_set_user(layer_state_t state) {
@@ -343,6 +343,11 @@ layer_state_t layer_state_set_user(layer_state_t state) {
return state;
}
```
Use the `IS_LAYER_ON_STATE(state, layer)` and `IS_LAYER_OFF_STATE(state, layer)` macros to check the status of a particular layer.
Outside of `layer_state_set_*` functions, you can use the `IS_LAYER_ON(layer)` and `IS_LAYER_OFF(layer)` macros to check global layer state.
### `layer_state_set_*` Function Documentation
* Keyboard/Revision: `layer_state_t layer_state_set_kb(layer_state_t state)`

View File

@@ -23,7 +23,7 @@ Zadig will automatically detect the bootloader device. You may sometimes need to
!> If Zadig lists one or more devices with the `HidUsb` driver, your keyboard is probably not in bootloader mode. The arrow will be colored orange and you will be asked to confirm modifying a system driver. **Do not** proceed if this is the case!
If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list. For flashing a USBaspLoader device via command line with msys2, the `libusbk` driver is recommended, otherwise `libusb-win32` will work fine if you are using QMK Toolbox for flashing.
If the arrow appears green, select the driver, and click **Install Driver**. The `libusb-win32` driver will usually work for AVR, and `WinUSB` for ARM, but if you still cannot flash the board, try installing a different driver from the list. USBAspLoader devices must use the `libusbK` driver.
![Zadig with a bootloader driver correctly installed](https://i.imgur.com/b8VgXzx.png)

View File

@@ -74,10 +74,9 @@ There are a number of functions (and variables) related to how you can use or ma
| [`update_tri_layer(x, y, z)`](ref_functions.md#update_tri_layerx-y-z) | Checks if layers `x` and `y` are both on, and sets `z` based on that (on if both on, otherwise off). |
| [`update_tri_layer_state(state, x, y, z)`](ref_functions.md#update_tri_layer_statestate-x-y-z) | Does the same as `update_tri_layer(x, y, z)`, but from `layer_state_set_*` functions. |
In addition to the functions that you can call, there are a number of callback functions that get called every time the layer changes. This passes the layer state to the function, where it can be read or modified.
In additional to the functions that you can call, there are a number of callback functions that get called every time the layer changes. This passed the layer state to the function, which can be read or modified.
|Callbacks |Description |
|Callback |Description |
|-----------------------------------------------------|----------------------------------------------------------------------------------------|
| `layer_state_set_kb(layer_state_t state)` | Callback for layer functions, for keyboard. |
| `layer_state_set_user(layer_state_t state)` | Callback for layer functions, for users. |
@@ -86,9 +85,9 @@ In additional to the functions that you can call, there are a number of callback
?> For additional details on how you can use these callbacks, check out the [Layer Change Code](custom_quantum_functions.md#layer-change-code) document.
|Check functions |Description |
|-------------------------------------------|------------------------------------------------------------------------------|
| `layer_state_cmp(cmp_layer_state, layer)` | This checks the `cmp_layer_state` to see if the specific `layer` is enabled. This is meant for use with the layer callbacks. |
| `layer_state_is(layer)` | This checks the layer state to see if the specific `layer` is enabled. (calls `layer_state_cmp` for the global layer state). |
It is also possible to check the state of a particular layer using the following functions and macros.
!> There is `IS_LAYER_ON(layer)` as well, however the `layer_state_cmp` function has some additional handling to ensure that on layer 0 that it returns the correct value. Otherwise, if you check to see if layer 0 is on, you may get an incorrect value returned.
|Function |Description |Aliases
|---------------------------------|-------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| `layer_state_is(layer)` | Checks if the specified `layer` is enabled globally. | `IS_LAYER_ON(layer)`, `IS_LAYER_OFF(layer)` |
| `layer_state_cmp(state, layer)` | Checks `state` to see if the specified `layer` is enabled. Intended for use in layer callbacks. | `IS_LAYER_ON_STATE(state, layer)`, `IS_LAYER_OFF_STATE(state, layer)` |

View File

@@ -20,6 +20,12 @@
#include "musical_notes.h"
#if __GNUC__ > 5 // don't use for older gcc compilers since check isn't supported.
# if __has_include("user_song_list.h")
# include "user_song_list.h"
# endif // if file exists
#endif // __GNUC__
#define NO_SOUND
/* Ode to Joy
@@ -146,44 +152,126 @@
* proof of permission to use them, or public domain status.
*/
#define CLOSE_ENCOUNTERS_5_NOTE
#define DOE_A_DEER
#define IN_LIKE_FLINT
#define IMPERIAL_MARCH
#define BASKET_CASE
#define COIN_SOUND
#define ONE_UP_SOUND
#define SONIC_RING
#define ZELDA_PUZZLE
#define ZELDA_TREASURE
#define OVERWATCH_THEME
#define MARIO_THEME
#define MARIO_GAMEOVER
#define MARIO_MUSHROOM
#define E1M1_DOOM
#define DISNEY_SONG
#define NUMBER_ONE
#define CABBAGE_SONG
#define OLD_SPICE
#define VICTORY_FANFARE_SHORT
#define ALL_STAR
#define RICK_ROLL
#define FF_PRELUDE
#define TO_BOLDLY_GO
#define KATAWARE_DOKI
#define MEGALOVANIA
#define MICHISHIRUBE
#define LIEBESLEID
#define MELODIES_OF_LIFE
#define EYES_ON_ME
#define SONG_OF_THE_ANCIENTS
#define NIER_AMUSEMENT_PARK
#define COPIED_CITY
#define VAGUE_HOPE_COLD_RAIN
#define KAINE_SALVATION
#define WEIGHT_OF_THE_WORLD
#define ISABELLAS_LULLABY
#define TERRAS_THEME
#define RENAI_CIRCULATION
#define PLATINUM_DISCO
#define LP_NUMB
#ifndef CLOSE_ENCOUNTERS_5_NOTE
# define CLOSE_ENCOUNTERS_5_NOTE
#endif
#ifndef DOE_A_DEER
# define DOE_A_DEER
#endif
#ifndef IN_LIKE_FLINT
# define IN_LIKE_FLINT
#endif
#ifndef IMPERIAL_MARCH
# define IMPERIAL_MARCH
#endif
#ifndef BASKET_CASE
# define BASKET_CASE
#endif
#ifndef COIN_SOUND
# define COIN_SOUND
#endif
#ifndef ONE_UP_SOUND
# define ONE_UP_SOUND
#endif
#ifndef SONIC_RING
# define SONIC_RING
#endif
#ifndef ZELDA_PUZZLE
# define ZELDA_PUZZLE
#endif
#ifndef ZELDA_TREASURE
# define ZELDA_TREASURE
#endif
#ifndef OVERWATCH_THEME
# define OVERWATCH_THEME
#endif
#ifndef MARIO_THEME
# define MARIO_THEME
#endif
#ifndef MARIO_GAMEOVER
# define MARIO_GAMEOVER
#endif
#ifndef MARIO_MUSHROOM
# define MARIO_MUSHROOM
#endif
#ifndef E1M1_DOOM
# define E1M1_DOOM
#endif
#ifndef DISNEY_SONG
# define DISNEY_SONG
#endif
#ifndef NUMBER_ONE
# define NUMBER_ONE
#endif
#ifndef CABBAGE_SONG
# define CABBAGE_SONG
#endif
#ifndef OLD_SPICE
# define OLD_SPICE
#endif
#ifndef VICTORY_FANFARE_SHORT
# define VICTORY_FANFARE_SHORT
#endif
#ifndef ALL_STAR
# define ALL_STAR
#endif
#ifndef RICK_ROLL
# define RICK_ROLL
#endif
#ifndef FF_PRELUDE
# define FF_PRELUDE
#endif
#ifndef TO_BOLDLY_GO
# define TO_BOLDLY_GO
#endif
#ifndef KATAWARE_DOKI
# define KATAWARE_DOKI
#endif
#ifndef MEGALOVANIA
# define MEGALOVANIA
#endif
#ifndef MICHISHIRUBE
# define MICHISHIRUBE
#endif
#ifndef LIEBESLEID
# define LIEBESLEID
#endif
#ifndef MELODIES_OF_LIFE
# define MELODIES_OF_LIFE
#endif
#ifndef EYES_ON_ME
# define EYES_ON_ME
#endif
#ifndef SONG_OF_THE_ANCIENTS
# define SONG_OF_THE_ANCIENTS
#endif
#ifndef NIER_AMUSEMENT_PARK
# define NIER_AMUSEMENT_PARK
#endif
#ifndef COPIED_CITY
# define COPIED_CITY
#endif
#ifndef VAGUE_HOPE_COLD_RAIN
# define VAGUE_HOPE_COLD_RAIN
#endif
#ifndef KAINE_SALVATION
# define KAINE_SALVATION
#endif
#ifndef WEIGHT_OF_THE_WORLD
# define WEIGHT_OF_THE_WORLD
#endif
#ifndef ISABELLAS_LULLABY
# define ISABELLAS_LULLABY
#endif
#ifndef TERRAS_THEME
# define TERRAS_THEME
#endif
#ifndef RENAI_CIRCULATION
# define RENAI_CIRCULATION
#endif
#ifndef PLATINUM_DISCO
# define PLATINUM_DISCO
#endif
#ifndef LP_NUMB
# define LP_NUMB
#endif

View File

@@ -204,7 +204,7 @@
#define CA_APSN RCTL(CA_N) // ʼn
#define CA_MICR RCTL(CA_M) // μ
#define CA_HRZB RCTL(CA_COMM) // ―
#define CA_DOTA ALGR(CA_DOT) // ˙ (dead)
#define CA_DOTA RCTL(CA_DOT) // ˙ (dead)
/* Shift+Right Ctrl symbols
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐

View File

@@ -249,8 +249,11 @@ void set_single_persistent_default_layer(uint8_t default_layer);
void tap_random_base64(void);
#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))
#define IS_LAYER_ON(layer) layer_state_is(layer)
#define IS_LAYER_OFF(layer) !layer_state_is(layer)
#define IS_LAYER_ON_STATE(state, layer) layer_state_cmp(state, layer)
#define IS_LAYER_OFF_STATE(state, layer) !layer_state_cmp(state, layer)
void matrix_init_kb(void);
void matrix_scan_kb(void);

View File

@@ -48,9 +48,6 @@
#define LCT_CPS LCTL_T(KC_CAPS)
#define RSF_SLS RSFT_T(KC_SLSH)
#define IS_LAYER_ON_STATE(state, layer) ( (state) & (1UL << (layer)))
#define IS_LAYER_OFF_STATE(state, layer) (~(state) & (1UL << (layer)))
// Clear mods, perform action, restore mods
#define CLEAN_MODS(action) { \
uint8_t mods = get_mods(); \

View File

@@ -5,7 +5,6 @@ function export_variables {
export PATH=$PATH:$util_dir
export PATH=$PATH:$util_dir/dfu-programmer
export PATH=$PATH:$util_dir/dfu-util-0.9-win64
export PATH=$PATH:$util_dir/bootloadHID.2012-12-08/commandline
export PATH=$PATH:$util_dir/avr8-gnu-toolchain/bin
export PATH=$PATH:$util_dir/gcc-arm-none-eabi/bin
}

View File

@@ -7,7 +7,6 @@ function export_variables {
export DFU_PROGRAMMER=$download_dir/dfu-programmer/dfu-programmer.exe
export DFU_UTIL=$download_dir/dfu-util-0.9-win64/dfu-util.exe
export TEENSY_LOADER_CLI=$download_dir/teensy_loader_cli.exe
export BOOTLOADHID_PROGRAMMER=$download_dir/bootloadHID.2012-12-08/commandline/bootloadHID.exe
}
export_variables

View File

@@ -4,7 +4,7 @@
# Driver can be one of winusb,libusb,libusbk
# Use Windows Powershell and type [guid]::NewGuid() to generate guids
winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75
libusb,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724
libusbk,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724
winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af
libusb,ATmega16U2,03EB,2FEF,007274da-b75f-492e-a288-8fc0aff8339f
libusb,ATmega32U2,03EB,2FF0,ddc2c572-cb6e-4f61-a6cc-1a5de941f063

View File

@@ -20,10 +20,7 @@ function install_avr {
rm avr8-gnu-toolchain/bin/make.exe
rm avr-gcc-8.3.0-x86-mingw.zip
# FIXME: As of 2020-05-19, the MSYS2 avrdude cannot flash USBaspLoader devices, for some reason
# (warning: cannot set sck period)
# However, the avr-gcc toolchain above contains an avrdude which can, so let's just not install this for now
#pacman --needed --disable-download-timeout -S mingw-w64-x86_64-avrdude
pacman --needed --disable-download-timeout -S mingw-w64-x86_64-avrdude mingw-w64-x86_64-bootloadhid
}
function install_arm {

View File

@@ -18,10 +18,6 @@ function install_utils {
wget 'https://www.pjrc.com/teensy/teensy_loader_cli_windows.zip'
unzip teensy_loader_cli_windows.zip
echo "Installing bootloadHID"
wget 'https://www.obdev.at/downloads/vusb/bootloadHID.2012-12-08.zip'
unzip bootloadHID.2012-12-08.zip
echo "Downloading the QMK driver installer"
wget -qO- https://api.github.com/repos/qmk/qmk_driver_installer/releases | grep browser_download_url | head -n 1 | cut -d '"' -f 4 | wget -i -