Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f30b402a2 | ||
|
|
1ff526dac0 | ||
|
|
e17b55e33a | ||
|
|
f31bf1b202 | ||
|
|
5f82b0782f | ||
|
|
2e6959ed87 | ||
|
|
c482a2944b | ||
|
|
e182a38e7c | ||
|
|
fe4581c1a1 | ||
|
|
ddd055b1e2 | ||
|
|
f7324ec684 | ||
|
|
750c7c2bdb | ||
|
|
4846c8eba0 | ||
|
|
830bd5460c | ||
|
|
9f54a26dc0 | ||
|
|
16a15c1cfc | ||
|
|
37a4b53c4f | ||
|
|
231464c49c | ||
|
|
d26a14c169 | ||
|
|
195be50745 | ||
|
|
8fdb229b66 | ||
|
|
fd3456f362 | ||
|
|
812d80efbd | ||
|
|
86c4c4e91d | ||
|
|
5f5c2a219c | ||
|
|
e415198235 | ||
|
|
b17482c3fd | ||
|
|
5b4870c046 | ||
|
|
47fc2f8855 | ||
|
|
ee29b515ec | ||
|
|
c031e13982 | ||
|
|
a6bd8fe67b | ||
|
|
db4b11f866 |
No files matched your search
@@ -75,6 +75,7 @@
|
|||||||
* [Layers](feature_layers.md)
|
* [Layers](feature_layers.md)
|
||||||
* [One Shot Keys](one_shot_keys.md)
|
* [One Shot Keys](one_shot_keys.md)
|
||||||
* [Pointing Device](feature_pointing_device.md)
|
* [Pointing Device](feature_pointing_device.md)
|
||||||
|
* [Raw HID](feature_rawhid.md)
|
||||||
* [Swap Hands](feature_swap_hands.md)
|
* [Swap Hands](feature_swap_hands.md)
|
||||||
* [Tap Dance](feature_tap_dance.md)
|
* [Tap Dance](feature_tap_dance.md)
|
||||||
* [Tap-Hold Configuration](tap_hold.md)
|
* [Tap-Hold Configuration](tap_hold.md)
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
# Raw HID
|
||||||
|
|
||||||
|
Raw HID allows for bidirectional communication between QMK and the host computer over an HID interface. This has many potential use cases, such as switching keymaps on the fly or changing RGB LED colors and modes.
|
||||||
|
|
||||||
|
There are two main components to getting raw HID working with your keyboard.
|
||||||
|
|
||||||
|
## Keyboard firmware
|
||||||
|
|
||||||
|
The implementation is fairly straightforward for the firmware.
|
||||||
|
In your `rules.mk` add:
|
||||||
|
|
||||||
|
```make
|
||||||
|
RAW_ENABLE = yes
|
||||||
|
```
|
||||||
|
|
||||||
|
In your `keymap.c` include `"raw_hid.h"` and implement the following:
|
||||||
|
|
||||||
|
```C
|
||||||
|
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||||
|
// Your code goes here. data is the packet received from host.
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `"raw_hid.h"` header also declares `void raw_hid_send(uint8_t *data, uint8_t length);` which allows sending packets from keyboard to host. As an example, it can also be used for debugging when building your host application by returning all data back to the host.
|
||||||
|
|
||||||
|
```C
|
||||||
|
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||||
|
raw_hid_send(data, length);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`raw_hid_receive` can receive variable size packets from host with maximum length `RAW_EPSIZE`. `raw_hid_send` on the other hand can send packets to host of exactly `RAW_EPSIZE` length, therefore it should be used with data of length `RAW_EPSIZE`.
|
||||||
|
|
||||||
|
Make sure to flash raw enabled firmware before proceeding with working on the host side.
|
||||||
|
|
||||||
|
## Host (Windows/macOS/Linux)
|
||||||
|
|
||||||
|
This is the more complicated part as it will require some digging.
|
||||||
|
|
||||||
|
To connect your host computer to your keyboard with raw HID you need four pieces of information about your keyboard:
|
||||||
|
|
||||||
|
1. Vendor ID
|
||||||
|
2. Product ID
|
||||||
|
3. Usage Page
|
||||||
|
4. Usage
|
||||||
|
|
||||||
|
The first two can easily be found in your keyboard's `config.h` in the keyboard's main directory under `VENDOR_ID` and `PRODUCT_ID`. **Usage Page** is **`0xFF60`** and **Usage** is **`0x0061`**.
|
||||||
|
|
||||||
|
### Building your host
|
||||||
|
|
||||||
|
You can build your host using any language that has an available HID implementation library if you don't wish to make your own. The ones we know of for popular languages are:
|
||||||
|
|
||||||
|
* Node: [node-hid](https://github.com/node-hid/node-hid).
|
||||||
|
* C: [hidapi](https://github.com/libusb/hidapi).
|
||||||
|
* Java: [purejavahidapi](https://github.com/nyholku/purejavahidapi) and [hid4java](https://github.com/gary-rowe/hid4java).
|
||||||
|
* Python: [pyhidapi](https://pypi.org/project/hid/).
|
||||||
|
|
||||||
|
This is not an exhaustive cross-platform list but should get you started. There are no special requirements for using raw HID so any HID library should work.
|
||||||
|
|
||||||
|
Now that you have all four pieces of information required to open HID interface to your keyboard. All you need to do is use your library's available functions to open the device with its ID parameters.
|
||||||
|
|
||||||
|
Note that Vendor ID and Product ID are not actually required to open the device. They are used only to filter to a specific device out of the many HID devices you have plugged in. Many libraries will give you the option to open the device using Product Name or Manufacturer Name instead, `node-hid` being a prime example. This will create issues for devices with builtin USB Hub or any extra HID interfaces where you will have multiple interfaces with the same name or from the same manufacturer. The Vendor ID together with Product ID create a unique designation to a single interface and will not exhibit this problem. Therefore, even if your library doesn't require you to, it is best to use them to avoid issues.
|
||||||
|
Unlike Vendor ID and Product ID though, Usage Page and Usage are necessary for successful communication.
|
||||||
|
|
||||||
|
It should go without saying that regardless of the library you're using, you should always make sure to close the interface when finished. Depending on the operating system and your particular environment there may be issues connecting to it again afterwards with another client or another instance of the same client if it's not explicitly closed.
|
||||||
+2
-1
@@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
// Moved pages
|
// Moved pages
|
||||||
'/adding_a_keyboard_to_qmk': '/hardware_keyboard_guidelines',
|
'/adding_a_keyboard_to_qmk': '/hardware_keyboard_guidelines',
|
||||||
'/build_environment_setup': '/getting_started_build_tools',
|
'/build_environment_setup': '/newbs_getting_started',
|
||||||
'/cli_dev_configuration': '/cli_configuration',
|
'/cli_dev_configuration': '/cli_configuration',
|
||||||
'/dynamic_macros': '/feature_dynamic_macros',
|
'/dynamic_macros': '/feature_dynamic_macros',
|
||||||
'/feature_common_shortcuts': '/feature_advanced_keycodes',
|
'/feature_common_shortcuts': '/feature_advanced_keycodes',
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
'/tap_dance': '/feature_tap_dance',
|
'/tap_dance': '/feature_tap_dance',
|
||||||
'/unicode': '/feature_unicode',
|
'/unicode': '/feature_unicode',
|
||||||
'/python_development': '/cli_development',
|
'/python_development': '/cli_development',
|
||||||
|
'/getting_started_build_tools':'/newbs_getting_started',
|
||||||
},
|
},
|
||||||
basePath: '/',
|
basePath: '/',
|
||||||
name: 'QMK Firmware',
|
name: 'QMK Firmware',
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ The following functions can provide basic control of GPIOs and are found in `qua
|
|||||||
| `writePinLow(pin)` | Set pin level as low, assuming it is an output | `PORTB &= ~(1<<2)` | `palClearLine(pin)` |
|
| `writePinLow(pin)` | Set pin level as low, assuming it is an output | `PORTB &= ~(1<<2)` | `palClearLine(pin)` |
|
||||||
| `writePin(pin, level)` | Set pin level, assuming it is an output | `(level) ? PORTB \|= (1<<2) : PORTB &= ~(1<<2)` | `(level) ? palSetLine(pin) : palClearLine(pin)` |
|
| `writePin(pin, level)` | Set pin level, assuming it is an output | `(level) ? PORTB \|= (1<<2) : PORTB &= ~(1<<2)` | `(level) ? palSetLine(pin) : palClearLine(pin)` |
|
||||||
| `readPin(pin)` | Returns the level of the pin | `_SFR_IO8(pin >> 4) & _BV(pin & 0xF)` | `palReadLine(pin)` |
|
| `readPin(pin)` | Returns the level of the pin | `_SFR_IO8(pin >> 4) & _BV(pin & 0xF)` | `palReadLine(pin)` |
|
||||||
|
| `togglePin(pin)` | Invert pin level, assuming it is an output | `PORTB ^= (1<<2)` | `palToggleLine(pin)` |
|
||||||
|
|
||||||
## Advanced Settings :id=advanced-settings
|
## Advanced Settings :id=advanced-settings
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,163 @@
|
|||||||
|
# 触覚フィードバック
|
||||||
|
|
||||||
|
<!---
|
||||||
|
original document: 0.8.123:docs/feature_haptic_feedback.md
|
||||||
|
git diff 0.8.123 HEAD -- docs/feature_haptic_feedback.md | cat
|
||||||
|
-->
|
||||||
|
|
||||||
|
## 触覚フィードバック の rules.mk オプション
|
||||||
|
|
||||||
|
現在のところ、`rules.mk` で触覚フィードバック用に以下のオプションを利用可能です:
|
||||||
|
|
||||||
|
`HAPTIC_ENABLE += DRV2605L`
|
||||||
|
|
||||||
|
`HAPTIC_ENABLE += SOLENOID`
|
||||||
|
|
||||||
|
## サポートされる既知のハードウェア
|
||||||
|
|
||||||
|
| 名前 | 説明 |
|
||||||
|
|--------------------|-------------------------------------------------|
|
||||||
|
| [LV061228B-L65-A](https://www.digikey.com/product-detail/en/jinlong-machinery-electronics-inc/LV061228B-L65-A/1670-1050-ND/7732325) | z-axis 2v LRA |
|
||||||
|
| [Mini Motor Disc](https://www.adafruit.com/product/1201) | small 2-5v ERM |
|
||||||
|
|
||||||
|
## 触覚キーコード
|
||||||
|
|
||||||
|
以下のキーコードは、選択した触覚メカニズムに依存して動作するかどうか決まります。
|
||||||
|
|
||||||
|
| 名前 | 説明 |
|
||||||
|
|-----------|-------------------------------------------------------|
|
||||||
|
| `HPT_ON` | 触覚フィードバックをオン |
|
||||||
|
| `HPT_OFF` | 触覚フィードバックをオフ |
|
||||||
|
| `HPT_TOG` | 触覚フィードバックのオン/オフを切り替え |
|
||||||
|
| `HPT_RST` | 触覚フィードバック設定をデフォルトに戻す |
|
||||||
|
| `HPT_FBK` | キー押下またはリリースまたはその両方でフィードバックを切り替え |
|
||||||
|
| `HPT_BUZ` | ソレノイドの振動のオン/オフを切り替え |
|
||||||
|
| `HPT_MODI` | 次の DRV2605L 波形に移動 |
|
||||||
|
| `HPT_MODD` | 前の DRV2605L 波形に移動 |
|
||||||
|
| `HPT_CONT` | 連続触覚モードのオン/オフを切り替え |
|
||||||
|
| `HPT_CONI` | DRV2605L の連続触覚強度を増加 |
|
||||||
|
| `HPT_COND` | DRV2605L の連続触覚強度を減少 |
|
||||||
|
| `HPT_DWLI` | ソレノイドの滞留時間を増加 |
|
||||||
|
| `HPT_DWLD` | ソレノイドの滞留時間を減少 |
|
||||||
|
|
||||||
|
### ソレノイド
|
||||||
|
|
||||||
|
ほとんどの MCU はソレノイドのコイルを駆動するために必要な電流を供給できないため、最初に MOSFET を介してソレノイドを駆動する回路を構築する必要があります。
|
||||||
|
|
||||||
|
[Adafruit が提供する配線図](https://playground.arduino.cc/uploads/Learning/solenoid_driver.pdf)
|
||||||
|
|
||||||
|
|
||||||
|
| 設定 | デフォルト | 説明 |
|
||||||
|
|--------------------------|---------------|-------------------------------------------------------|
|
||||||
|
| `SOLENOID_PIN` | *定義なし* | ソレノイドが接続されているピンを設定する。 |
|
||||||
|
| `SOLENOID_DEFAULT_DWELL` | `12` ms | ソレノイドのデフォルトの滞留時間を設定する。 |
|
||||||
|
| `SOLENOID_MIN_DWELL` | `4` ms | 滞留時間の下限を設定する。 |
|
||||||
|
| `SOLENOID_MAX_DWELL` | `100` ms | 滞留時間の上限を設定する。 |
|
||||||
|
|
||||||
|
?> 滞留時間とは、「プランジャー」が作動したままになる時間です。滞留時間により、ソレノイドの音が変わります。
|
||||||
|
|
||||||
|
ブートローダ実行中に一部のピンが給電されているかもしれず (例えば、STM32F303 チップ上の A13)、そうすると書き込みプロセスの間ずっとソレノイドがオン状態になることに注意してください。これはソレノイドを加熱し損傷を与えるかもしれません。ソレノイドが接続されているピンがブートローダ/DFU 実行中にソレノイドをオンにしていることが分かった場合は、他のピンを選択してください。
|
||||||
|
|
||||||
|
### DRV2605L
|
||||||
|
|
||||||
|
DRV2605Lは i2c プロトコルで制御され、SDA および SCL ピンに接続する必要があります。これらは使用する MCU によって異なります。
|
||||||
|
|
||||||
|
#### フィードバックモータのセットアップ
|
||||||
|
|
||||||
|
このドライバは2つの異なるフィードバックモータをサポートします。選択したモータに基づいて、`config.h` で以下を設定します。
|
||||||
|
|
||||||
|
##### ERM
|
||||||
|
|
||||||
|
偏心回転質量振動モータ (ERM) は偏りのある重りが取り付けられたモータで、駆動信号が取り付けられると偏りのある重りが回転し、正弦波が振動に変換されます。
|
||||||
|
|
||||||
|
```
|
||||||
|
#define FB_ERM_LRA 0
|
||||||
|
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
|
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
|
/* 特定のモータに最適な設定については、データシートを参照してください。*/
|
||||||
|
#define RATED_VOLTAGE 3
|
||||||
|
#define V_PEAK 5
|
||||||
|
```
|
||||||
|
##### LRA
|
||||||
|
|
||||||
|
線形共振アクチュエータ (LRA、線形バイブレータとしても知られています)は、ERM と異なります。LRA は重りと磁石をバネで吊るしたものとボイスコイルで構成されています。駆動信号が印加されるとされると、重りは単一の軸で振動します (左右または上下)。重りはバネに取り付けられているため、特定の周波数で共振効果があります。この周波数は LRA が最も効率的に動作する箇所です。この周波数の推奨範囲については、モータのデータシートを参照してください。
|
||||||
|
|
||||||
|
```
|
||||||
|
#define FB_ERM_LRA 1
|
||||||
|
#define FB_BRAKEFACTOR 3 /* For 1x:0, 2x:1, 3x:2, 4x:3, 6x:4, 8x:5, 16x:6, Disable Braking:7 */
|
||||||
|
#define FB_LOOPGAIN 1 /* For Low:0, Medium:1, High:2, Very High:3 */
|
||||||
|
|
||||||
|
/* 特定のモータに最適な設定については、データシートを参照してください。*/
|
||||||
|
#define RATED_VOLTAGE 2
|
||||||
|
#define V_PEAK 2.8
|
||||||
|
#define V_RMS 2.0
|
||||||
|
#define V_PEAK 2.1
|
||||||
|
#define F_LRA 205 /* 共振周波数 */
|
||||||
|
```
|
||||||
|
|
||||||
|
#### DRV2605L 波形ライブラリ
|
||||||
|
|
||||||
|
DRV2605L には呼び出して再生できる様々な波形シーケンスのプリロードライブラリが同梱されています。マクロを書く場合、これらの波形は `DRV_pulse(*sequence name or number*)` を使って再生することができます
|
||||||
|
|
||||||
|
データシートの波形シーケンスのリスト
|
||||||
|
|
||||||
|
| seq# | シーケンス名 | seq# | シーケンス名 | seq# | シーケンス名 |
|
||||||
|
|-----|---------------------|-----|-----------------------------------|-----|--------------------------------------|
|
||||||
|
| 1 | strong_click | 43 | lg_dblclick_med_60 | 85 | transition_rampup_med_smooth2 |
|
||||||
|
| 2 | strong_click_60 | 44 | lg_dblsharp_tick | 86 | transition_rampup_short_smooth1 |
|
||||||
|
| 3 | strong_click_30 | 45 | lg_dblsharp_tick_80 | 87 | transition_rampup_short_smooth2 |
|
||||||
|
| 4 | sharp_click | 46 | lg_dblsharp_tick_60 | 88 | transition_rampup_long_sharp1 |
|
||||||
|
| 5 | sharp_click_60 | 47 | buzz | 89 | transition_rampup_long_sharp2 |
|
||||||
|
| 6 | sharp_click_30 | 48 | buzz_80 | 90 | transition_rampup_med_sharp1 |
|
||||||
|
| 7 | soft_bump | 49 | buzz_60 | 91 | transition_rampup_med_sharp2 |
|
||||||
|
| 8 | soft_bump_60 | 50 | buzz_40 | 92 | transition_rampup_short_sharp1 |
|
||||||
|
| 9 | soft_bump_30 | 51 | buzz_20 | 93 | transition_rampup_short_sharp2 |
|
||||||
|
| 10 | dbl_click | 52 | pulsing_strong | 94 | transition_rampdown_long_smooth1_50 |
|
||||||
|
| 11 | dbl_click_60 | 53 | pulsing_strong_80 | 95 | transition_rampdown_long_smooth2_50 |
|
||||||
|
| 12 | trp_click | 54 | pulsing_medium | 96 | transition_rampdown_med_smooth1_50 |
|
||||||
|
| 13 | soft_fuzz | 55 | pulsing_medium_80 | 97 | transition_rampdown_med_smooth2_50 |
|
||||||
|
| 14 | strong_buzz | 56 | pulsing_sharp | 98 | transition_rampdown_short_smooth1_50 |
|
||||||
|
| 15 | alert_750ms | 57 | pulsing_sharp_80 | 99 | transition_rampdown_short_smooth2_50 |
|
||||||
|
| 16 | alert_1000ms | 58 | transition_click | 100 | transition_rampdown_long_sharp1_50 |
|
||||||
|
| 17 | strong_click1 | 59 | transition_click_80 | 101 | transition_rampdown_long_sharp2_50 |
|
||||||
|
| 18 | strong_click2_80 | 60 | transition_click_60 | 102 | transition_rampdown_med_sharp1_50 |
|
||||||
|
| 19 | strong_click3_60 | 61 | transition_click_40 | 103 | transition_rampdown_med_sharp2_50 |
|
||||||
|
| 20 | strong_click4_30 | 62 | transition_click_20 | 104 | transition_rampdown_short_sharp1_50 |
|
||||||
|
| 21 | medium_click1 | 63 | transition_click_10 | 105 | transition_rampdown_short_sharp2_50 |
|
||||||
|
| 22 | medium_click2_80 | 64 | transition_hum | 106 | transition_rampup_long_smooth1_50 |
|
||||||
|
| 23 | medium_click3_60 | 65 | transition_hum_80 | 107 | transition_rampup_long_smooth2_50 |
|
||||||
|
| 24 | sharp_tick1 | 66 | transition_hum_60 | 108 | transition_rampup_med_smooth1_50 |
|
||||||
|
| 25 | sharp_tick2_80 | 67 | transition_hum_40 | 109 | transition_rampup_med_smooth2_50 |
|
||||||
|
| 26 | sharp_tick3_60 | 68 | transition_hum_20 | 110 | transition_rampup_short_smooth1_50 |
|
||||||
|
| 27 | sh_dblclick_str | 69 | transition_hum_10 | 111 | transition_rampup_short_smooth2_50 |
|
||||||
|
| 28 | sh_dblclick_str_80 | 70 | transition_rampdown_long_smooth1 | 112 | transition_rampup_long_sharp1_50 |
|
||||||
|
| 29 | sh_dblclick_str_60 | 71 | transition_rampdown_long_smooth2 | 113 | transition_rampup_long_sharp2_50 |
|
||||||
|
| 30 | sh_dblclick_str_30 | 72 | transition_rampdown_med_smooth1 | 114 | transition_rampup_med_sharp1_50 |
|
||||||
|
| 31 | sh_dblclick_med | 73 | transition_rampdown_med_smooth2 | 115 | transition_rampup_med_sharp2_50 |
|
||||||
|
| 32 | sh_dblclick_med_80 | 74 | transition_rampdown_short_smooth1 | 116 | transition_rampup_short_sharp1_50 |
|
||||||
|
| 33 | sh_dblclick_med_60 | 75 | transition_rampdown_short_smooth2 | 117 | transition_rampup_short_sharp2_50 |
|
||||||
|
| 34 | sh_dblsharp_tick | 76 | transition_rampdown_long_sharp1 | 118 | long_buzz_for_programmatic_stopping |
|
||||||
|
| 35 | sh_dblsharp_tick_80 | 77 | transition_rampdown_long_sharp2 | 119 | smooth_hum1_50 |
|
||||||
|
| 36 | sh_dblsharp_tick_60 | 78 | transition_rampdown_med_sharp1 | 120 | smooth_hum2_40 |
|
||||||
|
| 37 | lg_dblclick_str | 79 | transition_rampdown_med_sharp2 | 121 | smooth_hum3_30 |
|
||||||
|
| 38 | lg_dblclick_str_80 | 80 | transition_rampdown_short_sharp1 | 122 | smooth_hum4_20 |
|
||||||
|
| 39 | lg_dblclick_str_60 | 81 | transition_rampdown_short_sharp2 | 123 | smooth_hum5_10 |
|
||||||
|
| 40 | lg_dblclick_str_30 | 82 | transition_rampup_long_smooth1 | | |
|
||||||
|
| 41 | lg_dblclick_med | 83 | transition_rampup_long_smooth2 | | |
|
||||||
|
| 42 | lg_dblclick_med_80 | 84 | transition_rampup_med_smooth1 | | |
|
||||||
|
### オプションの DRV2605L の定義
|
||||||
|
|
||||||
|
```
|
||||||
|
#define DRV_GREETING *sequence name or number*
|
||||||
|
```
|
||||||
|
触覚フィードバッグが有効な場合、キーボード起動時に特定のシーケンスに合わせて振動します。以下の定義を使って選択することができます:
|
||||||
|
|
||||||
|
```
|
||||||
|
#define DRV_MODE_DEFAULT *sequence name or number*
|
||||||
|
```
|
||||||
|
これにより HPT_RST がアクティブモードとして設定するシーケンスを設定します。未定義の場合、HPT_RST が押された時にモードが 1 に設定されます。
|
||||||
|
|
||||||
|
### DRV2605L 連続触覚モード
|
||||||
|
|
||||||
|
このモードは強さを増減するオプションを使って連続触覚フィードバッグを設定します。
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# キーロック
|
||||||
|
|
||||||
|
<!---
|
||||||
|
original document: 0.8.134:docs/feature_key_lock.md
|
||||||
|
git diff 0.8.134 HEAD -- docs/feature_key_lock.md | cat
|
||||||
|
-->
|
||||||
|
|
||||||
|
特定のキーを長時間押すことが必要になる場合があります。キーロックは次に押すキーを押したままにします。もう一度押すと、リリースされます。
|
||||||
|
|
||||||
|
いくつかの文を全て大文字で入力する必要があるとしましょう。`KC_LOCK` を押し、次にシフトを押します。これで、シフトは次にタップするまで押していると見なされます。キーロックを Caps Lock と考えることができますが、さらに強力です。
|
||||||
|
|
||||||
|
## 使用法
|
||||||
|
|
||||||
|
最初に `rules.mk` で `KEY_LOCK_ENABLE = yes` を設定することでキーロックを有効にします。次に、キーマップでキーを選択し、それをキーコード `KC_LOCK` に割り当てます。
|
||||||
|
|
||||||
|
## キーコード
|
||||||
|
|
||||||
|
| キーコード | 説明 |
|
||||||
|
|---------|--------------------------------------------------------------|
|
||||||
|
| `KC_LOCK` | キーが再び押されるまで次のキーを押したままにします。 |
|
||||||
|
|
||||||
|
## 注意事項
|
||||||
|
|
||||||
|
キーロックは、標準アクションキーと[ワンショットモディファイア](ja/one_shot_keys.md)キー (例えば、Shift を `OSM(KC_LSFT)` と定義した場合)のみを押し続けることができます。
|
||||||
|
これは、QMK の特殊機能(ワンショットモディファイアを除く)、または `KC_LPRN` のような shift を押されたキーのバージョンは含みません。[基本的なキーコード](ja/keycodes_basic.md)リストにある場合、押したままにすることができます。
|
||||||
|
|
||||||
|
レイヤーの切り替えは、キーロックを解除しません。
|
||||||
+18
-1
@@ -18,7 +18,24 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
|
|||||||
|
|
||||||
## ChibiOS/ARM Configuration
|
## ChibiOS/ARM Configuration
|
||||||
|
|
||||||
ARM support for this driver is not ready yet. Check back later!
|
You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
|
||||||
|
|
||||||
|
To enable SPI, modify your board's `halconf.h` to enable SPI - both `HAL_USE_SPI` and `SPI_USE_WAIT` should be `TRUE`, and `SPI_SELECT_MODE` should be `SPI_SELECT_MODE_PAD`.
|
||||||
|
Then, modify your board's `mcuconf.h` to enable the SPI peripheral you've chosen -- in the case of using SPI2, modify `STM32_SPI_USE_SPI2` to be `TRUE`.
|
||||||
|
|
||||||
|
As per the AVR configuration, you may select any other standard GPIO as a slave select pin, and can be supplied to `spi_start()`.
|
||||||
|
|
||||||
|
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||||
|
|
||||||
|
`config.h` override | Description | Default Value
|
||||||
|
----------------------------|---------------------------------------------------------------|--------------
|
||||||
|
`#define SPI_DRIVER` | SPI peripheral to use - SPI1 => `SPID1`, SPI2 => `SPID2` etc. | `SPID2`
|
||||||
|
`#define SPI_SCK_PIN` | The pin to use for the SCK | `B13`
|
||||||
|
`#define SPI_SCK_PAL_MODE` | The alternate function mode for the SCK pin | `5`
|
||||||
|
`#define SPI_MOSI_PIN` | The pin to use for the MOSI | `B15`
|
||||||
|
`#define SPI_MOSI_PAL_MODE` | The alternate function mode for the MOSI pin | `5`
|
||||||
|
`#define SPI_MISO_PIN` | The pin to use for the MISO | `B14`
|
||||||
|
`#define SPI_MISO_PAL_MODE` | The alternate function mode for the MISO pin | `5`
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,8 @@
|
|||||||
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }
|
void inline apa102_setleds(LED_TYPE *ledarray, uint16_t leds) { apa102_setleds_pin(ledarray, leds, _BV(RGB_DI_PIN & 0xF), _BV(RGB_CLK_PIN & 0xF)); }
|
||||||
|
|
||||||
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
|
void static inline apa102_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask_DI, uint8_t pinmask_CLK) {
|
||||||
pinMode(RGB_DI_PIN, PinDirectionOutput);
|
setPinOutput(RGB_DI_PIN);
|
||||||
pinMode(RGB_CLK_PIN, PinDirectionOutput);
|
setPinOutput(RGB_CLK_PIN);
|
||||||
|
|
||||||
apa102_send_array((uint8_t *)ledarray, leds)
|
apa102_send_array((uint8_t *)ledarray, leds)
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ void apa102_end_frame(uint16_t leds) {
|
|||||||
void apa102_send_byte(uint8_t byte) {
|
void apa102_send_byte(uint8_t byte) {
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
digitalWrite(RGB_DI_PIN, !!(byte & (1 << (7-i)));
|
writePin(RGB_DI_PIN, !!(byte & (1 << (7 - i))));
|
||||||
digitalWrite(RGB_CLK_PIN, PinLevelHigh);
|
writePinHigh(RGB_CLK_PIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
/* Copyright 2020 Nick Brassel (tzarc)
|
||||||
|
*
|
||||||
|
* 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 3 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "spi_master.h"
|
||||||
|
#include "quantum.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
static pin_t currentSlavePin = NO_PIN;
|
||||||
|
static SPIConfig spiConfig = {false, NULL, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
__attribute__((weak)) void spi_init(void) {
|
||||||
|
// Try releasing special pins for a short time
|
||||||
|
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_INPUT);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_INPUT);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_INPUT);
|
||||||
|
|
||||||
|
chThdSleepMilliseconds(10);
|
||||||
|
#if defined(USE_GPIOV1)
|
||||||
|
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||||
|
#else
|
||||||
|
palSetPadMode(PAL_PORT(SPI_SCK_PIN), PAL_PAD(SPI_SCK_PIN), PAL_MODE_ALTERNATE(SPI_SCK_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MOSI_PIN), PAL_PAD(SPI_MOSI_PIN), PAL_MODE_ALTERNATE(SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||||
|
palSetPadMode(PAL_PORT(SPI_MISO_PIN), PAL_PAD(SPI_MISO_PIN), PAL_MODE_ALTERNATE(SPI_MISO_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor) {
|
||||||
|
if (currentSlavePin != NO_PIN || slavePin == NO_PIN) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t roundedDivisor = 2;
|
||||||
|
while (roundedDivisor < divisor) {
|
||||||
|
roundedDivisor <<= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (roundedDivisor < 2 || roundedDivisor > 256) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
spiConfig.cr1 = 0;
|
||||||
|
|
||||||
|
if (lsbFirst) {
|
||||||
|
spiConfig.cr1 |= SPI_CR1_LSBFIRST;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_CPHA;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_CPOL;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_CPHA | SPI_CR1_CPOL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (roundedDivisor) {
|
||||||
|
case 2:
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_0;
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_1;
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_1 | SPI_CR1_BR_0;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_2;
|
||||||
|
break;
|
||||||
|
case 64:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_0;
|
||||||
|
break;
|
||||||
|
case 128:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1;
|
||||||
|
break;
|
||||||
|
case 256:
|
||||||
|
spiConfig.cr1 |= SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentSlavePin = slavePin;
|
||||||
|
spiConfig.ssport = PAL_PORT(slavePin);
|
||||||
|
spiConfig.sspad = PAL_PAD(slavePin);
|
||||||
|
|
||||||
|
setPinOutput(slavePin);
|
||||||
|
spiStart(&SPI_DRIVER, &spiConfig);
|
||||||
|
spiSelect(&SPI_DRIVER);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_status_t spi_write(uint8_t data) { return spi_transmit(&data, 1); }
|
||||||
|
|
||||||
|
spi_status_t spi_read(void) {
|
||||||
|
uint8_t data = 0;
|
||||||
|
spi_receive(&data, 1);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_status_t spi_transmit(const uint8_t *data, uint16_t length) {
|
||||||
|
spiSend(&SPI_DRIVER, length, data);
|
||||||
|
return SPI_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
spi_status_t spi_receive(uint8_t *data, uint16_t length) {
|
||||||
|
spiReceive(&SPI_DRIVER, length, data);
|
||||||
|
return SPI_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void spi_stop(void) {
|
||||||
|
if (currentSlavePin != NO_PIN) {
|
||||||
|
spiUnselect(&SPI_DRIVER);
|
||||||
|
spiStop(&SPI_DRIVER);
|
||||||
|
currentSlavePin = NO_PIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/* Copyright 2020 Nick Brassel (tzarc)
|
||||||
|
*
|
||||||
|
* 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 3 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 <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <ch.h>
|
||||||
|
#include <hal.h>
|
||||||
|
#include <quantum.h>
|
||||||
|
|
||||||
|
#ifndef SPI_DRIVER
|
||||||
|
# define SPI_DRIVER SPID2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_SCK_PIN
|
||||||
|
# define SPI_SCK_PIN B13
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_SCK_PAL_MODE
|
||||||
|
# define SPI_SCK_PAL_MODE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_MOSI_PIN
|
||||||
|
# define SPI_MOSI_PIN B15
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_MOSI_PAL_MODE
|
||||||
|
# define SPI_MOSI_PAL_MODE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_MISO_PIN
|
||||||
|
# define SPI_MISO_PIN B14
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SPI_MISO_PAL_MODE
|
||||||
|
# define SPI_MISO_PAL_MODE 5
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef int16_t spi_status_t;
|
||||||
|
|
||||||
|
#define SPI_STATUS_SUCCESS (0)
|
||||||
|
#define SPI_STATUS_ERROR (-1)
|
||||||
|
#define SPI_STATUS_TIMEOUT (-2)
|
||||||
|
|
||||||
|
#define SPI_TIMEOUT_IMMEDIATE (0)
|
||||||
|
#define SPI_TIMEOUT_INFINITE (0xFFFF)
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
void spi_init(void);
|
||||||
|
|
||||||
|
bool spi_start(pin_t slavePin, bool lsbFirst, uint8_t mode, uint16_t divisor);
|
||||||
|
|
||||||
|
spi_status_t spi_write(uint8_t data);
|
||||||
|
|
||||||
|
spi_status_t spi_read(void);
|
||||||
|
|
||||||
|
spi_status_t spi_transmit(const uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
|
spi_status_t spi_receive(uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
|
void spi_stop(void);
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "drashna.h"
|
#include "drashna.h"
|
||||||
#include "analog.h"
|
#include "analog.h"
|
||||||
#include "pointing_device.h"
|
#include "pointing_device.h"
|
||||||
#include "pincontrol.h"
|
|
||||||
|
|
||||||
#define KC_X0 LT(_FN, KC_ESC)
|
#define KC_X0 LT(_FN, KC_ESC)
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_LEVELS 3
|
#define BACKLIGHT_LEVELS 3
|
||||||
#define BACKLIGHT_BREATHING
|
#define BACKLIGHT_BREATHING
|
||||||
#define BREATHING_PERIOD 6
|
#define BREATHING_PERIOD 6
|
||||||
#define BACKLIGHT_ON_STATE 1
|
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
|
|
||||||
/* USB Device descriptor parameter */
|
/* USB Device descriptor parameter */
|
||||||
#define VENDOR_ID 0xFEED
|
#define VENDOR_ID 0x5058 // "PX"
|
||||||
#define PRODUCT_ID 0xFADE
|
#define PRODUCT_ID 0x4250 // "BP"
|
||||||
#define DEVICE_VER 0x0001
|
#define DEVICE_VER 0x1001
|
||||||
#define MANUFACTURER Pixlup
|
#define MANUFACTURER Pixlup
|
||||||
#define PRODUCT Blackplum Keeb
|
#define PRODUCT Blackplum Keeb
|
||||||
#define DESCRIPTION Blackplum 68 Percent Mechanical Keyboard
|
#define DESCRIPTION Blackplum 68 Percent Mechanical Keyboard
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT_68_ansi(
|
||||||
|
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_PGUP,\
|
||||||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_PGDOWN,\
|
||||||
|
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,\
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,\
|
||||||
|
KC_LCTL , KC_LGUI , KC_LALT , KC_SPC , KC_RALT , MO(1) , KC_RCTL, KC_LEFT, KC_DOWN, KC_RIGHT
|
||||||
|
),
|
||||||
|
|
||||||
|
[1] = LAYOUT_68_ansi(
|
||||||
|
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_TRNS, KC_MPLY, KC_HOME,\
|
||||||
|
KC_TRNS, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PSCR, KC_SLCK, KC_PAUSE, KC_TRNS, KC_MUTE, KC_END,\
|
||||||
|
KC_TRNS, RGB_TOG, RGB_HUD, RGB_SAD, RGB_VAD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_VOLU,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, RESET, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_VOLD, KC_MNXT
|
||||||
|
),
|
||||||
|
|
||||||
|
[2] = LAYOUT_68_ansi(
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
|
),
|
||||||
|
|
||||||
|
[3] = LAYOUT_68_ansi(
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,\
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
VIA_ENABLE = yes
|
||||||
|
LTO_ENABLE = yes
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
@@ -88,4 +87,4 @@ void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
|
|||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
void matrix_render(struct CharacterMatrix *matrix);
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
@@ -88,4 +87,4 @@ void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
|
|||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
void matrix_render(struct CharacterMatrix *matrix);
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -20,7 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
#include "protocol/serial.h"
|
#include "protocol/serial.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "pincontrol.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -96,27 +95,27 @@ void pins_init(void) {
|
|||||||
// set pins for pullups, Rts , power &etc.
|
// set pins for pullups, Rts , power &etc.
|
||||||
|
|
||||||
//print ("pins setup\n");
|
//print ("pins setup\n");
|
||||||
pinMode(VCC_PIN, PinDirectionOutput);
|
setPinOutput(VCC_PIN);
|
||||||
digitalWrite(VCC_PIN, PinLevelLow);
|
writePinLow(VCC_PIN);
|
||||||
|
|
||||||
#if ( HANDSPRING == 0)
|
#if ( HANDSPRING == 0)
|
||||||
|
|
||||||
#ifdef CY835
|
#ifdef CY835
|
||||||
pinMode(GND_PIN, PinDirectionOutput);
|
setPinOutput(GND_PIN);
|
||||||
digitalWrite(GND_PIN, PinLevelLow);
|
writePinLow(GND_PIN);
|
||||||
|
|
||||||
pinMode(PULLDOWN_PIN, PinDirectionOutput);
|
setPinOutput(PULLDOWN_PIN);
|
||||||
digitalWrite(PULLDOWN_PIN, PinLevelLow);
|
writePinLow(PULLDOWN_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pinMode(DCD_PIN, PinDirectionInput);
|
setPinInput(DCD_PIN);
|
||||||
pinMode(RTS_PIN, PinDirectionInput);
|
setPinInput(RTS_PIN);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* check that the other side isn't powered up.
|
/* check that the other side isn't powered up.
|
||||||
test=digitalRead(DCD_PIN);
|
test=readPin(DCD_PIN);
|
||||||
xprintf("b%02X:", test);
|
xprintf("b%02X:", test);
|
||||||
test=digitalRead(RTS_PIN);
|
test=readPin(RTS_PIN);
|
||||||
xprintf("%02X\n", test);
|
xprintf("%02X\n", test);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -129,20 +128,20 @@ uint8_t rts_reset(void) {
|
|||||||
// On boot, we keep rts as input, then switch roles here
|
// On boot, we keep rts as input, then switch roles here
|
||||||
// on leaving sleep, we toggle the same way
|
// on leaving sleep, we toggle the same way
|
||||||
|
|
||||||
firstread=digitalRead(RTS_PIN);
|
firstread=readPin(RTS_PIN);
|
||||||
// printf("r%02X:", firstread);
|
// printf("r%02X:", firstread);
|
||||||
|
|
||||||
pinMode(RTS_PIN, PinDirectionOutput);
|
setPinOutput(RTS_PIN);
|
||||||
|
|
||||||
if (firstread == PinLevelHigh) {
|
if (firstread) {
|
||||||
digitalWrite(RTS_PIN, PinLevelLow);
|
writePinLow(RTS_PIN);
|
||||||
}
|
}
|
||||||
_delay_ms(10);
|
_delay_ms(10);
|
||||||
digitalWrite(RTS_PIN, PinLevelHigh);
|
writePinHigh(RTS_PIN);
|
||||||
|
|
||||||
|
|
||||||
/* the future is Arm
|
/* the future is Arm
|
||||||
if (palReadPad(RTS_PIN_IOPRT) == PinLevelLow)
|
if (!palReadPad(RTS_PIN_IOPRT))
|
||||||
{
|
{
|
||||||
_delay_ms(10);
|
_delay_ms(10);
|
||||||
palSetPadMode(RTS_PINn_IOPORT, PinDirectionOutput_PUSHPULL);
|
palSetPadMode(RTS_PINn_IOPORT, PinDirectionOutput_PUSHPULL);
|
||||||
@@ -224,9 +223,9 @@ uint8_t handspring_handshake(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t handspring_reset(void) {
|
uint8_t handspring_reset(void) {
|
||||||
digitalWrite(VCC_PIN, PinLevelLow);
|
writePinLow(VCC_PIN);
|
||||||
_delay_ms(5);
|
_delay_ms(5);
|
||||||
digitalWrite(VCC_PIN, PinLevelHigh);
|
writePinHigh(VCC_PIN);
|
||||||
|
|
||||||
if ( handspring_handshake() ) {
|
if ( handspring_handshake() ) {
|
||||||
last_activity = timer_read();
|
last_activity = timer_read();
|
||||||
@@ -250,7 +249,7 @@ void matrix_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
print("power up\n");
|
print("power up\n");
|
||||||
digitalWrite(VCC_PIN, PinLevelHigh);
|
writePinHigh(VCC_PIN);
|
||||||
|
|
||||||
// wait for DCD strobe from keyboard - it will do this
|
// wait for DCD strobe from keyboard - it will do this
|
||||||
// up to 3 times, then the board needs the RTS toggled to try again
|
// up to 3 times, then the board needs the RTS toggled to try again
|
||||||
@@ -265,7 +264,7 @@ void matrix_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else /// Palm / HP device with DCD
|
#else /// Palm / HP device with DCD
|
||||||
while( digitalRead(DCD_PIN) != PinLevelHigh ) {;}
|
while( !readPin(DCD_PIN) ) {;}
|
||||||
print("dcd\n");
|
print("dcd\n");
|
||||||
|
|
||||||
rts_reset(); // at this point the keyboard should think all is well.
|
rts_reset(); // at this point the keyboard should think all is well.
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
@@ -88,4 +87,4 @@ void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
|
|||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
void matrix_render(struct CharacterMatrix *matrix);
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -43,7 +43,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_PINS { B1, B2, B3, E6 }
|
#define BACKLIGHT_PINS { B1, B2, B3, E6 }
|
||||||
#define BACKLIGHT_LED_COUNT 4
|
#define BACKLIGHT_LED_COUNT 4
|
||||||
#define BACKLIGHT_LEVELS 10
|
#define BACKLIGHT_LEVELS 10
|
||||||
#define BACKLIGHT_ON_STATE 1
|
|
||||||
|
|
||||||
#define RGBLIGHT_ANIMATIONS
|
#define RGBLIGHT_ANIMATIONS
|
||||||
#define RGB_DI_PIN D6
|
#define RGB_DI_PIN D6
|
||||||
|
|||||||
@@ -22,31 +22,11 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
|
|
||||||
# include "ws2812.c"
|
|
||||||
# include "ergodox_ez.h"
|
# include "ergodox_ez.h"
|
||||||
|
|
||||||
extern rgblight_config_t rgblight_config;
|
extern rgblight_config_t rgblight_config;
|
||||||
|
|
||||||
void rgblight_set(void) {
|
void rgblight_call_driver(LED_TYPE *led, uint8_t led_num) {
|
||||||
if (!rgblight_config.enable) {
|
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
||||||
led[i].r = 0;
|
|
||||||
led[i].g = 0;
|
|
||||||
led[i].b = 0;
|
|
||||||
#ifdef RGBW
|
|
||||||
led[i].w = 0;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#ifdef RGBW
|
|
||||||
else {
|
|
||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
|
||||||
convert_rgb_to_rgbw(&led[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uint8_t led_num = RGBLED_NUM;
|
|
||||||
i2c_init();
|
i2c_init();
|
||||||
i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT);
|
i2c_start(0x84, ERGODOX_EZ_I2C_TIMEOUT);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -54,8 +34,8 @@ void rgblight_set(void) {
|
|||||||
// prevent right-half code from trying to bitbang all 30
|
// prevent right-half code from trying to bitbang all 30
|
||||||
// so with 30 LEDs, we count from 29 to 15 here, and the
|
// so with 30 LEDs, we count from 29 to 15 here, and the
|
||||||
// other half does 0 to 14.
|
// other half does 0 to 14.
|
||||||
led_num = RGBLED_NUM / 2;
|
uint8_t half_led_num = RGBLED_NUM / 2;
|
||||||
for (i = led_num + led_num - 1; i >= led_num; --i)
|
for (i = half_led_num + half_led_num - 1; i >= half_led_num; --i)
|
||||||
# elif defined(ERGODOX_LED_15_MIRROR)
|
# elif defined(ERGODOX_LED_15_MIRROR)
|
||||||
for (i = 0; i < led_num; ++i)
|
for (i = 0; i < led_num; ++i)
|
||||||
# else // ERGDOX_LED_15 non-mirrored
|
# else // ERGDOX_LED_15 non-mirrored
|
||||||
@@ -72,7 +52,7 @@ void rgblight_set(void) {
|
|||||||
}
|
}
|
||||||
i2c_stop();
|
i2c_stop();
|
||||||
|
|
||||||
ws2812_setleds(led, RGBLED_NUM);
|
ws2812_setleds(led, led_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ SWAP_HANDS_ENABLE= yes # Allow swapping hands of keyboard
|
|||||||
SLEEP_LED_ENABLE = no
|
SLEEP_LED_ENABLE = no
|
||||||
API_SYSEX_ENABLE = no
|
API_SYSEX_ENABLE = no
|
||||||
RGBLIGHT_ENABLE = yes
|
RGBLIGHT_ENABLE = yes
|
||||||
RGBLIGHT_CUSTOM_DRIVER = yes
|
|
||||||
|
|
||||||
RGB_MATRIX_ENABLE = no # enable later
|
RGB_MATRIX_ENABLE = no # enable later
|
||||||
DEBOUNCE_TYPE = eager_pr
|
DEBOUNCE_TYPE = eager_pr
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
* https://docs.qmk.fm/#/feature_backlight?id=timer-assisted-pwm-implementation
|
* https://docs.qmk.fm/#/feature_backlight?id=timer-assisted-pwm-implementation
|
||||||
*/
|
*/
|
||||||
#define BACKLIGHT_PIN D4
|
#define BACKLIGHT_PIN D4
|
||||||
|
#define BACKLIGHT_ON_STATE 0
|
||||||
|
|
||||||
#define RGB_DI_PIN B2
|
#define RGB_DI_PIN B2
|
||||||
#ifdef RGB_DI_PIN
|
#ifdef RGB_DI_PIN
|
||||||
|
|||||||
@@ -39,7 +39,3 @@ After putting your COD67 in bootloader mode, it will show up as a drive.
|
|||||||
* Drag and drop your new `COD67.BIN` to the drive.
|
* Drag and drop your new `COD67.BIN` to the drive.
|
||||||
* Wait a few seconds for it to write. The caps lock LED flashes rapidly while writing.
|
* Wait a few seconds for it to write. The caps lock LED flashes rapidly while writing.
|
||||||
* Press the `Esc` key or eject the drive in Finder to reset the board. You are now ready to type!
|
* Press the `Esc` key or eject the drive in Finder to reset the board. You are now ready to type!
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
The backlight pin is attached to a non PWM pin `D4` so the backlight is only on/off.
|
|
||||||
@@ -27,9 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define PRODUCT AEK64
|
#define PRODUCT AEK64
|
||||||
#define DESCRIPTION QMK keyboard firmware for AEK64 handwired
|
#define DESCRIPTION QMK keyboard firmware for AEK64 handwired
|
||||||
|
|
||||||
/* Define the backlight */
|
|
||||||
/*#define BACKLIGHT_ON_STATE 1*/
|
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 5
|
#define MATRIX_ROWS 5
|
||||||
#define MATRIX_COLS 14
|
#define MATRIX_COLS 14
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_PIN F6
|
#define BACKLIGHT_PIN F6
|
||||||
// #define BACKLIGHT_BREATHING
|
// #define BACKLIGHT_BREATHING
|
||||||
#define BACKLIGHT_LEVELS 5
|
#define BACKLIGHT_LEVELS 5
|
||||||
#define BACKLIGHT_ON_STATE 1
|
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
// readability
|
// readability
|
||||||
#define XXX KC_NO
|
#define XXX KC_NO
|
||||||
|
|
||||||
/* TADA68 ANSI layout
|
/* SICK68 ANSI layout
|
||||||
* ,----------------------------------------------------------------.
|
* ,----------------------------------------------------------------.
|
||||||
* | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | 0e |
|
* | 00 |01| 02| 03| 04| 05| 06| 07| 08| 09| 0a| 0b| 0c| 0d | 0e |
|
||||||
* |----------------------------------------------------------------|
|
* |----------------------------------------------------------------|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
* |----------------------------------------------------------------|
|
* |----------------------------------------------------------------|
|
||||||
* | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3c| 3d| 3e |
|
* | 30 | 32| 33| 34| 35| 36| 37| 38| 39| 3a| 3b| 3c| 3d| 3e |
|
||||||
* |----------------------------------------------------------------|
|
* |----------------------------------------------------------------|
|
||||||
* | 40 | 41 | 42 | 45 | 49| 4a| 4b| 4c| 4d| 4e |
|
* | 40 | 41 | 42 | 46 | 49| 4a| 4b| 4c| 4d| 4e |
|
||||||
* `----------------------------------------------------------------'
|
* `----------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
// The first section contains all of the arguments
|
// The first section contains all of the arguments
|
||||||
@@ -51,12 +51,12 @@
|
|||||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
|
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \
|
||||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, k2e, \
|
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, k2e, \
|
||||||
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
|
k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \
|
||||||
k40, k41, k42, k45, k49, k4a, k4b, k4c, k4d, k4e \
|
k40, k41, k42, k46, k49, k4a, k4b, k4c, k4d, k4e \
|
||||||
) \
|
) \
|
||||||
{ \
|
{ \
|
||||||
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
|
{k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e}, \
|
||||||
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \
|
{k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e}, \
|
||||||
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
|
{k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, XXX, k2d, k2e}, \
|
||||||
{k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
|
{k30, XXX, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e}, \
|
||||||
{k40, k41, k42, XXX, XXX, k45, XXX, XXX, XXX, k49, k4a, k4b, k4c, k4d, k4e} \
|
{k40, k41, k42, XXX, XXX, XXX, k46, XXX, XXX, k49, k4a, k4b, k4c, k4d, k4e} \
|
||||||
}
|
}
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
|
|||||||
+17
-11
@@ -28,8 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define DESCRIPTION A 75% hotswap keyboard
|
#define DESCRIPTION A 75% hotswap keyboard
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 11
|
#define MATRIX_ROWS 9
|
||||||
#define MATRIX_COLS 9
|
#define MATRIX_COLS 11
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keyboard Matrix Assignments
|
* Keyboard Matrix Assignments
|
||||||
@@ -41,16 +41,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||||
*
|
*
|
||||||
* The matrix description in the vendor-supplied JSON file for kbfirmware.com
|
* The matrix description in the vendor-supplied JSON file for kbfirmware.com
|
||||||
* had 12 rows:
|
* had 9 columns:
|
||||||
|
* { D0, D1, D2, D3, D5, D4, D6, D7, B4 }
|
||||||
|
* and 12 rows:
|
||||||
* { B7, B3, B2, B1, B0, E6, F0, F1, F4, F5, F6, F7 }
|
* { B7, B3, B2, B1, B0, E6, F0, F1, F4, F5, F6, F7 }
|
||||||
* However, the row 6 was completely empty, and the pin F0 was not actually
|
* However, the row 6 was completely empty, and the pin F0 was not actually
|
||||||
* routed anywhere on the PCB, therefore this row was removed to save some
|
* routed anywhere on the PCB, therefore this row was removed to save some
|
||||||
* resources (the EEPROM space for dynamic keymaps is especially scarce).
|
* resources (the EEPROM space for dynamic keymaps is especially scarce).
|
||||||
|
*
|
||||||
|
* After doing the above change, the matrix was transposed (rows and columns
|
||||||
|
* were swapped), because a matrix with the COL2ROW layout can be scanned much
|
||||||
|
* more efficiently than a matrix with the ROW2COL layout (depending on various
|
||||||
|
* optimizations, the difference in scan rate can be over 2 times). Because of
|
||||||
|
* this, the "columns" in the matrix layout now mostly correspond to physical
|
||||||
|
* rows, and the "rows" have mostly vertical physical orientation.
|
||||||
*/
|
*/
|
||||||
#define MATRIX_ROW_PINS { B7, B3, B2, B1, B0, E6, F1, F4, F5, F6, F7 }
|
#define MATRIX_ROW_PINS { D0, D1, D2, D3, D5, D4, D6, D7, B4 }
|
||||||
#define MATRIX_COL_PINS { D0, D1, D2, D3, D5, D4, D6, D7, B4 }
|
#define MATRIX_COL_PINS { B7, B3, B2, B1, B0, E6, F1, F4, F5, F6, F7 }
|
||||||
|
|
||||||
#define DIODE_DIRECTION ROW2COL
|
#define DIODE_DIRECTION COL2ROW
|
||||||
|
|
||||||
#define BACKLIGHT_PIN B6
|
#define BACKLIGHT_PIN B6
|
||||||
// #define BACKLIGHT_BREATHING
|
// #define BACKLIGHT_BREATHING
|
||||||
@@ -81,8 +90,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bootmagic Lite key configuration: use the Esc key */
|
/* Bootmagic Lite key configuration: use the Esc key */
|
||||||
#define BOOTMAGIC_LITE_ROW 5
|
#define BOOTMAGIC_LITE_ROW 0
|
||||||
#define BOOTMAGIC_LITE_COLUMN 0
|
#define BOOTMAGIC_LITE_COLUMN 5
|
||||||
|
|
||||||
// partially generated by KBFirmware JSON to QMK Parser
|
|
||||||
// https://noroadsleft.github.io/kbf_qmk_converter/
|
|
||||||
+9
-14
@@ -25,18 +25,13 @@
|
|||||||
K10, K12, K13, K14, K15, K16, K17, K18, K68, K67, K65, K64, K63, \
|
K10, K12, K13, K14, K15, K16, K17, K18, K68, K67, K65, K64, K63, \
|
||||||
K00, K01, K02, K06, K08, K07, K05, K04, K03 \
|
K00, K01, K02, K06, K08, K07, K05, K04, K03 \
|
||||||
) { \
|
) { \
|
||||||
{ K00, K01, K02, K03, K04, K05, K06, K07, K08 }, \
|
{ K00, K10, K20, K30, K40, K50, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||||
{ K10, KC_NO, K12, K13, K14, K15, K16, K17, K18 }, \
|
{ K01, KC_NO, K21, K31, K41, K51, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||||
{ K20, K21, K22, K23, K24, K25, K26, K27, K28 }, \
|
{ K02, K12, K22, K32, K42, K52, KC_NO, KC_NO, K82, K92, KA2 }, \
|
||||||
{ K30, K31, K32, K33, K34, K35, K36, K37, K38 }, \
|
{ K03, K13, K23, K33, K43, K53, K63, KC_NO, K83, KC_NO, KA3 }, \
|
||||||
{ K40, K41, K42, K43, K44, K45, K46, K47, K48 }, \
|
{ K04, K14, K24, K34, K44, K54, K64, K74, K84, K94, KA4 }, \
|
||||||
{ K50, K51, K52, K53, K54, K55, K56, K57, K58 }, \
|
{ K05, K15, K25, K35, K45, K55, K65, K75, K85, K95, KA5 }, \
|
||||||
{ KC_NO, KC_NO, KC_NO, K63, K64, K65, KC_NO, K67, K68 }, \
|
{ K06, K16, K26, K36, K46, K56, KC_NO, KC_NO, KC_NO, K96, KA6 }, \
|
||||||
{ KC_NO, KC_NO, KC_NO, KC_NO, K74, K75, KC_NO, K77, K78 }, \
|
{ K07, K17, K27, K37, K47, K57, K67, K77, K87, K97, KA7 }, \
|
||||||
{ KC_NO, KC_NO, K82, K83, K84, K85, KC_NO, K87, K88 }, \
|
{ K08, K18, K28, K38, K48, K58, K68, K78, K88, K98, KC_NO }, \
|
||||||
{ KC_NO, KC_NO, K92, KC_NO, K94, K95, K96, K97, K98 }, \
|
|
||||||
{ KC_NO, KC_NO, KA2, KA3, KA4, KA5, KA6, KA7, KC_NO }, \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// generated by KBFirmware JSON to QMK Parser
|
|
||||||
// https://noroadsleft.github.io/kbf_qmk_converter/
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(
|
||||||
|
KC_7, KC_8, KC_9,
|
||||||
|
KC_4, KC_5, KC_6,
|
||||||
|
KC_1, KC_2, KC_3,
|
||||||
|
MO(1), KC_0, KC_DOT
|
||||||
|
),
|
||||||
|
|
||||||
|
[1] = LAYOUT(
|
||||||
|
RGB_MOD, KC_HOME, KC_PGUP,
|
||||||
|
KC_TRNS, KC_END, KC_PGDN,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_ENT
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
VIA_ENABLE = yes
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
@@ -88,4 +87,4 @@ void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
|
|||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
void matrix_render(struct CharacterMatrix *matrix);
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -65,7 +65,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_PINS { C2, C7, D5, D6, B0 }
|
#define BACKLIGHT_PINS { C2, C7, D5, D6, B0 }
|
||||||
#define BACKLIGHT_LED_COUNT 5
|
#define BACKLIGHT_LED_COUNT 5
|
||||||
#define BACKLIGHT_LEVELS 10
|
#define BACKLIGHT_LEVELS 10
|
||||||
#define BACKLIGHT_ON_STATE 1
|
|
||||||
|
|
||||||
/* Set 0 if debouncing isn't needed */
|
/* Set 0 if debouncing isn't needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ BOOTLOADER = bootloadHID
|
|||||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||||
MOUSEKEY_ENABLE = no # Mouse keys
|
MOUSEKEY_ENABLE = no # Mouse keys
|
||||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||||
CONSOLE_ENABLE = yes # Console for debug
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||||
WS2812_DRIVER = i2c
|
WS2812_DRIVER = i2c
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#define BACKLIGHT_PIN B7
|
#define BACKLIGHT_PIN B7
|
||||||
#ifdef BACKLIGHT_PIN
|
#ifdef BACKLIGHT_PIN
|
||||||
#define BACKLIGHT_LEVELS 6
|
#define BACKLIGHT_LEVELS 6
|
||||||
//#define BACKLIGHT_ON_STATE 1
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* COL2ROW or ROW2COL */
|
/* COL2ROW or ROW2COL */
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
enum layer_names {
|
||||||
|
_QWERTY,
|
||||||
|
_LOWER,
|
||||||
|
_RAISE,
|
||||||
|
_ADJUST
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
/* Qwerty
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||||
|
* | Tab | A | S | D | F | G | H | J | K | L | ; | ' |
|
||||||
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||||
|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | Ctrl | GUI | Alt |Adjust|Lower |Space |Space |Raise | Left | Down | Up |Right |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_QWERTY] = LAYOUT_ortho_4x12( \
|
||||||
|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
|
||||||
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
|
||||||
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
|
||||||
|
KC_LCTRL,KC_LGUI, KC_LALT,MO(_ADJUST),MO(_LOWER),KC_SPC,KC_SPC,MO(_RAISE),KC_LEFT,KC_DOWN, KC_UP, KC_RGHT \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Lower
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | Del |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||||
|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | |
|
||||||
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||||
|
* |RESET | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* |NKTOGG| | | | | | | Next | Vol- | Vol+ | Play |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_LOWER] = LAYOUT_ortho_4x12( \
|
||||||
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
|
||||||
|
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
|
||||||
|
RESET, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______,_______,_______, \
|
||||||
|
NK_TOGG, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Raise
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Del |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||||
|
* | Del | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
|
||||||
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||||
|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | |NKTOGG|RESET |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | Next | Vol- | Vol+ | Play |
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_RAISE] = LAYOUT_ortho_4x12( \
|
||||||
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
|
||||||
|
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
|
||||||
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, NK_TOGG, RESET, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY \
|
||||||
|
),
|
||||||
|
|
||||||
|
/* Adjust
|
||||||
|
* ,-----------------------------------------------------------------------------------.
|
||||||
|
* | | RESET| | | | | | | | | RESET| Del |
|
||||||
|
* |------+------+------+------+------+-------------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------|------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | | | |
|
||||||
|
* |------+------+------+------+------+------+------+------+------+------+------+------|
|
||||||
|
* | | | | | | | | | | |RGBMOD|
|
||||||
|
* `-----------------------------------------------------------------------------------'
|
||||||
|
*/
|
||||||
|
[_ADJUST] = LAYOUT_ortho_4x12( \
|
||||||
|
_______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, RESET, KC_DEL, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
|
||||||
|
_______, _______, _______, _______, AU_OFF, AU_ON, _______, _______, _______, _______, _______, RGB_MOD \
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
VIA_ENABLE = yes
|
||||||
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
/* USB Device descriptor parameter */
|
/* USB Device descriptor parameter */
|
||||||
#define VENDOR_ID 0x21FF
|
#define VENDOR_ID 0x21FF
|
||||||
#define PRODUCT_ID 0xAA97
|
#define PRODUCT_ID 0xAA98
|
||||||
#define DEVICE_VER 0x0002
|
#define DEVICE_VER 0x0002
|
||||||
#define MANUFACTURER westfoxtrot
|
#define MANUFACTURER westfoxtrot
|
||||||
#define PRODUCT cypher
|
#define PRODUCT cypher
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/* VIA Layout > http://www.keyboard-layout-editor.com/#/gists/0e8d4957e77f3179aa09bd6e195f7afa */
|
||||||
|
|
||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
|
[0] = LAYOUT_all(
|
||||||
|
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS,
|
||||||
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_P7, KC_P8, KC_P9, KC_PPLS,
|
||||||
|
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_P4, KC_P5, KC_P6, KC_PEQL,
|
||||||
|
KC_LSFT, KC_BSLS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_P1, KC_P2, KC_P3, KC_PENT,
|
||||||
|
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, KC_RALT, MO(1), KC_LEFT,KC_DOWN,KC_RGHT, KC_P0, KC_PDOT, KC_BSPC),
|
||||||
|
|
||||||
|
[1] = LAYOUT_all(
|
||||||
|
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, BL_TOGG, BL_STEP, BL_ON, BL_OFF, BL_INC, BL_DEC, BL_BRTG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
|
|
||||||
|
[2] = LAYOUT_all(
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
|
|
||||||
|
[3] = LAYOUT_all(
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
|
||||||
|
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,KC_TRNS,KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
|
||||||
|
|
||||||
|
};
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
VIA_ENABLE = yes
|
||||||
|
LTO_ENABLE = yes
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/* Copyright 2020 zvecr<[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "config_common.h"
|
||||||
|
|
||||||
|
/* USB Device descriptor parameter */
|
||||||
|
#define VENDOR_ID 0x7844 // "XD"
|
||||||
|
#define PRODUCT_ID 0x0202
|
||||||
|
#define DEVICE_VER 0x0001
|
||||||
|
#define MANUFACTURER XIUDI
|
||||||
|
#define PRODUCT XD002
|
||||||
|
|
||||||
|
/* matrix size */
|
||||||
|
#define MATRIX_ROWS 1
|
||||||
|
#define MATRIX_COLS 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keyboard Matrix Assignments
|
||||||
|
*
|
||||||
|
* On this board we have direct connection: no diodes.
|
||||||
|
*/
|
||||||
|
#define DIRECT_PINS {{ B0, B1 }}
|
||||||
|
|
||||||
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
|
#define DEBOUNCE 5
|
||||||
|
|
||||||
|
#define RGBLED_NUM 2
|
||||||
|
#define RGB_DI_PIN B2
|
||||||
|
|
||||||
|
// Save as much space as we can...
|
||||||
|
#define LAYER_STATE_8BIT
|
||||||
|
#define NO_ACTION_LAYER
|
||||||
|
#define NO_ACTION_TAPPING
|
||||||
|
#define NO_ACTION_ONESHOT
|
||||||
|
#define NO_RESET
|
||||||
|
|
||||||
|
// usbconfig.h overrides
|
||||||
|
#define USB_CFG_IOPORTNAME B
|
||||||
|
#define USB_CFG_DMINUS_BIT 3
|
||||||
|
#define USB_CFG_DPLUS_BIT 4
|
||||||
|
#define USB_COUNT_SOF 0
|
||||||
|
#define USB_INTR_CFG PCMSK
|
||||||
|
#define USB_INTR_CFG_SET (1<<USB_CFG_DPLUS_BIT)
|
||||||
|
#define USB_INTR_ENABLE_BIT PCIE
|
||||||
|
#define USB_INTR_PENDING_BIT PCIF
|
||||||
|
#define USB_INTR_VECTOR SIG_PIN_CHANGE
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"keyboard_name": "xd002",
|
||||||
|
"url": "https://kprepublic.com/products/xd002-xiudi-2-custom-mechanical-keyboard-2-keys-underglow-and-switch-rgb-pcb-programmed-hot-swappable-macro-key-aluminum-case",
|
||||||
|
"maintainer": "zvecr",
|
||||||
|
"width": 2,
|
||||||
|
"height": 1,
|
||||||
|
"layouts": {
|
||||||
|
"LAYOUT": {
|
||||||
|
"key_count": 2,
|
||||||
|
"layout": [
|
||||||
|
{"x":0, "y":0},
|
||||||
|
{"x":1, "y":0}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(
|
||||||
|
KC_A, KC_B
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
// Defines the keycodes used by our macros in process_record_user
|
||||||
|
enum custom_keycodes {
|
||||||
|
QMKURL = SAFE_RANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(
|
||||||
|
RGB_HUI, QMKURL
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch (keycode) {
|
||||||
|
case QMKURL:
|
||||||
|
// Using SEND_STRING here adds 400bytes ...
|
||||||
|
// SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
|
||||||
|
tap_code(KC_H);
|
||||||
|
tap_code(KC_T);
|
||||||
|
tap_code(KC_T);
|
||||||
|
tap_code(KC_P);
|
||||||
|
tap_code(KC_S);
|
||||||
|
tap_code16(KC_COLON);
|
||||||
|
tap_code(KC_SLASH);
|
||||||
|
tap_code(KC_SLASH);
|
||||||
|
tap_code(KC_Q);
|
||||||
|
tap_code(KC_M);
|
||||||
|
tap_code(KC_K);
|
||||||
|
tap_code(KC_DOT);
|
||||||
|
tap_code(KC_F);
|
||||||
|
tap_code(KC_M);
|
||||||
|
tap_code(KC_SLASH);
|
||||||
|
tap_code(KC_ENTER);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
rgblight_enable_noeeprom(); // enables Rgb, without saving settings
|
||||||
|
rgblight_sethsv_noeeprom(180, 255, 255); // sets the color to teal/cyan without saving
|
||||||
|
rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT); // sets mode to Fast breathing without saving
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
RGBLIGHT_ENABLE = yes
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
#include "rgblite.h"
|
||||||
|
|
||||||
|
// Defines the keycodes used by our macros in process_record_user
|
||||||
|
enum custom_keycodes {
|
||||||
|
QMKURL = SAFE_RANGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(
|
||||||
|
RGB_HUI, QMKURL
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||||
|
if (record->event.pressed) {
|
||||||
|
switch (keycode) {
|
||||||
|
case RGB_HUI:
|
||||||
|
rgblight_increase_hue();
|
||||||
|
break;
|
||||||
|
case QMKURL:
|
||||||
|
SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void keyboard_post_init_user(void) {
|
||||||
|
rgblight_increase_hue();
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ws2812.h"
|
||||||
|
#include "rgblight_list.h"
|
||||||
|
|
||||||
|
static inline void rgblight_setrgb(uint8_t _r, uint8_t _g, uint8_t _b) {
|
||||||
|
LED_TYPE leds[RGBLED_NUM] = {{.r = _r, .g = _g, .b = _b}, {.r = _r, .g = _g, .b = _b}};
|
||||||
|
ws2812_setleds(leds, RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rgblight_increase_hue(void) {
|
||||||
|
static uint8_t state = 0;
|
||||||
|
|
||||||
|
state = (state + 1) % 3;
|
||||||
|
switch (state) {
|
||||||
|
case 1:
|
||||||
|
rgblight_setrgb_red();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
rgblight_setrgb_blue();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rgblight_setrgb_green();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
SRC += ws2812.c
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define TAPPING_TERM 500
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
enum layers {
|
||||||
|
_BASE = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
TD_BC = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||||
|
[TD_BC] = ACTION_TAP_DANCE_DOUBLE(KC_B, KC_C)
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[_BASE] = LAYOUT(
|
||||||
|
KC_A, TD(TD_BC)
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
TAP_DANCE_ENABLE = yes
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
[0] = LAYOUT(
|
||||||
|
KC_VOLU, KC_VOLD
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
EXTRAKEY_ENABLE = yes
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# xd002
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
2% Custom mechanical keyboard. ATtiny85 powered, with 2*WS2812 LEDs, and the micronucleus bootloader.
|
||||||
|
|
||||||
|
**Note**: Due to limited firmware space, a _**lot**_ of features have to be disabled to get a functioning QMK based keyboard.
|
||||||
|
|
||||||
|
* Keyboard Maintainer: [zvecr](https://github.com/zvecr)
|
||||||
|
* Hardware Supported: xd002
|
||||||
|
* Hardware Availability: [kprepublic](https://kprepublic.com/products/xd002-xiudi-2-custom-mechanical-keyboard-2-keys-underglow-and-switch-rgb-pcb-programmed-hot-swappable-macro-key-aluminum-case)
|
||||||
|
|
||||||
|
Make example for this keyboard (after setting up your build environment):
|
||||||
|
|
||||||
|
make xd002:default
|
||||||
|
|
||||||
|
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||||
|
|
||||||
|
## Flashing
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://github.com/micronucleus/micronucleus.git
|
||||||
|
cd micronucleus/commandline/
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
On Linux, you’ll need proper privileges to access the MCU. You can either use sudo when flashing firmware, or place [these files](https://github.com/micronucleus/micronucleus/blob/master/commandline/49-micronucleus.rules) in /etc/udev/rules.d/. Once added run the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo udevadm control --reload-rules
|
||||||
|
sudo udevadm trigger
|
||||||
|
```
|
||||||
|
|
||||||
|
### Instructions
|
||||||
|
|
||||||
|
**Reset Key**: Hold down key nearest to the USB socket while plugging in the keyboard.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make xd002:default:flash
|
||||||
|
|
||||||
|
# or directly with...
|
||||||
|
micronucleus --run <firmware.hex>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Recovery
|
||||||
|
|
||||||
|
* [Original Firmware](https://github.com/xiudi/Attiny85_vusb_pad_test)
|
||||||
|
* [Bootloader Repair](https://digistump.com/wiki/digispark/tutorials/proisp)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# MCU name
|
||||||
|
MCU = attiny85
|
||||||
|
|
||||||
|
# Bootloader selection
|
||||||
|
BOOTLOADER = micronucleus
|
||||||
|
OPT_DEFS += -DBOOTLOADER_SIZE=1862
|
||||||
|
PROGRAM_CMD = micronucleus --run $(BUILD_DIR)/$(TARGET).hex
|
||||||
|
|
||||||
|
# Build Options
|
||||||
|
# change yes to no to disable
|
||||||
|
#
|
||||||
|
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||||
|
MOUSEKEY_ENABLE = no # Mouse keys
|
||||||
|
EXTRAKEY_ENABLE = no # Audio control and System control
|
||||||
|
CONSOLE_ENABLE = no # Console for debug
|
||||||
|
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||||
|
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
|
||||||
|
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||||
|
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||||
|
NKRO_ENABLE = no # USB Nkey Rollover
|
||||||
|
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||||
|
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||||
|
MIDI_ENABLE = no # MIDI support
|
||||||
|
UNICODE_ENABLE = no # Unicode
|
||||||
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
|
AUDIO_ENABLE = no # Audio output on port C6
|
||||||
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
|
||||||
|
|
||||||
|
# Save as much space as we can...
|
||||||
|
LTO_ENABLE = yes
|
||||||
|
GRAVE_ESC_ENABLE = no
|
||||||
|
MAGIC_ENABLE = no
|
||||||
|
SPACE_CADET_ENABLE = no
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/* Copyright 2020 zvecr<[email protected]>
|
||||||
|
*
|
||||||
|
* 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 "xd002.h"
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
/* Copyright 2020 zvecr<[email protected]>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "quantum.h"
|
||||||
|
|
||||||
|
/* This a shortcut to help you visually see your layout.
|
||||||
|
*
|
||||||
|
* The first section contains all of the arguments representing the physical
|
||||||
|
* layout of the board and position of the keys.
|
||||||
|
*
|
||||||
|
* The second converts the arguments into a two-dimensional array which
|
||||||
|
* represents the switch matrix.
|
||||||
|
*/
|
||||||
|
#define LAYOUT( \
|
||||||
|
K01, K02 \
|
||||||
|
) \
|
||||||
|
{ \
|
||||||
|
{ K01, K02 }, \
|
||||||
|
}
|
||||||
@@ -52,6 +52,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define BACKLIGHT_LEVELS 6
|
#define BACKLIGHT_LEVELS 6
|
||||||
#define BACKLIGHT_BREATHING
|
#define BACKLIGHT_BREATHING
|
||||||
#define BREATHING_PERIOD 6
|
#define BREATHING_PERIOD 6
|
||||||
|
#define BACKLIGHT_ON_STATE 0
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define BACKLIGHT_PIN F5
|
#define BACKLIGHT_PIN F5
|
||||||
#define BACKLIGHT_LEVELS 6
|
#define BACKLIGHT_LEVELS 6
|
||||||
|
#define BACKLIGHT_ON_STATE 0
|
||||||
|
|
||||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||||
#define DEBOUNCE 5
|
#define DEBOUNCE 5
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ enum custom_keycodes {
|
|||||||
QMKURL
|
QMKURL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FN_CAPS LT(_FN, KC_CAPS)
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
|
|
||||||
/* QWERTY
|
/* QWERTY
|
||||||
@@ -18,18 +20,18 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
|
||||||
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | Mute |
|
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | Mute |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------|
|
||||||
* | TT(1) | A | S | D | F | G | H | J | K | L | ; | ' | Vol- | Vol+ | ENTER |
|
* | FN(CPS)| A | S | D | F | G | H | J | K | L | ; | ' | Vol- | Vol+ | ENTER |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------|
|
||||||
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | Home | PGUP | UP | PGDWN |
|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | Home | PGUP | UP | PGDWN |
|
||||||
* |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------|
|
* |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------|
|
||||||
* | LCTRL | Prev | Next | LALT | SPACE | End | LEFT | DOWN | RIGHT |
|
* | LCTRL | Del | ENTER | LALT | SPACE | End | LEFT | DOWN | RIGHT |
|
||||||
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[_QW] = LAYOUT_ortho_5x15( /* QWERTY */
|
[_QW] = LAYOUT_ortho_5x15( /* QWERTY */
|
||||||
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC,
|
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_DEL, KC_BSPC,
|
||||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_MUTE,
|
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_MUTE,
|
||||||
TT(1), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_VOLD, KC_VOLU, KC_ENT,
|
FN_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_VOLD, KC_VOLU, KC_ENT,
|
||||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_HOME, KC_PGUP, KC_UP, KC_PGDN,
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_HOME, KC_PGUP, KC_UP, KC_PGDN,
|
||||||
KC_LCTL, KC_MPRV, KC_MNXT, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_END, KC_LEFT, KC_DOWN, KC_RGHT
|
KC_LCTL, KC_MPRV, KC_MNXT, KC_LALT, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, KC_END, KC_LEFT, KC_DOWN, KC_RGHT
|
||||||
),
|
),
|
||||||
@@ -38,22 +40,22 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||||||
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
||||||
* | XXXXXXX| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | _______| _______|
|
* | XXXXXXX| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | _______| _______|
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | P* | P7 | P8 | P9 | + | NumLk | PR SCR | SCR LK | PAUSE | XXXXXXX| XXXXXXX| BL_DEC | BL_INC | RGB HD | RGB HI |
|
* | _______| P7 | P8 | P9 | + | P* | XXXXXXX| PR SCR | SCR LK | PAUSE | XXXXXXX| BL_DEC | BL_INC | RGB HD | RGB HI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | _______| P4 | P5 | P6 | PENT | CALC | XXXXXXX| POWER | XXXXXXX| RESET | XXXXXXX| BL_BRTG| BL_STEP| RGB SD | RGB SI |
|
* | _______| P4 | P5 | P6 | NumLk | CALC | XXXXXXX| POWER | XXXXXXX| RESET | XXXXXXX| BL_BRTG| BL_STEP| RGB SD | RGB SI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | P/ | P1 | P2 | P3 | - | OS | XXXXXXX| XXXXXXX| XXXXXXX| XXXXXXX| XXXXXXX| BL_OFF | BL_ON | RGB VD | RGB VI |
|
* | _______| P1 | P2 | P3 | - | P/ | XXXXXXX| OS | PLAY | PREV | NXT | BL_OFF | BL_ON | RGB VD | RGB VI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | CPSLCK | P0 | P. | _______| SPACE | BL_TOGG| RGB TG | RGB RMD| RGB MD |
|
* | _______| P0 | P. | PENT | SPACE | BL_TOGG| RGB TG | RGB RMD| RGB MD |
|
||||||
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
[_FN] = LAYOUT_ortho_5x15( /* FUNCTION */
|
[_FN] = LAYOUT_ortho_5x15( /* FUNCTION */
|
||||||
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
|
XXXXXXX, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
|
||||||
KC_PAST, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_NLCK, KC_PSCR, KC_SLCK, KC_PAUS, XXXXXXX, XXXXXXX, BL_DEC, BL_INC, RGB_HUD, RGB_HUI,
|
_______, KC_P7, KC_P8, KC_P9, KC_PPLS, KC_PAST, XXXXXXX, KC_SLCK, KC_PAUS, XXXXXXX, XXXXXXX, BL_DEC, BL_INC, RGB_HUD, RGB_HUI,
|
||||||
_______, KC_P4, KC_P5, KC_P6, KC_PENT, KC_CALC, XXXXXXX, KC_PWR, XXXXXXX, RESET, XXXXXXX, BL_BRTG, BL_STEP, RGB_SAD, RGB_SAI,
|
_______, KC_P4, KC_P5, KC_P6, KC_NLCK, KC_CALC, XXXXXXX, KC_PWR, XXXXXXX, RESET, XXXXXXX, BL_BRTG, BL_STEP, RGB_SAD, RGB_SAI,
|
||||||
KC_PSLS, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_LWIN, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, BL_OFF, BL_ON, RGB_VAD, RGB_VAI,
|
_______, KC_P1, KC_P2, KC_P3, KC_PMNS, KC_PSLS, XXXXXXX, KC_LWIN, KC_MPLY, KC_MPRV, KC_MNXT, BL_OFF, BL_ON, RGB_VAD, RGB_VAI,
|
||||||
KC_CAPS, KC_P0, KC_PDOT, _______, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD
|
_______, KC_P0, KC_PDOT, KC_PENT, XXXXXXX, XXXXXXX, XXXXXXX, KC_SPC, XXXXXXX, XXXXXXX, XXXXXXX, BL_TOGG, RGB_TOG, RGB_RMOD,RGB_MOD
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +1,54 @@
|
|||||||
# XD75 with 7U spacebar for EN-RU gamers
|
# XD75 with 7U spacebar for EN-RU gamers
|
||||||
|
* Standard QWERTY made for gamers with a Russian alternative input.
|
||||||
|
* The keys for extra letters in RU alphabet are where they are expected.
|
||||||
|
* Full 2x4 nav cluster.
|
||||||
|
* Volume/mute control are on base layer, Win key is on function layer.
|
||||||
|
* FN_CAPS provides fast F-keys access while gaming. Lefthanded Numpad operation.
|
||||||
|
* NKRO is on (forced).
|
||||||
|
|
||||||
Standard QWERTY oriented on gamers with a Russian alternative input.
|
## Layout
|
||||||
Base layout is as close to classic layout as possible due to RU alphabet having more letters (thus the need for those extra keys remain on the right side).
|
```c
|
||||||
Full uncut 2x4 nav cluster.
|
|
||||||
Caps Lock and Win keys sent to the Function layer.
|
|
||||||
TT(1) - Function layer tap-toggle at CapsLock position provides fast F-keys access in a heat of a battle. As well as easy access to a Numpad.
|
|
||||||
|
|
||||||
/* QWERTY
|
/* QWERTY
|
||||||
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
||||||
* | GESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Del | BACKSP |
|
* | GESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | Del | BACKSP |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------|
|
||||||
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | Mute |
|
* | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | \ | Mute |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+-----------------+--------|
|
||||||
* | TT(1) | A | S | D | F | G | H | J | K | L | ; | '' | Vol- | Vol+ | ENTER |
|
* | FN(CPS)| A | S | D | F | G | H | J | K | L | ; | ' | Vol- | Vol+ | ENTER |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------------------------+--------|
|
||||||
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | Home | PGUP | UP | PGDWN |
|
* | LSHIFT | Z | X | C | V | B | N | M | , | . | / | Home | PGUP | UP | PGDWN |
|
||||||
* |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------|
|
* |--------+--------+--------+--------+--------+-----------------+--------+--------+--------+--------+-----------------+--------+--------|
|
||||||
* | LCTRL | Prev | Next | LALT | SPACE | End | LEFT | DOWN | RIGHT |
|
* | LCTRL | Del | ENTER | LALT | SPACE | End | LEFT | DOWN | RIGHT |
|
||||||
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
|
```
|
||||||
|
```c
|
||||||
/* FUNCTION
|
/* FUNCTION
|
||||||
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
* .--------------------------------------------------------------------------------------------------------------------------------------.
|
||||||
* | XXXXXXX| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | _______| _______|
|
* | XXXXXXX| F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | _______| _______|
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | P* | P7 | P8 | P9 | + | NumLk | PR SCR | SCR LK | PAUSE | XXXXXXX| XXXXXXX| BL_DEC | BL_INC | RGB HD | RGB HI |
|
* | _______| P7 | P8 | P9 | + | P* | XXXXXXX| PR SCR | SCR LK | PAUSE | XXXXXXX| BL_DEC | BL_INC | RGB HD | RGB HI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | _______| P4 | P5 | P6 | PENT | CALC | XXXXXXX| POWER | XXXXXXX| RESET | XXXXXXX| BL_BRTG| BL_STEP| RGB SD | RGB SI |
|
* | _______| P4 | P5 | P6 | NumLk | CALC | XXXXXXX| POWER | XXXXXXX| RESET | XXXXXXX| BL_BRTG| BL_STEP| RGB SD | RGB SI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | P/ | P1 | P2 | P3 | - | OS | XXXXXXX| XXXXXXX| XXXXXXX| XXXXXXX| XXXXXXX| BL_OFF | BL_ON | RGB VD | RGB VI |
|
* | _______| P1 | P2 | P3 | - | P/ | XXXXXXX| OS | PLAY | PREV | NXT | BL_OFF | BL_ON | RGB VD | RGB VI |
|
||||||
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
* |--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||||
* | CPSLCK | P0 | P. | _______| SPACE | BL_TOGG| RGB TG | RGB RMD| RGB MD |
|
* | _______| P0 | P. | PENT | SPACE | BL_TOGG| RGB TG | RGB RMD| RGB MD |
|
||||||
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
* '--------------------------------------------------------------------------------------------------------------------------------------'
|
||||||
*/
|
*/
|
||||||
|
```
|
||||||
|
## LEDs
|
||||||
## LED control
|
|
||||||
|
|
||||||
Top left LED - Function layer active.
|
Top left LED - Function layer active.
|
||||||
Mid left LED - CapsLock active.
|
Mid left LED - CapsLock active.
|
||||||
|
|
||||||
|
## Compile
|
||||||
|
|
||||||
|
go to qmk top directory.
|
||||||
|
```
|
||||||
|
$ cd qmk_firmware
|
||||||
|
```
|
||||||
|
|
||||||
|
build
|
||||||
|
```
|
||||||
|
$ make xd75:buzzlighter1
|
||||||
|
```
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
|
||||||
enum ssd1306_cmds {
|
enum ssd1306_cmds {
|
||||||
@@ -93,4 +92,4 @@ void matrix_write_ln(struct CharacterMatrix *matrix, const char *data);
|
|||||||
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
void matrix_write_P(struct CharacterMatrix *matrix, const char *data);
|
||||||
void matrix_render(struct CharacterMatrix *matrix);
|
void matrix_render(struct CharacterMatrix *matrix);
|
||||||
|
|
||||||
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
bool process_record_gfx(uint16_t keycode, keyrecord_t *record);
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/* Copyright 2016 Wez Furlong
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
// Some helpers for controlling gpio pins
|
|
||||||
#include <avr/io.h>
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PinDirectionInput = 0,
|
|
||||||
PinDirectionOutput = 1,
|
|
||||||
PinLevelHigh = 1,
|
|
||||||
PinLevelLow = 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
// ex: pinMode(B0, PinDirectionOutput);
|
|
||||||
static inline void pinMode(uint8_t pin, int mode) {
|
|
||||||
uint8_t bv = _BV(pin & 0xf);
|
|
||||||
if (mode == PinDirectionOutput) {
|
|
||||||
_SFR_IO8((pin >> 4) + 1) |= bv;
|
|
||||||
} else {
|
|
||||||
_SFR_IO8((pin >> 4) + 1) &= ~bv;
|
|
||||||
_SFR_IO8((pin >> 4) + 2) &= ~bv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ex: digitalWrite(B0, PinLevelHigh);
|
|
||||||
static inline void digitalWrite(uint8_t pin, int mode) {
|
|
||||||
uint8_t bv = _BV(pin & 0xf);
|
|
||||||
if (mode == PinLevelHigh) {
|
|
||||||
_SFR_IO8((pin >> 4) + 2) |= bv;
|
|
||||||
} else {
|
|
||||||
_SFR_IO8((pin >> 4) + 2) &= ~bv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return true if the pin is HIGH
|
|
||||||
// digitalRead(B0)
|
|
||||||
static inline bool digitalRead(uint8_t pin) { return _SFR_IO8(pin >> 4) & _BV(pin & 0xf); }
|
|
||||||
@@ -197,6 +197,8 @@ typedef uint8_t pin_t;
|
|||||||
|
|
||||||
# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
|
# define readPin(pin) ((bool)(PINx_ADDRESS(pin) & _BV((pin)&0xF)))
|
||||||
|
|
||||||
|
# define togglePin(pin) (PORTx_ADDRESS(pin) ^= _BV((pin)&0xF))
|
||||||
|
|
||||||
#elif defined(PROTOCOL_CHIBIOS)
|
#elif defined(PROTOCOL_CHIBIOS)
|
||||||
typedef ioline_t pin_t;
|
typedef ioline_t pin_t;
|
||||||
|
|
||||||
@@ -210,6 +212,8 @@ typedef ioline_t pin_t;
|
|||||||
# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
|
# define writePin(pin, level) ((level) ? writePinHigh(pin) : writePinLow(pin))
|
||||||
|
|
||||||
# define readPin(pin) palReadLine(pin)
|
# define readPin(pin) palReadLine(pin)
|
||||||
|
|
||||||
|
# define togglePin(pin) palToggleLine(pin)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SEND_STRING(string) send_string_P(PSTR(string))
|
#define SEND_STRING(string) send_string_P(PSTR(string))
|
||||||
|
|||||||
+34
-36
@@ -107,23 +107,19 @@ LED_TYPE led[RGBLED_NUM];
|
|||||||
rgblight_segment_t const *const *rgblight_layers = NULL;
|
rgblight_segment_t const *const *rgblight_layers = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t clipping_start_pos = 0;
|
rgblight_ranges_t rgblight_ranges = {0, RGBLED_NUM, 0, RGBLED_NUM, RGBLED_NUM};
|
||||||
static uint8_t clipping_num_leds = RGBLED_NUM;
|
|
||||||
static uint8_t effect_start_pos = 0;
|
|
||||||
static uint8_t effect_end_pos = RGBLED_NUM;
|
|
||||||
static uint8_t effect_num_leds = RGBLED_NUM;
|
|
||||||
|
|
||||||
void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) {
|
void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) {
|
||||||
clipping_start_pos = start_pos;
|
rgblight_ranges.clipping_start_pos = start_pos;
|
||||||
clipping_num_leds = num_leds;
|
rgblight_ranges.clipping_num_leds = num_leds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) {
|
void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) {
|
||||||
if (start_pos >= RGBLED_NUM) return;
|
if (start_pos >= RGBLED_NUM) return;
|
||||||
if (start_pos + num_leds > RGBLED_NUM) return;
|
if (start_pos + num_leds > RGBLED_NUM) return;
|
||||||
effect_start_pos = start_pos;
|
rgblight_ranges.effect_start_pos = start_pos;
|
||||||
effect_end_pos = start_pos + num_leds;
|
rgblight_ranges.effect_end_pos = start_pos + num_leds;
|
||||||
effect_num_leds = num_leds;
|
rgblight_ranges.effect_num_leds = num_leds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
|
||||||
@@ -468,15 +464,15 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w
|
|||||||
# else
|
# else
|
||||||
uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2];
|
uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2];
|
||||||
# endif
|
# endif
|
||||||
for (uint8_t i = 0; i < effect_num_leds; i++) {
|
for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
||||||
uint8_t _hue = ((uint16_t)i * (uint16_t)range) / effect_num_leds;
|
uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds;
|
||||||
if (direction) {
|
if (direction) {
|
||||||
_hue = hue + _hue;
|
_hue = hue + _hue;
|
||||||
} else {
|
} else {
|
||||||
_hue = hue - _hue;
|
_hue = hue - _hue;
|
||||||
}
|
}
|
||||||
dprintf("rgblight rainbow set hsv: %d,%d,%d,%u\n", i, _hue, direction, range);
|
dprintf("rgblight rainbow set hsv: %d,%d,%d,%u\n", i, _hue, direction, range);
|
||||||
sethsv(_hue, sat, val, (LED_TYPE *)&led[i + effect_start_pos]);
|
sethsv(_hue, sat, val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
|
||||||
}
|
}
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
}
|
}
|
||||||
@@ -530,7 +526,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) {
|
for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
|
||||||
led[i].r = r;
|
led[i].r = r;
|
||||||
led[i].g = g;
|
led[i].g = g;
|
||||||
led[i].b = b;
|
led[i].b = b;
|
||||||
@@ -664,10 +660,12 @@ static void rgblight_layers_write(void) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
|
||||||
|
|
||||||
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
#ifndef RGBLIGHT_CUSTOM_DRIVER
|
||||||
void rgblight_set(void) {
|
void rgblight_set(void) {
|
||||||
LED_TYPE *start_led;
|
LED_TYPE *start_led;
|
||||||
uint16_t num_leds = clipping_num_leds;
|
uint8_t num_leds = rgblight_ranges.clipping_num_leds;
|
||||||
|
|
||||||
# ifdef RGBLIGHT_LAYERS
|
# ifdef RGBLIGHT_LAYERS
|
||||||
if (rgblight_layers != NULL) {
|
if (rgblight_layers != NULL) {
|
||||||
@@ -676,7 +674,7 @@ void rgblight_set(void) {
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
if (!rgblight_config.enable) {
|
if (!rgblight_config.enable) {
|
||||||
for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) {
|
for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
|
||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
@@ -691,9 +689,9 @@ void rgblight_set(void) {
|
|||||||
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
|
||||||
led0[i] = led[pgm_read_byte(&led_map[i])];
|
led0[i] = led[pgm_read_byte(&led_map[i])];
|
||||||
}
|
}
|
||||||
start_led = led0 + clipping_start_pos;
|
start_led = led0 + rgblight_ranges.clipping_start_pos;
|
||||||
# else
|
# else
|
||||||
start_led = led + clipping_start_pos;
|
start_led = led + rgblight_ranges.clipping_start_pos;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef RGBW
|
# ifdef RGBW
|
||||||
@@ -701,7 +699,7 @@ void rgblight_set(void) {
|
|||||||
convert_rgb_to_rgbw(&start_led[i]);
|
convert_rgb_to_rgbw(&start_led[i]);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
ws2812_setleds(start_led, num_leds);
|
rgblight_call_driver(start_led, num_leds);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -961,9 +959,9 @@ void rgblight_effect_rainbow_swirl(animation_status_t *anim) {
|
|||||||
uint8_t hue;
|
uint8_t hue;
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
for (i = 0; i < effect_num_leds; i++) {
|
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
||||||
hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / effect_num_leds * i + anim->current_hue);
|
hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / rgblight_ranges.effect_num_leds * i + anim->current_hue);
|
||||||
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]);
|
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
|
||||||
}
|
}
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
|
|
||||||
@@ -991,7 +989,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
||||||
if (anim->pos == 0) { // restart signal
|
if (anim->pos == 0) { // restart signal
|
||||||
if (increment == 1) {
|
if (increment == 1) {
|
||||||
pos = effect_num_leds - 1;
|
pos = rgblight_ranges.effect_num_leds - 1;
|
||||||
} else {
|
} else {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
@@ -999,8 +997,8 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
for (i = 0; i < effect_num_leds; i++) {
|
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
||||||
LED_TYPE *ledp = led + i + effect_start_pos;
|
LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos;
|
||||||
ledp->r = 0;
|
ledp->r = 0;
|
||||||
ledp->g = 0;
|
ledp->g = 0;
|
||||||
ledp->b = 0;
|
ledp->b = 0;
|
||||||
@@ -1013,7 +1011,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
k = k % RGBLED_NUM;
|
k = k % RGBLED_NUM;
|
||||||
}
|
}
|
||||||
if (k < 0) {
|
if (k < 0) {
|
||||||
k = k + effect_num_leds;
|
k = k + rgblight_ranges.effect_num_leds;
|
||||||
}
|
}
|
||||||
if (i == k) {
|
if (i == k) {
|
||||||
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val * (RGBLIGHT_EFFECT_SNAKE_LENGTH - j) / RGBLIGHT_EFFECT_SNAKE_LENGTH), ledp);
|
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val * (RGBLIGHT_EFFECT_SNAKE_LENGTH - j) / RGBLIGHT_EFFECT_SNAKE_LENGTH), ledp);
|
||||||
@@ -1023,7 +1021,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
rgblight_set();
|
rgblight_set();
|
||||||
if (increment == 1) {
|
if (increment == 1) {
|
||||||
if (pos - 1 < 0) {
|
if (pos - 1 < 0) {
|
||||||
pos = effect_num_leds - 1;
|
pos = rgblight_ranges.effect_num_leds - 1;
|
||||||
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
||||||
anim->pos = 0;
|
anim->pos = 0;
|
||||||
# endif
|
# endif
|
||||||
@@ -1034,7 +1032,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos = (pos + 1) % effect_num_leds;
|
pos = (pos + 1) % rgblight_ranges.effect_num_leds;
|
||||||
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
|
||||||
anim->pos = pos;
|
anim->pos = pos;
|
||||||
# endif
|
# endif
|
||||||
@@ -1060,7 +1058,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
|
|||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
// Set all the LEDs to 0
|
// Set all the LEDs to 0
|
||||||
for (i = effect_start_pos; i < effect_end_pos; i++) {
|
for (i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
|
||||||
led[i].r = 0;
|
led[i].r = 0;
|
||||||
led[i].g = 0;
|
led[i].g = 0;
|
||||||
led[i].b = 0;
|
led[i].b = 0;
|
||||||
@@ -1070,7 +1068,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
|
|||||||
}
|
}
|
||||||
// Determine which LEDs should be lit up
|
// Determine which LEDs should be lit up
|
||||||
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
|
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
|
||||||
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % effect_num_leds + effect_start_pos;
|
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % rgblight_ranges.effect_num_leds + rgblight_ranges.effect_start_pos;
|
||||||
|
|
||||||
if (i >= low_bound && i <= high_bound) {
|
if (i >= low_bound && i <= high_bound) {
|
||||||
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);
|
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);
|
||||||
@@ -1107,9 +1105,9 @@ void rgblight_effect_christmas(animation_status_t *anim) {
|
|||||||
uint8_t i;
|
uint8_t i;
|
||||||
|
|
||||||
anim->current_offset = (anim->current_offset + 1) % 2;
|
anim->current_offset = (anim->current_offset + 1) % 2;
|
||||||
for (i = 0; i < effect_num_leds; i++) {
|
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
||||||
hue = 0 + ((i / RGBLIGHT_EFFECT_CHRISTMAS_STEP + anim->current_offset) % 2) * 85;
|
hue = 0 + ((i / RGBLIGHT_EFFECT_CHRISTMAS_STEP + anim->current_offset) % 2) * 85;
|
||||||
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]);
|
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
|
||||||
}
|
}
|
||||||
rgblight_set();
|
rgblight_set();
|
||||||
}
|
}
|
||||||
@@ -1148,11 +1146,11 @@ void rgblight_effect_rgbtest(animation_status_t *anim) {
|
|||||||
|
|
||||||
#ifdef RGBLIGHT_EFFECT_ALTERNATING
|
#ifdef RGBLIGHT_EFFECT_ALTERNATING
|
||||||
void rgblight_effect_alternating(animation_status_t *anim) {
|
void rgblight_effect_alternating(animation_status_t *anim) {
|
||||||
for (int i = 0; i < effect_num_leds; i++) {
|
for (int i = 0; i < rgblight_ranges.effect_num_leds; i++) {
|
||||||
LED_TYPE *ledp = led + i + effect_start_pos;
|
LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos;
|
||||||
if (i < effect_num_leds / 2 && anim->pos) {
|
if (i < rgblight_ranges.effect_num_leds / 2 && anim->pos) {
|
||||||
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
|
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
|
||||||
} else if (i >= effect_num_leds / 2 && !anim->pos) {
|
} else if (i >= rgblight_ranges.effect_num_leds / 2 && !anim->pos) {
|
||||||
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
|
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
|
||||||
} else {
|
} else {
|
||||||
sethsv(rgblight_config.hue, rgblight_config.sat, 0, ledp);
|
sethsv(rgblight_config.hue, rgblight_config.sat, 0, ledp);
|
||||||
|
|||||||
+15
-4
@@ -130,7 +130,7 @@ enum RGBLIGHT_EFFECT_MODE {
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM
|
# ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM
|
||||||
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (effect_num_leds)
|
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (rgblight_ranges.effect_num_leds)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL
|
# ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL
|
||||||
@@ -160,9 +160,7 @@ enum RGBLIGHT_EFFECT_MODE {
|
|||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
# include <stdbool.h>
|
# include <stdbool.h>
|
||||||
# include "eeconfig.h"
|
# include "eeconfig.h"
|
||||||
# ifndef RGBLIGHT_CUSTOM_DRIVER
|
# include "ws2812.h"
|
||||||
# include "ws2812.h"
|
|
||||||
# endif
|
|
||||||
# include "color.h"
|
# include "color.h"
|
||||||
# include "rgblight_list.h"
|
# include "rgblight_list.h"
|
||||||
|
|
||||||
@@ -230,6 +228,19 @@ typedef struct _rgblight_status_t {
|
|||||||
# endif
|
# endif
|
||||||
} rgblight_status_t;
|
} rgblight_status_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Structure for RGB Light clipping ranges
|
||||||
|
*/
|
||||||
|
typedef struct _rgblight_ranges_t {
|
||||||
|
uint8_t clipping_start_pos;
|
||||||
|
uint8_t clipping_num_leds;
|
||||||
|
uint8_t effect_start_pos;
|
||||||
|
uint8_t effect_end_pos;
|
||||||
|
uint8_t effect_num_leds;
|
||||||
|
} rgblight_ranges_t;
|
||||||
|
|
||||||
|
extern rgblight_ranges_t rgblight_ranges;
|
||||||
|
|
||||||
/* === Utility Functions ===*/
|
/* === Utility Functions ===*/
|
||||||
void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
|
void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
|
||||||
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check
|
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check
|
||||||
|
|||||||
@@ -156,7 +156,7 @@
|
|||||||
* @brief Enables the SPI subsystem.
|
* @brief Enables the SPI subsystem.
|
||||||
*/
|
*/
|
||||||
# if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
# if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||||
# define HAL_USE_SPI FALSE
|
# define HAL_USE_SPI TRUE
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -227,7 +227,7 @@
|
|||||||
* SPI driver system settings.
|
* SPI driver system settings.
|
||||||
*/
|
*/
|
||||||
#define STM32_SPI_USE_SPI1 FALSE
|
#define STM32_SPI_USE_SPI1 FALSE
|
||||||
#define STM32_SPI_USE_SPI2 FALSE
|
#define STM32_SPI_USE_SPI2 TRUE
|
||||||
#define STM32_SPI_USE_SPI3 FALSE
|
#define STM32_SPI_USE_SPI3 FALSE
|
||||||
#define STM32_SPI_SPI1_DMA_PRIORITY 1
|
#define STM32_SPI_SPI1_DMA_PRIORITY 1
|
||||||
#define STM32_SPI_SPI2_DMA_PRIORITY 1
|
#define STM32_SPI_SPI2_DMA_PRIORITY 1
|
||||||
|
|||||||
@@ -27,6 +27,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
|||||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||||
MIDI_ENABLE = no # MIDI support
|
MIDI_ENABLE = no # MIDI support
|
||||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||||
AUDIO_ENABLE = no # Audio output on port C6
|
AUDIO_ENABLE = no # Audio output
|
||||||
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
|
||||||
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
|
HD44780_ENABLE = no # Enable support for HD44780 based LCDs
|
||||||
@@ -10,6 +10,7 @@ TMK_COMMON_SRC += $(COMMON_DIR)/host.c \
|
|||||||
$(COMMON_DIR)/action_util.c \
|
$(COMMON_DIR)/action_util.c \
|
||||||
$(COMMON_DIR)/print.c \
|
$(COMMON_DIR)/print.c \
|
||||||
$(COMMON_DIR)/debug.c \
|
$(COMMON_DIR)/debug.c \
|
||||||
|
$(COMMON_DIR)/sendchar_null.c \
|
||||||
$(COMMON_DIR)/util.c \
|
$(COMMON_DIR)/util.c \
|
||||||
$(COMMON_DIR)/eeconfig.c \
|
$(COMMON_DIR)/eeconfig.c \
|
||||||
$(COMMON_DIR)/report.c \
|
$(COMMON_DIR)/report.c \
|
||||||
|
|||||||
@@ -213,6 +213,13 @@ void keyboard_setup(void) {
|
|||||||
*/
|
*/
|
||||||
__attribute__((weak)) bool is_keyboard_master(void) { return true; }
|
__attribute__((weak)) bool is_keyboard_master(void) { return true; }
|
||||||
|
|
||||||
|
/** \brief should_process_keypress
|
||||||
|
*
|
||||||
|
* Override this function if you have a condition where keypresses processing should change:
|
||||||
|
* - splits where the slave side needs to process for rgb/oled functionality
|
||||||
|
*/
|
||||||
|
__attribute__((weak)) bool should_process_keypress(void) { return is_keyboard_master(); }
|
||||||
|
|
||||||
/** \brief keyboard_init
|
/** \brief keyboard_init
|
||||||
*
|
*
|
||||||
* FIXME: needs doc
|
* FIXME: needs doc
|
||||||
@@ -292,7 +299,7 @@ void keyboard_task(void) {
|
|||||||
matrix_scan();
|
matrix_scan();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_keyboard_master()) {
|
if (should_process_keypress()) {
|
||||||
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
for (uint8_t r = 0; r < MATRIX_ROWS; r++) {
|
||||||
matrix_row = matrix_get_row(r);
|
matrix_row = matrix_get_row(r);
|
||||||
matrix_change = matrix_row ^ matrix_prev[r];
|
matrix_change = matrix_row ^ matrix_prev[r];
|
||||||
|
|||||||
@@ -69,6 +69,8 @@ enum consumer_usages {
|
|||||||
AL_CALCULATOR = 0x192,
|
AL_CALCULATOR = 0x192,
|
||||||
AL_LOCAL_BROWSER = 0x194,
|
AL_LOCAL_BROWSER = 0x194,
|
||||||
AL_LOCK = 0x19E,
|
AL_LOCK = 0x19E,
|
||||||
|
AL_CONTROL_PANEL = 0x19F,
|
||||||
|
AL_ASSISTANT = 0x1CB,
|
||||||
// 15.16 Generic GUI Application Controls
|
// 15.16 Generic GUI Application Controls
|
||||||
AC_MINIMIZE = 0x206,
|
AC_MINIMIZE = 0x206,
|
||||||
AC_SEARCH = 0x221,
|
AC_SEARCH = 0x221,
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*/
|
*/
|
||||||
#include "sendchar.h"
|
#include "sendchar.h"
|
||||||
|
|
||||||
int8_t sendchar(uint8_t c) { return 0; }
|
__attribute__((weak)) int8_t sendchar(uint8_t c) { return 0; }
|
||||||
@@ -161,7 +161,9 @@ ISR(IBM4704_INT_VECT) {
|
|||||||
case STOP:
|
case STOP:
|
||||||
// Data:Low
|
// Data:Low
|
||||||
WAIT(data_lo, 100, state);
|
WAIT(data_lo, 100, state);
|
||||||
rbuf_enqueue(data);
|
if (!rbuf_enqueue(data)) {
|
||||||
|
print("rbuf: full\n");
|
||||||
|
}
|
||||||
ibm4704_error = IBM4704_ERR_NONE;
|
ibm4704_error = IBM4704_ERR_NONE;
|
||||||
goto DONE;
|
goto DONE;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -801,8 +801,6 @@ ERROR_EXIT:
|
|||||||
Endpoint_SelectEndpoint(ep);
|
Endpoint_SelectEndpoint(ep);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
int8_t sendchar(uint8_t c) { return 0; }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|||||||
@@ -9,13 +9,12 @@ SRC += $(VUSB_DIR)/main.c \
|
|||||||
$(VUSB_DIR)/usbdrv/oddebug.c
|
$(VUSB_DIR)/usbdrv/oddebug.c
|
||||||
|
|
||||||
|
|
||||||
ifdef NO_UART
|
ifneq ($(strip $(CONSOLE_ENABLE)), yes)
|
||||||
SRC += $(COMMON_DIR)/sendchar_null.c
|
ifndef NO_UART
|
||||||
else
|
|
||||||
SRC += $(COMMON_DIR)/sendchar_uart.c \
|
SRC += $(COMMON_DIR)/sendchar_uart.c \
|
||||||
$(COMMON_DIR)/uart.c
|
$(COMMON_DIR)/uart.c
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
# Search Path
|
# Search Path
|
||||||
VPATH += $(TMK_PATH)/$(VUSB_DIR)
|
VPATH += $(TMK_PATH)/$(VUSB_DIR)
|
||||||
|
|||||||
@@ -21,12 +21,23 @@
|
|||||||
#include "uart.h"
|
#include "uart.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "suspend.h"
|
#include "suspend.h"
|
||||||
|
#include "wait.h"
|
||||||
|
#include "sendchar.h"
|
||||||
|
|
||||||
#ifdef SLEEP_LED_ENABLE
|
#ifdef SLEEP_LED_ENABLE
|
||||||
# include "sleep_led.h"
|
# include "sleep_led.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define UART_BAUD_RATE 115200
|
#define UART_BAUD_RATE 115200
|
||||||
|
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
void console_task(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef RAW_ENABLE
|
||||||
|
void raw_hid_task(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is from main.c of USBaspLoader */
|
/* This is from main.c of USBaspLoader */
|
||||||
static void initForUsbConnectivity(void) {
|
static void initForUsbConnectivity(void) {
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
@@ -39,10 +50,9 @@ static void initForUsbConnectivity(void) {
|
|||||||
_delay_ms(1);
|
_delay_ms(1);
|
||||||
}
|
}
|
||||||
usbDeviceConnect();
|
usbDeviceConnect();
|
||||||
sei();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void usb_remote_wakeup(void) {
|
static void usb_remote_wakeup(void) {
|
||||||
cli();
|
cli();
|
||||||
|
|
||||||
int8_t ddr_orig = USBDDR;
|
int8_t ddr_orig = USBDDR;
|
||||||
@@ -59,6 +69,23 @@ void usb_remote_wakeup(void) {
|
|||||||
sei();
|
sei();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** \brief Setup USB
|
||||||
|
*
|
||||||
|
* FIXME: Needs doc
|
||||||
|
*/
|
||||||
|
static void setup_usb(void) {
|
||||||
|
// debug("initForUsbConnectivity()\n");
|
||||||
|
initForUsbConnectivity();
|
||||||
|
|
||||||
|
// for Console_Task
|
||||||
|
print_set_sendchar(sendchar);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Main
|
||||||
|
*
|
||||||
|
* FIXME: Needs doc
|
||||||
|
*/
|
||||||
|
int main(void) __attribute__((weak));
|
||||||
int main(void) {
|
int main(void) {
|
||||||
bool suspended = false;
|
bool suspended = false;
|
||||||
#if USB_COUNT_SOF
|
#if USB_COUNT_SOF
|
||||||
@@ -76,8 +103,10 @@ int main(void) {
|
|||||||
keyboard_setup();
|
keyboard_setup();
|
||||||
|
|
||||||
host_set_driver(vusb_driver());
|
host_set_driver(vusb_driver());
|
||||||
debug("initForUsbConnectivity()\n");
|
setup_usb();
|
||||||
initForUsbConnectivity();
|
sei();
|
||||||
|
|
||||||
|
wait_ms(50);
|
||||||
|
|
||||||
keyboard_init();
|
keyboard_init();
|
||||||
#ifdef SLEEP_LED_ENABLE
|
#ifdef SLEEP_LED_ENABLE
|
||||||
@@ -120,18 +149,26 @@ int main(void) {
|
|||||||
if (!suspended) {
|
if (!suspended) {
|
||||||
usbPoll();
|
usbPoll();
|
||||||
|
|
||||||
// TODO: configuration process is incosistent. it sometime fails.
|
// TODO: configuration process is inconsistent. it sometime fails.
|
||||||
// To prevent failing to configure NOT scan keyboard during configuration
|
// To prevent failing to configure NOT scan keyboard during configuration
|
||||||
if (usbConfiguration && usbInterruptIsReady()) {
|
if (usbConfiguration && usbInterruptIsReady()) {
|
||||||
keyboard_task();
|
keyboard_task();
|
||||||
}
|
}
|
||||||
vusb_transfer_keyboard();
|
vusb_transfer_keyboard();
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
#ifdef RAW_ENABLE
|
||||||
usbPoll();
|
usbPoll();
|
||||||
|
|
||||||
if (usbConfiguration && usbInterruptIsReady3()) {
|
if (usbConfiguration && usbInterruptIsReady3()) {
|
||||||
raw_hid_task();
|
raw_hid_task();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
usbPoll();
|
||||||
|
|
||||||
|
if (usbConfiguration && usbInterruptIsReady3()) {
|
||||||
|
console_task();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (suspend_wakeup_condition()) {
|
} else if (suspend_wakeup_condition()) {
|
||||||
usb_remote_wakeup();
|
usb_remote_wakeup();
|
||||||
|
|||||||
+187
-26
@@ -15,25 +15,50 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <avr/eeprom.h>
|
|
||||||
#include <avr/wdt.h>
|
#include <avr/wdt.h>
|
||||||
|
#include <util/delay.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "usbdrv.h"
|
#include "usbdrv.h"
|
||||||
#include "usbconfig.h"
|
#include "usbconfig.h"
|
||||||
#include "host.h"
|
#include "host.h"
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "print.h"
|
|
||||||
#include "debug.h"
|
|
||||||
#include "host_driver.h"
|
#include "host_driver.h"
|
||||||
#include "vusb.h"
|
#include "vusb.h"
|
||||||
#include <util/delay.h>
|
#include "print.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
#ifdef RAW_ENABLE
|
||||||
# include "raw_hid.h"
|
# include "raw_hid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)) && defined(RAW_ENABLE)
|
#if defined(CONSOLE_ENABLE)
|
||||||
# error "Enabling Mousekeys/Extrakeys and Raw HID at the same time is not currently supported on V-USB."
|
# define RBUF_SIZE 128
|
||||||
|
# include "ring_buffer.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define NEXT_INTERFACE __COUNTER__
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Interface indexes
|
||||||
|
*/
|
||||||
|
enum usb_interfaces {
|
||||||
|
KEYBOARD_INTERFACE = NEXT_INTERFACE,
|
||||||
|
#if (defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE))
|
||||||
|
MOUSE_EXTRA_INTERFACE = NEXT_INTERFACE,
|
||||||
|
#endif
|
||||||
|
#ifdef RAW_ENABLE
|
||||||
|
RAW_INTERFACE = NEXT_INTERFACE,
|
||||||
|
#endif
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
CONSOLE_INTERFACE = NEXT_INTERFACE,
|
||||||
|
#endif
|
||||||
|
TOTAL_INTERFACES = NEXT_INTERFACE,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_INTERFACES 2
|
||||||
|
|
||||||
|
#if (NEXT_INTERFACE - 1) > MAX_INTERFACES
|
||||||
|
# error There are not enough available interfaces to support all functions. Please disable one or more of the following: Mouse Keys, Extra Keys, Raw HID, Console
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t vusb_keyboard_leds = 0;
|
static uint8_t vusb_keyboard_leds = 0;
|
||||||
@@ -120,7 +145,60 @@ void raw_hid_task(void) {
|
|||||||
raw_output_received_bytes = 0;
|
raw_output_received_bytes = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------*
|
||||||
|
* Console
|
||||||
|
*------------------------------------------------------------------*/
|
||||||
|
#ifdef CONSOLE_ENABLE
|
||||||
|
# define CONSOLE_BUFFER_SIZE 32
|
||||||
|
# define CONSOLE_EPSIZE 8
|
||||||
|
|
||||||
|
int8_t sendchar(uint8_t c) {
|
||||||
|
rbuf_enqueue(c);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool usbSendData3(char *data, uint8_t len) {
|
||||||
|
uint8_t retries = 5;
|
||||||
|
while (!usbInterruptIsReady3()) {
|
||||||
|
if (!(retries--)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
usbPoll();
|
||||||
|
}
|
||||||
|
|
||||||
|
usbSetInterrupt3((unsigned char *)data, len);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void console_task(void) {
|
||||||
|
if (!usbConfiguration) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rbuf_has_data()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send in chunks of 8 padded to 32
|
||||||
|
char send_buf[CONSOLE_BUFFER_SIZE] = {0};
|
||||||
|
uint8_t send_buf_count = 0;
|
||||||
|
while (rbuf_has_data() && send_buf_count < CONSOLE_EPSIZE) {
|
||||||
|
send_buf[send_buf_count++] = rbuf_dequeue();
|
||||||
|
}
|
||||||
|
|
||||||
|
char *temp = send_buf;
|
||||||
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
|
if (!usbSendData3(temp, 8)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
temp += 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
usbSendData3(0, 0);
|
||||||
|
usbPoll();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*------------------------------------------------------------------*
|
/*------------------------------------------------------------------*
|
||||||
@@ -429,7 +507,30 @@ const PROGMEM uchar raw_hid_report[] = {
|
|||||||
0x95, RAW_BUFFER_SIZE, // Report Count
|
0x95, RAW_BUFFER_SIZE, // Report Count
|
||||||
0x75, 0x08, // Report Size (8)
|
0x75, 0x08, // Report Size (8)
|
||||||
0x91, 0x02, // Output (Data, Variable, Absolute)
|
0x91, 0x02, // Output (Data, Variable, Absolute)
|
||||||
0xC0, // End Collection
|
0xC0 // End Collection
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONSOLE_ENABLE)
|
||||||
|
const PROGMEM uchar console_hid_report[] = {
|
||||||
|
0x06, 0x31, 0xFF, // Usage Page (Vendor Defined - PJRC Teensy compatible)
|
||||||
|
0x09, 0x74, // Usage (Vendor Defined - PJRC Teensy compatible)
|
||||||
|
0xA1, 0x01, // Collection (Application)
|
||||||
|
// Data to host
|
||||||
|
0x09, 0x75, // Usage (Vendor Defined)
|
||||||
|
0x15, 0x00, // Logical Minimum (0x00)
|
||||||
|
0x26, 0xFF, 0x00, // Logical Maximum (0x00FF)
|
||||||
|
0x95, CONSOLE_BUFFER_SIZE, // Report Count
|
||||||
|
0x75, 0x08, // Report Size (8)
|
||||||
|
0x81, 0x02, // Input (Data, Variable, Absolute)
|
||||||
|
// Data from host
|
||||||
|
0x09, 0x76, // Usage (Vendor Defined)
|
||||||
|
0x15, 0x00, // Logical Minimum (0x00)
|
||||||
|
0x26, 0xFF, 0x00, // Logical Maximum (0x00FF)
|
||||||
|
0x95, CONSOLE_BUFFER_SIZE, // Report Count
|
||||||
|
0x75, 0x08, // Report Size (8)
|
||||||
|
0x91, 0x02, // Output (Data)
|
||||||
|
0xC0 // End Collection
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -511,11 +612,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
|
|||||||
.bDescriptorType = USBDESCR_CONFIG
|
.bDescriptorType = USBDESCR_CONFIG
|
||||||
},
|
},
|
||||||
.wTotalLength = sizeof(usbConfigurationDescriptor_t),
|
.wTotalLength = sizeof(usbConfigurationDescriptor_t),
|
||||||
# if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE) || defined(RAW_ENABLE)
|
.bNumInterfaces = TOTAL_INTERFACES,
|
||||||
.bNumInterfaces = 2,
|
|
||||||
# else
|
|
||||||
.bNumInterfaces = 1,
|
|
||||||
# endif
|
|
||||||
.bConfigurationValue = 0x01,
|
.bConfigurationValue = 0x01,
|
||||||
.iConfiguration = 0x00,
|
.iConfiguration = 0x00,
|
||||||
.bmAttributes = (1 << 7) | USBATTR_REMOTEWAKE,
|
.bmAttributes = (1 << 7) | USBATTR_REMOTEWAKE,
|
||||||
@@ -530,7 +627,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
|
|||||||
.bLength = sizeof(usbInterfaceDescriptor_t),
|
.bLength = sizeof(usbInterfaceDescriptor_t),
|
||||||
.bDescriptorType = USBDESCR_INTERFACE
|
.bDescriptorType = USBDESCR_INTERFACE
|
||||||
},
|
},
|
||||||
.bInterfaceNumber = 0,
|
.bInterfaceNumber = KEYBOARD_INTERFACE,
|
||||||
.bAlternateSetting = 0x00,
|
.bAlternateSetting = 0x00,
|
||||||
.bNumEndpoints = 1,
|
.bNumEndpoints = 1,
|
||||||
.bInterfaceClass = 0x03,
|
.bInterfaceClass = 0x03,
|
||||||
@@ -569,7 +666,7 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
|
|||||||
.bLength = sizeof(usbInterfaceDescriptor_t),
|
.bLength = sizeof(usbInterfaceDescriptor_t),
|
||||||
.bDescriptorType = USBDESCR_INTERFACE
|
.bDescriptorType = USBDESCR_INTERFACE
|
||||||
},
|
},
|
||||||
.bInterfaceNumber = 1,
|
.bInterfaceNumber = MOUSE_EXTRA_INTERFACE,
|
||||||
.bAlternateSetting = 0x00,
|
.bAlternateSetting = 0x00,
|
||||||
.bNumEndpoints = 1,
|
.bNumEndpoints = 1,
|
||||||
.bInterfaceClass = 0x03,
|
.bInterfaceClass = 0x03,
|
||||||
@@ -597,14 +694,15 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
|
|||||||
.bmAttributes = 0x03,
|
.bmAttributes = 0x03,
|
||||||
.wMaxPacketSize = 8,
|
.wMaxPacketSize = 8,
|
||||||
.bInterval = USB_POLLING_INTERVAL_MS
|
.bInterval = USB_POLLING_INTERVAL_MS
|
||||||
}
|
},
|
||||||
# elif defined(RAW_ENABLE)
|
# endif
|
||||||
|
# if defined(RAW_ENABLE)
|
||||||
.rawInterface = {
|
.rawInterface = {
|
||||||
.header = {
|
.header = {
|
||||||
.bLength = sizeof(usbInterfaceDescriptor_t),
|
.bLength = sizeof(usbInterfaceDescriptor_t),
|
||||||
.bDescriptorType = USBDESCR_INTERFACE
|
.bDescriptorType = USBDESCR_INTERFACE
|
||||||
},
|
},
|
||||||
.bInterfaceNumber = 1,
|
.bInterfaceNumber = RAW_INTERFACE,
|
||||||
.bAlternateSetting = 0x00,
|
.bAlternateSetting = 0x00,
|
||||||
.bNumEndpoints = 2,
|
.bNumEndpoints = 2,
|
||||||
.bInterfaceClass = 0x03,
|
.bInterfaceClass = 0x03,
|
||||||
@@ -642,7 +740,56 @@ const PROGMEM usbConfigurationDescriptor_t usbConfigurationDescriptor = {
|
|||||||
.bmAttributes = 0x03,
|
.bmAttributes = 0x03,
|
||||||
.wMaxPacketSize = RAW_EPSIZE,
|
.wMaxPacketSize = RAW_EPSIZE,
|
||||||
.bInterval = USB_POLLING_INTERVAL_MS
|
.bInterval = USB_POLLING_INTERVAL_MS
|
||||||
}
|
},
|
||||||
|
# endif
|
||||||
|
# if defined(CONSOLE_ENABLE)
|
||||||
|
/*
|
||||||
|
* Console
|
||||||
|
*/
|
||||||
|
.consoleInterface = {
|
||||||
|
.header = {
|
||||||
|
.bLength = sizeof(usbInterfaceDescriptor_t),
|
||||||
|
.bDescriptorType = USBDESCR_INTERFACE
|
||||||
|
},
|
||||||
|
.bInterfaceNumber = CONSOLE_INTERFACE,
|
||||||
|
.bAlternateSetting = 0x00,
|
||||||
|
.bNumEndpoints = 2,
|
||||||
|
.bInterfaceClass = 0x03,
|
||||||
|
.bInterfaceSubClass = 0x00,
|
||||||
|
.bInterfaceProtocol = 0x00,
|
||||||
|
.iInterface = 0x00
|
||||||
|
},
|
||||||
|
.consoleHID = {
|
||||||
|
.header = {
|
||||||
|
.bLength = sizeof(usbHIDDescriptor_t),
|
||||||
|
.bDescriptorType = USBDESCR_HID
|
||||||
|
},
|
||||||
|
.bcdHID = 0x0111,
|
||||||
|
.bCountryCode = 0x00,
|
||||||
|
.bNumDescriptors = 1,
|
||||||
|
.bDescriptorType = USBDESCR_HID_REPORT,
|
||||||
|
.wDescriptorLength = sizeof(console_hid_report)
|
||||||
|
},
|
||||||
|
.consoleINEndpoint = {
|
||||||
|
.header = {
|
||||||
|
.bLength = sizeof(usbEndpointDescriptor_t),
|
||||||
|
.bDescriptorType = USBDESCR_ENDPOINT
|
||||||
|
},
|
||||||
|
.bEndpointAddress = (USBRQ_DIR_DEVICE_TO_HOST | USB_CFG_EP3_NUMBER),
|
||||||
|
.bmAttributes = 0x03,
|
||||||
|
.wMaxPacketSize = CONSOLE_EPSIZE,
|
||||||
|
.bInterval = 0x01
|
||||||
|
},
|
||||||
|
.consoleOUTEndpoint = {
|
||||||
|
.header = {
|
||||||
|
.bLength = sizeof(usbEndpointDescriptor_t),
|
||||||
|
.bDescriptorType = USBDESCR_ENDPOINT
|
||||||
|
},
|
||||||
|
.bEndpointAddress = (USBRQ_DIR_HOST_TO_DEVICE | USB_CFG_EP3_NUMBER),
|
||||||
|
.bmAttributes = 0x03,
|
||||||
|
.wMaxPacketSize = CONSOLE_EPSIZE,
|
||||||
|
.bInterval = 0x01
|
||||||
|
},
|
||||||
# endif
|
# endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -690,40 +837,54 @@ USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq) {
|
|||||||
break;
|
break;
|
||||||
case USBDESCR_HID:
|
case USBDESCR_HID:
|
||||||
switch (rq->wValue.bytes[0]) {
|
switch (rq->wValue.bytes[0]) {
|
||||||
case 0:
|
case KEYBOARD_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.keyboardHID;
|
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.keyboardHID;
|
||||||
len = sizeof(usbHIDDescriptor_t);
|
len = sizeof(usbHIDDescriptor_t);
|
||||||
break;
|
break;
|
||||||
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
case 1:
|
case MOUSE_EXTRA_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.mouseExtraHID;
|
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.mouseExtraHID;
|
||||||
len = sizeof(usbHIDDescriptor_t);
|
len = sizeof(usbHIDDescriptor_t);
|
||||||
break;
|
break;
|
||||||
#elif defined(RAW_ENABLE)
|
#endif
|
||||||
case 1:
|
#if defined(RAW_ENABLE)
|
||||||
|
case RAW_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.rawHID;
|
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.rawHID;
|
||||||
len = sizeof(usbHIDDescriptor_t);
|
len = sizeof(usbHIDDescriptor_t);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(CONSOLE_ENABLE)
|
||||||
|
case CONSOLE_INTERFACE:
|
||||||
|
usbMsgPtr = (unsigned char *)&usbConfigurationDescriptor.consoleHID;
|
||||||
|
len = sizeof(usbHIDDescriptor_t);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case USBDESCR_HID_REPORT:
|
case USBDESCR_HID_REPORT:
|
||||||
/* interface index */
|
/* interface index */
|
||||||
switch (rq->wIndex.word) {
|
switch (rq->wIndex.word) {
|
||||||
case 0:
|
case KEYBOARD_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)keyboard_hid_report;
|
usbMsgPtr = (unsigned char *)keyboard_hid_report;
|
||||||
len = sizeof(keyboard_hid_report);
|
len = sizeof(keyboard_hid_report);
|
||||||
break;
|
break;
|
||||||
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
#if defined(MOUSE_ENABLE) || defined(EXTRAKEY_ENABLE)
|
||||||
case 1:
|
case MOUSE_EXTRA_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)mouse_extra_hid_report;
|
usbMsgPtr = (unsigned char *)mouse_extra_hid_report;
|
||||||
len = sizeof(mouse_extra_hid_report);
|
len = sizeof(mouse_extra_hid_report);
|
||||||
break;
|
break;
|
||||||
#elif defined(RAW_ENABLE)
|
#endif
|
||||||
case 1:
|
#if defined(RAW_ENABLE)
|
||||||
|
case RAW_INTERFACE:
|
||||||
usbMsgPtr = (unsigned char *)raw_hid_report;
|
usbMsgPtr = (unsigned char *)raw_hid_report;
|
||||||
len = sizeof(raw_hid_report);
|
len = sizeof(raw_hid_report);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(CONSOLE_ENABLE)
|
||||||
|
case CONSOLE_INTERFACE:
|
||||||
|
usbMsgPtr = (unsigned char *)console_hid_report;
|
||||||
|
len = sizeof(console_hid_report);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -93,19 +93,24 @@ typedef struct usbConfigurationDescriptor {
|
|||||||
usbInterfaceDescriptor_t mouseExtraInterface;
|
usbInterfaceDescriptor_t mouseExtraInterface;
|
||||||
usbHIDDescriptor_t mouseExtraHID;
|
usbHIDDescriptor_t mouseExtraHID;
|
||||||
usbEndpointDescriptor_t mouseExtraINEndpoint;
|
usbEndpointDescriptor_t mouseExtraINEndpoint;
|
||||||
#elif defined(RAW_ENABLE)
|
#endif
|
||||||
|
|
||||||
|
#if defined(RAW_ENABLE)
|
||||||
usbInterfaceDescriptor_t rawInterface;
|
usbInterfaceDescriptor_t rawInterface;
|
||||||
usbHIDDescriptor_t rawHID;
|
usbHIDDescriptor_t rawHID;
|
||||||
usbEndpointDescriptor_t rawINEndpoint;
|
usbEndpointDescriptor_t rawINEndpoint;
|
||||||
usbEndpointDescriptor_t rawOUTEndpoint;
|
usbEndpointDescriptor_t rawOUTEndpoint;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CONSOLE_ENABLE)
|
||||||
|
usbInterfaceDescriptor_t consoleInterface;
|
||||||
|
usbHIDDescriptor_t consoleHID;
|
||||||
|
usbEndpointDescriptor_t consoleINEndpoint;
|
||||||
|
usbEndpointDescriptor_t consoleOUTEndpoint;
|
||||||
|
#endif
|
||||||
} __attribute__((packed)) usbConfigurationDescriptor_t;
|
} __attribute__((packed)) usbConfigurationDescriptor_t;
|
||||||
|
|
||||||
#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1))
|
#define USB_STRING_LEN(s) (sizeof(usbDescriptorHeader_t) + ((s) << 1))
|
||||||
|
|
||||||
host_driver_t *vusb_driver(void);
|
host_driver_t *vusb_driver(void);
|
||||||
void vusb_transfer_keyboard(void);
|
void vusb_transfer_keyboard(void);
|
||||||
|
|
||||||
#ifdef RAW_ENABLE
|
|
||||||
void raw_hid_task(void);
|
|
||||||
#endif
|
|
||||||
@@ -3,21 +3,26 @@
|
|||||||
/*--------------------------------------------------------------------
|
/*--------------------------------------------------------------------
|
||||||
* Ring buffer to store scan codes from keyboard
|
* Ring buffer to store scan codes from keyboard
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
#define RBUF_SIZE 32
|
#ifndef RBUF_SIZE
|
||||||
|
# define RBUF_SIZE 32
|
||||||
|
#endif
|
||||||
#include <util/atomic.h>
|
#include <util/atomic.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
static uint8_t rbuf[RBUF_SIZE];
|
static uint8_t rbuf[RBUF_SIZE];
|
||||||
static uint8_t rbuf_head = 0;
|
static uint8_t rbuf_head = 0;
|
||||||
static uint8_t rbuf_tail = 0;
|
static uint8_t rbuf_tail = 0;
|
||||||
static inline void rbuf_enqueue(uint8_t data) {
|
static inline bool rbuf_enqueue(uint8_t data) {
|
||||||
|
bool ret = false;
|
||||||
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
|
||||||
uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
|
uint8_t next = (rbuf_head + 1) % RBUF_SIZE;
|
||||||
if (next != rbuf_tail) {
|
if (next != rbuf_tail) {
|
||||||
rbuf[rbuf_head] = data;
|
rbuf[rbuf_head] = data;
|
||||||
rbuf_head = next;
|
rbuf_head = next;
|
||||||
} else {
|
ret = true;
|
||||||
print("rbuf: full\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
static inline uint8_t rbuf_dequeue(void) {
|
static inline uint8_t rbuf_dequeue(void) {
|
||||||
uint8_t val = 0;
|
uint8_t val = 0;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
#define SOLENOID_H
|
#define SOLENOID_H
|
||||||
|
|
||||||
#include <timer.h>
|
#include <timer.h>
|
||||||
#include "pincontrol.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define SOLENOID_DEFAULT_DWELL 12
|
#define SOLENOID_DEFAULT_DWELL 12
|
||||||
@@ -45,7 +44,7 @@ void solenoid_toggle(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void solenoid_stop(void) {
|
void solenoid_stop(void) {
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
writePinLow(SOLENOID_PIN);
|
||||||
solenoid_on = false;
|
solenoid_on = false;
|
||||||
solenoid_buzzing = false;
|
solenoid_buzzing = false;
|
||||||
}
|
}
|
||||||
@@ -59,7 +58,7 @@ void solenoid_fire(void) {
|
|||||||
solenoid_on = true;
|
solenoid_on = true;
|
||||||
solenoid_buzzing = true;
|
solenoid_buzzing = true;
|
||||||
solenoid_start = timer_read();
|
solenoid_start = timer_read();
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
writePinHigh(SOLENOID_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
void solenoid_check(void) {
|
void solenoid_check(void) {
|
||||||
@@ -80,20 +79,20 @@ void solenoid_check(void) {
|
|||||||
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
|
if (elapsed / SOLENOID_MIN_DWELL % 2 == 0){
|
||||||
if (!solenoid_buzzing) {
|
if (!solenoid_buzzing) {
|
||||||
solenoid_buzzing = true;
|
solenoid_buzzing = true;
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelHigh);
|
writePinHigh(SOLENOID_PIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (solenoid_buzzing) {
|
if (solenoid_buzzing) {
|
||||||
solenoid_buzzing = false;
|
solenoid_buzzing = false;
|
||||||
digitalWrite(SOLENOID_PIN, PinLevelLow);
|
writePinLow(SOLENOID_PIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void solenoid_setup(void) {
|
void solenoid_setup(void) {
|
||||||
pinMode(SOLENOID_PIN, PinDirectionOutput);
|
setPinOutput(SOLENOID_PIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Reference in new issue
Block a user