Compare commits
76 Commits
Author | SHA1 | Date | |
---|---|---|---|
eb309be6f0 | |||
4139de3cc9 | |||
7514f5124a | |||
31e4583f4a | |||
17a089d21b | |||
db2f187493 | |||
d2e1cc4d48 | |||
0f7d294ac3 | |||
c66a4a9831 | |||
e57af8db0d | |||
0968cf8b00 | |||
0f9982c53e | |||
6d5812a86c | |||
1249594cf0 | |||
e04c5edaae | |||
66fe3001e4 | |||
7149557bb4 | |||
2abc0e17e7 | |||
197a401be6 | |||
4a208b8951 | |||
1e90f5c71c | |||
0d80c7bd59 | |||
4d06d2835c | |||
92c62352cf | |||
1f0404e3c5 | |||
ee88feb759 | |||
eb5e513d26 | |||
a539bd63fe | |||
1b7a003d84 | |||
0804f0a5dd | |||
7342c335d2 | |||
50855593ff | |||
9a0245b778 | |||
43d2a0e167 | |||
212aeee202 | |||
5fb95c5f94 | |||
05d6e6ca78 | |||
992656e753 | |||
ee86be9dca | |||
98e5555705 | |||
d3abebb601 | |||
645c5fabf2 | |||
7f7b6b08e8 | |||
72d7661b30 | |||
d0d106cef7 | |||
d603e94f68 | |||
9ff61601e3 | |||
09370a95db | |||
e9ffc53476 | |||
480a391929 | |||
154336ee27 | |||
d4ccb2e0e6 | |||
5e65af3a76 | |||
6efcfaa264 | |||
e4a0f841e1 | |||
4867a9b1e6 | |||
9a9eaa8100 | |||
339e29d5af | |||
b568999769 | |||
fe50883c15 | |||
d13ada1162 | |||
6ff093efbe | |||
c3835262d8 | |||
1a40af74da | |||
9e6e01cabb | |||
a561443fca | |||
e0a0430c31 | |||
49c3a1cda5 | |||
ba264c69c2 | |||
8e500c3670 | |||
bf4611c7b7 | |||
f773056750 | |||
b70500806a | |||
9b6b54cdaa | |||
37db6012a7 | |||
6f176dfc7c |
@ -102,6 +102,57 @@ ifeq ($(strip $(UNICODE_COMMON)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_unicode_common.c
|
||||
endif
|
||||
|
||||
VALID_EEPROM_DRIVER_TYPES := vendor custom transient i2c
|
||||
EEPROM_DRIVER ?= vendor
|
||||
ifeq ($(filter $(EEPROM_DRIVER),$(VALID_EEPROM_DRIVER_TYPES)),)
|
||||
$(error EEPROM_DRIVER="$(EEPROM_DRIVER)" is not a valid EEPROM driver)
|
||||
else
|
||||
OPT_DEFS += -DEEPROM_ENABLE
|
||||
ifeq ($(strip $(EEPROM_DRIVER)), custom)
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_CUSTOM
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
SRC += eeprom_driver.c
|
||||
else ifeq ($(strip $(EEPROM_DRIVER)), i2c)
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_I2C
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
QUANTUM_LIB_SRC += i2c_master.c
|
||||
SRC += eeprom_driver.c eeprom_i2c.c
|
||||
else ifeq ($(strip $(EEPROM_DRIVER)), transient)
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_TRANSIENT
|
||||
COMMON_VPATH += $(DRIVER_PATH)/eeprom
|
||||
SRC += eeprom_driver.c eeprom_transient.c
|
||||
else ifeq ($(strip $(EEPROM_DRIVER)), vendor)
|
||||
OPT_DEFS += -DEEPROM_VENDOR
|
||||
ifeq ($(PLATFORM),AVR)
|
||||
# Automatically provided by avr-libc, nothing required
|
||||
else ifeq ($(PLATFORM),CHIBIOS)
|
||||
ifeq ($(MCU_SERIES), STM32F3xx)
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
|
||||
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
|
||||
OPT_DEFS += -DEEPROM_EMU_STM32F303xC
|
||||
OPT_DEFS += -DSTM32_EEPROM_ENABLE
|
||||
else ifeq ($(MCU_SERIES), STM32F1xx)
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
|
||||
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
|
||||
OPT_DEFS += -DEEPROM_EMU_STM32F103xB
|
||||
OPT_DEFS += -DSTM32_EEPROM_ENABLE
|
||||
else ifeq ($(MCU_SERIES)_$(MCU_LDSCRIPT), STM32F0xx_STM32F072xB)
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom_stm32.c
|
||||
SRC += $(PLATFORM_COMMON_DIR)/flash_stm32.c
|
||||
OPT_DEFS += -DEEPROM_EMU_STM32F072xB
|
||||
OPT_DEFS += -DSTM32_EEPROM_ENABLE
|
||||
else
|
||||
# This will effectively work the same as "transient" if not supported by the chip
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom_teensy.c
|
||||
endif
|
||||
else ifeq ($(PLATFORM),ARM_ATSAM)
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
|
||||
else ifeq ($(PLATFORM),TEST)
|
||||
SRC += $(PLATFORM_COMMON_DIR)/eeprom.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/rgblight_post_config.h
|
||||
OPT_DEFS += -DRGBLIGHT_ENABLE
|
||||
@ -124,7 +175,9 @@ ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
|
||||
ifeq ($(filter $(LED_MATRIX_ENABLE),$(VALID_MATRIX_TYPES)),)
|
||||
$(error LED_MATRIX_ENABLE="$(LED_MATRIX_ENABLE)" is not a valid matrix type)
|
||||
else
|
||||
OPT_DEFS += -DLED_MATRIX_ENABLE -DBACKLIGHT_ENABLE -DBACKLIGHT_CUSTOM_DRIVER
|
||||
BACKLIGHT_ENABLE = yes
|
||||
BACKLIGHT_DRIVER = custom
|
||||
OPT_DEFS += -DLED_MATRIX_ENABLE
|
||||
SRC += $(QUANTUM_DIR)/led_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/led_matrix_drivers.c
|
||||
endif
|
||||
@ -249,10 +302,6 @@ ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
|
||||
$(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
||||
CIE1931_CURVE := yes
|
||||
endif
|
||||
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/backlight
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight.c
|
||||
OPT_DEFS += -DBACKLIGHT_ENABLE
|
||||
@ -292,6 +341,10 @@ ifeq ($(strip $(WS2812_DRIVER_REQUIRED)), yes)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(VISUALIZER_ENABLE)), yes)
|
||||
CIE1931_CURVE := yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(CIE1931_CURVE)), yes)
|
||||
OPT_DEFS += -DUSE_CIE1931_CURVE
|
||||
LED_TABLES := yes
|
||||
@ -418,9 +471,17 @@ ifeq ($(strip $(SPLIT_KEYBOARD)), yes)
|
||||
QUANTUM_SRC += $(QUANTUM_DIR)/split_common/transport.c
|
||||
# Functions added via QUANTUM_LIB_SRC are only included in the final binary if they're called.
|
||||
# Unused functions are pruned away, which is why we can add multiple drivers here without bloat.
|
||||
QUANTUM_LIB_SRC += $(QUANTUM_DIR)/split_common/serial.c \
|
||||
i2c_master.c \
|
||||
i2c_slave.c
|
||||
ifeq ($(PLATFORM),AVR)
|
||||
QUANTUM_LIB_SRC += i2c_master.c \
|
||||
i2c_slave.c
|
||||
endif
|
||||
|
||||
SERIAL_DRIVER ?= bitbang
|
||||
ifeq ($(strip $(SERIAL_DRIVER)), bitbang)
|
||||
QUANTUM_LIB_SRC += serial.c
|
||||
else
|
||||
QUANTUM_LIB_SRC += serial_$(strip $(SERIAL_DRIVER)).c
|
||||
endif
|
||||
endif
|
||||
COMMON_VPATH += $(QUANTUM_PATH)/split_common
|
||||
endif
|
||||
|
@ -18,6 +18,7 @@
|
||||
* [Getting Help](getting_started_getting_help.md)
|
||||
|
||||
* [Breaking Changes](breaking_changes.md)
|
||||
* [My Pull Request Was Flagged](breaking_changes_instructions.md)
|
||||
* [2019 Aug 30](ChangeLog/20190830.md)
|
||||
|
||||
* [FAQ](faq.md)
|
||||
@ -104,6 +105,7 @@
|
||||
* [ADC Driver](adc_driver.md)
|
||||
* [I2C Driver](i2c_driver.md)
|
||||
* [WS2812 Driver](ws2812_driver.md)
|
||||
* [EEPROM Driver](eeprom_driver.md)
|
||||
* [GPIO Controls](internals_gpio_control.md)
|
||||
* [Custom Matrix](custom_matrix.md)
|
||||
* [Proton C Conversion](proton_c_conversion.md)
|
||||
|
42
docs/breaking_changes_instructions.md
Normal file
42
docs/breaking_changes_instructions.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Breaking Changes: My Pull Request Was Flagged
|
||||
|
||||
A QMK member may have replied to your pull request stating that your submission is a breaking change. In their judgment, the changes you have proposed have greater implications for either QMK, or its users.
|
||||
|
||||
Some things that may cause a pull request to be flagged are:
|
||||
|
||||
- **Edits to User Keymaps**
|
||||
A user may submit their keymap to QMK, then some time later open a pull request with further updates, only to find it can't be merged because it was edited in the `qmk/qmk_firmware` repository. As not all users are proficient at using Git or GitHub, the user may find themself unable to fix the issue on their own.
|
||||
- **Changes to Expected Behavior**
|
||||
Changes to QMK behavior may cause users to believe their hardware or QMK is broken if they flash new firmware that incorporates changes to existing QMK features, and find themselves without a means to restore the desired behavior.
|
||||
- **Changes Requiring User Action**
|
||||
Changes may also require action to be taken by users, such as updating a toolchain or taking some action in Git.
|
||||
- **Changes Necessitating Increased Scrutiny**
|
||||
On occasion, a submission may have implications for QMK as a project. This could be copyright/licensing issues, coding conventions, large feature overhauls, "high-risk" changes that need wider testing by our community, or something else entirely.
|
||||
- **Changes Requiring Communication to End Users**
|
||||
This includes warnings about future deprecations, outdated practices, and anything else that needs to be communicated but doesn't fit into one of the above categories.
|
||||
|
||||
## What Do I Do?
|
||||
|
||||
If it is determined that your submission is a breaking change, there are a few things you can do to smooth the process:
|
||||
|
||||
### Consider Splitting Up Your PR
|
||||
|
||||
If you are contributing core code, and the only reason it needs to go through breaking changes is that you are updating keymaps to match your change, consider whether you can submit your feature in a way that the old keymaps continue to work. Then submit a separate PR that goes through the breaking changes process to remove the old code.
|
||||
|
||||
### Contribute a ChangeLog Entry
|
||||
|
||||
We require submissions that go through the Breaking Change process to include a changelog entry. The entry should be a short summary of the changes your pull request makes – [each section here started as a changelog](ChangeLog/20190830.md "n.b. This should link to the 2019 Aug 30 Breaking Changes doc - @noroadsleft").
|
||||
|
||||
Your changelog should be located at `docs/ChangeLog/YYYYMMDD/PR####.md`, where `YYYYMMDD` is the date on which QMK's breaking change branch – usually named `future` – will be merged into the `master` branch, and `####` is the number of your pull request.
|
||||
|
||||
If your submission requires action on the part of users, your changelog should instruct users what action(s) must be taken, or link to a location that does so.
|
||||
|
||||
### Document Your Changes
|
||||
|
||||
Understanding the purpose for your submission, and possible implications or actions it will require can make the review process more straightforward. A changelog may suffice for this purpose, but more extensive changes may require a level of detail that is ill-suited for a changelog.
|
||||
|
||||
Commenting on your pull request and being responsive to questions, comments, and change requests is much appreciated.
|
||||
|
||||
### Ask for Help
|
||||
|
||||
Having your submission flagged may have caught you off guard. If you find yourself intimidated or overwhelmed, let us know. Comment on your pull request, or [reach out to the QMK team on Discord](https://discord.gg/Uq7gcHh).
|
18
docs/cli.md
18
docs/cli.md
@ -141,14 +141,28 @@ qmk docs [-p PORT]
|
||||
|
||||
## `qmk doctor`
|
||||
|
||||
This command examines your environment and alerts you to potential build or flash problems.
|
||||
This command examines your environment and alerts you to potential build or flash problems. It can fix many of them if you want it to.
|
||||
|
||||
**Usage**:
|
||||
|
||||
```
|
||||
qmk doctor
|
||||
qmk doctor [-y] [-n]
|
||||
```
|
||||
|
||||
**Examples**:
|
||||
|
||||
Check your environment for problems and prompt to fix them:
|
||||
|
||||
qmk doctor
|
||||
|
||||
Check your environment and automatically fix any problems found:
|
||||
|
||||
qmk doctor -y
|
||||
|
||||
Check your environment and report problems only:
|
||||
|
||||
qmk doctor -n
|
||||
|
||||
## `qmk json-keymap`
|
||||
|
||||
Creates a keymap.c from a QMK Configurator export.
|
||||
|
50
docs/eeprom_driver.md
Normal file
50
docs/eeprom_driver.md
Normal file
@ -0,0 +1,50 @@
|
||||
# EEPROM Driver Configuration
|
||||
|
||||
The EEPROM driver can be swapped out depending on the needs of the keyboard, or whether extra hardware is present.
|
||||
|
||||
Driver | Description
|
||||
--------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
`EEPROM_DRIVER = vendor` | Uses the on-chip driver provided by the chip manufacturer. For AVR, this is provided by avr-libc. This is supported on ARM for a subset of chips -- STM32F3xx, STM32F1xx, and STM32F072xB will be emulated by writing to flash. Other chips will generally act as "transient" below.
|
||||
`EEPROM_DRIVER = i2c` | Supports writing to I2C-based 24xx EEPROM chips. See the driver section below.
|
||||
`EEPROM_DRIVER = transient` | Fake EEPROM driver -- supports reading/writing to RAM, and will be discarded when power is lost.
|
||||
|
||||
## Vendor Driver Configuration
|
||||
|
||||
No configurable options are available.
|
||||
|
||||
## I2C Driver Configuration
|
||||
|
||||
Currently QMK supports 24xx-series chips over I2C. As such, requires a working i2c_master driver configuration. You can override the driver configuration via your config.h:
|
||||
|
||||
`config.h` override | Description | Default Value
|
||||
------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------
|
||||
`#define EXTERNAL_EEPROM_I2C_BASE_ADDRESS` | Base I2C address for the EEPROM -- shifted left by 1 as per i2c_master requirements | 0b10100000
|
||||
`#define EXTERNAL_EEPROM_I2C_ADDRESS(addr)` | Calculated I2C address for the EEPROM | `(EXTERNAL_EEPROM_I2C_BASE_ADDRESS)`
|
||||
`#define EXTERNAL_EEPROM_BYTE_COUNT` | Total size of the EEPROM in bytes | 8192
|
||||
`#define EXTERNAL_EEPROM_PAGE_SIZE` | Page size of the EEPROM in bytes, as specified in the datasheet | 32
|
||||
`#define EXTERNAL_EEPROM_ADDRESS_SIZE` | The number of bytes to transmit for the memory location within the EEPROM | 2
|
||||
`#define EXTERNAL_EEPROM_WRITE_TIME` | Write cycle time of the EEPROM, as specified in the datasheet | 5
|
||||
|
||||
Default values and extended descriptions can be found in `drivers/eeprom/eeprom_i2c.h`.
|
||||
|
||||
Alternatively, there are pre-defined hardware configurations for available chips/modules:
|
||||
|
||||
Module | Equivalent `#define` | Source
|
||||
-----------------|---------------------------------|------------------------------------------
|
||||
CAT24C512 EEPROM | `#define EEPROM_I2C_CAT24C512` | <https://www.sparkfun.com/products/14764>
|
||||
RM24C512C EEPROM | `#define EEPROM_I2C_RM24C512C` | <https://www.sparkfun.com/products/14764>
|
||||
24LC128 EEPROM | `#define EEPROM_I2C_24LC128` | <https://www.microchip.com/wwwproducts/en/24LC128>
|
||||
24LC256 EEPROM | `#define EEPROM_I2C_24LC256` | <https://www.sparkfun.com/products/525>
|
||||
MB85RC256V FRAM | `#define EEPROM_I2C_MB85RC256V` | <https://www.adafruit.com/product/1895>
|
||||
|
||||
?> If you find that the EEPROM is not cooperating, ensure you've correctly shifted up your EEPROM address by 1. For example, the datasheet might state the address as `0b01010000` -- the correct value of `EXTERNAL_EEPROM_I2C_BASE_ADDRESS` needs to be `0b10100000`.
|
||||
|
||||
## Transient Driver configuration
|
||||
|
||||
The only configurable item for the transient EEPROM driver is its size:
|
||||
|
||||
`config.h` override | Description | Default Value
|
||||
------------------------------- | ----------------------------------------- | -------------
|
||||
`#define TRANSIENT_EEPROM_SIZE` | Total size of the EEPROM storage in bytes | 64
|
||||
|
||||
Default values and extended descriptions can be found in `drivers/eeprom/eeprom_transient.h`.
|
@ -33,3 +33,7 @@ Support for up to 2 drivers. Each driver impliments 2 charlieplex matrices to in
|
||||
## IS31FL3733
|
||||
|
||||
Support for up to a single driver with room for expansion. Each driver can control 192 individual LEDs or 64 RGB LEDs. For more information on how to setup the driver see the [RGB Matrix](feature_rgb_matrix.md) page.
|
||||
|
||||
## 24xx series external I2C EEPROM
|
||||
|
||||
Support for an external I2C-based EEPROM instead of using the on-chip EEPROM. For more information on how to setup the driver see the [EEPROM Driver](eeprom_driver.md) page.
|
||||
|
@ -10,32 +10,34 @@
|
||||
* [学習リソース](ja/newbs_learn_more_resources.md)
|
||||
|
||||
* [QMKの基本](ja/README.md)
|
||||
* [QMKの導入](ja/getting_started_introduction.md)
|
||||
* [QMK の導入](ja/getting_started_introduction.md)
|
||||
* [QMK CLI](ja/cli.md)
|
||||
* [QMK CLI 設定](ja/cli_configuration.md)
|
||||
* [QMKへの貢献](ja/contributing.md)
|
||||
* [Githubの使い方](ja/getting_started_github.md)
|
||||
* [QMK への貢献](ja/contributing.md)
|
||||
* [Github の使い方](ja/getting_started_github.md)
|
||||
* [ヘルプ](ja/getting_started_getting_help.md)
|
||||
|
||||
* [破壊的な変更](ja/breaking_changes.md)
|
||||
* [プルリクエストにフラグが付けられた](ja/breaking_changes_instructions.md)
|
||||
* [2019年8月30日](ja/ChangeLog/20190830.md)
|
||||
|
||||
* [FAQ](ja/faq.md)
|
||||
* [一般的なFAQ](ja/faq_general.md)
|
||||
* [QMKのビルド/コンパイル](ja/faq_build.md)
|
||||
* [QMKのデバッグ/トラブルシューティング](ja/faq_debug.md)
|
||||
* [一般的な FAQ](ja/faq_general.md)
|
||||
* [QMK のビルド/コンパイル](ja/faq_build.md)
|
||||
* [QMK のデバッグ/トラブルシューティング](ja/faq_debug.md)
|
||||
* [キーマップ](ja/faq_keymap.md)
|
||||
* [Zadigを使ったドライバのインストール](ja/driver_installation_zadig.md)
|
||||
* [Zadig を使ったドライバのインストール](ja/driver_installation_zadig.md)
|
||||
|
||||
* 詳細なガイド
|
||||
* [ビルドツールのインストール](ja/getting_started_build_tools.md)
|
||||
* [Vagrantのガイド](ja/getting_started_vagrant.md)
|
||||
* [Vagrant のガイド](ja/getting_started_vagrant.md)
|
||||
* [ビルド/コンパイルの説明](ja/getting_started_make_guide.md)
|
||||
* [ファームウェアのフラッシュ](ja/flashing.md)
|
||||
* [機能のカスタマイズ](ja/custom_quantum_functions.md)
|
||||
* [キーマップの概要](ja/keymap.md)
|
||||
|
||||
* [ハードウェア](ja/hardware.md)
|
||||
* [互換性のあるマイクロコントローラ](ja/compatible_microcontrollers.md)
|
||||
* [AVR プロセッサ](ja/hardware_avr.md)
|
||||
* [ドライバ](ja/hardware_drivers.md)
|
||||
|
||||
@ -66,7 +68,7 @@
|
||||
* [ブートマジック](ja/feature_bootmagic.md)
|
||||
* [コンボ](ja/feature_combo.md)
|
||||
* [コマンド](ja/feature_command.md)
|
||||
* [Debounce API](ja/feature_debounce_type.md)
|
||||
* [デバウンス API](ja/feature_debounce_type.md)
|
||||
* [DIP スイッチ](ja/feature_dip_switch.md)
|
||||
* [動的マクロ](ja/feature_dynamic_macros.md)
|
||||
* [エンコーダ](ja/feature_encoders.md)
|
||||
@ -90,27 +92,31 @@
|
||||
* [Stenography](ja/feature_stenography.md)
|
||||
* [Swap Hands](ja/feature_swap_hands.md)
|
||||
* [タップ ダンス](ja/feature_tap_dance.md)
|
||||
* [Terminal](ja/feature_terminal.md)
|
||||
* [ターミナル](ja/feature_terminal.md)
|
||||
* [感熱式プリンタ](ja/feature_thermal_printer.md)
|
||||
* [ユニコード](ja/feature_unicode.md)
|
||||
* [Userspace](ja/feature_userspace.md)
|
||||
* [ユーザスペース](ja/feature_userspace.md)
|
||||
* [Velocikey](ja/feature_velocikey.md)
|
||||
|
||||
* メーカーおよびモッダーのために
|
||||
* [Hand Wiring Guide](ja/hand_wire.md)
|
||||
* [ISP Flashing Guide](ja/isp_flashing_guide.md)
|
||||
* [Hand Wiring ガイド](ja/hand_wire.md)
|
||||
* [ISP 書き込みガイド](ja/isp_flashing_guide.md)
|
||||
* [ARM デバッグ ガイド](ja/arm_debugging.md)
|
||||
* [ADC ドライバ](ja/adc_driver.md)
|
||||
* [I2C ドライバ](ja/i2c_driver.md)
|
||||
* [WS2812 ドライバ](ja/ws2812_driver.md)
|
||||
* [EEPROM ドライバ](ja/eeprom_driver.md)
|
||||
* [GPIO コントロール](ja/internals_gpio_control.md)
|
||||
* [カスタムマトリックス](ja/custom_matrix.md)
|
||||
* [Proton C 規約](ja/proton_c_conversion.md)
|
||||
|
||||
* より深く知るために
|
||||
* [キーボードがどのように動作するか](ja/how_keyboards_work.md)
|
||||
* [QMKの理解](ja/understanding_qmk.md)
|
||||
* [QMK の理解](ja/understanding_qmk.md)
|
||||
|
||||
* 他の話題
|
||||
* [EclipseでQMKを使用](ja/other_eclipse.md)
|
||||
* [VSCodeでQMKを使用](ja/other_vscode.md)
|
||||
* [Eclipse で QMK を使用](ja/other_eclipse.md)
|
||||
* [VSCode で QMK を使用](ja/other_vscode.md)
|
||||
* [サポート](ja/support.md)
|
||||
* [翻訳を追加する方法](ja/translating.md)
|
||||
|
||||
|
@ -64,13 +64,13 @@ Eclipse に QMK をビルドしようとするデバイスを教える必要が
|
||||
|
||||
## ビルド
|
||||
|
||||
全て正しくセットアップできていれば、ハンマーボタンを押すとファームウェアがビルドされ、.binファイルが出力されるはずです。
|
||||
全て正しくセットアップできていれば、ハンマーボタンを押すとファームウェアがビルドされ、.bin ファイルが出力されるはずです。
|
||||
|
||||
## デバッグ
|
||||
|
||||
### デバッガの接続
|
||||
|
||||
ARM MCU は、クロック信号(SWCLK) とデータ信号(SWDIO) で構成される Single Wire Debug (SWD) プロトコルを使います。MCUを 完全に操作するには、この2本のワイヤとグラウンドを接続するだけで十分です。ここでは、キーボードは USB を介して電力が供給されると想定しています。手動でリセットボタンを使えるため、RESET 信号は必要ありません。より高度なセットアップのために printf と scanf をホストに非同期にパイプする SWO 信号を使用できますが、私たちのセットアップでは無視します。
|
||||
ARM MCU は、クロック信号(SWCLK) とデータ信号(SWDIO) で構成される Single Wire Debug (SWD) プロトコルを使います。MCU を 完全に操作するには、この2本のワイヤとグラウンドを接続するだけで十分です。ここでは、キーボードは USB を介して電力が供給されると想定しています。手動でリセットボタンを使えるため、RESET 信号は必要ありません。より高度なセットアップのために printf と scanf をホストに非同期にパイプする SWO 信号を使用できますが、私たちのセットアップでは無視します。
|
||||
|
||||
注意: SWCLK と SWDIO ピンがキーボードのマトリックスで使われていないことを確認してください。もし使われている場合は、一時的に他のピンに切り替えることができます。
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# QMK の設定
|
||||
|
||||
<!---
|
||||
original document: 0f43c2652:docs/config_options.md
|
||||
git diff 0f43c2652 HEAD -- docs/config_options.md | cat
|
||||
original document: 9ff61601e:docs/config_options.md
|
||||
git diff 9ff61601e HEAD -- docs/config_options.md | cat
|
||||
-->
|
||||
|
||||
QMK はほぼ無制限に設定可能です。可能なところはいかなるところでも、やりすぎな程、ユーザーがコードサイズを犠牲にしてでも彼らのキーボードをカスタマイズをすることを許しています。ただし、このレベルの柔軟性により設定が困難になります。
|
||||
@ -154,6 +154,8 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* タップされた直後に、デュアルロールキーを修飾子として使用できるようにします
|
||||
* [Hold after tap](ja/feature_advanced_keycodes.md#tapping-force-hold)を見てください
|
||||
* タップトグル機能を無効にします (`TT` あるいは One Shot Tap Toggle)
|
||||
* `#define TAPPING_FORCE_HOLD_PER_KEY`
|
||||
* キーごとの `TAPPING_FORCE_HOLD` 設定処理を有効にします。
|
||||
* `#define LEADER_TIMEOUT 300`
|
||||
* リーダーキーがタイムアウトするまでの時間
|
||||
* タイムアウトする前にシーケンスを終了できない場合は、タイムアウトの設定を増やす必要があるかもしれません。あるいは、`LEADER_PER_KEY_TIMING` オプションを有効にすると良いでしょう。これは各キーがタップされた後でタイムアウトを再設定します。
|
||||
@ -187,7 +189,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* `#define RGBLIGHT_SPLIT`
|
||||
* 分割キーボードの左半分の RGB LED の出力を右半分の RGB LED の入力につなげるかわりに、それぞれの側で個別にコントローラの出力ピンが直接 RGB LED の入力に繋がっているときは、この定義が必要です。
|
||||
* `#define RGBLED_SPLIT { 6, 6 }`
|
||||
* 分割キーボードの各半分の `RGB_DI_PIN` に直接配線されている接続されているLEDの数
|
||||
* 分割キーボードの各半分の `RGB_DI_PIN` に直接配線されている接続されている LED の数
|
||||
* 最初の値は左半分の LED の数を示し、2番目の値は右半分です。
|
||||
* RGBLED_SPLIT が定義されている場合、RGBLIGHT_SPLIT は暗黙的に定義されます。
|
||||
* `#define RGBLIGHT_HUE_STEP 12`
|
||||
@ -216,7 +218,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
|
||||
### 左右の設定
|
||||
|
||||
一つ覚えておかなければならないことは、USB ポートが接続されている側が常にマスター側であるということです。USB に接続されていない側はスレーブです。
|
||||
1つ覚えておかなければならないことは、USB ポートが接続されている側が常にマスター側であるということです。USB に接続されていない側はスレーブです。
|
||||
|
||||
分割キーボードの左右を設定するには、幾つかの異なる方法があります (優先度の順にリストされています):
|
||||
|
||||
@ -260,7 +262,7 @@ QMK での全ての利用可能な設定にはデフォルトがあります。
|
||||
* `#define SELECT_SOFT_SERIAL_SPEED <speed>` (デフォルトの速度は1です)
|
||||
* serial 通信を使う時のプロトコルの速度を設定します。
|
||||
* 速度:
|
||||
* 0: 約189kbps (実験目的のみ)
|
||||
* 0: 約 189kbps (実験目的のみ)
|
||||
* 1: 約 137kbps (デフォルト)
|
||||
* 2: 約 75kbps
|
||||
* 3: 約 39kbps
|
||||
|
@ -63,7 +63,7 @@ QMK Configurator は Chrome/Firefox で最適に動作します。
|
||||
|
||||
2分割の右シフト: 両方とも右シフトで埋めます。
|
||||
|
||||
左シフトとISOサポート用に1つずつ: 両方とも左シフトで埋めます。
|
||||
左シフトと ISO サポート用に1つずつ: 両方とも左シフトで埋めます。
|
||||
|
||||
5分割だが4キーのみ: 以前やったことがある人を推測して確認するか尋ねてください。
|
||||
|
||||
@ -73,7 +73,7 @@ QMK Configurator は Chrome/Firefox で最適に動作します。
|
||||
|
||||
後日、`Import Keymap` ボタンを押すことで、この .json ファイルをロードできます。
|
||||
|
||||
!> **注意:** このファイルは、kbfirmware.com またはその他のツールに使用される .jsonファイルと同じ形式ではありません。これらのツールにこれを使用したり、QMK Configurator でこれらのツールの .json を使用しようとすると、キーボードが **爆発** する可能性があります。
|
||||
!> **注意:** このファイルは、kbfirmware.com またはその他のツールに使用される .json ファイルと同じ形式ではありません。これらのツールにこれを使用したり、QMK Configurator でこれらのツールの .json を使用しようとすると、キーボードが **爆発** する可能性があります。
|
||||
|
||||
## ファームウェアファイルを生成する
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
キーボードに書き込む最も簡単な方法は [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) を使うことです。
|
||||
|
||||
ただし、QMK Toolbox は、現在は Windows と macOS でしか使えません。
|
||||
Linuxを使用している場合(および、コマンドラインでファームウェアを書き込みたい場合)は、下の方で概説する[方法](ja/newbs_flashing.md#flash-your-keyboard-from-the-command-line)で行なう必要があります。
|
||||
Linux を使用している場合(および、コマンドラインでファームウェアを書き込みたい場合)は、下の方で概説する[方法](ja/newbs_flashing.md#flash-your-keyboard-from-the-command-line)で行なう必要があります。
|
||||
|
||||
### QMK Toolbox にファイルをロードする
|
||||
|
||||
@ -65,7 +65,7 @@ planck_rev5_default.hex
|
||||
* 基板(PCB)に付けられている物理的な `RESET` ボタンを押す
|
||||
* PCB 上の `BOOT0` か `RESET` のラベルの付いたヘッダピンを探し、PCB 接続中にそれらを互いにショートする
|
||||
|
||||
うまくいけば、QMK Toolboxに次のようなメッセージが表示されます。
|
||||
うまくいけば、QMK Toolbox に次のようなメッセージが表示されます。
|
||||
|
||||
```
|
||||
*** Clueboard - Clueboard 66% HotSwap disconnected -- 0xC1ED:0x2390
|
||||
@ -121,7 +121,7 @@ QMK Toolbox の `Flash` ボタンをクリックします。
|
||||
この場合、あなたは明示的にブートローダを指定する方法を使わなければなりません。
|
||||
|
||||
ブートローダは主に 5 種類のものが使われています。
|
||||
Pro Micro とそのクローンは Caterina を、Teensy は HalfKay を、OLKBの AVR ボードは QMK-DFU を、その他の ATmega32U4 ボードは DFU を、そして多くの ARM ボードは ARM DFU を使います。
|
||||
Pro Micro とそのクローンは Caterina を、Teensy は HalfKay を、OLKB の AVR ボードは QMK-DFU を、その他の ATmega32U4 ボードは DFU を、そして多くの ARM ボードは ARM DFU を使います。
|
||||
|
||||
より詳しいブートローダの情報は、[Flashing Instructions and Bootloader Information](ja/flashing.md) にあります。
|
||||
|
||||
@ -178,10 +178,10 @@ Checking file size of planck_rev5_xyverz.hex
|
||||
|
||||
ファームウェアを DFU デバイスに書き込むために使用できる DFU コマンドがいくつかあります。
|
||||
|
||||
* `:dfu` - これが通常のオプションで、DFUデバイスが使用可能になるまで待機したのちファームウェアを書き込みます。5秒ごとに、DFUデバイスが存在するかチェックしています。
|
||||
* `:dfu` - これが通常のオプションで、DFU デバイスが使用可能になるまで待機したのちファームウェアを書き込みます。5秒ごとに、DFU デバイスが存在するかチェックしています。
|
||||
* `:dfu-ee` - 通常の hex ファイルの代わりに `eep` ファイルを書き込みます。これを使用するのはまれです。
|
||||
* `:dfu-split-left` - デフォルトオプション (`:dfu`) と同様に、通常のファームウェアが書き込まれます。ただし、分割キーボードの「左側の」 EEPROMファイルも書き込まれます。_これは、Elite C ベースの分割キーボードに最適です。_
|
||||
* `:dfu-split-right` - デフォルトオプション (`:dfu`) と同様に、通常のファームウェアが書き込まれます。ただし、分割キーボードの「右側の」EEPROMファイルも書き込まれます。_これは、Elite C ベースの分割キーボードに最適です。_
|
||||
* `:dfu-split-left` - デフォルトオプション (`:dfu`) と同様に、通常のファームウェアが書き込まれます。ただし、分割キーボードの「左側の」 EEPROM ファイルも書き込まれます。_これは、Elite C ベースの分割キーボードに最適です。_
|
||||
* `:dfu-split-right` - デフォルトオプション (`:dfu`) と同様に、通常のファームウェアが書き込まれます。ただし、分割キーボードの「右側の」EEPROM ファイルも書き込まれます。_これは、Elite C ベースの分割キーボードに最適です。_
|
||||
|
||||
|
||||
### Caterina
|
||||
@ -259,8 +259,8 @@ avrdude.exe done. Thank you.
|
||||
|
||||
* `:avrdude` - これが通常のオプションで、Caterina デバイスが(新しい COM ポートを検出して)使用可能になるまで待機し、ファームウェアを書き込みます。
|
||||
* `:avrdude-loop` - これは `:avrdude` と同じです。ただし書き込みが終了すると再び Caterina デバイスの書き込み待ちに戻ります。これは何台ものデバイスへの書き込みに便利です。_Control+C を押して、手動でこの繰り返しを終了させる必要があります。_
|
||||
* `:avrdude-split-left` - デフォルトオプション(`:avrdude`)と同様に通常のファームウェアが書き込まれます。ただし、分割キーボードの「左側の」EEPROMファイルもフラッシュされます。 _これは、Pro Micro ベースの分割キーボードに最適です。_
|
||||
* `:avrdude-split-right` - デフォルトオプション(`:avrdude`)と同様に通常のファームウェアが書き込まれます。ただし、分割キーボードの「右側の」EEPROMファイルもフラッシュされます。 _これは、Pro Micro ベースの分割キーボードに最適です。_
|
||||
* `:avrdude-split-left` - デフォルトオプション(`:avrdude`)と同様に通常のファームウェアが書き込まれます。ただし、分割キーボードの「左側の」EEPROM ファイルもフラッシュされます。 _これは、Pro Micro ベースの分割キーボードに最適です。_
|
||||
* `:avrdude-split-right` - デフォルトオプション(`:avrdude`)と同様に通常のファームウェアが書き込まれます。ただし、分割キーボードの「右側の」EEPROM ファイルもフラッシュされます。 _これは、Pro Micro ベースの分割キーボードに最適です。_
|
||||
|
||||
### HalfKay
|
||||
|
||||
|
@ -12,7 +12,7 @@ QMK は、そのソフトウェアの役割を果たし、ボタンの押下を
|
||||
カスタムキーマップを作るということは、キーボード上で動くプログラムを作るということなのです。
|
||||
|
||||
QMK は、簡単なことは簡単に、そして、難しいことを可能なことにすることで、あなたの手にたくさんのパワーをもたらします。
|
||||
パワフルなキーマップを作るためにプログラムを作成する方法を知る必要はありません。いくつかのシンプルな文法に従うだけでOKです。
|
||||
パワフルなキーマップを作るためにプログラムを作成する方法を知る必要はありません。いくつかのシンプルな文法に従うだけで OK です。
|
||||
|
||||
# はじめに
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
-->
|
||||
|
||||
仮にあなたの `master` ブランチにあなたのコミットを行い、そしてあなたの QMK リポジトリの更新が必要になったとします。
|
||||
(フォーク元の) QMKの `master` ブランチをあなたの `master` ブランチに `git pull` することもできますが、GitHub は、あなたのブランチが `qmk:master` より何コミットか先行していると通知します、この状態で QMK にプルリクエストを行う場合、問題が発生する可能性があります。
|
||||
(フォーク元の) QMK の `master` ブランチをあなたの `master` ブランチに `git pull` することもできますが、GitHub は、あなたのブランチが `qmk:master` より何コミットか先行していると通知します、この状態で QMK にプルリクエストを行う場合、問題が発生する可能性があります。
|
||||
(訳注:この通知は、GitHub のあなたのリポジトリの code ペインのブランチ選択メニューの下のあたりで `This branch is 3 commit ahead of qmk:master` という様な文面で表示されています。)
|
||||
|
||||
?> このドキュメントは [あなたのフォークの master ブランチ: 更新は頻繁に、コミットはしないこと](ja/newbs_git_using_your_master_branch.md) で詳述されている概念に基づいています。その概念に慣れていない場合は、まずそれを読んでから、ここに戻ってください。
|
||||
|
@ -41,7 +41,7 @@ upstream https://github.com/qmk/qmk_firmware.git (push)
|
||||
このコマンドは `upstream` というニックネームを持つ QMK リポジトリから、ブランチとタグ — "refs" と総称されます — を取得します。
|
||||
これで、あなたのフォーク `origin` のデータを QMK が保持するデータと比較できます。
|
||||
|
||||
あなたのフォークの `master` を更新するには、次を実行します、各行の後にEnterキーを押してください:
|
||||
あなたのフォークの `master` を更新するには、次を実行します、各行の後に Enter キーを押してください:
|
||||
|
||||
```
|
||||
git checkout master
|
||||
@ -98,4 +98,4 @@ git commit -m "My commit message."
|
||||
|
||||
最後のステップは、変更をフォークにプッシュすることです。
|
||||
これを行うには、`git push`と入力します。
|
||||
Gitは、 `dev_branch`の現在の状態をフォークに公開します。
|
||||
Git は、 `dev_branch`の現在の状態をフォークに公開します。
|
||||
|
@ -6,7 +6,7 @@
|
||||
git diff ed0575fc8 HEAD -- docs/newbs_learn_more_resources.md | cat
|
||||
-->
|
||||
|
||||
これらのリソースは、QMKコミュニティの新しいメンバーに、初心者向けドキュメントで提供されている情報に対する理解を深めることを目的としています。
|
||||
これらのリソースは、QMK コミュニティの新しいメンバーに、初心者向けドキュメントで提供されている情報に対する理解を深めることを目的としています。
|
||||
|
||||
## Git に関するリース:
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
通常、キーボードをテストするのは非常に簡単です。全てのキーをひとつずつ押して、期待されるキーが送信されていることを確認します。キーを押したことを見逃さないためのプログラムもあります。
|
||||
|
||||
メモ: これらのプログラムはQMKによって提供・承認されたものではありません。
|
||||
メモ: これらのプログラムは QMK によって提供・承認されたものではありません。
|
||||
|
||||
* [QMK Configurator](https://config.qmk.fm/#/test/) (Web Based)
|
||||
* [Switch Hitter](https://web.archive.org/web/20190413233743/https://elitekeyboards.com/switchhitter.php) (Windows Only)
|
||||
@ -40,7 +40,7 @@ void keyboard_post_init_user(void) {
|
||||
|
||||
### hid_listenを使ったデバッグ
|
||||
|
||||
ターミナルベースの方法がお好みですか?PJRCが提供する[hid_listen](https://www.pjrc.com/teensy/hid_listen.html)もデバッグメッセージの表示に使用できます。ビルド済みの実行ファイルはWindows, Linux, MacOS用が用意されています。
|
||||
ターミナルベースの方法がお好みですか?PJRC が提供する[hid_listen](https://www.pjrc.com/teensy/hid_listen.html)もデバッグメッセージの表示に使用できます。ビルド済みの実行ファイルは Windows, Linux, MacOS 用が用意されています。
|
||||
|
||||
<!-- FIXME: Describe the debugging messages here. -->
|
||||
|
||||
@ -50,7 +50,7 @@ void keyboard_post_init_user(void) {
|
||||
|
||||
#include <print.h>
|
||||
|
||||
そのあとは、いくつかの異なったprint関数を使用することが出来ます。
|
||||
そのあとは、いくつかの異なった print 関数を使用することが出来ます。
|
||||
|
||||
* `print("string")`: シンプルな文字列を出力します
|
||||
* `uprintf("%s string", var)`: フォーマットされた文字列を出力します
|
||||
|
@ -24,8 +24,8 @@
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_GENERIC_STM32_F103
|
||||
#define BOARD_NAME "Generic STM32F103x board"
|
||||
#define BOARD_STM32_F103_STM32DUINO
|
||||
#define BOARD_NAME "GENERIC STM32F103C8T6 board - stm32duino bootloader"
|
||||
|
||||
/*
|
||||
* Board frequencies.
|
5
drivers/boards/STM32_F103_STM32DUINO/board.mk
Normal file
5
drivers/boards/STM32_F103_STM32DUINO/board.mk
Normal file
@ -0,0 +1,5 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = $(BOARD_PATH)/boards/STM32_F103_STM32DUINO/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(BOARD_PATH)/boards/STM32_F103_STM32DUINO
|
46
drivers/eeprom/eeprom_custom.c-template
Normal file
46
drivers/eeprom/eeprom_custom.c-template
Normal file
@ -0,0 +1,46 @@
|
||||
/* Copyright 2019 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 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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "eeprom_driver.h"
|
||||
|
||||
void eeprom_driver_init(void) {
|
||||
/* Any initialisation code */
|
||||
}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
/* Wipe out the EEPROM, setting values to zero */
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
/*
|
||||
Read a block of data:
|
||||
buf: target buffer
|
||||
addr: 0-based offset within the EEPROM
|
||||
len: length to read
|
||||
*/
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
/*
|
||||
Write a block of data:
|
||||
buf: target buffer
|
||||
addr: 0-based offset within the EEPROM
|
||||
len: length to write
|
||||
*/
|
||||
}
|
73
drivers/eeprom/eeprom_driver.c
Normal file
73
drivers/eeprom/eeprom_driver.c
Normal file
@ -0,0 +1,73 @@
|
||||
/* Copyright 2019 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 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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "eeprom_driver.h"
|
||||
|
||||
uint8_t eeprom_read_byte(const uint8_t *addr) {
|
||||
uint8_t ret;
|
||||
eeprom_read_block(&ret, addr, 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint16_t eeprom_read_word(const uint16_t *addr) {
|
||||
uint16_t ret;
|
||||
eeprom_read_block(&ret, addr, 2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32_t eeprom_read_dword(const uint32_t *addr) {
|
||||
uint32_t ret;
|
||||
eeprom_read_block(&ret, addr, 4);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void eeprom_write_byte(uint8_t *addr, uint8_t value) { eeprom_write_block(&value, addr, 1); }
|
||||
|
||||
void eeprom_write_word(uint16_t *addr, uint16_t value) { eeprom_write_block(&value, addr, 2); }
|
||||
|
||||
void eeprom_write_dword(uint32_t *addr, uint32_t value) { eeprom_write_block(&value, addr, 4); }
|
||||
|
||||
void eeprom_update_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t read_buf[len];
|
||||
eeprom_read_block(read_buf, addr, len);
|
||||
if (memcmp(buf, read_buf, len) != 0) {
|
||||
eeprom_write_block(buf, addr, len);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_byte(uint8_t *addr, uint8_t value) {
|
||||
uint8_t orig = eeprom_read_byte(addr);
|
||||
if (orig != value) {
|
||||
eeprom_write_byte(addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_word(uint16_t *addr, uint16_t value) {
|
||||
uint16_t orig = eeprom_read_word(addr);
|
||||
if (orig != value) {
|
||||
eeprom_write_word(addr, value);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_update_dword(uint32_t *addr, uint32_t value) {
|
||||
uint32_t orig = eeprom_read_dword(addr);
|
||||
if (orig != value) {
|
||||
eeprom_write_dword(addr, value);
|
||||
}
|
||||
}
|
22
drivers/eeprom/eeprom_driver.h
Normal file
22
drivers/eeprom/eeprom_driver.h
Normal file
@ -0,0 +1,22 @@
|
||||
/* Copyright 2019 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 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 "eeprom.h"
|
||||
|
||||
void eeprom_driver_init(void);
|
||||
void eeprom_driver_erase(void);
|
120
drivers/eeprom/eeprom_i2c.c
Normal file
120
drivers/eeprom/eeprom_i2c.c
Normal file
@ -0,0 +1,120 @@
|
||||
/* Copyright 2019 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 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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
Note that the implementations of eeprom_XXXX_YYYY on AVR are normally
|
||||
provided by avr-libc. The same functions are reimplemented below and are
|
||||
rerouted to the external i2c equivalent.
|
||||
|
||||
Seemingly, as this is compiled from within QMK, the object file generated
|
||||
during the build overrides the avr-libc implementation during the linking
|
||||
stage.
|
||||
|
||||
On other platforms such as ARM, there are no provided implementations, so
|
||||
there is nothing to override during linkage.
|
||||
*/
|
||||
|
||||
#include "wait.h"
|
||||
#include "i2c_master.h"
|
||||
#include "eeprom.h"
|
||||
#include "eeprom_i2c.h"
|
||||
|
||||
// #define DEBUG_EEPROM_OUTPUT
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
# include "print.h"
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
static inline void init_i2c_if_required(void) {
|
||||
static int done = 0;
|
||||
if (!done) {
|
||||
i2c_init();
|
||||
done = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void fill_target_address(uint8_t *buffer, const void *addr) {
|
||||
intptr_t p = (intptr_t)addr;
|
||||
for (int i = 0; i < EXTERNAL_EEPROM_ADDRESS_SIZE; ++i) {
|
||||
buffer[EXTERNAL_EEPROM_ADDRESS_SIZE - 1 - i] = p & 0xFF;
|
||||
p >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_driver_init(void) {}
|
||||
|
||||
void eeprom_driver_erase(void) {
|
||||
uint8_t buf[EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
memset(buf, 0x00, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
for (intptr_t addr = 0; addr < EXTERNAL_EEPROM_BYTE_COUNT; addr += EXTERNAL_EEPROM_PAGE_SIZE) {
|
||||
eeprom_write_block(buf, (void *)addr, EXTERNAL_EEPROM_PAGE_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
uint8_t complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE];
|
||||
fill_target_address(complete_packet, addr);
|
||||
|
||||
init_i2c_if_required();
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE, 100);
|
||||
i2c_receive(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), buf, len, 100);
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
dprintf("[EEPROM R] 0x%04X: ", ((int)addr));
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
dprintf(" %02X", (int)(((uint8_t *)buf)[i]));
|
||||
}
|
||||
dprintf("\n");
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
uint8_t complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + EXTERNAL_EEPROM_PAGE_SIZE];
|
||||
uint8_t *read_buf = (uint8_t *)buf;
|
||||
intptr_t target_addr = (intptr_t)addr;
|
||||
|
||||
init_i2c_if_required();
|
||||
while (len > 0) {
|
||||
intptr_t page_offset = target_addr % EXTERNAL_EEPROM_PAGE_SIZE;
|
||||
int write_length = EXTERNAL_EEPROM_PAGE_SIZE - page_offset;
|
||||
if (write_length > len) {
|
||||
write_length = len;
|
||||
}
|
||||
|
||||
fill_target_address(complete_packet, (const void *)target_addr);
|
||||
for (uint8_t i = 0; i < write_length; i++) {
|
||||
complete_packet[EXTERNAL_EEPROM_ADDRESS_SIZE + i] = read_buf[i];
|
||||
}
|
||||
|
||||
#ifdef DEBUG_EEPROM_OUTPUT
|
||||
dprintf("[EEPROM W] 0x%04X: ", ((int)target_addr));
|
||||
for (uint8_t i = 0; i < write_length; i++) {
|
||||
dprintf(" %02X", (int)(read_buf[i]));
|
||||
}
|
||||
dprintf("\n");
|
||||
#endif // DEBUG_EEPROM_OUTPUT
|
||||
|
||||
i2c_transmit(EXTERNAL_EEPROM_I2C_ADDRESS((intptr_t)addr), complete_packet, EXTERNAL_EEPROM_ADDRESS_SIZE + write_length, 100);
|
||||
wait_ms(EXTERNAL_EEPROM_WRITE_TIME);
|
||||
|
||||
read_buf += write_length;
|
||||
target_addr += write_length;
|
||||
len -= write_length;
|
||||
}
|
||||
}
|
115
drivers/eeprom/eeprom_i2c.h
Normal file
115
drivers/eeprom/eeprom_i2c.h
Normal file
@ -0,0 +1,115 @@
|
||||
/* Copyright 2019 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 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
|
||||
|
||||
/*
|
||||
Default device configurations:
|
||||
|
||||
For the Sparkfun Qwiic I2C EEPROM module: https://www.sparkfun.com/products/14764
|
||||
#define EEPROM_I2C_CAT24C512 // (part number 24512A)
|
||||
#define EEPROM_I2C_RM24C512C // (part number 24512C)
|
||||
|
||||
For the Sparkfun I2C EEPROM chip: https://www.sparkfun.com/products/525
|
||||
#define EEPROM_I2C_24LC256
|
||||
|
||||
For the Adafruit I2C FRAM chip: https://www.adafruit.com/product/1895
|
||||
#define EEPROM_I2C_MB85RC256V
|
||||
*/
|
||||
#if defined(EEPROM_I2C_CAT24C512)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 65536
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 128
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#elif defined(EEPROM_I2C_RM24C512C)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 65536
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 128
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 3
|
||||
#elif defined(EEPROM_I2C_24LC256)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 32768
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 64
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#elif defined(EEPROM_I2C_24LC128)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 16384
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 64
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#elif defined(EEPROM_I2C_MB85RC256V)
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 32768
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 128
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
The base I2C address of the EEPROM.
|
||||
This needs to be shifted up by 1, to match i2c_master requirements.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_I2C_BASE_ADDRESS
|
||||
# define EXTERNAL_EEPROM_I2C_BASE_ADDRESS 0b10100000
|
||||
#endif
|
||||
|
||||
/*
|
||||
The calculated I2C address based on the input memory location.
|
||||
|
||||
For EEPROM chips that embed part of the memory location in the I2C address
|
||||
such as AT24M02 you can use something similar to the following (ensuring the
|
||||
result is shifted by left by 1):
|
||||
|
||||
#define EXTERNAL_EEPROM_I2C_ADDRESS(loc) \
|
||||
(EXTERNAL_EEPROM_I2C_BASE_ADDRESS | ((((loc) >> 16) & 0x07) << 1))
|
||||
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_I2C_ADDRESS
|
||||
# define EXTERNAL_EEPROM_I2C_ADDRESS(loc) (EXTERNAL_EEPROM_I2C_BASE_ADDRESS)
|
||||
#endif
|
||||
|
||||
/*
|
||||
The total size of the EEPROM, in bytes. The EEPROM datasheet will usually
|
||||
specify this value in kbits, and will require conversion to bytes.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_BYTE_COUNT
|
||||
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
|
||||
#endif
|
||||
|
||||
/*
|
||||
The page size in bytes of the EEPROM, as specified in the datasheet.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_PAGE_SIZE
|
||||
# define EXTERNAL_EEPROM_PAGE_SIZE 32
|
||||
#endif
|
||||
|
||||
/*
|
||||
The address size in bytes of the EEPROM. For EEPROMs with <=256 bytes, this
|
||||
will likely be 1. For EEPROMs >256 and <=65536, this will be 2. For EEPROMs
|
||||
>65536, this will likely need to be 2 with the modified variant of
|
||||
EXTERNAL_EEPROM_I2C_ADDRESS above.
|
||||
|
||||
As expected, consult the datasheet for specifics of your EEPROM.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_ADDRESS_SIZE
|
||||
# define EXTERNAL_EEPROM_ADDRESS_SIZE 2
|
||||
#endif
|
||||
|
||||
/*
|
||||
The write cycle time of the EEPROM in milliseconds, as specified in the
|
||||
datasheet.
|
||||
*/
|
||||
#ifndef EXTERNAL_EEPROM_WRITE_TIME
|
||||
# define EXTERNAL_EEPROM_WRITE_TIME 5
|
||||
#endif
|
52
drivers/eeprom/eeprom_transient.c
Normal file
52
drivers/eeprom/eeprom_transient.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* Copyright 2019 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 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 <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "eeprom_driver.h"
|
||||
#include "eeprom_transient.h"
|
||||
|
||||
__attribute__((aligned(4))) static uint8_t transientBuffer[TRANSIENT_EEPROM_SIZE] = {0};
|
||||
|
||||
size_t clamp_length(intptr_t offset, size_t len) {
|
||||
if (offset + len > TRANSIENT_EEPROM_SIZE) {
|
||||
len = TRANSIENT_EEPROM_SIZE - offset;
|
||||
}
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
void eeprom_driver_init(void) { eeprom_driver_erase(); }
|
||||
|
||||
void eeprom_driver_erase(void) { memset(transientBuffer, 0x00, TRANSIENT_EEPROM_SIZE); }
|
||||
|
||||
void eeprom_read_block(void *buf, const void *addr, size_t len) {
|
||||
intptr_t offset = (intptr_t)addr;
|
||||
memset(buf, 0x00, len);
|
||||
len = clamp_length(offset, len);
|
||||
if (len > 0) {
|
||||
memcpy(buf, &transientBuffer[offset], len);
|
||||
}
|
||||
}
|
||||
|
||||
void eeprom_write_block(const void *buf, void *addr, size_t len) {
|
||||
intptr_t offset = (intptr_t)addr;
|
||||
len = clamp_length(offset, len);
|
||||
if (len > 0) {
|
||||
memcpy(&transientBuffer[offset], buf, len);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user