mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-18 05:32:05 +00:00
Merge branch 'master' of https://github.com/qmk/qmk_firmware
This commit is contained in:
commit
2786e1cf29
@ -159,7 +159,6 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/color.c
|
||||
SRC += $(QUANTUM_DIR)/rgblight.c
|
||||
CIE1931_CURVE := yes
|
||||
LED_BREATHING_TABLE := yes
|
||||
RGB_KEYCODES_ENABLE := yes
|
||||
ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
|
||||
OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
|
||||
@ -298,24 +297,27 @@ VALID_BACKLIGHT_TYPES := pwm software custom
|
||||
BACKLIGHT_ENABLE ?= no
|
||||
BACKLIGHT_DRIVER ?= pwm
|
||||
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
|
||||
ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),)
|
||||
$(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
|
||||
endif
|
||||
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/backlight
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight.c
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
|
||||
OPT_DEFS += -DBACKLIGHT_ENABLE
|
||||
|
||||
ifeq ($(strip $(BACKLIGHT_DRIVER)), custom)
|
||||
OPT_DEFS += -DBACKLIGHT_CUSTOM_DRIVER
|
||||
else ifeq ($(strip $(BACKLIGHT_DRIVER)), software)
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_soft.c
|
||||
else
|
||||
ifeq ($(PLATFORM),AVR)
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_avr.c
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_driver_common.c
|
||||
ifeq ($(strip $(BACKLIGHT_DRIVER)), pwm)
|
||||
ifeq ($(PLATFORM),AVR)
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_avr.c
|
||||
else
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_arm.c
|
||||
endif
|
||||
else
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_arm.c
|
||||
SRC += $(QUANTUM_DIR)/backlight/backlight_$(strip $(BACKLIGHT_DRIVER)).c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@ -351,11 +353,6 @@ ifeq ($(strip $(CIE1931_CURVE)), yes)
|
||||
LED_TABLES := yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(LED_BREATHING_TABLE)), yes)
|
||||
OPT_DEFS += -DUSE_LED_BREATHING_TABLE
|
||||
LED_TABLES := yes
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(LED_TABLES)), yes)
|
||||
SRC += $(QUANTUM_DIR)/led_tables.c
|
||||
endif
|
||||
|
@ -9,24 +9,35 @@
|
||||
|
||||
## What is QMK Firmware?
|
||||
|
||||
QMK (*Quantum Mechanical Keyboard*) is an open source community that maintains QMK Firmware, QMK Toolbox, qmk.fm, and these docs. QMK Firmware is a keyboard firmware based on the [tmk\_keyboard](http://github.com/tmk/tmk_keyboard) with some useful features for Atmel AVR controllers, and more specifically, the [OLKB product line](http://olkb.com), the [ErgoDox EZ](http://www.ergodox-ez.com) keyboard, and the [Clueboard product line](http://clueboard.co/). It has also been ported to ARM chips using ChibiOS. You can use it to power your own hand-wired or custom keyboard PCB.
|
||||
QMK (*Quantum Mechanical Keyboard*) is an open source community centered around developing computer input devices. The community encompasses all sorts of input devices, such as keyboards, mice, and MIDI devices. A core group of collaborators maintains [QMK Firmware](https://github.com/qmk/qmk_firmware), [QMK Configurator](https://config.qmk.fm), [QMK Toolbox](https://github.com/qmk/qmk_toolbox), [qmk.fm](https://qmk.fm), and this documentation with the help of community members like you.
|
||||
|
||||
## How to Get It
|
||||
## Get Started
|
||||
|
||||
If you plan on contributing a keymap, keyboard, or features to QMK, the easiest thing to do is [fork the repo through Github](https://github.com/qmk/qmk_firmware#fork-destination-box), and clone your repo locally to make your changes, push them, then open a [Pull Request](https://github.com/qmk/qmk_firmware/pulls) from your fork.
|
||||
Totally new to QMK? There are two ways to get started:
|
||||
|
||||
Otherwise, you can clone it directly with `git clone https://github.com/qmk/qmk_firmware`. Do not download the zip or tar files; a git repository is required to download the submodules in order to compile.
|
||||
* Basic: [QMK Configurator](https://config.qmk.fm)
|
||||
* Just select your keyboard from the dropdown and program your keyboard.
|
||||
* We have an [introductory video](https://www.youtube.com/watch?v=-imgglzDMdY) you can watch.
|
||||
* There is also an overview [document you can read](newbs_building_firmware_configurator.md).
|
||||
* Advanced: [Use The Source](newbs.md)
|
||||
* More powerful, but harder to use
|
||||
|
||||
## How to Compile
|
||||
## Make It Yours
|
||||
|
||||
Before you are able to compile, you'll need to [install an environment](getting_started_build_tools.md) for AVR or/and ARM development. Once that is complete, you'll use the `make` command to build a keyboard and keymap with the following notation:
|
||||
QMK has lots of [features](features.md) to explore, and a good deal of reference documentation to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md).
|
||||
|
||||
make planck/rev4:default
|
||||
## Need help?
|
||||
|
||||
This would build the `rev4` revision of the `planck` with the `default` keymap. Not all keyboards have revisions (also called subprojects or folders), in which case, it can be omitted:
|
||||
Check out the [support page](support.md) to see how you can get help using QMK.
|
||||
|
||||
make preonic:default
|
||||
## Give Back
|
||||
|
||||
## How to Customize
|
||||
There are a lot of ways you can contribute to the QMK Community. The easiest way to get started is to use it and spread the word to your friends.
|
||||
|
||||
QMK has lots of [features](features.md) to explore, and a good deal of [reference documentation](http://docs.qmk.fm) to dig through. Most features are taken advantage of by modifying your [keymap](keymap.md), and changing the [keycodes](keycodes.md).
|
||||
* Help people out on our forums and chat rooms:
|
||||
* [/r/olkb](https://www.reddit.com/r/olkb/)
|
||||
* [Discord Server](https://discord.gg/Uq7gcHh)
|
||||
* Contribute to our documentation by clicking "Edit This Page" at the bottom
|
||||
* [Translate our documentation into your language](translating.md)
|
||||
* [Report a bug](https://github.com/qmk/qmk_firmware/issues/new/choose)
|
||||
* [Open a Pull Request](contributing.md)
|
||||
|
266
docs/_summary.md
266
docs/_summary.md
@ -1,130 +1,162 @@
|
||||
* [Complete Newbs Guide](newbs.md)
|
||||
* [Getting Started](newbs_getting_started.md)
|
||||
* Tutorial
|
||||
* [Introduction](newbs.md)
|
||||
* [Setup](newbs_getting_started.md)
|
||||
* [Building Your First Firmware](newbs_building_firmware.md)
|
||||
* [Flashing Firmware](newbs_flashing.md)
|
||||
* [Testing and Debugging](newbs_testing_debugging.md)
|
||||
* [Best Git Practices](newbs_git_best_practices.md)
|
||||
* [Using Your Fork's Master](newbs_git_using_your_master_branch.md)
|
||||
* [Resolving Merge Conflicts](newbs_git_resolving_merge_conflicts.md)
|
||||
* [Resynchronizing a Branch](newbs_git_resynchronize_a_branch.md)
|
||||
* [Learning Resources](newbs_learn_more_resources.md)
|
||||
* [Getting Help/Support](support.md)
|
||||
* [Other Resources](newbs_learn_more_resources.md)
|
||||
|
||||
* [QMK Basics](README.md)
|
||||
* [QMK Introduction](getting_started_introduction.md)
|
||||
* [QMK CLI](cli.md)
|
||||
* [QMK CLI Config](cli_configuration.md)
|
||||
* [Contributing to QMK](contributing.md)
|
||||
* [How to Use Github](getting_started_github.md)
|
||||
* [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)
|
||||
* FAQs
|
||||
* [General FAQ](faq_general.md)
|
||||
* [Build/Compile QMK](faq_build.md)
|
||||
* [Debugging/Troubleshooting QMK](faq_debug.md)
|
||||
* [Keymap](faq_keymap.md)
|
||||
* [Driver Installation with Zadig](driver_installation_zadig.md)
|
||||
|
||||
* Detailed Guides
|
||||
* [Install Build Tools](getting_started_build_tools.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* [Build/Compile Instructions](getting_started_make_guide.md)
|
||||
* [Flashing Firmware](flashing.md)
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Keymap Overview](keymap.md)
|
||||
|
||||
* [Hardware](hardware.md)
|
||||
* [Compatible Microcontrollers](compatible_microcontrollers.md)
|
||||
* [AVR Processors](hardware_avr.md)
|
||||
* [Drivers](hardware_drivers.md)
|
||||
|
||||
* Reference
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
* [Config Options](config_options.md)
|
||||
* [Keycodes](keycodes.md)
|
||||
* [Coding Conventions - C](coding_conventions_c.md)
|
||||
* [Coding Conventions - Python](coding_conventions_python.md)
|
||||
* [Documentation Best Practices](documentation_best_practices.md)
|
||||
* [Documentation Templates](documentation_templates.md)
|
||||
* [Keymap FAQ](faq_keymap.md)
|
||||
* [Glossary](reference_glossary.md)
|
||||
* [Unit Testing](unit_testing.md)
|
||||
* [Useful Functions](ref_functions.md)
|
||||
* [Configurator Support](reference_configurator_support.md)
|
||||
* [info.json Format](reference_info_json.md)
|
||||
* [Python CLI Development](cli_development.md)
|
||||
|
||||
* [Features](features.md)
|
||||
* [Basic Keycodes](keycodes_basic.md)
|
||||
* [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
|
||||
* [Quantum Keycodes](quantum_keycodes.md)
|
||||
* [Advanced Keycodes](feature_advanced_keycodes.md)
|
||||
* [Audio](feature_audio.md)
|
||||
* [Auto Shift](feature_auto_shift.md)
|
||||
* [Backlight](feature_backlight.md)
|
||||
* [Bluetooth](feature_bluetooth.md)
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* [Combos](feature_combo.md)
|
||||
* [Command](feature_command.md)
|
||||
* [Debounce API](feature_debounce_type.md)
|
||||
* [DIP Switch](feature_dip_switch.md)
|
||||
* [Dynamic Macros](feature_dynamic_macros.md)
|
||||
* [Encoders](feature_encoders.md)
|
||||
* [Grave Escape](feature_grave_esc.md)
|
||||
* [Haptic Feedback](feature_haptic_feedback.md)
|
||||
* [HD44780 LCD Controller](feature_hd44780.md)
|
||||
* [Key Lock](feature_key_lock.md)
|
||||
* [Layouts](feature_layouts.md)
|
||||
* [Leader Key](feature_leader_key.md)
|
||||
* [LED Matrix](feature_led_matrix.md)
|
||||
* [Macros](feature_macros.md)
|
||||
* [Mouse Keys](feature_mouse_keys.md)
|
||||
* [OLED Driver](feature_oled_driver.md)
|
||||
* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [Pointing Device](feature_pointing_device.md)
|
||||
* [PS/2 Mouse](feature_ps2_mouse.md)
|
||||
* [RGB Lighting](feature_rgblight.md)
|
||||
* [RGB Matrix](feature_rgb_matrix.md)
|
||||
* [Space Cadet](feature_space_cadet.md)
|
||||
* [Split Keyboard](feature_split_keyboard.md)
|
||||
* [Stenography](feature_stenography.md)
|
||||
* [Swap Hands](feature_swap_hands.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
* [Terminal](feature_terminal.md)
|
||||
* [Thermal Printer](feature_thermal_printer.md)
|
||||
* [Unicode](feature_unicode.md)
|
||||
* [Userspace](feature_userspace.md)
|
||||
* [Velocikey](feature_velocikey.md)
|
||||
* Configurator
|
||||
* [Overview](newbs_building_firmware_configurator.md)
|
||||
* [Step by Step](configurator_step_by_step.md)
|
||||
* [Troubleshooting](configurator_troubleshooting.md)
|
||||
* [Problems and Bugs](configurator_problems.md)
|
||||
* QMK API
|
||||
* [Overview](api_overview.md)
|
||||
* [API Documentation](api_docs.md)
|
||||
* [Keyboard Support](reference_configurator_support.md)
|
||||
|
||||
* For Makers and Modders
|
||||
* [Hand Wiring Guide](hand_wire.md)
|
||||
* [ISP Flashing Guide](isp_flashing_guide.md)
|
||||
* [ARM Debugging Guide](arm_debugging.md)
|
||||
* [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)
|
||||
* CLI
|
||||
* [Overview](cli.md)
|
||||
* [Configuration](cli_configuration.md)
|
||||
* [Commands](cli_commands.md)
|
||||
|
||||
* For a Deeper Understanding
|
||||
* [How Keyboards Work](how_keyboards_work.md)
|
||||
* [Understanding QMK](understanding_qmk.md)
|
||||
* Using QMK
|
||||
* Guides
|
||||
* [Customizing Functionality](custom_quantum_functions.md)
|
||||
* [Driver Installation with Zadig](driver_installation_zadig.md)
|
||||
* [Keymap Overview](keymap.md)
|
||||
* [Vagrant Guide](getting_started_vagrant.md)
|
||||
* Flashing
|
||||
* [Flashing](flashing.md)
|
||||
* [Flashing ATmega32A (ps2avrgb)](flashing_bootloadhid.md)
|
||||
* IDEs
|
||||
* [Using Eclipse with QMK](other_eclipse.md)
|
||||
* [Using VSCode with QMK](other_vscode.md)
|
||||
* Git Best Practices
|
||||
* [Introduction](newbs_git_best_practices.md)
|
||||
* [Your Fork](newbs_git_using_your_master_branch.md)
|
||||
* [Merge Conflicts](newbs_git_resolving_merge_conflicts.md)
|
||||
* [Fixing Your Branch](newbs_git_resynchronize_a_branch.md)
|
||||
* Keyboard Building
|
||||
* [Hand Wiring Guide](hand_wire.md)
|
||||
* [ISP Flashing Guide](isp_flashing_guide.md)
|
||||
|
||||
* Other Topics
|
||||
* [Using Eclipse with QMK](other_eclipse.md)
|
||||
* [Using VSCode with QMK](other_vscode.md)
|
||||
* [Support](support.md)
|
||||
* [Translating the QMK Docs](translating.md)
|
||||
* Simple Keycodes
|
||||
* [Full List](keycodes.md)
|
||||
* [Basic Keycodes](keycodes_basic.md)
|
||||
* [Layer Switching](feature_advanced_keycodes.md)
|
||||
* [Quantum Keycodes](quantum_keycodes.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
* [Defines](internals_defines.md)
|
||||
* [Input Callback Reg](internals_input_callback_reg.md)
|
||||
* [Midi Device](internals_midi_device.md)
|
||||
* [Midi Device Setup Process](internals_midi_device_setup_process.md)
|
||||
* [Midi Util](internals_midi_util.md)
|
||||
* [Send Functions](internals_send_functions.md)
|
||||
* [Sysex Tools](internals_sysex_tools.md)
|
||||
* Advanced Keycodes
|
||||
* [Command](feature_command.md)
|
||||
* [Dynamic Macros](feature_dynamic_macros.md)
|
||||
* [Grave Escape](feature_grave_esc.md)
|
||||
* [Leader Key](feature_leader_key.md)
|
||||
* [Mod-Tap](mod_tap.md)
|
||||
* [Macros](feature_macros.md)
|
||||
* [Mouse Keys](feature_mouse_keys.md)
|
||||
* [Space Cadet Shift](feature_space_cadet.md)
|
||||
* [US ANSI Shifted Keys](keycodes_us_ansi_shifted.md)
|
||||
|
||||
* Software Features
|
||||
* [Auto Shift](feature_auto_shift.md)
|
||||
* [Combos](feature_combo.md)
|
||||
* [Debounce API](feature_debounce_type.md)
|
||||
* [Key Lock](feature_key_lock.md)
|
||||
* [One Shot Keys](one_shot_keys.md)
|
||||
* [Pointing Device](feature_pointing_device.md)
|
||||
* [Swap Hands](feature_swap_hands.md)
|
||||
* [Tap Dance](feature_tap_dance.md)
|
||||
* [Tap-Hold Configuration](tap_hold.md)
|
||||
* [Terminal](feature_terminal.md)
|
||||
* [Unicode](feature_unicode.md)
|
||||
* [Userspace](feature_userspace.md)
|
||||
|
||||
* Hardware Features
|
||||
* Displays
|
||||
* [HD44780 LCD Controller](feature_hd44780.md)
|
||||
* [OLED Driver](feature_oled_driver.md)
|
||||
* Lighting
|
||||
* [Backlight](feature_backlight.md)
|
||||
* [LED Matrix](feature_led_matrix.md)
|
||||
* [RGB Lighting](feature_rgblight.md)
|
||||
* [RGB Matrix](feature_rgb_matrix.md)
|
||||
* [Audio](feature_audio.md)
|
||||
* [Bluetooth](feature_bluetooth.md)
|
||||
* [Bootmagic](feature_bootmagic.md)
|
||||
* [Custom Matrix](custom_matrix.md)
|
||||
* [DIP Switch](feature_dip_switch.md)
|
||||
* [Encoders](feature_encoders.md)
|
||||
* [Haptic Feedback](feature_haptic_feedback.md)
|
||||
* [Proton C Conversion](proton_c_conversion.md)
|
||||
* [PS/2 Mouse](feature_ps2_mouse.md)
|
||||
* [Split Keyboard](feature_split_keyboard.md)
|
||||
* [Stenography](feature_stenography.md)
|
||||
* [Thermal Printer](feature_thermal_printer.md)
|
||||
* [Velocikey](feature_velocikey.md)
|
||||
|
||||
* Developing QMK
|
||||
* Breaking Changes
|
||||
* [Overview](breaking_changes.md)
|
||||
* [My Pull Request Was Flagged](breaking_changes_instructions.md)
|
||||
* History
|
||||
* [2020 Feb 29](ChangeLog/20200229.md)
|
||||
* [2019 Aug 30](ChangeLog/20190830.md)
|
||||
|
||||
* C Development
|
||||
* [ARM Debugging Guide](arm_debugging.md)
|
||||
* [AVR Processors](hardware_avr.md)
|
||||
* [Coding Conventions](coding_conventions_c.md)
|
||||
* [Compatible Microcontrollers](compatible_microcontrollers.md)
|
||||
* [Drivers](hardware_drivers.md)
|
||||
* [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)
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
|
||||
* Python Development
|
||||
* [Coding Conventions](coding_conventions_python.md)
|
||||
* [QMK CLI Development](cli_development.md)
|
||||
* [QMK CLI Config](cli_dev_configuration.md)
|
||||
|
||||
* Configurator Development
|
||||
* QMK API
|
||||
* [Development Environment](api_development_environment.md)
|
||||
* [Architecture Overview](api_development_overview.md)
|
||||
|
||||
* QMK Reference
|
||||
* [Contributing to QMK](contributing.md)
|
||||
* [Translating the QMK Docs](translating.md)
|
||||
* [Config Options](config_options.md)
|
||||
* [Make Documentation](getting_started_make_guide.md)
|
||||
* [Documentation Best Practices](documentation_best_practices.md)
|
||||
* [Documentation Templates](documentation_templates.md)
|
||||
* [Community Layouts](feature_layouts.md)
|
||||
* [Unit Testing](unit_testing.md)
|
||||
* [Useful Functions](ref_functions.md)
|
||||
* [info.json Format](reference_info_json.md)
|
||||
|
||||
* For a Deeper Understanding
|
||||
* [How Keyboards Work](how_keyboards_work.md)
|
||||
* [How a Matrix Works](how_a_matrix_works.md)
|
||||
* [Understanding QMK](understanding_qmk.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
* [Defines](internals_defines.md)
|
||||
* [Input Callback Reg](internals_input_callback_reg.md)
|
||||
* [Midi Device](internals_midi_device.md)
|
||||
* [Midi Device Setup Process](internals_midi_device_setup_process.md)
|
||||
* [Midi Util](internals_midi_util.md)
|
||||
* [Send Functions](internals_send_functions.md)
|
||||
* [Sysex Tools](internals_sysex_tools.md)
|
||||
|
3
docs/api_development_environment.md
Normal file
3
docs/api_development_environment.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Development Environment Setup
|
||||
|
||||
To setup a development stack head over to the [qmk_web_stack](https://github.com/qmk/qmk_web_stack).
|
44
docs/api_development_overview.md
Normal file
44
docs/api_development_overview.md
Normal file
@ -0,0 +1,44 @@
|
||||
# QMK Compiler Development Guide
|
||||
|
||||
This page attempts to introduce developers to the QMK Compiler. It does not go into nitty gritty details- for that you should read code. What this will give you is a framework to hang your understanding on as you read the code.
|
||||
|
||||
# Overview
|
||||
|
||||
The QMK Compile API consists of a few movings parts:
|
||||
|
||||

|
||||
|
||||
API Clients interact exclusively with the API service. This is where they submit jobs, check status, and download results. The API service inserts compile jobs into [Redis Queue](https://python-rq.org) and checks both RQ and S3 for the results of those jobs.
|
||||
|
||||
Workers fetch new compile jobs from RQ, compile them, and then upload the source and the binary to an S3 compatible storage engine.
|
||||
|
||||
# Workers
|
||||
|
||||
QMK Compiler Workers are responsible for doing the actual building. When a worker pulls a job from RQ it does several things to complete that job:
|
||||
|
||||
* Make a fresh qmk_firmware checkout
|
||||
* Use the supplied layers and keyboard metadata to build a `keymap.c`
|
||||
* Build the firmware
|
||||
* Zip a copy of the source
|
||||
* Upload the firmware, source zip, and a metadata file to S3.
|
||||
* Report the status of the job to RQ
|
||||
|
||||
# API Service
|
||||
|
||||
The API service is a relatively simple Flask application. There are a few main views you should understand.
|
||||
|
||||
## @app.route('/v1/compile', methods=['POST'])
|
||||
|
||||
This is the main entrypoint for the API. A client's interaction starts here. The client POST's a JSON document describing their keyboard, and the API does some (very) basic validation of that JSON before submitting the compile job.
|
||||
|
||||
## @app.route('/v1/compile/<string:job_id>', methods=['GET'])
|
||||
|
||||
This is the most frequently called endpoint. It pulls the job details from redis, if they're still available, or the cached job details on S3 if they're not.
|
||||
|
||||
## @app.route('/v1/compile/<string:job_id>/download', methods=['GET'])
|
||||
|
||||
This method allows users to download the compiled firmware file.
|
||||
|
||||
## @app.route('/v1/compile/<string:job_id>/source', methods=['GET'])
|
||||
|
||||
This method allows users to download the source for their firmware.
|
68
docs/api_docs.md
Normal file
68
docs/api_docs.md
Normal file
@ -0,0 +1,68 @@
|
||||
# QMK API
|
||||
|
||||
This page describes using the QMK API. If you are an application developer you can use this API to compile firmware for any [QMK](https://qmk.fm) Keyboard.
|
||||
|
||||
## Overview
|
||||
|
||||
This service is an asynchronous API for compiling custom keymaps. You POST some JSON to the API, periodically check the status, and when your firmware has finished compiling you can download the resulting firmware and (if desired) source code for that firmware.
|
||||
|
||||
#### Example JSON Payload:
|
||||
|
||||
```json
|
||||
{
|
||||
"keyboard": "clueboard/66/rev2",
|
||||
"keymap": "my_awesome_keymap",
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
["KC_GRV","KC_1","KC_2","KC_3","KC_4","KC_5","KC_6","KC_7","KC_8","KC_9","KC_0","KC_MINS","KC_EQL","KC_GRV","KC_BSPC","KC_PGUP","KC_TAB","KC_Q","KC_W","KC_E","KC_R","KC_T","KC_Y","KC_U","KC_I","KC_O","KC_P","KC_LBRC","KC_RBRC","KC_BSLS","KC_PGDN","KC_CAPS","KC_A","KC_S","KC_D","KC_F","KC_G","KC_H","KC_J","KC_K","KC_L","KC_SCLN","KC_QUOT","KC_NUHS","KC_ENT","KC_LSFT","KC_NUBS","KC_Z","KC_X","KC_C","KC_V","KC_B","KC_N","KC_M","KC_COMM","KC_DOT","KC_SLSH","KC_RO","KC_RSFT","KC_UP","KC_LCTL","KC_LGUI","KC_LALT","KC_MHEN","KC_SPC","KC_SPC","KC_HENK","KC_RALT","KC_RCTL","MO(1)","KC_LEFT","KC_DOWN","KC_RIGHT"],
|
||||
["KC_ESC","KC_F1","KC_F2","KC_F3","KC_F4","KC_F5","KC_F6","KC_F7","KC_F8","KC_F9","KC_F10","KC_F11","KC_F12","KC_TRNS","KC_DEL","BL_STEP","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","_______","KC_TRNS","KC_PSCR","KC_SLCK","KC_PAUS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","MO(2)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_PGUP","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","MO(1)","KC_LEFT","KC_PGDN","KC_RGHT"],
|
||||
["KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","RESET","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","MO(2)","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","KC_TRNS","MO(1)","KC_TRNS","KC_TRNS","KC_TRNS"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
As you can see the payload describes all aspects of a keyboard necessary to create and generate a firmware. Each layer is a single list of QMK keycodes the same length as the keyboard's `LAYOUT` macro. If a keyboard supports mulitple `LAYOUT` macros you can specify which macro to use.
|
||||
|
||||
## Submitting a Compile Job
|
||||
|
||||
To compile your keymap into a firmware simply POST your JSON to the `/v1/compile` endpoint. In the following example we've placed the JSON payload into a file named `json_data`.
|
||||
|
||||
```
|
||||
$ curl -H "Content-Type: application/json" -X POST -d "$(< json_data)" http://api.qmk.fm/v1/compile
|
||||
{
|
||||
"enqueued": true,
|
||||
"job_id": "ea1514b3-bdfc-4a7b-9b5c-08752684f7f6"
|
||||
}
|
||||
```
|
||||
|
||||
## Checking The Status
|
||||
|
||||
After submitting your keymap you can check the status using a simple HTTP GET call:
|
||||
|
||||
```
|
||||
$ curl http://api.qmk.fm/v1/compile/ea1514b3-bdfc-4a7b-9b5c-08752684f7f6
|
||||
{
|
||||
"created_at": "Sat, 19 Aug 2017 21:39:12 GMT",
|
||||
"enqueued_at": "Sat, 19 Aug 2017 21:39:12 GMT",
|
||||
"id": "f5f9b992-73b4-479b-8236-df1deb37c163",
|
||||
"status": "running",
|
||||
"result": null
|
||||
}
|
||||
```
|
||||
|
||||
This shows us that the job has made it through the queue and is currently running. There are 5 possible statuses:
|
||||
|
||||
* **failed**: Something about the compiling service has broken.
|
||||
* **finished**: The compilation is complete and you should check `result` to see the results.
|
||||
* **queued**: The keymap is waiting for a compilation server to become available.
|
||||
* **running**: The compilation is in progress and should be complete soon.
|
||||
* **unknown**: A serious error has occurred and you should [file a bug](https://github.com/qmk/qmk_compiler/issues).
|
||||
|
||||
## Examining Finished Results
|
||||
|
||||
Once your compile job has finished you'll check the `result` key. The value of this key is a hash containing several key bits of information:
|
||||
|
||||
* `firmware_binary_url`: A list of URLs for the the flashable firmware
|
||||
* `firmware_keymap_url`: A list of URLs for the the `keymap.c`
|
||||
* `firmware_source_url`: A list of URLs for the full firmware source code
|
||||
* `output`: The stdout and stderr for this compile job. Errors will be found here.
|
15
docs/api_overview.md
Normal file
15
docs/api_overview.md
Normal file
@ -0,0 +1,15 @@
|
||||
# QMK API
|
||||
|
||||
The QMK API provides an asynchronous API that Web and GUI tools can use to compile arbitrary keymaps for any keyboard supported by [QMK](http://qmk.fm/). The stock keymap template supports all QMK keycodes that do not require supporting C code. Keyboard maintainers can supply their own custom templates to enable more functionality.
|
||||
|
||||
## App Developers
|
||||
|
||||
If you are an app developer interested in using this API in your application you should head over to [Using The API](api_docs.md).
|
||||
|
||||
## Keyboard Maintainers
|
||||
|
||||
If you would like to enhance your keyboard's support in the QMK Compiler API head over to the [Keyboard Support](reference_configurator_support.md) section.
|
||||
|
||||
## Backend Developers
|
||||
|
||||
If you are interested in working on the API itself you should start by setting up a [Development Environment](api_development_environment.md), then check out [Hacking On The API](api_development_overview.md).
|
@ -1,9 +0,0 @@
|
||||
# Becoming a QMK Collaborator
|
||||
|
||||
A QMK collaborator is a keyboard maker or designer that is interested in helping QMK grow and fully support their keyboard(s), and encouraging their users and customers to submit features, ideas, and keymaps. We're always looking to add more keyboards and collaborators, but we ask that they fulfill these requirements:
|
||||
|
||||
* **Have a PCB available for sale.** Unfortunately there's just too much variation and complications with handwired keyboards.
|
||||
* **Maintain your keyboard in QMK.** This may just require an initial setup to get your keyboard working, but it could also include accommodating changes made to QMK's core that might break or render any custom code redundant.
|
||||
* **Approve and merge keymap pull requests for your keyboard.** We like to encourage users to contribute their keymaps for others to see and work from when creating their own.
|
||||
|
||||
If you feel you meet these requirements, shoot us an email at hello@qmk.fm with an introduction and some links to your keyboard!
|
@ -167,8 +167,7 @@ $ qmk compile -kb dz60
|
||||
## `qmk flash`
|
||||
|
||||
This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default.
|
||||
To specify a different bootloader, use `-bl <bootloader>`. Visit <https://docs.qmk.fm/#/flashing>
|
||||
for more details of the available bootloaders.
|
||||
To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing.md) guide for more details of the available bootloaders.
|
||||
|
||||
**Usage for Configurator Exports**:
|
||||
|
||||
|
@ -4,7 +4,7 @@ This document explains how `qmk config` works.
|
||||
|
||||
# Introduction
|
||||
|
||||
Configuration for QMK CLI is a key/value system. Each key consists of a subcommand and an argument name separated by a period. This allows for a straightforward and direct translation between config keys and the arguments they set.
|
||||
Configuration for the QMK CLI is a key/value system. Each key consists of a subcommand and an argument name separated by a period. This allows for a straightforward and direct translation between config keys and the arguments they set.
|
||||
|
||||
## Simple Example
|
||||
|
@ -136,22 +136,22 @@ If you define these options you will enable the associated feature, which may in
|
||||
* enables handling for per key `TAPPING_TERM` settings
|
||||
* `#define RETRO_TAPPING`
|
||||
* tap anyway, even after TAPPING_TERM, if there was no other key interruption between press and release
|
||||
* See [Retro Tapping](feature_advanced_keycodes.md#retro-tapping) for details
|
||||
* See [Retro Tapping](tap_hold.md#retro-tapping) for details
|
||||
* `#define TAPPING_TOGGLE 2`
|
||||
* how many taps before triggering the toggle
|
||||
* `#define PERMISSIVE_HOLD`
|
||||
* makes tap and hold keys trigger the hold if another key is pressed before releasing, even if it hasn't hit the `TAPPING_TERM`
|
||||
* See [Permissive Hold](feature_advanced_keycodes.md#permissive-hold) for details
|
||||
* See [Permissive Hold](tap_hold.md#permissive-hold) for details
|
||||
* `#define PERMISSIVE_HOLD_PER_KEY`
|
||||
* enabled handling for per key `PERMISSIVE_HOLD` settings
|
||||
* `#define IGNORE_MOD_TAP_INTERRUPT`
|
||||
* makes it possible to do rolling combos (zx) with keys that convert to other keys on hold, by enforcing the `TAPPING_TERM` for both keys.
|
||||
* See [Mod tap interrupt](feature_advanced_keycodes.md#ignore-mod-tap-interrupt) for details
|
||||
* See [Ignore Mod Tap Interrupt](tap_hold.md#ignore-mod-tap-interrupt) for details
|
||||
* `#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY`
|
||||
* enables handling for per key `IGNORE_MOD_TAP_INTERRUPT` settings
|
||||
* `#define TAPPING_FORCE_HOLD`
|
||||
* makes it possible to use a dual role key as modifier shortly after having been tapped
|
||||
* See [Hold after tap](feature_advanced_keycodes.md#tapping-force-hold)
|
||||
* See [Tapping Force Hold](tap_hold.md#tapping-force-hold)
|
||||
* Breaks any Tap Toggle functionality (`TT` or the One Shot Tap Toggle)
|
||||
* `#define TAPPING_FORCE_HOLD_PER_KEY`
|
||||
* enables handling for per key `TAPPING_FORCE_HOLD` settings
|
||||
@ -335,7 +335,7 @@ This is a [make](https://www.gnu.org/software/make/manual/make.html) file that i
|
||||
* `bootloadHID`
|
||||
* `USBasp`
|
||||
|
||||
## Feature Options
|
||||
## Feature Options :id=feature-options
|
||||
|
||||
Use these to enable or disable building certain features. The more you have enabled the bigger your firmware will be, and you run the risk of building a firmware too large for your MCU.
|
||||
|
||||
|
58
docs/configurator_step_by_step.md
Normal file
58
docs/configurator_step_by_step.md
Normal file
@ -0,0 +1,58 @@
|
||||
# QMK Configurator: Step by Step
|
||||
|
||||
This page describes the steps for building your firmware in QMK Configurator.
|
||||
|
||||
## Step 1: Select Your Keyboard
|
||||
|
||||
Click the drop down box and select the keyboard you want to create a keymap for.
|
||||
|
||||
?> If your keyboard has several versions, make sure you select the correct one.
|
||||
|
||||
I'll say that again because it's important:
|
||||
|
||||
!> **MAKE SURE YOU SELECT THE RIGHT VERSION!**
|
||||
|
||||
If your keyboard has been advertised to be powered by QMK but is not in the list, chances are a developer hasn't gotten to it yet or we haven't had a chance to merge it in yet. File an issue at [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) requesting to support that particular keyboard, if there is no active [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) for it. There are also QMK powered keyboards that are in their manufacturer's own github accounts. Double check for that as well. <!-- FIXME(skullydazed): This feels too wordy and I'm not sure we want to encourage these kinds of issues. Also, should we prompt them to bug the manufacutrer? -->
|
||||
|
||||
## Step 2: Select Your Keyboard Layout
|
||||
|
||||
Choose the layout that best represents the keymap you want to create. Some keyboards do not have enough layouts or correct layouts defined yet. They will be supported in the future.
|
||||
|
||||
!> Sometimes there isn't a layout that supports your exact build. In that case select `LAYOUT_all`.
|
||||
|
||||
## Step 3: Name Your Keymap
|
||||
|
||||
Call this keymap what you want.
|
||||
|
||||
?> If you are running into issues when compiling, it may be worth changing this name, as it may already exist in the QMK Firmware repo.
|
||||
|
||||
## Step 4: Define Your Keymap
|
||||
|
||||
Keycode Entry is accomplished in one of 3 ways:
|
||||
|
||||
1. Drag and drop
|
||||
2. Clicking on an empty spot on the layout, then clicking the keycode you desire
|
||||
3. Clicking on an empty spot on the layout, then pressing the physical key on your keyboard
|
||||
|
||||
?> Hover your mouse over a key and a short blurb will tell you what that keycode does. For a more verbose description please see:
|
||||
|
||||
* [Basic Keycode Reference](keycodes_basic.md)
|
||||
* [Advanced Keycode Reference](feature_advanced_keycodes.md)
|
||||
|
||||
!> If your selected layout doesn't match your physical build leave the unused keys blank. If you're not sure which key is in use, for example you have a one backspace key but `LAYOUT_all` has 2 keys, put the same keycode in both locations.
|
||||
|
||||
## Step 5: Save Your Keymap for Future Changes
|
||||
|
||||
When you're satisfied with your keymap or just want to work on it later, press the `Export Keymap` button. It will save your keymap to your computer. You can then load this .json file in the future by pressing the `Import Keymap` button.
|
||||
|
||||
!> **CAUTION:** This is not the same type of .json file used for kbfirmware.com or any other tool. If you try to use this for those tools, or the .json from those tools with QMK Configurator, you will encounter problems.
|
||||
|
||||
## Step 6: Compile Your Firmware File
|
||||
|
||||
Press the green `Compile` button.
|
||||
|
||||
When the compilation is done, you will be able to press the green `Download Firmware` button.
|
||||
|
||||
## Next steps: Flashing Your Keyboard
|
||||
|
||||
Please refer to [Flashing Firmware](newbs_flashing.md).
|
26
docs/configurator_troubleshooting.md
Normal file
26
docs/configurator_troubleshooting.md
Normal file
@ -0,0 +1,26 @@
|
||||
# Configurator Troubleshooting
|
||||
|
||||
## My .json file is not working
|
||||
|
||||
If the .json file was generated with QMK Configurator, congratulations you have stumbled upon a bug. File an issue at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues).
|
||||
|
||||
If not... how did you miss the big bold message at the top saying not to use other .json files?
|
||||
|
||||
## There are extra spaces in my layout? What do I do?
|
||||
|
||||
If you're referring to having three spots for space bar, the best course of action is to just fill them all with Space. The same can be done for Backspace and Shift keys.
|
||||
|
||||
## What is the keycode for...
|
||||
|
||||
Please see:
|
||||
|
||||
* [Basic Keycode Reference](keycodes_basic.md)
|
||||
* [Advanced Keycode Reference](feature_advanced_keycodes.md)
|
||||
|
||||
## It won't compile
|
||||
|
||||
Please double check the other layers of your keymap to make sure there are no random keys present.
|
||||
|
||||
## Problems and Bugs
|
||||
|
||||
We are always accepting customer requests and bug reports. Please file them at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues).
|
@ -101,7 +101,7 @@ enum my_keycodes {
|
||||
};
|
||||
```
|
||||
|
||||
### Previewing the Documentation
|
||||
### Previewing the Documentation :id=previewing-the-documentation
|
||||
|
||||
Before opening a pull request, you can preview your changes if you have set up the development environment by running this command from the `qmk_firmware/` folder:
|
||||
|
||||
|
@ -4,7 +4,7 @@ For a lot of people a custom keyboard is about more than sending button presses
|
||||
|
||||
This page does not assume any special knowledge about QMK, but reading [Understanding QMK](understanding_qmk.md) will help you understand what is going on at a more fundamental level.
|
||||
|
||||
## A Word on Core vs Keyboards vs Keymap
|
||||
## A Word on Core vs Keyboards vs Keymap :id=a-word-on-core-vs-keyboards-vs-keymap
|
||||
|
||||
We have structured QMK as a hierarchy:
|
||||
|
||||
@ -34,7 +34,7 @@ enum my_keycodes {
|
||||
};
|
||||
```
|
||||
|
||||
## Programming the Behavior of Any Keycode
|
||||
## Programming the Behavior of Any Keycode :id=programming-the-behavior-of-any-keycode
|
||||
|
||||
When you want to override the behavior of an existing key, or define the behavior for a new key, you should use the `process_record_kb()` and `process_record_user()` functions. These are called by QMK during key processing before the actual key event is handled. If these functions return `true` QMK will process the keycodes as usual. That can be handy for extending the functionality of a key rather than replacing it. If these functions return `false` QMK will skip the normal key handling, and it will be up to you to send any key up or down events that are required.
|
||||
|
||||
@ -313,7 +313,7 @@ void suspend_wakeup_init_user(void) {
|
||||
* Keyboard/Revision: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||
* Keymap: `void suspend_power_down_kb(void)` and `void suspend_wakeup_init_user(void)`
|
||||
|
||||
# Layer Change Code
|
||||
# Layer Change Code :id=layer-change-code
|
||||
|
||||
This runs code every time that the layers get changed. This can be useful for layer indication, or custom layer handling.
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
||||
* [Macros](de/feature_macros.md)
|
||||
* [Mouse Keys](de/feature_mouse_keys.md)
|
||||
* [OLED Driver](de/feature_oled_driver.md)
|
||||
* [One Shot Keys](de/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [One Shot Keys](de/one_shot_keys.md)
|
||||
* [Pointing Device](de/feature_pointing_device.md)
|
||||
* [PS/2 Mouse](de/feature_ps2_mouse.md)
|
||||
* [RGB Lighting](de/feature_rgblight.md)
|
||||
@ -108,7 +108,7 @@
|
||||
* Andere Themen
|
||||
* [Eclipse mit QMK](de/other_eclipse.md)
|
||||
* [VSCode mit QMK](de/other_vscode.md)
|
||||
* [Support](de/support.md)
|
||||
* [Support](de/getting_started_getting_help.md)
|
||||
* [Übersetzungen](de/translating.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
This page documents the templates you should use when submitting new Keymaps and Keyboards to QMK.
|
||||
|
||||
## Keymap `readme.md` Template
|
||||
## Keymap `readme.md` Template :id=keyboard-readmemd-template
|
||||
|
||||
Most keymaps have an image depicting the layout. You can use [Keyboard Layout Editor](http://keyboard-layout-editor.com) to create an image. Upload it to [Imgur](http://imgur.com) or another hosting service, please do not include images in your Pull Request.
|
||||
|
||||
|
@ -77,7 +77,7 @@
|
||||
* [Macros](es/feature_macros.md)
|
||||
* [Teclas del ratón](es/feature_mouse_keys.md)
|
||||
* [Driver OLED](es/feature_oled_driver.md)
|
||||
* [Teclas One Shot](es/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [Teclas One Shot](es/one_shot_keys.md)
|
||||
* [Dispositivo de apuntado](es/feature_pointing_device.md)
|
||||
* [Ratón PS/2](es/feature_ps2_mouse.md)
|
||||
* [Iluminación RGB](es/feature_rgblight.md)
|
||||
@ -108,7 +108,7 @@
|
||||
* Otros temas
|
||||
* [Usando Eclipse con QMK](es/other_eclipse.md)
|
||||
* [Usando VSCode con QMK](es/other_vscode.md)
|
||||
* [Soporte](es/support.md)
|
||||
* [Soporte](es/getting_started_getting_help.md)
|
||||
* [Cómo añadir traducciones](es/translating.md)
|
||||
|
||||
* QMK Internals (En progreso)
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Llegar a ser un colaborador QMK
|
||||
|
||||
Un colaborador QMK es un maker o diseñador de teclados que tiene interés en ayudar a QMK a crecer y mantener sus teclado(s), y alentar a los usuarios y clientes a presentar herramientas, ideas, y keymaps. Siempre procuramos agregar más teclados y colaboradores, pero pedimos que cumplan los siguientes requisitos:
|
||||
|
||||
* **Tener un PCB disponible a la venta.** Desafortunadamente, hay demasiada variación y complicaciones con teclados cableados a mano.
|
||||
* **Realizar el mantenimiento de tu teclado en QMK.** Este podría requirir un setup inicial para hacer que tu teclado funcione, pero también podría incluir adaptarse a cambios hecho al base de QMK que podrían descomponer o rendir código superfluo.
|
||||
* **Aprobar e incorporar pull requests de keymaps para tu teclado.** Nos gusta alentar a los usuarios a contribuir sus keymaps para que otros los vean y los puedan usar para crear sus propios.
|
||||
|
||||
Si sientes que cumples los requisitos, ¡mándanos un email a hello@qmk.fm con una introducción y algunos enlaces para tu teclado!
|
@ -4,7 +4,7 @@ El [Configurador QMK](https://config.qmk.fm) es un entorno gráfico online que g
|
||||
|
||||
?> **Por favor sigue estos pasos en orden.**
|
||||
|
||||
Ve el [Video tutorial](https://youtu.be/tx54jkRC9ZY)
|
||||
Ve el [Video tutorial](https://www.youtube.com/watch?v=-imgglzDMdY)
|
||||
|
||||
El Configurador QMK functiona mejor con Chrome/Firefox.
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
# Frequently Asked Questions
|
||||
|
||||
* [General](faq_general.md)
|
||||
* [Building or Compiling QMK](faq_build.md)
|
||||
* [Debugging and Troubleshooting QMK](faq_debug.md)
|
||||
* [Keymap](faq_keymap.md)
|
@ -4,6 +4,44 @@
|
||||
|
||||
[QMK](https://github.com/qmk), short for Quantum Mechanical Keyboard, is a group of people building tools for custom keyboards. We started with the [QMK firmware](https://github.com/qmk/qmk_firmware), a heavily modified fork of [TMK](https://github.com/tmk/tmk_keyboard).
|
||||
|
||||
## I don't know where to start!
|
||||
|
||||
If this is the case, then you should start with our [Newbs Guide](newbs.md). There is a lot of great info there, and that should cover everything you need to get started.
|
||||
|
||||
If that's an issue, hop onto the [QMK Configurator](https://config.qmk.fm), as that will handle a majority of what you need there.
|
||||
|
||||
## How can I flash the firmware I built?
|
||||
|
||||
First, head to the [Compiling/Flashing FAQ Page](faq_build.md). There is a good deal of info there, and you'll find a bunch of solutions to common issues there.
|
||||
|
||||
## What if I have an issue that isn't covered here?
|
||||
|
||||
Okay, that's fine. Then please check the [open issues in our GitHub](https://github.com/qmk/qmk_firmware/issues) to see if somebody is experiencing the same thing (make sure it's not just similar, but actually the same).
|
||||
|
||||
If you can't find anything, then please open a [new issue](https://github.com/qmk/qmk_firmware/issues/new)!
|
||||
|
||||
## What if I found a bug?
|
||||
|
||||
Then please open an [issue](https://github.com/qmk/qmk_firmware/issues/new), and if you know how to fix it, open up a Pull Request on GitHub with the fix.
|
||||
|
||||
## But `git` and `GitHub` are intimidating!
|
||||
|
||||
Don't worry, we have some pretty nice [Guidelines](newbs_git_best_practices.md) on how to start using `git` and GitHub to make things easier to develop.
|
||||
|
||||
Additionally, you can find additional `git` and GitHub related links [here](newbs_learn_more_resources.md).
|
||||
|
||||
## I have a Keyboard that I want to add support for
|
||||
|
||||
Awesome! Open up a Pull Request for it. We'll review the code, and merge it!
|
||||
|
||||
### What if I want to do brand it with `QMK`?
|
||||
|
||||
That's amazing! We would love to assist you with that!
|
||||
|
||||
In fact, we have a [whole page](https://qmk.fm/powered/) dedicated to adding QMK Branding to your page and keyboard. This covers pretty much everything you need (knowledge and images) to officially support QMK.
|
||||
|
||||
If you have any questions about this, open an issue or head to [Discord](https://discord.gg/Uq7gcHh).
|
||||
|
||||
## What Differences Are There Between QMK and TMK?
|
||||
|
||||
TMK was originally designed and implemented by [Jun Wako](https://github.com/tmk). QMK started as [Jack Humbert](https://github.com/jackhumbert)'s fork of TMK for the Planck. After a while Jack's fork had diverged quite a bit from TMK, and in 2015 Jack decided to rename his fork to QMK.
|
||||
|
@ -14,6 +14,17 @@ There are 3 standard keyboard layouts in use around the world- ANSI, ISO, and JI
|
||||
<!-- Source for this image: http://www.keyboard-layout-editor.com/#/gists/bf431647d1001cff5eff20ae55621e9a -->
|
||||

|
||||
|
||||
## How Can I Make Custom Names For Complex Keycodes?
|
||||
|
||||
Sometimes, for readability's sake, it's useful to define custom names for some keycodes. People often define custom names using `#define`. For example:
|
||||
|
||||
```c
|
||||
#define FN_CAPS LT(_FL, KC_CAPSLOCK)
|
||||
#define ALT_TAB LALT(KC_TAB)
|
||||
```
|
||||
|
||||
This will allow you to use `FN_CAPS` and `ALT_TAB` in your keymap, keeping it more readable.
|
||||
|
||||
## Some Of My Keys Are Swapped Or Not Working
|
||||
|
||||
QMK has two features, Bootmagic and Command, which allow you to change the behavior of your keyboard on the fly. This includes, but is not limited to, swapping Ctrl/Caps, disabling Gui, swapping Alt/Gui, swapping Backspace/Backslash, disabling all keys, and other behavioral modifications.
|
||||
|
@ -1,25 +1,4 @@
|
||||
# Advanced Keycodes
|
||||
|
||||
Your keymap can include keycodes that are more advanced than normal, for example keys that switch layers or send modifiers when held, but send regular keycodes when tapped. This page documents the functions that are available to you.
|
||||
|
||||
## Assigning Custom Names
|
||||
|
||||
People often define custom names using `#define`. For example:
|
||||
|
||||
```c
|
||||
#define FN_CAPS LT(_FL, KC_CAPSLOCK)
|
||||
#define ALT_TAB LALT(KC_TAB)
|
||||
```
|
||||
|
||||
This will allow you to use `FN_CAPS` and `ALT_TAB` in your keymap, keeping it more readable.
|
||||
|
||||
## Caveats
|
||||
|
||||
Currently, `LT()` and `MT()` are limited to the [Basic Keycode set](keycodes_basic.md), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. Modifiers specified as part of a Layer Tap or Mod Tap's keycode will be ignored. If you need to apply modifiers to your tapped keycode, [Tap Dance](feature_tap_dance.md#example-5-using-tap-dance-for-advanced-mod-tap-and-layer-tap-keys) can be used to accomplish this.
|
||||
|
||||
Additionally, if at least one right-handed modifier is specified in a Mod Tap or Layer Tap, it will cause all modifiers specified to become right-handed, so it is not possible to mix and match the two.
|
||||
|
||||
# Switching and Toggling Layers
|
||||
# Switching and Toggling Layers :id=switching-and-toggling-layers
|
||||
|
||||
These functions allow you to activate layers in various ways. Note that layers are not generally independent layouts -- multiple layers can be activated at once, and it's typical for layers to use `KC_TRNS` to allow keypresses to pass through to lower layers. For a detailed explanation of layers, see [Keymap Overview](keymap.md#keymap-and-layers). When using momentary layer switching with MO(), LM(), TT(), or LT(), make sure to leave the key on the above layers transparent or it may not work as intended.
|
||||
|
||||
@ -27,11 +6,17 @@ These functions allow you to activate layers in various ways. Note that layers a
|
||||
* `MO(layer)` - momentarily activates *layer*. As soon as you let go of the key, the layer is deactivated.
|
||||
* `LM(layer, mod)` - Momentarily activates *layer* (like `MO`), but with modifier(s) *mod* active. Only supports layers 0-15 and the left modifiers: `MOD_LCTL`, `MOD_LSFT`, `MOD_LALT`, `MOD_LGUI` (note the use of `MOD_` constants instead of `KC_`). These modifiers can be combined using bitwise OR, e.g. `LM(_RAISE, MOD_LCTL | MOD_LALT)`.
|
||||
* `LT(layer, kc)` - momentarily activates *layer* when held, and sends *kc* when tapped. Only supports layers 0-15.
|
||||
* `OSL(layer)` - momentarily activates *layer* until the next key is pressed. See [One Shot Keys](#one-shot-keys) for details and additional functionality.
|
||||
* `OSL(layer)` - momentarily activates *layer* until the next key is pressed. See [One Shot Keys](one_shot_keys.md) for details and additional functionality.
|
||||
* `TG(layer)` - toggles *layer*, activating it if it's inactive and vice versa
|
||||
* `TO(layer)` - activates *layer* and de-activates all other layers (except your default layer). This function is special, because instead of just adding/removing one layer to your active layer stack, it will completely replace your current active layers, uniquely allowing you to replace higher layers with a lower one. This is activated on keydown (as soon as the key is pressed).
|
||||
* `TT(layer)` - Layer Tap-Toggle. If you hold the key down, *layer* is activated, and then is de-activated when you let go (like `MO`). If you repeatedly tap it, the layer will be toggled on or off (like `TG`). It needs 5 taps by default, but you can change this by defining `TAPPING_TOGGLE` -- for example, `#define TAPPING_TOGGLE 2` to toggle on just two taps.
|
||||
|
||||
## Caveats
|
||||
|
||||
Currently, `LT()` and `MT()` are limited to the [Basic Keycode set](keycodes_basic.md), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. Modifiers specified as part of a Layer Tap or Mod Tap's keycode will be ignored. If you need to apply modifiers to your tapped keycode, [Tap Dance](feature_tap_dance.md#example-5-using-tap-dance-for-advanced-mod-tap-and-layer-tap-keys) can be used to accomplish this.
|
||||
|
||||
Additionally, if at least one right-handed modifier is specified in a Mod Tap or Layer Tap, it will cause all modifiers specified to become right-handed, so it is not possible to mix and match the two.
|
||||
|
||||
# Working with Layers
|
||||
|
||||
Care must be taken when switching layers, it's possible to lock yourself into a layer with no way to deactivate that layer (without unplugging your keyboard.) We've created some guidelines to help users avoid the most common problems.
|
||||
@ -56,7 +41,7 @@ Layers stack on top of each other in numerical order. When determining what a ke
|
||||
|
||||
Sometimes, you might want to switch between layers in a macro or as part of a tap dance routine. `layer_on` activates a layer, and `layer_off` deactivates it. More layer-related functions can be found in [action_layer.h](https://github.com/qmk/qmk_firmware/blob/master/tmk_core/common/action_layer.h).
|
||||
|
||||
# Modifier Keys
|
||||
# Modifier Keys :id=modifier-keys
|
||||
|
||||
These allow you to combine a modifier with a keycode. When pressed, the keydown event for the modifier, then `kc` will be sent. On release, the keyup event for `kc`, then the modifier will be sent.
|
||||
|
||||
@ -78,308 +63,18 @@ These allow you to combine a modifier with a keycode. When pressed, the keydown
|
||||
|
||||
You can also chain them, for example `LCTL(LALT(KC_DEL))` makes a key that sends Control+Alt+Delete with a single keypress.
|
||||
|
||||
# Mod-Tap
|
||||
# Legacy Content
|
||||
|
||||
The Mod-Tap key `MT(mod, kc)` acts like a modifier when held, and a regular keycode when tapped. In other words, you can have a key that sends Escape when you tap it, but functions as a Control or Shift key when you hold it down.
|
||||
This page used to encompass a large set of features. We have moved many sections that used to be part of this page to their own pages. Everything below this point is simply a redirect so that people following old links on the web find what they're looking for.
|
||||
|
||||
The modifiers this keycode and `OSM()` accept are prefixed with `MOD_`, not `KC_`:
|
||||
## Mod-Tap :id=mod-tap
|
||||
|
||||
|Modifier |Description |
|
||||
|----------|----------------------------------------|
|
||||
|`MOD_LCTL`|Left Control |
|
||||
|`MOD_LSFT`|Left Shift |
|
||||
|`MOD_LALT`|Left Alt |
|
||||
|`MOD_LGUI`|Left GUI (Windows/Command/Meta key) |
|
||||
|`MOD_RCTL`|Right Control |
|
||||
|`MOD_RSFT`|Right Shift |
|
||||
|`MOD_RALT`|Right Alt (AltGr) |
|
||||
|`MOD_RGUI`|Right GUI (Windows/Command/Meta key) |
|
||||
|`MOD_HYPR`|Hyper (Left Control, Shift, Alt and GUI)|
|
||||
|`MOD_MEH` |Meh (Left Control, Shift, and Alt) |
|
||||
* [Mod-Tap](mod_tap.md)
|
||||
|
||||
You can combine these by ORing them together like so:
|
||||
## One Shot Keys :id=one-shot-keys
|
||||
|
||||
```c
|
||||
MT(MOD_LCTL | MOD_LSFT, KC_ESC)
|
||||
```
|
||||
* [One Shot Keys](one_shot_keys.md)
|
||||
|
||||
This key would activate Left Control and Left Shift when held, and send Escape when tapped.
|
||||
## Tap-Hold Configuration Options :id=tap-hold-configuration-options
|
||||
|
||||
For convenience, QMK includes some Mod-Tap shortcuts to make common combinations more compact in your keymap:
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------|-----------------------------------------------------------------|-------------------------------------------------------|
|
||||
|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
|
||||
|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
|
||||
|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
|
||||
|`LGUI_T(kc)`|`LCMD_T(kc)`, `LWIN_T(kc)`, `GUI_T(kc)`, `CMD_T(kc)`, `WIN_T(kc)`|Left GUI when held, `kc` when tapped |
|
||||
|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
|
||||
|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
|
||||
|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
|
||||
|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
|
||||
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|
||||
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
|
||||
|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
|
||||
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|
||||
|`HYPR_T(kc)`|`ALL_T(kc)` |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|
||||
## Caveats
|
||||
|
||||
Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
|
||||
|
||||
Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
|
||||
|
||||
To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
|
||||
|
||||
# One Shot Keys
|
||||
|
||||
One shot keys are keys that remain active until the next key is pressed, and then are released. This allows you to type keyboard combinations without pressing more than one key at a time. These keys are usually called "Sticky keys" or "Dead keys".
|
||||
|
||||
For example, if you define a key as `OSM(MOD_LSFT)`, you can type a capital A character by first pressing and releasing shift, and then pressing and releasing A. Your computer will see the shift key being held the moment shift is pressed, and it will see the shift key being released immediately after A is released.
|
||||
|
||||
One shot keys also work as normal modifiers. If you hold down a one shot key and type other keys, your one shot will be released immediately after you let go of the key.
|
||||
|
||||
Additionally, hitting keys five times in a short period will lock that key. This applies for both One Shot Modifiers and One Shot Layers, and is controlled by the `ONESHOT_TAP_TOGGLE` define.
|
||||
|
||||
You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
|
||||
```c
|
||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */
|
||||
#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.
|
||||
* `OSL(layer)` - momentary switch to *layer*.
|
||||
|
||||
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
|
||||
|
||||
For one shot layers, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`.
|
||||
|
||||
For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear_oneshot_mods()` to cancel it.
|
||||
|
||||
!> If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop.
|
||||
|
||||
## Callbacks
|
||||
|
||||
When you'd like to perform custom logic when pressing a one shot key, there are several callbacks you can choose to implement. You could indicate changes in one shot keys by flashing an LED or making a sound, for example.
|
||||
|
||||
There is a callback for `OSM(mod)`. It is called whenever the state of any one shot modifier key is changed: when it toggles on, but also when it is toggled off. You can use it like this:
|
||||
|
||||
```c
|
||||
void oneshot_mods_changed_user(uint8_t mods) {
|
||||
if (mods & MOD_MASK_SHIFT) {
|
||||
println("Oneshot mods SHIFT");
|
||||
}
|
||||
if (mods & MOD_MASK_CTRL) {
|
||||
println("Oneshot mods CTRL");
|
||||
}
|
||||
if (mods & MOD_MASK_ALT) {
|
||||
println("Oneshot mods ALT");
|
||||
}
|
||||
if (mods & MOD_MASK_GUI) {
|
||||
println("Oneshot mods GUI");
|
||||
}
|
||||
if (!mods) {
|
||||
println("Oneshot mods off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `mods` argument contains the active mods after the change, so it reflects the current state.
|
||||
|
||||
When you use One Shot Tap Toggle (by adding `#define ONESHOT_TAP_TOGGLE 2` in your `config.h` file), you may lock a modifier key by pressing it the specified amount of times. There's a callback for that, too:
|
||||
|
||||
```c
|
||||
void oneshot_locked_mods_changed_user(uint8_t mods) {
|
||||
if (mods & MOD_MASK_SHIFT) {
|
||||
println("Oneshot locked mods SHIFT");
|
||||
}
|
||||
if (mods & MOD_MASK_CTRL) {
|
||||
println("Oneshot locked mods CTRL");
|
||||
}
|
||||
if (mods & MOD_MASK_ALT) {
|
||||
println("Oneshot locked mods ALT");
|
||||
}
|
||||
if (mods & MOD_MASK_GUI) {
|
||||
println("Oneshot locked mods GUI");
|
||||
}
|
||||
if (!mods) {
|
||||
println("Oneshot locked mods off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Last, there is also a callback for the `OSL(layer)` one shot key:
|
||||
|
||||
```c
|
||||
void oneshot_layer_changed_user(uint8_t layer) {
|
||||
if (layer == 1) {
|
||||
println("Oneshot layer 1 on");
|
||||
}
|
||||
if (!layer) {
|
||||
println("Oneshot layer off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If any one shot layer is switched off, `layer` will be zero. When you're looking to do something on any layer change instead of one shot layer changes, `layer_state_set_user` is a better callback to use.
|
||||
|
||||
If you are making your own keyboard, there are also `_kb` equivalent functions:
|
||||
|
||||
```c
|
||||
void oneshot_locked_mods_changed_kb(uint8_t mods);
|
||||
void oneshot_mods_changed_kb(uint8_t mods);
|
||||
void oneshot_layer_changed_kb(uint8_t layer);
|
||||
```
|
||||
|
||||
As with any callback, be sure to call the `_user` variant to allow for further customizability.
|
||||
|
||||
# Tap-Hold Configuration Options
|
||||
|
||||
While Tap-Hold options are fantastic, they are not without their issues. We have tried to configure them with reasonal defaults, but that may still cause issues for some people.
|
||||
|
||||
These options let you modify the behavior of the Tap-Hold keys.
|
||||
|
||||
## Permissive Hold
|
||||
|
||||
As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:
|
||||
|
||||
```c
|
||||
#define PERMISSIVE_HOLD
|
||||
```
|
||||
|
||||
This makes tap and hold keys (like Mod Tap) work better for fast typist, or for high `TAPPING_TERM` settings.
|
||||
|
||||
If you press a Mod Tap key, tap another key (press and release) and then release the Mod Tap key, all within the tapping term, it will output the "tapping" function for both keys.
|
||||
|
||||
For Instance:
|
||||
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `KC_X` Up
|
||||
- `SFT_T(KC_A)` Up
|
||||
|
||||
Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this will be registered as `ax` by the firmware and host system. With permissive hold enabled, this modifies how this is handled by considering the Mod Tap keys as a Mod if another key is tapped, and would registered as `X` (`SHIFT`+`x`).
|
||||
|
||||
?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
|
||||
|
||||
For more granular control of this feature, you can add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define PERMISSIVE_HOLD_PER_KEY
|
||||
```
|
||||
|
||||
You can then add the following function to your keymap:
|
||||
|
||||
```c
|
||||
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case SFT_T(KC_A):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Ignore Mod Tap Interrupt
|
||||
|
||||
To enable this setting, add this to your `config.h`:
|
||||
|
||||
```c
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
```
|
||||
|
||||
Similar to Permissive Hold, this alters how the firmware processes input for fast typist. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys.
|
||||
|
||||
Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_TERM` to trigger the hold function (the mod).
|
||||
|
||||
For Instance:
|
||||
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `SFT_T(KC_A)` Up
|
||||
- `KC_X` Up
|
||||
|
||||
Normally, this would send `X` (`SHIFT`+`x`). With `Ignore Mod Tap Interrupt` enabled, holding both keys are required for the `TAPPING_TERM` to register the hold action. A quick tap will output `ax` in this case, while a hold on both will still output `X` (`SHIFT`+`x`).
|
||||
|
||||
|
||||
?> __Note__: This only concerns modifiers and not layer switching keys.
|
||||
|
||||
?> If you have `Permissive Hold` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
|
||||
|
||||
For more granular control of this feature, you can add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
|
||||
```
|
||||
|
||||
You can then add the following function to your keymap:
|
||||
|
||||
```c
|
||||
bool get_ignore_mod_tap_interrupt(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case SFT_T(KC_SPC):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tapping Force Hold
|
||||
|
||||
To enable `tapping force hold`, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define TAPPING_FORCE_HOLD
|
||||
```
|
||||
|
||||
When the user holds a key after tap, this repeats the tapped key rather to hold a modifier key. This allows to use auto repeat for the tapped key.
|
||||
|
||||
Example:
|
||||
|
||||
- SFT_T(KC_A) Down
|
||||
- SFT_T(KC_A) Up
|
||||
- SFT_T(KC_A) Down
|
||||
- wait more than tapping term...
|
||||
- SFT_T(KC_A) Up
|
||||
|
||||
With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto repeat function.
|
||||
|
||||
With `TAPPING_FORCE_HOLD`, the second press will be interpreted as a Shift, allowing to use it as a modifier shortly after having used it as a tap.
|
||||
|
||||
!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tapping Toggle).
|
||||
|
||||
For more granular control of this feature, you can add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define TAPPING_FORCE_HOLD_PER_KEY
|
||||
```
|
||||
|
||||
You can then add the following function to your keymap:
|
||||
|
||||
```c
|
||||
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case LT(1, KC_BSPC):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Retro Tapping
|
||||
|
||||
To enable `retro tapping`, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define RETRO_TAPPING
|
||||
```
|
||||
|
||||
Holding and releasing a dual function key without pressing another key will result in nothing happening. With retro tapping enabled, releasing the key without pressing another will send the original keycode even if it is outside the tapping term.
|
||||
|
||||
For instance, holding and releasing `LT(2, KC_SPACE)` without hitting another key will result in nothing happening. With this enabled, it will send `KC_SPACE` instead.
|
||||
* [Tap-Hold Configuration Options](tap_hold.md)
|
||||
|
@ -192,7 +192,7 @@ To change the behavior of the backlighting, `#define` these in your `config.h`:
|
||||
|`BACKLIGHT_PWM_CHANNEL` |`3` |The PWM channel to use, see ST datasheets for pin to PWM channel mapping. Unless you are designing your own keyboard, you shouldn't need to change this|
|
||||
|`BACKLIGHT_PAL_MODE` |`2` |The pin alternative function to use, see ST datasheets for pin AF mapping. Unless you are designing your own keyboard, you shouldn't need to change this|
|
||||
|
||||
## Software PWM Driver
|
||||
## Software PWM Driver :id=software-pwm-driver
|
||||
|
||||
Emulation of PWM while running other keyboard tasks, it offers maximum hardware compatibility without extra platform configuration. The tradeoff is the backlight might jitter when the keyboard is busy. To enable, add this to your rules.mk:
|
||||
```makefile
|
||||
|
@ -54,7 +54,7 @@ Hold down the Bootmagic key (Space by default) and the desired hotkey while plug
|
||||
|`6` |Make layer 6 the default layer |
|
||||
|`7` |Make layer 7 the default layer |
|
||||
|
||||
## Keycodes
|
||||
## Keycodes :id=keycodes
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||
@ -121,7 +121,7 @@ If you would like to change the hotkey assignments for Bootmagic, `#define` thes
|
||||
|`BOOTMAGIC_KEY_DEFAULT_LAYER_6` |`KC_6` |Make layer 6 the default layer |
|
||||
|`BOOTMAGIC_KEY_DEFAULT_LAYER_7` |`KC_7` |Make layer 7 the default layer |
|
||||
|
||||
# Bootmagic Lite
|
||||
# Bootmagic Lite :id=bootmagic-lite
|
||||
|
||||
In addition to the full blown Bootmagic feature, is the Bootmagic Lite feature that only handles jumping into the bootloader. This is great for boards that don't have a physical reset button but you need a way to jump into the bootloader, and don't want to deal with the headache that Bootmagic can cause.
|
||||
|
||||
|
@ -16,7 +16,7 @@ First, enable Key Lock by setting `KEY_LOCK_ENABLE = yes` in your `rules.mk`. Th
|
||||
|
||||
## Caveats
|
||||
|
||||
Key Lock is only able to hold standard action keys and [One Shot modifier](feature_advanced_keycodes.md#one-shot-keys) keys (for example, if you have your Shift defined as `OSM(KC_LSFT)`).
|
||||
Key Lock is only able to hold standard action keys and [One Shot modifier](one_shot_keys.md) keys (for example, if you have your Shift defined as `OSM(KC_LSFT)`).
|
||||
This does not include any of the QMK special functions (except One Shot modifiers), or shifted versions of keys such as `KC_LPRN`. If it's in the [Basic Keycodes](keycodes_basic.md) list, it can be held.
|
||||
|
||||
Switching layers will not cancel the Key Lock.
|
||||
|
@ -74,7 +74,7 @@ SEQ_THREE_KEYS(KC_C, KC_C, KC_C) {
|
||||
|
||||
## Strict Key Processing
|
||||
|
||||
By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](feature_advanced_keycodes.md#mod-tap) and [`Layer Tap`](feature_advanced_keycodes.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users.
|
||||
By default, the Leader Key feature will filter the keycode out of [`Mod-Tap`](mod_tap.md) and [`Layer Tap`](feature_advanced_keycodes.md#switching-and-toggling-layers) functions when checking for the Leader sequences. That means if you're using `LT(3, KC_A)`, it will pick this up as `KC_A` for the sequence, rather than `LT(3, KC_A)`, giving a more expected behavior for newer users.
|
||||
|
||||
While, this may be fine for most, if you want to specify the whole keycode (eg, `LT(3, KC_A)` from the example above) in the sequence, you can enable this by added `#define LEADER_KEY_STRICT_KEY_PROCESSING` to your `config.h` file. This well then disable the filtering, and you'll need to specify the whole keycode.
|
||||
|
||||
|
@ -221,6 +221,12 @@ void oled_write(const char *data, bool invert);
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
void oled_write_ln(const char *data, bool invert);
|
||||
|
||||
// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
|
||||
// Useful for moving the screen in preparation for new drawing
|
||||
// oled_scroll_left or oled_scroll_right should be preferred for all cases of moving a static
|
||||
// image such as a logo or to avoid burn-in as it's much, much less cpu intensive
|
||||
void oled_pan(bool left);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
// Advances the cursor while writing, inverts the pixels if true
|
||||
// Remapped to call 'void oled_write(const char *data, bool invert);' on ARM
|
||||
@ -235,6 +241,9 @@ void oled_write_ln_P(const char *data, bool invert);
|
||||
// Writes a string to the buffer at current cursor position
|
||||
void oled_write_raw(const char *data, uint16_t size);
|
||||
|
||||
// Writes a single byte into the buffer at the specified index
|
||||
void oled_write_raw_byte(const char data, uint16_t index);
|
||||
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
void oled_write_raw_P(const char *data, uint16_t size);
|
||||
|
||||
|
@ -335,7 +335,7 @@ If you want to implement this in your userspace, then you may want to check out
|
||||
|
||||
> In this configuration "hold" takes place **after** tap dance timeout (see `ACTION_TAP_DANCE_FN_ADVANCED_TIME`). To achieve instant hold, remove `state->interrupted` checks in conditions. As a result you may use comfortable longer tapping periods to have more time for taps and not to wait too long for holds (try starting with doubled `TAPPING_TERM`).
|
||||
|
||||
### Example 5: Using tap dance for advanced mod-tap and layer-tap keys
|
||||
### Example 5: Using tap dance for advanced mod-tap and layer-tap keys :id=example-5-using-tap-dance-for-advanced-mod-tap-and-layer-tap-keys
|
||||
|
||||
Tap dance can be used to emulate `MT()` and `LT()` behavior when the tapped code is not a basic keycode. This is useful to send tapped keycodes that normally require `Shift`, such as parentheses or curly braces—or other modified keycodes, such as `Control + X`.
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
# QMK Features
|
||||
|
||||
QMK has a staggering number of features for building your keyboard. It can take some time to understand all of them and determine which one will achieve your goal.
|
||||
|
||||
|
||||
* [Advanced Keycodes](feature_advanced_keycodes.md) - Change layers, dual-action keys, and more. Go beyond typing simple characters.
|
||||
* [Audio](feature_audio.md) - Connect a speaker to your keyboard for audio feedback, midi support, and music mode.
|
||||
* [Auto Shift](feature_auto_shift.md) - Tap for the normal key, hold slightly longer for its shifted state.
|
||||
* [Backlight](feature_backlight.md) - LED lighting support for your keyboard.
|
||||
* [Bluetooth](feature_bluetooth.md) - BlueTooth support for your keyboard.
|
||||
* [Bootmagic](feature_bootmagic.md) - Adjust the behavior of your keyboard using hotkeys.
|
||||
* [Combos](feature_combo.md) - Custom actions for multiple key holds.
|
||||
* [Command](feature_command.md) - Runtime version of bootmagic (Formerly known as "Magic").
|
||||
* [Debounce API](feature_debounce_type.md) - Customization of debouncing algorithms, and the ability to add more/custom debouncing.
|
||||
* [DIP Switch](feature_dip_switch.md) - Toggle switches for customizing board function.
|
||||
* [Dynamic Macros](feature_dynamic_macros.md) - Record and playback macros from the keyboard itself.
|
||||
* [Encoders](feature_encoders.md) - Rotary encoders!
|
||||
* [Grave Escape](feature_grave_esc.md) - Lets you use a single key for Esc and Grave.
|
||||
* [Haptic Feedback](feature_haptic_feedback.md) - Add haptic feedback drivers to your board.
|
||||
* [HD44780 LCD Display](feature_hd44780.md) - Support for LCD character displays using the HD44780 standard.
|
||||
* [Key Lock](feature_key_lock.md) - Lock a key in the "down" state.
|
||||
* [Layouts](feature_layouts.md) - Use one keymap with any keyboard that supports your layout.
|
||||
* [Leader Key](feature_leader_key.md) - Tap the leader key followed by a sequence to trigger custom behavior.
|
||||
* [LED Matrix](feature_led_matrix.md) - LED Matrix single color lights for per key lighting (Single Color, not RGB).
|
||||
* [Macros](feature_macros.md) - Send multiple key presses when pressing only one physical key.
|
||||
* [Mouse keys](feature_mouse_keys.md) - Control your mouse pointer from your keyboard.
|
||||
* [OLED Driver](feature_oled_driver.md) - Add OLED screens to your keyboard.
|
||||
* [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys) - Sticky Keys, lets you hit a key rather than holding it.
|
||||
* [Pointing Device](feature_pointing_device.md) - Framework for connecting your custom pointing device to your keyboard.
|
||||
* [PS2 Mouse](feature_ps2_mouse.md) - Driver for connecting a PS/2 mouse directly to your keyboard.
|
||||
* [RGB Light](feature_rgblight.md) - RGB lighting for your keyboard.
|
||||
* [RGB Matrix](feature_rgb_matrix.md) - RGB Matrix lights for per key lighting.
|
||||
* [Space Cadet](feature_space_cadet.md) - Use your left/right shift keys to type parenthesis and brackets.
|
||||
* [Split Keyboard](feature_split_keyboard.md)
|
||||
* [Stenography](feature_stenography.md) - Put your keyboard into Plover mode for stenography use.
|
||||
* [Swap Hands](feature_swap_hands.md) - Mirror your keyboard for one handed usage.
|
||||
* [Tap Dance](feature_tap_dance.md) - Make a single key do as many things as you want.
|
||||
* [Terminal](feature_terminal.md) - CLI interface to the internals of your keyboard.
|
||||
* [Thermal Printer](feature_thermal_printer.md) - Connect a thermal printer to your keyboard to be able to toggle on a printed log of everything you type.
|
||||
* [Unicode](feature_unicode.md) - Unicode input support.
|
||||
* [Userspace](feature_userspace.md) - Share code between different keymaps and keyboards.
|
||||
* [Velocikey](feature_velocikey.md) - Allows changes in RGB animation speed based on WPM/Typing speed.
|
@ -1,8 +1,8 @@
|
||||
# Flashing Instructions and Bootloader Information
|
||||
|
||||
There are quite a few different types of bootloaders that keyboards use, and just about all of the use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them.
|
||||
There are quite a few different types of bootloaders that keyboards use, and just about all of them use a different flashing method. Luckily, projects like the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases) aim to be compatible with all the different types without having to think about it much, but this article will describe the different types of bootloaders, and available methods for flashing them.
|
||||
|
||||
If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size in bytes (along with the max). To run this process manually, compile with the target `check-size`, eg `make planck/rev4:default:check-size`.
|
||||
If you have a bootloader selected with the `BOOTLOADER` variable in your `rules.mk`, QMK will automatically calculate if your .hex file is the right size to be flashed to the device, and output the total size in bytes (along with the max).
|
||||
|
||||
## DFU
|
||||
|
||||
@ -100,7 +100,7 @@ or
|
||||
make <keyboard>:<keymap>:avrdude
|
||||
|
||||
|
||||
#### Caterina commands
|
||||
### Caterina commands
|
||||
|
||||
There are a number of DFU commands that you can use to flash firmware to a DFU device:
|
||||
|
||||
@ -113,7 +113,7 @@ There are a number of DFU commands that you can use to flash firmware to a DFU d
|
||||
|
||||
## Halfkay
|
||||
|
||||
Halfkay is a super-slim protocol developed by PJRC that uses HID, and come on all Teensys (namely the 2.0).
|
||||
Halfkay is a super-slim protocol developed by PJRC that uses HID, and comes on all Teensys (namely the 2.0).
|
||||
|
||||
To ensure compatibility with the Halfkay bootloader, make sure this block is present your `rules.mk`:
|
||||
|
||||
|
@ -81,7 +81,7 @@
|
||||
* [Macros](fr-fr/feature_macros.md)
|
||||
* [Boutons de souris](fr-fr/feature_mouse_keys.md)
|
||||
* [Pilotes / Drivers OLED](fr-fr/feature_oled_driver.md)
|
||||
* [Touche one-shot](fr-fr/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [Touche one-shot](fr-fr/one_shot_keys.md)
|
||||
* [Périphériques de pointage](fr-fr/feature_pointing_device.md)
|
||||
* [Souris PS/2](fr-fr/feature_ps2_mouse.md)
|
||||
* [Éclairage RGB](fr-fr/feature_rgblight.md)
|
||||
@ -112,7 +112,7 @@
|
||||
* Autres sujets
|
||||
* [Utiliser Eclipse avec QMK](fr-fr/other_eclipse.md)
|
||||
* [Utiliser VSCode avec QMK](fr-fr/other_vscode.md)
|
||||
* [Support](fr-fr/support.md)
|
||||
* [Support](fr-fr/getting_started_getting_help.md)
|
||||
* [Comment ajouter des traductions](fr-fr/translating.md)
|
||||
|
||||
* À l’intérieur de QMK (En cours de documentation)
|
||||
|
@ -4,7 +4,7 @@ Le [Configurateur de QMK](https://config.qmk.fm) est une interface graphique en
|
||||
|
||||
?> **S'il vous plaît, suivez les étapes suivantes dans l'ordre.**
|
||||
|
||||
Regardez le [Tutoriel vidéo](https://youtu.be/tx54jkRC9ZY)
|
||||
Regardez le [Tutoriel vidéo](https://youtu.be/tx54jkRC9ZY)https://www.youtube.com/watch?v=-imgglzDMdY)
|
||||
|
||||
Le configurateur de QMK fonctionne mieux avec Chrome et Firefox.
|
||||
|
||||
|
@ -1,141 +0,0 @@
|
||||
# Installing Build Tools
|
||||
|
||||
This page describes setting up the build environment for QMK. These instructions cover AVR processors (such as the atmega32u4).
|
||||
|
||||
<!-- FIXME: We should have ARM instructions somewhere. -->
|
||||
|
||||
**Note:** If this is your first time here, check out the [Complete Newbs Guide](newbs.md) page.
|
||||
|
||||
Before continuing, double check that your submodules (third-party libraries) are up to date by running `make git-submodule`.
|
||||
|
||||
## Linux
|
||||
|
||||
To ensure you are always up to date, you can just run `sudo util/qmk_install.sh`. That should always install all the dependencies needed. **This will run `apt-get upgrade`.**
|
||||
|
||||
You can also install things manually, but this documentation might not be always up to date with all requirements.
|
||||
|
||||
The current requirements are the following, but not all might be needed depending on what you do. Also note that some systems might not have all the dependencies available as packages, or they might be named differently.
|
||||
|
||||
```
|
||||
build-essential
|
||||
gcc
|
||||
unzip
|
||||
wget
|
||||
zip
|
||||
gcc-avr
|
||||
binutils-avr
|
||||
avr-libc
|
||||
dfu-programmer
|
||||
dfu-util
|
||||
gcc-arm-none-eabi
|
||||
binutils-arm-none-eabi
|
||||
libnewlib-arm-none-eabi
|
||||
git
|
||||
```
|
||||
|
||||
Install the dependencies with your favorite package manager.
|
||||
|
||||
Debian / Ubuntu example:
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install gcc unzip wget zip gcc-avr binutils-avr avr-libc dfu-programmer dfu-util gcc-arm-none-eabi binutils-arm-none-eabi libnewlib-arm-none-eabi
|
||||
|
||||
Fedora / Red Hat example:
|
||||
|
||||
sudo dnf install gcc unzip wget zip dfu-util dfu-programmer avr-gcc avr-libc binutils-avr32-linux-gnu arm-none-eabi-gcc-cs arm-none-eabi-binutils-cs arm-none-eabi-newlib
|
||||
|
||||
Arch / Manjaro example:
|
||||
|
||||
pacman -S base-devel gcc unzip wget zip avr-gcc avr-binutils avr-libc dfu-util arm-none-eabi-gcc arm-none-eabi-binutils arm-none-eabi-newlib git dfu-programmer dfu-util
|
||||
|
||||
## Nix
|
||||
|
||||
If you're on [NixOS](https://nixos.org/), or have Nix installed on Linux or macOS, run `nix-shell` from the repository root to get a build environment.
|
||||
|
||||
By default, this will download compilers for both AVR and ARM. If you don't need both, disable the `avr` or `arm` arguments, e.g.:
|
||||
|
||||
nix-shell --arg arm false
|
||||
|
||||
## macOS
|
||||
If you're using [Homebrew](http://brew.sh/), you can use the following commands:
|
||||
|
||||
brew tap osx-cross/avr
|
||||
brew tap osx-cross/arm
|
||||
brew update
|
||||
brew install avr-gcc@8
|
||||
brew link --force avr-gcc@8
|
||||
brew install dfu-programmer
|
||||
brew install dfu-util
|
||||
brew install arm-gcc-bin@8
|
||||
brew link --force arm-gcc-bin@8
|
||||
brew install avrdude
|
||||
|
||||
This is the recommended method. If you don't have homebrew, [install it!](http://brew.sh/) It's very much worth it for anyone who works in the command line. Note that the `make` and `make install` portion during the homebrew installation of `avr-gcc@8` can take over 20 minutes and exhibit high CPU usage.
|
||||
|
||||
## Windows with msys2 (recommended)
|
||||
|
||||
The best environment to use, for Windows Vista through any later version (tested on 7 and 10), is [msys2](http://www.msys2.org).
|
||||
|
||||
* Install msys2 by downloading it and following the instructions here: http://www.msys2.org
|
||||
* Open the ``MSYS2 MingGW 64-bit`` shortcut
|
||||
* Navigate to your QMK repository. For example, if it's in the root of your c drive:
|
||||
* `$ cd /c/qmk_firmware`
|
||||
* Run `util/qmk_install.sh` and follow the prompts
|
||||
|
||||
## Windows 10 (deprecated)
|
||||
These are the old instructions for Windows 10. We recommend you use [MSYS2 as outlined above](#windows-with-msys2-recommended).
|
||||
|
||||
### Creators Update
|
||||
If you have Windows 10 with Creators Update or later, you can build and flash the firmware directly. Before the Creators Update, only building was possible. If you don't have it yet or if are unsure, follow [these instructions](https://support.microsoft.com/en-us/instantanswers/d4efb316-79f0-1aa1-9ef3-dcada78f3fa0/get-the-windows-10-creators-update).
|
||||
|
||||
### Windows Subsystem for Linux
|
||||
In addition to the Creators Update, you need Windows 10 Subystem for Linux, so install it following [these instructions](http://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/). If you already have the Windows 10 Subsystem for Linux from the Anniversary update it's recommended that you [upgrade](https://betanews.com/2017/04/14/upgrade-windows-subsystem-for-linux/) it to 16.04LTS, because some keyboards don't compile with the toolchains included in 14.04LTS. Note that you need to know what your are doing if you chose the `sudo do-release-upgrade` method.
|
||||
|
||||
### Git
|
||||
If you already have cloned the repository on your Windows file system you can ignore this section.
|
||||
|
||||
You will need to clone the repository to your Windows file system using the normal Git for Windows and **not** the WSL Git. So if you haven't installed Git before, [download](https://git-scm.com/download/win) and install it. Then [set it up](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup), it's important that you setup the e-mail and user name, especially if you are planning to contribute.
|
||||
|
||||
Once Git is installed, open the Git Bash command and change the directory to where you want to clone QMK; note that you have to use forward slashes, and that your c drive is accessed like this `/c/path/to/where/you/want/to/go`. Then run `git clone --recurse-submodules https://github.com/qmk/qmk_firmware`, this will create a new folder `qmk_firmware` as a subfolder of the current one.
|
||||
|
||||
### Toolchain Setup
|
||||
The Toolchain setup is done through the Windows Subsystem for Linux, and the process is fully automated. If you want to do everything manually, there are no other instructions than the scripts themselves, but you can always open issues and ask for more information.
|
||||
|
||||
1. Open "Bash On Ubuntu On Windows" from the start menu.
|
||||
2. Go to the directory where you cloned `qmk_firmware`. Note that the paths start with `/mnt/` in the WSL, so you have to write for example `cd /mnt/c/path/to/qmk_firmware`.
|
||||
3. Run `util/wsl_install.sh` and follow the on-screen instructions.
|
||||
4. Close the Bash command window, and re-open it.
|
||||
5. You are ready to compile and flash the firmware!
|
||||
|
||||
### Some Important Things to Keep in Mind
|
||||
* You can run `util/wsl_install.sh` again to get all the newest updates.
|
||||
* Your QMK repository need to be on a Windows file system path, since WSL can't run executables outside it.
|
||||
* The WSL Git is **not** compatible with the Windows Git, so use the Windows Git Bash or a windows Git GUI for all Git operations
|
||||
* You can edit files either inside WSL or normally using Windows, but note that if you edit makefiles or shell scripts, make sure you are using an editor that saves the files with Unix line endings. Otherwise the compilation might not work.
|
||||
|
||||
## Docker
|
||||
|
||||
If this is a bit complex for you, Docker might be the turnkey solution you need. After installing [Docker CE](https://docs.docker.com/install/#supported-platforms), run the following command from the `qmk_firmware` directory to build a keyboard/keymap:
|
||||
```bash
|
||||
util/docker_build.sh keyboard:keymap
|
||||
# For example: util/docker_build.sh ergodox_ez:steno
|
||||
```
|
||||
This will compile the desired keyboard/keymap and leave the resulting `.hex` or `.bin` file in the QMK directory for you to flash. If `:keymap` is omitted, all keymaps are used. Note that the parameter format is the same as when building with `make`.
|
||||
|
||||
You can also start the script without any parameters, in which case it will ask you to input the build parameters one by one, which you may find easier to use:
|
||||
```bash
|
||||
util/docker_build.sh
|
||||
# Reads parameters as input (leave blank for all keyboards/keymaps)
|
||||
```
|
||||
|
||||
There is also support for building _and_ flashing the keyboard straight from Docker by specifying the `target` as well:
|
||||
```bash
|
||||
util/docker_build.sh keyboard:keymap:target
|
||||
# For example: util/docker_build.sh planck/rev6:default:flash
|
||||
```
|
||||
If you're on Linux, this should work out of the box. On Windows and macOS, it requires [Docker Machine](http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos/) to be running. This is tedious to set up, so it's not recommended; use [QMK Toolbox](https://github.com/qmk/qmk_toolbox) instead.
|
||||
|
||||
!> Docker for Windows requires [Hyper-V](https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/enable-hyper-v) to be enabled. This means that it cannot work on versions of Windows which don't have Hyper-V, such as Windows 7, Windows 8 and **Windows 10 Home**.
|
||||
|
||||
## Vagrant
|
||||
If you have any problems building the firmware, you can try using a tool called Vagrant. It will set up a virtual computer with a known configuration that's ready-to-go for firmware building. OLKB does NOT host the files for this virtual computer. Details on how to set up Vagrant are in the [vagrant guide](getting_started_vagrant.md).
|
@ -1,15 +0,0 @@
|
||||
# Getting Help
|
||||
|
||||
There are a lot of resources for getting help with QMK.
|
||||
|
||||
## Realtime Chat
|
||||
|
||||
You can find QMK developers and users on our main [Discord server](https://discord.gg/Uq7gcHh). There are specific channels in the server for chatting about the firmware, Toolbox, hardware, and configurator.
|
||||
|
||||
## OLKB Subreddit
|
||||
|
||||
The official QMK forum is [/r/olkb](https://reddit.com/r/olkb) on [reddit.com](https://reddit.com).
|
||||
|
||||
## Github Issues
|
||||
|
||||
You can open an [issue on GitHub](https://github.com/qmk/qmk_firmware/issues). This is especially handy when your issue will require long-term discussion or debugging.
|
@ -1,65 +0,0 @@
|
||||
# How to Use Github with QMK
|
||||
|
||||
Github can be a little tricky to those that aren't familiar with it - this guide will walk through each step of forking, cloning, and submitting a pull request with QMK.
|
||||
|
||||
?> This guide assumes you're somewhat comfortable with running things at the command line, and have git installed on your system.
|
||||
|
||||
Start on the [QMK Github page](https://github.com/qmk/qmk_firmware), and you'll see a button in the upper right that says "Fork":
|
||||
|
||||

|
||||
|
||||
If you're a part of an organization, you'll need to choose which account to fork it to. In most circumstances, you'll want to fork it to your personal account. Once your fork is completed (sometimes this takes a little while), click the "Clone or Download" button:
|
||||
|
||||

|
||||
|
||||
And be sure to select "HTTPS", and select the link and copy it:
|
||||
|
||||

|
||||
|
||||
From here, enter `git clone --recurse-submodules ` into the command line, and then paste your link:
|
||||
|
||||
```
|
||||
user@computer:~$ git clone --recurse-submodules https://github.com/whoeveryouare/qmk_firmware.git
|
||||
Cloning into 'qmk_firmware'...
|
||||
remote: Enumerating objects: 9, done.
|
||||
remote: Counting objects: 100% (9/9), done.
|
||||
remote: Compressing objects: 100% (5/5), done.
|
||||
remote: Total 183883 (delta 5), reused 4 (delta 4), pack-reused 183874
|
||||
Receiving objects: 100% (183883/183883), 132.90 MiB | 9.57 MiB/s, done.
|
||||
Resolving deltas: 100% (119972/119972), done.
|
||||
...
|
||||
Submodule path 'lib/chibios': checked out '587968d6cbc2b0e1c7147540872f2a67e59ca18b'
|
||||
Submodule path 'lib/chibios-contrib': checked out 'ede48346eee4b8d6847c19bc01420bee76a5e486'
|
||||
Submodule path 'lib/googletest': checked out 'ec44c6c1675c25b9827aacd08c02433cccde7780'
|
||||
Submodule path 'lib/lufa': checked out 'ce10f7642b0459e409839b23cc91498945119b4d'
|
||||
Submodule path 'lib/ugfx': checked out '3e97b74e03c93631cdd3ddb2ce43b963fdce19b2'
|
||||
```
|
||||
|
||||
You now have your QMK fork on your local machine, and you can add your keymap, compile it and flash it to your board. Once you're happy with your changes, you can add, commit, and push them to your fork like this:
|
||||
|
||||
```
|
||||
user@computer:~$ git add .
|
||||
user@computer:~$ git commit -m "adding my keymap"
|
||||
[master cccb1608] adding my keymap
|
||||
1 file changed, 1 insertion(+)
|
||||
create mode 100644 keyboards/planck/keymaps/mine/keymap.c
|
||||
user@computer:~$ git push
|
||||
Counting objects: 1, done.
|
||||
Delta compression using up to 4 threads.
|
||||
Compressing objects: 100% (1/1), done.
|
||||
Writing objects: 100% (1/1), 1.64 KiB | 0 bytes/s, done.
|
||||
Total 1 (delta 1), reused 0 (delta 0)
|
||||
remote: Resolving deltas: 100% (1/1), completed with 1 local objects.
|
||||
To https://github.com/whoeveryouare/qmk_firmware.git
|
||||
+ 20043e64...7da94ac5 master -> master
|
||||
```
|
||||
|
||||
Your changes now exist on your fork on Github - if you go back there (`https://github.com/<whoeveryouare>/qmk_firmware`), you can create a "New Pull Request" by clicking this button:
|
||||
|
||||

|
||||
|
||||
Here you'll be able to see exactly what you've committed - if it all looks good, you can finalize it by clicking "Create Pull Request":
|
||||
|
||||

|
||||
|
||||
After submitting, we may talk to you about your changes, ask that you make changes, and eventually accept it! Thanks for contributing to QMK :)
|
@ -1,114 +1,5 @@
|
||||
# Hand-Wiring Guide
|
||||
|
||||
## Preamble: How a Keyboard Matrix Works (and why we need diodes)
|
||||
|
||||
The collapsible section below covers why keyboards are wired the way they are, as outlined in this guide. It isn't required reading to make your own hand wired keyboard, but provides background information.
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Click for details</summary>
|
||||
|
||||
Without a matrix circuit each switch would require its own wire directly to the controller.
|
||||
|
||||
Simply put, when the circuit is arranged in rows and columns, if a key is pressed, a column wire makes contact with a row wire and completes a circuit. The keyboard controller detects this closed circuit and registers it as a key press.
|
||||
|
||||
The microcontroller will be setup up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
row0 ---(key0)---(key1) row0 ---(key0)---(key1)
|
||||
| | | |
|
||||
row1 ---(key2)---(key3) row1 ---(key2)---(key3)
|
||||
|
||||
The `x` represents that the column/row associated has a value of 1, or is HIGH. Here, we see that no keys are being pressed, so no rows get an `x`. For one keyswitch, keep in mind that one side of the contacts is connected to its row, and the other, its column.
|
||||
|
||||
When we press `key0`, `col0` gets connected to `row0`, so the values that the firmware receives for that row is `0b01` (the `0b` here means that this is a bit value, meaning all of the following digits are bits - 0 or 1 - and represent the keys in that column). We'll use this notation to show when a keyswitch has been pressed, to show that the column and row are being connected:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
x row0 ---(-+-0)---(key1) row0 ---(-+-0)---(key1)
|
||||
| | | |
|
||||
row1 ---(key2)---(key3) row1 ---(key2)---(key3)
|
||||
|
||||
We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is
|
||||
|
||||
col0: 0b01
|
||||
col1: 0b00
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
A problem arises when you start pressing more than one key at a time. Looking at our matrix again, it should become pretty obvious:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
x row0 ---(-+-0)---(-+-1) x row0 ---(-+-0)---(-+-1)
|
||||
| | | |
|
||||
x row1 ---(key2)---(-+-3) x row1 ---(key2)---(-+-3)
|
||||
|
||||
Remember that this ^ is still connected to row1
|
||||
|
||||
The data we get from that is:
|
||||
|
||||
col0: 0b11
|
||||
col1: 0b11
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
Which isn't accurate, since we only have 3 keys pressed down, not all 4. This behavior is called ghosting, and only happens in odd scenarios like this, but can be much more common on a bigger keyboard. The way we can get around this is by placing a diode after the keyswitch, but before it connects to its row. A diode only allows current to pass through one way, which will protect our other columns/rows from being activated in the previous example. We'll represent a dioded matrix like this;
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
│ │ | │
|
||||
(key0) (key1) (key0) (key1)
|
||||
! │ ! │ ! | ! │
|
||||
row0 ─────┴────────┘ │ row0 ─────┴────────┘ │
|
||||
│ │ | │
|
||||
(key2) (key3) (key2) (key3)
|
||||
! ! ! !
|
||||
row1 ─────┴────────┘ row1 ─────┴────────┘
|
||||
|
||||
In practical applications, the black line of the diode will be placed facing the row, and away from the keyswitch - the `!` in this case is the diode, where the gap represents the black line. A good way to remember this is to think of this symbol: `>|`
|
||||
|
||||
Now when we press the three keys, invoking what would be a ghosting scenario:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
│ │ │ │
|
||||
(┌─┤0) (┌─┤1) (┌─┤0) (┌─┤1)
|
||||
! │ ! │ ! │ ! │
|
||||
x row0 ─────┴────────┘ │ x row0 ─────┴────────┘ │
|
||||
│ │ │ │
|
||||
(key2) (┌─┘3) (key2) (┌─┘3)
|
||||
! ! ! !
|
||||
row1 ─────┴────────┘ x row1 ─────┴────────┘
|
||||
|
||||
Things act as they should! Which will get us the following data:
|
||||
|
||||
col0: 0b01
|
||||
col1: 0b11
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS.
|
||||
|
||||
Further reading:
|
||||
- [Wikipedia article](https://en.wikipedia.org/wiki/Keyboard_matrix_circuit)
|
||||
- [Deskthority article](https://deskthority.net/wiki/Keyboard_matrix)
|
||||
- [Keyboard Matrix Help by Dave Dribin (2000)](https://www.dribin.org/dave/keyboard/one_html/)
|
||||
- [How Key Matrices Works by PCBheaven](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/) (animated examples)
|
||||
- [How keyboards work - QMK documentation](how_keyboards_work.md)
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
## Parts list
|
||||
|
||||
You will need: (where *x* is the number of keys on your planned keyboard)
|
||||
@ -141,29 +32,29 @@ Start by installing the switches and stabilisers in the plate. Depending on the
|
||||
|
||||
If you are following a pre-existing handwire guide (e.g. for the keyboards in the [handwire firmware section](https://github.com/qmk/qmk_firmware/tree/master/keyboards/handwired) you can skip this step, just ensure you wire the matrix as described.
|
||||
|
||||
What you want to achieve is one leg from each switch being attached to the corresponding switches next to it (rows) and the other leg being attached to the switches above and below it (columns) and a diode to one of the legs, mosy commonly this will be the leg attached to the rows, and the diode will face away from it (Column to Row) i.e. with the wire furthest from the black line on the diode connected to the switch (as current will only travel in one direction through a diode)
|
||||
What you want to achieve is one leg from each switch being attached to the corresponding switches next to it (rows) and the other leg being attached to the switches above and below it (columns) and a diode to one of the legs, mosy commonly this will be the leg attached to the rows, and the diode will face away from it (Column to Row) i.e. with the wire furthest from the black line on the diode connected to the switch (as current will only travel in one direction through a diode).
|
||||
|
||||
It is fairly simple to plan for an ortholinear keyboard (like a Planck).
|
||||
|
||||

|
||||

|
||||
Image from [RoastPotatoes' "How to hand wire a Planck"](https://blog.roastpotatoes.co/guide/2015/11/04/how-to-handwire-a-planck/)
|
||||
|
||||
But the larger and more complicated your keyboard, the more complex the matrix. [Keyboard Firmware Builder](https://kbfirmware.com/) can help you plan your matrix layout (shown here with a basic fullsize ISO keyboard imported from [Keyboard Layout Editor](http://www.keyboard-layout-editor.com).
|
||||
|
||||

|
||||
|
||||
Bear in mind that the number of rows plus the number of columns can not exceed the number of I/O pins on your controller. So the fullsize matrix shown above would be possible on a Proton C or Teensy++, but not on a regular Teensy or Pro Micro
|
||||
Bear in mind that the number of rows plus the number of columns can not exceed the number of I/O pins on your controller. So the fullsize matrix shown above would be possible on a Proton C or Teensy++, but not on a regular Teensy or Pro Micro.
|
||||
|
||||
#### Common Microcontroller Boards
|
||||
### Common Microcontroller Boards
|
||||
|
||||
| Board | Controller | # I/O | Pinout |
|
||||
| :------------ |:-------------:| ------:| ------ |
|
||||
| Pro Micro* | ATmega32u4 | 20 | [link](https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/hardware-overview-pro-micro#Teensy++_2.0) |
|
||||
| Pro Micro* | ATmega32u4 | 20 | [link](https://learn.sparkfun.com/tutorials/pro-micro--fio-v3-hookup-guide/hardware-overview-pro-micro#Teensy++_2.0) |
|
||||
| Teensy 2.0 | ATmega32u4 | 25 | [link](https://www.pjrc.com/teensy/pinout.html) |
|
||||
| [QMK Proton C](https://qmk.fm/proton-c/) | STM32F303xC | 36 | [link 1](https://i.imgur.com/RhtrAlc.png), [2](https://deskthority.net/wiki/QMK_Proton_C) |
|
||||
| Teensy++ 2.0 | AT90USB1286 | 46 | [link](https://www.pjrc.com/teensy/pinout.html#Teensy_2.0) |
|
||||
|
||||
*Elite C is essentially the same as a pro micro with a USB-C instead of Micro-USB
|
||||
*Elite C is essentially the same as a Pro Micro with a USB-C instead of Micro-USB
|
||||
|
||||
There are also a number of boards designed specifically for handwiring that mount directly to a small number of switches and offer pinouts for the rest. Though these are generally more expensive and may be more difficult to get hold of.
|
||||
|
||||
@ -204,7 +95,7 @@ If you are planning a split keyboard (e.g. Dactyl) each half will require a cont
|
||||
|
||||
There are a lot of soldering guides and tips available elsewhere but here are some of the most useful and relevant for hand wiring:
|
||||
|
||||
To ensure a strong solder joint you want a good amount of contact between the solder and the 2 peices of metal you are connecting, a good way of doing this (though not required) is looping around pins or twisting wires together before applying solder.
|
||||
To ensure a strong solder joint you want a good amount of contact between the solder and the two pieces of metal you are connecting. A good way of doing this (though not required) is looping around pins or twisting wires together before applying solder.
|
||||
|
||||
<img src="https://i.imgur.com/eHJjmnU.jpg" alt="Looped around rod" width="200"/> <img src="https://i.imgur.com/8nbxmmr.jpg?1" alt="Looped diode leg" width="200"/>
|
||||
|
||||
@ -220,24 +111,11 @@ When you come to apply the solder, hold the soldering iron against the two surfa
|
||||
|
||||
Don't hold the iron on the solder/joint longer than necessary. Heat will be conducted through the surfaces and can damage components (melt switch housings etc.). Also, solder contains flux, which aids in ["wetting"](https://en.m.wikipedia.org/wiki/Wetting). The longer heat is applied to the solder the more flux will evaporate meaning you may end up with a bad solder joint with peaks which, apart from looking bad, may also increase the risk of electrical shorts.
|
||||
|
||||
The following collapsible section describes in detail how to solder rows using the bent diode technique and columns using short lengths of wire.
|
||||
#### Soldering the Diodes
|
||||
|
||||
<details>
|
||||
Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The input lead of the diode should be touching the left contact on the switch, and the bent, output end should be facing to the right and resting on the switch there, like this:
|
||||
|
||||
<summary>Click for details</summary>
|
||||
|
||||
## Soldering the Diodes
|
||||
|
||||
Starting at the top-left switch, place the diode (with tweezers if you have them) on the switch so that the diode itself is vertically aligned, and the black line is facing toward you. The straight end of the diode should be touching the left contact on the switch, and the bent end should be facing to the right and resting on the switch there, like this:
|
||||
|
||||
```
|
||||
│o
|
||||
┌┴┐ o
|
||||
│ │ O
|
||||
├─┤
|
||||
└┬┘
|
||||
└─────────────
|
||||
```
|
||||

|
||||
|
||||
Letting the diode rest, grab your solder, and touch both it and the soldering iron to the left contact at the same time - the rosin in the solder should make it easy for the solder to flow over both the diode and the keyswitch contact. The diode may move a little, and if it does, carefully position it back it place by grabbing the bent end of the diode - the other end will become hot very quickly. If you find that it's moving too much, using needle-nose pliers of some sort may help to keep the diode still when soldering.
|
||||
|
||||
@ -247,20 +125,13 @@ After soldering things in place, it may be helpful to blow on the joint to push
|
||||
|
||||
When the first diode is complete, the next one will need to be soldered to both the keyswitch, and the previous diode at the new elbow. That will look something like this:
|
||||
|
||||
```
|
||||
│o │o
|
||||
┌┴┐ o ┌┴┐ o
|
||||
│ │ O │ │ O
|
||||
├─┤ ├─┤
|
||||
└┬┘ └┬┘
|
||||
└────────────────┴─────────────
|
||||
```
|
||||

|
||||
|
||||
After completing a row, use the wire cutters to trim the excess wire from the tops of the diodes, and from the right side on the final switch. This process will need to completed for each row you have.
|
||||
|
||||
When all of the diodes are completely soldered, it's a good idea to quickly inspect each one to ensure that your solder joints are solid and sturdy - repairing things after this is possible, but more difficult.
|
||||
|
||||
## Soldering the Columns
|
||||
#### Soldering the Columns
|
||||
|
||||
You'll have some options in the next process - it's a good idea to insulate the column wires (since the diodes aren't), but if you're careful enough, you can use exposed wires for the columns - it's not recommended, though. If you're using single-cored wire, stripping the plastic off of the whole wire and feeding it back on is probably the best option, but can be difficult depending on the size and materials. You'll want to leave parts of the wire exposed where you're going to be solder it onto the keyswitch.
|
||||
|
||||
@ -270,9 +141,7 @@ Before beginning to solder, it helps to have your wire pre-bent (if using single
|
||||
|
||||
If you're not using any insulation, you can try to keep the column wires elevated, and solder them near the tips of the keyswitch contacts - if the wires are sturdy enough, they won't short out to the row wiring an diodes.
|
||||
|
||||
</details>
|
||||
|
||||
# Wiring up the controller
|
||||
## Wiring up the controller
|
||||
|
||||
Now that the matrix itself is complete, it's time to connect what you've done to the microcontroller board.
|
||||
|
||||
@ -280,15 +149,16 @@ Place the microcontroller where you want it to be located, give thought to mount
|
||||
|
||||
Find the pinout/documentation for your microcontroller board ([links here](#common-microcontroller-boards)) and make a note of all the digital I/O pins on it (note that on some controllers, like the teensy, analogue I/O can double as digital) as these are the pins you want to connect your wires to.
|
||||
|
||||
<details>
|
||||
----
|
||||
|
||||
<summary>Specific instructions for the Teensy 2.0</summary>
|
||||
### Specific instructions for the Teensy 2.0
|
||||
|
||||
There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple.
|
||||
There are some pins on the Teensy that are special, like D6 (the LED on the chip), or some of the UART, SPI, I2C, or PWM channels, but only avoid those if you're planning something in addition to a keyboard. If you're unsure about wanting to add something later, you should have enough pins in total to avoid a couple.
|
||||
|
||||
The pins you'll absolutely have to avoid, as with any controller, are: GND, VCC, AREF, and RST - all the others are usable and accessible in the firmware.
|
||||
|
||||
</details>
|
||||
----
|
||||
|
||||
|
||||
Cut wires to the length of the distance from the a point on each column/row to the controller. You can solder anywhere along the row, as long as it's after the diode - soldering before the diode (on the keyswitch side) will cause that row not to work.
|
||||
|
||||
@ -301,150 +171,32 @@ As you solder the wires to the controller make a note of which row/column is goi
|
||||
As you move along, be sure that the controller is staying in place - recutting and soldering the wires is a pain!
|
||||
|
||||
|
||||
|
||||
# Getting Some Basic Firmware Set Up
|
||||
## Getting Some Basic Firmware Set Up
|
||||
|
||||
From here, you should have a working keyboard once you program a firmware.
|
||||
|
||||
Simple firmware can be created easily using the [Keyboard Firmware Builder](https://kbfirmware.com/) website. Recreate your layout using [Keyboard Layout Editor](http://www.keyboard-layout-editor.com), import it and recreate the matrix (if not already done as part of [planning the matrix](#planning-the-matrix).
|
||||
|
||||
Go through the rest of the tabs, assigning keys until you get to the last one where you can compile and download your firmware. The .hex file can be flashed straight onto your keyboard, and the .zip of source files can be modified for advanced functionality and compiled locally using the method described in the collapsable section below, or using the more comprehensive [getting started guide.](newbs_getting_started)
|
||||
Go through the rest of the tabs, assigning keys until you get to the last one where you can compile and download your firmware. The .hex file can be flashed straight onto your keyboard, and the .zip of source files can be modified for advanced functionality and compiled locally using the method described in [Building Your First Firmware](newbs_building_firmware?id=build-your-firmware).
|
||||
|
||||
The source given by Keyboard Firmware Builder is QMK, but is based on a version of QMK from early 2017. To compile the code from your .zip file in a modern version of QMK Firmware, you'll need to open the .zip and follow these instructions:
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Creating and compiling your firmware locally (command line method)</summary>
|
||||
|
||||
To start out, download [the firmware](https://github.com/qmk/qmk_firmware/) - We'll be doing a lot from the Terminal/command prompt, so get that open, along with a decent text editor like [Sublime Text](http://www.sublimetext.com/) (paid) or [Visual Studio Code](https://code.visualstudio.com) (free).
|
||||
|
||||
The first thing we're going to do is create a new keyboard. In your terminal, run this command, which will ask you some questions and generate a basic keyboard project:
|
||||
|
||||
```
|
||||
./util/new_keyboard.sh
|
||||
```
|
||||
|
||||
You'll want to navigate to the `keyboards/<project_name>/` folder by typing, like the print-out from the script specifies:
|
||||
|
||||
```
|
||||
cd keyboards/<project_name>
|
||||
```
|
||||
|
||||
### `config.h`
|
||||
|
||||
The first thing you're going to want to modify is the `config.h` file. Find `MATRIX_ROWS` and `MATRIX_COLS` and change their definitions to match the dimensions of your keyboard's matrix.
|
||||
|
||||
Farther down are `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`. Change their definitions to match how you wired up your matrix (looking from the top of the keyboard, the rows run top-to-bottom and the columns run left-to-right). Likewise, change the definition of `UNUSED_PINS` to match the pins you did not use (this will save power).
|
||||
|
||||
### `<project_name>.h`
|
||||
|
||||
The next file you'll want to look at is `<project_name>.h`. You're going to want to rewrite the `LAYOUT` definition - the format and syntax here is extremely important, so pay attention to how things are setup. The first half of the definition are considered the arguments - this is the format that you'll be following in your keymap later on, so you'll want to have as many k*xy* variables here as you do keys. The second half is the part that the firmware actually looks at, and will contain gaps depending on how you wired your matrix.
|
||||
|
||||
We'll dive into how this will work with the following example. Say we have a keyboard like this:
|
||||
|
||||
```
|
||||
┌───┬───┬───┐
|
||||
│ │ │ │
|
||||
├───┴─┬─┴───┤
|
||||
│ │ │
|
||||
└─────┴─────┘
|
||||
```
|
||||
|
||||
This can be described by saying the top row is 3 1u keys, and the bottom row is 2 1.5u keys. The difference between the two rows is important, because the bottom row has an unused column spot (3 v 2). Let's say that this is how we wired the columns:
|
||||
|
||||
```
|
||||
┌───┬───┬───┐
|
||||
│ ┋ │ ┋ │ ┋ │
|
||||
├─┋─┴─┬─┴─┋─┤
|
||||
│ ┋ │ ┋ │
|
||||
└─────┴─────┘
|
||||
```
|
||||
|
||||
The middle column is unused on the bottom row in this example. Our `LAYOUT` definition would look like this:
|
||||
|
||||
```
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, \
|
||||
k10, k11, \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02 }, \
|
||||
{ k10, KC_NO, k11 }, \
|
||||
1. Extract the `kb` folder to `qmk_firmware/keyboards/handwired/`.
|
||||
2. Open the extracted `kb` folder, then proceed to the `keymaps/default/` folder, and open `keymap.c`.
|
||||
3. Locate and delete the `action_get_macro` code block:
|
||||
```
|
||||
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) {
|
||||
...
|
||||
return MACRO_NONE;
|
||||
}
|
||||
```
|
||||
|
||||
Notice how the top half is spaced to resemble our physical layout - this helps us understand which keys are associated with which columns. The bottom half uses the keycode `KC_NO` where there is no keyswitch wired in. It's easiest to keep the bottom half aligned in a grid to help us make sense of how the firmware actually sees the wiring.
|
||||
|
||||
Let's say that instead, we wired our keyboard like this (a fair thing to do):
|
||||
|
||||
```
|
||||
┌───┬───┬───┐
|
||||
│ ┋ │ ┋│ ┋ │
|
||||
├─┋─┴─┬┋┴───┤
|
||||
│ ┋ │┋ │
|
||||
└─────┴─────┘
|
||||
```
|
||||
|
||||
This would require our `LAYOUT` definition to look like this:
|
||||
|
||||
```
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, \
|
||||
k10, k11, \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02 }, \
|
||||
{ k10, k11, KC_NO }, \
|
||||
}
|
||||
```
|
||||
|
||||
Notice how the `k11` and `KC_NO` switched places to represent the wiring, and the unused final column on the bottom row. Sometimes it'll make more sense to put a keyswitch on a particular column, but in the end, it won't matter, as long as all of them are accounted for. You can use this process to write out the `LAYOUT` for your entire keyboard - be sure to remember that your keyboard is actually backwards when looking at the underside of it.
|
||||
|
||||
### `keymaps/<variant>/default.c`
|
||||
|
||||
This is the actual keymap for your keyboard, and the main place you'll make changes as you perfect your layout. `default.c` is the file that gets pull by default when typing `make`, but you can make other files as well, and specify them by typing `make handwired/<keyboard>:<variant>`, which will pull `keymaps/<variant>/keymap.c`.
|
||||
|
||||
The basis of a keymap is its layers - by default, layer 0 is active. You can activate other layers, the highest of which will be referenced first. Let's start with our base layer.
|
||||
|
||||
Using our previous example, let's say we want to create the following layout:
|
||||
|
||||
```
|
||||
┌───┬───┬───┐
|
||||
│ A │ 1 │ H │
|
||||
├───┴─┬─┴───┤
|
||||
│ TAB │ SPC │
|
||||
└─────┴─────┘
|
||||
```
|
||||
|
||||
This can be accomplished by using the following `keymaps` definition:
|
||||
|
||||
```
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT( /* Base */
|
||||
KC_A, KC_1, KC_H, \
|
||||
KC_TAB, KC_SPC \
|
||||
),
|
||||
};
|
||||
```
|
||||
|
||||
Note that the layout of the keycodes is similar to the physical layout of our keyboard - this make it much easier to see what's going on. A lot of the keycodes should be fairly obvious, but for a full list of them, check out [Keycodes](keycodes.md) - there are also a lot of aliases to condense your keymap file.
|
||||
|
||||
It's also important to use the `LAYOUT` function we defined earlier - this is what allows the firmware to associate our intended readable keymap with the actual wiring.
|
||||
|
||||
## Compiling Your Firmware
|
||||
|
||||
After you've written out your entire keymap, you're ready to get the firmware compiled and onto your Teensy. Before compiling, you'll need to get your [development environment set-up](getting_started_build_tools.md) - you can skip the dfu-programmer instructions, but you'll need to download and install the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to get the firmware on your Teensy.
|
||||
|
||||
Once everything is installed, running `make` in the terminal should get you some output, and eventually a `<project_name>.hex` file in that folder. If you're having trouble with this step, see the end of the guide for the trouble-shooting section.
|
||||
|
||||
Once you have your `<project_name>.hex` file, open up the Teensy loader application, and click the file icon. From here, navigate to your `QMK/keyboards/<project_name>/` folder, and select the `<project_name>.hex` file. Plug in your keyboard and press the button on the Teensy - you should see the LED on the device turn off once you do. The Teensy Loader app will change a little, and the buttons should be clickable - click the download button (down arrow), and then the reset button (right arrow), and your keyboard should be ready to go!
|
||||
|
||||
</details>
|
||||
```
|
||||
4. Save and close `keymap.c`.
|
||||
|
||||
## Flashing the Firmware
|
||||
|
||||
Install [QMK toolbox](https://github.com/qmk/qmk_toolbox).
|
||||
Install [QMK Toolbox](https://github.com/qmk/qmk_toolbox).
|
||||
|
||||

|
||||

|
||||
|
||||
Under "Local File" navigate to your newly created .hex file. Under "Microcontroller", select the corresponding one for your controller board (common ones available [here](#common-microcontroller-boards)).
|
||||
|
||||
@ -453,20 +205,20 @@ Plug in your keyboard and press the reset button (or short the Reset and Ground
|
||||
|
||||
## Testing Your Firmware
|
||||
|
||||
Use a website such as [keyboard tester](https://www.keyboardtester.com/tester.html)/[keyboard checker](http://keyboardchecker.com/) or just open a text editor and try typing - you should get the characters that you put into your keymap. Test each key, and make a note of the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys:
|
||||
Use a website such as [QMK Configurator's Keyboard Tester](https://config.qmk.fm/#/test), [Keyboard Tester](https://www.keyboardtester.com/tester.html), or [Keyboard Checker](http://keyboardchecker.com/) or just open a text editor and try typing - you should get the characters that you put into your keymap. Test each key, and make a note of the ones that aren't working. Here's a quick trouble-shooting guide for non-working keys:
|
||||
|
||||
0. Flip the keyboard back over and short the keyswitch's contacts with a piece wire - this will eliminate the possibility of the keyswitch being bad and needing to be replaced.
|
||||
1. Check the solder points on the keyswitch - these need to be plump and whole. If you touch it with a moderate amount of force and it comes apart, it's not strong enough.
|
||||
2. Check the solder joints on the diode - if the diode is loose, part of your row may register, while the other may not.
|
||||
3. Check the solder joints on the columns - if your column wiring is loose, part or all of the column may not work.
|
||||
4. Check the solder joints on both sides of the wires going to/from the Teensy - the wires need to be fully soldered and connect to both sides.
|
||||
5. Check the `<project_name>.h` file for errors and incorrectly placed `KC_NO`s - if you're unsure where they should be, instead duplicate a k*xy* variable.
|
||||
6. Check to make sure you actually compiled the firmware and flashed the Teensy correctly. Unless you got error messages in the terminal, or a pop-up during flashing, you probably did everything correctly.
|
||||
7. Use a multimeter to check that the switch is actually closing when actuated (completing the circuit when pressed down).
|
||||
1. Flip the keyboard back over and short the keyswitch's contacts with a piece wire - this will eliminate the possibility of the keyswitch being bad and needing to be replaced.
|
||||
2. Check the solder points on the keyswitch - these need to be plump and whole. If you touch it with a moderate amount of force and it comes apart, it's not strong enough.
|
||||
3. Check the solder joints on the diode - if the diode is loose, part of your row may register, while the other may not.
|
||||
4. Check the solder joints on the columns - if your column wiring is loose, part or all of the column may not work.
|
||||
5. Check the solder joints on both sides of the wires going to/from the Teensy - the wires need to be fully soldered and connect to both sides.
|
||||
6. Check the `<project_name>.h` file for errors and incorrectly placed `KC_NO`s - if you're unsure where they should be, instead duplicate a k*xy* variable.
|
||||
7. Check to make sure you actually compiled the firmware and flashed the Teensy correctly. Unless you got error messages in the terminal, or a pop-up during flashing, you probably did everything correctly.
|
||||
8. Use a multimeter to check that the switch is actually closing when actuated (completing the circuit when pressed down).
|
||||
|
||||
If you've done all of these things, keep in mind that sometimes you might have had multiple things affecting the keyswitch, so it doesn't hurt to test the keyswitch by shorting it out at the end.
|
||||
|
||||
# Finishing up
|
||||
## Finishing up
|
||||
|
||||
Once you have confirmed that the keyboard is working, if you have used a seperate (non handwire specific) controller you will want to secure it in place. This can be done in many different ways e.g. hot glue, double sided sticky tape, 3D printed caddy, electrical tape.
|
||||
|
||||
@ -474,7 +226,7 @@ If you found this fullfilling you could experiment by adding additional features
|
||||
|
||||
There are a lot of possibilities inside the firmware - explore [docs.qmk.fm](http://docs.qmk.fm) for a full feature list, and dive into the different keyboards to see how people use all of them. You can always stop by [the OLKB subreddit](http://reddit.com/r/olkb) or [QMK Discord](https://discord.gg/Uq7gcHh) for help!
|
||||
|
||||
# Links to other guides:
|
||||
## Links to Other Guides
|
||||
|
||||
- [matt3o's step by step guide (BrownFox build)](https://deskthority.net/viewtopic.php?f=7&t=6050) also his [website](https://matt3o.com/hand-wiring-a-custom-keyboard/) and [video guide](https://www.youtube.com/watch?v=LVzpsjFWPP4)
|
||||
- [Cribbit's "Modern hand wiring guide - stronger, cleaner, easier"](https://geekhack.org/index.php?topic=87689.0)
|
||||
@ -483,4 +235,10 @@ There are a lot of possibilities inside the firmware - explore [docs.qmk.fm](htt
|
||||
- [Masterzen's "Handwired keyboard build log"](http://www.masterzen.fr/2018/12/16/handwired-keyboard-build-log-part-1/)
|
||||
|
||||
|
||||
# Legacy Content
|
||||
|
||||
This page used to include more content. We have moved a section that used to be part of this page its own page. Everything below this point is simply a redirect so that people following old links on the web find what they're looking for.
|
||||
|
||||
## Preamble: How a Keyboard Matrix Works (and why we need diodes) :id=preamble-how-a-keyboard-matrix-works-and-why-we-need-diodes
|
||||
|
||||
* [How a Keyboard Matrix Works](how_a_matrix_works.md)
|
||||
|
@ -1,8 +0,0 @@
|
||||
# Hardware
|
||||
|
||||
QMK runs on a variety of hardware. If your processor can be targeted by [LUFA](http://www.fourwalledcubicle.com/LUFA.php) or [ChibiOS](http://www.chibios.com) you can probably get QMK running on it. This section explores getting QMK running on, and communicating with, hardware of all kinds.
|
||||
|
||||
* [Keyboard Guidelines](hardware_keyboard_guidelines.md)
|
||||
* [AVR Processors](hardware_avr.md)
|
||||
* ARM Processors (TBD)
|
||||
* [Drivers](hardware_drivers.md)
|
@ -93,7 +93,7 @@
|
||||
* [Macros](he-il/feature_macros.md)
|
||||
* [Mouse Keys](he-il/feature_mouse_keys.md)
|
||||
* [OLED Driver](he-il/feature_oled_driver.md)
|
||||
* [One Shot Keys](he-il/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [One Shot Keys](he-il/one_shot_keys.md)
|
||||
* [Pointing Device](he-il/feature_pointing_device.md)
|
||||
* [PS/2 Mouse](he-il/feature_ps2_mouse.md)
|
||||
* [RGB Lighting](he-il/feature_rgblight.md)
|
||||
@ -124,7 +124,7 @@
|
||||
* נושאים נוספים
|
||||
* [שימוש ב - Eclipse עם QMK](he-il/other_eclipse.md)
|
||||
* [שימוש ב - VSCode עם QMK](he-il/other_vscode.md)
|
||||
* [תמיכה](he-il/support.md)
|
||||
* [תמיכה](he-il/getting_started_getting_help.md)
|
||||
* [כיצד להוסיף תרגום](he-il/translating.md)
|
||||
|
||||
* QMK מבפנים (בתהליך)
|
||||
|
@ -1,11 +0,0 @@
|
||||
<div dir="rtl" markdown="1">
|
||||
# איך להפוך לשותף של QMK
|
||||
|
||||
שותף של QMK הוא יצרן מקלדות או מעצב שמעוניין בלעזור ל-QMK לגדול ולתמוך במקלד(ו)ת שלהם, ולעודד את המשתמשים והצרכנים להוסיף יכולות, רעיונות ומיפויים. אנחנו תמיד מחפשים עוד מקלדות ומשתפי פעולה, אבל אנחנו מבקשים שיעמדו בדרישות הבאות:
|
||||
|
||||
* **קיום לוח PCB למכירה.** לצערינו, יש יותר מידי הסתבכויות ובעיות עם מקלדות המחווטות ידנית.
|
||||
* **תחזוק המקלדת ב-QMK.** זה אולי רק ידרוש הגדרה בסיסית כדי לגרום למקלדת לעבוד, אבל זה גם יכול לכלול התאמה של שינויים בקוד הליבה של QMK שיכול לשבור קוד ייחודי שלכם.
|
||||
* **אישור ומיזוג Pull Requests של מיפויי מקלדת עבור המקלדת** אנחנו רוצים לעודד משתמשים לתרום את מיפויי המקלדת שלהם לאחרים כדי לעזור לאחרים להתחיל ליצור את שלהם.
|
||||
|
||||
אם אתם עומדים בדרישות הללו, שלחו לנו מייל לכתובת hello@qmk.fm עם מבוא וקישורים עבור המקלדת שלכם.
|
||||
</div>
|
99
docs/how_a_matrix_works.md
Normal file
99
docs/how_a_matrix_works.md
Normal file
@ -0,0 +1,99 @@
|
||||
# How a Keyboard Matrix Works
|
||||
|
||||
Keyboard switch matrices are arranged in rows and columns. Without a matrix circuit, each switch would require its own wire directly to the controller.
|
||||
|
||||
When the circuit is arranged in rows and columns, if a key is pressed, a column wire makes contact with a row wire and completes a circuit. The keyboard controller detects this closed circuit and registers it as a key press.
|
||||
|
||||
The microcontroller will be set up via the firmware to send a logical 1 to the columns, one at a time, and read from the rows, all at once - this process is called matrix scanning. The matrix is a bunch of open switches that, by default, don't allow any current to pass through - the firmware will read this as no keys being pressed. As soon as you press one key down, the logical 1 that was coming from the column the keyswitch is attached to gets passed through the switch and to the corresponding row - check out the following 2x2 example:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
row0 ---(key0)---(key1) row0 ---(key0)---(key1)
|
||||
| | | |
|
||||
row1 ---(key2)---(key3) row1 ---(key2)---(key3)
|
||||
|
||||
The `x` represents that the column/row associated has a value of 1, or is HIGH. Here, we see that no keys are being pressed, so no rows get an `x`. For one keyswitch, keep in mind that one side of the contacts is connected to its row, and the other, its column.
|
||||
|
||||
When we press `key0`, `col0` gets connected to `row0`, so the values that the firmware receives for that row is `0b01` (the `0b` here means that this is a bit value, meaning all of the following digits are bits - 0 or 1 - and represent the keys in that column). We'll use this notation to show when a keyswitch has been pressed, to show that the column and row are being connected:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
x row0 ---(-+-0)---(key1) row0 ---(-+-0)---(key1)
|
||||
| | | |
|
||||
row1 ---(key2)---(key3) row1 ---(key2)---(key3)
|
||||
|
||||
We can now see that `row0` has an `x`, so has the value of 1. As a whole, the data the firmware receives when `key0` is pressed is:
|
||||
|
||||
col0: 0b01
|
||||
col1: 0b00
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
A problem arises when you start pressing more than one key at a time. Looking at our matrix again, it should become pretty obvious:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
| | | |
|
||||
x row0 ---(-+-0)---(-+-1) x row0 ---(-+-0)---(-+-1)
|
||||
| | | |
|
||||
x row1 ---(key2)---(-+-3) x row1 ---(key2)---(-+-3)
|
||||
|
||||
Remember that this ^ is still connected to row1
|
||||
|
||||
The data we get from that is:
|
||||
|
||||
col0: 0b11
|
||||
col1: 0b11
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
Which isn't accurate, since we only have 3 keys pressed down, not all 4. This behavior is called ghosting, and only happens in odd scenarios like this, but can be much more common on a bigger keyboard. The way we can get around this is by placing a diode after the keyswitch, but before it connects to its row. A diode only allows current to pass through one way, which will protect our other columns/rows from being activated in the previous example. We'll represent a dioded matrix like this;
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
│ │ | │
|
||||
(key0) (key1) (key0) (key1)
|
||||
! │ ! │ ! | ! │
|
||||
row0 ─────┴────────┘ │ row0 ─────┴────────┘ │
|
||||
│ │ | │
|
||||
(key2) (key3) (key2) (key3)
|
||||
! ! ! !
|
||||
row1 ─────┴────────┘ row1 ─────┴────────┘
|
||||
|
||||
In practical applications, the black line of the diode will be placed facing the row, and away from the keyswitch - the `!` in this case is the diode, where the gap represents the black line. A good way to remember this is to think of this symbol: `>|`
|
||||
|
||||
Now when we press the three keys, invoking what would be a ghosting scenario:
|
||||
|
||||
Column 0 being scanned Column 1 being scanned
|
||||
x x
|
||||
col0 col1 col0 col1
|
||||
│ │ │ │
|
||||
(┌─┤0) (┌─┤1) (┌─┤0) (┌─┤1)
|
||||
! │ ! │ ! │ ! │
|
||||
x row0 ─────┴────────┘ │ x row0 ─────┴────────┘ │
|
||||
│ │ │ │
|
||||
(key2) (┌─┘3) (key2) (┌─┘3)
|
||||
! ! ! !
|
||||
row1 ─────┴────────┘ x row1 ─────┴────────┘
|
||||
|
||||
Things act as they should! Which will get us the following data:
|
||||
|
||||
col0: 0b01
|
||||
col1: 0b11
|
||||
│└row0
|
||||
└row1
|
||||
|
||||
The firmware can then use this correct data to detect what it should do, and eventually, what signals it needs to send to the OS.
|
||||
|
||||
Further reading:
|
||||
- [Wikipedia article](https://en.wikipedia.org/wiki/Keyboard_matrix_circuit)
|
||||
- [Deskthority article](https://deskthority.net/wiki/Keyboard_matrix)
|
||||
- [Keyboard Matrix Help by Dave Dribin (2000)](https://www.dribin.org/dave/keyboard/one_html/)
|
||||
- [How Key Matrices Works by PCBheaven](http://pcbheaven.com/wikipages/How_Key_Matrices_Works/) (animated examples)
|
||||
- [How keyboards work - QMK documentation](how_keyboards_work.md)
|
@ -13,8 +13,9 @@
|
||||
<meta property="og:image" content="https://i.imgur.com/svjvIrw.jpg">
|
||||
<meta property="og:url" content="https://docs.qmk.fm">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css" title="light">
|
||||
<link rel="stylesheet" href="qmk.css" title="dark" disabled>
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/buble.css" title="light">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/dark.css" media="(prefers-color-scheme: dark)">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify-toc@1.0.0/dist/toc.css">
|
||||
<link rel="stylesheet" href="sidebar.css" />
|
||||
</head>
|
||||
<body>
|
||||
@ -22,10 +23,26 @@
|
||||
<script>
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
// Translation aliases
|
||||
'/en/(.*)': '/$1',
|
||||
'/en-us/(.*)': '/$1',
|
||||
'/en-gb/(.*)': '/$1',
|
||||
'/.*/_langs.md': '/_langs.md',
|
||||
|
||||
// Moved pages
|
||||
'/adding_a_keyboard_to_qmk': '/hardware_keyboard_guidelines',
|
||||
'/build_environment_setup': '/getting_started_build_tools',
|
||||
'/dynamic_macros': '/feature_dynamic_macros',
|
||||
'/feature_common_shortcuts': '/feature_advanced_keycodes',
|
||||
'/glossary': '/reference_glossary',
|
||||
'/key_lock': '/feature_key_lock',
|
||||
'/make_instructions': '/getting_started_make_guide',
|
||||
'/porting_your_keyboard_to_qmk': '/hardware_avr',
|
||||
'/space_cadet_shift': '/feature_space_cadet_shift',
|
||||
'/getting_started_getting_help': '/support',
|
||||
'/tap_dance': '/feature_tap_dance',
|
||||
'/unicode': '/feature_unicode',
|
||||
'/python_development': '/cli_development',
|
||||
},
|
||||
basePath: '/',
|
||||
name: 'QMK Firmware',
|
||||
@ -45,6 +62,7 @@
|
||||
loadNavbar: '_langs.md',
|
||||
mergeNavbar: true,
|
||||
auto2top: true,
|
||||
autoHeader: true,
|
||||
fallbackLanguages: [
|
||||
'de',
|
||||
'es',
|
||||
@ -74,6 +92,36 @@
|
||||
},
|
||||
depth: 6
|
||||
},
|
||||
markdown: {
|
||||
smartypants: true,
|
||||
smartLists: true,
|
||||
},
|
||||
copyCode: {
|
||||
buttonText: {
|
||||
'/zh-cn/': '点击复制',
|
||||
'/ru/' : 'Скопировать в буфер обмена',
|
||||
'/de-de/': 'Klicken Sie zum Kopieren',
|
||||
'/es/' : 'Haga clic para copiar',
|
||||
'/' : 'Copy to clipboard'
|
||||
},
|
||||
errorText: {
|
||||
'/zh-cn/': '错误',
|
||||
'/ru/' : 'ошибка',
|
||||
'/' : 'Error'
|
||||
},
|
||||
successText: {
|
||||
'/zh-cn/': '复制',
|
||||
'/ru/' : 'Скопировано',
|
||||
'/de-de/': 'Kopiert',
|
||||
'/es/' : 'Copiado',
|
||||
'/' : 'Copied'
|
||||
}
|
||||
},
|
||||
toc: {
|
||||
scope: '.markdown-section',
|
||||
headings: 'h1, h2',
|
||||
title: 'Table of Contents',
|
||||
},
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
hook.beforeEach(function (html) {
|
||||
@ -96,13 +144,16 @@
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
|
||||
<script src="//unpkg.com/docsify-copy-code@2"></script>
|
||||
<script src="//unpkg.com/docsify-toc@1.0.0/dist/toc.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-c.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-cpp.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-makefile.min.js"></script>
|
||||
<script>
|
||||
// Register the offline cache worker
|
||||
// Register the cache worker for offline viewing mode
|
||||
// https://docsify.now.sh/pwa
|
||||
if (typeof navigator.serviceWorker !== 'undefined') {
|
||||
navigator.serviceWorker.register('sw.js')
|
||||
}
|
||||
|
@ -1,6 +1,14 @@
|
||||
# ISP Flashing Guide
|
||||
|
||||
If you're having trouble flashing/erasing your board, and running into cryptic error messages like any of the following:
|
||||
ISP flashing (also known as ICSP flashing) is the process of programming a microcontroller directly. This allows you to replace the bootloader, or change the "fuses" on the controller, which control a number of hardware- and software-related functions, such as the speed of the controller, how it boots, and other options.
|
||||
|
||||
The main use of ISP flashing for QMK is flashing or replacing the bootloader on your AVR-based controller (Pro Micros, or V-USB chips).
|
||||
|
||||
?> This is only for programming AVR based boards, such as the Pro Micro or other ATmega controllers. It is not for Arm controllers, such as the Proton C.
|
||||
|
||||
## Dealing with Corrupted Bootloaders
|
||||
|
||||
If you're having trouble flashing/erasing your board, and running into cryptic error messages like any of the following for a DFU based controller:
|
||||
|
||||
libusb: warning [darwin_transfer_status] transfer error: timed out
|
||||
dfu.c:844: -ETIMEDOUT: Transfer timed out, NAK 0xffffffc4 (-60)
|
||||
@ -19,16 +27,60 @@ If you're having trouble flashing/erasing your board, and running into cryptic e
|
||||
Memory write error, use debug for more info.
|
||||
commands.c:360: Error writing memory data. (err -4)
|
||||
|
||||
You're likely going to need to ISP flash your board/device to get it working again. Luckily, this process is pretty straight-forward, provided you have any extra programmable keyboard, Pro Micro, or Teensy 2.0/Teensy 2.0++. There are also dedicated ISP flashers available for this, but most cost >$15, and it's assumed that if you are googling this error, this is the first you've heard about ISP flashing, and don't have one readily available (whereas you might have some other AVR board). __We'll be using a Teensy 2.0 or Pro Micro with Windows 10 in this guide__ - if you are comfortable doing this on another system, please consider editing this guide and contributing those instructions!
|
||||
Or, if you see this sort of message for a Pro Micro based controller:
|
||||
|
||||
avrdude: butterfly_recv(): programmer is not responding
|
||||
avrdude: butterfly_recv(): programmer is not responding
|
||||
avrdude: verification error, first mismatch at byte 0x002a
|
||||
0x2b != 0x75
|
||||
avrdude: verification error; content mismatch
|
||||
avrdude: verification error; content mismatch
|
||||
|
||||
|
||||
You're likely going to need to ISP flash your board/device to get it working again.
|
||||
|
||||
## Hardware Needed
|
||||
|
||||
You'll need one of the following to actually perform the ISP flashing (followed by the protocol they use):
|
||||
|
||||
* [SparkFun PocketAVR](https://www.sparkfun.com/products/9825) - (USB Tiny)
|
||||
* [USBtinyISP AVR Programmer Kit](https://www.adafruit.com/product/46) - (USB Tiny)
|
||||
* [Teensy 2.0](https://www.pjrc.com/store/teensy.html) - (avrisp)
|
||||
* [Pro Micro](https://www.sparkfun.com/products/12640) - (avrisp)
|
||||
* [Bus Pirate](https://www.adafruit.com/product/237) - (buspirate)
|
||||
|
||||
There are other devices that can be used to ISP flash, but these are the main ones. Also, all product links are to the official versions. You can source them elsewhere.
|
||||
|
||||
You'll also need something to wire your "ISP Programmer" to the device that you're programming. Some PCBs may have ISP headers that you can use directly, but this often isn't the case, so you'll likely need to solder to the controller itself or to different switches or other components.
|
||||
|
||||
### The ISP Firmware
|
||||
|
||||
The Teensy and Pro Micro controllers will need you to flash the ISP firmware to the controllers before you can use them as an ISP programmer. The rest of the hardware should come preprogrammed. So, for these controllers, download the correct hex file, and flash it first.
|
||||
|
||||
* Teensy 2.0: [`util/teensy_2.0_ISP_B0.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/teensy_2.0_ISP_B0.hex) (`B0`)
|
||||
* Pro Micro: [`util/pro_micro_ISP_B6_10.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/pro_micro_ISP_B6_10.hex) (`10/B6`)
|
||||
|
||||
Once you've flashed your controller, you won't need this hex file anymore.
|
||||
|
||||
## Software Needed
|
||||
|
||||
* [Teensy Loader](https://www.pjrc.com/teensy/loader.html) (if using a Teensy)
|
||||
* QMK Toolbox (flash as usual - be sure to select the correct MCU) or `avrdude` via [WinAVR](http://www.ladyada.net/learn/avr/setup-win.html) (for Teensy & Pro Micro)
|
||||
The QMK Toolbox can be used for most (all) of this.
|
||||
|
||||
However, you can grab the [Teensy Loader](https://www.pjrc.com/teensy/loader.html) to flash your Teensy 2.0 board, if you are using that. Or you can use `avrdude` (installed as part of `qmk_install.sh`), or [AVRDUDESS](https://blog.zakkemble.net/avrdudess-a-gui-for-avrdude/) (for Windows) to flash the Pro Micro, and the ISP flashing.
|
||||
|
||||
|
||||
## Wiring
|
||||
|
||||
This is pretty straight-forward - we'll be connecting like-things to like-things in the following manner:
|
||||
This is pretty straight-forward - we'll be connecting like-things to like-things in the following manner.
|
||||
|
||||
### SparkFun Pocket AVR
|
||||
|
||||
PocketAVR RST <-> Keyboard RESET
|
||||
PocketAVR SCLK <-> Keyboard B1 (SCLK)
|
||||
PocketAVR MOSI <-> Keyboard B2 (MOSI)
|
||||
PocketAVR MISO <-> Keyboard B3 (MISO)
|
||||
PocketAVR VCC <-> Keyboard VCC
|
||||
PocketAVR GND <-> Keyboard GND
|
||||
|
||||
### Teensy 2.0
|
||||
|
||||
@ -39,6 +91,8 @@ This is pretty straight-forward - we'll be connecting like-things to like-things
|
||||
Teensy VCC <-> Keyboard VCC
|
||||
Teensy GND <-> Keyboard GND
|
||||
|
||||
!> Note that the B0 pin on the Teensy is wired to the RESET/RST pin on the keyboard's controller. ***DO NOT*** wire the RESET pin on the Teensy to the RESET on the keyboard.
|
||||
|
||||
### Pro Micro
|
||||
|
||||
Pro Micro 10 (B6) <-> Keyboard RESET
|
||||
@ -48,45 +102,61 @@ This is pretty straight-forward - we'll be connecting like-things to like-things
|
||||
Pro Micro VCC <-> Keyboard VCC
|
||||
Pro Micro GND <-> Keyboard GND
|
||||
|
||||
## The ISP Firmware (now pre-compiled)
|
||||
!> Note that the 10/B6 pin on the Pro Micro is wired to the RESET/RST pin on the keyboard's controller. ***DO NOT*** wire the RESET pin on the Pro Micro to the RESET on the keyboard.
|
||||
|
||||
The only difference between the .hex files below is which pin is connected to RESET. You can use them on other boards as well, as long as you're aware of the pins being used. If for some reason neither of these pins are available, [create an issue](https://github.com/qmk/qmk_firmware/issues/new), and we can generate one for you!
|
||||
|
||||
* Teensy 2.0: [`util/teensy_2.0_ISP_B0.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/teensy_2.0_ISP_B0.hex) (`B0`)
|
||||
* Pro Micro: [`util/pro_micro_ISP_B6_10.hex`](https://github.com/qmk/qmk_firmware/blob/master/util/pro_micro_ISP_B6_10.hex) (`B6/10`)
|
||||
## Flashing Your Keyboard
|
||||
|
||||
**Flash your Teenys/Pro Micro with one of these and continue - you won't need the file after flashing your ISP device.**
|
||||
After you have your ISP programmer set up, and wired to your keyboard, it's time to flash your keyboard.
|
||||
|
||||
## Just the Bootloader File
|
||||
### The Bootloader File
|
||||
|
||||
If you just want to get things back to normal, you can flash only a bootloader from [`util/` folder](https://github.com/qmk/qmk_firmware/tree/master/util), and use your normal process to flash the firmware afterwards. Be sure to flash the correct bootloader for your chip:
|
||||
The simplest and quickest way to get things back to normal is to flash only a bootloader to the keyboard. Once this is done, you can connect the keyboard normally and flash the keyboard like you normally would.
|
||||
|
||||
You can find the stock bootloaders in the [`util/` folder](https://github.com/qmk/qmk_firmware/tree/master/util). Be sure to flash the correct bootloader for your chip:
|
||||
|
||||
* [`atmega32u4`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32u4_1_0_0.hex) - Most keyboards, Planck Rev 1-5, Preonic Rev 1-2
|
||||
* [`Pro Micro`](https://github.com/sparkfun/Arduino_Boards/blob/master/sparkfun/avr/bootloaders/caterina/Caterina-promicro16.hex) - The default bootloader for Pro Micro controllers
|
||||
* [`at90usb1286`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_at90usb128x_1_0_1.hex) - Planck Light Rev 1
|
||||
* [`atmega32a`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32a_1_0_0.hex) - jj40
|
||||
* [`atmega32a`](https://github.com/qmk/qmk_firmware/blob/master/util/bootloader_atmega32a_1_0_0.hex) - jj40, and other V-USB/ps2avrGB keyboards
|
||||
|
||||
If you're not sure what your board uses, look in the `rules.mk` file for the keyboard in QMK. The `MCU =` line will have the value you need. It may differ between different versions of the board.
|
||||
|
||||
### Advanced/Production Techniques
|
||||
### Production Techniques
|
||||
|
||||
If you'd like to flash both the bootloader **and** the regular firmware at the same time, you need to combine the files.
|
||||
If you'd like to flash both the bootloader **and** the regular firmware at the same time, there are two options to do so. Manually, or with the `:production` target when compiling.
|
||||
|
||||
To do this manually:
|
||||
|
||||
1. Open the original firmware .hex file in a text editor
|
||||
2. Remove the last line (which should be `:00000001FF` - this is an EOF message)
|
||||
3. Copy the entire bootloader's contents onto a new line (with no empty lines between) and paste it at the end of the original file
|
||||
4. Save it as a new file by naming it `<keyboard>_<keymap>_production.hex`
|
||||
|
||||
It's possible to use other bootloaders here in the same way, but __you need a bootloader__, otherwise you'll have to use ISP again to write new firmware to your keyboard.
|
||||
?> It's possible to use other bootloaders here in the same way, but __you need a bootloader__, otherwise you'll have to use ISP again to write new firmware to your keyboard.
|
||||
|
||||
To do this the easy way, you can flash the board using the `:production` target when compiling. This compiles the firmware, then compiles the QMK DFU bootloader, and then creates a combined image. Once this is done, you'll see three files:
|
||||
* `<keyboard>_<keymap>.hex`
|
||||
* `<keyboard>_<keymap>_bootloader.hex`
|
||||
* `<keyboard>_<keymap>_production.hex`
|
||||
|
||||
The QMK DFU bootloader has only really been tested on `atmega32u4` controllers (such as the AVR based Planck boards, and the Pro Micro), and hasn't been tested on other controllers. However, it will definitely not work on V-USB controllers, such as the `atmega32a` or `atmega328p`.
|
||||
|
||||
You can flash either the bootloader or the production firmware file. The production firmware file will take a lot longer to flash, since it's flashing a lot more data.
|
||||
|
||||
?> Note: You should stay with the same bootloader. If you're using DFU already, switching to QMK DFU is fine. But flashing QMK DFU onto a Pro Micro, for instance, has additional steps needed.
|
||||
|
||||
## Flashing Your Bootloader/Production File
|
||||
|
||||
Make sure your keyboard is unplugged from any device, and plug in your Teensy.
|
||||
Make sure your keyboard is unplugged from any device, and plug in your ISP Programmer.
|
||||
|
||||
If you want to change bootloader types, You'll need to use the command line.
|
||||
|
||||
### QMK Toolbox
|
||||
|
||||
1. `AVRISP device connected` will show up in yellow
|
||||
1. `AVRISP device connected` or `USB Tiny device connected` will show up in yellow
|
||||
2. Select the correct bootloader/production .hex file with the `Open` dialog (spaces can't be in the path)
|
||||
3. Be sure the correct `Microcontroller` option is selected
|
||||
3. Be sure the correct `Microcontroller` option for the keyboard you're flashing (not the ISP programmer) is selected
|
||||
4. Hit `Flash`
|
||||
5. Wait, as nothing will output for a while, especially with production files
|
||||
|
||||
@ -94,7 +164,7 @@ If the verification and fuse checks are ok, you're done! Your board may restart
|
||||
|
||||
### Command Line
|
||||
|
||||
Open `cmd` and navigate to your where your modified .hex file is. We'll pretend this file is called `main.hex`, and that your Teensy 2.0 is on the `COM3` port - if you're unsure, you can open your Device Manager, and look for `Ports > USB Serial Device`. Use that COM port here. You can confirm it's the right port with:
|
||||
Open a terminal (`cmd` on Windows, for instance) and navigate to your where your modified .hex file is. We'll pretend this file is called `main.hex`, and that your Teensy 2.0 is on the `COM3` port - if you're unsure, you can open your Device Manager, and look for `Ports > USB Serial Device`. Use that COM port here. You can confirm it's the right port with:
|
||||
|
||||
avrdude -c avrisp -P COM3 -p atmega32u4
|
||||
|
||||
@ -129,4 +199,47 @@ You should see a couple of progress bars, then you should see:
|
||||
|
||||
Which means everything should be ok! Your board may restart automatically, otherwise, unplug your Teensy and plug in your keyboard - you can leave your Teensy wired to your keyboard while testing things, but it's recommended that you desolder it/remove the wiring once you're sure everything works.
|
||||
|
||||
If you're using a SparkFun PocketAVR Programmer, or another USB Tiny based ISP programmer, you will want to use something like this:
|
||||
|
||||
avrdude -c usbtiny -P usb -p atmega32u4
|
||||
|
||||
#### Advanced: Changing Fuses
|
||||
|
||||
If you're switching bootloaders, such as flashing QMK DFU on a Pro Micro, you will need to change the fuses, in additional to flashing the bootloader hex file. This is because `caterina` (the Pro Micro bootloader) and `dfu` handle the startup routines differently, and that behavior is controlled by the fuses.
|
||||
|
||||
!> This is one area that it is very important to be careful, as changing fuses is one of the ways that you can permanently brick your controller.
|
||||
|
||||
For this, we are assuming the 5V 16MHz versions of the `atmega32u4` (such as the 5V Pro Micro).
|
||||
|
||||
For DFU on the `atmega32u4`, these are the fuse settings that you want:
|
||||
|
||||
| Fuse | Setting |
|
||||
|----------|------------------|
|
||||
| Low | `0x5E` |
|
||||
| High | `0xD9` or `0x99` |
|
||||
| Extended | `0xC3` |
|
||||
|
||||
The High fuse can be 0xD9 or 0x99. The difference is that 0xD9 disables JTAG, which QMK Firmware disables via software as well, while 0x99 doesn't disable JTAG.
|
||||
|
||||
To set this add `-U lfuse:w:0x5E:m -U hfuse:w:0xD9:m -U efuse:w:0xC3:m` to your command. So the final command should look something like:
|
||||
|
||||
avrdude -c avrisp -P COM3 -p atmega32u4 -U flash:w:main.hex:i -U lfuse:w:0x5E:m -U hfuse:w:0xD9:m -U efuse:w:0xC3:m
|
||||
|
||||
For Caterina on the `atmega32u4`, these are the fuse settings that you want:
|
||||
|
||||
| Fuse | Setting|
|
||||
|----------|--------|
|
||||
| Low | `0xFF` |
|
||||
| High | `0xD9` |
|
||||
| Extended | `0xC3` |
|
||||
|
||||
To set this add `-U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xC3:m` to your command. So the final command should look something like:
|
||||
|
||||
avrdude -c avrisp -P COM3 -p atmega32u4 -U flash:w:main.hex:i -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xC3:m
|
||||
|
||||
|
||||
If you are using a different controller or want different configuration, you can use [this AVR Fuse Calculator](http://www.engbedded.com/fusecalc/) to find a better value for you.
|
||||
|
||||
## Help
|
||||
|
||||
If you have any questions/problems, feel free to [open an issue](https://github.com/qmk/qmk_firmware/issues/new)!
|
||||
|
@ -82,7 +82,7 @@
|
||||
* [マクロ](ja/feature_macros.md)
|
||||
* [マウスキー](ja/feature_mouse_keys.md)
|
||||
* [OLED ドライバ](ja/feature_oled_driver.md)
|
||||
* [One Shot Keys](ja/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [One Shot Keys](ja/one_shot_keys.md)
|
||||
* [ポインティング デバイス](ja/feature_pointing_device.md)
|
||||
* [PS/2 マウス](ja/feature_ps2_mouse.md)
|
||||
* [RGB ライト](ja/feature_rgblight.md)
|
||||
@ -117,7 +117,7 @@
|
||||
* 他の話題
|
||||
* [Eclipse で QMK を使用](ja/other_eclipse.md)
|
||||
* [VSCode で QMK を使用](ja/other_vscode.md)
|
||||
* [サポート](ja/support.md)
|
||||
* [サポート](ja/getting_started_getting_help.md)
|
||||
* [翻訳を追加する方法](ja/translating.md)
|
||||
|
||||
* QMK の内部詳細(作成中)
|
||||
|
128
docs/ja/i2c_driver.md
Normal file
128
docs/ja/i2c_driver.md
Normal file
@ -0,0 +1,128 @@
|
||||
# I2C マスタドライバ
|
||||
|
||||
<!---
|
||||
grep --no-filename "^[ ]*git diff" docs/ja/*.md | sh
|
||||
original document: 85041ff05:docs/i2c_driver.md
|
||||
git diff 85041ff05 HEAD -- docs/i2c_driver.md | cat
|
||||
-->
|
||||
|
||||
QMK で使われる I2C マスタドライバには、MCU 間のポータビリティを提供するための一連の関数が用意されています。
|
||||
|
||||
## 使用できる関数
|
||||
|
||||
| 関数 | 説明 |
|
||||
|-------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `void i2c_init(void);` | I2C ドライバを初期化します。他のあらゆるトランザクションを開始する前に、この関数を一度だけ呼ぶ必要があります。 |
|
||||
| `uint8_t i2c_start(uint8_t address, uint16_t timeout);` | I2C トランザクションを開始します。アドレスは方向ビットのない7ビットスレーブアドレスです。 |
|
||||
| `uint8_t i2c_transmit(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` | I2C 経由でデータを送信します。アドレスは方向ビットのない7ビットスレーブアドレスです。トランザクションのステータスを返します。 |
|
||||
| `uint8_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);` | I2C 経由でデータを受信します。アドレスは方向ビットのない7ビットスレーブアドレスです。 `length` で指定した長さのバイト列を `data` に保存し、トランザクションのステータスを返します。 |
|
||||
| `uint8_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` | `i2c_transmit` と同様ですが、 `regaddr` でスレーブのデータ書き込み先のレジスタを指定します。 |
|
||||
| `uint8_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);` | `i2c_receive` と同様ですが、 `regaddr` でスレーブのデータ読み込み先のレジスタを指定します。 |
|
||||
| `uint8_t i2c_stop(void);` | I2C トランザクションを終了します。 |
|
||||
|
||||
### 関数の戻り値
|
||||
|
||||
`void i2c_init(void)` を除く上にあるすべての関数は、次の真理値表にある値を返します。
|
||||
|
||||
| 戻り値 | 説明 |
|
||||
|--------|------------------------------|
|
||||
| 0 | 処理が正常に実行されました。 |
|
||||
| -1 | 処理に失敗しました。 |
|
||||
| -2 | 処理がタイムアウトしました。 |
|
||||
|
||||
## AVR
|
||||
|
||||
### 設定
|
||||
|
||||
I2Cマスタドライバを設定するために、次の定義が使えます。
|
||||
|
||||
| 変数 | 説明 | 既定値 |
|
||||
|---------|---------------------|--------|
|
||||
| `F_SCL` | クロック周波数 (Hz) | 400KHz |
|
||||
|
||||
|
||||
AVR は通常 I2C ピンとして使う GPIO が設定されているので、これ以上の設定は必要ありません。
|
||||
|
||||
## ARM
|
||||
|
||||
ARM の場合は、内部に ChibiOS I2C HAL ドライバがあります。この節では STM32 MCU を使用していると仮定します。
|
||||
|
||||
### 設定
|
||||
|
||||
ARM MCU 用の設定はしばしば非常に複雑です。これは、多くの場合複数の I2C ドライバをさまざまなポートに対して割り当てられるためです。
|
||||
|
||||
最初に、必要なハードウェアドライバを有効にするために `mcuconf.h` ファイルをセットアップします。
|
||||
|
||||
| 変数 | 説明 | 既定値 |
|
||||
|-------------------------------|------------------------------------------------------------------------------------------------|--------|
|
||||
| `#STM32_I2C_USE_XXX` | ハードウェアドライバ XXX の有効化/無効化(すべてのドライバを明示的にリストアップする必要あり) | FALSE |
|
||||
| `#STM32_I2C_BUSY_TIMEOUT` | レスポンスの受信がない場合に I2C コマンドを中断するまでの時間 (ms) | 50 |
|
||||
| `#STM32_I2C_XXX_IRQ_PRIORITY` | ハードウェアドライバ XXX の割り込み優先度(上級者向けの設定) | 10 |
|
||||
| `#STM32_I2C_USE_DMA` | MCU がデータ送信を DMA ユニットにオフロードする機能の有効化/無効化 | TRUE |
|
||||
| `#STM32_I2C_XXX_DMA_PRIORITY` | ハードウェアドライバ XXX に使用する DMA ユニットの優先度(上級者向けの設定) | 1 |
|
||||
|
||||
次に `halconf.h` ファイル内で `#define HAL_USE_I2C` を `TRUE` にします。これにより ChibiOS が I2C ドライバを読み込みます。
|
||||
|
||||
最後に、使用したい I2C ハードウェアドライバに応じて正しい GPIO ピンを割り当てます。
|
||||
|
||||
標準では I2C1 ハードウェアドライバが使われます。もし他のハードウェアドライバを使う場合、 `config.h` ファイルに `#define I2C_DRIVER I2CDX` を追加します( X は使用するハードウェアドライバの番号です)。例えば I2C3 を有効化する場合、`config.h` ファイルに `#define I2C_DRIVER I2CD3` と定義します。これにより QMK I2C ドライバと ChibiOS I2C driver が同期されます。
|
||||
|
||||
STM32 MCU では、使用するハードウェアドライバにより、さまざまなピンを I2C ピンとして設定できます。標準では `B6`, `B7` ピンが I2C 用のピンです。 I2C 用のピンを設定するために次の定義が使えます:
|
||||
|
||||
| 変数 | 説明 | 既定値 |
|
||||
|-----------------------|--------------------------------------------------------------------------------------------------|---------|
|
||||
| `I2C1_SCL_BANK` | SCL に使うピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
|
||||
| `I2C1_SDA_BANK` | SDA に使うピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`) | `GPIOB` |
|
||||
| `I2C1_SCL` | SCL のピン番号 (0-9) | `6` |
|
||||
| `I2C1_SDA` | SDA のピン番号 (0-9) | `7` |
|
||||
| `I2C1_BANK`(非推奨) | 使用するピンのバンク (`GPIOA`, `GPIOB`, `GPIOC`)。後継は `I2C1_SCL_BANK`, `I2C1_SDA_BANK` です。 | `GPIOB` |
|
||||
|
||||
ChibiOS I2C ドライバの設定項目は STM32 MCU の種類に依存します。
|
||||
|
||||
STM32F1xx, STM32F2xx, STM32F4xx, STM32L0xx, STM32L1xx では I2Cv1 が使われます。
|
||||
STM32F0xx, STM32F3xx, STM32F7xx, STM32L4xx では I2Cv2 が使われます。
|
||||
|
||||
#### I2Cv1
|
||||
|
||||
STM32 MCU の I2Cv1 では、クロック周波数とデューティ比を次の変数で変更できます。詳しくは <https://www.playembedded.org/blog/stm32-i2c-chibios/#I2Cv1_configuration_structure> を参照してください。
|
||||
|
||||
| 変数 | 既定値 |
|
||||
|--------------------|------------------|
|
||||
| `I2C1_OPMODE` | `OPMODE_I2C` |
|
||||
| `I2C1_CLOCK_SPEED` | `100000` |
|
||||
| `I2C1_DUTY_CYCLE` | `STD_DUTY_CYCLE` |
|
||||
|
||||
#### I2Cv2
|
||||
|
||||
STM32 MCU の I2Cv2 では、信号のタイミングパラメータを次の変数で変更できます。詳しくは <https://www.st.com/en/embedded-software/stsw-stm32126.html> を参照してください。
|
||||
|
||||
| 変数 | 既定値 |
|
||||
|-----------------------|--------|
|
||||
| `I2C1_TIMINGR_PRESC` | `15U` |
|
||||
| `I2C1_TIMINGR_SCLDEL` | `4U` |
|
||||
| `I2C1_TIMINGR_SDADEL` | `2U` |
|
||||
| `I2C1_TIMINGR_SCLH` | `15U` |
|
||||
| `I2C1_TIMINGR_SCLL` | `21U` |
|
||||
|
||||
STM32 MCU では GPIO ピンを設定するとき、別の「代替機能」モードを使うことができます。これは I2Cv2 モードで使われるピンを変更するために必要です。適切な設定値は、使用している MCU のデータシートを参照してください。
|
||||
|
||||
| 変数 | 既定値 |
|
||||
|---------------------|--------|
|
||||
| `I2C1_SCL_PAL_MODE` | `4` |
|
||||
| `I2C1_SDA_PAL_MODE` | `4` |
|
||||
|
||||
#### その他
|
||||
|
||||
`void i2c_init(void)` 関数は `weak` 属性が付いており、オーバーロードすることができます。この場合、上記で設定した変数は使用されません。可能な GPIO の設定については、 MCU のデータシートを参照してください。次に示すのは初期化関数の例です:
|
||||
|
||||
```C
|
||||
void i2c_init(void)
|
||||
{
|
||||
setPinInput(B6); // Try releasing special pins for a short time
|
||||
setPinInput(B7);
|
||||
wait_ms(10); // Wait for the release to happen
|
||||
|
||||
palSetPadMode(GPIOB, 6, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B6 to I2C function
|
||||
palSetPadMode(GPIOB, 7, PAL_MODE_ALTERNATE(4) | PAL_STM32_OTYPE_OPENDRAIN | PAL_STM32_PUPDR_PULLUP); // Set B7 to I2C function
|
||||
}
|
||||
```
|
@ -10,7 +10,7 @@
|
||||
|
||||
?> **次の手順を順番に実行してください。**
|
||||
|
||||
[Video Tutorial](https://youtu.be/tx54jkRC9ZY) を見てください。
|
||||
[Video Tutorial](https://www.youtube.com/watch?v=-imgglzDMdY) を見てください。
|
||||
|
||||
QMK Configurator は Chrome/Firefox で最適に動作します。
|
||||
|
||||
|
@ -4,7 +4,9 @@ When defining a [keymap](keymap.md) each key needs a valid key definition. This
|
||||
|
||||
This is a reference only. Each group of keys links to the page documenting their functionality in more detail.
|
||||
|
||||
## [Basic Keycodes](keycodes_basic.md)
|
||||
## Basic Keycodes :id=basic-keycodes
|
||||
|
||||
See also: [Basic Keycodes](keycodes_basic.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-----------------------|------------------------------|-----------------------------------------------|
|
||||
@ -206,7 +208,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`KC_BRIGHTNESS_UP` |`KC_BRIU` |Brightness Up |
|
||||
|`KC_BRIGHTNESS_DOWN` |`KC_BRID` |Brightness Down |
|
||||
|
||||
## [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
|
||||
## Quantum Keycodes :id=quantum-keycodes
|
||||
|
||||
See also: [Quantum Keycodes](quantum_keycodes.md#qmk-keycodes)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|--------------|---------|-------------------------------------------------------|
|
||||
@ -214,7 +218,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`DEBUG` | |Toggle debug mode |
|
||||
|`EEPROM_RESET`|`EEP_RST`|Reinitializes the keyboard's EEPROM (persistent memory)|
|
||||
|
||||
## [Audio Keys](feature_audio.md)
|
||||
## Audio Keys :id=audio-keys
|
||||
|
||||
See also: [Audio](feature_audio.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------|---------|----------------------------------|
|
||||
@ -230,7 +236,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`MU_TOG` | |Toggles Music Mode |
|
||||
|`MU_MOD` | |Cycles through the music modes |
|
||||
|
||||
## [Backlighting](feature_backlight.md)
|
||||
## Backlighting :id=backlighting
|
||||
|
||||
See also: [Backlighting](feature_backlight.md)
|
||||
|
||||
|Key |Description |
|
||||
|---------|------------------------------------------|
|
||||
@ -242,7 +250,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`BL_DEC` |Decrease the backlight level |
|
||||
|`BL_BRTG`|Toggle backlight breathing |
|
||||
|
||||
## [Bootmagic](feature_bootmagic.md)
|
||||
## Bootmagic :id=bootmagic
|
||||
|
||||
See also: [Bootmagic](feature_bootmagic.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------------------------|---------|--------------------------------------------------------------------------|
|
||||
@ -276,7 +286,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`MAGIC_EE_HANDS_LEFT` |`EH_LEFT`|Set the master half of a split keyboard as the left hand (for `EE_HANDS`) |
|
||||
|`MAGIC_EE_HANDS_RIGHT` |`EH_RGHT`|Set the master half of a split keyboard as the right hand (for `EE_HANDS`)|
|
||||
|
||||
## [Bluetooth](feature_bluetooth.md)
|
||||
## Bluetooth :id=bluetooth
|
||||
|
||||
See also: [Bluetooth](feature_bluetooth.md)
|
||||
|
||||
|Key |Description |
|
||||
|----------|----------------------------------------------|
|
||||
@ -284,7 +296,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`OUT_USB` |USB only |
|
||||
|`OUT_BT` |Bluetooth only |
|
||||
|
||||
## [Dynamic Macros](feature_dynamic_macros.md)
|
||||
## Dynamic Macros :id=dynamic-macros
|
||||
|
||||
See also: [Dynamic Macros](feature_dynamic_macros.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-----------------|---------|--------------------------------------------------|
|
||||
@ -294,38 +308,48 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`DYN_MACRO_PLAY2`|`DM_PLY2`|Replay Macro 2 |
|
||||
|`DYN_REC_STOP` |`DM_RSTP`|Finish the macro that is currently being recorded.|
|
||||
|
||||
## [Grave Escape](feature_grave_esc.md)
|
||||
## Grave Escape :id=grave-escape
|
||||
|
||||
See also: [Grave Escape](feature_grave_esc.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-----------|---------|------------------------------------------------------------------|
|
||||
|`GRAVE_ESC`|`KC_GESC`|Escape when pressed, <code>`</code> when Shift or GUI are held|
|
||||
|
||||
## [Key Lock](feature_key_lock.md)
|
||||
## Key Lock :id=key-lock
|
||||
|
||||
See also: [Key Lock](feature_key_lock.md)
|
||||
|
||||
|Key |Description |
|
||||
|---------|--------------------------------------------------------------|
|
||||
|`KC_LOCK`|Hold down the next key pressed, until the key is pressed again|
|
||||
|
||||
## [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers)
|
||||
## Layer Switching :id=layer-switching
|
||||
|
||||
See also: [Layer Switching](feature_advanced_keycodes.md#switching-and-toggling-layers)
|
||||
|
||||
|Key |Description |
|
||||
|----------------|----------------------------------------------------------------------------------|
|
||||
|`DF(layer)` |Set the base (default) layer |
|
||||
|`MO(layer)` |Momentarily turn on `layer` when pressed (requires `KC_TRNS` on destination layer)|
|
||||
|`OSL(layer)` |Momentarily activates `layer` until a key is pressed. See [One Shot Keys](https://docs.qmk.fm/#/feature_advanced_keycodes?id=one-shot-keys) for details. |
|
||||
|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. Where `mod` is a mods_bit. Mods can be viewed [here](https://docs.qmk.fm/#/feature_advanced_keycodes?id=mod-tap). Example Implementation: `LM(LAYER_1, MOD_LALT)`|
|
||||
|`OSL(layer)` |Momentarily activates `layer` until a key is pressed. See [One Shot Keys](one_shot_keys.md) for details. |
|
||||
|`LM(layer, mod)`|Momentarily turn on `layer` (like MO) with `mod` active as well. Where `mod` is a mods_bit. Mods can be viewed [here](mod_tap.md). Example Implementation: `LM(LAYER_1, MOD_LALT)`|
|
||||
|`LT(layer, kc)` |Turn on `layer` when held, `kc` when tapped |
|
||||
|`TG(layer)` |Toggle `layer` on or off |
|
||||
|`TO(layer)` |Turns on `layer` and turns off all other layers, except the default layer |
|
||||
|`TT(layer)` |Normally acts like MO unless it's tapped multiple times, which toggles `layer` on |
|
||||
|
||||
## [Leader Key](feature_leader_key.md)
|
||||
## Leader Key :id=leader-key
|
||||
|
||||
See also: [Leader Key](feature_leader_key.md)
|
||||
|
||||
|Key |Description |
|
||||
|---------|------------------------|
|
||||
|`KC_LEAD`|Begins a leader sequence|
|
||||
|
||||
## [Mouse Keys](feature_mouse_keys.md)
|
||||
## Mouse Keys :id=mouse-keys
|
||||
|
||||
See also: [Mouse Keys](feature_mouse_keys.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------|---------|---------------------------|
|
||||
@ -346,7 +370,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`KC_MS_ACCEL1` |`KC_ACL1`|Set mouse acceleration to 1|
|
||||
|`KC_MS_ACCEL2` |`KC_ACL2`|Set mouse acceleration to 2|
|
||||
|
||||
## [Modifiers](feature_advanced_keycodes.md#modifier-keys)
|
||||
## Modifiers :id=modifiers
|
||||
|
||||
See also: [Modifier Keys](feature_advanced_keycodes.md#modifier-keys)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------|-------------------------------|----------------------------------------------------|
|
||||
@ -366,7 +392,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`KC_MEH` | |Left Control, Shift and Alt |
|
||||
|`KC_HYPR` | |Left Control, Shift, Alt and GUI |
|
||||
|
||||
## [Mod-Tap Keys](feature_advanced_keycodes.md#mod-tap)
|
||||
## Mod-Tap Keys :id=mod-tap-keys
|
||||
|
||||
See also: [Mod-Tap](mod_tap.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-------------|-----------------------------------------------------------------|-------------------------------------------------------|
|
||||
@ -387,7 +415,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|
||||
|`HYPR_T(kc)` |`ALL_T(kc)` |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|
||||
## [RGB Lighting](feature_rgblight.md)
|
||||
## RGB Lighting :id=rgb-lighting
|
||||
|
||||
See also: [RGB Lighting](feature_rgblight.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-------------------|----------|--------------------------------------------------------------------|
|
||||
@ -410,7 +440,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`RGB_MODE_GRADIENT`|`RGB_M_G` |Static gradient animation mode |
|
||||
|`RGB_MODE_RGBTEST` |`RGB_M_T` |Red,Green,Blue test animation mode |
|
||||
|
||||
## [RGB Matrix Lighting](feature_rgb_matrix.md)
|
||||
## RGB Matrix Lighting :id=rgb-matrix-lighting
|
||||
|
||||
See also: [RGB Matrix Lighting](feature_rgb_matrix.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|-------------------|----------|--------------------------------------------------------------------------------------|
|
||||
@ -426,14 +458,18 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`RGB_SPI` | |Increase effect speed (does not support eeprom yet), decrease speed when Shift is held|
|
||||
|`RGB_SPD` | |Decrease effect speed (does not support eeprom yet), increase speed when Shift is held|
|
||||
|
||||
## [Thermal Printer](feature_thermal_printer.md)
|
||||
## Thermal Printer :id=thermal-printer
|
||||
|
||||
See also: [Thermal Printer](feature_thermal_printer.md)
|
||||
|
||||
|Key |Description |
|
||||
|-----------|----------------------------------------|
|
||||
|`PRINT_ON` |Start printing everything the user types|
|
||||
|`PRINT_OFF`|Stop printing everything the user types |
|
||||
|
||||
## [US ANSI Shifted Symbols](keycodes_us_ansi_shifted.md)
|
||||
## US ANSI Shifted Symbols :id=us-ansi-shifted-symbols
|
||||
|
||||
See also: [US ANSI Shifted Symbols](keycodes_us_ansi_shifted.md)
|
||||
|
||||
|Key |Aliases |Description|
|
||||
|------------------------|-------------------|-----------|
|
||||
@ -459,14 +495,18 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`KC_RIGHT_ANGLE_BRACKET`|`KC_RABK`, `KC_GT` |`>` |
|
||||
|`KC_QUESTION` |`KC_QUES` |`?` |
|
||||
|
||||
## [One Shot Keys](feature_advanced_keycodes.md#one-shot-keys)
|
||||
## One Shot Keys :id=one-shot-keys
|
||||
|
||||
See also: [One Shot Keys](one_shot_keys.md)
|
||||
|
||||
|Key |Description |
|
||||
|------------|----------------------------------|
|
||||
|`OSM(mod)` |Hold `mod` for one keypress |
|
||||
|`OSL(layer)`|Switch to `layer` for one keypress|
|
||||
|
||||
## [Space Cadet](feature_space_cadet.md)
|
||||
## Space Cadet :id=space-cadet
|
||||
|
||||
See also: [Space Cadet](feature_space_cadet.md)
|
||||
|
||||
|Key |Description |
|
||||
|-----------|----------------------------------------|
|
||||
@ -478,7 +518,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`KC_RAPC` |Right Alt when held, `)` when tapped |
|
||||
|`KC_SFTENT`|Right Shift when held, Enter when tapped|
|
||||
|
||||
## [Swap Hands](feature_swap_hands.md)
|
||||
## Swap Hands :id=swap-hands
|
||||
|
||||
See also: [Swap Hands](feature_swap_hands.md)
|
||||
|
||||
|Key |Description |
|
||||
|-----------|-------------------------------------------------------------------------|
|
||||
@ -490,7 +532,9 @@ This is a reference only. Each group of keys links to the page documenting their
|
||||
|`SH_TG` |Toggles swap on and off with every key press. |
|
||||
|`SH_TT` |Toggles with a tap; momentary when held. |
|
||||
|
||||
## [Unicode Support](feature_unicode.md)
|
||||
## Unicode Support :id=unicode-support
|
||||
|
||||
See also: [Unicode Support](feature_unicode.md)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|----------------------|---------|----------------------------------------------------------------|
|
||||
|
@ -3,7 +3,7 @@
|
||||
QMK keymaps are defined inside a C source file. The data structure is an array of arrays. The outer array is a list of layer arrays while the inner layer array is a list of keys. Most keyboards define a `LAYOUT()` macro to help you create this array of arrays.
|
||||
|
||||
|
||||
## Keymap and Layers
|
||||
## Keymap and Layers :id=keymap-and-layers
|
||||
In QMK, **`const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS]`** holds multiple **layers** of keymap information in **16 bit** data holding the **action code**. You can define **32 layers** at most.
|
||||
|
||||
For trivial key definitions, the higher 8 bits of the **action code** are all 0 and the lower 8 bits holds the USB HID usage code generated by the key as **keycode**.
|
||||
@ -27,7 +27,8 @@ Respective layers can be validated simultaneously. Layers are indexed with 0 to
|
||||
|
||||
Sometimes, the action code stored in keymap may be referred as keycode in some documents due to the TMK history.
|
||||
|
||||
### Keymap Layer Status
|
||||
### Keymap Layer Status :id=keymap-layer-status
|
||||
|
||||
The state of the Keymap layer is determined by two 32 bit parameters:
|
||||
|
||||
* **`default_layer_state`** indicates a base keymap layer (0-31) which is always valid and to be referred (the default layer).
|
||||
|
54
docs/mod_tap.md
Normal file
54
docs/mod_tap.md
Normal file
@ -0,0 +1,54 @@
|
||||
# Mod-Tap
|
||||
|
||||
The Mod-Tap key `MT(mod, kc)` acts like a modifier when held, and a regular keycode when tapped. In other words, you can have a key that sends Escape when you tap it, but functions as a Control or Shift key when you hold it down.
|
||||
|
||||
The modifiers this keycode and `OSM()` accept are prefixed with `MOD_`, not `KC_`:
|
||||
|
||||
|Modifier |Description |
|
||||
|----------|----------------------------------------|
|
||||
|`MOD_LCTL`|Left Control |
|
||||
|`MOD_LSFT`|Left Shift |
|
||||
|`MOD_LALT`|Left Alt |
|
||||
|`MOD_LGUI`|Left GUI (Windows/Command/Meta key) |
|
||||
|`MOD_RCTL`|Right Control |
|
||||
|`MOD_RSFT`|Right Shift |
|
||||
|`MOD_RALT`|Right Alt (AltGr) |
|
||||
|`MOD_RGUI`|Right GUI (Windows/Command/Meta key) |
|
||||
|`MOD_HYPR`|Hyper (Left Control, Shift, Alt and GUI)|
|
||||
|`MOD_MEH` |Meh (Left Control, Shift, and Alt) |
|
||||
|
||||
You can combine these by ORing them together like so:
|
||||
|
||||
```c
|
||||
MT(MOD_LCTL | MOD_LSFT, KC_ESC)
|
||||
```
|
||||
|
||||
This key would activate Left Control and Left Shift when held, and send Escape when tapped.
|
||||
|
||||
For convenience, QMK includes some Mod-Tap shortcuts to make common combinations more compact in your keymap:
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------|-----------------------------------------------------------------|-------------------------------------------------------|
|
||||
|`LCTL_T(kc)`|`CTL_T(kc)` |Left Control when held, `kc` when tapped |
|
||||
|`LSFT_T(kc)`|`SFT_T(kc)` |Left Shift when held, `kc` when tapped |
|
||||
|`LALT_T(kc)`|`ALT_T(kc)` |Left Alt when held, `kc` when tapped |
|
||||
|`LGUI_T(kc)`|`LCMD_T(kc)`, `LWIN_T(kc)`, `GUI_T(kc)`, `CMD_T(kc)`, `WIN_T(kc)`|Left GUI when held, `kc` when tapped |
|
||||
|`RCTL_T(kc)`| |Right Control when held, `kc` when tapped |
|
||||
|`RSFT_T(kc)`| |Right Shift when held, `kc` when tapped |
|
||||
|`RALT_T(kc)`|`ALGR_T(kc)` |Right Alt when held, `kc` when tapped |
|
||||
|`RGUI_T(kc)`|`RCMD_T(kc)`, `RWIN_T(kc)` |Right GUI when held, `kc` when tapped |
|
||||
|`SGUI_T(kc)`|`SCMD_T(kc)`, `SWIN_T(kc)` |Left Shift and GUI when held, `kc` when tapped |
|
||||
|`LCA_T(kc)` | |Left Control and Alt when held, `kc` when tapped |
|
||||
|`LCAG_T(kc)`| |Left Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`RCAG_T(kc)`| |Right Control, Alt and GUI when held, `kc` when tapped |
|
||||
|`C_S_T(kc)` | |Left Control and Shift when held, `kc` when tapped |
|
||||
|`MEH_T(kc)` | |Left Control, Shift and Alt when held, `kc` when tapped|
|
||||
|`HYPR_T(kc)`|`ALL_T(kc)` |Left Control, Shift, Alt and GUI when held, `kc` when tapped - more info [here](http://brettterpstra.com/2012/12/08/a-useful-caps-lock-key/)|
|
||||
|
||||
## Caveats
|
||||
|
||||
Unfortunately, these keycodes cannot be used in Mod-Taps or Layer-Taps, since any modifiers specified in the keycode are ignored.
|
||||
|
||||
Additionally, you may run into issues when using Remote Desktop Connection on Windows. Because these codes send shift very fast, Remote Desktop may miss the codes.
|
||||
|
||||
To fix this, open Remote Desktop Connection, click on "Show Options", open the the "Local Resources" tab. In the keyboard section, change the drop down to "On this Computer". This will fix the issue, and allow the characters to work correctly.
|
@ -1,23 +1,30 @@
|
||||
# The Complete Newbs Guide To QMK
|
||||
|
||||
QMK is a powerful Open Source firmware for your mechanical keyboard. You can use QMK to customize your keyboard in ways both simple and powerful. People of all skill levels, from complete newbie to master programmer, have successfully used QMK to customize their keyboard. This guide will help you do the same, no matter your skill level.
|
||||
Your computer keyboard has a processor inside of it, similar to the one inside your computer. This processor runs software that is responsible for detecting button presses and informing the computer when keys are pressed. QMK Firmware fills the role of that software, detecting button presses and passing that information on to the host computer. When you build your custom keymap, you are creating an executable program for your keyboard.
|
||||
|
||||
Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built yourself chances are good it can. We support a [large number of hobbyist boards](http://qmk.fm/keyboards/), so even if your current keyboard can't run QMK you shouldn't have trouble finding one to suit your needs.
|
||||
QMK tries to put a lot of power into your hands by making easy things easy, and hard things possible. You don't have to know how to program to create powerful keymaps — you only have to follow a few simple syntax rules.
|
||||
|
||||
Not sure if your keyboard can run QMK? If it's a mechanical keyboard you built yourself chances are good it can. We support a [large number of hobbyist boards](http://qmk.fm/keyboards/). If your current keyboard can't run QMK there are a lot of choices out there for boards that do.
|
||||
|
||||
## Is This Guide For Me?
|
||||
|
||||
This guide is suitable for everyone who wants to build a keyboard firmware using the source code. If you are already a programmer you will find the process very familiar and easier to follow. If the thought of programming intimidates you please [take a look at our online GUI](newbs_building_firmware_configurator.md) instead.
|
||||
|
||||
## Overview
|
||||
|
||||
There are 7 main sections to this guide:
|
||||
There are 4 main sections to this guide:
|
||||
|
||||
* [Getting Started](newbs_getting_started.md)
|
||||
* [Building Your First Firmware using the command line](newbs_building_firmware.md)
|
||||
* [Building Your First Firmware using the online GUI](newbs_building_firmware_configurator.md)
|
||||
* [Flashing Firmware](newbs_flashing.md)
|
||||
* [Testing and Debugging](newbs_testing_debugging.md)
|
||||
* [Best Git Practices](newbs_git_best_practices.md)
|
||||
* [Learn More with these Resources](newbs_learn_more_resources.md)
|
||||
1. [Setup Your Environment](newbs_getting_started.md)
|
||||
2. [Building Your First Firmware](newbs_building_firmware.md)
|
||||
3. [Flashing Firmware](newbs_flashing.md)
|
||||
4. [Testing and Debugging](newbs_testing_debugging.md)
|
||||
|
||||
This guide is focused on helping someone who has never compiled software before. It makes choices and recommendations based on that viewpoint. There are alternative methods for many of these procedures, and we support most of those alternatives. If you have any doubt about how to accomplish a task you can [ask us for guidance](getting_started_getting_help.md).
|
||||
|
||||
## Additional Resources
|
||||
|
||||
* [Thomas Baart's QMK Basics Blog](https://thomasbaart.nl/category/mechanical-keyboards/firmware/qmk/qmk-basics/) – A user-created blog covering the basics of how to use QMK Firmware, as seen from a new user's perspective.
|
||||
Beyond this guide there are several resources you may find helpful while you learn QMK. We've collected them on the [Learning Resources](newbs_learn_more_resources.md) page.
|
||||
|
||||
## Open Source
|
||||
|
||||
QMK is Open Source Software released under the GNU General Public License.
|
||||
|
@ -2,78 +2,61 @@
|
||||
|
||||
Now that you have setup your build environment you are ready to start building custom firmware. For this section of the guide we will bounce between 3 programs- your file manager, your text editor, and your terminal window. Keep all 3 open until you are done and happy with your keyboard firmware.
|
||||
|
||||
If you have closed and reopened your terminal window since following the first part of the guide, don't forget to `cd qmk_firmware` so that your terminal is in the correct directory.
|
||||
## Create a New Keymap
|
||||
|
||||
## Navigate To Your Keymaps Folder
|
||||
To create your own keymap you'll want to create a copy of the `default` keymap. If you configured your build environment in the last step you can do that easily with the QMK CLI:
|
||||
|
||||
Start by navigating to the `keymaps` folder for your keyboard.
|
||||
qmk new-keymap
|
||||
|
||||
If you are on macOS or Windows there are commands you can use to easily open the keymaps folder.
|
||||
If you did not configure your environment, or you have multiple keyboards, you can specify a keyboard name:
|
||||
|
||||
### macOS:
|
||||
qmk new-keymap -kb <keyboard_name>
|
||||
|
||||
``` open keyboards/<keyboard_folder>/keymaps ```
|
||||
Look at the output from that command, you should see something like this:
|
||||
|
||||
### Windows:
|
||||
Ψ <github_username> keymap directory created in: /home/me/qmk_firmware/keyboards/clueboard/66/rev3/keymaps/<github_username>
|
||||
|
||||
``` start .\\keyboards\\<keyboard_folder>\\keymaps ```
|
||||
|
||||
## Create a Copy Of The `default` Keymap
|
||||
|
||||
Once you have the `keymaps` folder open you will want to create a copy of the `default` folder. We highly recommend you name your folder the same as your GitHub username, but you can use any name you want as long as it contains only lower case letters, numbers, and the underscore character.
|
||||
|
||||
To automate the process, you also have the option to run the `new_keymap.sh` script.
|
||||
|
||||
Navigate to the `qmk_firmware/util` directory and type the following:
|
||||
|
||||
```
|
||||
./new_keymap.sh <keyboard path> <username>
|
||||
```
|
||||
|
||||
For example, for a user named John, trying to make a new keymap for the 1up60hse, they would type in
|
||||
|
||||
```
|
||||
./new_keymap.sh 1upkeyboards/1up60hse john
|
||||
```
|
||||
This is the location of your new `keymap.c` file.
|
||||
|
||||
## Open `keymap.c` In Your Favorite Text Editor
|
||||
|
||||
Open up your `keymap.c`. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this:
|
||||
Open your `keymap.c` file in your text editor. Inside this file you'll find the structure that controls how your keyboard behaves. At the top of `keymap.c` there may be some defines and enums that make the keymap easier to read. Farther down you'll find a line that looks like this:
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
|
||||
This line indicates the start of the list of Layers. Below that you'll find lines containing either `LAYOUT` or `KEYMAP`, and these lines indicate the start of a layer. Below that line is the list of keys that comprise a particular layer.
|
||||
This line indicates where the list of Layers begins. Below that you'll find lines containing `LAYOUT`, and these lines indicate the start of a layer. Below that line is the list of keys that comprise a particular layer.
|
||||
|
||||
!> When editing your keymap file be careful not to add or remove any commas. If you do you will prevent your firmware from compiling and it may not be easy to figure out where the extra, or missing, comma is.
|
||||
|
||||
## Customize The Layout To Your Liking
|
||||
|
||||
How to complete this step is entirely up to you. Make the one change that's been bugging you, or completely rework everything. You can remove layers if you don't need all of them, or add layers up to a total of 32. Check the following documentation to find out what you can define here:
|
||||
How to complete this step is entirely up to you. Make the one change that's been bugging you, or completely rework everything. You can remove layers if you don't need all of them, or add layers up to a total of 32. There are a lot of features in QMK, explore the sidebar to the left under "Using QMK" to see the full list. To get you started here are a few of the easier to use features:
|
||||
|
||||
* [Keycodes](keycodes.md)
|
||||
* [Features](features.md)
|
||||
* [FAQ](faq.md)
|
||||
* [Basic Keycodes](keycodes_basic.md)
|
||||
* [Quantum Keycodes](quantum_keycodes.md)
|
||||
* [Grave/Escape](feature_grave_esc.md)
|
||||
* [Mouse keys](feature_mouse_keys.md)
|
||||
|
||||
?> While you get a feel for how keymaps work, keep each change small. Bigger changes make it harder to debug any problems that arise.
|
||||
|
||||
## Build Your Firmware
|
||||
## Build Your Firmware :id=build-your-firmware
|
||||
|
||||
When your changes to the keymap are complete you will need to build the firmware. To do so go back to your terminal window and run the build command:
|
||||
When your changes to the keymap are complete you will need to build the firmware. To do so go back to your terminal window and run the compile command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>
|
||||
qmk compile
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for a rev5 planck, you'll use this command:
|
||||
If you did not configure your environment, or you have multiple keyboards, you can specify a keyboard and/or keymap:
|
||||
|
||||
make planck/rev5:xyverz
|
||||
qmk compile -kb <keyboard> -km <keymap>
|
||||
|
||||
While this compiles you will have a lot of output going to the screen informing you of what files are being compiled. It should end with output that looks similar to this:
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev5_xyverz.elf [OK]
|
||||
Creating load file for flashing: .build/planck_rev5_xyverz.hex [OK]
|
||||
Copying planck_rev5_xyverz.hex to qmk_firmware folder [OK]
|
||||
Checking file size of planck_rev5_xyverz.hex [OK]
|
||||
* File size is fine - 18392/28672
|
||||
Linking: .build/planck_rev5_default.elf [OK]
|
||||
Creating load file for flashing: .build/planck_rev5_default.hex [OK]
|
||||
Copying planck_rev5_default.hex to qmk_firmware folder [OK]
|
||||
Checking file size of planck_rev5_default.hex [OK]
|
||||
* The firmware size is fine - 27312/28672 (95%, 1360 bytes free)
|
||||
```
|
||||
|
||||
## Flash Your Firmware
|
||||
|
@ -1,105 +1,13 @@
|
||||
# QMK Configurator
|
||||
|
||||
The [QMK Configurator](https://config.qmk.fm) is an online graphical user interface that generates QMK Firmware hex files.
|
||||
[](https://config.qmk.fm/)
|
||||
|
||||
?> **Please follow these steps in order.**
|
||||
The [QMK Configurator](https://config.qmk.fm) is an online graphical user interface that generates QMK Firmware hex files.
|
||||
|
||||
Watch the [Video Tutorial](https://youtu.be/tx54jkRC9ZY)
|
||||
Watch the [Video Tutorial](https://www.youtube.com/watch?v=-imgglzDMdY). Many people find that is enough information to start programming their own keyboard.
|
||||
|
||||
The QMK Configurator works best with Chrome/Firefox.
|
||||
The QMK Configurator works best with Chrome or Firefox.
|
||||
|
||||
!> **Note: Files from other tools such as Keyboard Layout Editor (KLE), or kbfirmware will not be compatible with QMK Configurator. Do not load them, do not import them. QMK Configurator is a DIFFERENT tool.**
|
||||
|
||||
!> **Files from other tools such as KLE, or kbfirmware will not be compatible with QMK Configurator. Do not load them, do not import them. QMK Configurator is a DIFFERENT tool. **
|
||||
|
||||
## Selecting your keyboard
|
||||
|
||||
Click the drop down box and select the keyboard you want to create a keymap for.
|
||||
|
||||
?> If your keyboard has several versions, make sure you select the correct one.**
|
||||
|
||||
I'll say that again because it's important
|
||||
|
||||
!> **MAKE SURE YOU SELECT THE RIGHT VERSION!**
|
||||
|
||||
If your keyboard has been advertised to be powered by QMK but is not in the list, chances are a developer hasn't gotten to it yet or we haven't had a chance to merge it in yet. File an issue at [qmk_firmware](https://github.com/qmk/qmk_firmware/issues) requesting to support that particular keyboard, if there is no active [Pull Request](https://github.com/qmk/qmk_firmware/pulls?q=is%3Aopen+is%3Apr+label%3Akeyboard) for it. There are also QMK powered keyboards that are in their manufacturer's own github accounts. Double check for that as well.
|
||||
|
||||
## Selecting your keyboard layout
|
||||
|
||||
Choose the layout that best represents the keymap you want to create. Some keyboards do not have enough layouts or correct layouts defined yet. They will be supported in the future.
|
||||
|
||||
## Keymap Name
|
||||
|
||||
Call this keymap what you want.
|
||||
|
||||
?> If you are running into issues when compiling, it may be worth changing this name, as it may already exist in the QMK Firmware repo.
|
||||
|
||||
## Creating Your Keymap
|
||||
|
||||
Keycode Entry is accomplished in 3 ways.
|
||||
1. Drag and dropping
|
||||
2. Clicking on an empty spot on the layout and clicking the keycode you desire
|
||||
3. Clicking on an empty spot on the layout, pressing the physical key on your keyboard.
|
||||
|
||||
Hover your mouse over a key and a short blurb will tell you what that keycode does. For a more verbose description please see
|
||||
|
||||
[Basic Keycode Reference](https://docs.qmk.fm/#/keycodes_basic)
|
||||
[Advanced Keycode Reference](https://docs.qmk.fm/#/feature_advanced_keycodes)
|
||||
|
||||
In the event that you can't find a layout that supports your keymap, for example three spots for spacebar, or two spots for backspace, or 2 spots for shift etc etc, Fill them ALL up.
|
||||
|
||||
### Example:
|
||||
|
||||
3 spots for spacebar: Fill them ALL with spacebar
|
||||
|
||||
2 spots for backspace: Fill them BOTH with backspace
|
||||
|
||||
2 spots for right shift: Fill them BOTH with right shift
|
||||
|
||||
1 spot for left shift and 1 spot for iso support: Fill them both with left shift
|
||||
|
||||
5 spots, but only 4 keys: Guess and check or ask someone who has done it before.
|
||||
|
||||
## Saving Your Keymap for Future Edits
|
||||
|
||||
When you're satisfied with your keymap or just want to work on it later, press the `Export Keymap` button. It will save your keymap as the name you chose above appended with .json.
|
||||
|
||||
You can then load this .json file in the future by pressing the `Import Keymap` button.
|
||||
|
||||
!> **CAUTION:** This is not the same type of .json file used for kbfirmware.com or any other tool. If you try to use this for those tools, or the .json from those tools with QMK Configurator, there is a chance your keyboard will **explode**.
|
||||
|
||||
## Generating your firmware file
|
||||
|
||||
Press the green `Compile` button.
|
||||
|
||||
When the compilation is done, you will be able to press the green `Download Firmware` button.
|
||||
|
||||
## Flashing Your Keyboard
|
||||
|
||||
Please refer to [Flashing Firmware](newbs_flashing.md)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
#### My .json file is not working
|
||||
|
||||
If the .json file was generated with QMK Configurator, congratulations you have stumbled upon a bug. File an issue at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues)
|
||||
|
||||
If not....how did you miss my big bold message at the top saying not to use other .json files?
|
||||
|
||||
#### There are extra spaces in my layout? What do I do?
|
||||
|
||||
If you're referring to having three spots for space bar, the best course of action is to just fill them all with space bar. The same can be done for backspace and shifts
|
||||
|
||||
#### What is the keycode for.......
|
||||
|
||||
Please see
|
||||
|
||||
[Basic Keycode Reference](https://docs.qmk.fm/#/keycodes_basic)
|
||||
[Advanced Keycode Reference](https://docs.qmk.fm/#/feature_advanced_keycodes)
|
||||
|
||||
#### It won't compile
|
||||
|
||||
Please double check the other layers of your keymap to make sure there are no random keys present.
|
||||
|
||||
## Problems and Bugs
|
||||
|
||||
We are always accepting customer requests and bug reports. Please file them at [qmk_configurator](https://github.com/qmk/qmk_configurator/issues)
|
||||
Please refer to [QMK Configurator: Step by Step](configurator_step_by_step.md).
|
||||
|
@ -6,7 +6,7 @@ Now that you've built a custom firmware file you'll want to flash your keyboard.
|
||||
|
||||
The simplest way to flash your keyboard will be with the [QMK Toolbox](https://github.com/qmk/qmk_toolbox/releases).
|
||||
|
||||
However, the QMK Toolbox is only available for Windows and macOS currently. If you're using Linux (or just wish to flash the firmware from the command line), you'll have to use the [method outlined below](newbs_flashing.md#flash-your-keyboard-from-the-command-line).
|
||||
However, the QMK Toolbox is only available for Windows and macOS currently. If you're using Linux (or just wish to flash the firmware from the command line), proceed down to [Flash Your Keyboard From The Command Line](#flash-your-keyboard-from-the-command-line).
|
||||
|
||||
### Load The File Into QMK Toolbox
|
||||
|
||||
@ -86,13 +86,13 @@ Click the `Flash` button in QMK Toolbox. You will see output similar to the foll
|
||||
|
||||
## Flash your Keyboard from the Command Line
|
||||
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
This has been made pretty simple compared to what it used to be. When you are ready to compile and flash your firmware, open up your terminal window and run the flash command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:flash
|
||||
qmk flash
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for a rev5 planck, you'll use this command:
|
||||
If you have not configured your keyboard/keymap name, or you have multiple keyboards, you can specify the keyboard and keymap:
|
||||
|
||||
make planck/rev5:xyverz:flash
|
||||
qmk flash -kb <my_keyboard> -km <my_keymap>
|
||||
|
||||
This will check the keyboard's configuration, and then attempt to flash it based on the specified bootloader. This means that you don't need to know which bootloader that your keyboard uses. Just run the command, and let the command do the heavy lifting.
|
||||
|
||||
@ -100,279 +100,10 @@ However, this does rely on the bootloader being set by the keyboard. If this in
|
||||
|
||||
WARNING: This board's bootloader is not specified or is not supported by the ":flash" target at this time.
|
||||
|
||||
In this case, you'll have to fall back on specifying the bootloader.
|
||||
|
||||
There are five main bootloaders that are used. Pro Micro and clones use Caterina, Teensys use HalfKay, OLKB's AVR boards use QMK-DFU, other ATmega32U4 boards use DFU, and most ARM boards use ARM DFU.
|
||||
|
||||
You can find more information about the bootloaders in the [Flashing Instructions and Bootloader Information](flashing.md) page.
|
||||
|
||||
If you know what bootloader that you're using, then when compiling the firmware, you can actually add some extra text to the `make` command to automate the flashing process.
|
||||
|
||||
### DFU
|
||||
|
||||
For the DFU bootloader, when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:dfu
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for a rev5 planck, you'll use this command:
|
||||
|
||||
make planck/rev5:xyverz:dfu
|
||||
|
||||
Once it finishes compiling, it should output the following:
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev5_xyverz.elf [OK]
|
||||
Creating load file for flashing: .build/planck_rev5_xyverz.hex [OK]
|
||||
Copying planck_rev5_xyverz.hex to qmk_firmware folder [OK]
|
||||
Checking file size of planck_rev5_xyverz.hex
|
||||
* File size is fine - 18574/28672
|
||||
```
|
||||
|
||||
After it gets to this point, the build script will look for the DFU bootloader every 5 seconds. It will repeat the following until the device is found or you cancel it.
|
||||
|
||||
dfu-programmer: no device present.
|
||||
Error: Bootloader not found. Trying again in 5s.
|
||||
|
||||
Once it does this, you'll want to reset the controller. It should then show output similar to this:
|
||||
|
||||
```
|
||||
*** Attempting to flash, please don't remove device
|
||||
>>> dfu-programmer atmega32u4 erase --force
|
||||
Erasing flash... Success
|
||||
Checking memory from 0x0 to 0x6FFF... Empty.
|
||||
>>> dfu-programmer atmega32u4 flash /Users/skully/qmk_firmware/clueboard_66_hotswap_gen1_skully.hex
|
||||
Checking memory from 0x0 to 0x55FF... Empty.
|
||||
0% 100% Programming 0x5600 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
0% 100% Reading 0x7000 bytes...
|
||||
[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>] Success
|
||||
Validating... Success
|
||||
0x5600 bytes written into 0x7000 bytes memory (76.79%).
|
||||
>>> dfu-programmer atmega32u4 reset
|
||||
```
|
||||
|
||||
?> If you have any issues with this - such as `dfu-programmer: no device present` - please see the [Frequently Asked Build Questions](faq_build.md).
|
||||
|
||||
#### DFU commands
|
||||
|
||||
There are a number of DFU commands that you can use to flash firmware to a DFU device:
|
||||
|
||||
* `:dfu` - This is the normal option and waits until a DFU device is available, and then flashes the firmware. This will check every 5 seconds, to see if a DFU device has appeared.
|
||||
* `:dfu-ee` - This flashes an `eep` file instead of the normal hex. This is uncommon.
|
||||
* `:dfu-split-left` - This flashes the normal firmware, just like the default option (`:dfu`). However, this also flashes the "Left Side" EEPROM file for split keyboards. _This is ideal for Elite C based split keyboards._
|
||||
* `:dfu-split-right` - This flashes the normal firmware, just like the default option (`:dfu`). However, this also flashes the "Right Side" EEPROM file for split keyboards. _This is ideal for Elite C based split keyboards._
|
||||
|
||||
|
||||
### Caterina
|
||||
|
||||
For Arduino boards and their clones (such as the SparkFun ProMicro), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:avrdude
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for a rev2 Lets Split, you'll use this command:
|
||||
|
||||
make lets_split/rev2:xyverz:avrdude
|
||||
|
||||
Once the firmware finishes compiling, it will output something like this:
|
||||
|
||||
```
|
||||
Linking: .build/lets_split_rev2_xyverz.elf [OK]
|
||||
Creating load file for flashing: .build/lets_split_rev2_xyverz.hex [OK]
|
||||
Checking file size of lets_split_rev2_xyverz.hex [OK]
|
||||
* File size is fine - 27938/28672
|
||||
Detecting USB port, reset your controller now..............
|
||||
```
|
||||
|
||||
At this point, reset the board and then the script will detect the bootloader and then flash the board. The output should look something like this:
|
||||
|
||||
```
|
||||
Detected controller on USB port at /dev/ttyS15
|
||||
|
||||
Connecting to programmer: .
|
||||
Found programmer: Id = "CATERIN"; type = S
|
||||
Software Version = 1.0; No Hardware Version given.
|
||||
Programmer supports auto addr increment.
|
||||
Programmer supports buffered memory access with buffersize=128 bytes.
|
||||
|
||||
Programmer supports the following devices:
|
||||
Device code: 0x44
|
||||
|
||||
avrdude.exe: AVR device initialized and ready to accept instructions
|
||||
|
||||
Reading | ################################################## | 100% 0.00s
|
||||
|
||||
avrdude.exe: Device signature = 0x1e9587 (probably m32u4)
|
||||
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
|
||||
To disable this feature, specify the -D option.
|
||||
avrdude.exe: erasing chip
|
||||
avrdude.exe: reading input file "./.build/lets_split_rev2_xyverz.hex"
|
||||
avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
|
||||
avrdude.exe: writing flash (27938 bytes):
|
||||
|
||||
Writing | ################################################## | 100% 2.40s
|
||||
|
||||
avrdude.exe: 27938 bytes of flash written
|
||||
avrdude.exe: verifying flash memory against ./.build/lets_split_rev2_xyverz.hex:
|
||||
avrdude.exe: load data flash data from input file ./.build/lets_split_rev2_xyverz.hex:
|
||||
avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex auto detected as Intel Hex
|
||||
avrdude.exe: input file ./.build/lets_split_rev2_xyverz.hex contains 27938 bytes
|
||||
avrdude.exe: reading on-chip flash data:
|
||||
|
||||
Reading | ################################################## | 100% 0.43s
|
||||
|
||||
avrdude.exe: verifying ...
|
||||
avrdude.exe: 27938 bytes of flash verified
|
||||
|
||||
avrdude.exe: safemode: Fuses OK (E:CB, H:D8, L:FF)
|
||||
|
||||
avrdude.exe done. Thank you.
|
||||
```
|
||||
If you have any issues with this, you may need to this:
|
||||
|
||||
sudo make <my_keyboard>:<my_keymap>:avrdude
|
||||
|
||||
|
||||
#### Caterina commands
|
||||
|
||||
There are a number of DFU commands that you can use to flash firmware to a DFU device:
|
||||
|
||||
* `:avrdude` - This is the normal option which waits until a Caterina device is available (by detecting a new COM port), and then flashes the firmware.
|
||||
* `:avrdude-loop` - This runs the same command as `:avrdude`, but after each device is flashed, it will attempt to flash again. This is useful for bulk flashing. _This requires you to manually escape the loop by hitting Control+C._
|
||||
* `:avrdude-split-left` - This flashes the normal firmware, just like the default option (`:avrdude`). However, this also flashes the "Left Side" EEPROM file for split keyboards. _This is ideal for Pro Micro based split keyboards._
|
||||
* `:avrdude-split-right` - This flashes the normal firmware, just like the default option (`:avrdude`). However, this also flashes the "Right Side" EEPROM file for split keyboards. _This is ideal for Pro Micro based split keyboards._
|
||||
|
||||
|
||||
### HalfKay
|
||||
|
||||
For the PJRC devices (Teensy's), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:teensy
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for an Ergodox or Ergodox EZ, you'll use this command:
|
||||
|
||||
make ergodox_ez:xyverz:teensy
|
||||
|
||||
Once the firmware finishes compiling, it will output something like this:
|
||||
|
||||
```
|
||||
Linking: .build/ergodox_ez_xyverz.elf [OK]
|
||||
Creating load file for flashing: .build/ergodox_ez_xyverz.hex [OK]
|
||||
Checking file size of ergodox_ez_xyverz.hex [OK]
|
||||
* File size is fine - 25584/32256
|
||||
Teensy Loader, Command Line, Version 2.1
|
||||
Read "./.build/ergodox_ez_xyverz.hex": 25584 bytes, 79.3% usage
|
||||
Waiting for Teensy device...
|
||||
(hint: press the reset button)
|
||||
```
|
||||
|
||||
At this point, reset your board. Once you've done that, you'll see output like this:
|
||||
|
||||
```
|
||||
Found HalfKay Bootloader
|
||||
Read "./.build/ergodox_ez_xyverz.hex": 28532 bytes, 88.5% usage
|
||||
Programming............................................................................................................................................................................
|
||||
...................................................
|
||||
Booting
|
||||
```
|
||||
|
||||
### STM32 (ARM)
|
||||
|
||||
For a majority of ARM boards (including the Proton C, Planck Rev 6, and Preonic Rev 3), when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:dfu-util
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for the Planck Revision 6 keyboard, you'll use this command and then reboot the keyboard to the bootloader (before it finishes compiling):
|
||||
|
||||
make planck/rev6:xyverz:dfu-util
|
||||
|
||||
Once the firmware finishes compiling, it will output something like this:
|
||||
|
||||
```
|
||||
Linking: .build/planck_rev6_xyverz.elf [OK]
|
||||
Creating binary load file for flashing: .build/planck_rev6_xyverz.bin [OK]
|
||||
Creating load file for flashing: .build/planck_rev6_xyverz.hex [OK]
|
||||
|
||||
Size after:
|
||||
text data bss dec hex filename
|
||||
0 41820 0 41820 a35c .build/planck_rev6_xyverz.hex
|
||||
|
||||
Copying planck_rev6_xyverz.bin to qmk_firmware folder [OK]
|
||||
dfu-util 0.9
|
||||
|
||||
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
|
||||
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
|
||||
This program is Free Software and has ABSOLUTELY NO WARRANTY
|
||||
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
|
||||
|
||||
Invalid DFU suffix signature
|
||||
A valid DFU suffix will be required in a future dfu-util release!!!
|
||||
Opening DFU capable USB device...
|
||||
ID 0483:df11
|
||||
Run-time device DFU version 011a
|
||||
Claiming USB DFU Interface...
|
||||
Setting Alternate Setting #0 ...
|
||||
Determining device status: state = dfuERROR, status = 10
|
||||
dfuERROR, clearing status
|
||||
Determining device status: state = dfuIDLE, status = 0
|
||||
dfuIDLE, continuing
|
||||
DFU mode device DFU version 011a
|
||||
Device returned transfer size 2048
|
||||
DfuSe interface name: "Internal Flash "
|
||||
Downloading to address = 0x08000000, size = 41824
|
||||
Download [=========================] 100% 41824 bytes
|
||||
Download done.
|
||||
File downloaded successfully
|
||||
Transitioning to dfuMANIFEST state
|
||||
```
|
||||
|
||||
#### STM32 Commands
|
||||
|
||||
There are a number of DFU commands that you can use to flash firmware to a STM32 device:
|
||||
|
||||
* `:dfu-util` - The default command for flashing to STM32 devices, and will wait until an STM32 bootloader is present. .
|
||||
* `:dfu-util-split-left` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Left Side" EEPROM setting for split keyboards.
|
||||
* `:dfu-util-split-right` - This flashes the normal firmware, just like the default option (`:dfu-util`). However, this also configures the "Right Side" EEPROM setting for split keyboards.
|
||||
* `:st-link-cli` - This allows you to flash the firmware via ST-LINK's CLI utility, rather than dfu-util.
|
||||
|
||||
|
||||
### BootloadHID
|
||||
|
||||
For Bootmapper Client(BMC)/bootloadHID/ATmega32A based boards, when you're ready to compile and flash your firmware, open up your terminal window and run the build command:
|
||||
|
||||
make <my_keyboard>:<my_keymap>:bootloaderHID
|
||||
|
||||
For example, if your keymap is named "xyverz" and you're building a keymap for a jj40, you'll use this command:
|
||||
|
||||
make jj40:xyverz:bootloaderHID
|
||||
|
||||
Once the firmware finishes compiling, it will output something like this:
|
||||
|
||||
```
|
||||
Linking: .build/jj40_default.elf [OK]
|
||||
Creating load file for flashing: .build/jj40_default.hex [OK]
|
||||
Copying jj40_default.hex to qmk_firmware folder [OK]
|
||||
Checking file size of jj40_default.hex [OK]
|
||||
* The firmware size is fine - 21920/28672 (6752 bytes free)
|
||||
```
|
||||
|
||||
After it gets to this point, the build script will look for the DFU bootloader every 5 seconds. It will repeat the following until the device is found or you cancel it.
|
||||
|
||||
```
|
||||
Error opening HIDBoot device: The specified device was not found
|
||||
Trying again in 5s.
|
||||
```
|
||||
|
||||
Once it does this, you'll want to reset the controller. It should then show output similar to this:
|
||||
|
||||
```
|
||||
Page size = 128 (0x80)
|
||||
Device size = 32768 (0x8000); 30720 bytes remaining
|
||||
Uploading 22016 (0x5600) bytes starting at 0 (0x0)
|
||||
0x05580 ... 0x05600
|
||||
```
|
||||
In this case, you'll have to fall back on specifying the bootloader. See the [Flashing Firmware](flashing.md) Guide for more details.
|
||||
|
||||
## Test It Out!
|
||||
|
||||
Congrats! Your custom firmware has been programmed to your keyboard!
|
||||
|
||||
Give it a try and make sure everything works the way you want it to. We've written [Testing and Debugging](newbs_testing_debugging.md) to round out this Newbie Guide, so head over there to learn about how to troubleshoot your custom functionality.
|
||||
Give it a try and make sure everything works the way you want it to. We've written [Testing and Debugging](newbs_testing_debugging.md) to round out this guide, so head over there to learn about validating your firmware and how to troubleshoot your custom functionality.
|
||||
|
@ -1,17 +1,10 @@
|
||||
# Introduction
|
||||
# Setting Up Your QMK Environment
|
||||
|
||||
Your computer keyboard has a processor inside of it, not unlike the one inside your computer. This processor runs software that is responsible for detecting button presses and sending reports about the state of the keyboard when buttons are pressed or released. QMK fills the role of that software, detecting button presses and passing that information on to the host computer. When you build your custom keymap, you are creating the equivalent of an executable program for your keyboard.
|
||||
Before you can build keymaps, you need to install some software and set up your build environment. This only has to be done once no matter how many keyboards you plan to compile firmware for.
|
||||
|
||||
QMK tries to put a lot of power into your hands by making easy things easy, and hard things possible. You don't have to know how to program to create powerful keymaps — you only have to follow a few simple syntax rules.
|
||||
## 1. Download Software
|
||||
|
||||
# Getting Started
|
||||
|
||||
Before you can build keymaps, you need to install some software and set up your build environment. This only has to be done once no matter how many keyboards you plan to compile firmware for.
|
||||
|
||||
If you would prefer a more graphical user interface approach, please consider using the online [QMK Configurator](https://config.qmk.fm). Please refer to [Building Your First Firmware using the online GUI](newbs_building_firmware_configurator.md).
|
||||
|
||||
|
||||
## Download Software
|
||||
There are a few pieces of software you'll need to get started.
|
||||
|
||||
### Text Editor
|
||||
|
||||
@ -30,7 +23,13 @@ QMK Toolbox is an optional graphical program for Windows and macOS that allows y
|
||||
* For Windows: `qmk_toolbox.exe` (portable) or `qmk_toolbox_install.exe` (installer)
|
||||
* For macOS: `QMK.Toolbox.app.zip` (portable) or `QMK.Toolbox.pkg` (installer)
|
||||
|
||||
## Set Up Your Environment
|
||||
### A Unix-like Environment
|
||||
|
||||
Linux and macOS come with unix shells you can execute already. You will only need to setup your build environment.
|
||||
|
||||
On Windows you will need to install MSYS2 or WSL and use those environments. Instructions for setting up MSYS2 are provided below.
|
||||
|
||||
## 2. Prepare Your Build Environment :id=set-up-your-environment
|
||||
|
||||
We've tried to make QMK as easy to set up as possible. You only have to prepare your Linux or Unix environment, then let QMK install the rest.
|
||||
|
||||
@ -40,52 +39,52 @@ We've tried to make QMK as easy to set up as possible. You only have to prepare
|
||||
|
||||
### Windows
|
||||
|
||||
You will need to install MSYS2 and Git.
|
||||
You will need to install MSYS2, Git, and the QMK CLI.
|
||||
|
||||
* Follow the installation instructions on the [MSYS2 homepage](http://www.msys2.org).
|
||||
* Close any open MSYS2 terminals and open a new MSYS2 MinGW 64-bit terminal.
|
||||
* Install Git by running this command: `pacman -S git`.
|
||||
|
||||
After opening a new MSYS2 MinGW 64-bit terminal run these commands:
|
||||
|
||||
pacman -S git python3-pip
|
||||
python3 -m pip install qmk
|
||||
|
||||
### macOS
|
||||
|
||||
You will need to install Homebrew. Follow the instructions on the [Homebrew homepage](https://brew.sh).
|
||||
|
||||
After Homebrew is installed, continue with _Set Up QMK_. In that step you will run a script that will install other packages.
|
||||
After Homebrew is installed run these commands:
|
||||
|
||||
brew tap qmk/qmk
|
||||
brew install qmk
|
||||
|
||||
### Linux
|
||||
|
||||
You will need to install Git. It's very likely that you already have it, but if not, one of the following commands should install it:
|
||||
You will need to install Git and Python. It's very likely that you already have both, but if not, one of the following commands should install them:
|
||||
|
||||
* Debian / Ubuntu / Devuan: `apt-get install git`
|
||||
* Fedora / Red Hat / CentOS: `yum install git`
|
||||
* Arch: `pacman -S git`
|
||||
* Debian / Ubuntu / Devuan: `apt-get install git python3 && python3 -m pip install qmk`
|
||||
* Fedora / Red Hat / CentOS: `yum install git python3 && python3 -m pip install qmk`
|
||||
* Arch: `pacman -S qmk`
|
||||
|
||||
?> Docker is also an option on all platforms. [Click here for details.](getting_started_build_tools.md#docker)
|
||||
## 3. Run QMK Setup :id=set-up-qmk
|
||||
|
||||
## Set Up QMK
|
||||
After installing QMK you can set it up with this command:
|
||||
|
||||
Once you have set up your Linux/Unix environment, you are ready to download QMK. We will do this by using Git to "clone" the QMK repository. Open a Terminal or MSYS2 MinGW window and leave it open for the remainder of this guide. Inside that window run these two commands:
|
||||
qmk setup
|
||||
|
||||
```shell
|
||||
git clone --recurse-submodules https://github.com/qmk/qmk_firmware.git
|
||||
cd qmk_firmware
|
||||
```
|
||||
In most situations you will want to answer Yes to all of the prompts.
|
||||
|
||||
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create and clone your own fork instead. If you don't know what that means, you can safely ignore this message.
|
||||
?> If you already know [how to use GitHub](getting_started_github.md), we recommend that you create your own fork and use `qmk setup <github_username>` to clone your personal fork. If you don't know what that means you can safely ignore this message.
|
||||
|
||||
QMK comes with a script to help you set up the rest of what you'll need. You should run it now by typing in this command:
|
||||
|
||||
util/qmk_install.sh
|
||||
|
||||
## Test Your Build Environment
|
||||
## 4. Test Your Build Environment
|
||||
|
||||
Now that your QMK build environment is set up, you can build a firmware for your keyboard. Start by trying to build the keyboard's default keymap. You should be able to do that with a command in this format:
|
||||
|
||||
make <keyboard>:default
|
||||
qmk compile -kb <keyboard> -km default
|
||||
|
||||
For example, to build a firmware for a Clueboard 66% you would use:
|
||||
|
||||
make clueboard/66/rev3:default
|
||||
qmk compile -kb clueboard/66/rev3 -km default
|
||||
|
||||
When it is done you should have a lot of output that ends similar to this:
|
||||
|
||||
@ -97,6 +96,22 @@ Checking file size of clueboard_66_rev3_default.hex
|
||||
* The firmware size is fine - 26356/28672 (2316 bytes free)
|
||||
```
|
||||
|
||||
## 5. Configure Your Build Environment (Optional)
|
||||
|
||||
You can configure your build environment to set the defaults and make working with QMK less tedious. Let's do that now!
|
||||
|
||||
Most people new to QMK only have 1 keyboard. You can set this keyboard as your default with the `qmk config` command. For example, to set your default keyboard to `clueboard/66/rev4`:
|
||||
|
||||
qmk config user.keyboard=clueboard/66/rev4
|
||||
|
||||
You can also set your default keymap name. Most people use their github username here, and we recommend that you do too.
|
||||
|
||||
qmk config user.keymap=<github_username>
|
||||
|
||||
After this you can leave those arguments off and compile your keyboard like this:
|
||||
|
||||
qmk compile
|
||||
|
||||
# Creating Your Keymap
|
||||
|
||||
You are now ready to create your own personal keymap! Move on to [Building Your First Firmware](newbs_building_firmware.md) for that.
|
||||
|
@ -37,7 +37,7 @@ git push origin master
|
||||
|
||||
This switches you to your `master` branch, retrieves the refs from the QMK repo, downloads the current QMK `master` branch to your computer, and then uploads it to your fork.
|
||||
|
||||
## Making Changes
|
||||
## Making Changes :id=making-changes
|
||||
|
||||
To make changes, create a new branch by entering:
|
||||
|
||||
|
@ -2,14 +2,16 @@
|
||||
|
||||
These resources are aimed at giving new members in the QMK community more understanding to the information provided in the Newbs docs.
|
||||
|
||||
Git resources:
|
||||
**QMK resources**:
|
||||
|
||||
* [Great General Tutorial](https://www.codecademy.com/learn/learn-git)
|
||||
* [Git Game To Learn From Examples](https://learngitbranching.js.org/)
|
||||
* [Git Resources to Learn More About Github](getting_started_github.md)
|
||||
* [Git Resources Aimed Specifically toward QMK](contributing.md)
|
||||
* [Thomas Baart's QMK Basics Blog](https://thomasbaart.nl/category/mechanical-keyboards/firmware/qmk/qmk-basics/) – A user-created blog covering the basics of how to use QMK Firmware, as seen from a new user's perspective.
|
||||
|
||||
|
||||
Command Line resources:
|
||||
**Command Line resources**:
|
||||
|
||||
* [Good General Tutorial on Command Line](https://www.codecademy.com/learn/learn-the-command-line)
|
||||
|
||||
**Git resources**:
|
||||
|
||||
* [Great General Tutorial](https://www.codecademy.com/learn/learn-git)
|
||||
* [Flight Rules For Git](https://github.com/k88hudson/git-flight-rules)
|
||||
* [Git Game To Learn From Examples](https://learngitbranching.js.org/)
|
||||
|
@ -4,17 +4,9 @@ Once you've flashed your keyboard with a custom firmware you're ready to test it
|
||||
|
||||
## Testing
|
||||
|
||||
Testing your keyboard is usually pretty straightforward. Press every single key and make sure it sends the keys you expect. There are even programs that will help you make sure that no key is missed.
|
||||
Testing your keyboard is usually pretty straightforward. Press every single key and make sure it sends the keys you expect. You can use [QMK Configurator](https://config.qmk.fm/#/test/)'s test mode to check your keyboard, even if it doesn't run QMK.
|
||||
|
||||
Note: These programs are not provided by or endorsed by 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)
|
||||
* [Keyboard Viewer](https://www.imore.com/how-use-keyboard-viewer-your-mac) (Mac Only)
|
||||
* [Keyboard Tester](http://www.keyboardtester.com) (Web Based)
|
||||
* [Keyboard Checker](http://keyboardchecker.com) (Web Based)
|
||||
|
||||
## Debugging
|
||||
## Debugging :id=debugging
|
||||
|
||||
Your keyboard will output debug information if you have `CONSOLE_ENABLE = yes` in your `rules.mk`. By default the output is very limited, but you can turn on debug mode to increase the amount of debug output. Use the `DEBUG` keycode in your keymap, use the [Command](feature_command.md) feature to enable debug mode, or add the following code to your keymap.
|
||||
|
||||
@ -28,6 +20,10 @@ void keyboard_post_init_user(void) {
|
||||
}
|
||||
```
|
||||
|
||||
## Debugging Tools
|
||||
|
||||
There are two different tools you can use to debug your keyboard.
|
||||
|
||||
### Debugging With QMK Toolbox
|
||||
|
||||
For compatible platforms, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) can be used to display debug messages from your keyboard.
|
||||
@ -36,8 +32,6 @@ For compatible platforms, [QMK Toolbox](https://github.com/qmk/qmk_toolbox) can
|
||||
|
||||
Prefer a terminal based solution? [hid_listen](https://www.pjrc.com/teensy/hid_listen.html), provided by PJRC, can also be used to display debug messages. Prebuilt binaries for Windows,Linux,and MacOS are available.
|
||||
|
||||
<!-- FIXME: Describe the debugging messages here. -->
|
||||
|
||||
## Sending Your Own Debug Messages
|
||||
|
||||
Sometimes it's useful to print debug messages from within your [custom code](custom_quantum_functions.md). Doing so is pretty simple. Start by including `print.h` at the top of your file:
|
||||
|
102
docs/one_shot_keys.md
Normal file
102
docs/one_shot_keys.md
Normal file
@ -0,0 +1,102 @@
|
||||
# One Shot Keys
|
||||
|
||||
One shot keys are keys that remain active until the next key is pressed, and then are released. This allows you to type keyboard combinations without pressing more than one key at a time. These keys are usually called "Sticky keys" or "Dead keys".
|
||||
|
||||
For example, if you define a key as `OSM(MOD_LSFT)`, you can type a capital A character by first pressing and releasing shift, and then pressing and releasing A. Your computer will see the shift key being held the moment shift is pressed, and it will see the shift key being released immediately after A is released.
|
||||
|
||||
One shot keys also work as normal modifiers. If you hold down a one shot key and type other keys, your one shot will be released immediately after you let go of the key.
|
||||
|
||||
Additionally, hitting keys five times in a short period will lock that key. This applies for both One Shot Modifiers and One Shot Layers, and is controlled by the `ONESHOT_TAP_TOGGLE` define.
|
||||
|
||||
You can control the behavior of one shot keys by defining these in `config.h`:
|
||||
|
||||
```c
|
||||
#define ONESHOT_TAP_TOGGLE 5 /* Tapping this number of times holds the key until tapped once again. */
|
||||
#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.
|
||||
* `OSL(layer)` - momentary switch to *layer*.
|
||||
|
||||
Sometimes, you want to activate a one-shot key as part of a macro or tap dance routine.
|
||||
|
||||
For one shot layers, you need to call `set_oneshot_layer(LAYER, ONESHOT_START)` on key down, and `clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED)` on key up. If you want to cancel the oneshot, call `reset_oneshot_layer()`.
|
||||
|
||||
For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear_oneshot_mods()` to cancel it.
|
||||
|
||||
!> If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop.
|
||||
|
||||
## Callbacks
|
||||
|
||||
When you'd like to perform custom logic when pressing a one shot key, there are several callbacks you can choose to implement. You could indicate changes in one shot keys by flashing an LED or making a sound, for example.
|
||||
|
||||
There is a callback for `OSM(mod)`. It is called whenever the state of any one shot modifier key is changed: when it toggles on, but also when it is toggled off. You can use it like this:
|
||||
|
||||
```c
|
||||
void oneshot_mods_changed_user(uint8_t mods) {
|
||||
if (mods & MOD_MASK_SHIFT) {
|
||||
println("Oneshot mods SHIFT");
|
||||
}
|
||||
if (mods & MOD_MASK_CTRL) {
|
||||
println("Oneshot mods CTRL");
|
||||
}
|
||||
if (mods & MOD_MASK_ALT) {
|
||||
println("Oneshot mods ALT");
|
||||
}
|
||||
if (mods & MOD_MASK_GUI) {
|
||||
println("Oneshot mods GUI");
|
||||
}
|
||||
if (!mods) {
|
||||
println("Oneshot mods off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The `mods` argument contains the active mods after the change, so it reflects the current state.
|
||||
|
||||
When you use One Shot Tap Toggle (by adding `#define ONESHOT_TAP_TOGGLE 2` in your `config.h` file), you may lock a modifier key by pressing it the specified amount of times. There's a callback for that, too:
|
||||
|
||||
```c
|
||||
void oneshot_locked_mods_changed_user(uint8_t mods) {
|
||||
if (mods & MOD_MASK_SHIFT) {
|
||||
println("Oneshot locked mods SHIFT");
|
||||
}
|
||||
if (mods & MOD_MASK_CTRL) {
|
||||
println("Oneshot locked mods CTRL");
|
||||
}
|
||||
if (mods & MOD_MASK_ALT) {
|
||||
println("Oneshot locked mods ALT");
|
||||
}
|
||||
if (mods & MOD_MASK_GUI) {
|
||||
println("Oneshot locked mods GUI");
|
||||
}
|
||||
if (!mods) {
|
||||
println("Oneshot locked mods off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Last, there is also a callback for the `OSL(layer)` one shot key:
|
||||
|
||||
```c
|
||||
void oneshot_layer_changed_user(uint8_t layer) {
|
||||
if (layer == 1) {
|
||||
println("Oneshot layer 1 on");
|
||||
}
|
||||
if (!layer) {
|
||||
println("Oneshot layer off");
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If any one shot layer is switched off, `layer` will be zero. When you're looking to do something on any layer change instead of one shot layer changes, `layer_state_set_user` is a better callback to use.
|
||||
|
||||
If you are making your own keyboard, there are also `_kb` equivalent functions:
|
||||
|
||||
```c
|
||||
void oneshot_locked_mods_changed_kb(uint8_t mods);
|
||||
void oneshot_mods_changed_kb(uint8_t mods);
|
||||
void oneshot_layer_changed_kb(uint8_t layer);
|
||||
```
|
||||
|
||||
As with any callback, be sure to call the `_user` variant to allow for further customizability.
|
@ -17,7 +17,7 @@ Note that this set-up has been tested on Ubuntu 16.04 only for the moment.
|
||||
|
||||
# Prerequisites
|
||||
## Build Environment
|
||||
Before starting, you must have followed the [Getting Started](README.md#getting-started) section corresponding to your system. In particular, you must have been able to build the firmware with [the `make` command](../#the-make-command).
|
||||
Before starting, you must have followed the [Getting Started](news_getting_started.md) section of the Tutorial. In particular, you must have been able to build the firmware with [the `qmk compile` command](news_building_firmware#build-your-firmware).
|
||||
|
||||
## Java
|
||||
Eclipse is a Java application, so you will need to install Java 8 or more recent to be able to run it. You may choose between the JRE or the JDK, the latter being useful if you intend to do Java development.
|
||||
@ -85,4 +85,4 @@ We will now configure a make target that cleans the project and builds the keyma
|
||||
8. Double-click the build target you created to trigger a build.
|
||||
9. Select the <kbd>Console</kbd> view at the bottom to view the running build.
|
||||
|
||||
[1]: https://en.wikipedia.org/wiki/Eclipse_(software)
|
||||
[1]: https://en.wikipedia.org/wiki/Eclipse_(software)
|
||||
|
@ -1,82 +0,0 @@
|
||||
Setting up your ARM based PCB is a little more involved than an Atmel MCU, but is easy enough. Start by running `util/new_keyboard.sh`:
|
||||
|
||||
```
|
||||
$ ./util/new_keyboard.sh
|
||||
Generating a new QMK keyboard directory
|
||||
|
||||
Keyboard Name: mycoolkb
|
||||
Keyboard Type [avr]:
|
||||
Your Name [John Smith]:
|
||||
|
||||
Copying base template files... done
|
||||
Copying avr template files... done
|
||||
Renaming keyboard files... done
|
||||
Replacing %KEYBOARD% with mycoolkb... done
|
||||
Replacing %YOUR_NAME% with John Smith... done
|
||||
|
||||
Created a new keyboard called mycoolkb.
|
||||
|
||||
To start working on things, cd into keyboards/mycoolkb,
|
||||
or open the directory in your favourite text editor.
|
||||
```
|
||||
|
||||
# END OF NEW ARM DOC, OLD ATMEL DOC FOLLOWS
|
||||
|
||||
## `/keyboards/<keyboard>/config.h`
|
||||
|
||||
The `USB Device descriptor parameter` block contains parameters are used to uniquely identify your keyboard, but they don't really matter to the machine.
|
||||
|
||||
Your `MATRIX_ROWS` and `MATRIX_COLS` are the numbers of rows and cols in your keyboard matrix - this may be different than the number of actual rows and columns on your keyboard. There are some tricks you can pull to increase the number of keys in a given matrix, but most keyboards are pretty straight-forward.
|
||||
|
||||
The `MATRIX_ROW_PINS` and `MATRIX_COL_PINS` are the pins your MCU uses on each row/column. Your schematic (if you have one) will have this information on it, and the values will vary depending on your setup. This is one of the most important things to double-check in getting your keyboard setup correctly.
|
||||
|
||||
For the `DIODE_DIRECTION`, most hand-wiring guides will instruct you to wire the diodes in the `COL2ROW` position, but it's possible that they are in the other - people coming from EasyAVR often use `ROW2COL`. Nothing will function if this is incorrect.
|
||||
|
||||
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `DIRECT_PINS`. The mapping defines the pins of each switch in rows and columns, from left to right. Must conform to the sizes within `MATRIX_ROWS` and `MATRIX_COLS`, use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `DIODE_DIRECTION`, `MATRIX_ROW_PINS` and `MATRIX_COL_PINS`.
|
||||
|
||||
`BACKLIGHT_PIN` is the pin that your PWM-controlled backlight (if one exists) is hooked-up to.
|
||||
|
||||
`BACKLIGHT_BREATHING` is a fancier backlight feature that adds breathing/pulsing/fading effects to the backlight. It uses the same timer as the normal backlight. These breathing effects must be called by code in your keymap.
|
||||
|
||||
`BACKLIGHT_LEVELS` is how many levels exist for your backlight - max is 31, and they are computed automatically from this number.
|
||||
|
||||
## `/keyboards/<keyboard>/Makefile`
|
||||
|
||||
The values at the top likely won't need to be changed, since most boards use the `atmega32u4` chip. The `BOOTLOADER_SIZE` will need to be adjusted based on your MCU type. It's defaulted to the Teensy, since that's the most common controller. Below is quoted from the `Makefile`.
|
||||
|
||||
```
|
||||
# Boot Section Size in *bytes*
|
||||
# Teensy halfKay 512
|
||||
# Teensy++ halfKay 1024
|
||||
# Atmel DFU loader 4096
|
||||
# LUFA bootloader 4096
|
||||
# USBaspLoader 2048
|
||||
OPT_DEFS += -DBOOTLOADER_SIZE=512
|
||||
```
|
||||
|
||||
At the bottom of the file, you'll find lots of features to turn on and off - all of these options should be set with `?=` to allow for the keymap overrides. `?=` only assigns if the variable was previously undefined. For the full documentation of these features, see the [Makefile options](#makefile-options).
|
||||
|
||||
## `/keyboards/<keyboard>/readme.md`
|
||||
|
||||
This is where you'll describe your keyboard - please write as much as you can about it! Talking about default functionality/features is useful here. Feel free to link to external pages/sites if necessary. Images can be included here as well. This file will be rendered into a webpage at qmk.fm/keyboards/<keyboard>/.
|
||||
|
||||
## `/keyboards/<keyboard>/<keyboard>.c`
|
||||
|
||||
This is where all of the custom logic for your keyboard goes - you may not need to put anything in this file, since a lot of things are configured automatically. All of the `*_kb()` functions are defined here. If you modify them, remember to keep the calls to `*_user()`, or things in the keymaps might not work. You can read more about the functions [here](#custom-quantum-functions-for-keyboards-and-keymaps)
|
||||
|
||||
## `/keyboards/<keyboard>/<keyboard>.h`
|
||||
|
||||
Here is where you can (optionally) define your `LAYOUT` function to remap your matrix into a more readable format. With ortholinear boards, this isn't always necessary, but it can help to accommodate the dead spots on your matrix, where there are keys that take up more than one space (2u, staggering, 6.25u, etc). The example shows the difference between the physical keys, and the matrix design:
|
||||
|
||||
```
|
||||
#define LAYOUT( \
|
||||
k00, k01, k02, \
|
||||
k10, k11 \
|
||||
) \
|
||||
{ \
|
||||
{ k00, k01, k02 }, \
|
||||
{ k10, KC_NO, k11 }, \
|
||||
}
|
||||
```
|
||||
|
||||
Each of the `kxx` variables needs to be unique, and usually follows the format `k<row><col>`. You can place `KC_NO` where your dead keys are in your matrix.
|
@ -77,7 +77,7 @@
|
||||
* [Macros](pt-br/feature_macros.md)
|
||||
* [Mouse Keys](pt-br/feature_mouse_keys.md)
|
||||
* [OLED Driver](pt-br/feature_oled_driver.md)
|
||||
* [One Shot Keys](pt-br/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [One Shot Keys](pt-br/one_shot_keys.md)
|
||||
* [Pointing Device](pt-br/feature_pointing_device.md)
|
||||
* [PS/2 Mouse](pt-br/feature_ps2_mouse.md)
|
||||
* [RGB Lighting](pt-br/feature_rgblight.md)
|
||||
@ -108,7 +108,7 @@
|
||||
* Other Topics
|
||||
* [Using Eclipse with QMK](pt-br/other_eclipse.md)
|
||||
* [Using VSCode with QMK](pt-br/other_vscode.md)
|
||||
* [Support](pt-br/support.md)
|
||||
* [Support](pt-br/getting_started_getting_help.md)
|
||||
* [How to add translations](pt-br/translating.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
|
@ -6,7 +6,7 @@ All keycodes within quantum are numbers between `0x0000` and `0xFFFF`. Within yo
|
||||
|
||||
On this page we have documented keycodes between `0x00FF` and `0xFFFF` which are used to implement advanced quantum features. If you define your own custom keycodes they will be put into this range as well.
|
||||
|
||||
## QMK Keycodes
|
||||
## QMK Keycodes :id=qmk-keycodes
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|--------------|---------|-------------------------------------------------------|
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
There are a lot of hidden functions in QMK that are incredible useful, or may add a bit of functionality that you've been wanting. Functions that are specific to certain features are not included here, as those will be on their respective feature page.
|
||||
|
||||
## (OLKB) Tri Layers
|
||||
## (OLKB) Tri Layers :id=olkb-tri-layers
|
||||
|
||||
There are actually separate functions that you can use there, depending on what you're after.
|
||||
|
||||
|
@ -8,17 +8,17 @@ This page covers how to properly support keyboards in the [QMK Configurator](htt
|
||||
To understand how the Configurator understands keyboards, first one must understand layout macros. For this exercise, we're going to imagine a 17-key numpad PCB, which we're going to call `numpad`.
|
||||
|
||||
```
|
||||
┌───┬───┬───┬───┐
|
||||
│NLk│ / │ * │ - │
|
||||
├───┼───┼───┼───┤
|
||||
│7 │8 │9 │ + │
|
||||
├───┼───┼───┤ │
|
||||
│4 │5 │6 │ │
|
||||
├───┼───┼───┼───┤
|
||||
│1 │2 │3 │Ent│
|
||||
├───┴───┼───┤ │
|
||||
│0 │ . │ │
|
||||
└───────┴───┴───┘
|
||||
|---------------|
|
||||
|NLk| / | * | - |
|
||||
|---+---+---+---|
|
||||
|7 |8 |9 | + |
|
||||
|---+---+---| |
|
||||
|4 |5 |6 | |
|
||||
|---+---+---+---|
|
||||
|1 |2 |3 |Ent|
|
||||
|-------+---| |
|
||||
|0 | . | |
|
||||
|---------------|
|
||||
```
|
||||
|
||||
?> For more on layout macros, see [Understanding QMK: Matrix Scanning](understanding_qmk.md?id=matrix-scanning) and [Understanding QMK: Matrix to Physical Layout Map](understanding_qmk.md?id=matrix-to-physical-layout-map).
|
||||
@ -130,18 +130,20 @@ Use the `keyboard_name` object to set the name of the keyboard. For instruction
|
||||
The `layouts` object contains the data that represents the physical layout of the keyboard. It has an object `LAYOUT`, which needs to match the name of our layout macro from `numpad.h`. The `LAYOUT` object itself has an object named `layout`, which contains one JSON object for each physical key on our keyboard, formatted as follows:
|
||||
|
||||
```
|
||||
┌ The name of the key. Not displayed in the Configurator.
|
||||
│ ┌ The key's X-axis location, in key units from the
|
||||
│ │ keyboard's left edge.
|
||||
│ │ ┌ The key's Y-axis location, in key units from
|
||||
│ │ │ the keyboard's top (rear-facing) edge.
|
||||
The name of the key. Not displayed in the Configurator.
|
||||
|
|
||||
| The key's X-axis location, in key units from the
|
||||
| | keyboard's left edge.
|
||||
| |
|
||||
| | The key's Y-axis location, in key units from
|
||||
| | | the keyboard's top (rear-facing) edge.
|
||||
↓ ↓ ↓
|
||||
{"label":"Num Lock", "x":0, "y":0},
|
||||
```
|
||||
|
||||
Some objects will also have `"w"` and `"h"` keys, which represent a key's width and height, respectively.
|
||||
|
||||
?> For more on the `info.json` files, see [QMK Keyboard Guidelines: Keyboard Metadata](hardware_keyboard_guidelines.md?id=keyboard-metadata)
|
||||
?> For more on the `info.json` files, see [`info.json` Format](reference_info_json.md).
|
||||
|
||||
|
||||
## How the Configurator Programs Keys
|
||||
|
@ -78,7 +78,7 @@
|
||||
* [Macros](ru-ru/feature_macros.md)
|
||||
* [Mouse Keys](ru-ru/feature_mouse_keys.md)
|
||||
* [OLED Driver](ru-ru/feature_oled_driver.md)
|
||||
* [One Shot Keys](ru-ru/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [One Shot Keys](ru-ru/one_shot_keys.md)
|
||||
* [Pointing Device](ru-ru/feature_pointing_device.md)
|
||||
* [PS/2 Mouse](ru-ru/feature_ps2_mouse.md)
|
||||
* [RGB Lighting](ru-ru/feature_rgblight.md)
|
||||
@ -110,7 +110,7 @@
|
||||
* Other Topics
|
||||
* [Using Eclipse with QMK](ru-ru/other_eclipse.md)
|
||||
* [Using VSCode with QMK](ru-ru/other_vscode.md)
|
||||
* [Support](ru-ru/support.md)
|
||||
* [Support](ru-ru/getting_started_getting_help.md)
|
||||
* [Translating the QMK Docs](ru-ru/translating.md)
|
||||
|
||||
* QMK Internals (In Progress)
|
||||
|
@ -1,9 +0,0 @@
|
||||
# Стать соавтором QMK
|
||||
|
||||
Соавтор QMK - это производитель или разработчик клавиатуры, который заинтересован в том, чтобы помочь QMK вырасти. Для этого он полностью поддерживает свои клавиатуры, поощряет пользователей и клиентов создавать новый функционал, идеи и раскладки клавиатур. Мы всегда стремимся добавлять больше клавиатур и соавторов, но нам важно, чтобы они соответствовали следующим требованиям:
|
||||
|
||||
* **Иметь печатную плату на продажу.** К сожалению, у собранных вручную клавиатур слишком много вариаций и сложностей.
|
||||
* **Поддерживать вашу клавиатуру в QMK.** Это может потребовать просто начальной настройки, чтобы ваша клавиатура заработала. Но поддержка также может заключаться в адаптации изменений ядра QMK, которые способны сломать или сделать избыточным любой пользовательский код.
|
||||
* **Одобрять и производить слияние пулреквестов для вашей клавиатуры.** Мы призываем пользователей делиться своими раскладками клавиатур, чтобы другие могли их видеть и опираться на них при создании своих собственных.
|
||||
|
||||
Если вы чувствуете, что удовлетворяете этим требованиям, напишите нам письмо по адресу hello@qmk.fm с кратким описанием и ссылками на вашу клавиатуру!
|
@ -8,3 +8,23 @@
|
||||
.search {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.markdown-section h2 {
|
||||
padding-top: 0.25rem;
|
||||
}
|
||||
|
||||
.markdown-section h3 {
|
||||
margin-top: 0.25rem;
|
||||
}
|
||||
|
||||
.sidebar, .sidebar-nav {
|
||||
line-height: 1.5em !important;
|
||||
}
|
||||
|
||||
.markdown-section ul ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.markdown-section pre {
|
||||
padding: 0;
|
||||
}
|
||||
|
@ -1,43 +1,17 @@
|
||||
# Support
|
||||
# Getting Help
|
||||
|
||||
There are a lot of resources for getting help with QMK.
|
||||
|
||||
Please read our [Code of Conduct](https://qmk.fm/coc/) before participating in any of our community spaces.
|
||||
|
||||
## Realtime Chat
|
||||
|
||||
If you need help with something, the best place to get quick support is going to be on our [Discord Server](https://discord.gg/Uq7gcHh). There is usually somebody online, and there are a bunch of very helpful people there.
|
||||
|
||||
Don't forget to read our [Code of Conduct](https://qmk.fm/coc/).
|
||||
## OLKB Subreddit
|
||||
|
||||
## Help! I don't know where to start!
|
||||
The official QMK forum is [/r/olkb](https://reddit.com/r/olkb) on [reddit.com](https://reddit.com).
|
||||
|
||||
If this is the case, then you should start with our [Newbs Guide](https://docs.qmk.fm/#/newbs). There is a lot of great info there, and that should cover everything you need to get started.
|
||||
## Github Issues
|
||||
|
||||
If that's an issue, hop onto the [QMK Configurator](https://config.qmk.fm), as that will handle a majority of what you need there.
|
||||
|
||||
## Help! I'm having issues flashing!
|
||||
|
||||
First, head to the [Compiling/Flashing FAQ Page](https://docs.qmk.fm/#/faq_build). There is a good deal of info there, and you'll find a bunch of solutions to common issues there.
|
||||
|
||||
## Help, I have an issue that isn't covered by the links above
|
||||
|
||||
Okay, that's fine. Then please check the [open issues in our GitHub](https://github.com/qmk/qmk_firmware/issues) to see if somebody is experiencing the same thing (make sure it's not just similar, but actually the same).
|
||||
|
||||
If you can't find anything, then please open a [new issue](https://github.com/qmk/qmk_firmware/issues/new)!
|
||||
|
||||
## What if I found a bug?
|
||||
|
||||
Then please open an [issue](https://github.com/qmk/qmk_firmware/issues/new), and if you know how to fix it, open up a Pull Request on GitHub with the fix.
|
||||
|
||||
## But `git` and `GitHub` are intimidating!
|
||||
|
||||
Don't worry, we have some pretty nice [Guidelines](https://docs.qmk.fm/#/newbs_best_practices) on how to start using `git` and GitHub to make things easier to develop.
|
||||
|
||||
Additionally, you can find additional `git` and GitHub related links [here](https://docs.qmk.fm/#/newbs_learn_more_resources).
|
||||
|
||||
## I have a Keyboard that I want to add support for
|
||||
|
||||
Awesome! Open up a Pull Request for it. We'll review the code, and merge it!
|
||||
|
||||
### What if I want to do brand it with `QMK`?
|
||||
|
||||
That's amazing! We would love to assist you with that!
|
||||
|
||||
In fact, we have a [whole page](https://qmk.fm/powered/) dedicated to adding QMK Branding to your page and keyboard. This covers pretty much everything you need (knowledge and images) to officially support QMK.
|
||||
|
||||
If you have any questions about this, open an issue or head to [Discord](https://discord.gg/Uq7gcHh).
|
||||
You can open an [issue on GitHub](https://github.com/qmk/qmk_firmware/issues). This is especially handy when your issue will require long-term discussion or debugging.
|
||||
|
128
docs/tap_hold.md
Normal file
128
docs/tap_hold.md
Normal file
@ -0,0 +1,128 @@
|
||||
# Tap-Hold Configuration Options
|
||||
|
||||
While Tap-Hold options are fantastic, they are not without their issues. We have tried to configure them with reasonable defaults, but that may still cause issues for some people.
|
||||
|
||||
These options let you modify the behavior of the Tap-Hold keys.
|
||||
|
||||
## Permissive Hold
|
||||
|
||||
As of [PR#1359](https://github.com/qmk/qmk_firmware/pull/1359/), there is a new `config.h` option:
|
||||
|
||||
```c
|
||||
#define PERMISSIVE_HOLD
|
||||
```
|
||||
|
||||
This makes tap and hold keys (like Mod Tap) work better for fast typist, or for high `TAPPING_TERM` settings.
|
||||
|
||||
If you press a Mod Tap key, tap another key (press and release) and then release the Mod Tap key, all within the tapping term, it will output the "tapping" function for both keys.
|
||||
|
||||
For Instance:
|
||||
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `KC_X` Up
|
||||
- `SFT_T(KC_A)` Up
|
||||
|
||||
Normally, if you do all this within the `TAPPING_TERM` (default: 200ms) this will be registered as `ax` by the firmware and host system. With permissive hold enabled, this modifies how this is handled by considering the Mod Tap keys as a Mod if another key is tapped, and would registered as `X` (`SHIFT`+`x`).
|
||||
|
||||
?> If you have `Ignore Mod Tap Interrupt` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
|
||||
|
||||
## Ignore Mod Tap Interrupt
|
||||
|
||||
To enable this setting, add this to your `config.h`:
|
||||
|
||||
```c
|
||||
#define IGNORE_MOD_TAP_INTERRUPT
|
||||
```
|
||||
|
||||
Similar to Permissive Hold, this alters how the firmware processes input for fast typist. If you press a Mod Tap key, press another key, release the Mod Tap key, and then release the normal key, it would normally output the "tapping" function for both keys. This may not be desirable for rolling combo keys.
|
||||
|
||||
Setting `Ignore Mod Tap Interrupt` requires holding both keys for the `TAPPING_TERM` to trigger the hold function (the mod).
|
||||
|
||||
For Instance:
|
||||
|
||||
- `SFT_T(KC_A)` Down
|
||||
- `KC_X` Down
|
||||
- `SFT_T(KC_A)` Up
|
||||
- `KC_X` Up
|
||||
|
||||
Normally, this would send `X` (`SHIFT`+`x`). With `Ignore Mod Tap Interrupt` enabled, holding both keys are required for the `TAPPING_TERM` to register the hold action. A quick tap will output `ax` in this case, while a hold on both will still output `X` (`SHIFT`+`x`).
|
||||
|
||||
|
||||
?> __Note__: This only concerns modifiers and not layer switching keys.
|
||||
|
||||
?> If you have `Permissive Hold` enabled, as well, this will modify how both work. The regular key has the modifier added if the first key is released first or if both keys are held longer than the `TAPPING_TERM`.
|
||||
|
||||
For more granular control of this feature, you can add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
|
||||
```
|
||||
|
||||
You can then add the following function to your keymap:
|
||||
|
||||
```c
|
||||
bool get_ignore_mod_tap_interrupt(uint16_t keycode) {
|
||||
switch (keycode) {
|
||||
case SFT_T(KC_SPC):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Tapping Force Hold
|
||||
|
||||
To enable `tapping force hold`, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define TAPPING_FORCE_HOLD
|
||||
```
|
||||
|
||||
When the user holds a key after tap, this repeats the tapped key rather to hold a modifier key. This allows to use auto repeat for the tapped key.
|
||||
|
||||
Example:
|
||||
|
||||
- SFT_T(KC_A) Down
|
||||
- SFT_T(KC_A) Up
|
||||
- SFT_T(KC_A) Down
|
||||
- wait more than tapping term...
|
||||
- SFT_T(KC_A) Up
|
||||
|
||||
With default settings, `a` will be sent on the first release, then `a` will be sent on the second press allowing the computer to trigger its auto repeat function.
|
||||
|
||||
With `TAPPING_FORCE_HOLD`, the second press will be interpreted as a Shift, allowing to use it as a modifier shortly after having used it as a tap.
|
||||
|
||||
!> `TAPPING_FORCE_HOLD` will break anything that uses tapping toggles (Such as the `TT` layer keycode, and the One Shot Tapping Toggle).
|
||||
|
||||
For more granular control of this feature, you can add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define TAPPING_FORCE_HOLD_PER_KEY
|
||||
```
|
||||
|
||||
You can then add the following function to your keymap:
|
||||
|
||||
```c
|
||||
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case LT(1, KC_BSPC):
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Retro Tapping
|
||||
|
||||
To enable `retro tapping`, add the following to your `config.h`:
|
||||
|
||||
```c
|
||||
#define RETRO_TAPPING
|
||||
```
|
||||
|
||||
Holding and releasing a dual function key without pressing another key will result in nothing happening. With retro tapping enabled, releasing the key without pressing another will send the original keycode even if it is outside the tapping term.
|
||||
|
||||
For instance, holding and releasing `LT(2, KC_SPACE)` without hitting another key will result in nothing happening. With this enabled, it will send `KC_SPACE` instead.
|
@ -48,7 +48,7 @@ It's not yet possible to do a full integration test, where you would compile the
|
||||
|
||||
In that model you would emulate the input, and expect a certain output from the emulated keyboard.
|
||||
|
||||
# Tracing Variables
|
||||
# Tracing Variables :id=tracing-variables
|
||||
|
||||
Sometimes you might wonder why a variable gets changed and where, and this can be quite tricky to track down without having a debugger. It's of course possible to manually add print statements to track it, but you can also enable the variable trace feature. This works for both for variables that are changed by the code, and when the variable is changed by some memory corruption.
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
* [宏指令](zh-cn/feature_macros.md)
|
||||
* [鼠标键](zh-cn/feature_mouse_keys.md)
|
||||
* [OLED驱动](zh-cn/feature_oled_driver.md)
|
||||
* [一键功能](zh-cn/feature_advanced_keycodes.md#one-shot-keys)
|
||||
* [一键功能](zh-cn/one_shot_keys.md)
|
||||
* [指针设备](zh-cn/feature_pointing_device.md)
|
||||
* [PS/2鼠标](zh-cn/feature_ps2_mouse.md)
|
||||
* [RGB灯光](zh-cn/feature_rgblight.md)
|
||||
@ -117,7 +117,7 @@
|
||||
* 其他话题
|
||||
* [使用Eclipse开发QMK](zh-cn/other_eclipse.md)
|
||||
* [使用VSCode开发QMK](zh-cn/other_vscode.md)
|
||||
* [支持](zh-cn/support.md)
|
||||
* [支持](zh-cn/getting_started_getting_help.md)
|
||||
* [翻译QMK文档](zh-cn/translating.md)
|
||||
|
||||
* QMK 内构 (正在编写)
|
||||
@ -129,4 +129,4 @@
|
||||
* [发送函数](zh-cn/internals_send_functions.md)
|
||||
* [Sysex工具](zh-cn/internals_sysex_tools.md)
|
||||
<!--fromen:20200126-6:03AM(GMT+8)-->
|
||||
<!--cn:20200211-11:04AM(GMT+8)-->
|
||||
<!--cn:20200211-11:04AM(GMT+8)-->
|
||||
|
250
drivers/boards/BLACKPILL_STM32_F401/board.c
Normal file
250
drivers/boards/BLACKPILL_STM32_F401/board.c
Normal file
@ -0,0 +1,250 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO port setup.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t moder;
|
||||
uint32_t otyper;
|
||||
uint32_t ospeedr;
|
||||
uint32_t pupdr;
|
||||
uint32_t odr;
|
||||
uint32_t afrl;
|
||||
uint32_t afrh;
|
||||
} gpio_setup_t;
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO initialization data.
|
||||
*/
|
||||
typedef struct {
|
||||
#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
|
||||
gpio_setup_t PAData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
|
||||
gpio_setup_t PBData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
|
||||
gpio_setup_t PCData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
|
||||
gpio_setup_t PDData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
|
||||
gpio_setup_t PEData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
|
||||
gpio_setup_t PFData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
|
||||
gpio_setup_t PGData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
|
||||
gpio_setup_t PHData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
|
||||
gpio_setup_t PIData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
|
||||
gpio_setup_t PJData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
|
||||
gpio_setup_t PKData;
|
||||
#endif
|
||||
} gpio_config_t;
|
||||
|
||||
/**
|
||||
* @brief STM32 GPIO static initialization data.
|
||||
*/
|
||||
static const gpio_config_t gpio_default_config = {
|
||||
#if STM32_HAS_GPIOA
|
||||
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
|
||||
#endif
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
|
||||
gpiop->OTYPER = config->otyper;
|
||||
gpiop->OSPEEDR = config->ospeedr;
|
||||
gpiop->PUPDR = config->pupdr;
|
||||
gpiop->ODR = config->odr;
|
||||
gpiop->AFRL = config->afrl;
|
||||
gpiop->AFRH = config->afrh;
|
||||
gpiop->MODER = config->moder;
|
||||
}
|
||||
|
||||
static void stm32_gpio_init(void) {
|
||||
/* Enabling GPIO-related clocks, the mask comes from the
|
||||
registry header file.*/
|
||||
rccResetAHB1(STM32_GPIO_EN_MASK);
|
||||
rccEnableAHB1(STM32_GPIO_EN_MASK, true);
|
||||
|
||||
/* Initializing all the defined GPIO ports.*/
|
||||
#if STM32_HAS_GPIOA
|
||||
gpio_init(GPIOA, &gpio_default_config.PAData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
gpio_init(GPIOB, &gpio_default_config.PBData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
gpio_init(GPIOC, &gpio_default_config.PCData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
gpio_init(GPIOD, &gpio_default_config.PDData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
gpio_init(GPIOE, &gpio_default_config.PEData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
gpio_init(GPIOF, &gpio_default_config.PFData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
gpio_init(GPIOG, &gpio_default_config.PGData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
gpio_init(GPIOH, &gpio_default_config.PHData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
gpio_init(GPIOI, &gpio_default_config.PIData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
gpio_init(GPIOJ, &gpio_default_config.PJData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
gpio_init(GPIOK, &gpio_default_config.PKData);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
|
||||
|
||||
/**
|
||||
* @brief Early initialization code.
|
||||
* @details GPIO ports and system clocks are initialized before everything
|
||||
* else.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
enter_bootloader_mode_if_requested();
|
||||
|
||||
stm32_gpio_init();
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
#if HAL_USE_SDC || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief SDC card detection.
|
||||
*/
|
||||
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDC card write protection detection.
|
||||
*/
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief MMC_SPI card detection.
|
||||
*/
|
||||
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MMC_SPI card write protection detection.
|
||||
*/
|
||||
bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Board-specific initialization code.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void boardInit(void) {}
|
568
drivers/boards/BLACKPILL_STM32_F401/board.h
Normal file
568
drivers/boards/BLACKPILL_STM32_F401/board.h
Normal file
@ -0,0 +1,568 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Setup for STM32F401CCU6 black pill board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_BLACKPILL_STM32_F401
|
||||
#define BOARD_NAME "STM32F401CCU6 blackpill"
|
||||
|
||||
/*
|
||||
* Allow Board to boot USB without extra A9 hardware/software config
|
||||
*/
|
||||
#define BOARD_OTG_NOVBUSSENS 1
|
||||
|
||||
/*
|
||||
* Board oscillators-related settings.
|
||||
*/
|
||||
#if !defined(STM32_LSECLK)
|
||||
# define STM32_LSECLK 32768U
|
||||
#endif
|
||||
|
||||
#if !defined(STM32_HSECLK)
|
||||
# define STM32_HSECLK 25000000U
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Board voltages.
|
||||
* Required for performance limits calculation.
|
||||
*/
|
||||
#define STM32_VDD 300U
|
||||
|
||||
/*
|
||||
* MCU type as defined in the ST header.
|
||||
*/
|
||||
#define STM32F401xC
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_BUTTON 0U
|
||||
#define GPIOA_PIN1 1U
|
||||
#define GPIOA_PIN2 2U
|
||||
#define GPIOA_PIN3 3U
|
||||
#define GPIOA_CS43L22_LRCK 4U
|
||||
#define GPIOA_L3GD20_SCL 5U
|
||||
#define GPIOA_L3GD20_SD0 6U
|
||||
#define GPIOA_L3GD20_SDI 7U
|
||||
#define GPIOA_PIN8 8U
|
||||
#define GPIOA_VBUS_FS 9U
|
||||
#define GPIOA_OTG_FS_ID 10U
|
||||
#define GPIOA_OTG_FS_DM 11U
|
||||
#define GPIOA_OTG_FS_DP 12U
|
||||
#define GPIOA_SWDIO 13U
|
||||
#define GPIOA_SWCLK 14U
|
||||
#define GPIOA_PIN15 15U
|
||||
|
||||
#define GPIOB_PIN0 0U
|
||||
#define GPIOB_PIN1 1U
|
||||
#define GPIOB_PIN2 2U
|
||||
#define GPIOB_SWO 3U
|
||||
#define GPIOB_PIN4 4U
|
||||
#define GPIOB_PIN5 5U
|
||||
#define GPIOB_LSM303DLHC_SCL 6U
|
||||
#define GPIOB_PIN7 7U
|
||||
#define GPIOB_PIN8 8U
|
||||
#define GPIOB_LSM303DLHC_SDA 9U
|
||||
#define GPIOB_MP45DT02_CLK_IN 10U
|
||||
#define GPIOB_PIN11 11U
|
||||
#define GPIOB_PIN12 12U
|
||||
#define GPIOB_PIN13 13U
|
||||
#define GPIOB_PIN14 14U
|
||||
#define GPIOB_PIN15 15U
|
||||
|
||||
#define GPIOC_OTG_FS_POWER_ON 0U
|
||||
#define GPIOC_PIN1 1U
|
||||
#define GPIOC_PIN2 2U
|
||||
#define GPIOC_CS43L22_AIN4x 3U
|
||||
#define GPIOC_MP45DT02_PDM_OUT 3U
|
||||
#define GPIOC_PIN4 4U
|
||||
#define GPIOC_PIN5 5U
|
||||
#define GPIOC_PIN6 6U
|
||||
#define GPIOC_CS43L22_MCLK 7U
|
||||
#define GPIOC_PIN8 8U
|
||||
#define GPIOC_PIN9 9U
|
||||
#define GPIOC_CS43L22_SCLK 10U
|
||||
#define GPIOC_PIN11 11U
|
||||
#define GPIOC_CS43L22_SDIN 12U
|
||||
#define GPIOC_PIN13 13U
|
||||
#define GPIOC_OSC32_IN 14U
|
||||
#define GPIOC_OSC32_OUT 15U
|
||||
|
||||
#define GPIOD_PIN0 0U
|
||||
#define GPIOD_PIN1 1U
|
||||
#define GPIOD_PIN2 2U
|
||||
#define GPIOD_PIN3 3U
|
||||
#define GPIOD_CS43L22_RESET 4U
|
||||
#define GPIOD_OverCurrent 5U
|
||||
#define GPIOD_PIN6 6U
|
||||
#define GPIOD_PIN7 7U
|
||||
#define GPIOD_PIN8 8U
|
||||
#define GPIOD_PIN9 9U
|
||||
#define GPIOD_PIN10 10U
|
||||
#define GPIOD_PIN11 11U
|
||||
#define GPIOD_LED4 12U
|
||||
#define GPIOD_LED3 13U
|
||||
#define GPIOD_LED5 14U
|
||||
#define GPIOD_LED6 15U
|
||||
|
||||
#define GPIOE_L3GD20_INT1 0U
|
||||
#define GPIOE_L3GD20_INT2 1U
|
||||
#define GPIOE_LSM303DLHC_DRDY 2U
|
||||
#define GPIOE_L3GD20_CS 3U
|
||||
#define GPIOE_LSM303DLHC_INT1 4U
|
||||
#define GPIOE_LSM303DLHC_INT2 5U
|
||||
#define GPIOE_PIN6 6U
|
||||
#define GPIOE_PIN7 7U
|
||||
#define GPIOE_PIN8 8U
|
||||
#define GPIOE_PIN9 9U
|
||||
#define GPIOE_PIN10 10U
|
||||
#define GPIOE_PIN11 11U
|
||||
#define GPIOE_PIN12 12U
|
||||
#define GPIOE_PIN13 13U
|
||||
#define GPIOE_PIN14 14U
|
||||
#define GPIOE_PIN15 15U
|
||||
|
||||
#define GPIOF_PIN0 0U
|
||||
#define GPIOF_PIN1 1U
|
||||
#define GPIOF_PIN2 2U
|
||||
#define GPIOF_PIN3 3U
|
||||
#define GPIOF_PIN4 4U
|
||||
#define GPIOF_PIN5 5U
|
||||
#define GPIOF_PIN6 6U
|
||||
#define GPIOF_PIN7 7U
|
||||
#define GPIOF_PIN8 8U
|
||||
#define GPIOF_PIN9 9U
|
||||
#define GPIOF_PIN10 10U
|
||||
#define GPIOF_PIN11 11U
|
||||
#define GPIOF_PIN12 12U
|
||||
#define GPIOF_PIN13 13U
|
||||
#define GPIOF_PIN14 14U
|
||||
#define GPIOF_PIN15 15U
|
||||
|
||||
#define GPIOG_PIN0 0U
|
||||
#define GPIOG_PIN1 1U
|
||||
#define GPIOG_PIN2 2U
|
||||
#define GPIOG_PIN3 3U
|
||||
#define GPIOG_PIN4 4U
|
||||
#define GPIOG_PIN5 5U
|
||||
#define GPIOG_PIN6 6U
|
||||
#define GPIOG_PIN7 7U
|
||||
#define GPIOG_PIN8 8U
|
||||
#define GPIOG_PIN9 9U
|
||||
#define GPIOG_PIN10 10U
|
||||
#define GPIOG_PIN11 11U
|
||||
#define GPIOG_PIN12 12U
|
||||
#define GPIOG_PIN13 13U
|
||||
#define GPIOG_PIN14 14U
|
||||
#define GPIOG_PIN15 15U
|
||||
|
||||
#define GPIOH_OSC_IN 0U
|
||||
#define GPIOH_OSC_OUT 1U
|
||||
#define GPIOH_PIN2 2U
|
||||
#define GPIOH_PIN3 3U
|
||||
#define GPIOH_PIN4 4U
|
||||
#define GPIOH_PIN5 5U
|
||||
#define GPIOH_PIN6 6U
|
||||
#define GPIOH_PIN7 7U
|
||||
#define GPIOH_PIN8 8U
|
||||
#define GPIOH_PIN9 9U
|
||||
#define GPIOH_PIN10 10U
|
||||
#define GPIOH_PIN11 11U
|
||||
#define GPIOH_PIN12 12U
|
||||
#define GPIOH_PIN13 13U
|
||||
#define GPIOH_PIN14 14U
|
||||
#define GPIOH_PIN15 15U
|
||||
|
||||
#define GPIOI_PIN0 0U
|
||||
#define GPIOI_PIN1 1U
|
||||
#define GPIOI_PIN2 2U
|
||||
#define GPIOI_PIN3 3U
|
||||
#define GPIOI_PIN4 4U
|
||||
#define GPIOI_PIN5 5U
|
||||
#define GPIOI_PIN6 6U
|
||||
#define GPIOI_PIN7 7U
|
||||
#define GPIOI_PIN8 8U
|
||||
#define GPIOI_PIN9 9U
|
||||
#define GPIOI_PIN10 10U
|
||||
#define GPIOI_PIN11 11U
|
||||
#define GPIOI_PIN12 12U
|
||||
#define GPIOI_PIN13 13U
|
||||
#define GPIOI_PIN14 14U
|
||||
#define GPIOI_PIN15 15U
|
||||
|
||||
/*
|
||||
* IO lines assignments.
|
||||
*/
|
||||
#define LINE_BUTTON PAL_LINE(GPIOA, 0U)
|
||||
#define LINE_CS43L22_LRCK PAL_LINE(GPIOA, 4U)
|
||||
#define LINE_L3GD20_SCL PAL_LINE(GPIOA, 5U)
|
||||
#define LINE_L3GD20_SD0 PAL_LINE(GPIOA, 6U)
|
||||
#define LINE_L3GD20_SDI PAL_LINE(GPIOA, 7U)
|
||||
#define LINE_VBUS_FS PAL_LINE(GPIOA, 9U)
|
||||
#define LINE_OTG_FS_ID PAL_LINE(GPIOA, 10U)
|
||||
#define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
|
||||
#define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
|
||||
#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
|
||||
#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
|
||||
#define LINE_SWO PAL_LINE(GPIOB, 3U)
|
||||
#define LINE_LSM303DLHC_SCL PAL_LINE(GPIOB, 6U)
|
||||
#define LINE_LSM303DLHC_SDA PAL_LINE(GPIOB, 9U)
|
||||
#define LINE_MP45DT02_CLK_IN PAL_LINE(GPIOB, 10U)
|
||||
#define LINE_OTG_FS_POWER_ON PAL_LINE(GPIOC, 0U)
|
||||
#define LINE_CS43L22_AIN4x PAL_LINE(GPIOC, 3U)
|
||||
#define LINE_MP45DT02_PDM_OUT PAL_LINE(GPIOC, 3U)
|
||||
#define LINE_CS43L22_MCLK PAL_LINE(GPIOC, 7U)
|
||||
#define LINE_CS43L22_SCLK PAL_LINE(GPIOC, 10U)
|
||||
#define LINE_CS43L22_SDIN PAL_LINE(GPIOC, 12U)
|
||||
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
|
||||
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
|
||||
#define LINE_CS43L22_RESET PAL_LINE(GPIOD, 4U)
|
||||
#define LINE_OverCurrent PAL_LINE(GPIOD, 5U)
|
||||
#define LINE_LED4 PAL_LINE(GPIOD, 12U)
|
||||
#define LINE_LED3 PAL_LINE(GPIOD, 13U)
|
||||
#define LINE_LED5 PAL_LINE(GPIOD, 14U)
|
||||
#define LINE_LED6 PAL_LINE(GPIOD, 15U)
|
||||
#define LINE_L3GD20_INT1 PAL_LINE(GPIOE, 0U)
|
||||
#define LINE_L3GD20_INT2 PAL_LINE(GPIOE, 1U)
|
||||
#define LINE_LSM303DLHC_DRDY PAL_LINE(GPIOE, 2U)
|
||||
#define LINE_L3GD20_CS PAL_LINE(GPIOE, 3U)
|
||||
#define LINE_LSM303DLHC_INT1 PAL_LINE(GPIOE, 4U)
|
||||
#define LINE_LSM303DLHC_INT2 PAL_LINE(GPIOE, 5U)
|
||||
#define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
|
||||
#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
#define PIN_MODE_INPUT(n) (0U << ((n)*2U))
|
||||
#define PIN_MODE_OUTPUT(n) (1U << ((n)*2U))
|
||||
#define PIN_MODE_ALTERNATE(n) (2U << ((n)*2U))
|
||||
#define PIN_MODE_ANALOG(n) (3U << ((n)*2U))
|
||||
#define PIN_ODR_LOW(n) (0U << (n))
|
||||
#define PIN_ODR_HIGH(n) (1U << (n))
|
||||
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
|
||||
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
|
||||
#define PIN_OSPEED_VERYLOW(n) (0U << ((n)*2U))
|
||||
#define PIN_OSPEED_LOW(n) (1U << ((n)*2U))
|
||||
#define PIN_OSPEED_MEDIUM(n) (2U << ((n)*2U))
|
||||
#define PIN_OSPEED_HIGH(n) (3U << ((n)*2U))
|
||||
#define PIN_PUPDR_FLOATING(n) (0U << ((n)*2U))
|
||||
#define PIN_PUPDR_PULLUP(n) (1U << ((n)*2U))
|
||||
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n)*2U))
|
||||
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
|
||||
|
||||
/*
|
||||
* GPIOA setup:
|
||||
*
|
||||
* PA0 - BUTTON (input floating).
|
||||
* PA1 - PIN1 (input pullup).
|
||||
* PA2 - PIN2 (input pullup).
|
||||
* PA3 - PIN3 (input pullup).
|
||||
* PA4 - CS43L22_LRCK (alternate 6).
|
||||
* PA5 - L3GD20_SCL (alternate 5).
|
||||
* PA6 - L3GD20_SD0 (alternate 5).
|
||||
* PA7 - L3GD20_SDI (alternate 5).
|
||||
* PA8 - PIN8 (input pullup).
|
||||
* PA9 - VBUS_FS (input floating).
|
||||
* PA10 - OTG_FS_ID (alternate 10).
|
||||
* PA11 - OTG_FS_DM (alternate 10).
|
||||
* PA12 - OTG_FS_DP (alternate 10).
|
||||
* PA13 - SWDIO (alternate 0).
|
||||
* PA14 - SWCLK (alternate 0).
|
||||
* PA15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_BUTTON) | PIN_MODE_INPUT(GPIOA_PIN1) | PIN_MODE_INPUT(GPIOA_PIN2) | PIN_MODE_INPUT(GPIOA_PIN3) | PIN_MODE_ALTERNATE(GPIOA_CS43L22_LRCK) | PIN_MODE_ALTERNATE(GPIOA_L3GD20_SCL) | PIN_MODE_ALTERNATE(GPIOA_L3GD20_SD0) | PIN_MODE_ALTERNATE(GPIOA_L3GD20_SDI) | PIN_MODE_INPUT(GPIOA_PIN8) | PIN_MODE_INPUT(GPIOA_VBUS_FS) | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_ID) | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | PIN_MODE_INPUT(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_BUTTON) | PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | PIN_OTYPE_PUSHPULL(GPIOA_CS43L22_LRCK) | PIN_OTYPE_PUSHPULL(GPIOA_L3GD20_SCL) | PIN_OTYPE_PUSHPULL(GPIOA_L3GD20_SD0) | PIN_OTYPE_PUSHPULL(GPIOA_L3GD20_SDI) | PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | PIN_OTYPE_PUSHPULL(GPIOA_VBUS_FS) | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_ID) | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_BUTTON) | PIN_OSPEED_HIGH(GPIOA_PIN1) | PIN_OSPEED_HIGH(GPIOA_PIN2) | PIN_OSPEED_HIGH(GPIOA_PIN3) | PIN_OSPEED_HIGH(GPIOA_CS43L22_LRCK) | PIN_OSPEED_HIGH(GPIOA_L3GD20_SCL) | PIN_OSPEED_HIGH(GPIOA_L3GD20_SD0) | PIN_OSPEED_HIGH(GPIOA_L3GD20_SDI) | PIN_OSPEED_HIGH(GPIOA_PIN8) | PIN_OSPEED_HIGH(GPIOA_VBUS_FS) | PIN_OSPEED_HIGH(GPIOA_OTG_FS_ID) | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | PIN_OSPEED_HIGH(GPIOA_SWDIO) | PIN_OSPEED_HIGH(GPIOA_SWCLK) | PIN_OSPEED_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_PUPDR (PIN_PUPDR_FLOATING(GPIOA_BUTTON) | PIN_PUPDR_PULLUP(GPIOA_PIN1) | PIN_PUPDR_PULLUP(GPIOA_PIN2) | PIN_PUPDR_PULLUP(GPIOA_PIN3) | PIN_PUPDR_FLOATING(GPIOA_CS43L22_LRCK) | PIN_PUPDR_FLOATING(GPIOA_L3GD20_SCL) | PIN_PUPDR_PULLUP(GPIOA_L3GD20_SD0) | PIN_PUPDR_PULLUP(GPIOA_L3GD20_SDI) | PIN_PUPDR_PULLUP(GPIOA_PIN8) | PIN_PUPDR_FLOATING(GPIOA_VBUS_FS) | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_ID) | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | PIN_PUPDR_FLOATING(GPIOA_SWDIO) | PIN_PUPDR_FLOATING(GPIOA_SWCLK) | PIN_PUPDR_PULLUP(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_BUTTON) | PIN_ODR_HIGH(GPIOA_PIN1) | PIN_ODR_HIGH(GPIOA_PIN2) | PIN_ODR_HIGH(GPIOA_PIN3) | PIN_ODR_HIGH(GPIOA_CS43L22_LRCK) | PIN_ODR_HIGH(GPIOA_L3GD20_SCL) | PIN_ODR_HIGH(GPIOA_L3GD20_SD0) | PIN_ODR_HIGH(GPIOA_L3GD20_SDI) | PIN_ODR_HIGH(GPIOA_PIN8) | PIN_ODR_HIGH(GPIOA_VBUS_FS) | PIN_ODR_HIGH(GPIOA_OTG_FS_ID) | PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | PIN_ODR_HIGH(GPIOA_SWDIO) | PIN_ODR_HIGH(GPIOA_SWCLK) | PIN_ODR_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_BUTTON, 0U) | PIN_AFIO_AF(GPIOA_PIN1, 0U) | PIN_AFIO_AF(GPIOA_PIN2, 0U) | PIN_AFIO_AF(GPIOA_PIN3, 0U) | PIN_AFIO_AF(GPIOA_CS43L22_LRCK, 6U) | PIN_AFIO_AF(GPIOA_L3GD20_SCL, 5U) | PIN_AFIO_AF(GPIOA_L3GD20_SD0, 5U) | PIN_AFIO_AF(GPIOA_L3GD20_SDI, 5U))
|
||||
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | PIN_AFIO_AF(GPIOA_VBUS_FS, 0U) | PIN_AFIO_AF(GPIOA_OTG_FS_ID, 10U) | PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | PIN_AFIO_AF(GPIOA_SWDIO, 0U) | PIN_AFIO_AF(GPIOA_SWCLK, 0U) | PIN_AFIO_AF(GPIOA_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOB setup:
|
||||
*
|
||||
* PB0 - PIN0 (input pullup).
|
||||
* PB1 - PIN1 (input pullup).
|
||||
* PB2 - PIN2 (input pullup).
|
||||
* PB3 - SWO (alternate 0).
|
||||
* PB4 - PIN4 (input pullup).
|
||||
* PB5 - PIN5 (input pullup).
|
||||
* PB6 - LSM303DLHC_SCL (alternate 4).
|
||||
* PB7 - PIN7 (input pullup).
|
||||
* PB8 - PIN8 (input pullup).
|
||||
* PB9 - LSM303DLHC_SDA (alternate 4).
|
||||
* PB10 - MP45DT02_CLK_IN (alternate 5).
|
||||
* PB11 - PIN11 (input pullup).
|
||||
* PB12 - PIN12 (input pullup).
|
||||
* PB13 - PIN13 (input pullup).
|
||||
* PB14 - PIN14 (input pullup).
|
||||
* PB15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | PIN_MODE_INPUT(GPIOB_PIN1) | PIN_MODE_INPUT(GPIOB_PIN2) | PIN_MODE_ALTERNATE(GPIOB_SWO) | PIN_MODE_INPUT(GPIOB_PIN4) | PIN_MODE_INPUT(GPIOB_PIN5) | PIN_MODE_ALTERNATE(GPIOB_LSM303DLHC_SCL) | PIN_MODE_INPUT(GPIOB_PIN7) | PIN_MODE_INPUT(GPIOB_PIN8) | PIN_MODE_ALTERNATE(GPIOB_LSM303DLHC_SDA) | PIN_MODE_ALTERNATE(GPIOB_MP45DT02_CLK_IN) | PIN_MODE_INPUT(GPIOB_PIN11) | PIN_MODE_INPUT(GPIOB_PIN12) | PIN_MODE_INPUT(GPIOB_PIN13) | PIN_MODE_INPUT(GPIOB_PIN14) | PIN_MODE_INPUT(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | PIN_OTYPE_PUSHPULL(GPIOB_SWO) | PIN_OTYPE_PUSHPULL(GPIOB_PIN4) | PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | PIN_OTYPE_PUSHPULL(GPIOB_LSM303DLHC_SCL) | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | PIN_OTYPE_PUSHPULL(GPIOB_LSM303DLHC_SDA) | PIN_OTYPE_PUSHPULL(GPIOB_MP45DT02_CLK_IN) | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_PIN0) | PIN_OSPEED_HIGH(GPIOB_PIN1) | PIN_OSPEED_HIGH(GPIOB_PIN2) | PIN_OSPEED_HIGH(GPIOB_SWO) | PIN_OSPEED_HIGH(GPIOB_PIN4) | PIN_OSPEED_HIGH(GPIOB_PIN5) | PIN_OSPEED_HIGH(GPIOB_LSM303DLHC_SCL) | PIN_OSPEED_HIGH(GPIOB_PIN7) | PIN_OSPEED_HIGH(GPIOB_PIN8) | PIN_OSPEED_HIGH(GPIOB_LSM303DLHC_SDA) | PIN_OSPEED_HIGH(GPIOB_MP45DT02_CLK_IN) | PIN_OSPEED_HIGH(GPIOB_PIN11) | PIN_OSPEED_HIGH(GPIOB_PIN12) | PIN_OSPEED_HIGH(GPIOB_PIN13) | PIN_OSPEED_HIGH(GPIOB_PIN14) | PIN_OSPEED_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | PIN_PUPDR_PULLUP(GPIOB_PIN1) | PIN_PUPDR_PULLUP(GPIOB_PIN2) | PIN_PUPDR_PULLUP(GPIOB_SWO) | PIN_PUPDR_PULLUP(GPIOB_PIN4) | PIN_PUPDR_PULLUP(GPIOB_PIN5) | PIN_PUPDR_FLOATING(GPIOB_LSM303DLHC_SCL) | PIN_PUPDR_PULLUP(GPIOB_PIN7) | PIN_PUPDR_PULLUP(GPIOB_PIN8) | PIN_PUPDR_FLOATING(GPIOB_LSM303DLHC_SDA) | PIN_PUPDR_FLOATING(GPIOB_MP45DT02_CLK_IN) | PIN_PUPDR_PULLUP(GPIOB_PIN11) | PIN_PUPDR_PULLUP(GPIOB_PIN12) | PIN_PUPDR_PULLUP(GPIOB_PIN13) | PIN_PUPDR_PULLUP(GPIOB_PIN14) | PIN_PUPDR_PULLUP(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | PIN_ODR_HIGH(GPIOB_PIN1) | PIN_ODR_HIGH(GPIOB_PIN2) | PIN_ODR_HIGH(GPIOB_SWO) | PIN_ODR_HIGH(GPIOB_PIN4) | PIN_ODR_HIGH(GPIOB_PIN5) | PIN_ODR_HIGH(GPIOB_LSM303DLHC_SCL) | PIN_ODR_HIGH(GPIOB_PIN7) | PIN_ODR_HIGH(GPIOB_PIN8) | PIN_ODR_HIGH(GPIOB_LSM303DLHC_SDA) | PIN_ODR_HIGH(GPIOB_MP45DT02_CLK_IN) | PIN_ODR_HIGH(GPIOB_PIN11) | PIN_ODR_HIGH(GPIOB_PIN12) | PIN_ODR_HIGH(GPIOB_PIN13) | PIN_ODR_HIGH(GPIOB_PIN14) | PIN_ODR_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | PIN_AFIO_AF(GPIOB_PIN1, 0U) | PIN_AFIO_AF(GPIOB_PIN2, 0U) | PIN_AFIO_AF(GPIOB_SWO, 0U) | PIN_AFIO_AF(GPIOB_PIN4, 0U) | PIN_AFIO_AF(GPIOB_PIN5, 0U) | PIN_AFIO_AF(GPIOB_LSM303DLHC_SCL, 4U) | PIN_AFIO_AF(GPIOB_PIN7, 0U))
|
||||
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | PIN_AFIO_AF(GPIOB_LSM303DLHC_SDA, 4U) | PIN_AFIO_AF(GPIOB_MP45DT02_CLK_IN, 5U) | PIN_AFIO_AF(GPIOB_PIN11, 0U) | PIN_AFIO_AF(GPIOB_PIN12, 0U) | PIN_AFIO_AF(GPIOB_PIN13, 0U) | PIN_AFIO_AF(GPIOB_PIN14, 0U) | PIN_AFIO_AF(GPIOB_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOC setup:
|
||||
*
|
||||
* PC0 - OTG_FS_POWER_ON (output pushpull maximum).
|
||||
* PC1 - PIN1 (input pullup).
|
||||
* PC2 - PIN2 (input pullup).
|
||||
* PC3 - CS43L22_AIN4x MP45DT02_PDM_OUT(alternate 5).
|
||||
* PC4 - PIN4 (input pullup).
|
||||
* PC5 - PIN5 (input pullup).
|
||||
* PC6 - PIN6 (input pullup).
|
||||
* PC7 - CS43L22_MCLK (alternate 6).
|
||||
* PC8 - PIN8 (input pullup).
|
||||
* PC9 - PIN9 (input pullup).
|
||||
* PC10 - CS43L22_SCLK (alternate 6).
|
||||
* PC11 - PIN11 (input pullup).
|
||||
* PC12 - CS43L22_SDIN (alternate 6).
|
||||
* PC13 - PIN13 (input pullup).
|
||||
* PC14 - OSC32_IN (input floating).
|
||||
* PC15 - OSC32_OUT (input floating).
|
||||
*/
|
||||
#define VAL_GPIOC_MODER (PIN_MODE_OUTPUT(GPIOC_OTG_FS_POWER_ON) | PIN_MODE_INPUT(GPIOC_PIN1) | PIN_MODE_INPUT(GPIOC_PIN2) | PIN_MODE_ALTERNATE(GPIOC_CS43L22_AIN4x) | PIN_MODE_INPUT(GPIOC_PIN4) | PIN_MODE_INPUT(GPIOC_PIN5) | PIN_MODE_INPUT(GPIOC_PIN6) | PIN_MODE_ALTERNATE(GPIOC_CS43L22_MCLK) | PIN_MODE_INPUT(GPIOC_PIN8) | PIN_MODE_INPUT(GPIOC_PIN9) | PIN_MODE_ALTERNATE(GPIOC_CS43L22_SCLK) | PIN_MODE_INPUT(GPIOC_PIN11) | PIN_MODE_ALTERNATE(GPIOC_CS43L22_SDIN) | PIN_MODE_INPUT(GPIOC_PIN13) | PIN_MODE_INPUT(GPIOC_OSC32_IN) | PIN_MODE_INPUT(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_OTG_FS_POWER_ON) | PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | PIN_OTYPE_PUSHPULL(GPIOC_CS43L22_AIN4x) | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | PIN_OTYPE_PUSHPULL(GPIOC_CS43L22_MCLK) | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | PIN_OTYPE_PUSHPULL(GPIOC_CS43L22_SCLK) | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | PIN_OTYPE_PUSHPULL(GPIOC_CS43L22_SDIN) | PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_OTG_FS_POWER_ON) | PIN_OSPEED_HIGH(GPIOC_PIN1) | PIN_OSPEED_HIGH(GPIOC_PIN2) | PIN_OSPEED_HIGH(GPIOC_CS43L22_AIN4x) | PIN_OSPEED_HIGH(GPIOC_PIN4) | PIN_OSPEED_HIGH(GPIOC_PIN5) | PIN_OSPEED_HIGH(GPIOC_PIN6) | PIN_OSPEED_HIGH(GPIOC_CS43L22_MCLK) | PIN_OSPEED_HIGH(GPIOC_PIN8) | PIN_OSPEED_HIGH(GPIOC_PIN9) | PIN_OSPEED_HIGH(GPIOC_CS43L22_SCLK) | PIN_OSPEED_HIGH(GPIOC_PIN11) | PIN_OSPEED_HIGH(GPIOC_CS43L22_SDIN) | PIN_OSPEED_HIGH(GPIOC_PIN13) | PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_OTG_FS_POWER_ON) | PIN_PUPDR_PULLUP(GPIOC_PIN1) | PIN_PUPDR_PULLUP(GPIOC_PIN2) | PIN_PUPDR_FLOATING(GPIOC_CS43L22_AIN4x) | PIN_PUPDR_PULLUP(GPIOC_PIN4) | PIN_PUPDR_PULLUP(GPIOC_PIN5) | PIN_PUPDR_PULLUP(GPIOC_PIN6) | PIN_PUPDR_PULLUP(GPIOC_CS43L22_MCLK) | PIN_PUPDR_PULLUP(GPIOC_PIN8) | PIN_PUPDR_PULLUP(GPIOC_PIN9) | PIN_PUPDR_PULLUP(GPIOC_CS43L22_SCLK) | PIN_PUPDR_PULLUP(GPIOC_PIN11) | PIN_PUPDR_PULLUP(GPIOC_CS43L22_SDIN) | PIN_PUPDR_PULLUP(GPIOC_PIN13) | PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_OTG_FS_POWER_ON) | PIN_ODR_HIGH(GPIOC_PIN1) | PIN_ODR_HIGH(GPIOC_PIN2) | PIN_ODR_HIGH(GPIOC_CS43L22_AIN4x) | PIN_ODR_HIGH(GPIOC_PIN4) | PIN_ODR_HIGH(GPIOC_PIN5) | PIN_ODR_HIGH(GPIOC_PIN6) | PIN_ODR_HIGH(GPIOC_CS43L22_MCLK) | PIN_ODR_HIGH(GPIOC_PIN8) | PIN_ODR_HIGH(GPIOC_PIN9) | PIN_ODR_HIGH(GPIOC_CS43L22_SCLK) | PIN_ODR_HIGH(GPIOC_PIN11) | PIN_ODR_HIGH(GPIOC_CS43L22_SDIN) | PIN_ODR_HIGH(GPIOC_PIN13) | PIN_ODR_HIGH(GPIOC_OSC32_IN) | PIN_ODR_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_OTG_FS_POWER_ON, 0U) | PIN_AFIO_AF(GPIOC_PIN1, 0U) | PIN_AFIO_AF(GPIOC_PIN2, 0U) | PIN_AFIO_AF(GPIOC_CS43L22_AIN4x, 5U) | PIN_AFIO_AF(GPIOC_PIN4, 0U) | PIN_AFIO_AF(GPIOC_PIN5, 0U) | PIN_AFIO_AF(GPIOC_PIN6, 0U) | PIN_AFIO_AF(GPIOC_CS43L22_MCLK, 6U))
|
||||
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | PIN_AFIO_AF(GPIOC_PIN9, 0U) | PIN_AFIO_AF(GPIOC_CS43L22_SCLK, 6U) | PIN_AFIO_AF(GPIOC_PIN11, 0U) | PIN_AFIO_AF(GPIOC_CS43L22_SDIN, 6U) | PIN_AFIO_AF(GPIOC_PIN13, 0U) | PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
|
||||
|
||||
/*
|
||||
* GPIOD setup:
|
||||
*
|
||||
* PD0 - PIN0 (input pullup).
|
||||
* PD1 - PIN1 (input pullup).
|
||||
* PD2 - PIN2 (input pullup).
|
||||
* PD3 - PIN3 (input pullup).
|
||||
* PD4 - CS43L22_RESET (output pushpull maximum).
|
||||
* PD5 - OverCurrent (input floating).
|
||||
* PD6 - PIN6 (input pullup).
|
||||
* PD7 - PIN7 (input pullup).
|
||||
* PD8 - PIN8 (input pullup).
|
||||
* PD9 - PIN9 (input pullup).
|
||||
* PD10 - PIN10 (input pullup).
|
||||
* PD11 - PIN11 (input pullup).
|
||||
* PD12 - LED4 (output pushpull maximum).
|
||||
* PD13 - LED3 (output pushpull maximum).
|
||||
* PD14 - LED5 (output pushpull maximum).
|
||||
* PD15 - LED6 (output pushpull maximum).
|
||||
*/
|
||||
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | PIN_MODE_INPUT(GPIOD_PIN1) | PIN_MODE_INPUT(GPIOD_PIN2) | PIN_MODE_INPUT(GPIOD_PIN3) | PIN_MODE_OUTPUT(GPIOD_CS43L22_RESET) | PIN_MODE_INPUT(GPIOD_OverCurrent) | PIN_MODE_INPUT(GPIOD_PIN6) | PIN_MODE_INPUT(GPIOD_PIN7) | PIN_MODE_INPUT(GPIOD_PIN8) | PIN_MODE_INPUT(GPIOD_PIN9) | PIN_MODE_INPUT(GPIOD_PIN10) | PIN_MODE_INPUT(GPIOD_PIN11) | PIN_MODE_OUTPUT(GPIOD_LED4) | PIN_MODE_OUTPUT(GPIOD_LED3) | PIN_MODE_OUTPUT(GPIOD_LED5) | PIN_MODE_OUTPUT(GPIOD_LED6))
|
||||
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | PIN_OTYPE_PUSHPULL(GPIOD_CS43L22_RESET) | PIN_OTYPE_PUSHPULL(GPIOD_OverCurrent) | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | PIN_OTYPE_PUSHPULL(GPIOD_LED4) | PIN_OTYPE_PUSHPULL(GPIOD_LED3) | PIN_OTYPE_PUSHPULL(GPIOD_LED5) | PIN_OTYPE_PUSHPULL(GPIOD_LED6))
|
||||
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | PIN_OSPEED_HIGH(GPIOD_PIN1) | PIN_OSPEED_HIGH(GPIOD_PIN2) | PIN_OSPEED_HIGH(GPIOD_PIN3) | PIN_OSPEED_HIGH(GPIOD_CS43L22_RESET) | PIN_OSPEED_HIGH(GPIOD_OverCurrent) | PIN_OSPEED_HIGH(GPIOD_PIN6) | PIN_OSPEED_HIGH(GPIOD_PIN7) | PIN_OSPEED_HIGH(GPIOD_PIN8) | PIN_OSPEED_HIGH(GPIOD_PIN9) | PIN_OSPEED_HIGH(GPIOD_PIN10) | PIN_OSPEED_HIGH(GPIOD_PIN11) | PIN_OSPEED_HIGH(GPIOD_LED4) | PIN_OSPEED_HIGH(GPIOD_LED3) | PIN_OSPEED_HIGH(GPIOD_LED5) | PIN_OSPEED_HIGH(GPIOD_LED6))
|
||||
#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | PIN_PUPDR_PULLUP(GPIOD_PIN1) | PIN_PUPDR_PULLUP(GPIOD_PIN2) | PIN_PUPDR_PULLUP(GPIOD_PIN3) | PIN_PUPDR_PULLUP(GPIOD_CS43L22_RESET) | PIN_PUPDR_FLOATING(GPIOD_OverCurrent) | PIN_PUPDR_PULLUP(GPIOD_PIN6) | PIN_PUPDR_PULLUP(GPIOD_PIN7) | PIN_PUPDR_PULLUP(GPIOD_PIN8) | PIN_PUPDR_PULLUP(GPIOD_PIN9) | PIN_PUPDR_PULLUP(GPIOD_PIN10) | PIN_PUPDR_PULLUP(GPIOD_PIN11) | PIN_PUPDR_FLOATING(GPIOD_LED4) | PIN_PUPDR_FLOATING(GPIOD_LED3) | PIN_PUPDR_FLOATING(GPIOD_LED5) | PIN_PUPDR_FLOATING(GPIOD_LED6))
|
||||
#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | PIN_ODR_HIGH(GPIOD_PIN1) | PIN_ODR_HIGH(GPIOD_PIN2) | PIN_ODR_HIGH(GPIOD_PIN3) | PIN_ODR_HIGH(GPIOD_CS43L22_RESET) | PIN_ODR_HIGH(GPIOD_OverCurrent) | PIN_ODR_HIGH(GPIOD_PIN6) | PIN_ODR_HIGH(GPIOD_PIN7) | PIN_ODR_HIGH(GPIOD_PIN8) | PIN_ODR_HIGH(GPIOD_PIN9) | PIN_ODR_HIGH(GPIOD_PIN10) | PIN_ODR_HIGH(GPIOD_PIN11) | PIN_ODR_LOW(GPIOD_LED4) | PIN_ODR_LOW(GPIOD_LED3) | PIN_ODR_LOW(GPIOD_LED5) | PIN_ODR_LOW(GPIOD_LED6))
|
||||
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | PIN_AFIO_AF(GPIOD_PIN1, 0U) | PIN_AFIO_AF(GPIOD_PIN2, 0U) | PIN_AFIO_AF(GPIOD_PIN3, 0U) | PIN_AFIO_AF(GPIOD_CS43L22_RESET, 0U) | PIN_AFIO_AF(GPIOD_OverCurrent, 0U) | PIN_AFIO_AF(GPIOD_PIN6, 0U) | PIN_AFIO_AF(GPIOD_PIN7, 0U))
|
||||
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | PIN_AFIO_AF(GPIOD_PIN9, 0U) | PIN_AFIO_AF(GPIOD_PIN10, 0U) | PIN_AFIO_AF(GPIOD_PIN11, 0U) | PIN_AFIO_AF(GPIOD_LED4, 0U) | PIN_AFIO_AF(GPIOD_LED3, 0U) | PIN_AFIO_AF(GPIOD_LED5, 0U) | PIN_AFIO_AF(GPIOD_LED6, 0U))
|
||||
|
||||
/*
|
||||
* GPIOE setup:
|
||||
*
|
||||
* PE0 - L3GD20_INT1 (input pullup).
|
||||
* PE1 - L3GD20_INT2 (input pullup).
|
||||
* PE2 - LSM303DLHC_DRDY (input floating).
|
||||
* PE3 - L3GD20_CS (output pushpull maximum).
|
||||
* PE4 - LSM303DLHC_INT1 (output pushpull maximum).
|
||||
* PE5 - LSM303DLHC_INT2 (output pushpull maximum).
|
||||
* PE6 - PIN6 (input pullup).
|
||||
* PE7 - PIN7 (input pullup).
|
||||
* PE8 - PIN8 (input pullup).
|
||||
* PE9 - PIN9 (input pullup).
|
||||
* PE10 - PIN10 (input pullup).
|
||||
* PE11 - PIN11 (input pullup).
|
||||
* PE12 - PIN12 (input pullup).
|
||||
* PE13 - PIN13 (input pullup).
|
||||
* PE14 - PIN14 (input pullup).
|
||||
* PE15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_L3GD20_INT1) | PIN_MODE_INPUT(GPIOE_L3GD20_INT2) | PIN_MODE_INPUT(GPIOE_LSM303DLHC_DRDY) | PIN_MODE_OUTPUT(GPIOE_L3GD20_CS) | PIN_MODE_OUTPUT(GPIOE_LSM303DLHC_INT1) | PIN_MODE_OUTPUT(GPIOE_LSM303DLHC_INT2) | PIN_MODE_INPUT(GPIOE_PIN6) | PIN_MODE_INPUT(GPIOE_PIN7) | PIN_MODE_INPUT(GPIOE_PIN8) | PIN_MODE_INPUT(GPIOE_PIN9) | PIN_MODE_INPUT(GPIOE_PIN10) | PIN_MODE_INPUT(GPIOE_PIN11) | PIN_MODE_INPUT(GPIOE_PIN12) | PIN_MODE_INPUT(GPIOE_PIN13) | PIN_MODE_INPUT(GPIOE_PIN14) | PIN_MODE_INPUT(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_L3GD20_INT1) | PIN_OTYPE_PUSHPULL(GPIOE_L3GD20_INT2) | PIN_OTYPE_PUSHPULL(GPIOE_LSM303DLHC_DRDY) | PIN_OTYPE_PUSHPULL(GPIOE_L3GD20_CS) | PIN_OTYPE_PUSHPULL(GPIOE_LSM303DLHC_INT1) | PIN_OTYPE_PUSHPULL(GPIOE_LSM303DLHC_INT2) | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_L3GD20_INT1) | PIN_OSPEED_HIGH(GPIOE_L3GD20_INT2) | PIN_OSPEED_HIGH(GPIOE_LSM303DLHC_DRDY) | PIN_OSPEED_HIGH(GPIOE_L3GD20_CS) | PIN_OSPEED_HIGH(GPIOE_LSM303DLHC_INT1) | PIN_OSPEED_HIGH(GPIOE_LSM303DLHC_INT2) | PIN_OSPEED_HIGH(GPIOE_PIN6) | PIN_OSPEED_HIGH(GPIOE_PIN7) | PIN_OSPEED_HIGH(GPIOE_PIN8) | PIN_OSPEED_HIGH(GPIOE_PIN9) | PIN_OSPEED_HIGH(GPIOE_PIN10) | PIN_OSPEED_HIGH(GPIOE_PIN11) | PIN_OSPEED_HIGH(GPIOE_PIN12) | PIN_OSPEED_HIGH(GPIOE_PIN13) | PIN_OSPEED_HIGH(GPIOE_PIN14) | PIN_OSPEED_HIGH(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_L3GD20_INT1) | PIN_PUPDR_PULLUP(GPIOE_L3GD20_INT2) | PIN_PUPDR_FLOATING(GPIOE_LSM303DLHC_DRDY) | PIN_PUPDR_PULLUP(GPIOE_L3GD20_CS) | PIN_PUPDR_PULLUP(GPIOE_LSM303DLHC_INT1) | PIN_PUPDR_PULLUP(GPIOE_LSM303DLHC_INT2) | PIN_PUPDR_PULLUP(GPIOE_PIN6) | PIN_PUPDR_PULLUP(GPIOE_PIN7) | PIN_PUPDR_PULLUP(GPIOE_PIN8) | PIN_PUPDR_PULLUP(GPIOE_PIN9) | PIN_PUPDR_PULLUP(GPIOE_PIN10) | PIN_PUPDR_PULLUP(GPIOE_PIN11) | PIN_PUPDR_PULLUP(GPIOE_PIN12) | PIN_PUPDR_PULLUP(GPIOE_PIN13) | PIN_PUPDR_PULLUP(GPIOE_PIN14) | PIN_PUPDR_PULLUP(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_L3GD20_INT1) | PIN_ODR_HIGH(GPIOE_L3GD20_INT2) | PIN_ODR_HIGH(GPIOE_LSM303DLHC_DRDY) | PIN_ODR_HIGH(GPIOE_L3GD20_CS) | PIN_ODR_HIGH(GPIOE_LSM303DLHC_INT1) | PIN_ODR_HIGH(GPIOE_LSM303DLHC_INT2) | PIN_ODR_HIGH(GPIOE_PIN6) | PIN_ODR_HIGH(GPIOE_PIN7) | PIN_ODR_HIGH(GPIOE_PIN8) | PIN_ODR_HIGH(GPIOE_PIN9) | PIN_ODR_HIGH(GPIOE_PIN10) | PIN_ODR_HIGH(GPIOE_PIN11) | PIN_ODR_HIGH(GPIOE_PIN12) | PIN_ODR_HIGH(GPIOE_PIN13) | PIN_ODR_HIGH(GPIOE_PIN14) | PIN_ODR_HIGH(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_L3GD20_INT1, 0U) | PIN_AFIO_AF(GPIOE_L3GD20_INT2, 0U) | PIN_AFIO_AF(GPIOE_LSM303DLHC_DRDY, 0U) | PIN_AFIO_AF(GPIOE_L3GD20_CS, 0U) | PIN_AFIO_AF(GPIOE_LSM303DLHC_INT1, 0U) | PIN_AFIO_AF(GPIOE_LSM303DLHC_INT2, 0U) | PIN_AFIO_AF(GPIOE_PIN6, 0U) | PIN_AFIO_AF(GPIOE_PIN7, 0U))
|
||||
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | PIN_AFIO_AF(GPIOE_PIN9, 0U) | PIN_AFIO_AF(GPIOE_PIN10, 0U) | PIN_AFIO_AF(GPIOE_PIN11, 0U) | PIN_AFIO_AF(GPIOE_PIN12, 0U) | PIN_AFIO_AF(GPIOE_PIN13, 0U) | PIN_AFIO_AF(GPIOE_PIN14, 0U) | PIN_AFIO_AF(GPIOE_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOF setup:
|
||||
*
|
||||
* PF0 - PIN0 (input pullup).
|
||||
* PF1 - PIN1 (input pullup).
|
||||
* PF2 - PIN2 (input pullup).
|
||||
* PF3 - PIN3 (input pullup).
|
||||
* PF4 - PIN4 (input pullup).
|
||||
* PF5 - PIN5 (input pullup).
|
||||
* PF6 - PIN6 (input pullup).
|
||||
* PF7 - PIN7 (input pullup).
|
||||
* PF8 - PIN8 (input pullup).
|
||||
* PF9 - PIN9 (input pullup).
|
||||
* PF10 - PIN10 (input pullup).
|
||||
* PF11 - PIN11 (input pullup).
|
||||
* PF12 - PIN12 (input pullup).
|
||||
* PF13 - PIN13 (input pullup).
|
||||
* PF14 - PIN14 (input pullup).
|
||||
* PF15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | PIN_MODE_INPUT(GPIOF_PIN1) | PIN_MODE_INPUT(GPIOF_PIN2) | PIN_MODE_INPUT(GPIOF_PIN3) | PIN_MODE_INPUT(GPIOF_PIN4) | PIN_MODE_INPUT(GPIOF_PIN5) | PIN_MODE_INPUT(GPIOF_PIN6) | PIN_MODE_INPUT(GPIOF_PIN7) | PIN_MODE_INPUT(GPIOF_PIN8) | PIN_MODE_INPUT(GPIOF_PIN9) | PIN_MODE_INPUT(GPIOF_PIN10) | PIN_MODE_INPUT(GPIOF_PIN11) | PIN_MODE_INPUT(GPIOF_PIN12) | PIN_MODE_INPUT(GPIOF_PIN13) | PIN_MODE_INPUT(GPIOF_PIN14) | PIN_MODE_INPUT(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | PIN_OSPEED_HIGH(GPIOF_PIN1) | PIN_OSPEED_HIGH(GPIOF_PIN2) | PIN_OSPEED_HIGH(GPIOF_PIN3) | PIN_OSPEED_HIGH(GPIOF_PIN4) | PIN_OSPEED_HIGH(GPIOF_PIN5) | PIN_OSPEED_HIGH(GPIOF_PIN6) | PIN_OSPEED_HIGH(GPIOF_PIN7) | PIN_OSPEED_HIGH(GPIOF_PIN8) | PIN_OSPEED_HIGH(GPIOF_PIN9) | PIN_OSPEED_HIGH(GPIOF_PIN10) | PIN_OSPEED_HIGH(GPIOF_PIN11) | PIN_OSPEED_HIGH(GPIOF_PIN12) | PIN_OSPEED_HIGH(GPIOF_PIN13) | PIN_OSPEED_HIGH(GPIOF_PIN14) | PIN_OSPEED_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | PIN_PUPDR_PULLUP(GPIOF_PIN1) | PIN_PUPDR_PULLUP(GPIOF_PIN2) | PIN_PUPDR_PULLUP(GPIOF_PIN3) | PIN_PUPDR_PULLUP(GPIOF_PIN4) | PIN_PUPDR_PULLUP(GPIOF_PIN5) | PIN_PUPDR_PULLUP(GPIOF_PIN6) | PIN_PUPDR_PULLUP(GPIOF_PIN7) | PIN_PUPDR_PULLUP(GPIOF_PIN8) | PIN_PUPDR_PULLUP(GPIOF_PIN9) | PIN_PUPDR_PULLUP(GPIOF_PIN10) | PIN_PUPDR_PULLUP(GPIOF_PIN11) | PIN_PUPDR_PULLUP(GPIOF_PIN12) | PIN_PUPDR_PULLUP(GPIOF_PIN13) | PIN_PUPDR_PULLUP(GPIOF_PIN14) | PIN_PUPDR_PULLUP(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | PIN_ODR_HIGH(GPIOF_PIN1) | PIN_ODR_HIGH(GPIOF_PIN2) | PIN_ODR_HIGH(GPIOF_PIN3) | PIN_ODR_HIGH(GPIOF_PIN4) | PIN_ODR_HIGH(GPIOF_PIN5) | PIN_ODR_HIGH(GPIOF_PIN6) | PIN_ODR_HIGH(GPIOF_PIN7) | PIN_ODR_HIGH(GPIOF_PIN8) | PIN_ODR_HIGH(GPIOF_PIN9) | PIN_ODR_HIGH(GPIOF_PIN10) | PIN_ODR_HIGH(GPIOF_PIN11) | PIN_ODR_HIGH(GPIOF_PIN12) | PIN_ODR_HIGH(GPIOF_PIN13) | PIN_ODR_HIGH(GPIOF_PIN14) | PIN_ODR_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | PIN_AFIO_AF(GPIOF_PIN1, 0U) | PIN_AFIO_AF(GPIOF_PIN2, 0U) | PIN_AFIO_AF(GPIOF_PIN3, 0U) | PIN_AFIO_AF(GPIOF_PIN4, 0U) | PIN_AFIO_AF(GPIOF_PIN5, 0U) | PIN_AFIO_AF(GPIOF_PIN6, 0U) | PIN_AFIO_AF(GPIOF_PIN7, 0U))
|
||||
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | PIN_AFIO_AF(GPIOF_PIN9, 0U) | PIN_AFIO_AF(GPIOF_PIN10, 0U) | PIN_AFIO_AF(GPIOF_PIN11, 0U) | PIN_AFIO_AF(GPIOF_PIN12, 0U) | PIN_AFIO_AF(GPIOF_PIN13, 0U) | PIN_AFIO_AF(GPIOF_PIN14, 0U) | PIN_AFIO_AF(GPIOF_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOG setup:
|
||||
*
|
||||
* PG0 - PIN0 (input pullup).
|
||||
* PG1 - PIN1 (input pullup).
|
||||
* PG2 - PIN2 (input pullup).
|
||||
* PG3 - PIN3 (input pullup).
|
||||
* PG4 - PIN4 (input pullup).
|
||||
* PG5 - PIN5 (input pullup).
|
||||
* PG6 - PIN6 (input pullup).
|
||||
* PG7 - PIN7 (input pullup).
|
||||
* PG8 - PIN8 (input pullup).
|
||||
* PG9 - PIN9 (input pullup).
|
||||
* PG10 - PIN10 (input pullup).
|
||||
* PG11 - PIN11 (input pullup).
|
||||
* PG12 - PIN12 (input pullup).
|
||||
* PG13 - PIN13 (input pullup).
|
||||
* PG14 - PIN14 (input pullup).
|
||||
* PG15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | PIN_MODE_INPUT(GPIOG_PIN1) | PIN_MODE_INPUT(GPIOG_PIN2) | PIN_MODE_INPUT(GPIOG_PIN3) | PIN_MODE_INPUT(GPIOG_PIN4) | PIN_MODE_INPUT(GPIOG_PIN5) | PIN_MODE_INPUT(GPIOG_PIN6) | PIN_MODE_INPUT(GPIOG_PIN7) | PIN_MODE_INPUT(GPIOG_PIN8) | PIN_MODE_INPUT(GPIOG_PIN9) | PIN_MODE_INPUT(GPIOG_PIN10) | PIN_MODE_INPUT(GPIOG_PIN11) | PIN_MODE_INPUT(GPIOG_PIN12) | PIN_MODE_INPUT(GPIOG_PIN13) | PIN_MODE_INPUT(GPIOG_PIN14) | PIN_MODE_INPUT(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_PIN0) | PIN_OSPEED_HIGH(GPIOG_PIN1) | PIN_OSPEED_HIGH(GPIOG_PIN2) | PIN_OSPEED_HIGH(GPIOG_PIN3) | PIN_OSPEED_HIGH(GPIOG_PIN4) | PIN_OSPEED_HIGH(GPIOG_PIN5) | PIN_OSPEED_HIGH(GPIOG_PIN6) | PIN_OSPEED_HIGH(GPIOG_PIN7) | PIN_OSPEED_HIGH(GPIOG_PIN8) | PIN_OSPEED_HIGH(GPIOG_PIN9) | PIN_OSPEED_HIGH(GPIOG_PIN10) | PIN_OSPEED_HIGH(GPIOG_PIN11) | PIN_OSPEED_HIGH(GPIOG_PIN12) | PIN_OSPEED_HIGH(GPIOG_PIN13) | PIN_OSPEED_HIGH(GPIOG_PIN14) | PIN_OSPEED_HIGH(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | PIN_PUPDR_PULLUP(GPIOG_PIN1) | PIN_PUPDR_PULLUP(GPIOG_PIN2) | PIN_PUPDR_PULLUP(GPIOG_PIN3) | PIN_PUPDR_PULLUP(GPIOG_PIN4) | PIN_PUPDR_PULLUP(GPIOG_PIN5) | PIN_PUPDR_PULLUP(GPIOG_PIN6) | PIN_PUPDR_PULLUP(GPIOG_PIN7) | PIN_PUPDR_PULLUP(GPIOG_PIN8) | PIN_PUPDR_PULLUP(GPIOG_PIN9) | PIN_PUPDR_PULLUP(GPIOG_PIN10) | PIN_PUPDR_PULLUP(GPIOG_PIN11) | PIN_PUPDR_PULLUP(GPIOG_PIN12) | PIN_PUPDR_PULLUP(GPIOG_PIN13) | PIN_PUPDR_PULLUP(GPIOG_PIN14) | PIN_PUPDR_PULLUP(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | PIN_ODR_HIGH(GPIOG_PIN1) | PIN_ODR_HIGH(GPIOG_PIN2) | PIN_ODR_HIGH(GPIOG_PIN3) | PIN_ODR_HIGH(GPIOG_PIN4) | PIN_ODR_HIGH(GPIOG_PIN5) | PIN_ODR_HIGH(GPIOG_PIN6) | PIN_ODR_HIGH(GPIOG_PIN7) | PIN_ODR_HIGH(GPIOG_PIN8) | PIN_ODR_HIGH(GPIOG_PIN9) | PIN_ODR_HIGH(GPIOG_PIN10) | PIN_ODR_HIGH(GPIOG_PIN11) | PIN_ODR_HIGH(GPIOG_PIN12) | PIN_ODR_HIGH(GPIOG_PIN13) | PIN_ODR_HIGH(GPIOG_PIN14) | PIN_ODR_HIGH(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | PIN_AFIO_AF(GPIOG_PIN1, 0U) | PIN_AFIO_AF(GPIOG_PIN2, 0U) | PIN_AFIO_AF(GPIOG_PIN3, 0U) | PIN_AFIO_AF(GPIOG_PIN4, 0U) | PIN_AFIO_AF(GPIOG_PIN5, 0U) | PIN_AFIO_AF(GPIOG_PIN6, 0U) | PIN_AFIO_AF(GPIOG_PIN7, 0U))
|
||||
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | PIN_AFIO_AF(GPIOG_PIN9, 0U) | PIN_AFIO_AF(GPIOG_PIN10, 0U) | PIN_AFIO_AF(GPIOG_PIN11, 0U) | PIN_AFIO_AF(GPIOG_PIN12, 0U) | PIN_AFIO_AF(GPIOG_PIN13, 0U) | PIN_AFIO_AF(GPIOG_PIN14, 0U) | PIN_AFIO_AF(GPIOG_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOH setup:
|
||||
*
|
||||
* PH0 - OSC_IN (input floating).
|
||||
* PH1 - OSC_OUT (input floating).
|
||||
* PH2 - PIN2 (input pullup).
|
||||
* PH3 - PIN3 (input pullup).
|
||||
* PH4 - PIN4 (input pullup).
|
||||
* PH5 - PIN5 (input pullup).
|
||||
* PH6 - PIN6 (input pullup).
|
||||
* PH7 - PIN7 (input pullup).
|
||||
* PH8 - PIN8 (input pullup).
|
||||
* PH9 - PIN9 (input pullup).
|
||||
* PH10 - PIN10 (input pullup).
|
||||
* PH11 - PIN11 (input pullup).
|
||||
* PH12 - PIN12 (input pullup).
|
||||
* PH13 - PIN13 (input pullup).
|
||||
* PH14 - PIN14 (input pullup).
|
||||
* PH15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | PIN_MODE_INPUT(GPIOH_OSC_OUT) | PIN_MODE_INPUT(GPIOH_PIN2) | PIN_MODE_INPUT(GPIOH_PIN3) | PIN_MODE_INPUT(GPIOH_PIN4) | PIN_MODE_INPUT(GPIOH_PIN5) | PIN_MODE_INPUT(GPIOH_PIN6) | PIN_MODE_INPUT(GPIOH_PIN7) | PIN_MODE_INPUT(GPIOH_PIN8) | PIN_MODE_INPUT(GPIOH_PIN9) | PIN_MODE_INPUT(GPIOH_PIN10) | PIN_MODE_INPUT(GPIOH_PIN11) | PIN_MODE_INPUT(GPIOH_PIN12) | PIN_MODE_INPUT(GPIOH_PIN13) | PIN_MODE_INPUT(GPIOH_PIN14) | PIN_MODE_INPUT(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | PIN_OSPEED_HIGH(GPIOH_PIN2) | PIN_OSPEED_HIGH(GPIOH_PIN3) | PIN_OSPEED_HIGH(GPIOH_PIN4) | PIN_OSPEED_HIGH(GPIOH_PIN5) | PIN_OSPEED_HIGH(GPIOH_PIN6) | PIN_OSPEED_HIGH(GPIOH_PIN7) | PIN_OSPEED_HIGH(GPIOH_PIN8) | PIN_OSPEED_HIGH(GPIOH_PIN9) | PIN_OSPEED_HIGH(GPIOH_PIN10) | PIN_OSPEED_HIGH(GPIOH_PIN11) | PIN_OSPEED_HIGH(GPIOH_PIN12) | PIN_OSPEED_HIGH(GPIOH_PIN13) | PIN_OSPEED_HIGH(GPIOH_PIN14) | PIN_OSPEED_HIGH(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | PIN_PUPDR_PULLUP(GPIOH_PIN2) | PIN_PUPDR_PULLUP(GPIOH_PIN3) | PIN_PUPDR_PULLUP(GPIOH_PIN4) | PIN_PUPDR_PULLUP(GPIOH_PIN5) | PIN_PUPDR_PULLUP(GPIOH_PIN6) | PIN_PUPDR_PULLUP(GPIOH_PIN7) | PIN_PUPDR_PULLUP(GPIOH_PIN8) | PIN_PUPDR_PULLUP(GPIOH_PIN9) | PIN_PUPDR_PULLUP(GPIOH_PIN10) | PIN_PUPDR_PULLUP(GPIOH_PIN11) | PIN_PUPDR_PULLUP(GPIOH_PIN12) | PIN_PUPDR_PULLUP(GPIOH_PIN13) | PIN_PUPDR_PULLUP(GPIOH_PIN14) | PIN_PUPDR_PULLUP(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | PIN_ODR_HIGH(GPIOH_OSC_OUT) | PIN_ODR_HIGH(GPIOH_PIN2) | PIN_ODR_HIGH(GPIOH_PIN3) | PIN_ODR_HIGH(GPIOH_PIN4) | PIN_ODR_HIGH(GPIOH_PIN5) | PIN_ODR_HIGH(GPIOH_PIN6) | PIN_ODR_HIGH(GPIOH_PIN7) | PIN_ODR_HIGH(GPIOH_PIN8) | PIN_ODR_HIGH(GPIOH_PIN9) | PIN_ODR_HIGH(GPIOH_PIN10) | PIN_ODR_HIGH(GPIOH_PIN11) | PIN_ODR_HIGH(GPIOH_PIN12) | PIN_ODR_HIGH(GPIOH_PIN13) | PIN_ODR_HIGH(GPIOH_PIN14) | PIN_ODR_HIGH(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | PIN_AFIO_AF(GPIOH_PIN2, 0U) | PIN_AFIO_AF(GPIOH_PIN3, 0U) | PIN_AFIO_AF(GPIOH_PIN4, 0U) | PIN_AFIO_AF(GPIOH_PIN5, 0U) | PIN_AFIO_AF(GPIOH_PIN6, 0U) | PIN_AFIO_AF(GPIOH_PIN7, 0U))
|
||||
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | PIN_AFIO_AF(GPIOH_PIN9, 0U) | PIN_AFIO_AF(GPIOH_PIN10, 0U) | PIN_AFIO_AF(GPIOH_PIN11, 0U) | PIN_AFIO_AF(GPIOH_PIN12, 0U) | PIN_AFIO_AF(GPIOH_PIN13, 0U) | PIN_AFIO_AF(GPIOH_PIN14, 0U) | PIN_AFIO_AF(GPIOH_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOI setup:
|
||||
*
|
||||
* PI0 - PIN0 (input pullup).
|
||||
* PI1 - PIN1 (input pullup).
|
||||
* PI2 - PIN2 (input pullup).
|
||||
* PI3 - PIN3 (input pullup).
|
||||
* PI4 - PIN4 (input pullup).
|
||||
* PI5 - PIN5 (input pullup).
|
||||
* PI6 - PIN6 (input pullup).
|
||||
* PI7 - PIN7 (input pullup).
|
||||
* PI8 - PIN8 (input pullup).
|
||||
* PI9 - PIN9 (input pullup).
|
||||
* PI10 - PIN10 (input pullup).
|
||||
* PI11 - PIN11 (input pullup).
|
||||
* PI12 - PIN12 (input pullup).
|
||||
* PI13 - PIN13 (input pullup).
|
||||
* PI14 - PIN14 (input pullup).
|
||||
* PI15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | PIN_MODE_INPUT(GPIOI_PIN1) | PIN_MODE_INPUT(GPIOI_PIN2) | PIN_MODE_INPUT(GPIOI_PIN3) | PIN_MODE_INPUT(GPIOI_PIN4) | PIN_MODE_INPUT(GPIOI_PIN5) | PIN_MODE_INPUT(GPIOI_PIN6) | PIN_MODE_INPUT(GPIOI_PIN7) | PIN_MODE_INPUT(GPIOI_PIN8) | PIN_MODE_INPUT(GPIOI_PIN9) | PIN_MODE_INPUT(GPIOI_PIN10) | PIN_MODE_INPUT(GPIOI_PIN11) | PIN_MODE_INPUT(GPIOI_PIN12) | PIN_MODE_INPUT(GPIOI_PIN13) | PIN_MODE_INPUT(GPIOI_PIN14) | PIN_MODE_INPUT(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_PIN0) | PIN_OSPEED_HIGH(GPIOI_PIN1) | PIN_OSPEED_HIGH(GPIOI_PIN2) | PIN_OSPEED_HIGH(GPIOI_PIN3) | PIN_OSPEED_HIGH(GPIOI_PIN4) | PIN_OSPEED_HIGH(GPIOI_PIN5) | PIN_OSPEED_HIGH(GPIOI_PIN6) | PIN_OSPEED_HIGH(GPIOI_PIN7) | PIN_OSPEED_HIGH(GPIOI_PIN8) | PIN_OSPEED_HIGH(GPIOI_PIN9) | PIN_OSPEED_HIGH(GPIOI_PIN10) | PIN_OSPEED_HIGH(GPIOI_PIN11) | PIN_OSPEED_HIGH(GPIOI_PIN12) | PIN_OSPEED_HIGH(GPIOI_PIN13) | PIN_OSPEED_HIGH(GPIOI_PIN14) | PIN_OSPEED_HIGH(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | PIN_PUPDR_PULLUP(GPIOI_PIN1) | PIN_PUPDR_PULLUP(GPIOI_PIN2) | PIN_PUPDR_PULLUP(GPIOI_PIN3) | PIN_PUPDR_PULLUP(GPIOI_PIN4) | PIN_PUPDR_PULLUP(GPIOI_PIN5) | PIN_PUPDR_PULLUP(GPIOI_PIN6) | PIN_PUPDR_PULLUP(GPIOI_PIN7) | PIN_PUPDR_PULLUP(GPIOI_PIN8) | PIN_PUPDR_PULLUP(GPIOI_PIN9) | PIN_PUPDR_PULLUP(GPIOI_PIN10) | PIN_PUPDR_PULLUP(GPIOI_PIN11) | PIN_PUPDR_PULLUP(GPIOI_PIN12) | PIN_PUPDR_PULLUP(GPIOI_PIN13) | PIN_PUPDR_PULLUP(GPIOI_PIN14) | PIN_PUPDR_PULLUP(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | PIN_ODR_HIGH(GPIOI_PIN1) | PIN_ODR_HIGH(GPIOI_PIN2) | PIN_ODR_HIGH(GPIOI_PIN3) | PIN_ODR_HIGH(GPIOI_PIN4) | PIN_ODR_HIGH(GPIOI_PIN5) | PIN_ODR_HIGH(GPIOI_PIN6) | PIN_ODR_HIGH(GPIOI_PIN7) | PIN_ODR_HIGH(GPIOI_PIN8) | PIN_ODR_HIGH(GPIOI_PIN9) | PIN_ODR_HIGH(GPIOI_PIN10) | PIN_ODR_HIGH(GPIOI_PIN11) | PIN_ODR_HIGH(GPIOI_PIN12) | PIN_ODR_HIGH(GPIOI_PIN13) | PIN_ODR_HIGH(GPIOI_PIN14) | PIN_ODR_HIGH(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | PIN_AFIO_AF(GPIOI_PIN1, 0U) | PIN_AFIO_AF(GPIOI_PIN2, 0U) | PIN_AFIO_AF(GPIOI_PIN3, 0U) | PIN_AFIO_AF(GPIOI_PIN4, 0U) | PIN_AFIO_AF(GPIOI_PIN5, 0U) | PIN_AFIO_AF(GPIOI_PIN6, 0U) | PIN_AFIO_AF(GPIOI_PIN7, 0U))
|
||||
#define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | PIN_AFIO_AF(GPIOI_PIN9, 0U) | PIN_AFIO_AF(GPIOI_PIN10, 0U) | PIN_AFIO_AF(GPIOI_PIN11, 0U) | PIN_AFIO_AF(GPIOI_PIN12, 0U) | PIN_AFIO_AF(GPIOI_PIN13, 0U) | PIN_AFIO_AF(GPIOI_PIN14, 0U) | PIN_AFIO_AF(GPIOI_PIN15, 0U))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
void boardInit(void);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
9
drivers/boards/BLACKPILL_STM32_F401/board.mk
Normal file
9
drivers/boards/BLACKPILL_STM32_F401/board.mk
Normal file
@ -0,0 +1,9 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = $(BOARD_PATH)/boards/BLACKPILL_STM32_F401/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(BOARD_PATH)/boards/BLACKPILL_STM32_F401
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(BOARDSRC)
|
||||
ALLINC += $(BOARDINC)
|
1193
drivers/boards/BLACKPILL_STM32_F401/cfg/board.chcfg
Normal file
1193
drivers/boards/BLACKPILL_STM32_F401/cfg/board.chcfg
Normal file
File diff suppressed because it is too large
Load Diff
15
drivers/boards/BLACKPILL_STM32_F401/cfg/board.fmpp
Normal file
15
drivers/boards/BLACKPILL_STM32_F401/cfg/board.fmpp
Normal file
@ -0,0 +1,15 @@
|
||||
sourceRoot: ../../../../../tools/ftl/processors/boards/stm32f4xx/templates
|
||||
outputRoot: ..
|
||||
dataRoot: .
|
||||
|
||||
freemarkerLinks: {
|
||||
lib: ../../../../../tools/ftl/libs
|
||||
}
|
||||
|
||||
data : {
|
||||
doc1:xml (
|
||||
board.chcfg
|
||||
{
|
||||
}
|
||||
)
|
||||
}
|
250
drivers/boards/BLACKPILL_STM32_F411/board.c
Normal file
250
drivers/boards/BLACKPILL_STM32_F411/board.c
Normal file
@ -0,0 +1,250 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO port setup.
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t moder;
|
||||
uint32_t otyper;
|
||||
uint32_t ospeedr;
|
||||
uint32_t pupdr;
|
||||
uint32_t odr;
|
||||
uint32_t afrl;
|
||||
uint32_t afrh;
|
||||
} gpio_setup_t;
|
||||
|
||||
/**
|
||||
* @brief Type of STM32 GPIO initialization data.
|
||||
*/
|
||||
typedef struct {
|
||||
#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
|
||||
gpio_setup_t PAData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
|
||||
gpio_setup_t PBData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
|
||||
gpio_setup_t PCData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
|
||||
gpio_setup_t PDData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
|
||||
gpio_setup_t PEData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
|
||||
gpio_setup_t PFData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
|
||||
gpio_setup_t PGData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
|
||||
gpio_setup_t PHData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
|
||||
gpio_setup_t PIData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
|
||||
gpio_setup_t PJData;
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
|
||||
gpio_setup_t PKData;
|
||||
#endif
|
||||
} gpio_config_t;
|
||||
|
||||
/**
|
||||
* @brief STM32 GPIO static initialization data.
|
||||
*/
|
||||
static const gpio_config_t gpio_default_config = {
|
||||
#if STM32_HAS_GPIOA
|
||||
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
{VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
{VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
{VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
{VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
{VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
{VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
|
||||
#endif
|
||||
};
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
|
||||
gpiop->OTYPER = config->otyper;
|
||||
gpiop->OSPEEDR = config->ospeedr;
|
||||
gpiop->PUPDR = config->pupdr;
|
||||
gpiop->ODR = config->odr;
|
||||
gpiop->AFRL = config->afrl;
|
||||
gpiop->AFRH = config->afrh;
|
||||
gpiop->MODER = config->moder;
|
||||
}
|
||||
|
||||
static void stm32_gpio_init(void) {
|
||||
/* Enabling GPIO-related clocks, the mask comes from the
|
||||
registry header file.*/
|
||||
rccResetAHB1(STM32_GPIO_EN_MASK);
|
||||
rccEnableAHB1(STM32_GPIO_EN_MASK, true);
|
||||
|
||||
/* Initializing all the defined GPIO ports.*/
|
||||
#if STM32_HAS_GPIOA
|
||||
gpio_init(GPIOA, &gpio_default_config.PAData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOB
|
||||
gpio_init(GPIOB, &gpio_default_config.PBData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOC
|
||||
gpio_init(GPIOC, &gpio_default_config.PCData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOD
|
||||
gpio_init(GPIOD, &gpio_default_config.PDData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOE
|
||||
gpio_init(GPIOE, &gpio_default_config.PEData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOF
|
||||
gpio_init(GPIOF, &gpio_default_config.PFData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOG
|
||||
gpio_init(GPIOG, &gpio_default_config.PGData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOH
|
||||
gpio_init(GPIOH, &gpio_default_config.PHData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOI
|
||||
gpio_init(GPIOI, &gpio_default_config.PIData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOJ
|
||||
gpio_init(GPIOJ, &gpio_default_config.PJData);
|
||||
#endif
|
||||
#if STM32_HAS_GPIOK
|
||||
gpio_init(GPIOK, &gpio_default_config.PKData);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
|
||||
|
||||
/**
|
||||
* @brief Early initialization code.
|
||||
* @details GPIO ports and system clocks are initialized before everything
|
||||
* else.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
enter_bootloader_mode_if_requested();
|
||||
|
||||
stm32_gpio_init();
|
||||
stm32_clock_init();
|
||||
}
|
||||
|
||||
#if HAL_USE_SDC || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief SDC card detection.
|
||||
*/
|
||||
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDC card write protection detection.
|
||||
*/
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
(void)sdcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief MMC_SPI card detection.
|
||||
*/
|
||||
bool mmc_lld_is_card_inserted(MMCDriver *mmcp) {
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief MMC_SPI card write protection detection.
|
||||
*/
|
||||
bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
|
||||
(void)mmcp;
|
||||
/* TODO: Fill the implementation.*/
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Board-specific initialization code.
|
||||
* @todo Add your board-specific code, if any.
|
||||
*/
|
||||
void boardInit(void) {}
|
583
drivers/boards/BLACKPILL_STM32_F411/board.h
Normal file
583
drivers/boards/BLACKPILL_STM32_F411/board.h
Normal file
@ -0,0 +1,583 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file has been automatically generated using ChibiStudio board
|
||||
* generator plugin. Do not edit manually.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Setup for STM32F411CEU6 black pill board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_BLACKPILL_STM32_F411
|
||||
#define BOARD_NAME "STM32F411CEU6 blackpill"
|
||||
|
||||
/*
|
||||
* Allow Board to boot USB without extra A9 hardware/software config
|
||||
*/
|
||||
#define BOARD_OTG_NOVBUSSENS 1
|
||||
|
||||
/*
|
||||
* Board oscillators-related settings.
|
||||
*/
|
||||
#if !defined(STM32_LSECLK)
|
||||
# define STM32_LSECLK 32768U
|
||||
#endif
|
||||
|
||||
#if !defined(STM32_HSECLK)
|
||||
# define STM32_HSECLK 25000000U
|
||||
#endif
|
||||
|
||||
//#define STM32_HSE_BYPASS
|
||||
|
||||
/*
|
||||
* Board voltages.
|
||||
* Required for performance limits calculation.
|
||||
*/
|
||||
#define STM32_VDD 300U
|
||||
|
||||
/*
|
||||
* MCU type as defined in the ST header.
|
||||
*/
|
||||
#define STM32F411xE
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_ARD_A0 0U
|
||||
#define GPIOA_ADC1_IN0 0U
|
||||
#define GPIOA_ARD_A1 1U
|
||||
#define GPIOA_ADC1_IN1 1U
|
||||
#define GPIOA_ARD_D1 2U
|
||||
#define GPIOA_USART2_TX 2U
|
||||
#define GPIOA_ARD_D0 3U
|
||||
#define GPIOA_USART2_RX 3U
|
||||
#define GPIOA_ARD_A2 4U
|
||||
#define GPIOA_ADC1_IN4 4U
|
||||
#define GPIOA_LED_GREEN 5U
|
||||
#define GPIOA_ARD_D13 5U
|
||||
#define GPIOA_ARD_D12 6U
|
||||
#define GPIOA_ARD_D11 7U
|
||||
#define GPIOA_ARD_D7 8U
|
||||
#define GPIOA_ARD_D8 9U
|
||||
#define GPIOA_ARD_D2 10U
|
||||
#define GPIOA_OTG_FS_DM 11U
|
||||
#define GPIOA_OTG_FS_DP 12U
|
||||
#define GPIOA_SWDIO 13U
|
||||
#define GPIOA_SWCLK 14U
|
||||
#define GPIOA_PIN15 15U
|
||||
|
||||
#define GPIOB_ARD_A3 0U
|
||||
#define GPIOB_ADC1_IN8 0U
|
||||
#define GPIOB_PIN1 1U
|
||||
#define GPIOB_PIN2 2U
|
||||
#define GPIOB_SWO 3U
|
||||
#define GPIOB_ARD_D3 3U
|
||||
#define GPIOB_ARD_D5 4U
|
||||
#define GPIOB_ARD_D4 5U
|
||||
#define GPIOB_ARD_D10 6U
|
||||
#define GPIOB_PIN7 7U
|
||||
#define GPIOB_ARD_D15 8U
|
||||
#define GPIOB_ARD_D14 9U
|
||||
#define GPIOB_ARD_D6 10U
|
||||
#define GPIOB_PIN11 11U
|
||||
#define GPIOB_PIN12 12U
|
||||
#define GPIOB_PIN13 13U
|
||||
#define GPIOB_PIN14 14U
|
||||
#define GPIOB_PIN15 15U
|
||||
|
||||
#define GPIOC_ARD_A5 0U
|
||||
#define GPIOC_ADC1_IN10 0U
|
||||
#define GPIOC_ARD_A4 1U
|
||||
#define GPIOC_ADC1_IN11 1U
|
||||
#define GPIOC_PIN2 2U
|
||||
#define GPIOC_PIN3 3U
|
||||
#define GPIOC_PIN4 4U
|
||||
#define GPIOC_PIN5 5U
|
||||
#define GPIOC_PIN6 6U
|
||||
#define GPIOC_ARD_D9 7U
|
||||
#define GPIOC_PIN8 8U
|
||||
#define GPIOC_PIN9 9U
|
||||
#define GPIOC_PIN10 10U
|
||||
#define GPIOC_PIN11 11U
|
||||
#define GPIOC_PIN12 12U
|
||||
#define GPIOC_BUTTON 13U
|
||||
#define GPIOC_OSC32_IN 14U
|
||||
#define GPIOC_OSC32_OUT 15U
|
||||
|
||||
#define GPIOD_PIN0 0U
|
||||
#define GPIOD_PIN1 1U
|
||||
#define GPIOD_PIN2 2U
|
||||
#define GPIOD_PIN3 3U
|
||||
#define GPIOD_PIN4 4U
|
||||
#define GPIOD_PIN5 5U
|
||||
#define GPIOD_PIN6 6U
|
||||
#define GPIOD_PIN7 7U
|
||||
#define GPIOD_PIN8 8U
|
||||
#define GPIOD_PIN9 9U
|
||||
#define GPIOD_PIN10 10U
|
||||
#define GPIOD_PIN11 11U
|
||||
#define GPIOD_PIN12 12U
|
||||
#define GPIOD_PIN13 13U
|
||||
#define GPIOD_PIN14 14U
|
||||
#define GPIOD_PIN15 15U
|
||||
|
||||
#define GPIOE_PIN0 0U
|
||||
#define GPIOE_PIN1 1U
|
||||
#define GPIOE_PIN2 2U
|
||||
#define GPIOE_PIN3 3U
|
||||
#define GPIOE_PIN4 4U
|
||||
#define GPIOE_PIN5 5U
|
||||
#define GPIOE_PIN6 6U
|
||||
#define GPIOE_PIN7 7U
|
||||
#define GPIOE_PIN8 8U
|
||||
#define GPIOE_PIN9 9U
|
||||
#define GPIOE_PIN10 10U
|
||||
#define GPIOE_PIN11 11U
|
||||
#define GPIOE_PIN12 12U
|
||||
#define GPIOE_PIN13 13U
|
||||
#define GPIOE_PIN14 14U
|
||||
#define GPIOE_PIN15 15U
|
||||
|
||||
#define GPIOF_PIN0 0U
|
||||
#define GPIOF_PIN1 1U
|
||||
#define GPIOF_PIN2 2U
|
||||
#define GPIOF_PIN3 3U
|
||||
#define GPIOF_PIN4 4U
|
||||
#define GPIOF_PIN5 5U
|
||||
#define GPIOF_PIN6 6U
|
||||
#define GPIOF_PIN7 7U
|
||||
#define GPIOF_PIN8 8U
|
||||
#define GPIOF_PIN9 9U
|
||||
#define GPIOF_PIN10 10U
|
||||
#define GPIOF_PIN11 11U
|
||||
#define GPIOF_PIN12 12U
|
||||
#define GPIOF_PIN13 13U
|
||||
#define GPIOF_PIN14 14U
|
||||
#define GPIOF_PIN15 15U
|
||||
|
||||
#define GPIOG_PIN0 0U
|
||||
#define GPIOG_PIN1 1U
|
||||
#define GPIOG_PIN2 2U
|
||||
#define GPIOG_PIN3 3U
|
||||
#define GPIOG_PIN4 4U
|
||||
#define GPIOG_PIN5 5U
|
||||
#define GPIOG_PIN6 6U
|
||||
#define GPIOG_PIN7 7U
|
||||
#define GPIOG_PIN8 8U
|
||||
#define GPIOG_PIN9 9U
|
||||
#define GPIOG_PIN10 10U
|
||||
#define GPIOG_PIN11 11U
|
||||
#define GPIOG_PIN12 12U
|
||||
#define GPIOG_PIN13 13U
|
||||
#define GPIOG_PIN14 14U
|
||||
#define GPIOG_PIN15 15U
|
||||
|
||||
#define GPIOH_OSC_IN 0U
|
||||
#define GPIOH_OSC_OUT 1U
|
||||
#define GPIOH_PIN2 2U
|
||||
#define GPIOH_PIN3 3U
|
||||
#define GPIOH_PIN4 4U
|
||||
#define GPIOH_PIN5 5U
|
||||
#define GPIOH_PIN6 6U
|
||||
#define GPIOH_PIN7 7U
|
||||
#define GPIOH_PIN8 8U
|
||||
#define GPIOH_PIN9 9U
|
||||
#define GPIOH_PIN10 10U
|
||||
#define GPIOH_PIN11 11U
|
||||
#define GPIOH_PIN12 12U
|
||||
#define GPIOH_PIN13 13U
|
||||
#define GPIOH_PIN14 14U
|
||||
#define GPIOH_PIN15 15U
|
||||
|
||||
#define GPIOI_PIN0 0U
|
||||
#define GPIOI_PIN1 1U
|
||||
#define GPIOI_PIN2 2U
|
||||
#define GPIOI_PIN3 3U
|
||||
#define GPIOI_PIN4 4U
|
||||
#define GPIOI_PIN5 5U
|
||||
#define GPIOI_PIN6 6U
|
||||
#define GPIOI_PIN7 7U
|
||||
#define GPIOI_PIN8 8U
|
||||
#define GPIOI_PIN9 9U
|
||||
#define GPIOI_PIN10 10U
|
||||
#define GPIOI_PIN11 11U
|
||||
#define GPIOI_PIN12 12U
|
||||
#define GPIOI_PIN13 13U
|
||||
#define GPIOI_PIN14 14U
|
||||
#define GPIOI_PIN15 15U
|
||||
|
||||
/*
|
||||
* IO lines assignments.
|
||||
*/
|
||||
#define LINE_ARD_A0 PAL_LINE(GPIOA, 0U)
|
||||
#define LINE_ADC1_IN0 PAL_LINE(GPIOA, 0U)
|
||||
#define LINE_ARD_A1 PAL_LINE(GPIOA, 1U)
|
||||
#define LINE_ADC1_IN1 PAL_LINE(GPIOA, 1U)
|
||||
#define LINE_ARD_D1 PAL_LINE(GPIOA, 2U)
|
||||
#define LINE_USART2_TX PAL_LINE(GPIOA, 2U)
|
||||
#define LINE_ARD_D0 PAL_LINE(GPIOA, 3U)
|
||||
#define LINE_USART2_RX PAL_LINE(GPIOA, 3U)
|
||||
#define LINE_ARD_A2 PAL_LINE(GPIOA, 4U)
|
||||
#define LINE_ADC1_IN4 PAL_LINE(GPIOA, 4U)
|
||||
#define LINE_LED_GREEN PAL_LINE(GPIOA, 5U)
|
||||
#define LINE_ARD_D13 PAL_LINE(GPIOA, 5U)
|
||||
#define LINE_ARD_D12 PAL_LINE(GPIOA, 6U)
|
||||
#define LINE_ARD_D11 PAL_LINE(GPIOA, 7U)
|
||||
#define LINE_ARD_D7 PAL_LINE(GPIOA, 8U)
|
||||
#define LINE_ARD_D8 PAL_LINE(GPIOA, 9U)
|
||||
#define LINE_ARD_D2 PAL_LINE(GPIOA, 10U)
|
||||
#define LINE_OTG_FS_DM PAL_LINE(GPIOA, 11U)
|
||||
#define LINE_OTG_FS_DP PAL_LINE(GPIOA, 12U)
|
||||
#define LINE_SWDIO PAL_LINE(GPIOA, 13U)
|
||||
#define LINE_SWCLK PAL_LINE(GPIOA, 14U)
|
||||
#define LINE_ARD_A3 PAL_LINE(GPIOB, 0U)
|
||||
#define LINE_ADC1_IN8 PAL_LINE(GPIOB, 0U)
|
||||
#define LINE_SWO PAL_LINE(GPIOB, 3U)
|
||||
#define LINE_ARD_D3 PAL_LINE(GPIOB, 3U)
|
||||
#define LINE_ARD_D5 PAL_LINE(GPIOB, 4U)
|
||||
#define LINE_ARD_D4 PAL_LINE(GPIOB, 5U)
|
||||
#define LINE_ARD_D10 PAL_LINE(GPIOB, 6U)
|
||||
#define LINE_ARD_D15 PAL_LINE(GPIOB, 8U)
|
||||
#define LINE_ARD_D14 PAL_LINE(GPIOB, 9U)
|
||||
#define LINE_ARD_D6 PAL_LINE(GPIOB, 10U)
|
||||
#define LINE_ARD_A5 PAL_LINE(GPIOC, 0U)
|
||||
#define LINE_ADC1_IN10 PAL_LINE(GPIOC, 0U)
|
||||
#define LINE_ARD_A4 PAL_LINE(GPIOC, 1U)
|
||||
#define LINE_ADC1_IN11 PAL_LINE(GPIOC, 1U)
|
||||
#define LINE_ARD_D9 PAL_LINE(GPIOC, 7U)
|
||||
#define LINE_BUTTON PAL_LINE(GPIOC, 13U)
|
||||
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
|
||||
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
|
||||
#define LINE_OSC_IN PAL_LINE(GPIOH, 0U)
|
||||
#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U)
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* I/O ports initial setup, this configuration is established soon after reset
|
||||
* in the initialization code.
|
||||
* Please refer to the STM32 Reference Manual for details.
|
||||
*/
|
||||
#define PIN_MODE_INPUT(n) (0U << ((n)*2U))
|
||||
#define PIN_MODE_OUTPUT(n) (1U << ((n)*2U))
|
||||
#define PIN_MODE_ALTERNATE(n) (2U << ((n)*2U))
|
||||
#define PIN_MODE_ANALOG(n) (3U << ((n)*2U))
|
||||
#define PIN_ODR_LOW(n) (0U << (n))
|
||||
#define PIN_ODR_HIGH(n) (1U << (n))
|
||||
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
|
||||
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
|
||||
#define PIN_OSPEED_VERYLOW(n) (0U << ((n)*2U))
|
||||
#define PIN_OSPEED_LOW(n) (1U << ((n)*2U))
|
||||
#define PIN_OSPEED_MEDIUM(n) (2U << ((n)*2U))
|
||||
#define PIN_OSPEED_HIGH(n) (3U << ((n)*2U))
|
||||
#define PIN_PUPDR_FLOATING(n) (0U << ((n)*2U))
|
||||
#define PIN_PUPDR_PULLUP(n) (1U << ((n)*2U))
|
||||
#define PIN_PUPDR_PULLDOWN(n) (2U << ((n)*2U))
|
||||
#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U))
|
||||
|
||||
/*
|
||||
* GPIOA setup:
|
||||
*
|
||||
* PA0 - ARD_A0 ADC1_IN0 (input pullup).
|
||||
* PA1 - ARD_A1 ADC1_IN1 (input pullup).
|
||||
* PA2 - ARD_D1 USART2_TX (alternate 7).
|
||||
* PA3 - ARD_D0 USART2_RX (alternate 7).
|
||||
* PA4 - ARD_A2 ADC1_IN4 (input pullup).
|
||||
* PA5 - LED_GREEN ARD_D13 (output pushpull high).
|
||||
* PA6 - ARD_D12 (input pullup).
|
||||
* PA7 - ARD_D11 (input pullup).
|
||||
* PA8 - ARD_D7 (input pullup).
|
||||
* PA9 - ARD_D8 (input pullup).
|
||||
* PA10 - ARD_D2 (input pullup).
|
||||
* PA11 - OTG_FS_DM (alternate 10).
|
||||
* PA12 - OTG_FS_DP (alternate 10).
|
||||
* PA13 - SWDIO (alternate 0).
|
||||
* PA14 - SWCLK (alternate 0).
|
||||
* PA15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_ARD_A0) | PIN_MODE_INPUT(GPIOA_ARD_A1) | PIN_MODE_ALTERNATE(GPIOA_ARD_D1) | PIN_MODE_ALTERNATE(GPIOA_ARD_D0) | PIN_MODE_INPUT(GPIOA_ARD_A2) | PIN_MODE_OUTPUT(GPIOA_LED_GREEN) | PIN_MODE_INPUT(GPIOA_ARD_D12) | PIN_MODE_INPUT(GPIOA_ARD_D11) | PIN_MODE_INPUT(GPIOA_ARD_D7) | PIN_MODE_INPUT(GPIOA_ARD_D8) | PIN_MODE_INPUT(GPIOA_ARD_D2) | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DM) | PIN_MODE_ALTERNATE(GPIOA_OTG_FS_DP) | PIN_MODE_ALTERNATE(GPIOA_SWDIO) | PIN_MODE_ALTERNATE(GPIOA_SWCLK) | PIN_MODE_INPUT(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_ARD_A0) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_A1) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D1) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D0) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_A2) | PIN_OTYPE_PUSHPULL(GPIOA_LED_GREEN) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D12) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D11) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D7) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D8) | PIN_OTYPE_PUSHPULL(GPIOA_ARD_D2) | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DM) | PIN_OTYPE_PUSHPULL(GPIOA_OTG_FS_DP) | PIN_OTYPE_PUSHPULL(GPIOA_SWDIO) | PIN_OTYPE_PUSHPULL(GPIOA_SWCLK) | PIN_OTYPE_PUSHPULL(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_HIGH(GPIOA_ARD_A0) | PIN_OSPEED_HIGH(GPIOA_ARD_A1) | PIN_OSPEED_MEDIUM(GPIOA_ARD_D1) | PIN_OSPEED_MEDIUM(GPIOA_ARD_D0) | PIN_OSPEED_HIGH(GPIOA_ARD_A2) | PIN_OSPEED_MEDIUM(GPIOA_LED_GREEN) | PIN_OSPEED_HIGH(GPIOA_ARD_D12) | PIN_OSPEED_HIGH(GPIOA_ARD_D11) | PIN_OSPEED_HIGH(GPIOA_ARD_D7) | PIN_OSPEED_HIGH(GPIOA_ARD_D8) | PIN_OSPEED_HIGH(GPIOA_ARD_D2) | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DM) | PIN_OSPEED_HIGH(GPIOA_OTG_FS_DP) | PIN_OSPEED_HIGH(GPIOA_SWDIO) | PIN_OSPEED_HIGH(GPIOA_SWCLK) | PIN_OSPEED_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_ARD_A0) | PIN_PUPDR_PULLUP(GPIOA_ARD_A1) | PIN_PUPDR_FLOATING(GPIOA_ARD_D1) | PIN_PUPDR_FLOATING(GPIOA_ARD_D0) | PIN_PUPDR_PULLUP(GPIOA_ARD_A2) | PIN_PUPDR_FLOATING(GPIOA_LED_GREEN) | PIN_PUPDR_PULLUP(GPIOA_ARD_D12) | PIN_PUPDR_PULLUP(GPIOA_ARD_D11) | PIN_PUPDR_PULLUP(GPIOA_ARD_D7) | PIN_PUPDR_PULLUP(GPIOA_ARD_D8) | PIN_PUPDR_PULLUP(GPIOA_ARD_D2) | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DM) | PIN_PUPDR_FLOATING(GPIOA_OTG_FS_DP) | PIN_PUPDR_PULLUP(GPIOA_SWDIO) | PIN_PUPDR_PULLDOWN(GPIOA_SWCLK) | PIN_PUPDR_PULLUP(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_ARD_A0) | PIN_ODR_HIGH(GPIOA_ARD_A1) | PIN_ODR_HIGH(GPIOA_ARD_D1) | PIN_ODR_HIGH(GPIOA_ARD_D0) | PIN_ODR_HIGH(GPIOA_ARD_A2) | PIN_ODR_LOW(GPIOA_LED_GREEN) | PIN_ODR_HIGH(GPIOA_ARD_D12) | PIN_ODR_HIGH(GPIOA_ARD_D11) | PIN_ODR_HIGH(GPIOA_ARD_D7) | PIN_ODR_HIGH(GPIOA_ARD_D8) | PIN_ODR_HIGH(GPIOA_ARD_D2) | PIN_ODR_HIGH(GPIOA_OTG_FS_DM) | PIN_ODR_HIGH(GPIOA_OTG_FS_DP) | PIN_ODR_HIGH(GPIOA_SWDIO) | PIN_ODR_HIGH(GPIOA_SWCLK) | PIN_ODR_HIGH(GPIOA_PIN15))
|
||||
#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_ARD_A0, 0U) | PIN_AFIO_AF(GPIOA_ARD_A1, 0U) | PIN_AFIO_AF(GPIOA_ARD_D1, 7U) | PIN_AFIO_AF(GPIOA_ARD_D0, 7U) | PIN_AFIO_AF(GPIOA_ARD_A2, 0U) | PIN_AFIO_AF(GPIOA_LED_GREEN, 0U) | PIN_AFIO_AF(GPIOA_ARD_D12, 0U) | PIN_AFIO_AF(GPIOA_ARD_D11, 0U))
|
||||
#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_ARD_D7, 0U) | PIN_AFIO_AF(GPIOA_ARD_D8, 0U) | PIN_AFIO_AF(GPIOA_ARD_D2, 0U) | PIN_AFIO_AF(GPIOA_OTG_FS_DM, 10U) | PIN_AFIO_AF(GPIOA_OTG_FS_DP, 10U) | PIN_AFIO_AF(GPIOA_SWDIO, 0U) | PIN_AFIO_AF(GPIOA_SWCLK, 0U) | PIN_AFIO_AF(GPIOA_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOB setup:
|
||||
*
|
||||
* PB0 - ARD_A3 ADC1_IN8 (input pullup).
|
||||
* PB1 - PIN1 (input pullup).
|
||||
* PB2 - PIN2 (input pullup).
|
||||
* PB3 - SWO ARD_D3 (alternate 0).
|
||||
* PB4 - ARD_D5 (input pullup).
|
||||
* PB5 - ARD_D4 (input pullup).
|
||||
* PB6 - ARD_D10 (input pullup).
|
||||
* PB7 - PIN7 (input pullup).
|
||||
* PB8 - ARD_D15 (input pullup).
|
||||
* PB9 - ARD_D14 (input pullup).
|
||||
* PB10 - ARD_D6 (input pullup).
|
||||
* PB11 - PIN11 (input pullup).
|
||||
* PB12 - PIN12 (input pullup).
|
||||
* PB13 - PIN13 (input pullup).
|
||||
* PB14 - PIN14 (input pullup).
|
||||
* PB15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_ARD_A3) | PIN_MODE_INPUT(GPIOB_PIN1) | PIN_MODE_INPUT(GPIOB_PIN2) | PIN_MODE_ALTERNATE(GPIOB_SWO) | PIN_MODE_INPUT(GPIOB_ARD_D5) | PIN_MODE_INPUT(GPIOB_ARD_D4) | PIN_MODE_INPUT(GPIOB_ARD_D10) | PIN_MODE_INPUT(GPIOB_PIN7) | PIN_MODE_INPUT(GPIOB_ARD_D15) | PIN_MODE_INPUT(GPIOB_ARD_D14) | PIN_MODE_INPUT(GPIOB_ARD_D6) | PIN_MODE_INPUT(GPIOB_PIN11) | PIN_MODE_INPUT(GPIOB_PIN12) | PIN_MODE_INPUT(GPIOB_PIN13) | PIN_MODE_INPUT(GPIOB_PIN14) | PIN_MODE_INPUT(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_ARD_A3) | PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | PIN_OTYPE_PUSHPULL(GPIOB_PIN2) | PIN_OTYPE_PUSHPULL(GPIOB_SWO) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D5) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D4) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D10) | PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D15) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D14) | PIN_OTYPE_PUSHPULL(GPIOB_ARD_D6) | PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | PIN_OTYPE_PUSHPULL(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_HIGH(GPIOB_ARD_A3) | PIN_OSPEED_HIGH(GPIOB_PIN1) | PIN_OSPEED_HIGH(GPIOB_PIN2) | PIN_OSPEED_HIGH(GPIOB_SWO) | PIN_OSPEED_HIGH(GPIOB_ARD_D5) | PIN_OSPEED_HIGH(GPIOB_ARD_D4) | PIN_OSPEED_HIGH(GPIOB_ARD_D10) | PIN_OSPEED_HIGH(GPIOB_PIN7) | PIN_OSPEED_HIGH(GPIOB_ARD_D15) | PIN_OSPEED_HIGH(GPIOB_ARD_D14) | PIN_OSPEED_HIGH(GPIOB_ARD_D6) | PIN_OSPEED_HIGH(GPIOB_PIN11) | PIN_OSPEED_HIGH(GPIOB_PIN12) | PIN_OSPEED_HIGH(GPIOB_PIN13) | PIN_OSPEED_HIGH(GPIOB_PIN14) | PIN_OSPEED_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_ARD_A3) | PIN_PUPDR_PULLUP(GPIOB_PIN1) | PIN_PUPDR_PULLUP(GPIOB_PIN2) | PIN_PUPDR_PULLUP(GPIOB_SWO) | PIN_PUPDR_PULLUP(GPIOB_ARD_D5) | PIN_PUPDR_PULLUP(GPIOB_ARD_D4) | PIN_PUPDR_PULLUP(GPIOB_ARD_D10) | PIN_PUPDR_PULLUP(GPIOB_PIN7) | PIN_PUPDR_PULLUP(GPIOB_ARD_D15) | PIN_PUPDR_PULLUP(GPIOB_ARD_D14) | PIN_PUPDR_PULLUP(GPIOB_ARD_D6) | PIN_PUPDR_PULLUP(GPIOB_PIN11) | PIN_PUPDR_PULLUP(GPIOB_PIN12) | PIN_PUPDR_PULLUP(GPIOB_PIN13) | PIN_PUPDR_PULLUP(GPIOB_PIN14) | PIN_PUPDR_PULLUP(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_ARD_A3) | PIN_ODR_HIGH(GPIOB_PIN1) | PIN_ODR_HIGH(GPIOB_PIN2) | PIN_ODR_HIGH(GPIOB_SWO) | PIN_ODR_HIGH(GPIOB_ARD_D5) | PIN_ODR_HIGH(GPIOB_ARD_D4) | PIN_ODR_HIGH(GPIOB_ARD_D10) | PIN_ODR_HIGH(GPIOB_PIN7) | PIN_ODR_HIGH(GPIOB_ARD_D15) | PIN_ODR_HIGH(GPIOB_ARD_D14) | PIN_ODR_HIGH(GPIOB_ARD_D6) | PIN_ODR_HIGH(GPIOB_PIN11) | PIN_ODR_HIGH(GPIOB_PIN12) | PIN_ODR_HIGH(GPIOB_PIN13) | PIN_ODR_HIGH(GPIOB_PIN14) | PIN_ODR_HIGH(GPIOB_PIN15))
|
||||
#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_ARD_A3, 0U) | PIN_AFIO_AF(GPIOB_PIN1, 0U) | PIN_AFIO_AF(GPIOB_PIN2, 0U) | PIN_AFIO_AF(GPIOB_SWO, 0U) | PIN_AFIO_AF(GPIOB_ARD_D5, 0U) | PIN_AFIO_AF(GPIOB_ARD_D4, 0U) | PIN_AFIO_AF(GPIOB_ARD_D10, 0U) | PIN_AFIO_AF(GPIOB_PIN7, 0U))
|
||||
#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_ARD_D15, 0U) | PIN_AFIO_AF(GPIOB_ARD_D14, 0U) | PIN_AFIO_AF(GPIOB_ARD_D6, 0U) | PIN_AFIO_AF(GPIOB_PIN11, 0U) | PIN_AFIO_AF(GPIOB_PIN12, 0U) | PIN_AFIO_AF(GPIOB_PIN13, 0U) | PIN_AFIO_AF(GPIOB_PIN14, 0U) | PIN_AFIO_AF(GPIOB_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOC setup:
|
||||
*
|
||||
* PC0 - ARD_A5 ADC1_IN10 (input pullup).
|
||||
* PC1 - ARD_A4 ADC1_IN11 (input pullup).
|
||||
* PC2 - PIN2 (input pullup).
|
||||
* PC3 - PIN3 (input pullup).
|
||||
* PC4 - PIN4 (input pullup).
|
||||
* PC5 - PIN5 (input pullup).
|
||||
* PC6 - PIN6 (input pullup).
|
||||
* PC7 - ARD_D9 (input pullup).
|
||||
* PC8 - PIN8 (input pullup).
|
||||
* PC9 - PIN9 (input pullup).
|
||||
* PC10 - PIN10 (input pullup).
|
||||
* PC11 - PIN11 (input pullup).
|
||||
* PC12 - PIN12 (input pullup).
|
||||
* PC13 - BUTTON (input floating).
|
||||
* PC14 - OSC32_IN (input floating).
|
||||
* PC15 - OSC32_OUT (input floating).
|
||||
*/
|
||||
#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_ARD_A5) | PIN_MODE_INPUT(GPIOC_ARD_A4) | PIN_MODE_INPUT(GPIOC_PIN2) | PIN_MODE_INPUT(GPIOC_PIN3) | PIN_MODE_INPUT(GPIOC_PIN4) | PIN_MODE_INPUT(GPIOC_PIN5) | PIN_MODE_INPUT(GPIOC_PIN6) | PIN_MODE_INPUT(GPIOC_ARD_D9) | PIN_MODE_INPUT(GPIOC_PIN8) | PIN_MODE_INPUT(GPIOC_PIN9) | PIN_MODE_INPUT(GPIOC_PIN10) | PIN_MODE_INPUT(GPIOC_PIN11) | PIN_MODE_INPUT(GPIOC_PIN12) | PIN_MODE_INPUT(GPIOC_BUTTON) | PIN_MODE_INPUT(GPIOC_OSC32_IN) | PIN_MODE_INPUT(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_ARD_A5) | PIN_OTYPE_PUSHPULL(GPIOC_ARD_A4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | PIN_OTYPE_PUSHPULL(GPIOC_ARD_D9) | PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | PIN_OTYPE_PUSHPULL(GPIOC_BUTTON) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_HIGH(GPIOC_ARD_A5) | PIN_OSPEED_HIGH(GPIOC_ARD_A4) | PIN_OSPEED_HIGH(GPIOC_PIN2) | PIN_OSPEED_HIGH(GPIOC_PIN3) | PIN_OSPEED_HIGH(GPIOC_PIN4) | PIN_OSPEED_HIGH(GPIOC_PIN5) | PIN_OSPEED_HIGH(GPIOC_PIN6) | PIN_OSPEED_HIGH(GPIOC_ARD_D9) | PIN_OSPEED_HIGH(GPIOC_PIN8) | PIN_OSPEED_HIGH(GPIOC_PIN9) | PIN_OSPEED_HIGH(GPIOC_PIN10) | PIN_OSPEED_HIGH(GPIOC_PIN11) | PIN_OSPEED_HIGH(GPIOC_PIN12) | PIN_OSPEED_HIGH(GPIOC_BUTTON) | PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | PIN_OSPEED_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_ARD_A5) | PIN_PUPDR_PULLUP(GPIOC_ARD_A4) | PIN_PUPDR_PULLUP(GPIOC_PIN2) | PIN_PUPDR_PULLUP(GPIOC_PIN3) | PIN_PUPDR_PULLUP(GPIOC_PIN4) | PIN_PUPDR_PULLUP(GPIOC_PIN5) | PIN_PUPDR_PULLUP(GPIOC_PIN6) | PIN_PUPDR_PULLUP(GPIOC_ARD_D9) | PIN_PUPDR_PULLUP(GPIOC_PIN8) | PIN_PUPDR_PULLUP(GPIOC_PIN9) | PIN_PUPDR_PULLUP(GPIOC_PIN10) | PIN_PUPDR_PULLUP(GPIOC_PIN11) | PIN_PUPDR_PULLUP(GPIOC_PIN12) | PIN_PUPDR_FLOATING(GPIOC_BUTTON) | PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_ARD_A5) | PIN_ODR_HIGH(GPIOC_ARD_A4) | PIN_ODR_HIGH(GPIOC_PIN2) | PIN_ODR_HIGH(GPIOC_PIN3) | PIN_ODR_HIGH(GPIOC_PIN4) | PIN_ODR_HIGH(GPIOC_PIN5) | PIN_ODR_HIGH(GPIOC_PIN6) | PIN_ODR_HIGH(GPIOC_ARD_D9) | PIN_ODR_HIGH(GPIOC_PIN8) | PIN_ODR_HIGH(GPIOC_PIN9) | PIN_ODR_HIGH(GPIOC_PIN10) | PIN_ODR_HIGH(GPIOC_PIN11) | PIN_ODR_HIGH(GPIOC_PIN12) | PIN_ODR_HIGH(GPIOC_BUTTON) | PIN_ODR_HIGH(GPIOC_OSC32_IN) | PIN_ODR_HIGH(GPIOC_OSC32_OUT))
|
||||
#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_ARD_A5, 0U) | PIN_AFIO_AF(GPIOC_ARD_A4, 0U) | PIN_AFIO_AF(GPIOC_PIN2, 0U) | PIN_AFIO_AF(GPIOC_PIN3, 0U) | PIN_AFIO_AF(GPIOC_PIN4, 0U) | PIN_AFIO_AF(GPIOC_PIN5, 0U) | PIN_AFIO_AF(GPIOC_PIN6, 0U) | PIN_AFIO_AF(GPIOC_ARD_D9, 0U))
|
||||
#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | PIN_AFIO_AF(GPIOC_PIN9, 0U) | PIN_AFIO_AF(GPIOC_PIN10, 0U) | PIN_AFIO_AF(GPIOC_PIN11, 0U) | PIN_AFIO_AF(GPIOC_PIN12, 0U) | PIN_AFIO_AF(GPIOC_BUTTON, 0U) | PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U))
|
||||
|
||||
/*
|
||||
* GPIOD setup:
|
||||
*
|
||||
* PD0 - PIN0 (input pullup).
|
||||
* PD1 - PIN1 (input pullup).
|
||||
* PD2 - PIN2 (input pullup).
|
||||
* PD3 - PIN3 (input pullup).
|
||||
* PD4 - PIN4 (input pullup).
|
||||
* PD5 - PIN5 (input pullup).
|
||||
* PD6 - PIN6 (input pullup).
|
||||
* PD7 - PIN7 (input pullup).
|
||||
* PD8 - PIN8 (input pullup).
|
||||
* PD9 - PIN9 (input pullup).
|
||||
* PD10 - PIN10 (input pullup).
|
||||
* PD11 - PIN11 (input pullup).
|
||||
* PD12 - PIN12 (input pullup).
|
||||
* PD13 - PIN13 (input pullup).
|
||||
* PD14 - PIN14 (input pullup).
|
||||
* PD15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | PIN_MODE_INPUT(GPIOD_PIN1) | PIN_MODE_INPUT(GPIOD_PIN2) | PIN_MODE_INPUT(GPIOD_PIN3) | PIN_MODE_INPUT(GPIOD_PIN4) | PIN_MODE_INPUT(GPIOD_PIN5) | PIN_MODE_INPUT(GPIOD_PIN6) | PIN_MODE_INPUT(GPIOD_PIN7) | PIN_MODE_INPUT(GPIOD_PIN8) | PIN_MODE_INPUT(GPIOD_PIN9) | PIN_MODE_INPUT(GPIOD_PIN10) | PIN_MODE_INPUT(GPIOD_PIN11) | PIN_MODE_INPUT(GPIOD_PIN12) | PIN_MODE_INPUT(GPIOD_PIN13) | PIN_MODE_INPUT(GPIOD_PIN14) | PIN_MODE_INPUT(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | PIN_OTYPE_PUSHPULL(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_HIGH(GPIOD_PIN0) | PIN_OSPEED_HIGH(GPIOD_PIN1) | PIN_OSPEED_HIGH(GPIOD_PIN2) | PIN_OSPEED_HIGH(GPIOD_PIN3) | PIN_OSPEED_HIGH(GPIOD_PIN4) | PIN_OSPEED_HIGH(GPIOD_PIN5) | PIN_OSPEED_HIGH(GPIOD_PIN6) | PIN_OSPEED_HIGH(GPIOD_PIN7) | PIN_OSPEED_HIGH(GPIOD_PIN8) | PIN_OSPEED_HIGH(GPIOD_PIN9) | PIN_OSPEED_HIGH(GPIOD_PIN10) | PIN_OSPEED_HIGH(GPIOD_PIN11) | PIN_OSPEED_HIGH(GPIOD_PIN12) | PIN_OSPEED_HIGH(GPIOD_PIN13) | PIN_OSPEED_HIGH(GPIOD_PIN14) | PIN_OSPEED_HIGH(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | PIN_PUPDR_PULLUP(GPIOD_PIN1) | PIN_PUPDR_PULLUP(GPIOD_PIN2) | PIN_PUPDR_PULLUP(GPIOD_PIN3) | PIN_PUPDR_PULLUP(GPIOD_PIN4) | PIN_PUPDR_PULLUP(GPIOD_PIN5) | PIN_PUPDR_PULLUP(GPIOD_PIN6) | PIN_PUPDR_PULLUP(GPIOD_PIN7) | PIN_PUPDR_PULLUP(GPIOD_PIN8) | PIN_PUPDR_PULLUP(GPIOD_PIN9) | PIN_PUPDR_PULLUP(GPIOD_PIN10) | PIN_PUPDR_PULLUP(GPIOD_PIN11) | PIN_PUPDR_PULLUP(GPIOD_PIN12) | PIN_PUPDR_PULLUP(GPIOD_PIN13) | PIN_PUPDR_PULLUP(GPIOD_PIN14) | PIN_PUPDR_PULLUP(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | PIN_ODR_HIGH(GPIOD_PIN1) | PIN_ODR_HIGH(GPIOD_PIN2) | PIN_ODR_HIGH(GPIOD_PIN3) | PIN_ODR_HIGH(GPIOD_PIN4) | PIN_ODR_HIGH(GPIOD_PIN5) | PIN_ODR_HIGH(GPIOD_PIN6) | PIN_ODR_HIGH(GPIOD_PIN7) | PIN_ODR_HIGH(GPIOD_PIN8) | PIN_ODR_HIGH(GPIOD_PIN9) | PIN_ODR_HIGH(GPIOD_PIN10) | PIN_ODR_HIGH(GPIOD_PIN11) | PIN_ODR_HIGH(GPIOD_PIN12) | PIN_ODR_HIGH(GPIOD_PIN13) | PIN_ODR_HIGH(GPIOD_PIN14) | PIN_ODR_HIGH(GPIOD_PIN15))
|
||||
#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | PIN_AFIO_AF(GPIOD_PIN1, 0U) | PIN_AFIO_AF(GPIOD_PIN2, 0U) | PIN_AFIO_AF(GPIOD_PIN3, 0U) | PIN_AFIO_AF(GPIOD_PIN4, 0U) | PIN_AFIO_AF(GPIOD_PIN5, 0U) | PIN_AFIO_AF(GPIOD_PIN6, 0U) | PIN_AFIO_AF(GPIOD_PIN7, 0U))
|
||||
#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | PIN_AFIO_AF(GPIOD_PIN9, 0U) | PIN_AFIO_AF(GPIOD_PIN10, 0U) | PIN_AFIO_AF(GPIOD_PIN11, 0U) | PIN_AFIO_AF(GPIOD_PIN12, 0U) | PIN_AFIO_AF(GPIOD_PIN13, 0U) | PIN_AFIO_AF(GPIOD_PIN14, 0U) | PIN_AFIO_AF(GPIOD_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOE setup:
|
||||
*
|
||||
* PE0 - PIN0 (input pullup).
|
||||
* PE1 - PIN1 (input pullup).
|
||||
* PE2 - PIN2 (input pullup).
|
||||
* PE3 - PIN3 (input pullup).
|
||||
* PE4 - PIN4 (input pullup).
|
||||
* PE5 - PIN5 (input pullup).
|
||||
* PE6 - PIN6 (input pullup).
|
||||
* PE7 - PIN7 (input pullup).
|
||||
* PE8 - PIN8 (input pullup).
|
||||
* PE9 - PIN9 (input pullup).
|
||||
* PE10 - PIN10 (input pullup).
|
||||
* PE11 - PIN11 (input pullup).
|
||||
* PE12 - PIN12 (input pullup).
|
||||
* PE13 - PIN13 (input pullup).
|
||||
* PE14 - PIN14 (input pullup).
|
||||
* PE15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | PIN_MODE_INPUT(GPIOE_PIN1) | PIN_MODE_INPUT(GPIOE_PIN2) | PIN_MODE_INPUT(GPIOE_PIN3) | PIN_MODE_INPUT(GPIOE_PIN4) | PIN_MODE_INPUT(GPIOE_PIN5) | PIN_MODE_INPUT(GPIOE_PIN6) | PIN_MODE_INPUT(GPIOE_PIN7) | PIN_MODE_INPUT(GPIOE_PIN8) | PIN_MODE_INPUT(GPIOE_PIN9) | PIN_MODE_INPUT(GPIOE_PIN10) | PIN_MODE_INPUT(GPIOE_PIN11) | PIN_MODE_INPUT(GPIOE_PIN12) | PIN_MODE_INPUT(GPIOE_PIN13) | PIN_MODE_INPUT(GPIOE_PIN14) | PIN_MODE_INPUT(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | PIN_OTYPE_PUSHPULL(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_HIGH(GPIOE_PIN0) | PIN_OSPEED_HIGH(GPIOE_PIN1) | PIN_OSPEED_HIGH(GPIOE_PIN2) | PIN_OSPEED_HIGH(GPIOE_PIN3) | PIN_OSPEED_HIGH(GPIOE_PIN4) | PIN_OSPEED_HIGH(GPIOE_PIN5) | PIN_OSPEED_HIGH(GPIOE_PIN6) | PIN_OSPEED_HIGH(GPIOE_PIN7) | PIN_OSPEED_HIGH(GPIOE_PIN8) | PIN_OSPEED_HIGH(GPIOE_PIN9) | PIN_OSPEED_HIGH(GPIOE_PIN10) | PIN_OSPEED_HIGH(GPIOE_PIN11) | PIN_OSPEED_HIGH(GPIOE_PIN12) | PIN_OSPEED_HIGH(GPIOE_PIN13) | PIN_OSPEED_HIGH(GPIOE_PIN14) | PIN_OSPEED_HIGH(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | PIN_PUPDR_PULLUP(GPIOE_PIN1) | PIN_PUPDR_PULLUP(GPIOE_PIN2) | PIN_PUPDR_PULLUP(GPIOE_PIN3) | PIN_PUPDR_PULLUP(GPIOE_PIN4) | PIN_PUPDR_PULLUP(GPIOE_PIN5) | PIN_PUPDR_PULLUP(GPIOE_PIN6) | PIN_PUPDR_PULLUP(GPIOE_PIN7) | PIN_PUPDR_PULLUP(GPIOE_PIN8) | PIN_PUPDR_PULLUP(GPIOE_PIN9) | PIN_PUPDR_PULLUP(GPIOE_PIN10) | PIN_PUPDR_PULLUP(GPIOE_PIN11) | PIN_PUPDR_PULLUP(GPIOE_PIN12) | PIN_PUPDR_PULLUP(GPIOE_PIN13) | PIN_PUPDR_PULLUP(GPIOE_PIN14) | PIN_PUPDR_PULLUP(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | PIN_ODR_HIGH(GPIOE_PIN1) | PIN_ODR_HIGH(GPIOE_PIN2) | PIN_ODR_HIGH(GPIOE_PIN3) | PIN_ODR_HIGH(GPIOE_PIN4) | PIN_ODR_HIGH(GPIOE_PIN5) | PIN_ODR_HIGH(GPIOE_PIN6) | PIN_ODR_HIGH(GPIOE_PIN7) | PIN_ODR_HIGH(GPIOE_PIN8) | PIN_ODR_HIGH(GPIOE_PIN9) | PIN_ODR_HIGH(GPIOE_PIN10) | PIN_ODR_HIGH(GPIOE_PIN11) | PIN_ODR_HIGH(GPIOE_PIN12) | PIN_ODR_HIGH(GPIOE_PIN13) | PIN_ODR_HIGH(GPIOE_PIN14) | PIN_ODR_HIGH(GPIOE_PIN15))
|
||||
#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | PIN_AFIO_AF(GPIOE_PIN1, 0U) | PIN_AFIO_AF(GPIOE_PIN2, 0U) | PIN_AFIO_AF(GPIOE_PIN3, 0U) | PIN_AFIO_AF(GPIOE_PIN4, 0U) | PIN_AFIO_AF(GPIOE_PIN5, 0U) | PIN_AFIO_AF(GPIOE_PIN6, 0U) | PIN_AFIO_AF(GPIOE_PIN7, 0U))
|
||||
#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | PIN_AFIO_AF(GPIOE_PIN9, 0U) | PIN_AFIO_AF(GPIOE_PIN10, 0U) | PIN_AFIO_AF(GPIOE_PIN11, 0U) | PIN_AFIO_AF(GPIOE_PIN12, 0U) | PIN_AFIO_AF(GPIOE_PIN13, 0U) | PIN_AFIO_AF(GPIOE_PIN14, 0U) | PIN_AFIO_AF(GPIOE_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOF setup:
|
||||
*
|
||||
* PF0 - PIN0 (input pullup).
|
||||
* PF1 - PIN1 (input pullup).
|
||||
* PF2 - PIN2 (input pullup).
|
||||
* PF3 - PIN3 (input pullup).
|
||||
* PF4 - PIN4 (input pullup).
|
||||
* PF5 - PIN5 (input pullup).
|
||||
* PF6 - PIN6 (input pullup).
|
||||
* PF7 - PIN7 (input pullup).
|
||||
* PF8 - PIN8 (input pullup).
|
||||
* PF9 - PIN9 (input pullup).
|
||||
* PF10 - PIN10 (input pullup).
|
||||
* PF11 - PIN11 (input pullup).
|
||||
* PF12 - PIN12 (input pullup).
|
||||
* PF13 - PIN13 (input pullup).
|
||||
* PF14 - PIN14 (input pullup).
|
||||
* PF15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOF_MODER (PIN_MODE_INPUT(GPIOF_PIN0) | PIN_MODE_INPUT(GPIOF_PIN1) | PIN_MODE_INPUT(GPIOF_PIN2) | PIN_MODE_INPUT(GPIOF_PIN3) | PIN_MODE_INPUT(GPIOF_PIN4) | PIN_MODE_INPUT(GPIOF_PIN5) | PIN_MODE_INPUT(GPIOF_PIN6) | PIN_MODE_INPUT(GPIOF_PIN7) | PIN_MODE_INPUT(GPIOF_PIN8) | PIN_MODE_INPUT(GPIOF_PIN9) | PIN_MODE_INPUT(GPIOF_PIN10) | PIN_MODE_INPUT(GPIOF_PIN11) | PIN_MODE_INPUT(GPIOF_PIN12) | PIN_MODE_INPUT(GPIOF_PIN13) | PIN_MODE_INPUT(GPIOF_PIN14) | PIN_MODE_INPUT(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OTYPER (PIN_OTYPE_PUSHPULL(GPIOF_PIN0) | PIN_OTYPE_PUSHPULL(GPIOF_PIN1) | PIN_OTYPE_PUSHPULL(GPIOF_PIN2) | PIN_OTYPE_PUSHPULL(GPIOF_PIN3) | PIN_OTYPE_PUSHPULL(GPIOF_PIN4) | PIN_OTYPE_PUSHPULL(GPIOF_PIN5) | PIN_OTYPE_PUSHPULL(GPIOF_PIN6) | PIN_OTYPE_PUSHPULL(GPIOF_PIN7) | PIN_OTYPE_PUSHPULL(GPIOF_PIN8) | PIN_OTYPE_PUSHPULL(GPIOF_PIN9) | PIN_OTYPE_PUSHPULL(GPIOF_PIN10) | PIN_OTYPE_PUSHPULL(GPIOF_PIN11) | PIN_OTYPE_PUSHPULL(GPIOF_PIN12) | PIN_OTYPE_PUSHPULL(GPIOF_PIN13) | PIN_OTYPE_PUSHPULL(GPIOF_PIN14) | PIN_OTYPE_PUSHPULL(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_OSPEEDR (PIN_OSPEED_HIGH(GPIOF_PIN0) | PIN_OSPEED_HIGH(GPIOF_PIN1) | PIN_OSPEED_HIGH(GPIOF_PIN2) | PIN_OSPEED_HIGH(GPIOF_PIN3) | PIN_OSPEED_HIGH(GPIOF_PIN4) | PIN_OSPEED_HIGH(GPIOF_PIN5) | PIN_OSPEED_HIGH(GPIOF_PIN6) | PIN_OSPEED_HIGH(GPIOF_PIN7) | PIN_OSPEED_HIGH(GPIOF_PIN8) | PIN_OSPEED_HIGH(GPIOF_PIN9) | PIN_OSPEED_HIGH(GPIOF_PIN10) | PIN_OSPEED_HIGH(GPIOF_PIN11) | PIN_OSPEED_HIGH(GPIOF_PIN12) | PIN_OSPEED_HIGH(GPIOF_PIN13) | PIN_OSPEED_HIGH(GPIOF_PIN14) | PIN_OSPEED_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_PUPDR (PIN_PUPDR_PULLUP(GPIOF_PIN0) | PIN_PUPDR_PULLUP(GPIOF_PIN1) | PIN_PUPDR_PULLUP(GPIOF_PIN2) | PIN_PUPDR_PULLUP(GPIOF_PIN3) | PIN_PUPDR_PULLUP(GPIOF_PIN4) | PIN_PUPDR_PULLUP(GPIOF_PIN5) | PIN_PUPDR_PULLUP(GPIOF_PIN6) | PIN_PUPDR_PULLUP(GPIOF_PIN7) | PIN_PUPDR_PULLUP(GPIOF_PIN8) | PIN_PUPDR_PULLUP(GPIOF_PIN9) | PIN_PUPDR_PULLUP(GPIOF_PIN10) | PIN_PUPDR_PULLUP(GPIOF_PIN11) | PIN_PUPDR_PULLUP(GPIOF_PIN12) | PIN_PUPDR_PULLUP(GPIOF_PIN13) | PIN_PUPDR_PULLUP(GPIOF_PIN14) | PIN_PUPDR_PULLUP(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_ODR (PIN_ODR_HIGH(GPIOF_PIN0) | PIN_ODR_HIGH(GPIOF_PIN1) | PIN_ODR_HIGH(GPIOF_PIN2) | PIN_ODR_HIGH(GPIOF_PIN3) | PIN_ODR_HIGH(GPIOF_PIN4) | PIN_ODR_HIGH(GPIOF_PIN5) | PIN_ODR_HIGH(GPIOF_PIN6) | PIN_ODR_HIGH(GPIOF_PIN7) | PIN_ODR_HIGH(GPIOF_PIN8) | PIN_ODR_HIGH(GPIOF_PIN9) | PIN_ODR_HIGH(GPIOF_PIN10) | PIN_ODR_HIGH(GPIOF_PIN11) | PIN_ODR_HIGH(GPIOF_PIN12) | PIN_ODR_HIGH(GPIOF_PIN13) | PIN_ODR_HIGH(GPIOF_PIN14) | PIN_ODR_HIGH(GPIOF_PIN15))
|
||||
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_PIN0, 0U) | PIN_AFIO_AF(GPIOF_PIN1, 0U) | PIN_AFIO_AF(GPIOF_PIN2, 0U) | PIN_AFIO_AF(GPIOF_PIN3, 0U) | PIN_AFIO_AF(GPIOF_PIN4, 0U) | PIN_AFIO_AF(GPIOF_PIN5, 0U) | PIN_AFIO_AF(GPIOF_PIN6, 0U) | PIN_AFIO_AF(GPIOF_PIN7, 0U))
|
||||
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | PIN_AFIO_AF(GPIOF_PIN9, 0U) | PIN_AFIO_AF(GPIOF_PIN10, 0U) | PIN_AFIO_AF(GPIOF_PIN11, 0U) | PIN_AFIO_AF(GPIOF_PIN12, 0U) | PIN_AFIO_AF(GPIOF_PIN13, 0U) | PIN_AFIO_AF(GPIOF_PIN14, 0U) | PIN_AFIO_AF(GPIOF_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOG setup:
|
||||
*
|
||||
* PG0 - PIN0 (input pullup).
|
||||
* PG1 - PIN1 (input pullup).
|
||||
* PG2 - PIN2 (input pullup).
|
||||
* PG3 - PIN3 (input pullup).
|
||||
* PG4 - PIN4 (input pullup).
|
||||
* PG5 - PIN5 (input pullup).
|
||||
* PG6 - PIN6 (input pullup).
|
||||
* PG7 - PIN7 (input pullup).
|
||||
* PG8 - PIN8 (input pullup).
|
||||
* PG9 - PIN9 (input pullup).
|
||||
* PG10 - PIN10 (input pullup).
|
||||
* PG11 - PIN11 (input pullup).
|
||||
* PG12 - PIN12 (input pullup).
|
||||
* PG13 - PIN13 (input pullup).
|
||||
* PG14 - PIN14 (input pullup).
|
||||
* PG15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOG_MODER (PIN_MODE_INPUT(GPIOG_PIN0) | PIN_MODE_INPUT(GPIOG_PIN1) | PIN_MODE_INPUT(GPIOG_PIN2) | PIN_MODE_INPUT(GPIOG_PIN3) | PIN_MODE_INPUT(GPIOG_PIN4) | PIN_MODE_INPUT(GPIOG_PIN5) | PIN_MODE_INPUT(GPIOG_PIN6) | PIN_MODE_INPUT(GPIOG_PIN7) | PIN_MODE_INPUT(GPIOG_PIN8) | PIN_MODE_INPUT(GPIOG_PIN9) | PIN_MODE_INPUT(GPIOG_PIN10) | PIN_MODE_INPUT(GPIOG_PIN11) | PIN_MODE_INPUT(GPIOG_PIN12) | PIN_MODE_INPUT(GPIOG_PIN13) | PIN_MODE_INPUT(GPIOG_PIN14) | PIN_MODE_INPUT(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_OTYPER (PIN_OTYPE_PUSHPULL(GPIOG_PIN0) | PIN_OTYPE_PUSHPULL(GPIOG_PIN1) | PIN_OTYPE_PUSHPULL(GPIOG_PIN2) | PIN_OTYPE_PUSHPULL(GPIOG_PIN3) | PIN_OTYPE_PUSHPULL(GPIOG_PIN4) | PIN_OTYPE_PUSHPULL(GPIOG_PIN5) | PIN_OTYPE_PUSHPULL(GPIOG_PIN6) | PIN_OTYPE_PUSHPULL(GPIOG_PIN7) | PIN_OTYPE_PUSHPULL(GPIOG_PIN8) | PIN_OTYPE_PUSHPULL(GPIOG_PIN9) | PIN_OTYPE_PUSHPULL(GPIOG_PIN10) | PIN_OTYPE_PUSHPULL(GPIOG_PIN11) | PIN_OTYPE_PUSHPULL(GPIOG_PIN12) | PIN_OTYPE_PUSHPULL(GPIOG_PIN13) | PIN_OTYPE_PUSHPULL(GPIOG_PIN14) | PIN_OTYPE_PUSHPULL(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_OSPEEDR (PIN_OSPEED_HIGH(GPIOG_PIN0) | PIN_OSPEED_HIGH(GPIOG_PIN1) | PIN_OSPEED_HIGH(GPIOG_PIN2) | PIN_OSPEED_HIGH(GPIOG_PIN3) | PIN_OSPEED_HIGH(GPIOG_PIN4) | PIN_OSPEED_HIGH(GPIOG_PIN5) | PIN_OSPEED_HIGH(GPIOG_PIN6) | PIN_OSPEED_HIGH(GPIOG_PIN7) | PIN_OSPEED_HIGH(GPIOG_PIN8) | PIN_OSPEED_HIGH(GPIOG_PIN9) | PIN_OSPEED_HIGH(GPIOG_PIN10) | PIN_OSPEED_HIGH(GPIOG_PIN11) | PIN_OSPEED_HIGH(GPIOG_PIN12) | PIN_OSPEED_HIGH(GPIOG_PIN13) | PIN_OSPEED_HIGH(GPIOG_PIN14) | PIN_OSPEED_HIGH(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_PUPDR (PIN_PUPDR_PULLUP(GPIOG_PIN0) | PIN_PUPDR_PULLUP(GPIOG_PIN1) | PIN_PUPDR_PULLUP(GPIOG_PIN2) | PIN_PUPDR_PULLUP(GPIOG_PIN3) | PIN_PUPDR_PULLUP(GPIOG_PIN4) | PIN_PUPDR_PULLUP(GPIOG_PIN5) | PIN_PUPDR_PULLUP(GPIOG_PIN6) | PIN_PUPDR_PULLUP(GPIOG_PIN7) | PIN_PUPDR_PULLUP(GPIOG_PIN8) | PIN_PUPDR_PULLUP(GPIOG_PIN9) | PIN_PUPDR_PULLUP(GPIOG_PIN10) | PIN_PUPDR_PULLUP(GPIOG_PIN11) | PIN_PUPDR_PULLUP(GPIOG_PIN12) | PIN_PUPDR_PULLUP(GPIOG_PIN13) | PIN_PUPDR_PULLUP(GPIOG_PIN14) | PIN_PUPDR_PULLUP(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_ODR (PIN_ODR_HIGH(GPIOG_PIN0) | PIN_ODR_HIGH(GPIOG_PIN1) | PIN_ODR_HIGH(GPIOG_PIN2) | PIN_ODR_HIGH(GPIOG_PIN3) | PIN_ODR_HIGH(GPIOG_PIN4) | PIN_ODR_HIGH(GPIOG_PIN5) | PIN_ODR_HIGH(GPIOG_PIN6) | PIN_ODR_HIGH(GPIOG_PIN7) | PIN_ODR_HIGH(GPIOG_PIN8) | PIN_ODR_HIGH(GPIOG_PIN9) | PIN_ODR_HIGH(GPIOG_PIN10) | PIN_ODR_HIGH(GPIOG_PIN11) | PIN_ODR_HIGH(GPIOG_PIN12) | PIN_ODR_HIGH(GPIOG_PIN13) | PIN_ODR_HIGH(GPIOG_PIN14) | PIN_ODR_HIGH(GPIOG_PIN15))
|
||||
#define VAL_GPIOG_AFRL (PIN_AFIO_AF(GPIOG_PIN0, 0U) | PIN_AFIO_AF(GPIOG_PIN1, 0U) | PIN_AFIO_AF(GPIOG_PIN2, 0U) | PIN_AFIO_AF(GPIOG_PIN3, 0U) | PIN_AFIO_AF(GPIOG_PIN4, 0U) | PIN_AFIO_AF(GPIOG_PIN5, 0U) | PIN_AFIO_AF(GPIOG_PIN6, 0U) | PIN_AFIO_AF(GPIOG_PIN7, 0U))
|
||||
#define VAL_GPIOG_AFRH (PIN_AFIO_AF(GPIOG_PIN8, 0U) | PIN_AFIO_AF(GPIOG_PIN9, 0U) | PIN_AFIO_AF(GPIOG_PIN10, 0U) | PIN_AFIO_AF(GPIOG_PIN11, 0U) | PIN_AFIO_AF(GPIOG_PIN12, 0U) | PIN_AFIO_AF(GPIOG_PIN13, 0U) | PIN_AFIO_AF(GPIOG_PIN14, 0U) | PIN_AFIO_AF(GPIOG_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOH setup:
|
||||
*
|
||||
* PH0 - OSC_IN (input floating).
|
||||
* PH1 - OSC_OUT (input floating).
|
||||
* PH2 - PIN2 (input pullup).
|
||||
* PH3 - PIN3 (input pullup).
|
||||
* PH4 - PIN4 (input pullup).
|
||||
* PH5 - PIN5 (input pullup).
|
||||
* PH6 - PIN6 (input pullup).
|
||||
* PH7 - PIN7 (input pullup).
|
||||
* PH8 - PIN8 (input pullup).
|
||||
* PH9 - PIN9 (input pullup).
|
||||
* PH10 - PIN10 (input pullup).
|
||||
* PH11 - PIN11 (input pullup).
|
||||
* PH12 - PIN12 (input pullup).
|
||||
* PH13 - PIN13 (input pullup).
|
||||
* PH14 - PIN14 (input pullup).
|
||||
* PH15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | PIN_MODE_INPUT(GPIOH_OSC_OUT) | PIN_MODE_INPUT(GPIOH_PIN2) | PIN_MODE_INPUT(GPIOH_PIN3) | PIN_MODE_INPUT(GPIOH_PIN4) | PIN_MODE_INPUT(GPIOH_PIN5) | PIN_MODE_INPUT(GPIOH_PIN6) | PIN_MODE_INPUT(GPIOH_PIN7) | PIN_MODE_INPUT(GPIOH_PIN8) | PIN_MODE_INPUT(GPIOH_PIN9) | PIN_MODE_INPUT(GPIOH_PIN10) | PIN_MODE_INPUT(GPIOH_PIN11) | PIN_MODE_INPUT(GPIOH_PIN12) | PIN_MODE_INPUT(GPIOH_PIN13) | PIN_MODE_INPUT(GPIOH_PIN14) | PIN_MODE_INPUT(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | PIN_OTYPE_PUSHPULL(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | PIN_OSPEED_HIGH(GPIOH_PIN2) | PIN_OSPEED_HIGH(GPIOH_PIN3) | PIN_OSPEED_HIGH(GPIOH_PIN4) | PIN_OSPEED_HIGH(GPIOH_PIN5) | PIN_OSPEED_HIGH(GPIOH_PIN6) | PIN_OSPEED_HIGH(GPIOH_PIN7) | PIN_OSPEED_HIGH(GPIOH_PIN8) | PIN_OSPEED_HIGH(GPIOH_PIN9) | PIN_OSPEED_HIGH(GPIOH_PIN10) | PIN_OSPEED_HIGH(GPIOH_PIN11) | PIN_OSPEED_HIGH(GPIOH_PIN12) | PIN_OSPEED_HIGH(GPIOH_PIN13) | PIN_OSPEED_HIGH(GPIOH_PIN14) | PIN_OSPEED_HIGH(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | PIN_PUPDR_PULLUP(GPIOH_PIN2) | PIN_PUPDR_PULLUP(GPIOH_PIN3) | PIN_PUPDR_PULLUP(GPIOH_PIN4) | PIN_PUPDR_PULLUP(GPIOH_PIN5) | PIN_PUPDR_PULLUP(GPIOH_PIN6) | PIN_PUPDR_PULLUP(GPIOH_PIN7) | PIN_PUPDR_PULLUP(GPIOH_PIN8) | PIN_PUPDR_PULLUP(GPIOH_PIN9) | PIN_PUPDR_PULLUP(GPIOH_PIN10) | PIN_PUPDR_PULLUP(GPIOH_PIN11) | PIN_PUPDR_PULLUP(GPIOH_PIN12) | PIN_PUPDR_PULLUP(GPIOH_PIN13) | PIN_PUPDR_PULLUP(GPIOH_PIN14) | PIN_PUPDR_PULLUP(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | PIN_ODR_HIGH(GPIOH_OSC_OUT) | PIN_ODR_HIGH(GPIOH_PIN2) | PIN_ODR_HIGH(GPIOH_PIN3) | PIN_ODR_HIGH(GPIOH_PIN4) | PIN_ODR_HIGH(GPIOH_PIN5) | PIN_ODR_HIGH(GPIOH_PIN6) | PIN_ODR_HIGH(GPIOH_PIN7) | PIN_ODR_HIGH(GPIOH_PIN8) | PIN_ODR_HIGH(GPIOH_PIN9) | PIN_ODR_HIGH(GPIOH_PIN10) | PIN_ODR_HIGH(GPIOH_PIN11) | PIN_ODR_HIGH(GPIOH_PIN12) | PIN_ODR_HIGH(GPIOH_PIN13) | PIN_ODR_HIGH(GPIOH_PIN14) | PIN_ODR_HIGH(GPIOH_PIN15))
|
||||
#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | PIN_AFIO_AF(GPIOH_PIN2, 0U) | PIN_AFIO_AF(GPIOH_PIN3, 0U) | PIN_AFIO_AF(GPIOH_PIN4, 0U) | PIN_AFIO_AF(GPIOH_PIN5, 0U) | PIN_AFIO_AF(GPIOH_PIN6, 0U) | PIN_AFIO_AF(GPIOH_PIN7, 0U))
|
||||
#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | PIN_AFIO_AF(GPIOH_PIN9, 0U) | PIN_AFIO_AF(GPIOH_PIN10, 0U) | PIN_AFIO_AF(GPIOH_PIN11, 0U) | PIN_AFIO_AF(GPIOH_PIN12, 0U) | PIN_AFIO_AF(GPIOH_PIN13, 0U) | PIN_AFIO_AF(GPIOH_PIN14, 0U) | PIN_AFIO_AF(GPIOH_PIN15, 0U))
|
||||
|
||||
/*
|
||||
* GPIOI setup:
|
||||
*
|
||||
* PI0 - PIN0 (input pullup).
|
||||
* PI1 - PIN1 (input pullup).
|
||||
* PI2 - PIN2 (input pullup).
|
||||
* PI3 - PIN3 (input pullup).
|
||||
* PI4 - PIN4 (input pullup).
|
||||
* PI5 - PIN5 (input pullup).
|
||||
* PI6 - PIN6 (input pullup).
|
||||
* PI7 - PIN7 (input pullup).
|
||||
* PI8 - PIN8 (input pullup).
|
||||
* PI9 - PIN9 (input pullup).
|
||||
* PI10 - PIN10 (input pullup).
|
||||
* PI11 - PIN11 (input pullup).
|
||||
* PI12 - PIN12 (input pullup).
|
||||
* PI13 - PIN13 (input pullup).
|
||||
* PI14 - PIN14 (input pullup).
|
||||
* PI15 - PIN15 (input pullup).
|
||||
*/
|
||||
#define VAL_GPIOI_MODER (PIN_MODE_INPUT(GPIOI_PIN0) | PIN_MODE_INPUT(GPIOI_PIN1) | PIN_MODE_INPUT(GPIOI_PIN2) | PIN_MODE_INPUT(GPIOI_PIN3) | PIN_MODE_INPUT(GPIOI_PIN4) | PIN_MODE_INPUT(GPIOI_PIN5) | PIN_MODE_INPUT(GPIOI_PIN6) | PIN_MODE_INPUT(GPIOI_PIN7) | PIN_MODE_INPUT(GPIOI_PIN8) | PIN_MODE_INPUT(GPIOI_PIN9) | PIN_MODE_INPUT(GPIOI_PIN10) | PIN_MODE_INPUT(GPIOI_PIN11) | PIN_MODE_INPUT(GPIOI_PIN12) | PIN_MODE_INPUT(GPIOI_PIN13) | PIN_MODE_INPUT(GPIOI_PIN14) | PIN_MODE_INPUT(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_OTYPER (PIN_OTYPE_PUSHPULL(GPIOI_PIN0) | PIN_OTYPE_PUSHPULL(GPIOI_PIN1) | PIN_OTYPE_PUSHPULL(GPIOI_PIN2) | PIN_OTYPE_PUSHPULL(GPIOI_PIN3) | PIN_OTYPE_PUSHPULL(GPIOI_PIN4) | PIN_OTYPE_PUSHPULL(GPIOI_PIN5) | PIN_OTYPE_PUSHPULL(GPIOI_PIN6) | PIN_OTYPE_PUSHPULL(GPIOI_PIN7) | PIN_OTYPE_PUSHPULL(GPIOI_PIN8) | PIN_OTYPE_PUSHPULL(GPIOI_PIN9) | PIN_OTYPE_PUSHPULL(GPIOI_PIN10) | PIN_OTYPE_PUSHPULL(GPIOI_PIN11) | PIN_OTYPE_PUSHPULL(GPIOI_PIN12) | PIN_OTYPE_PUSHPULL(GPIOI_PIN13) | PIN_OTYPE_PUSHPULL(GPIOI_PIN14) | PIN_OTYPE_PUSHPULL(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_OSPEEDR (PIN_OSPEED_HIGH(GPIOI_PIN0) | PIN_OSPEED_HIGH(GPIOI_PIN1) | PIN_OSPEED_HIGH(GPIOI_PIN2) | PIN_OSPEED_HIGH(GPIOI_PIN3) | PIN_OSPEED_HIGH(GPIOI_PIN4) | PIN_OSPEED_HIGH(GPIOI_PIN5) | PIN_OSPEED_HIGH(GPIOI_PIN6) | PIN_OSPEED_HIGH(GPIOI_PIN7) | PIN_OSPEED_HIGH(GPIOI_PIN8) | PIN_OSPEED_HIGH(GPIOI_PIN9) | PIN_OSPEED_HIGH(GPIOI_PIN10) | PIN_OSPEED_HIGH(GPIOI_PIN11) | PIN_OSPEED_HIGH(GPIOI_PIN12) | PIN_OSPEED_HIGH(GPIOI_PIN13) | PIN_OSPEED_HIGH(GPIOI_PIN14) | PIN_OSPEED_HIGH(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_PUPDR (PIN_PUPDR_PULLUP(GPIOI_PIN0) | PIN_PUPDR_PULLUP(GPIOI_PIN1) | PIN_PUPDR_PULLUP(GPIOI_PIN2) | PIN_PUPDR_PULLUP(GPIOI_PIN3) | PIN_PUPDR_PULLUP(GPIOI_PIN4) | PIN_PUPDR_PULLUP(GPIOI_PIN5) | PIN_PUPDR_PULLUP(GPIOI_PIN6) | PIN_PUPDR_PULLUP(GPIOI_PIN7) | PIN_PUPDR_PULLUP(GPIOI_PIN8) | PIN_PUPDR_PULLUP(GPIOI_PIN9) | PIN_PUPDR_PULLUP(GPIOI_PIN10) | PIN_PUPDR_PULLUP(GPIOI_PIN11) | PIN_PUPDR_PULLUP(GPIOI_PIN12) | PIN_PUPDR_PULLUP(GPIOI_PIN13) | PIN_PUPDR_PULLUP(GPIOI_PIN14) | PIN_PUPDR_PULLUP(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_ODR (PIN_ODR_HIGH(GPIOI_PIN0) | PIN_ODR_HIGH(GPIOI_PIN1) | PIN_ODR_HIGH(GPIOI_PIN2) | PIN_ODR_HIGH(GPIOI_PIN3) | PIN_ODR_HIGH(GPIOI_PIN4) | PIN_ODR_HIGH(GPIOI_PIN5) | PIN_ODR_HIGH(GPIOI_PIN6) | PIN_ODR_HIGH(GPIOI_PIN7) | PIN_ODR_HIGH(GPIOI_PIN8) | PIN_ODR_HIGH(GPIOI_PIN9) | PIN_ODR_HIGH(GPIOI_PIN10) | PIN_ODR_HIGH(GPIOI_PIN11) | PIN_ODR_HIGH(GPIOI_PIN12) | PIN_ODR_HIGH(GPIOI_PIN13) | PIN_ODR_HIGH(GPIOI_PIN14) | PIN_ODR_HIGH(GPIOI_PIN15))
|
||||
#define VAL_GPIOI_AFRL (PIN_AFIO_AF(GPIOI_PIN0, 0U) | PIN_AFIO_AF(GPIOI_PIN1, 0U) | PIN_AFIO_AF(GPIOI_PIN2, 0U) | PIN_AFIO_AF(GPIOI_PIN3, 0U) | PIN_AFIO_AF(GPIOI_PIN4, 0U) | PIN_AFIO_AF(GPIOI_PIN5, 0U) | PIN_AFIO_AF(GPIOI_PIN6, 0U) | PIN_AFIO_AF(GPIOI_PIN7, 0U))
|
||||
#define VAL_GPIOI_AFRH (PIN_AFIO_AF(GPIOI_PIN8, 0U) | PIN_AFIO_AF(GPIOI_PIN9, 0U) | PIN_AFIO_AF(GPIOI_PIN10, 0U) | PIN_AFIO_AF(GPIOI_PIN11, 0U) | PIN_AFIO_AF(GPIOI_PIN12, 0U) | PIN_AFIO_AF(GPIOI_PIN13, 0U) | PIN_AFIO_AF(GPIOI_PIN14, 0U) | PIN_AFIO_AF(GPIOI_PIN15, 0U))
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
void boardInit(void);
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* BOARD_H */
|
9
drivers/boards/BLACKPILL_STM32_F411/board.mk
Normal file
9
drivers/boards/BLACKPILL_STM32_F411/board.mk
Normal file
@ -0,0 +1,9 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = $(BOARD_PATH)/boards/BLACKPILL_STM32_F411/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(BOARD_PATH)/boards/BLACKPILL_STM32_F411
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(BOARDSRC)
|
||||
ALLINC += $(BOARDINC)
|
1193
drivers/boards/BLACKPILL_STM32_F411/cfg/board.chcfg
Normal file
1193
drivers/boards/BLACKPILL_STM32_F411/cfg/board.chcfg
Normal file
File diff suppressed because it is too large
Load Diff
15
drivers/boards/BLACKPILL_STM32_F411/cfg/board.fmpp
Normal file
15
drivers/boards/BLACKPILL_STM32_F411/cfg/board.fmpp
Normal file
@ -0,0 +1,15 @@
|
||||
sourceRoot: ../../../../../tools/ftl/processors/boards/stm32f4xx/templates
|
||||
outputRoot: ..
|
||||
dataRoot: .
|
||||
|
||||
freemarkerLinks: {
|
||||
lib: ../../../../../tools/ftl/libs
|
||||
}
|
||||
|
||||
data : {
|
||||
doc1:xml (
|
||||
board.chcfg
|
||||
{
|
||||
}
|
||||
)
|
||||
}
|
@ -428,6 +428,31 @@ void oled_write_ln(const char *data, bool invert) {
|
||||
oled_advance_page(true);
|
||||
}
|
||||
|
||||
void oled_pan(bool left) {
|
||||
uint16_t i = 0;
|
||||
for (uint16_t y = 0; y < OLED_DISPLAY_HEIGHT / 8; y++) {
|
||||
if (left) {
|
||||
for (uint16_t x = 0; x < OLED_DISPLAY_WIDTH - 1; x++) {
|
||||
i = y * OLED_DISPLAY_WIDTH + x;
|
||||
oled_buffer[i] = oled_buffer[i + 1];
|
||||
}
|
||||
} else {
|
||||
for (uint16_t x = OLED_DISPLAY_WIDTH - 1; x > 0; x--) {
|
||||
i = y * OLED_DISPLAY_WIDTH + x;
|
||||
oled_buffer[i] = oled_buffer[i - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
oled_dirty = ~((OLED_BLOCK_TYPE)0);
|
||||
}
|
||||
|
||||
void oled_write_raw_byte(const char data, uint16_t index) {
|
||||
if (index > OLED_MATRIX_SIZE) index = OLED_MATRIX_SIZE;
|
||||
if (oled_buffer[index] == data) return;
|
||||
oled_buffer[index] = data;
|
||||
oled_dirty |= (1 << (index / OLED_BLOCK_SIZE));
|
||||
}
|
||||
|
||||
void oled_write_raw(const char *data, uint16_t size) {
|
||||
if (size > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE;
|
||||
for (uint16_t i = 0; i < size; i++) {
|
||||
|
@ -200,7 +200,11 @@ void oled_write(const char *data, bool invert);
|
||||
// Advances the cursor to the next page, wiring ' ' to the remainder of the current page
|
||||
void oled_write_ln(const char *data, bool invert);
|
||||
|
||||
// Pans the buffer to the right (or left by passing true) by moving contents of the buffer
|
||||
void oled_pan(bool left);
|
||||
|
||||
void oled_write_raw(const char *data, uint16_t size);
|
||||
void oled_write_raw_byte(const char data, uint16_t index);
|
||||
|
||||
#if defined(__AVR__)
|
||||
// Writes a PROGMEM string to the buffer at current cursor position
|
||||
|
@ -40,9 +40,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
|
||||
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
|
||||
*
|
||||
*/
|
||||
#define MATRIX_ROW_PINS { D1, D0, F4, F5 }
|
||||
#define MATRIX_COL_PINS { D4, C6, F6, F7 }
|
||||
*/
|
||||
#define MATRIX_ROW_PINS \
|
||||
{ D1, D0, F4, F5 }
|
||||
#define MATRIX_COL_PINS \
|
||||
{ D4, C6, F6, F7 }
|
||||
#define UNUSED_PINS
|
||||
|
||||
/* COL2ROW, ROW2COL*/
|
||||
@ -51,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
/*
|
||||
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
|
||||
*/
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
|
||||
// #define BACKLIGHT_PIN B7
|
||||
// #define BACKLIGHT_BREATHING
|
||||
@ -59,15 +61,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#define RGB_DI_PIN D3
|
||||
#ifdef RGB_DI_PIN
|
||||
#define RGBLED_NUM 16 // Add 12 if attaching the RGB LED ring
|
||||
#define RGBLIGHT_HUE_STEP 8
|
||||
#define RGBLIGHT_SAT_STEP 8
|
||||
#define RGBLIGHT_VAL_STEP 8
|
||||
#define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
#define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
/*== all animations enable ==*/
|
||||
#define RGBLIGHT_ANIMATIONS
|
||||
/*== or choose animations ==*/
|
||||
# define RGBLED_NUM 16 // Add 12 if attaching the RGB LED ring
|
||||
# define DRIVER_LED_TOTAL RGBLED_NUM
|
||||
# ifdef RGBLIGHT_ENABLE
|
||||
# define RGBLIGHT_HUE_STEP 8
|
||||
# define RGBLIGHT_SAT_STEP 8
|
||||
# define RGBLIGHT_VAL_STEP 8
|
||||
# define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
|
||||
# define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
|
||||
/*== all animations enable ==*/
|
||||
# define RGBLIGHT_ANIMATIONS
|
||||
/*== or choose animations ==*/
|
||||
// #define RGBLIGHT_EFFECT_BREATHING
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
|
||||
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
|
||||
@ -77,6 +81,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
|
||||
// #define RGBLIGHT_EFFECT_RGB_TEST
|
||||
// #define RGBLIGHT_EFFECT_ALTERNATING
|
||||
# elif defined RGB_MATRIX_ENABLE
|
||||
# define RGB_MATRIX_KEYPRESSES // reacts to keypresses
|
||||
# define RGB_MATRIX_FRAMEBUFFER_EFFECTS // reacts to keyreleases (instead of keypresses)
|
||||
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
|
110
keyboards/1upkeyboards/super16/keymaps/15game/keymap.c
Normal file
110
keyboards/1upkeyboards/super16/keymaps/15game/keymap.c
Normal file
@ -0,0 +1,110 @@
|
||||
/* Copyright 2020 Sam Reinehr
|
||||
*
|
||||
* 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 QMK_KEYBOARD_H
|
||||
enum my_keycodes {
|
||||
K00 = SAFE_RANGE,
|
||||
K01,
|
||||
K02,
|
||||
K03,
|
||||
K04,
|
||||
K05,
|
||||
K06,
|
||||
K07,
|
||||
K08,
|
||||
K09,
|
||||
K10,
|
||||
K11,
|
||||
K12,
|
||||
K13,
|
||||
K14,
|
||||
K15,
|
||||
};
|
||||
/* just a simple way to give each key a unique code */
|
||||
//clang-format off
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/* Base */
|
||||
[0] = LAYOUT_ortho_4x4(
|
||||
K00, K01, K02, K03,
|
||||
K04, K05, K06, K07,
|
||||
K08, K09, K10, K11,
|
||||
K12, K13, K14, K15
|
||||
)
|
||||
};
|
||||
/* flags describing current free square/0 */
|
||||
uint8_t current = 0;
|
||||
/* r g and b describe the colors for the initial map,
|
||||
currently blank for free, and evenly spaced hues with maximum sat/value */
|
||||
const uint8_t r[16] = {
|
||||
0x00, 0xFF, 0xFF, 0xFF,
|
||||
0xCC, 0x66, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x66, 0xCC, 0xFF, 0xFF
|
||||
};
|
||||
const uint8_t g[16] = {
|
||||
0x00, 0x00, 0x66, 0xCC,
|
||||
0xFF, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xCC, 0x66, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
const uint8_t b[16] = {
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x66,
|
||||
0xCC, 0xFF, 0xFF, 0xFF,
|
||||
0xFF, 0xFF, 0xCC, 0x66
|
||||
};
|
||||
/* pos contains the current positions, could technically be compressed to 4 bits per, but not worth it
|
||||
index into pos is the position we're looking at, output is the tile that is currently there */
|
||||
uint8_t tiles[16] = {
|
||||
0, 1, 2, 3,
|
||||
4, 5, 6, 7,
|
||||
8, 9, 10, 11,
|
||||
12, 13, 14, 15
|
||||
};
|
||||
/* default led array for super 16 has them in a snake, so we must do some remapping/flipping of the 2nd and 4th rows */
|
||||
uint8_t remap[16] = {
|
||||
0, 1, 2, 3,
|
||||
7, 6, 5, 4,
|
||||
8, 9, 10, 11,
|
||||
15, 14, 13, 12
|
||||
};
|
||||
//clang-format on
|
||||
/* function to refresh the led coloring with the positions with current tiles */
|
||||
void refresh_leds(void) {
|
||||
for (uint8_t index = 0; index < 16; ++index) {
|
||||
uint8_t tile = tiles[index];
|
||||
setrgb(r[tile], g[tile], b[tile], (LED_TYPE *)&led[remap[index]]);
|
||||
}
|
||||
rgblight_set();
|
||||
}
|
||||
void keyboard_post_init_user(void) {
|
||||
rgblight_mode(RGBLIGHT_MODE_STATIC_LIGHT);
|
||||
rgblight_enable_noeeprom();
|
||||
refresh_leds();
|
||||
}
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
uint8_t offset = keycode - K00;
|
||||
uint8_t x = offset & 0x03;
|
||||
uint8_t y = (offset & 0x0C) >> 2;
|
||||
/* if the adjacent space exists and is empty, */
|
||||
if ((x > 0 && 0 == tiles[offset - 1]) || (y > 0 && 0 == tiles[offset - 4]) || (x < 3 && 0 == tiles[offset + 1]) || (y < 3 && 0 == tiles[offset + 4])) {
|
||||
/* set the currently blank tile to this tile, and make this one blank */
|
||||
tiles[current] = tiles[offset];
|
||||
tiles[offset] = 0;
|
||||
current = offset;
|
||||
}
|
||||
refresh_leds();
|
||||
return false;
|
||||
}
|
5
keyboards/1upkeyboards/super16/keymaps/15game/readme.md
Normal file
5
keyboards/1upkeyboards/super16/keymaps/15game/readme.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Trying to put a game that plays like the 15 puzzle on the super16
|
||||
The 15/16 puzzle consists of a grid where one space is free, and adjacent spaces can be swapped with the free space
|
||||
* future planned features:
|
||||
* fix the start at red
|
||||
* have a cute animation play when the puzzle is solved
|
2
keyboards/1upkeyboards/super16/keymaps/15game/rules.mk
Normal file
2
keyboards/1upkeyboards/super16/keymaps/15game/rules.mk
Normal file
@ -0,0 +1,2 @@
|
||||
RGBLIGHT_ENABLE = yes
|
||||
RGB_MATRIX_ENABLE = no
|
@ -24,7 +24,8 @@ SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
NKRO_ENABLE = no # USB Nkey Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
|
||||
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
RGB_MATRIX_ENABLE = WS2812
|
||||
MIDI_ENABLE = no # MIDI support
|
||||
UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
|
@ -15,29 +15,25 @@
|
||||
*/
|
||||
#include "super16.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
#ifdef RGB_MATRIX_ENABLE
|
||||
led_config_t g_led_config = { {
|
||||
// Key Matrix to LED Index
|
||||
{ 0, 1, 2, 3 },
|
||||
{ 7, 6, 5, 4 },
|
||||
{ 8, 9, 10, 11 },
|
||||
{ 15, 14, 13, 12 }
|
||||
}, {
|
||||
// LED Index to Physical Position
|
||||
{ 0, 0 }, { 75, 0 }, { 150, 0 }, { 224, 0 },
|
||||
{ 224, 21 }, { 150, 21 }, { 75, 21 }, { 0, 21 },
|
||||
{ 0, 43 }, { 75, 43 }, { 150, 43 }, { 224, 43 },
|
||||
{ 224, 64 }, { 150, 64 }, { 75, 64 }, { 0, 64 },
|
||||
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
// put your looping keyboard code here
|
||||
// runs every cycle (a lot)
|
||||
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
// put your per-action keyboard code here
|
||||
// runs for every action, just before processing by the firmware
|
||||
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
void led_set_kb(uint8_t usb_led) {
|
||||
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
|
||||
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
}, {
|
||||
// LED Index to Flag
|
||||
4, 4, 4, 4,
|
||||
4, 4, 4, 4,
|
||||
4, 4, 4, 4,
|
||||
4, 4, 4, 4
|
||||
} };
|
||||
#endif
|
||||
|
@ -25,9 +25,9 @@ enum custom_keycodes {
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_QWERTY] = LAYOUT(
|
||||
//,-----------------------------------------------------| |--------------------------------------------------------------------------------.
|
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS,KC_GRAVE,
|
||||
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSLS, KC_GRV,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------+--------|
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LCBR, KC_RCBR,KC_BSPC,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,KC_BSPC,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------+--------|
|
||||
KC_LCTRL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT,
|
||||
//|--------+--------+--------+--------+--------+--------| |--------+--------+--------+--------+--------+--------+--------|
|
||||
|
47
keyboards/ai03/equinox/keymaps/crd/keymap.c
Normal file
47
keyboards/ai03/equinox/keymaps/crd/keymap.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* Copyright 2019 Ryota Goto
|
||||
*
|
||||
* 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 QMK_KEYBOARD_H
|
||||
/*
|
||||
K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, \
|
||||
K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, \
|
||||
K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, \
|
||||
K300, K301, K302, K304, K306, K308, K309, K310, K311 \
|
||||
*/
|
||||
|
||||
#define KC_CTES RCTL_T(KC_ESC)
|
||||
#define KC_BSM1 LT(1, KC_BSPC)
|
||||
#define KC_SPM1 LT(1, KC_SPC)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[0] = LAYOUT_all( /* Base */
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_GRV,
|
||||
KC_CTES, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, XXXXXXX, KC_ENT,
|
||||
KC_LSFT, KC_SLSH, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_RSFT,
|
||||
KC_LCTL, XXXXXXX, KC_RGUI, KC_BSM1, MO(2), KC_SPM1, KC_RALT, XXXXXXX, KC_RCTL
|
||||
),
|
||||
[1] = LAYOUT_all( /* Extra Keys */
|
||||
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS,
|
||||
_______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, XXXXXXX, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LBRC, KC_RBRC, _______,
|
||||
_______, XXXXXXX, _______, _______, _______, _______, _______, _______, _______
|
||||
),
|
||||
[2] = LAYOUT_all( /* Num and FN */
|
||||
RESET, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, _______, KC_MINS, KC_EQL, _______,
|
||||
_______, KC_VOLD, KC_VOLU, KC_MUTE, _______, _______, _______, _______, KC_SCLN, KC_QUOT, XXXXXXX, _______,
|
||||
_______, _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______,
|
||||
_______, XXXXXXX, _______, _______, _______, _______, _______, XXXXXXX, _______
|
||||
)
|
||||
};
|
3
keyboards/ai03/equinox/keymaps/crd/readme.md
Normal file
3
keyboards/ai03/equinox/keymaps/crd/readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# crd's keymap for equinox
|
||||
|
||||
[KLE](http://www.keyboard-layout-editor.com/#/gists/0be9c4a916dba80ebb5533cd00c5304c)
|
@ -21,8 +21,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define VENDOR_ID 0xA22A
|
||||
#define PRODUCT_ID 0x6600
|
||||
#define DEVICE_VER 0x0001
|
||||
/* in python2: list(u"whatever".encode('utf-16-le')) */
|
||||
/* at most 32 characters or the ugly hack in usb_main.c borks */
|
||||
#define MANUFACTURER AT-AT
|
||||
#define PRODUCT 660M
|
||||
#define DESCRIPTION 660M Keyboard
|
||||
|
@ -1,258 +1,47 @@
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
typedef enum {
|
||||
SINGLE_TAP,
|
||||
SINGLE_HOLD,
|
||||
DOUBLE_TAP,
|
||||
} td_state_t;
|
||||
#include "ibnuda.h"
|
||||
|
||||
static td_state_t td_state;
|
||||
|
||||
int current_dance(qk_tap_dance_state_t *state);
|
||||
|
||||
void dance_tmb_finished(qk_tap_dance_state_t *state, void *user_data);
|
||||
void dance_tmb_reset(qk_tap_dance_state_t *state, void *user_data);
|
||||
|
||||
// enum for tap dances.
|
||||
enum {
|
||||
TD_DLT_CTLDLT = 0,
|
||||
TD_SCLN_CLN,
|
||||
TD_LEFT_THUMB,
|
||||
};
|
||||
|
||||
// enum for combos.
|
||||
enum combos {
|
||||
// left hand combinations.
|
||||
COLON_COMMA,
|
||||
COMMA_DOT,
|
||||
DOT_P,
|
||||
Q_J,
|
||||
J_K,
|
||||
|
||||
// right hand combinations.
|
||||
L_R,
|
||||
R_C,
|
||||
C_G,
|
||||
V_W,
|
||||
W_M,
|
||||
|
||||
// both hands combinations.
|
||||
DOT_C,
|
||||
J_W,
|
||||
P_G,
|
||||
U_H,
|
||||
K_M,
|
||||
};
|
||||
|
||||
enum {
|
||||
_BASE,
|
||||
_LOWER,
|
||||
_RAISE,
|
||||
_ADJUST,
|
||||
_MUIS
|
||||
};
|
||||
|
||||
// thumb keys.
|
||||
#define ALT_ENT ALT_T(KC_ENT)
|
||||
#define SFT_ESC SFT_T(KC_ESC)
|
||||
|
||||
// home row mods.
|
||||
#define CT_O RCTL_T(KC_O)
|
||||
#define CT_N RCTL_T(KC_N)
|
||||
#define SH_A RSFT_T(KC_A)
|
||||
#define SH_S RSFT_T(KC_S)
|
||||
#define AL_E RALT_T(KC_E)
|
||||
#define AL_T RALT_T(KC_T)
|
||||
#define GU_I RGUI_T(KC_I)
|
||||
#define GU_D RGUI_T(KC_D)
|
||||
|
||||
// layer toggle.
|
||||
#define LW_BSPC LT(_LOWER, KC_BSPC)
|
||||
#define RS_SPC LT(_RAISE, KC_SPC)
|
||||
#define RS_D LT(_RAISE, KC_D)
|
||||
#define LW_I LT(_LOWER, KC_I)
|
||||
#define MU_QUOT LT(_MUIS, KC_QUOT)
|
||||
#define MU_Z LT(_MUIS, KC_Z)
|
||||
|
||||
// idk, man. not used, i guess.
|
||||
#define RAISE MO(_RAISE)
|
||||
#define LOWER MO(_LOWER)
|
||||
#define ADDDD MO(_ADJUST)
|
||||
#define MUIS MO(_MUIS)
|
||||
|
||||
// common shortcuts for windows and linux that i use.
|
||||
#define NXTTAB LCTL(KC_PGDN)
|
||||
#define PRVTAB LCTL(KC_PGUP)
|
||||
#define UPTAB LCTL(LSFT(KC_PGUP))
|
||||
#define DNTAB LCTL(LSFT(KC_PGDN))
|
||||
#define NXTWIN LALT(KC_TAB)
|
||||
#define PRVWIN LALT(LSFT(KC_TAB))
|
||||
#define CALDL LCTL(LALT(KC_DELT))
|
||||
#define TSKMGR LCTL(LSFT(KC_ESC))
|
||||
#define EXPLR LGUI(KC_E)
|
||||
#define LCKGUI LGUI(KC_L)
|
||||
#define CONPST LSFT(KC_INS)
|
||||
#define CLSGUI LALT(KC_F4)
|
||||
|
||||
// tap dances
|
||||
#define CTL_DLT TD(TD_DLT_CTLDLT)
|
||||
#define SM_CLN TD(TD_SCLN_CLN)
|
||||
#define LFT_TMB TD(TD_LEFT_THUMB)
|
||||
|
||||
// left hand combinations.
|
||||
const uint16_t PROGMEM colon_comma_combo[] = {KC_SCLN, KC_COMM, COMBO_END};
|
||||
const uint16_t PROGMEM comma_dot_combo[] = {KC_COMM, KC_DOT, COMBO_END};
|
||||
const uint16_t PROGMEM dot_p_combo[] = {KC_DOT, KC_P, COMBO_END};
|
||||
const uint16_t PROGMEM q_j_combo[] = {KC_Q, KC_J, COMBO_END};
|
||||
const uint16_t PROGMEM j_k_combo[] = {KC_J, KC_K, COMBO_END};
|
||||
|
||||
// right hand combinations.
|
||||
const uint16_t PROGMEM l_r_combo[] = {KC_L, KC_R, COMBO_END};
|
||||
const uint16_t PROGMEM r_c_combo[] = {KC_R, KC_C, COMBO_END};
|
||||
const uint16_t PROGMEM c_g_combo[] = {KC_C, KC_G, COMBO_END};
|
||||
const uint16_t PROGMEM v_w_combo[] = {KC_V, KC_W, COMBO_END};
|
||||
const uint16_t PROGMEM w_m_combo[] = {KC_W, KC_M, COMBO_END};
|
||||
|
||||
// both hand combinations.
|
||||
const uint16_t PROGMEM dot_c_combo[] = {KC_DOT, KC_C, COMBO_END};
|
||||
const uint16_t PROGMEM j_w_combo[] = {KC_J, KC_W, COMBO_END};
|
||||
const uint16_t PROGMEM u_h_combo[] = {KC_U, KC_H, COMBO_END};
|
||||
const uint16_t PROGMEM p_g_combo[] = {KC_P, KC_G, COMBO_END};
|
||||
const uint16_t PROGMEM k_m_combo[] = {KC_K, KC_M, COMBO_END};
|
||||
|
||||
combo_t key_combos[COMBO_COUNT] = {
|
||||
// left hand combinations.
|
||||
[COLON_COMMA] = COMBO(colon_comma_combo, KC_TAB),
|
||||
[COMMA_DOT] = COMBO(comma_dot_combo, KC_QUES),
|
||||
[DOT_P] = COMBO(dot_p_combo, KC_UNDS),
|
||||
[Q_J] = COMBO(q_j_combo, LCTL(KC_W)),
|
||||
[J_K] = COMBO(j_k_combo, KC_DELT),
|
||||
|
||||
// right hand combinations.
|
||||
[L_R] = COMBO(l_r_combo, KC_BSPC),
|
||||
[R_C] = COMBO(r_c_combo, KC_SLSH),
|
||||
[C_G] = COMBO(c_g_combo, KC_MINS),
|
||||
[V_W] = COMBO(v_w_combo, KC_APP),
|
||||
[W_M] = COMBO(w_m_combo, KC_DELT),
|
||||
|
||||
// both hand combinations.
|
||||
[DOT_C] = COMBO(dot_c_combo, KC_PGUP),
|
||||
[J_W] = COMBO(j_w_combo, KC_PGDN),
|
||||
[U_H] = COMBO(u_h_combo, KC_ENT),
|
||||
[P_G] = COMBO(p_g_combo, KC_HOME),
|
||||
[K_M] = COMBO(k_m_combo, KC_END),
|
||||
};
|
||||
|
||||
void dance_dlt_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (state->count == 1) {
|
||||
register_code16(KC_DELT);
|
||||
} else {
|
||||
register_code16(C(KC_DELT));
|
||||
}
|
||||
}
|
||||
|
||||
void dance_dlt_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (state->count == 1) {
|
||||
unregister_code16(KC_DELT);
|
||||
} else {
|
||||
unregister_code16(C(KC_DELT));
|
||||
}
|
||||
}
|
||||
|
||||
void dance_cln_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (state->count == 1) {
|
||||
register_code(KC_LSFT);
|
||||
}
|
||||
register_code(KC_SCLN);
|
||||
}
|
||||
|
||||
void dance_cln_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
if (state->count == 1) {
|
||||
unregister_code(KC_LSFT);
|
||||
}
|
||||
unregister_code(KC_SCLN);
|
||||
}
|
||||
|
||||
int current_dance(qk_tap_dance_state_t *state) {
|
||||
if (state->count == 1) {
|
||||
if (state->interrupted || !state->pressed) {
|
||||
return SINGLE_TAP;
|
||||
} else {
|
||||
return SINGLE_HOLD;
|
||||
}
|
||||
}
|
||||
if (state->count == 2) {
|
||||
return DOUBLE_TAP;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
void dance_tmb_finished(qk_tap_dance_state_t *state, void *user_data) {
|
||||
td_state = current_dance(state);
|
||||
switch (td_state) {
|
||||
case SINGLE_TAP:
|
||||
register_code16(KC_ESC);
|
||||
break;
|
||||
case SINGLE_HOLD:
|
||||
register_mods(MOD_BIT(KC_LSFT));
|
||||
break;
|
||||
case DOUBLE_TAP:
|
||||
register_code16(KC_DELT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void dance_tmb_reset(qk_tap_dance_state_t *state, void *user_data) {
|
||||
switch (td_state) {
|
||||
case SINGLE_TAP:
|
||||
unregister_code16(KC_ESC);
|
||||
break;
|
||||
case SINGLE_HOLD:
|
||||
unregister_mods(MOD_BIT(KC_LSFT));
|
||||
break;
|
||||
case DOUBLE_TAP:
|
||||
unregister_code16(KC_DELT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
qk_tap_dance_action_t tap_dance_actions[] = {
|
||||
[TD_DLT_CTLDLT] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_dlt_finished, dance_dlt_reset),
|
||||
[TD_SCLN_CLN] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_cln_finished, dance_cln_reset),
|
||||
[TD_LEFT_THUMB] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, dance_tmb_finished, dance_tmb_reset),
|
||||
};
|
||||
// clang-format off
|
||||
#define LAYOUT_atreus_base( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
|
||||
KTA, KTB, KTC, KTD \
|
||||
) \
|
||||
LAYOUT_wrapper( \
|
||||
K01, K02, K03, K04, K05, K06, K07, K08, K09, K0A, \
|
||||
K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, \
|
||||
K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, \
|
||||
___, ___, ___, ___, KTA, KTB, KTC, KTD, ___, ___, ___, ___ \
|
||||
)
|
||||
#define LAYOUT_atreus_base_wrapper(...) LAYOUT_atreus_base(__VA_ARGS__)
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_BASE] = LAYOUT(
|
||||
SM_CLN, KC_COMM,KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L,
|
||||
SH_A, CT_O, AL_E, KC_U, GU_I, GU_D, KC_H, AL_T, CT_N, SH_S,
|
||||
MU_QUOT,KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, MU_Z,
|
||||
_______,_______,_______,_______,LW_BSPC,SFT_ESC, ALT_ENT,RS_SPC, _______,_______,_______,_______
|
||||
[_BASE] = LAYOUT_atreus_base_wrapper(
|
||||
________________DVORAK_L1_______________, ________________DVORAK_R1_______________,
|
||||
________________DVORAK_L2_______________, ________________DVORAK_R2_______________,
|
||||
________________DVORAK_L3_______________, ________________DVORAK_R3_______________,
|
||||
LW_BSPC,SFT_ESC, ALT_ENT,RS_SPC
|
||||
),
|
||||
|
||||
[_RAISE] = LAYOUT(
|
||||
KC_EXLM,KC_AT, KC_UP, KC_LCBR,KC_RCBR, KC_BSLS,KC_7, KC_8, KC_9, KC_ASTR ,
|
||||
KC_HASH,KC_LEFT,KC_DOWN,KC_RGHT,KC_DLR, KC_EQL, KC_4, KC_5, KC_6, KC_TILD ,
|
||||
KC_LBRC,KC_RBRC,KC_LPRN,KC_RPRN,KC_AMPR, KC_GRV, KC_1, KC_2, KC_3, KC_PLUS ,
|
||||
_______,_______,_______,_______,ADDDD, _______, ALT_ENT,RS_SPC, _______,KC_0, _______,_______
|
||||
[_RAISE] = LAYOUT_atreus_base_wrapper(
|
||||
________________RAISE_L1________________, ________________RAISE_R1________________,
|
||||
________________RAISE_L2________________, ________________RAISE_R2________________,
|
||||
________________RAISE_L3________________, ________________RAISE_R3________________,
|
||||
ADDDD, _______, _______,_______
|
||||
),
|
||||
[_LOWER] = LAYOUT(
|
||||
KC_ESC, KC_QUES,KC_UNDS,KC_F1, KC_F2, KC_F3, KC_F4, KC_MINS,KC_SLSH,KC_BSPC ,
|
||||
KC_LSFT,KC_TAB, KC_PGUP,KC_F5, KC_F6, KC_F7, KC_F8, KC_HOME,KC_LALT,KC_ENT ,
|
||||
KC_CLCK,KC_SLCK,KC_PGDN,KC_F9, KC_F10, KC_F11, KC_F12, KC_END, KC_INS, KC_SLSH ,
|
||||
_______,_______,_______,_______,ADDDD, _______, KC_DELT,ADDDD, _______,_______,_______,_______
|
||||
[_LOWER] = LAYOUT_atreus_base_wrapper(
|
||||
________________LOWER_L1________________, ________________LOWER_R1________________,
|
||||
________________LOWER_L2________________, ________________LOWER_R2________________,
|
||||
________________LOWER_L3________________, ________________LOWER_R3________________,
|
||||
_______,_______, _______,ADDDD
|
||||
),
|
||||
[_ADJUST] = LAYOUT(
|
||||
_______,EXPLR, KC_UP, PRVTAB, PRVWIN, NXTWIN, NXTTAB, _______,_______,LCKGUI,
|
||||
TSKMGR, KC_LEFT,KC_DOWN,KC_RGHT,UPTAB, DNTAB, KC_ENT, KC_LGUI,_______,CALDL,
|
||||
_______,CLSGUI, _______,CONPST, RESET, _______,_______,_______,_______,_______,
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______
|
||||
),
|
||||
[_MUIS] = LAYOUT(
|
||||
_______,KC_BTN2,KC_MS_U,KC_BTN1,_______, _______,KC_BTN1,KC_MS_U,KC_BTN2,_______,
|
||||
_______,KC_MS_L,KC_MS_D,KC_MS_R,_______, _______,KC_MS_L,KC_MS_D,KC_MS_R,_______,
|
||||
_______,_______,KC_WH_D,KC_WH_U,_______, _______,KC_WH_U,KC_WH_D,_______,_______,
|
||||
_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______
|
||||
[_ADJUST] = LAYOUT_atreus_base_wrapper(
|
||||
________________ADJUST_L1_______________, ________________ADJUST_R1_______________,
|
||||
________________ADJUST_L2_______________, ________________ADJUST_R2_______________,
|
||||
________________ADJUST_L3_______________, ________________ADJUST_R3_______________,
|
||||
_______,_______, _______,_______
|
||||
),
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -1,7 +0,0 @@
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
|
||||
MOUSEKEY_ENABLE = yes
|
||||
COMBO_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
@ -36,13 +36,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 8 // Row0 - Row7 in the schematic
|
||||
#define MATRIX_COLS 18 // ColA - ColR in the schematic
|
||||
#define MATRIX_ROWS 18 // ColA - ColR in the schematic
|
||||
#define MATRIX_COLS 8 // Row0 - Row7 in the schematic
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
*/
|
||||
#define UNUSED_PINS { B0, C4, D3 }
|
||||
#define UNUSED_PINS { C0, C1, C2, C3, C4, D2, D7 }
|
||||
|
||||
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
|
||||
#define DEBOUNCE 5
|
||||
|
@ -1,63 +1,24 @@
|
||||
#include "frosty_flake.h"
|
||||
|
||||
void matrix_init_kb(void) {
|
||||
// put your keyboard start-up code here
|
||||
// runs once when the firmware starts up
|
||||
void keyboard_pre_init_kb() {
|
||||
setPinOutput(B7); // num lock
|
||||
writePinHigh(B7);
|
||||
setPinOutput(C5); // caps lock
|
||||
writePinHigh(C7);
|
||||
setPinOutput(C6); // scroll lock
|
||||
writePinHigh(C6);
|
||||
|
||||
matrix_init_user();
|
||||
keyboard_pre_init_user();
|
||||
}
|
||||
|
||||
void matrix_scan_kb(void) {
|
||||
// put your looping keyboard code here
|
||||
// runs every cycle (a lot)
|
||||
bool led_update_kb(led_t usb_led) {
|
||||
// user requests no further processing
|
||||
if (!led_update_user(usb_led))
|
||||
return true;
|
||||
|
||||
matrix_scan_user();
|
||||
writePin(C5, !usb_led.caps_lock);
|
||||
writePin(B7, !usb_led.num_lock);
|
||||
writePin(C6, !usb_led.scroll_lock);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
// put your per-action keyboard code here
|
||||
// runs for every action, just before processing by the firmware
|
||||
|
||||
return process_record_user(keycode, record);
|
||||
}
|
||||
|
||||
void led_set_kb(uint8_t usb_led) {
|
||||
DDRB |= (1<<7);
|
||||
DDRC |= (1<<5) | (1<<6);
|
||||
|
||||
print_dec(usb_led);
|
||||
|
||||
if (usb_led & (1<<USB_LED_CAPS_LOCK))
|
||||
PORTC &= ~(1<<5);
|
||||
else
|
||||
PORTC |= (1<<5);
|
||||
|
||||
if (usb_led & (1<<USB_LED_NUM_LOCK))
|
||||
PORTB &= ~(1<<7);
|
||||
else
|
||||
PORTB |= (1<<7);
|
||||
|
||||
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
|
||||
PORTC &= ~(1<<6);
|
||||
else
|
||||
PORTC |= (1<<6);
|
||||
|
||||
led_set_user(usb_led);
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
return true;
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void led_set_user(uint8_t usb_led) {
|
||||
}
|
@ -34,16 +34,25 @@
|
||||
KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0, KL6, KQ6 \
|
||||
) \
|
||||
{ \
|
||||
/* Columns and rows need to be swapped in the below definition */ \
|
||||
/* A B C D E F G H I J K L M N O P Q R */ \
|
||||
/* 0 */ { KC_NO, KB0, KC0, KD0, KC_NO, KF0, KG0, KC_NO, KC_NO, KC_NO, KK0, KL0, KC_NO, KC_NO, KO0, KC_NO, KQ0, KR0 }, \
|
||||
/* 1 */ { KA1, KB1, KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KK1, KL1, KC_NO, KC_NO, KC_NO, KC_NO, KQ1, KC_NO }, \
|
||||
/* 2 */ { KC_NO, KB2, KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KK2, KL2, KC_NO, KN2, KC_NO, KP2, KQ2, KR2 }, \
|
||||
/* 3 */ { KC_NO, KB3, KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KK3, KL3, KM3, KN3, KO3, KC_NO, KQ3, KR3 }, \
|
||||
/* 4 */ { KA4, KB4, KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4, KC_NO, KC_NO, KO4, KC_NO, KQ4, KR4 }, \
|
||||
/* 5 */ { KA5, KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KK5, KL5, KC_NO, KC_NO, KO5, KC_NO, KQ5, KR5 }, \
|
||||
/* 6 */ { KC_NO, KB6, KC6, KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KL6, KC_NO, KC_NO, KO6, KC_NO, KQ6, KR6 }, \
|
||||
/* 7 */ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7, KC_NO, KC_NO, KC_NO, KC_NO, KO7, KC_NO, KQ7, KR7 } \
|
||||
/* 0 1 2 3 4 5 6 7 */ \
|
||||
/* A */ { KC_NO, KA1, KC_NO, KC_NO, KA4, KA5, KC_NO, KA7, }, \
|
||||
/* B */ { KB0, KB1, KB2, KB3, KB4, KC_NO, KB6, KB7, }, \
|
||||
/* C */ { KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC5, KC6, KC7, }, \
|
||||
/* D */ { KD0, KD1, KD2, KD3, KD4, KD5, KC_NO, KD7, }, \
|
||||
/* E */ { KC_NO, KE1, KE2, KE3, KE4, KE5, KE6, KE7, }, \
|
||||
/* F */ { KF0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, }, \
|
||||
/* G */ { KG0, KG1, KG2, KG3, KG4, KG5, KG6, KG7, }, \
|
||||
/* H */ { KC_NO, KH1, KH2, KH3, KH4, KH5, KH6, KH7, }, \
|
||||
/* I */ { KC_NO, KI1, KI2, KI3, KI4, KI5, KI6, KI7, }, \
|
||||
/* J */ { KC_NO, KJ1, KJ2, KJ3, KJ4, KJ5, KJ6, KJ7, }, \
|
||||
/* K */ { KK0, KK1, KK2, KK3, KK4, KK5, KK6, KC_NO, }, \
|
||||
/* L */ { KL0, KL1, KL2, KL3, KL4, KL5, KL6, KC_NO, }, \
|
||||
/* M */ { KC_NO, KC_NO, KC_NO, KM3, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* N */ { KC_NO, KC_NO, KN2, KN3, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* O */ { KO0, KC_NO, KC_NO, KO3, KO4, KO5, KO6, KO7, }, \
|
||||
/* P */ { KC_NO, KC_NO, KP2, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* Q */ { KQ0, KQ1, KQ2, KQ3, KQ4, KQ5, KQ6, KQ7, }, \
|
||||
/* R */ { KR0, KC_NO, KR2, KR3, KR4, KR5, KR6, KR7, }, \
|
||||
}
|
||||
|
||||
/*
|
||||
@ -74,16 +83,25 @@
|
||||
KA4, KP2, KC6, KK6, KC0, KM3, KD0, KA1, KO0, KK0, KL0 \
|
||||
) \
|
||||
{ \
|
||||
/* Columns and rows need to be swapped in the below definition */ \
|
||||
/* A B C D E F G H I J K L M N O P Q R */ \
|
||||
/* 0 */ { KC_NO, KB0, KC0, KD0, KC_NO, KF0, KG0, KC_NO, KC_NO, KC_NO, KK0, KL0, KC_NO, KC_NO, KO0, KC_NO, KC_NO, KR0 }, \
|
||||
/* 1 */ { KA1, KB1, KC_NO, KD1, KE1, KF1, KG1, KH1, KI1, KJ1, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO }, \
|
||||
/* 2 */ { KC_NO, KB2, KC_NO, KD2, KE2, KF2, KG2, KH2, KI2, KJ2, KC_NO, KC_NO, KC_NO, KN2, KC_NO, KP2, KC_NO, KR2 }, \
|
||||
/* 3 */ { KC_NO, KB3, KC_NO, KD3, KE3, KF3, KG3, KH3, KI3, KJ3, KC_NO, KC_NO, KM3, KN3, KC_NO, KC_NO, KC_NO, KR3 }, \
|
||||
/* 4 */ { KA4, KB4, KC_NO, KD4, KE4, KF4, KG4, KH4, KI4, KJ4, KK4, KL4, KC_NO, KC_NO, KO4, KC_NO, KQ4, KR4 }, \
|
||||
/* 5 */ { KA5, KC_NO, KC5, KD5, KE5, KF5, KG5, KH5, KI5, KJ5, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KR5 }, \
|
||||
/* 6 */ { KC_NO, KB6, KC6, KC_NO, KE6, KF6, KG6, KH6, KI6, KJ6, KK6, KC_NO, KC_NO, KC_NO, KO6, KC_NO, KC_NO, KR6 }, \
|
||||
/* 7 */ { KA7, KB7, KC7, KD7, KE7, KF7, KG7, KH7, KI7, KJ7, KC_NO, KC_NO, KC_NO, KC_NO, KO7, KC_NO, KQ7, KR7 } \
|
||||
/* 0 1 2 3 4 5 6 7 */ \
|
||||
/* A */ { KC_NO, KA1, KC_NO, KC_NO, KA4, KA5, KC_NO, KA7, }, \
|
||||
/* B */ { KB0, KB1, KB2, KB3, KB4, KC_NO, KB6, KB7, }, \
|
||||
/* C */ { KC0, KC_NO, KC_NO, KC_NO, KC_NO, KC5, KC6, KC7, }, \
|
||||
/* D */ { KD0, KD1, KD2, KD3, KD4, KD5, KC_NO, KD7, }, \
|
||||
/* E */ { KC_NO, KE1, KE2, KE3, KE4, KE5, KE6, KE7, }, \
|
||||
/* F */ { KF0, KF1, KF2, KF3, KF4, KF5, KF6, KF7, }, \
|
||||
/* G */ { KG0, KG1, KG2, KG3, KG4, KG5, KG6, KG7, }, \
|
||||
/* H */ { KC_NO, KH1, KH2, KH3, KH4, KH5, KH6, KH7, }, \
|
||||
/* I */ { KC_NO, KI1, KI2, KI3, KI4, KI5, KI6, KI7, }, \
|
||||
/* J */ { KC_NO, KJ1, KJ2, KJ3, KJ4, KJ5, KJ6, KJ7, }, \
|
||||
/* K */ { KK0, KC_NO, KC_NO, KC_NO, KK4, KC_NO, KK6, KC_NO, }, \
|
||||
/* L */ { KL0, KC_NO, KC_NO, KC_NO, KL4, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* M */ { KC_NO, KC_NO, KC_NO, KM3, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* N */ { KC_NO, KC_NO, KN2, KN3, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* O */ { KO0, KC_NO, KC_NO, KC_NO, KO4, KC_NO, KO6, KO7, }, \
|
||||
/* P */ { KC_NO, KC_NO, KP2, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, }, \
|
||||
/* Q */ { KC_NO, KC_NO, KC_NO, KC_NO, KQ4, KC_NO, KC_NO, KQ7, }, \
|
||||
/* R */ { KR0, KC_NO, KR2, KR3, KR4, KR5, KR6, KR7, }, \
|
||||
}
|
||||
|
||||
#define LAYOUT_tkl_ansi( \
|
||||
|
@ -15,42 +15,15 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <avr/io.h>
|
||||
#include <util/delay.h>
|
||||
#include "print.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
#include "matrix.h"
|
||||
|
||||
#ifndef DEBOUNCE
|
||||
# define DEBOUNCE 5
|
||||
#endif
|
||||
static uint8_t debouncing = DEBOUNCE;
|
||||
|
||||
static matrix_row_t matrix[MATRIX_ROWS];
|
||||
static matrix_row_t matrix_debouncing[MATRIX_ROWS];
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_kb(void) {
|
||||
matrix_init_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_kb(void) {
|
||||
matrix_scan_user();
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_init_user(void) {
|
||||
}
|
||||
|
||||
__attribute__ ((weak))
|
||||
void matrix_scan_user(void) {
|
||||
}
|
||||
|
||||
static matrix_row_t scan_col(void) {
|
||||
// Each of the 8 columns is read off pins as below
|
||||
// 7 6 5 4 3 2 1 0
|
||||
// ,--,--,--,--,--,--,--,--,
|
||||
// |B0|B3|B2|B1|B6|B4|B5|C7|
|
||||
// `--`--`--`--`--`--`--`--`
|
||||
return (
|
||||
(PINC&(1<<7) ? 0 : ((matrix_row_t)1<<0)) |
|
||||
(PINB&(1<<5) ? 0 : ((matrix_row_t)1<<1)) |
|
||||
@ -63,8 +36,8 @@ static matrix_row_t scan_col(void) {
|
||||
);
|
||||
}
|
||||
|
||||
static void select_col(uint8_t col) {
|
||||
switch (col) {
|
||||
static void select_row(uint8_t row) {
|
||||
switch (row) {
|
||||
case 0: PORTD = (PORTD & ~0b01111011) | 0b00011011; break;
|
||||
case 1: PORTD = (PORTD & ~0b01111011) | 0b01000011; break;
|
||||
case 2: PORTD = (PORTD & ~0b01111011) | 0b01101010; break;
|
||||
@ -86,7 +59,7 @@ static void select_col(uint8_t col) {
|
||||
}
|
||||
}
|
||||
|
||||
void matrix_init(void) {
|
||||
void matrix_init_custom(void) {
|
||||
/* Row output pins */
|
||||
DDRD |= 0b01111011;
|
||||
/* Column input pins */
|
||||
@ -94,62 +67,19 @@ void matrix_init(void) {
|
||||
DDRB &= ~0b01111111;
|
||||
PORTC |= 0b10000000;
|
||||
PORTB |= 0b01111111;
|
||||
|
||||
for (uint8_t i=0; i < MATRIX_ROWS; i++)
|
||||
matrix[i] = matrix_debouncing[i] = 0;
|
||||
|
||||
matrix_init_quantum();
|
||||
}
|
||||
|
||||
uint8_t matrix_scan(void) {
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
select_col(col);
|
||||
_delay_us(3);
|
||||
matrix_row_t col_scan = scan_col();
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
bool prev_bit = matrix_debouncing[row] & ((matrix_row_t)1<<col);
|
||||
bool curr_bit = col_scan & (1<<row);
|
||||
if (prev_bit != curr_bit) {
|
||||
matrix_debouncing[row] ^= ((matrix_row_t)1<<col);
|
||||
debouncing = DEBOUNCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (debouncing) {
|
||||
if (--debouncing)
|
||||
_delay_ms(1);
|
||||
else
|
||||
for (uint8_t i = 0; i < MATRIX_ROWS; i++)
|
||||
matrix[i] = matrix_debouncing[i];
|
||||
}
|
||||
|
||||
matrix_scan_quantum();
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline matrix_row_t matrix_get_row(uint8_t row) {
|
||||
return matrix[row];
|
||||
}
|
||||
|
||||
void matrix_print(void) {
|
||||
#ifndef NO_PRINT
|
||||
print("\nr\\c ABCDEFGHIJKLMNOPQR\n");
|
||||
// matrix is 18 uint8_t.
|
||||
// we select the row (one of 18), then read the column
|
||||
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
|
||||
bool has_changed = false;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
|
||||
matrix_row_t matrix_row = matrix_get_row(row);
|
||||
xprintf("%02X: ", row);
|
||||
for (uint8_t col = 0; col < MATRIX_COLS; col++) {
|
||||
bool curr_bit = matrix_row & (1<<col);
|
||||
xprintf("%c", curr_bit ? '*' : '.');
|
||||
}
|
||||
print("\n");
|
||||
matrix_row_t orig = current_matrix[row];
|
||||
select_row(row);
|
||||
_delay_us(3);
|
||||
current_matrix[row] = scan_col();
|
||||
has_changed |= (orig != current_matrix[row]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t matrix_key_count(void) {
|
||||
uint8_t count = 0;
|
||||
for (uint8_t row = 0; row < MATRIX_ROWS; row++)
|
||||
count += bitpop32(matrix[row]);
|
||||
return count;
|
||||
return has_changed;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user