Compare commits
83 Commits
Author | SHA1 | Date | |
---|---|---|---|
e58ab6d326 | |||
02781979d6 | |||
69b484600f | |||
de79d55187 | |||
580cb2c1df | |||
d9eae3ef03 | |||
05e6cc2655 | |||
8b572de523 | |||
18e561b82c | |||
c785148445 | |||
b43bdc1c69 | |||
5a5ecd7dd9 | |||
60be8d9f24 | |||
3f85e90126 | |||
3eefe31a54 | |||
7be65f2cd0 | |||
016b4be751 | |||
db80209e69 | |||
716924de3e | |||
d88dca3ca7 | |||
9c1097e768 | |||
f7eb030e91 | |||
aae1814319 | |||
78fdd40622 | |||
43b6f031b1 | |||
3e27ceee42 | |||
67f374029d | |||
30fd69886d | |||
ed528403fd | |||
faae375ccd | |||
b0fd064491 | |||
abf466e57d | |||
157319fbd0 | |||
39ff121d73 | |||
8018f4db2d | |||
1a159a38ed | |||
a0bf235644 | |||
f420741f9b | |||
0b7b74f56a | |||
80b2b710da | |||
3814dacf27 | |||
7576f6162e | |||
e8a02afc8c | |||
357a888d80 | |||
7f5656996c | |||
b008a9afe6 | |||
d8e3294aea | |||
a8d073368f | |||
44d93285d1 | |||
8e0af2f5ba | |||
da76734fe0 | |||
c029c5b187 | |||
294cfd8d33 | |||
622e94c6cd | |||
ba7f52aaeb | |||
307013a2f8 | |||
f68abbf6c8 | |||
897c4cd175 | |||
1f2807c2de | |||
b160913309 | |||
867fded980 | |||
d1730ec760 | |||
4057d44989 | |||
2bfcb6bfc5 | |||
1f42071238 | |||
400423d10b | |||
54ef02dead | |||
044b4aaf01 | |||
ccb4b81b3f | |||
e269977387 | |||
0cb4da2c74 | |||
9b0c734733 | |||
fffee6ade1 | |||
97ddc7ea18 | |||
3afd2d81b8 | |||
2543bad250 | |||
a056d94561 | |||
573d1fbb92 | |||
437446ba8f | |||
8640b43214 | |||
09fc6cab34 | |||
7e8dc2e570 | |||
263536586d |
@ -144,7 +144,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
endif
|
||||
endif
|
||||
|
||||
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 WS2812 custom
|
||||
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 IS31FL3741 WS2812 custom
|
||||
|
||||
LED_MATRIX_ENABLE ?= no
|
||||
ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
|
||||
@ -205,6 +205,13 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737)
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3741)
|
||||
OPT_DEFS += -DIS31FL3741 -DSTM32_I2C -DHAL_USE_I2C=TRUE
|
||||
COMMON_VPATH += $(DRIVER_PATH)/issi
|
||||
SRC += is31fl3741.c
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
|
||||
OPT_DEFS += -DWS2812
|
||||
WS2812_DRIVER_REQUIRED := yes
|
||||
|
@ -145,6 +145,7 @@
|
||||
|
||||
* Hardware Platform Development
|
||||
* Arm/ChibiOS
|
||||
* [Selecting an MCU](platformdev_selecting_arm_mcu.md)
|
||||
* [Early initialization](platformdev_chibios_earlyinit.md)
|
||||
|
||||
* QMK Reference
|
||||
|
@ -5,7 +5,7 @@ If you've ever used Vim, you know what a Leader key is. If not, you're about to
|
||||
That's what `KC_LEAD` does. Here's an example:
|
||||
|
||||
1. Pick a key on your keyboard you want to use as the Leader key. Assign it the keycode `KC_LEAD`. This key would be dedicated just for this -- it's a single action key, can't be used for anything else.
|
||||
2. Include the line `#define LEADER_TIMEOUT 300` in your `config.h`. This sets the timeout for the `KC_LEAD` key. Specifically, when you press the `KC_LEAD` key, you only have a certain amount of time to complete the Leader Key sequence. The `300` here sets that to 300ms, and you can increase this value to give you more time to hit the sequence. But any keys pressed during this timeout are intercepted and not sent, so you may want to keep this value low. .
|
||||
2. Include the line `#define LEADER_TIMEOUT 300` in your `config.h`. This sets the timeout for the `KC_LEAD` key. Specifically, when you press the `KC_LEAD` key, you only have a certain amount of time to complete the Leader Key sequence. The `300` here sets that to 300ms, and you can increase this value to give you more time to hit the sequence. But any keys pressed during this timeout are intercepted and not sent, so you may want to keep this value low.
|
||||
* By default, this timeout is how long after pressing `KC_LEAD` to complete your entire sequence. This may be very low for some people. So you may want to increase this timeout. Optionally, you may want to enable the `LEADER_PER_KEY_TIMING` option, which resets the timeout after each key is tapped. This allows you to maintain a low value here, but still be able to use the longer sequences. To enable this option, add `#define LEADER_PER_KEY_TIMING` to your `config.h`.
|
||||
3. Within your `matrix_scan_user` function, add something like this:
|
||||
|
||||
|
@ -6,34 +6,34 @@ Macros allow you to send multiple keystrokes when pressing just one key. QMK has
|
||||
|
||||
## The New Way: `SEND_STRING()` & `process_record_user`
|
||||
|
||||
Sometimes you just want a key to type out words or phrases. For the most common situations we've provided `SEND_STRING()`, which will type out your string (i.e. a sequence of characters) for you. All ASCII characters that are easily translated to a keycode are supported (e.g. `\n\t`).
|
||||
Sometimes you want a key to type out words or phrases. For the most common situations, we've provided `SEND_STRING()`, which will type out a string (i.e. a sequence of characters) for you. All ASCII characters that are easily translatable to a keycode are supported (e.g. `qmk 123\n\t`).
|
||||
|
||||
Here is an example `keymap.c` for a two-key keyboard:
|
||||
|
||||
```c
|
||||
enum custom_keycodes {
|
||||
QMKBEST = SAFE_RANGE,
|
||||
QMKBEST = SAFE_RANGE,
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
switch (keycode) {
|
||||
case QMKBEST:
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKBEST is pressed
|
||||
SEND_STRING("QMK is the best thing ever!");
|
||||
} else {
|
||||
// when keycode QMKBEST is released
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKBEST is pressed
|
||||
SEND_STRING("QMK is the best thing ever!");
|
||||
} else {
|
||||
// when keycode QMKBEST is released
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = {
|
||||
{QMKBEST, KC_ESC}
|
||||
}
|
||||
[0] = {
|
||||
{QMKBEST, KC_ESC},
|
||||
// ...
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
@ -49,42 +49,45 @@ You can do that by adding another keycode and adding another case to the switch
|
||||
|
||||
```c
|
||||
enum custom_keycodes {
|
||||
QMKBEST = SAFE_RANGE,
|
||||
QMKURL,
|
||||
MY_OTHER_MACRO
|
||||
QMKBEST = SAFE_RANGE,
|
||||
QMKURL,
|
||||
MY_OTHER_MACRO,
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
switch (keycode) {
|
||||
case QMKBEST:
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKBEST is pressed
|
||||
SEND_STRING("QMK is the best thing ever!");
|
||||
} else {
|
||||
// when keycode QMKBEST is released
|
||||
}
|
||||
break;
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKBEST is pressed
|
||||
SEND_STRING("QMK is the best thing ever!");
|
||||
} else {
|
||||
// when keycode QMKBEST is released
|
||||
}
|
||||
break;
|
||||
|
||||
case QMKURL:
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKURL is pressed
|
||||
SEND_STRING("https://qmk.fm/\n");
|
||||
} else {
|
||||
// when keycode QMKURL is released
|
||||
}
|
||||
break;
|
||||
if (record->event.pressed) {
|
||||
// when keycode QMKURL is pressed
|
||||
SEND_STRING("https://qmk.fm/\n");
|
||||
} else {
|
||||
// when keycode QMKURL is released
|
||||
}
|
||||
break;
|
||||
|
||||
case MY_OTHER_MACRO:
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL("ac")); // selects all and copies
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
if (record->event.pressed) {
|
||||
SEND_STRING(SS_LCTL("ac")); // selects all and copies
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = {
|
||||
{MY_CUSTOM_MACRO, MY_OTHER_MACRO}
|
||||
}
|
||||
[0] = {
|
||||
{MY_CUSTOM_MACRO, MY_OTHER_MACRO},
|
||||
// ...
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
|
@ -21,7 +21,11 @@ Keep in mind that a report_mouse_t (here "mouseReport") has the following proper
|
||||
* `mouseReport.h` - this is a signed int from -127 to 127 (not 128, this is defined in USB HID spec) representing horizontal scrolling (+ right, - left).
|
||||
* `mouseReport.buttons` - this is a uint8_t in which the last 5 bits are used. These bits represent the mouse button state - bit 3 is mouse button 5, and bit 7 is mouse button 1.
|
||||
|
||||
When the mouse report is sent, the x, y, v, and h values are set to 0 (this is done in "pointing_device_send()", which can be overridden to avoid this behavior). This way, button states persist, but movement will only occur once. For further customization, both `pointing_device_init` and `pointing_device_task` can be overridden.
|
||||
Once you have made the necessary changes to the mouse report, you need to send it:
|
||||
|
||||
* `pointing_device_send()` - Sends the mouse report to the host and zeroes out the report.
|
||||
|
||||
When the mouse report is sent, the x, y, v, and h values are set to 0 (this is done in `pointing_device_send()`, which can be overridden to avoid this behavior). This way, button states persist, but movement will only occur once. For further customization, both `pointing_device_init` and `pointing_device_task` can be overridden.
|
||||
|
||||
In the following example, a custom key is used to click the mouse and scroll 127 units vertically and horizontally, then undo all of that when released - because that's a totally useful function. Listen, this is an example:
|
||||
|
||||
@ -38,6 +42,7 @@ case MS_SPECIAL:
|
||||
currentReport.buttons &= ~MOUSE_BTN1;
|
||||
}
|
||||
pointing_device_set_report(currentReport);
|
||||
pointing_device_send();
|
||||
break;
|
||||
```
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -111,7 +111,7 @@ This is ideal for when you want ensure everything compiles successfully when pre
|
||||
|
||||
## Examples
|
||||
|
||||
For a brief example, checkout [`/users/_example/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna).
|
||||
For a brief example, checkout [`/users/_example/`](https://github.com/qmk/qmk_firmware/tree/master/users/_example).
|
||||
For a more complicated example, checkout [`/users/drashna/`](https://github.com/qmk/qmk_firmware/tree/master/users/drashna)'s userspace.
|
||||
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# デバッグの FAQ
|
||||
|
||||
<!---
|
||||
original document: 376419a4f:docs/faq_debug.md
|
||||
git diff 376419a4f HEAD -- docs/faq_debug.md | cat
|
||||
original document: 0.9.10:docs/faq_debug.md
|
||||
git diff 0.9.10 HEAD -- docs/faq_debug.md | cat
|
||||
-->
|
||||
|
||||
このページは、キーボードのトラブルシューティングについての様々な一般的な質問を説明します。
|
||||
|
@ -1,8 +1,8 @@
|
||||
# バックライト
|
||||
|
||||
<!---
|
||||
original document: 5d5ff80:docs/feature_backlight.md
|
||||
git diff 5d5ff80 HEAD -- docs/feature_backlight.md | cat
|
||||
original document: 0.9.10:docs/feature_backlight.md
|
||||
git diff 0.9.10 HEAD -- docs/feature_backlight.md | cat
|
||||
-->
|
||||
|
||||
多くのキーボードは、キースイッチを貫通して配置されたり、キースイッチの下に配置された個々の LED によって、バックライトキーをサポートします。この機能は通常スイッチごとに単一の色しか使用できないため、[RGB アンダーグロー](ja/feature_rgblight.md)および [RGB マトリックス](ja/feature_rgb_matrix.md)機能のどちらとも異なりますが、キーボードに複数の異なる単一色の LED を取り付けることは当然可能です。
|
||||
@ -94,29 +94,29 @@ BACKLIGHT_DRIVER = pwm
|
||||
|
||||
ハードウェア PWM は以下の表に従ってサポートされます:
|
||||
|
||||
| バックライトピン | AT90USB64/128 | ATmega16/32U4 | ATmega16/32U2 | ATmega32A | ATmega328P |
|
||||
| バックライトピン | AT90USB64/128 | ATmega16/32U4 | ATmega16/32U2 | ATmega32A | ATmega328/P |
|
||||
|-------------|-------------|-------------|-------------|---------|----------|
|
||||
| `B1` | | | | | Timer 1 |
|
||||
| `B2` | | | | | Timer 1 |
|
||||
| `B5` | Timer 1 | Timer 1 | | | |
|
||||
| `B6` | Timer 1 | Timer 1 | | | |
|
||||
| `B7` | Timer 1 | Timer 1 | Timer 1 | | |
|
||||
| `C4` | Timer 3 | | | | |
|
||||
| `C5` | Timer 3 | | Timer 1 | | |
|
||||
| `C6` | Timer 3 | Timer 3 | Timer 1 | | |
|
||||
| `D4` | | | | Timer 1 | |
|
||||
| `D5` | | | | Timer 1 | |
|
||||
| `B1` | | | | | Timer 1 |
|
||||
| `B2` | | | | | Timer 1 |
|
||||
| `B5` | Timer 1 | Timer 1 | | | |
|
||||
| `B6` | Timer 1 | Timer 1 | | | |
|
||||
| `B7` | Timer 1 | Timer 1 | Timer 1 | | |
|
||||
| `C4` | Timer 3 | | | | |
|
||||
| `C5` | Timer 3 | | Timer 1 | | |
|
||||
| `C6` | Timer 3 | Timer 3 | Timer 1 | | |
|
||||
| `D4` | | | | Timer 1 | |
|
||||
| `D5` | | | | Timer 1 | |
|
||||
|
||||
他の全てのピンはソフトウェア PWM を使います。[オーディオ](ja/feature_audio.md)機能が無効あるいは1つのタイマだけを使っている場合は、ハードウェアタイマによってバックライト PWM を引き起こすことができます:
|
||||
|
||||
| オーディオピン | オーディオタイマ | ソフトウェア PWM タイマ |
|
||||
|---------|-----------|------------------|
|
||||
| `C4` | Timer 3 | Timer 1 |
|
||||
| `C5` | Timer 3 | Timer 1 |
|
||||
| `C6` | Timer 3 | Timer 1 |
|
||||
| `B5` | Timer 1 | Timer 3 |
|
||||
| `B6` | Timer 1 | Timer 3 |
|
||||
| `B7` | Timer 1 | Timer 3 |
|
||||
| `C4` | Timer 3 | Timer 1 |
|
||||
| `C5` | Timer 3 | Timer 1 |
|
||||
| `C6` | Timer 3 | Timer 1 |
|
||||
| `B5` | Timer 1 | Timer 3 |
|
||||
| `B6` | Timer 1 | Timer 3 |
|
||||
| `B7` | Timer 1 | Timer 3 |
|
||||
|
||||
両方のタイマーがオーディオのために使われている場合、バックライト PWM はハードウェアタイマを使いませんが、代わりにマトリックススキャンの間に引き起こされます。この場合、PWM の計算は十分なタイミングの精度で呼ばれないかもしれないため、バックライトの明滅はサポートされず、バックライトもちらつくかもしれません。
|
||||
|
||||
@ -126,13 +126,13 @@ BACKLIGHT_DRIVER = pwm
|
||||
|
||||
| 定義 | デフォルト | 説明 |
|
||||
|---------------------|-------------|--------------------------------------------------------------------------------------------------------------|
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PINS` | *定義なし* | 実験的: 詳細は以下を見てください |
|
||||
| `BACKLIGHT_LEVELS` | `3` | 輝度のレベルの数 (オフを除いて最大 31) |
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PINS` | *定義なし* | 実験的: 詳細は以下を見てください |
|
||||
| `BACKLIGHT_LEVELS` | `3` | 輝度のレベルの数 (オフを除いて最大 31) |
|
||||
| `BACKLIGHT_CAPS_LOCK` | *定義なし* | バックライトを使って Caps Lock のインジケータを有効にする (専用 LED の無いキーボードのため) |
|
||||
| `BACKLIGHT_BREATHING` | *定義なし* | サポートされる場合は、バックライトの明滅動作を有効にする |
|
||||
| `BREATHING_PERIOD` | `6` | 各バックライトの "明滅" の長さ(秒) |
|
||||
| `BACKLIGHT_ON_STATE` | `1` | バックライトが "オン" の時のバックライトピンの状態 - high の場合は `1`、low の場合は `0` |
|
||||
| `BREATHING_PERIOD` | `6` | 各バックライトの "明滅" の長さ(秒) |
|
||||
| `BACKLIGHT_ON_STATE` | `1` | バックライトが "オン" の時のバックライトピンの状態 - high の場合は `1`、low の場合は `0` |
|
||||
|
||||
### バックライトオン状態
|
||||
|
||||
@ -192,10 +192,10 @@ BACKLIGHT_DRIVER = pwm
|
||||
|
||||
| 定義 | デフォルト | 説明 |
|
||||
|------------------------|-------------|-------------------------------------------------------------------------------------------------------------|
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PWM_DRIVER` | `PWMD4` | 使用する PWM ドライバ。ピンから PWM タイマへのマッピングについては、ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PWM_CHANNEL` | `3` | 使用する PWM チャンネル。ピンから PWM チャンネルへのマッピングについては、ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PAL_MODE` | `2` | 使用するピンの代替機能。ピンの AF マッピングについては ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PWM_DRIVER` | `PWMD4` | 使用する PWM ドライバ。ピンから PWM タイマへのマッピングについては、ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PWM_CHANNEL` | `3` | 使用する PWM チャンネル。ピンから PWM チャンネルへのマッピングについては、ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PAL_MODE` | `2` | 使用するピンの代替機能。ピンの AF マッピングについては ST データシートを見てください。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
|
||||
## Software PWM Driver :id=software-pwm-driver
|
||||
|
||||
@ -210,7 +210,7 @@ BACKLIGHT_DRIVER = software
|
||||
|
||||
| 定義 | デフォルト | 説明 |
|
||||
|-----------------|-------------|-------------------------------------------------------------------------------------------------------------|
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PIN` | `B7` | LED を制御するピン。自身のキーボードを設計している場合を除き、これを変更する必要はないはずです |
|
||||
| `BACKLIGHT_PINS` | *定義なし* | 実験的: 詳細は以下を見てください |
|
||||
|
||||
### 複数のバックライトピン
|
||||
|
232
docs/ja/feature_split_keyboard.md
Normal file
232
docs/ja/feature_split_keyboard.md
Normal file
@ -0,0 +1,232 @@
|
||||
# 分割キーボード
|
||||
|
||||
<!---
|
||||
original document:0.9.5:docs/feature_split_keyboard.md
|
||||
git diff 0.9.5 HEAD -- docs/feature_split_keyboard.md | cat
|
||||
-->
|
||||
|
||||
QMK ファームウェアリポジトリの多くのキーボードは、"分割"キーボードです。それらは2つのコントローラを使います — 1つは USB に接続し、もう1つは TRRS または同様のケーブルを介してシリアルまたは I<sup>2</sup>C 接続で接続します。
|
||||
|
||||
分割キーボードには多くの利点がありますが、有効にするには追加の作業が必要です。
|
||||
|
||||
QMK ファームウェアには、任意のキーボードで使用可能な一般的な実装と、多くのキーボード固有の実装があります。
|
||||
|
||||
このため、主に Let's Split とその他のキーボードで使われる一般的な実装について説明します。
|
||||
|
||||
!> ARM はまだ完全には分割キーボードをサポートしておらず、様々な制限があります。進捗はしていますが、機能の100%にはまだ達していません。
|
||||
|
||||
|
||||
## 互換性の概要
|
||||
|
||||
| Transport | AVR | ARM |
|
||||
|------------------------------|--------------------|--------------------|
|
||||
| ['serial'](serial_driver.md) | :heavy_check_mark: | :white_check_mark: <sup>1</sup> |
|
||||
| I2C | :heavy_check_mark: | |
|
||||
|
||||
注意:
|
||||
|
||||
1. ハードウェアとソフトウェアの両方の制限は、[ドライバーのドキュメント](serial_driver.md)の中で説明されます。
|
||||
|
||||
## ハードウェア設定
|
||||
|
||||
2つの Pro Micro 互換のコントローラを使っており、キーボードの左右を接続するために TRRS ジャックを使っていることを前提とします。
|
||||
|
||||
### ハードウェア要件
|
||||
|
||||
左右それぞれのキーボードマトリックスのためのダイオードとスイッチとは別に、2個の TRRS ソケットと 1本の TRRS ケーブルが必要です。
|
||||
|
||||
あるいは、少なくとも3本のワイヤがあるケーブルとソケットを使うことができます。
|
||||
|
||||
キーボードの左右間で通信するために I<sup>2</sup>C を使いたい場合は、少なくとも4本のワイヤを備えたケーブルと 2個の 4.7kΩ プルアップ抵抗が必要です。
|
||||
|
||||
#### 考慮事項
|
||||
|
||||
最も一般的に使われる接続は、TRRS ケーブルとジャックです。これらは4本のワイヤを提供し、分割キーボードに非常に有用で、簡単に見つけることができます。
|
||||
|
||||
ただし、ワイヤのうちの1本が Vcc を供給するため、キーボードはホットプラグ不可能です。TRRS ケーブルを抜き差しする前に、必ずキーボードのUSB接続をはずす必要があります。そうしなければ、コントローラを短絡させたり、もっと悪いことが起こるかもしれません。
|
||||
|
||||
別のオプションは電話ケーブルを使うことです (例えば、旧式の RJ-11/RJ-14 ケーブル)。実際に4本のワイヤ/レーンをサポートするものを使うようにしてください。
|
||||
|
||||
ただし、USB ケーブル、SATA ケーブル、そして単に4本の電線でもコントローラ間の通信に使用できることがわかっています。
|
||||
|
||||
!> コントローラ間の通信に USB ケーブルを使っても問題ありませんが、コネクタは通常の USB 接続と間違えられるかもしれず、配線方法によってはキーボードが短絡する可能性があります。このため、分割キーボードの接続のためにはお勧めできません。
|
||||
|
||||
### シリアル配線
|
||||
|
||||
2つの Pro Micro 間で GND、Vcc、D0 (別名 PDO あるいは pin 3) を TRS/TRRS ケーブルの3本のワイヤで接続します。
|
||||
|
||||
?> ここで使われるピンは実際には以下の `SOFT_SERIAL_PIN` によって設定されることに注意してください。
|
||||
|
||||

|
||||
|
||||
### I<sup>2</sup>C 配線
|
||||
|
||||
2つの Pro Micro 間で GND、Vcc、さらに SCL と SDA (それぞれ 別名 PD0/ピン3 および PD1/ピン2) を TRRS ケーブルの4本のワイヤで接続します。
|
||||
|
||||
プルアップ抵抗はキーボードの左右どちら側にも配置することができます。もし各側を単独で使いたい場合は、4つの抵抗を使い、両側にプルアップ抵抗を配置することもできます。
|
||||
|
||||

|
||||
|
||||
## ファームウェア設定
|
||||
|
||||
分割キーボード機能を有効にするには、以下を `rules.mk` に追加してください:
|
||||
|
||||
```make
|
||||
SPLIT_KEYBOARD = yes
|
||||
```
|
||||
|
||||
カスタムトランスポート (通信メソッド)を使っている場合は、以下を追加する必要もあります:
|
||||
|
||||
```make
|
||||
SPLIT_TRANSPORT = custom
|
||||
```
|
||||
|
||||
### 左右の設定
|
||||
|
||||
デフォルトでは、ファームウェアはどちら側がどちらであるかを認識しません; 決定するには幾つかの助けが必要です。これを行うには幾つかの方法があり、以下に優先順に列挙します。
|
||||
|
||||
#### ピンによる左右の設定
|
||||
|
||||
左右を決定するためにコントローラ上のピンを読むようにファームウェアを設定することができます。これを行うには、以下を `config.h` ファイルに追加します:
|
||||
|
||||
```c
|
||||
#define SPLIT_HAND_PIN B7
|
||||
```
|
||||
|
||||
これは指定されたピンを読み込みます。high の場合、コントローラはそれを左側だと仮定し、low の場合、それは右側であると仮定します。
|
||||
|
||||
#### EEPROM による左右の設定
|
||||
|
||||
このメソッドは永続ストレージ(`EEPROM`)のフラグを設定することで、キーボードの左右を設定します。これはコントローラが最初に起動する時にチェックされ、キーボードのどちら側であるかとキーボードのレイアウトの向きを決定します。
|
||||
|
||||
|
||||
このメソッドを有効にするには、以下を `config.h` ファイルに追加します:
|
||||
|
||||
```c
|
||||
#define EE_HANDS
|
||||
```
|
||||
|
||||
ただし、各コントローラに正しい側の EEPROM ファイルを書き込む必要があります。これを手動で行うこともできますが、ファームウェアを書き込む時にこれを行う avrdude および dfu のターゲットが存在します。
|
||||
|
||||
* `:avrdude-split-left`
|
||||
* `:avrdude-split-right`
|
||||
* `:dfu-split-left`
|
||||
* `:dfu-split-right`
|
||||
* `:dfu-util-split-left`
|
||||
* `:dfu-util-split-right`
|
||||
|
||||
この設定は、`EEP_RST` キーや `eeconfig_init()` 関数を使って EEPROM を再初期化する時には変更されません。ただし、ファームウェアの組み込みオプション以外で EEPROM をリセット([QMK Toolbox]() の "Reset EEPROM" ボタンの動作のように、`EEPROM` を上書きするファイルを書きこむなど)した場合、`EEPROM` ファイルを再書き込みする必要があります。
|
||||
|
||||
`EEPROM` ファイルは、QMK ファームウェアのリポジトリ内の[ここ](https://github.com/qmk/qmk_firmware/tree/master/quantum/split_common)にあります。
|
||||
|
||||
#### `#define` による左右の設定
|
||||
|
||||
コンパイル時に左右を設定することができます。これは以下を `config.h` ファイルに追加することで行うことができます:
|
||||
|
||||
```c
|
||||
#define MASTER_RIGHT
|
||||
```
|
||||
|
||||
あるいは
|
||||
|
||||
```c
|
||||
#define MASTER_LEFT
|
||||
```
|
||||
|
||||
どちらも定義されていない場合、左右のデフォルトは `MASTER_LEFT` になります。
|
||||
|
||||
|
||||
### 通信オプション
|
||||
|
||||
全ての分割キーボードが同一であるとは限らないため、`config.h` ファイル内で設定することができる多くの追加のオプションがあります。
|
||||
|
||||
```c
|
||||
#define USE_I2C
|
||||
```
|
||||
|
||||
これは分割キーボードの I<sup>2</sup>C サポートを有効にします。これは厳密には通信用ではありませんが、OLED あるいは I<sup>2</sup>C ベースのデバイスに使うことができます。
|
||||
|
||||
```c
|
||||
#define SOFT_SERIAL_PIN D0
|
||||
```
|
||||
|
||||
これはシリアル通信用に使われるピンを設定します。シリアルを使っていない場合は、これを定義する必要はありません。
|
||||
|
||||
ただし、キーボード上でシリアルおよび I<sup>2</sup>C を使っている場合は、これを設定し、D0 および D1 以外の値に設定する必要があります (これらは I<sup>2</sup>C 通信のために使われます)。
|
||||
|
||||
```c
|
||||
#define SELECT_SOFT_SERIAL_SPEED {#}`
|
||||
```
|
||||
|
||||
シリアル通信に問題がある場合は、この値を変更して、シリアル用の通信速度を制御することができます。デフォルトは1で、可能な値は以下の通りです:
|
||||
|
||||
* **`0`**: 約189kbps (実験用途専用)
|
||||
* **`1`**: 約137kbps (デフォルト)
|
||||
* **`2`**: 約75kbps
|
||||
* **`3`**: 約39kbps
|
||||
* **`4`**: 約26kbps
|
||||
* **`5`**: 約20kbps
|
||||
|
||||
### ハードウェア設定オプション
|
||||
|
||||
ハードウェアのセットアップ方法に基づいて、設定する必要のある設定が幾つかあります。
|
||||
|
||||
```c
|
||||
#define MATRIX_ROW_PINS_RIGHT { <row pins> }
|
||||
#define MATRIX_COL_PINS_RIGHT { <col pins> }
|
||||
```
|
||||
|
||||
これにより、右側のマトリックスに異なるピンのセットを指定することができます。これは、左右の形が違うキーボード (Keebio の Quefrency など)で、左右で別の構成が必要な場合に便利です。
|
||||
|
||||
```c
|
||||
#define DIRECT_PINS_RIGHT { { F1, F0, B0, C7 }, { F4, F5, F6, F7 } }
|
||||
```
|
||||
|
||||
これにより右側のための異なる直接ピンのセットを指定することができます。
|
||||
|
||||
```c
|
||||
#define ENCODERS_PAD_A_RIGHT { encoder1a, encoder2a }
|
||||
#define ENCODERS_PAD_B_RIGHT { encoder1b, encoder2b }
|
||||
```
|
||||
|
||||
これにより右側のための異なるエンコーダピンのセットを指定することができます。
|
||||
|
||||
```c
|
||||
#define RGBLIGHT_SPLIT
|
||||
```
|
||||
|
||||
このオプションは、分割キーボードのコントローラ間で RGB ライトモードの同期を有効にします。これはコントローラに直接配線されている RGB LED を持つキーボード用です (つまり、それらは TRRS ケーブルで "追加データ"オプションを使っていません)。
|
||||
|
||||
```c
|
||||
#define RGBLED_SPLIT { 6, 6 }
|
||||
```
|
||||
|
||||
これは各コントローラに直接接続されている LED の数を設定します。最初の数は左側、2番目の数は右側です。
|
||||
|
||||
?> この設定は `RGBLIGHT_SPLIT` が有効になっていることを意味し、有効になっていない場合は強制的に有効にします。
|
||||
|
||||
|
||||
```c
|
||||
#define SPLIT_USB_DETECT
|
||||
```
|
||||
このオプションは、スタートアップの挙動を変更して、マスタ/スレーブの決定時にアクティブな USB 接続を検出します。このオプションがタイムアウトになった場合、その片側はスレーブと見なされます。これは ARM のデフォルトの挙動で、AVR Teensy ボードに必要です (ハードウェアの制限のため)。
|
||||
|
||||
?> この設定はバッテリパックを使ったデモの機能を停止します。
|
||||
|
||||
```c
|
||||
#define SPLIT_USB_TIMEOUT 2000
|
||||
```
|
||||
これは、`SPLIT_USB_DETECT` を使う時のマスタ/スレーブを検出する場合の最大タイムアウトを設定します。
|
||||
|
||||
```c
|
||||
#define SPLIT_USB_TIMEOUT_POLL 10
|
||||
```
|
||||
これは `SPLIT_USB_DETECT` を使う時のマスタ/スレーブを検出する場合のポーリング頻度を設定します
|
||||
|
||||
## 追加のリソース(英語)
|
||||
|
||||
Nicinabox には Let's Split キーボードのための[非常に優れた詳細なガイド](https://github.com/nicinabox/lets-split-guide)があり、トラブルシューティング情報を含む知っておくべきほとんど全てをカバーします。
|
||||
|
||||
ただし、RGB ライトセクションは、RGB Split コードが QMK ファームウェアに追加されるずっと前に書かれたため、古くなっています。ガイドに従う代わりに、各 LED テーブ(訳注: LED strip とも呼びます)を直接コントローラに配線します。
|
||||
|
||||
<!-- I may port this information later, but for now ... it's very nice, and covers everything -->
|
@ -1,8 +1,8 @@
|
||||
# 書き込みの手順とブートローダ情報
|
||||
|
||||
<!---
|
||||
original document: 0.8.62:docs/flashing.md
|
||||
git diff 0.8.62 HEAD -- docs/flashing.md | cat
|
||||
original document: 0.9.10:docs/flashing.md
|
||||
git diff 0.9.10 HEAD -- docs/flashing.md | cat
|
||||
-->
|
||||
|
||||
キーボードが使用するブートローダにはかなり多くの種類があり、ほぼ全てが異なる書き込みの方法を使います。幸いなことに、[QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) のようなプロジェクトは、あまり深く考える必要無しに様々なタイプと互換性を持つことを目指していますが、この文章では様々なタイプのブートローダとそれらを書き込むために利用可能な方法について説明します。
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Vagrant クイックスタート
|
||||
|
||||
<!---
|
||||
original document: 7494490d6:docs/getting_started_vagrant.md
|
||||
git diff 7494490d6 HEAD -- docs/getting_started_vagrant.md | cat
|
||||
original document: 0.9.10:docs/getting_started_vagrant.md
|
||||
git diff 0.9.10 HEAD -- docs/getting_started_vagrant.md | cat
|
||||
-->
|
||||
|
||||
このプロジェクトは、プライマリオペレーティングシステムに大きな変更を加えることなくキーボードの新しいファームウェアを非常に簡単に構築することができる `Vagrantfile` を含みます。これは、あなたがプロジェクトをクローンしビルドを実行した時に、ビルドのために Vagrantfile を使っている他のユーザと全く同じ環境を持つことも保証します。これにより、人々はあなたが遭遇した問題の解決をより簡単に行えるようになります。
|
||||
|
@ -97,7 +97,7 @@ In most situations you will want to answer Yes to all of the prompts.
|
||||
It's possible, that you will get an error saying something like: `bash: qmk: command not found`.
|
||||
This is due to a [bug](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839155) Debian introduced with their Bash 4.4 release, which removed `$HOME/.local/bin` from the PATH. This bug was later fixed on Debian and Ubuntu.
|
||||
Sadly, Ubuntu reitroduced this bug and is [yet to fix it](https://bugs.launchpad.net/ubuntu/+source/bash/+bug/1588562).
|
||||
Luckily, the fix is easy. Run this as your user: `echo "PATH=$HOME/.local/bin:$PATH" >> $HOME/.bashrc && source $HOME/.bashrc`
|
||||
Luckily, the fix is easy. Run this as your user: `echo 'PATH="$HOME/.local/bin:$PATH"' >> $HOME/.bashrc && source $HOME/.bashrc`
|
||||
|
||||
?>**Note on FreeBSD**:
|
||||
It is suggested to run `qmk setup` as a non-`root` user to start with, but this will likely identify packages that need to be installed to your
|
||||
|
@ -15,7 +15,7 @@ You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
#define ONESHOT_TIMEOUT 5000 /* Time (in ms) before the one shot key is released */
|
||||
```
|
||||
|
||||
* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](#mod-tap), not the `KC_*` codes.
|
||||
* `OSM(mod)` - Momentarily hold down *mod*. You must use the `MOD_*` keycodes as shown in [Mod Tap](mod_tap.md), not the `KC_*` codes.
|
||||
* `OSL(layer)` - momentary switch to *layer*.
|
||||
|
||||
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
|
||||
|
58
docs/platformdev_selecting_arm_mcu.md
Normal file
58
docs/platformdev_selecting_arm_mcu.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Choosing an Arm MCU :id=choose-arm-mcu
|
||||
|
||||
This page outlines the selection criteria to ensure compatibility with Arm/ChibiOS.
|
||||
|
||||
QMK uses the Hardware Abstraction Layer of ChibiOS in order to run on Arm devices. ChibiOS in general is best supported on STM32 devices, both in the perspective of base MCU support, as well as on-MCU peripheral support. As an extension to the core ChibiOS MCU support, QMK also utilises ChibiOS-Contrib (which includes the Kinetis MCU support layer, as an example), but it does not provide as great a level of peripheral support or general testing for supported devices.
|
||||
|
||||
Adding support for new MCU families must go through ChibiOS or ChibiOS-Contrib -- QMK does not have the bandwidth, resources, nor the inclination to maintain long-term MCU support for your board of choice.
|
||||
|
||||
To be clear: this also includes commercial boards -- unless agreed upon by all parties, QMK will not take over maintenance of a bespoke MCU support package. Even if MCU support is upstreamed into ChibiOS/ChibiOS-Contrib, QMK reserves the right to deprecate and/or remove keyboards utilising support packages that aren't kept up to date with upstream ChibiOS itself.
|
||||
|
||||
## Selecting an already-supported MCU :id=selecting-already-supported-mcu
|
||||
|
||||
### STM32 families
|
||||
|
||||
As outlined earlier, STM32 is the preferred option to ensure greatest compatibility with the subsystems already implemented in QMK. Not all subsystems are compatible yet, but for the most widely-used support is already present.
|
||||
|
||||
The simplest solution to determine if an STM32 MCU is compatible is to navigate to the list of supported STM32 ports in QMK's [ChibiOS fork](https://github.com/qmk/ChibiOS/tree/master/os/hal/ports/STM32). Inside this directory, each of the supported STM32 families will be listed, and inside each family a file called `stm32_registry.h` will be present. Scanning through these files will show `#define`s such as the following, which can be used to determine if ChibiOS supports a particular MCU:
|
||||
|
||||
```c
|
||||
#if defined(STM32F303xC) || defined(__DOXYGEN__)
|
||||
```
|
||||
|
||||
The example shows that STM32F303xC devices are supported by ChibiOS.
|
||||
|
||||
The next step is to ensure that USB is supported on those devices by ChibiOS -- you can confirm this by checking inside the same section guarded by the `#define` above, specifically for the following to be `TRUE`:
|
||||
|
||||
```c
|
||||
#define STM32_HAS_USB TRUE
|
||||
```
|
||||
|
||||
or one of the following being `TRUE`:
|
||||
|
||||
```c
|
||||
#define STM32_HAS_OTG1 TRUE
|
||||
#define STM32_HAS_OTG2 TRUE
|
||||
```
|
||||
|
||||
For the most part, this is the bare minimum to be able to have a high confidence that QMK will be able to run on your MCU. After that, it's all up to configuration.
|
||||
|
||||
### Non-STM32 families
|
||||
|
||||
ChibiOS does have support for a handful of non-STM32 devices, and the list can be found in QMK's [ChibiOS fork](https://github.com/qmk/ChibiOS/tree/master/os/hal/ports) and [ChibiOS-Contrib fork](https://github.com/qmk/ChibiOS-Contrib/tree/master/os/hal/ports). Non-STM32 support is likely out of date, and only supports ancient MCUs -- whilst it might be possible to use these, it's not recommended.
|
||||
|
||||
Do note that there are sometimes licensing restrictions with respect to redistribution. As an example, binaries built for nRF5 are not able to be redistributed via QMK Configurator, due to the licensing of their board support package.
|
||||
|
||||
## Adding support for a new STM32 MCU (for an existing family) :id=add-new-stm32-mcu
|
||||
|
||||
Usually, one can "masquerade" as an existing MCU of the same family, especially if the only difference is RAM or Flash size. As an example, some MCUs within the same family are virtually identical, with the exception of adding a cryptographic peripheral -- STM32L072 vs. STM32L082 for instance. Given the unlikely use of the cryptographic peripheral, L082 chips can actually run as if they're an L072, and can be targeted accordingly.
|
||||
|
||||
Adding proper support for new MCUs within an existing STM32 family should ideally be upstreamed to ChibiOS. In general, this will require modifications of the `stm32_registry.h` file, providing correct responses for the same `#define`s provided for the other MCUs in that family.
|
||||
|
||||
## Adding support for a new STM32 Family :id=add-new-stm32-family
|
||||
|
||||
If this is a requirement, this needs to go through upstream ChibiOS before QMK would consider accepting boards targeting the new family. More information for porting should be sought by approaching ChibiOS directly, rather than through QMK.
|
||||
|
||||
## Adding support for a new MCU Family :id=add-new-mcu-family
|
||||
|
||||
As stated earlier, in order for a new MCU family to be supported by QMK, it needs to be upstreamed into ChibiOS-Contrib before QMK will consider accepting boards using it. The same principle applies for development -- you're best approaching the ChibiOS-Contrib maintainers to get a bit more of an idea on what's involved with upstreaming your contribution.
|
@ -19,6 +19,15 @@ These LEDs are called "addressable" because instead of using a wire per color, e
|
||||
|
||||
## Driver configuration
|
||||
|
||||
### All drivers
|
||||
|
||||
Different versions of the addressable LEDs have differing requirements for the T<sub>RST</sub> period between frames.
|
||||
The default setting is 280 µs, which should work for most cases, but this can be overridden in your config.h. e.g.:
|
||||
|
||||
```c
|
||||
#define WS2812_TRST_US 80
|
||||
```
|
||||
|
||||
### Bitbang
|
||||
Default driver, the absence of configuration assumes this driver. To configure it, add this to your rules.mk:
|
||||
|
||||
@ -99,3 +108,14 @@ While not an exhaustive list, the following table provides the scenarios that ha
|
||||
| f401/f411 | :heavy_check_mark: |
|
||||
|
||||
*Other supported ChibiOS boards and/or pins may function, it will be highly chip and configuration dependent.*
|
||||
|
||||
### Push Pull and Open Drain Configuration
|
||||
The default configuration is a push pull on the defined pin.
|
||||
This can be configured for bitbang, PWM and SPI.
|
||||
|
||||
Note: This only applies to STM32 boards.
|
||||
|
||||
To configure the `RGB_DI_PIN` to open drain configuration add this to your config.h file:
|
||||
```c
|
||||
#define WS2812_EXTERNAL_PULLUP
|
||||
```
|
||||
|
@ -36,25 +36,15 @@
|
||||
|
||||
static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi);
|
||||
|
||||
// Setleds for standard RGB
|
||||
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) {
|
||||
// wrap up usage of RGB_DI_PIN
|
||||
ws2812_setleds_pin(ledarray, number_of_leds, RGB_DI_PIN);
|
||||
}
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) {
|
||||
DDRx_ADDRESS(RGB_DI_PIN) |= pinmask(RGB_DI_PIN);
|
||||
|
||||
void ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pin) {
|
||||
DDRx_ADDRESS(RGB_DI_PIN) |= pinmask(pin);
|
||||
|
||||
uint8_t masklo = ~(pinmask(pin)) & PORTx_ADDRESS(pin);
|
||||
uint8_t maskhi = pinmask(pin) | PORTx_ADDRESS(pin);
|
||||
uint8_t masklo = ~(pinmask(RGB_DI_PIN)) & PORTx_ADDRESS(RGB_DI_PIN);
|
||||
uint8_t maskhi = pinmask(RGB_DI_PIN) | PORTx_ADDRESS(RGB_DI_PIN);
|
||||
|
||||
ws2812_sendarray_mask((uint8_t *)ledarray, number_of_leds * sizeof(LED_TYPE), masklo, maskhi);
|
||||
|
||||
#ifdef RGBW
|
||||
_delay_us(80);
|
||||
#else
|
||||
_delay_us(50);
|
||||
#endif
|
||||
_delay_us(WS2812_TRST_US);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -14,6 +14,14 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Push Pull or Open Drain Configuration
|
||||
// Default Push Pull
|
||||
#ifndef WS2812_EXTERNAL_PULLUP
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_PUSHPULL
|
||||
#else
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_OUTPUT_OPENDRAIN
|
||||
#endif
|
||||
|
||||
#define NUMBER_NOPS 6
|
||||
#define CYCLES_PER_SEC (STM32_SYSCLK / NUMBER_NOPS * NOP_FUDGE)
|
||||
#define NS_PER_SEC (1000000000L) // Note that this has to be SIGNED since we want to be able to check for negative values of derivatives
|
||||
@ -43,7 +51,7 @@
|
||||
|
||||
// The reset gap can be 6000 ns, but depending on the LED strip it may have to be increased
|
||||
// to values like 600000 ns. If it is too small, the pixels will show nothing most of the time.
|
||||
#define RES 10000 // Width of the low gap between bits to cause a frame to latch
|
||||
#define RES (1000 * WS2812_TRST_US) // Width of the low gap between bits to cause a frame to latch
|
||||
|
||||
void sendByte(uint8_t byte) {
|
||||
// WS2812 protocol wants most significant bits first
|
||||
@ -66,7 +74,7 @@ void sendByte(uint8_t byte) {
|
||||
}
|
||||
}
|
||||
|
||||
void ws2812_init(void) { setPinOutput(RGB_DI_PIN); }
|
||||
void ws2812_init(void) { palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); }
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
|
||||
|
@ -1,16 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "quantum/color.h"
|
||||
|
||||
/* User Interface
|
||||
*
|
||||
* Input:
|
||||
* ledarray: An array of GRB data describing the LED colors
|
||||
* number_of_leds: The number of LEDs to write
|
||||
*
|
||||
* The functions will perform the following actions:
|
||||
* - Set the data-out pin as output
|
||||
* - Send out the LED data
|
||||
* - Wait 50us to reset the LEDs
|
||||
*/
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
|
@ -24,6 +24,22 @@
|
||||
# define WS2812_DMA_CHANNEL 2 // DMA Channel for TIMx_UP
|
||||
#endif
|
||||
|
||||
// Push Pull or Open Drain Configuration
|
||||
// Default Push Pull
|
||||
#ifndef WS2812_EXTERNAL_PULLUP
|
||||
# if defined(USE_GPIOV1)
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_ALTERNATE(WS2812_PWM_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING
|
||||
# endif
|
||||
#else
|
||||
# if defined(USE_GPIOV1)
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
|
||||
# else
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_ALTERNATE(WS2812_PWM_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef WS2812_PWM_TARGET_PERIOD
|
||||
//# define WS2812_PWM_TARGET_PERIOD 800000 // Original code is 800k...?
|
||||
# define WS2812_PWM_TARGET_PERIOD 80000 // TODO: work out why 10x less on f303/f4x1
|
||||
@ -37,11 +53,10 @@
|
||||
/**
|
||||
* @brief Number of bit-periods to hold the data line low at the end of a frame
|
||||
*
|
||||
* The reset period for each frame must be at least 50 uS; so we add in 50 bit-times
|
||||
* of zeroes at the end. (50 bits)*(1.25 uS/bit) = 62.5 uS, which gives us some
|
||||
* slack in the timing requirements
|
||||
* The reset period for each frame is defined in WS2812_TRST_US.
|
||||
* Calculate the number of zeroes to add at the end assuming 1.25 uS/bit:
|
||||
*/
|
||||
#define WS2812_RESET_BIT_N (50)
|
||||
#define WS2812_RESET_BIT_N (1000 * WS2812_TRST_US / 1250)
|
||||
#define WS2812_COLOR_BIT_N (RGBLED_NUM * 24) /**< Number of data bits */
|
||||
#define WS2812_BIT_N (WS2812_COLOR_BIT_N + WS2812_RESET_BIT_N) /**< Total number of bits in a frame */
|
||||
|
||||
@ -142,11 +157,7 @@ void ws2812_init(void) {
|
||||
for (i = 0; i < WS2812_COLOR_BIT_N; i++) ws2812_frame_buffer[i] = WS2812_DUTYCYCLE_0; // All color bits are zero duty cycle
|
||||
for (i = 0; i < WS2812_RESET_BIT_N; i++) ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero
|
||||
|
||||
#if defined(USE_GPIOV1)
|
||||
palSetLineMode(RGB_DI_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
#else
|
||||
palSetLineMode(RGB_DI_PIN, PAL_MODE_ALTERNATE(WS2812_PWM_PAL_MODE) | PAL_STM32_OSPEED_HIGHEST | PAL_STM32_PUPDR_FLOATING);
|
||||
#endif
|
||||
palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE);
|
||||
|
||||
// PWM Configuration
|
||||
//#pragma GCC diagnostic ignored "-Woverride-init" // Turn off override-init warning for this struct. We use the overriding ability to set a "default" channel config
|
||||
|
@ -16,11 +16,27 @@
|
||||
# define WS2812_SPI_MOSI_PAL_MODE 5
|
||||
#endif
|
||||
|
||||
// Push Pull or Open Drain Configuration
|
||||
// Default Push Pull
|
||||
#ifndef WS2812_EXTERNAL_PULLUP
|
||||
# if defined(USE_GPIOV1)
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_STM32_ALTERNATE_PUSHPULL
|
||||
# else
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_ALTERNATE(WS2812_SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL
|
||||
# endif
|
||||
#else
|
||||
# if defined(USE_GPIOV1)
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_STM32_ALTERNATE_OPENDRAIN
|
||||
# else
|
||||
# define WS2812_OUTPUT_MODE PAL_MODE_ALTERNATE(WS2812_SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_OPENDRAIN
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define BYTES_FOR_LED_BYTE 4
|
||||
#define NB_COLORS 3
|
||||
#define BYTES_FOR_LED (BYTES_FOR_LED_BYTE * NB_COLORS)
|
||||
#define DATA_SIZE (BYTES_FOR_LED * RGBLED_NUM)
|
||||
#define RESET_SIZE 200
|
||||
#define RESET_SIZE (1000 * WS2812_TRST_US / (2 * 1250))
|
||||
#define PREAMBLE_SIZE 4
|
||||
|
||||
static uint8_t txbuf[PREAMBLE_SIZE + DATA_SIZE + RESET_SIZE] = {0};
|
||||
@ -52,11 +68,7 @@ static void set_led_color_rgb(LED_TYPE color, int pos) {
|
||||
}
|
||||
|
||||
void ws2812_init(void) {
|
||||
#if defined(USE_GPIOV1)
|
||||
palSetLineMode(RGB_DI_PIN, PAL_MODE_STM32_ALTERNATE_PUSHPULL);
|
||||
#else
|
||||
palSetLineMode(RGB_DI_PIN, PAL_MODE_ALTERNATE(WS2812_SPI_MOSI_PAL_MODE) | PAL_STM32_OTYPE_PUSHPULL);
|
||||
#endif
|
||||
palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE);
|
||||
|
||||
// TODO: more dynamic baudrate
|
||||
static const SPIConfig spicfg = {
|
||||
|
289
drivers/issi/is31fl3741.c
Normal file
289
drivers/issi/is31fl3741.c
Normal file
@ -0,0 +1,289 @@
|
||||
/* Copyright 2017 Jason Williams
|
||||
* Copyright 2018 Jack Humbert
|
||||
* Copyright 2018 Yiancar
|
||||
* Copyright 2020 MelGeek
|
||||
*
|
||||
* 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 "wait.h"
|
||||
|
||||
#include "is31fl3741.h"
|
||||
#include <string.h>
|
||||
#include "i2c_master.h"
|
||||
#include "progmem.h"
|
||||
|
||||
|
||||
// This is a 7-bit address, that gets left-shifted and bit 0
|
||||
// set to 0 for write, 1 for read (as per I2C protocol)
|
||||
// The address will vary depending on your wiring:
|
||||
// 00 <-> GND
|
||||
// 01 <-> SCL
|
||||
// 10 <-> SDA
|
||||
// 11 <-> VCC
|
||||
// ADDR1 represents A1:A0 of the 7-bit address.
|
||||
// ADDR2 represents A3:A2 of the 7-bit address.
|
||||
// The result is: 0b101(ADDR2)(ADDR1)
|
||||
#define ISSI_ADDR_DEFAULT 0x60
|
||||
|
||||
#define ISSI_COMMANDREGISTER 0xFD
|
||||
#define ISSI_COMMANDREGISTER_WRITELOCK 0xFE
|
||||
#define ISSI_INTERRUPTMASKREGISTER 0xF0
|
||||
#define ISSI_INTERRUPTSTATUSREGISTER 0xF1
|
||||
#define ISSI_IDREGISTER 0xFC
|
||||
|
||||
#define ISSI_PAGE_PWM0 0x00 // PG0
|
||||
#define ISSI_PAGE_PWM1 0x01 // PG1
|
||||
#define ISSI_PAGE_SCALING_0 0x02 // PG2
|
||||
#define ISSI_PAGE_SCALING_1 0x03 // PG3
|
||||
#define ISSI_PAGE_FUNCTION 0x04 // PG4
|
||||
|
||||
#define ISSI_REG_CONFIGURATION 0x00 // PG4
|
||||
#define ISSI_REG_GLOBALCURRENT 0x01 // PG4
|
||||
#define ISSI_REG_PULLDOWNUP 0x02 // PG4
|
||||
#define ISSI_REG_RESET 0x3F // PG4
|
||||
|
||||
#ifndef ISSI_TIMEOUT
|
||||
# define ISSI_TIMEOUT 100
|
||||
#endif
|
||||
|
||||
#ifndef ISSI_PERSISTENCE
|
||||
# define ISSI_PERSISTENCE 0
|
||||
#endif
|
||||
|
||||
#define ISSI_MAX_LEDS 351
|
||||
|
||||
// Transfer buffer for TWITransmitData()
|
||||
uint8_t g_twi_transfer_buffer[20] = {0xFF};
|
||||
|
||||
// These buffers match the IS31FL3741 and IS31FL3741A PWM registers.
|
||||
// The scaling buffers match the PG2 and PG3 LED On/Off registers.
|
||||
// Storing them like this is optimal for I2C transfers to the registers.
|
||||
// We could optimize this and take out the unused registers from these
|
||||
// buffers and the transfers in IS31FL3741_write_pwm_buffer() but it's
|
||||
// probably not worth the extra complexity.
|
||||
uint8_t g_pwm_buffer[DRIVER_COUNT][ISSI_MAX_LEDS];
|
||||
bool g_pwm_buffer_update_required = false;
|
||||
bool g_scaling_registers_update_required[DRIVER_COUNT] = {false};
|
||||
|
||||
uint8_t g_scaling_registers[DRIVER_COUNT][ISSI_MAX_LEDS];
|
||||
|
||||
uint32_t IS31FL3741_get_cw_sw_position(uint8_t cs, uint8_t sw) {
|
||||
uint32_t pos = 0;
|
||||
|
||||
if (cs < 31) {
|
||||
if (sw < 7) {
|
||||
pos = (sw - 1) * 30 + (cs - 1);
|
||||
|
||||
} else {
|
||||
pos = 0xB4 + (sw - 7) * 30 + (cs - 1);
|
||||
}
|
||||
} else {
|
||||
pos = 0xB4 + 0x5A + (sw - 1) * 9 + (cs - 31);
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data) {
|
||||
g_twi_transfer_buffer[0] = reg;
|
||||
g_twi_transfer_buffer[1] = data;
|
||||
|
||||
#if ISSI_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT) == 0) break;
|
||||
}
|
||||
#else
|
||||
i2c_transmit(addr << 1, g_twi_transfer_buffer, 2, ISSI_TIMEOUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer) {
|
||||
// unlock the command register and select PG2
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM0);
|
||||
|
||||
for (int i = 0; i < 342; i += 18) {
|
||||
g_twi_transfer_buffer[0] = i % 180;
|
||||
|
||||
if (i == 180) {
|
||||
// unlock the command register and select PG2
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_PWM1);
|
||||
}
|
||||
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + i, 18);
|
||||
|
||||
#if ISSI_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 19, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// transfer the left cause the total number is 351
|
||||
g_twi_transfer_buffer[0] = 162;
|
||||
memcpy(g_twi_transfer_buffer + 1, pwm_buffer + 342, 9);
|
||||
|
||||
#if ISSI_PERSISTENCE > 0
|
||||
for (uint8_t i = 0; i < ISSI_PERSISTENCE; i++) {
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (i2c_transmit(addr << 1, g_twi_transfer_buffer, 10, ISSI_TIMEOUT) != 0) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void IS31FL3741_init(uint8_t addr) {
|
||||
// In order to avoid the LEDs being driven with garbage data
|
||||
// in the LED driver's PWM registers, shutdown is enabled last.
|
||||
// Set up the mode and other settings, clear the PWM registers,
|
||||
// then disable software shutdown.
|
||||
// Unlock the command register.
|
||||
|
||||
// Unlock the command register.
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||
|
||||
// Select PG4
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_FUNCTION);
|
||||
|
||||
// Set to Normal operation
|
||||
IS31FL3741_write_register(addr, ISSI_REG_CONFIGURATION, 0x01);
|
||||
|
||||
// Set Golbal Current Control Register
|
||||
IS31FL3741_write_register(addr, ISSI_REG_GLOBALCURRENT, 0xFF);
|
||||
// Set Pull up & Down for SWx CSy
|
||||
IS31FL3741_write_register(addr, ISSI_REG_PULLDOWNUP, 0x77);
|
||||
|
||||
// IS31FL3741_update_led_scaling_registers(addr, 0xFF, 0xFF, 0xFF);
|
||||
|
||||
// Wait 10ms to ensure the device has woken up.
|
||||
wait_ms(10);
|
||||
}
|
||||
|
||||
void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
if (index >= 0 && index < DRIVER_LED_TOTAL) {
|
||||
is31_led led = g_is31_leds[index];
|
||||
uint32_t rp = 0, gp = 0, bp = 0;
|
||||
|
||||
rp = IS31FL3741_get_cw_sw_position(led.rcs, led.rsw);
|
||||
gp = IS31FL3741_get_cw_sw_position(led.gcs, led.gsw);
|
||||
bp = IS31FL3741_get_cw_sw_position(led.bcs, led.bsw);
|
||||
|
||||
g_pwm_buffer[led.driver][rp] = red;
|
||||
g_pwm_buffer[led.driver][gp] = green;
|
||||
g_pwm_buffer[led.driver][bp] = blue;
|
||||
g_pwm_buffer_update_required = true;
|
||||
}
|
||||
}
|
||||
|
||||
void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
|
||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
||||
IS31FL3741_set_color(i, red, green, blue);
|
||||
}
|
||||
}
|
||||
|
||||
void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue) {
|
||||
is31_led led = g_is31_leds[index];
|
||||
|
||||
uint32_t scaling_register_r = IS31FL3741_get_cw_sw_position(led.rcs, led.rsw);
|
||||
uint32_t scaling_register_g = IS31FL3741_get_cw_sw_position(led.gcs, led.gsw);
|
||||
uint32_t scaling_register_b = IS31FL3741_get_cw_sw_position(led.bcs, led.bsw);
|
||||
|
||||
if (red) {
|
||||
g_scaling_registers[led.driver][scaling_register_r] = 0xFF;
|
||||
} else {
|
||||
g_scaling_registers[led.driver][scaling_register_r] = 0x00;
|
||||
}
|
||||
|
||||
if (green) {
|
||||
g_scaling_registers[led.driver][scaling_register_g] = 0xFF;
|
||||
} else {
|
||||
g_scaling_registers[led.driver][scaling_register_g] = 0x00;
|
||||
}
|
||||
|
||||
if (blue) {
|
||||
g_scaling_registers[led.driver][scaling_register_b] = 0xFF;
|
||||
} else {
|
||||
g_scaling_registers[led.driver][scaling_register_b] = 0x00;
|
||||
}
|
||||
|
||||
g_scaling_registers_update_required[led.driver] = true;
|
||||
}
|
||||
|
||||
void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2) {
|
||||
if (g_pwm_buffer_update_required) {
|
||||
IS31FL3741_write_pwm_buffer(addr1, g_pwm_buffer[0]);
|
||||
}
|
||||
|
||||
g_pwm_buffer_update_required = false;
|
||||
}
|
||||
|
||||
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
uint32_t rp = 0, gp = 0, bp = 0;
|
||||
|
||||
rp = IS31FL3741_get_cw_sw_position(pled->rcs, pled->rsw);
|
||||
gp = IS31FL3741_get_cw_sw_position(pled->gcs, pled->gsw);
|
||||
bp = IS31FL3741_get_cw_sw_position(pled->bcs, pled->bsw);
|
||||
|
||||
g_pwm_buffer[pled->driver][rp] = red;
|
||||
g_pwm_buffer[pled->driver][gp] = green;
|
||||
g_pwm_buffer[pled->driver][bp] = blue;
|
||||
|
||||
g_pwm_buffer_update_required = true;
|
||||
}
|
||||
|
||||
void IS31FL3741_update_led_control_registers(uint8_t addr, uint8_t index) {
|
||||
if (g_scaling_registers_update_required[index]) {
|
||||
// unlock the command register and select PG2
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_0);
|
||||
|
||||
for (int i = 0; i < 180; ++i) {
|
||||
IS31FL3741_write_register(addr, i, g_scaling_registers[0][i]);
|
||||
}
|
||||
|
||||
// unlock the command register and select PG3
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER_WRITELOCK, 0xC5);
|
||||
IS31FL3741_write_register(addr, ISSI_COMMANDREGISTER, ISSI_PAGE_SCALING_1);
|
||||
|
||||
for (int i = 0; i < 171; ++i) {
|
||||
IS31FL3741_write_register(addr, i, g_scaling_registers[0][180 + i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue) {
|
||||
uint32_t rp = 0, gp = 0, bp = 0;
|
||||
|
||||
rp = IS31FL3741_get_cw_sw_position(pled->rcs, pled->rsw);
|
||||
gp = IS31FL3741_get_cw_sw_position(pled->gcs, pled->gsw);
|
||||
bp = IS31FL3741_get_cw_sw_position(pled->bcs, pled->bsw);
|
||||
|
||||
g_scaling_registers[pled->driver][rp] = red;
|
||||
g_scaling_registers[pled->driver][gp] = green;
|
||||
g_scaling_registers[pled->driver][bp] = blue;
|
||||
}
|
55
drivers/issi/is31fl3741.h
Normal file
55
drivers/issi/is31fl3741.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* Copyright 2017 Jason Williams
|
||||
* Copyright 2018 Jack Humbert
|
||||
* Copyright 2018 Yiancar
|
||||
* Copyright 2020 MelGeek
|
||||
*
|
||||
* 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 <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct is31_led {
|
||||
uint8_t driver : 2;
|
||||
uint8_t rcs;
|
||||
uint8_t rsw;
|
||||
uint8_t gcs;
|
||||
uint8_t gsw;
|
||||
uint8_t bcs;
|
||||
uint8_t bsw;
|
||||
} __attribute__((packed)) is31_led;
|
||||
|
||||
extern const is31_led g_is31_leds[DRIVER_LED_TOTAL];
|
||||
extern const is31_led g_is31_indicator_leds[DRIVER_INDICATOR_LED_TOTAL];
|
||||
|
||||
void IS31FL3741_init(uint8_t addr);
|
||||
void IS31FL3741_write_register(uint8_t addr, uint8_t reg, uint8_t data);
|
||||
bool IS31FL3741_write_pwm_buffer(uint8_t addr, uint8_t *pwm_buffer);
|
||||
|
||||
void IS31FL3741_set_color(int index, uint8_t red, uint8_t green, uint8_t blue);
|
||||
void IS31FL3741_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
void IS31FL3741_set_led_control_register(uint8_t index, bool red, bool green, bool blue);
|
||||
|
||||
// This should not be called from an interrupt
|
||||
// (eg. from a timer interrupt).
|
||||
// Call this while idle (in between matrix scans).
|
||||
// If the buffer is dirty, it will update the driver with the buffer.
|
||||
void IS31FL3741_update_pwm_buffers(uint8_t addr1, uint8_t addr2);
|
||||
void IS31FL3741_update_led_control_registers(uint8_t addr1, uint8_t addr2);
|
||||
void IS31FL3741_set_scaling_registers(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
|
||||
|
||||
void IS31FL3741_set_pwm_buffer(const is31_led *pled, uint8_t red, uint8_t green, uint8_t blue);
|
@ -1,11 +1,4 @@
|
||||
/*
|
||||
* light weight WS2812 lib include
|
||||
*
|
||||
* Version 2.3 - Nev 29th 2015
|
||||
* Author: Tim (cpldcpu@gmail.com)
|
||||
*
|
||||
* Please do not change this file! All configuration is handled in "ws2812_config.h"
|
||||
*
|
||||
* 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
|
||||
@ -24,12 +17,20 @@
|
||||
|
||||
#include "quantum/color.h"
|
||||
|
||||
/*
|
||||
* Older WS2812s can handle a reset time (TRST) of 50us, but recent
|
||||
* component revisions require a minimum of 280us.
|
||||
*/
|
||||
|
||||
#if !defined(WS2812_TRST_US)
|
||||
#define WS2812_TRST_US 280
|
||||
#endif
|
||||
|
||||
/* User Interface
|
||||
*
|
||||
* Input:
|
||||
* ledarray: An array of GRB data describing the LED colors
|
||||
* number_of_leds: The number of LEDs to write
|
||||
* pin (optional): A pin_t definition for the line to drive
|
||||
*
|
||||
* The functions will perform the following actions:
|
||||
* - Set the data-out pin as output
|
||||
@ -37,4 +38,3 @@
|
||||
* - Wait 50us to reset the LEDs
|
||||
*/
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
|
||||
void ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pin);
|
@ -11,16 +11,6 @@ MCU = atmega32u4
|
||||
# ATmega328P USBasp
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# If you don't know the bootloader type, then you can specify the
|
||||
# Boot Section Size in *bytes* by uncommenting out the OPT_DEFS line
|
||||
# Otherwise, delete this section
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
# OPT_DEFS += -DBOOTLOADER_SIZE=4096
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
@ -39,7 +29,5 @@ MIDI_ENABLE = no # MIDI support
|
||||
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
|
||||
ENCODER_ENABLE = yes
|
||||
RGBLIGHT_ENABLE = yes
|
||||
# EXTRAFLAGS += -flto
|
||||
|
@ -5,7 +5,7 @@
|
||||
"width": 15.5,
|
||||
"height": 4.25,
|
||||
"layouts": {
|
||||
"LAYOUT_all": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"label":"Tab", "x":0, "y":0},
|
||||
{"label":"Q", "x":1, "y":0},
|
||||
@ -33,7 +33,7 @@
|
||||
{"label":"J", "x":7.25, "y":1},
|
||||
{"label":"K", "x":8.25, "y":1},
|
||||
{"label":"L", "x":9.25, "y":1},
|
||||
{"label":"Enter", "x":10.25, "y":1.75},
|
||||
{"label":"Enter", "x":10.25, "y":1, "w":1.75},
|
||||
{"label":"4", "x":12.5, "y":1},
|
||||
{"label":"5", "x":13.5, "y":1},
|
||||
{"label":"6", "x":14.5, "y":1},
|
||||
@ -47,7 +47,7 @@
|
||||
{"label":"N", "x":6.75, "y":2},
|
||||
{"label":"M", "x":7.75, "y":2},
|
||||
{"label":"<", "x":8.75, "y":2},
|
||||
{"label":"Fn1", "x":9.75, "y":2},
|
||||
{"label":"Fn1", "x":9.75, "y":2, "w":1.25},
|
||||
{"label":"Up", "x":11.25, "y":2.25},
|
||||
{"label":"1", "x":12.5, "y":2},
|
||||
{"label":"2", "x":13.5, "y":2},
|
||||
|
@ -14,13 +14,13 @@ BOOTLOADER = atmel-dfu
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE ?= yes # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE ?= no # Mouse keys
|
||||
EXTRAKEY_ENABLE ?= yes # Audio control and System control
|
||||
CONSOLE_ENABLE ?= no # Console for debug
|
||||
COMMAND_ENABLE ?= no # Commands for debug and configuration
|
||||
SLEEP_LED_ENABLE ?= yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE ?= no
|
||||
RGBLIGHT_ENABLE ?= yes
|
||||
BOOTMAGIC_ENABLE = yes # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
AUDIO_ENABLE = no
|
||||
RGBLIGHT_ENABLE = yes
|
||||
|
@ -14,15 +14,15 @@ BOOTLOADER = atmel-dfu
|
||||
# Build Options
|
||||
# comment out to disable the options.
|
||||
#
|
||||
BOOTMAGIC_ENABLE ?= no # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE ?= no # Mouse keys
|
||||
EXTRAKEY_ENABLE ?= yes # Audio control and System control
|
||||
CONSOLE_ENABLE ?= yes # Console for debug
|
||||
COMMAND_ENABLE ?= yes # Commands for debug and configuration
|
||||
NKRO_ENABLE ?= yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RGBLIGHT_ENABLE ?= yes # Enable keyboard underlight functionality
|
||||
BACKLIGHT_ENABLE ?= yes # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE ?= no # MIDI controls
|
||||
AUDIO_ENABLE ?= no
|
||||
UNICODE_ENABLE ?= no # Unicode
|
||||
BLUETOOTH_ENABLE ?= no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
|
||||
MOUSEKEY_ENABLE = no # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = yes # Console for debug
|
||||
COMMAND_ENABLE = yes # Commands for debug and configuration
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RGBLIGHT_ENABLE = yes # Enable keyboard underlight functionality
|
||||
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality
|
||||
MIDI_ENABLE = no # MIDI controls
|
||||
AUDIO_ENABLE = no
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
|
@ -1,46 +1,10 @@
|
||||
/* Copyright 2020 yfuku
|
||||
*
|
||||
* 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
|
||||
|
||||
#ifdef KEYBOARD_bat43_rev1
|
||||
#include "rev1.h"
|
||||
#endif
|
||||
#ifdef KEYBOARD_bat43_rev2
|
||||
#include "rev2.h"
|
||||
#endif
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
/* This is 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( \
|
||||
k00, k01, k02, k03, k04, k05, k40, k41, k42, k43, k44, k45, \
|
||||
k10, k11, k12, k13, k14, k15, k30, k50, k51, k52, k53, k54, k55, \
|
||||
k20, k21, k22, k23, k24, k25, k60, k61, k62, k63, k64, k65, \
|
||||
k33, k34, k35, k70, k71, k72, \
|
||||
k74, k75, k73, k31, k32 \
|
||||
) { \
|
||||
{ k00, k01, k02, k03, k04, k05 }, \
|
||||
{ k10, k11, k12, k13, k14, k15 }, \
|
||||
{ k20, k21, k22, k23, k24, k25 }, \
|
||||
{ k30, k31, k32, k33, k34, k35 }, \
|
||||
{ k40, k41, k42, k43, k44, k45 }, \
|
||||
{ k50, k51, k52, k53, k54, k55 }, \
|
||||
{ k60, k61, k62, k63, k64, k65 }, \
|
||||
{ k70, k71, k72, k73, k74, k75 }, \
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user