mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-24 20:32:58 +00:00
Compare commits
35 Commits
daa090dfd2
...
1e093b670b
Author | SHA1 | Date | |
---|---|---|---|
|
1e093b670b | ||
|
36b5559b99 | ||
|
39161b9ee7 | ||
|
074bbbfb21 | ||
|
638b22d057 | ||
|
9bea332a21 | ||
|
8cbcdcac62 | ||
|
88afd53b1f | ||
|
9c86583981 | ||
|
e66fce38b2 | ||
|
c843ad1268 | ||
|
0853a8ea35 | ||
|
0988523851 | ||
|
7936a791ed | ||
|
3a6df60ba5 | ||
|
5ab408aef7 | ||
|
da34d652d4 | ||
|
310c4847d5 | ||
|
f4e58eeff4 | ||
|
79a661fe61 | ||
|
46236ce3de | ||
|
0bda0f4775 | ||
|
f8b4e24d37 | ||
|
a8a47c4011 | ||
|
d04789e9ea | ||
|
4757ef281f | ||
|
4e77ab66e2 | ||
|
3d4da6de29 | ||
|
be7b479c4a | ||
|
9cd7896760 | ||
|
0056a1f0d0 | ||
|
42c2e8d1f7 | ||
|
10fe06e228 | ||
|
24042a0cf1 | ||
|
41bfb5a2ee |
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@ -56,7 +56,7 @@ jobs:
|
||||
|
||||
- name: Deploy
|
||||
if: ${{ github.event_name == 'push' && github.repository == 'qmk/qmk_firmware' }}
|
||||
uses: JamesIves/github-pages-deploy-action@v4.6.8
|
||||
uses: JamesIves/github-pages-deploy-action@v4.6.9
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
branch: gh-pages
|
||||
|
@ -215,7 +215,7 @@ else
|
||||
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/flash
|
||||
COMMON_VPATH += $(DRIVER_PATH)/flash
|
||||
SRC += eeprom_driver.c eeprom_legacy_emulated_flash.c legacy_flash_ops.c
|
||||
else ifneq ($(filter $(MCU_SERIES),STM32F1xx STM32F3xx STM32F4xx STM32L4xx STM32G4xx WB32F3G71xx WB32FQ95xx GD32VF103),)
|
||||
else ifneq ($(filter $(MCU_SERIES),STM32F1xx STM32F3xx STM32F4xx STM32L4xx STM32G4xx WB32F3G71xx WB32FQ95xx AT32F415 GD32VF103),)
|
||||
# Wear-leveling EEPROM implementation, backed by MCU flash
|
||||
OPT_DEFS += -DEEPROM_DRIVER -DEEPROM_WEAR_LEVELING
|
||||
SRC += eeprom_driver.c eeprom_wear_leveling.c
|
||||
@ -456,6 +456,10 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/rgb_matrix/post_config.h
|
||||
|
||||
# TODO: Remove this
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_underglow.c
|
||||
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_rgb_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/color.c
|
||||
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
|
||||
|
@ -39,6 +39,11 @@ export default defineConfig(({ mode }) => {
|
||||
provider: "local",
|
||||
},
|
||||
|
||||
editLink: {
|
||||
pattern: 'https://github.com/qmk/qmk_firmware/edit/master/docs/:path'
|
||||
},
|
||||
lastUpdated: true,
|
||||
|
||||
sidebar: sidebar,
|
||||
|
||||
externalLinkIcon: true,
|
||||
|
@ -36,6 +36,7 @@ GENERIC_FEATURES = \
|
||||
HAPTIC \
|
||||
KEY_LOCK \
|
||||
KEY_OVERRIDE \
|
||||
LAYER_LOCK \
|
||||
LEADER \
|
||||
MAGIC \
|
||||
MOUSEKEY \
|
||||
|
@ -7,41 +7,47 @@
|
||||
"keycodes": {
|
||||
"0x7780": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NEXT",
|
||||
"key": "QK_OUTPUT_AUTO",
|
||||
"aliases": [
|
||||
"OU_NEXT",
|
||||
"OU_AUTO"
|
||||
]
|
||||
},
|
||||
"0x7781": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NEXT",
|
||||
"aliases": [
|
||||
"OU_NEXT"
|
||||
]
|
||||
},
|
||||
"0x7782": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_PREV",
|
||||
"aliases": [
|
||||
"OU_PREV"
|
||||
]
|
||||
},
|
||||
"0x7782": {
|
||||
"0x7783": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_NONE",
|
||||
"aliases": [
|
||||
"OU_NONE"
|
||||
]
|
||||
},
|
||||
"0x7783": {
|
||||
"0x7784": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_USB",
|
||||
"aliases": [
|
||||
"OU_USB"
|
||||
]
|
||||
},
|
||||
"0x7784": {
|
||||
"0x7785": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_2P4GHZ",
|
||||
"aliases": [
|
||||
"OU_2P4G"
|
||||
]
|
||||
},
|
||||
"0x7785": {
|
||||
"0x7786": {
|
||||
"group": "connection",
|
||||
"key": "QK_OUTPUT_BLUETOOTH",
|
||||
"aliases": [
|
||||
|
@ -3,5 +3,12 @@
|
||||
"0x7C20": "!delete!", // old QK_OUTPUT_AUTO
|
||||
"0x7C21": "!delete!", // old QK_OUTPUT_USB
|
||||
"0x7C22": "!delete!", // old QK_OUTPUT_BLUETOOTH
|
||||
"0x7C7B": {
|
||||
"group": "quantum",
|
||||
"key": "QK_LAYER_LOCK",
|
||||
"aliases": [
|
||||
"QK_LLCK"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +64,9 @@
|
||||
"WEAR_LEVELING_BACKING_SIZE": {"info_key": "eeprom.wear_leveling.backing_size", "value_type": "int", "to_json": false},
|
||||
"WEAR_LEVELING_LOGICAL_SIZE": {"info_key": "eeprom.wear_leveling.logical_size", "value_type": "int", "to_json": false},
|
||||
|
||||
// Layer locking
|
||||
"LAYER_LOCK_IDLE_TIMEOUT": {"info_key": "layer_lock.timeout", "value_type": "int"},
|
||||
|
||||
// Indicators
|
||||
"LED_CAPS_LOCK_PIN": {"info_key": "indicators.caps_lock"},
|
||||
"LED_NUM_LOCK_PIN": {"info_key": "indicators.num_lock"},
|
||||
|
@ -92,6 +92,7 @@
|
||||
"GD32VF103",
|
||||
"WB32F3G71",
|
||||
"WB32FQ95",
|
||||
"AT32F415",
|
||||
"atmega16u2",
|
||||
"atmega32u2",
|
||||
"atmega16u4",
|
||||
@ -216,6 +217,7 @@
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"apm32-dfu",
|
||||
"at32-dfu",
|
||||
"atmel-dfu",
|
||||
"bootloadhid",
|
||||
"caterina",
|
||||
@ -373,6 +375,12 @@
|
||||
}
|
||||
},
|
||||
"keycodes": {"$ref": "qmk.definitions.v1#/keycode_decl_array"},
|
||||
"layer_lock": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"timeout": {"$ref": "qmk.definitions.v1#/unsigned_int"}
|
||||
}
|
||||
},
|
||||
"layout_aliases": {
|
||||
"type": "object",
|
||||
"additionalProperties": {"$ref": "qmk.definitions.v1#/layout_macro"}
|
||||
|
@ -16,6 +16,8 @@
|
||||
"/tutorial": "/newbs",
|
||||
"/unicode": "/feature_unicode",
|
||||
|
||||
"/features/bluetooth": "/features/wireless",
|
||||
|
||||
"/adc_driver": "/drivers/adc",
|
||||
"/apa102_driver": "/drivers/apa102",
|
||||
"/audio_driver": "/drivers/audio",
|
||||
@ -24,7 +26,7 @@
|
||||
"/feature_auto_shift": "/features/auto_shift",
|
||||
"/feature_autocorrect": "/features/autocorrect",
|
||||
"/feature_backlight": "/features/backlight",
|
||||
"/feature_bluetooth": "/features/bluetooth",
|
||||
"/feature_bluetooth": "/features/wireless",
|
||||
"/feature_bootmagic": "/features/bootmagic",
|
||||
"/feature_caps_word": "/features/caps_word",
|
||||
"/feature_combo": "/features/combo",
|
||||
|
@ -123,6 +123,7 @@
|
||||
{ "text": "Key Lock", "link": "/features/key_lock" },
|
||||
{ "text": "Key Overrides", "link": "/features/key_overrides" },
|
||||
{ "text": "Layers", "link": "/feature_layers" },
|
||||
{ "text": "Layer Lock", "link": "/features/layer_lock" },
|
||||
{ "text": "One Shot Keys", "link": "/one_shot_keys" },
|
||||
{ "text": "OS Detection", "link": "/features/os_detection" },
|
||||
{ "text": "Raw HID", "link": "/features/rawhid" },
|
||||
@ -166,7 +167,6 @@
|
||||
]
|
||||
},
|
||||
{ "text": "Audio", "link": "/features/audio" },
|
||||
{ "text": "Bluetooth", "link": "/features/bluetooth" },
|
||||
{ "text": "Bootmagic", "link": "/features/bootmagic" },
|
||||
{ "text": "Converters", "link": "/feature_converters" },
|
||||
{ "text": "Custom Matrix", "link": "/custom_matrix" },
|
||||
@ -179,7 +179,8 @@
|
||||
{ "text": "Pointing Device", "link": "/features/pointing_device" },
|
||||
{ "text": "PS/2 Mouse", "link": "/features/ps2_mouse" },
|
||||
{ "text": "Split Keyboard", "link": "/features/split_keyboard" },
|
||||
{ "text": "Stenography", "link": "/features/stenography" }
|
||||
{ "text": "Stenography", "link": "/features/stenography" },
|
||||
{ "text": "Wireless", "link": "/features/wireless" }
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -4,7 +4,7 @@ This page attempts to introduce developers to the QMK Compiler. It does not go i
|
||||
|
||||
# Overview
|
||||
|
||||
The QMK Compile API consists of a few movings parts:
|
||||
The QMK Compile API consists of a few moving parts:
|
||||
|
||||
![Architecture Diagram](https://raw.githubusercontent.com/qmk/qmk_api/master/docs/architecture.svg)
|
||||
|
||||
|
@ -57,6 +57,10 @@ You can also use any ARM chip with USB that [ChibiOS](https://www.chibios.org) s
|
||||
* [WB32F3G71xx](http://www.westberrytech.com)
|
||||
* [WB32FQ95xx](http://www.westberrytech.com)
|
||||
|
||||
### Artery (AT32)
|
||||
|
||||
* [AT32F415](https://www.arterychip.com/en/product/AT32F415.jsp)
|
||||
|
||||
### NXP (Kinetis)
|
||||
|
||||
* [MKL26Z64](https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/kl-series-cortex-m0-plus/kinetis-kl2x-72-96-mhz-usb-ultra-low-power-microcontrollers-mcus-based-on-arm-cortex-m0-plus-core:KL2x)
|
||||
|
@ -98,6 +98,7 @@ The device name here is the name that appears in Zadig, and may not be what the
|
||||
|`bootloadhid` |HIDBoot |`16C0:05DF` |HidUsb |
|
||||
|`usbasploader`|USBasp |`16C0:05DC` |libusbK|
|
||||
|`apm32-dfu` |APM32 DFU ISP Mode |`314B:0106` |WinUSB |
|
||||
|`at32-dfu` |AT32 Bootloader DFU |`2E3C:DF11` |WinUSB |
|
||||
|`stm32-dfu` |STM32 BOOTLOADER |`0483:DF11` |WinUSB |
|
||||
|`gd32v-dfu` |GD32V BOOTLOADER |`28E9:0189` |WinUSB |
|
||||
|`kiibohd` |Kiibohd DFU Bootloader |`1C11:B007` |WinUSB |
|
||||
|
@ -57,27 +57,32 @@ This driver needs one Timer per enabled/used DAC channel, to trigger conversion;
|
||||
|
||||
Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timers 6, 7 and 8:
|
||||
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_DAC TRUE
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_DAC TRUE // [!code focus]
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_DAC_USE_DAC1_CH1
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE
|
||||
#undef STM32_DAC_USE_DAC1_CH2
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE
|
||||
#undef STM32_GPT_USE_TIM6
|
||||
#define STM32_GPT_USE_TIM6 TRUE
|
||||
#undef STM32_GPT_USE_TIM7
|
||||
#define STM32_GPT_USE_TIM7 TRUE
|
||||
#undef STM32_GPT_USE_TIM8
|
||||
#define STM32_GPT_USE_TIM8 TRUE
|
||||
|
||||
#undef STM32_DAC_USE_DAC1_CH1 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE // [!code focus]
|
||||
#undef STM32_DAC_USE_DAC1_CH2 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM6 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM6 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM7 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM7 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM8 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM8 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
::: tip
|
||||
Note: DAC1 (A4) uses TIM6, DAC2 (A5) uses TIM7, and the audio state timer uses TIM8 (configurable).
|
||||
@ -95,23 +100,28 @@ only needs one timer (GPTD6, Tim6) to trigger the DAC unit to do a conversion; t
|
||||
|
||||
Additionally, in the board config, you'll want to make changes to enable the DACs, GPT for Timer 6:
|
||||
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_DAC TRUE
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_DAC TRUE // [!code focus]
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_DAC_USE_DAC1_CH1
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE
|
||||
#undef STM32_DAC_USE_DAC1_CH2
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE
|
||||
#undef STM32_GPT_USE_TIM6
|
||||
#define STM32_GPT_USE_TIM6 TRUE
|
||||
|
||||
#undef STM32_DAC_USE_DAC1_CH1 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH1 TRUE // [!code focus]
|
||||
#undef STM32_DAC_USE_DAC1_CH2 // [!code focus]
|
||||
#define STM32_DAC_USE_DAC1_CH2 TRUE // [!code focus]
|
||||
#undef STM32_GPT_USE_TIM6 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM6 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
### DAC Config
|
||||
|
||||
@ -170,19 +180,25 @@ This driver uses the ChibiOS-PWM system to produce a square-wave on specific out
|
||||
The hardware directly toggles the pin via its alternate function. See your MCU's data-sheet for which pin can be driven by what timer - looking for TIMx_CHy and the corresponding alternate function.
|
||||
|
||||
A configuration example for the STM32F103C8 would be:
|
||||
```c
|
||||
//halconf.h:
|
||||
#define HAL_USE_PWM TRUE
|
||||
#define HAL_USE_PAL TRUE
|
||||
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
#define HAL_USE_PAL TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
```c
|
||||
// mcuconf.h:
|
||||
#include_next <mcuconf.h>
|
||||
#undef STM32_PWM_USE_TIM1
|
||||
#define STM32_PWM_USE_TIM1 TRUE
|
||||
|
||||
#undef STM32_PWM_USE_TIM1 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM1 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
If we now target pin A8, looking through the data-sheet of the STM32F103C8, for the timers and alternate functions
|
||||
- TIM1_CH1 = PA8 <- alternate0
|
||||
|
@ -54,18 +54,25 @@ The ATmega16/32U2 does not possess I2C functionality, and so cannot use this dri
|
||||
|
||||
You'll need to determine which pins can be used for I2C -- a an example, STM32 parts generally have multiple I2C peripherals, labeled I2C1, I2C2, I2C3 etc.
|
||||
|
||||
To enable I2C, modify your board's `halconf.h` to enable I2C:
|
||||
To enable I2C, modify your board's `halconf.h` to enable I2C, then modify your board's `mcuconf.h` to enable the peripheral you've chosen:
|
||||
|
||||
```c
|
||||
#define HAL_USE_I2C TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
```c
|
||||
#undef STM32_I2C_USE_I2C2
|
||||
#define STM32_I2C_USE_I2C2 TRUE
|
||||
#undef STM32_I2C_USE_I2C2 // [!code focus]
|
||||
#define STM32_I2C_USE_I2C2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
|`mcuconf.h` Setting |Description |Default|
|
||||
|----------------------------|----------------------------------------------------------------------------------|-------|
|
||||
|
@ -12,8 +12,6 @@ The Serial driver powers the [Split Keyboard](../features/split_keyboard) featur
|
||||
Serial in this context should be read as **sending information one bit at a time**, rather than implementing UART/USART/RS485/RS232 standards.
|
||||
:::
|
||||
|
||||
<hr>
|
||||
|
||||
## Bitbang
|
||||
|
||||
This is the Default driver, absence of configuration assumes this driver. It works by [bit banging](https://en.wikipedia.org/wiki/Bit_banging) a GPIO pin using the CPU. It is therefore not as efficient as a dedicated hardware peripheral, which the Half-duplex and Full-duplex drivers use.
|
||||
@ -53,11 +51,15 @@ SERIAL_DRIVER = bitbang
|
||||
#define SOFT_SERIAL_PIN D0 // or D1, D2, D3, E6
|
||||
```
|
||||
|
||||
3. On ARM platforms you must turn on ChibiOS `PAL_USE_CALLBACKS` feature:
|
||||
3. On ARM platforms you must turn on ChibiOS PAL callbacks:
|
||||
|
||||
* In `halconf.h` add the line `#define PAL_USE_CALLBACKS TRUE`.
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
<hr>
|
||||
#define PAL_USE_CALLBACKS TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
## USART Half-duplex
|
||||
|
||||
@ -117,8 +119,6 @@ For STM32 MCUs several GPIO configuration options can be changed as well. See th
|
||||
|
||||
4. Decide either for `SERIAL`, `SIO`, or `PIO` subsystem. See section ["Choosing a driver subsystem"](#choosing-a-driver-subsystem).
|
||||
|
||||
<hr>
|
||||
|
||||
## USART Full-duplex
|
||||
|
||||
Targeting ARM boards based on ChibiOS where communication is offloaded to an USART hardware device. The advantages over bitbanging are fast, accurate timings and reduced CPU usage; therefore it is advised to choose this driver over all others where possible. Due to its internal design Full-duplex is slightly more efficient than the Half-duplex driver, but Full-duplex should be primarily chosen if Half-duplex operation is not supported by the controller's USART peripheral.
|
||||
@ -179,34 +179,42 @@ For STM32 MCUs several GPIO configuration options, including the ability for `TX
|
||||
|
||||
4. Decide either for `SERIAL`, `SIO`, or `PIO` subsystem. See section ["Choosing a driver subsystem"](#choosing-a-driver-subsystem).
|
||||
|
||||
<hr>
|
||||
|
||||
## Choosing a driver subsystem
|
||||
|
||||
### The `SERIAL` driver
|
||||
|
||||
The `SERIAL` Subsystem is supported for the majority of ChibiOS MCUs and should be used whenever supported. Follow these steps in order to activate it:
|
||||
|
||||
1. In your keyboards `halconf.h` add:
|
||||
1. Enable the SERIAL subsystem in the ChibiOS HAL.
|
||||
|
||||
Add the following to your keyboard's `halconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#define HAL_USE_SERIAL TRUE
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SERIAL TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
2. In your keyboards `mcuconf.h`: activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
2. Activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
Just below `#include_next <mcuconf.h>` add:
|
||||
Add the following to your keyboard's `mcuconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SERIAL_USE_USARTn
|
||||
#define STM32_SERIAL_USE_USARTn TRUE
|
||||
#undef STM32_SERIAL_USE_USARTn // [!code focus]
|
||||
#define STM32_SERIAL_USE_USARTn TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Where 'n' matches the peripheral number of your selected USART on the MCU.
|
||||
Where *n* matches the peripheral number of your selected USART on the MCU.
|
||||
|
||||
3. In you keyboards `config.h`: override the default USART `SERIAL` driver if you use a USART peripheral that does not belong to the default selected `SD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SD3`.
|
||||
3. Override the default USART `SERIAL` driver if you use a USART peripheral that does not belong to the default selected `SD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SD3`.
|
||||
|
||||
Add the following to your keyboard's `config.h`:
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SD3
|
||||
@ -218,26 +226,36 @@ The `SIO` Subsystem was added to ChibiOS with the 21.11 release and is only supp
|
||||
|
||||
Follow these steps in order to activate it:
|
||||
|
||||
1. In your keyboards `halconf.h` add:
|
||||
1. Enable the SIO subsystem in the ChibiOS HAL.
|
||||
|
||||
Add the following to your keyboard's `halconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#define HAL_USE_SIO TRUE
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SIO TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
2. In your keyboards `mcuconf.h:` activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
2. Activate the USART peripheral that is used on your MCU. The shown example is for an STM32 MCU, so this will not work on MCUs by other manufacturers. You can find the correct names in the `mcuconf.h` files of your MCU that ship with ChibiOS.
|
||||
|
||||
Just below `#include_next <mcuconf.h>` add:
|
||||
Add the following to your keyboard's `mcuconf.h`, creating it if necessary:
|
||||
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SIO_USE_USARTn
|
||||
#define STM32_SIO_USE_USARTn TRUE
|
||||
#undef STM32_SIO_USE_USARTn // [!code focus]
|
||||
#define STM32_SIO_USE_USARTn TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Where 'n' matches the peripheral number of your selected USART on the MCU.
|
||||
Where *n* matches the peripheral number of your selected USART on the MCU.
|
||||
|
||||
3. In the keyboard's `config.h` file: override the default USART `SIO` driver if you use a USART peripheral that does not belong to the default selected `SIOD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SIOD3`.
|
||||
3. Override the default USART `SIO` driver if you use a USART peripheral that does not belong to the default selected `SIOD1` driver. For instance, if you selected `STM32_SERIAL_USE_USART3` the matching driver would be `SIOD3`.
|
||||
|
||||
Add the following to your keyboard's `config.h`:
|
||||
|
||||
```c
|
||||
#define SERIAL_USART_DRIVER SIOD3
|
||||
@ -254,8 +272,6 @@ Optionally, the PIO peripheral utilized for split communication can be changed w
|
||||
|
||||
The Serial PIO program uses 2 state machines, 13 instructions and the complete interrupt handler of the PIO peripheral it is running on.
|
||||
|
||||
<hr>
|
||||
|
||||
## Advanced Configuration
|
||||
|
||||
There are several advanced configuration options that can be defined in your keyboards `config.h` file:
|
||||
@ -265,9 +281,11 @@ There are several advanced configuration options that can be defined in your key
|
||||
If you're having issues or need a higher baudrate with serial communication, you can change the baudrate which in turn controls the communication speed for serial. You want to lower the baudrate if you experience failed transactions.
|
||||
|
||||
```c
|
||||
#define SELECT_SOFT_SERIAL_SPEED {#}
|
||||
#define SELECT_SOFT_SERIAL_SPEED n
|
||||
```
|
||||
|
||||
Where *n* is one of:
|
||||
|
||||
| Speed | Bitbang | Half-duplex and Full-duplex |
|
||||
| ----- | -------------------------- | --------------------------- |
|
||||
| `0` | 189000 baud (experimental) | 460800 baud |
|
||||
@ -287,8 +305,6 @@ This is the default time window in milliseconds in which a successful communicat
|
||||
#define SERIAL_USART_TIMEOUT 20 // USART driver timeout. default 20
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you're having issues withe serial communication, you can enable debug messages that will give you insights which part of the communication failed. The enable these messages add to your keyboards `config.h` file:
|
||||
|
@ -32,20 +32,27 @@ You may use more than one slave select pin, not just the `SS` pin. This is usefu
|
||||
|
||||
You'll need to determine which pins can be used for SPI -- as an example, STM32 parts generally have multiple SPI peripherals, labeled SPI1, SPI2, SPI3 etc.
|
||||
|
||||
To enable SPI, modify your board's `halconf.h` to enable SPI:
|
||||
To enable SPI, modify your board's `halconf.h` to enable SPI, then modify your board's `mcuconf.h` to enable the peripheral you've chosen:
|
||||
|
||||
```c
|
||||
#define HAL_USE_SPI TRUE
|
||||
#define SPI_USE_WAIT TRUE
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SPI TRUE // [!code focus]
|
||||
#define SPI_USE_WAIT TRUE // [!code focus]
|
||||
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
Then, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
```c
|
||||
#undef STM32_SPI_USE_SPI2
|
||||
#define STM32_SPI_USE_SPI2 TRUE
|
||||
#undef STM32_SPI_USE_SPI2 // [!code focus]
|
||||
#define STM32_SPI_USE_SPI2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||
|
||||
|
@ -35,8 +35,12 @@ You'll need to determine which pins can be used for UART -- as an example, STM32
|
||||
To enable UART, modify your board's `mcuconf.h` to enable the peripheral you've chosen, for example:
|
||||
|
||||
```c
|
||||
#undef STM32_SERIAL_USE_USART2
|
||||
#define STM32_SERIAL_USE_USART2 TRUE
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SERIAL_USE_USART2 // [!code focus]
|
||||
#define STM32_SERIAL_USE_USART2 TRUE // [!code focus]
|
||||
```
|
||||
|
||||
Configuration-wise, you'll need to set up the peripheral as per your MCU's datasheet -- the defaults match the pins for a Proton-C, i.e. STM32F303.
|
||||
|
@ -160,15 +160,23 @@ To configure the DI pin for open drain configuration, add the following to your
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable SPI at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_SPI TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_SPI TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_SPI_USE_SPI1
|
||||
#define STM32_SPI_USE_SPI1 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_SPI_USE_SPI1 // [!code focus]
|
||||
#define STM32_SPI_USE_SPI1 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `define`s apply only to the `spi` driver:
|
||||
|
||||
@ -213,15 +221,23 @@ The following `#define`s apply only to the PIO driver:
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable PWM at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_PWM TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_PWM_USE_TIM2
|
||||
#define STM32_PWM_USE_TIM2 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_PWM_USE_TIM2 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM2 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `pwm` driver:
|
||||
|
||||
|
@ -11,7 +11,7 @@ These allow you to combine a modifier with a keycode. When pressed, the keydown
|
||||
|`RCTL(kc)`| |Hold Right Control and press `kc` |
|
||||
|`RSFT(kc)`| |Hold Right Shift and press `kc` |
|
||||
|`RALT(kc)`|`ROPT(kc)`, `ALGR(kc)` |Hold Right Alt and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `LWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`RGUI(kc)`|`RCMD(kc)`, `RWIN(kc)` |Hold Right GUI and press `kc` |
|
||||
|`LSG(kc)` |`SGUI(kc)`, `SCMD(kc)`, `SWIN(kc)`|Hold Left Shift and GUI and press `kc` |
|
||||
|`LAG(kc)` | |Hold Left Alt and Left GUI and press `kc` |
|
||||
|`RSG(kc)` | |Hold Right Shift and Right GUI and press `kc` |
|
||||
|
@ -17,6 +17,9 @@ These functions allow you to activate layers in various ways. Note that layers a
|
||||
* `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.
|
||||
|
||||
See also the [Layer Lock key](features/layer_lock), which locks the highest
|
||||
active layer until pressed again.
|
||||
|
||||
### Caveats {#caveats}
|
||||
|
||||
Currently, the `layer` argument of `LT()` is limited to layers 0-15, and the `kc` argument to the [Basic Keycode set](keycodes_basic), meaning you can't use keycodes like `LCTL()`, `KC_TILD`, or anything greater than `0xFF`. This is because QMK uses 16-bit keycodes, of which 4 bits are used for the function identifier and 4 bits for the layer, leaving only 8 bits for the keycode.
|
||||
|
@ -42,38 +42,7 @@ You can define up to 32 macros in a `keymap.json` file, as used by [Configurator
|
||||
|
||||
### Selecting Your Host Keyboard Layout
|
||||
|
||||
If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros - you may need to type different keys to get the same letters! To address this you can add the `host_language` key to your `keymap.json`, like so:
|
||||
|
||||
```json
|
||||
{
|
||||
"keyboard": "handwired/my_macropad",
|
||||
"keymap": "my_keymap",
|
||||
"host_language": "dvorak",
|
||||
"macros": [
|
||||
["Hello, World!"]
|
||||
],
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
["QK_MACRO_0"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The current list of available languages is:
|
||||
|
||||
| belgian | bepo | br_abnt2 | canadian_multilingual |
|
||||
|:-------:|:----:|:--------:|:---------------------:|
|
||||
| **colemak** | **croatian** | **czech** | **danish** |
|
||||
| **dvorak_fr** | **dvorak** | **dvp** | **estonian** |
|
||||
| **finnish** | **fr_ch** | **french_afnor** | **french** |
|
||||
| **french_osx** | **german_ch** | **german** | **german_osx** |
|
||||
| **hungarian** | **icelandic** | **italian** | **italian_osx_ansi** |
|
||||
| **italian_osx_iso** | **jis** | **latvian** | **lithuanian_azerty** |
|
||||
| **lithuanian_qwerty** | **norman** | **norwegian** | **portuguese** |
|
||||
| **portuguese_osx_iso** | **romanian** | **serbian_latin** | **slovak** |
|
||||
| **slovenian** | **spanish_dvorak** | **spanish_latin_america** | **spanish** |
|
||||
| **swedish** | **turkish_f** | **turkish_q** | **uk** |
|
||||
| **us_international** | **workman** | **workman_zxcvm** |
|
||||
If you type in a language other than English, or use a non-QWERTY layout like Colemak, Dvorak, or Workman, you may have set your computer's input language to match this layout. This presents a challenge when creating macros — you may need to type different keys to get the same letters! To address this you can use [language-specific keycodes](reference_keymap_extras).
|
||||
|
||||
### Macro Basics
|
||||
|
||||
|
@ -161,15 +161,23 @@ Note that the choice of timer may conflict with the [Audio](audio) feature.
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable PWM at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_PWM TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_PWM TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_PWM_USE_TIM4
|
||||
#define STM32_PWM_USE_TIM4 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_PWM_USE_TIM4 // [!code focus]
|
||||
#define STM32_PWM_USE_TIM4 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `pwm` driver:
|
||||
|
||||
@ -187,15 +195,23 @@ Refer to the ST datasheet for your particular MCU to determine these values. For
|
||||
|
||||
Depending on the ChibiOS board configuration, you may need to enable general-purpose timers at the keyboard level. For STM32, this would look like:
|
||||
|
||||
`halconf.h`:
|
||||
```c
|
||||
#define HAL_USE_GPT TRUE
|
||||
::: code-group
|
||||
```c [halconf.h]
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_GPT TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
`mcuconf.h`:
|
||||
```c
|
||||
#undef STM32_GPT_USE_TIM15
|
||||
#define STM32_GPT_USE_TIM15 TRUE
|
||||
```c [mcuconf.h]
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef STM32_GPT_USE_TIM15 // [!code focus]
|
||||
#define STM32_GPT_USE_TIM15 TRUE // [!code focus]
|
||||
```
|
||||
:::
|
||||
|
||||
The following `#define`s apply only to the `timer` driver:
|
||||
|
||||
|
139
docs/features/layer_lock.md
Normal file
139
docs/features/layer_lock.md
Normal file
@ -0,0 +1,139 @@
|
||||
# Layer Lock
|
||||
|
||||
Some [layer switches](../feature_layers#switching-and-toggling-layers) access
|
||||
the layer by holding the key, including momentary layer `MO(layer)` and layer
|
||||
tap `LT(layer, key)` keys. You may sometimes need to stay on the layer for a
|
||||
long period of time. Layer Lock "locks" the current layer to stay on, supposing
|
||||
it was accessed by one of:
|
||||
|
||||
* `MO(layer)` momentary layer switch
|
||||
* `LT(layer, key)` layer tap
|
||||
* `OSL(layer)` one-shot layer
|
||||
* `TT(layer)` layer tap toggle
|
||||
* `LM(layer, mod)` layer-mod key (the layer is locked, but not the mods)
|
||||
|
||||
Press the Layer Lock key again to unlock the layer. Additionally, when a layer
|
||||
is locked, layer switch keys that turn off the layer such as `TO(other_layer)`
|
||||
will unlock it.
|
||||
|
||||
|
||||
## How do I enable Layer Lock
|
||||
|
||||
In your rules.mk, add:
|
||||
|
||||
```make
|
||||
LAYER_LOCK_ENABLE = yes
|
||||
```
|
||||
|
||||
Pick a key in your keymap on a layer you intend to lock, and assign it the
|
||||
keycode `QK_LAYER_LOCK` (short alias `QK_LLCK`). Note that locking the base
|
||||
layer has no effect, so typically, this key is used on layers above the base
|
||||
layer.
|
||||
|
||||
|
||||
## Example use
|
||||
|
||||
Consider a keymap with the following base layer.
|
||||
|
||||
![Base layer with a MO(NAV) key.](https://i.imgur.com/DkEhj9x.png)
|
||||
|
||||
The highlighted key is a momentary layer switch `MO(NAV)`. Holding it accesses a
|
||||
navigation layer.
|
||||
|
||||
![Nav layer with a Layer Lock key.](https://i.imgur.com/2wUZNWk.png)
|
||||
|
||||
|
||||
Holding the NAV key is fine for brief use, but awkward to continue holding when
|
||||
using navigation functions continuously. The Layer Lock key comes to the rescue:
|
||||
|
||||
1. Hold the NAV key, activating the navigation layer.
|
||||
2. Tap Layer Lock.
|
||||
3. Release NAV. The navigation layer stays on.
|
||||
4. Make use of the arrow keys, etc.
|
||||
5. Tap Layer Lock or NAV again to turn the navigation layer back off.
|
||||
|
||||
A variation that would also work is to put the Layer Lock key on the base layer
|
||||
and make other layers transparent (`KC_TRNS`) in that position. Pressing the
|
||||
Layer Lock key locks (or unlocks) the highest active layer, regardless of which
|
||||
layer the Layer Lock key is on.
|
||||
|
||||
|
||||
## Idle timeout
|
||||
|
||||
Optionally, Layer Lock may be configured to unlock if the keyboard is idle
|
||||
for some time. In config.h, define `LAYER_LOCK_IDLE_TIMEOUT` in units of
|
||||
milliseconds:
|
||||
|
||||
```c
|
||||
#define LAYER_LOCK_IDLE_TIMEOUT 60000 // Turn off after 60 seconds.
|
||||
```
|
||||
|
||||
|
||||
## Functions
|
||||
|
||||
Use the following functions to query and manipulate the layer lock state.
|
||||
|
||||
| Function | Description |
|
||||
|----------------------------|------------------------------------|
|
||||
| `is_layer_locked(layer)` | Checks whether `layer` is locked. |
|
||||
| `layer_lock_on(layer)` | Locks and turns on `layer`. |
|
||||
| `layer_lock_off(layer)` | Unlocks and turns off `layer`. |
|
||||
| `layer_lock_invert(layer)` | Toggles whether `layer` is locked. |
|
||||
|
||||
|
||||
## Representing the current Layer Lock state
|
||||
|
||||
There is an optional callback `layer_lock_set_user()` that gets called when a
|
||||
layer is locked or unlocked. This is useful to represent the current lock state
|
||||
for instance by setting an LED. In keymap.c, define
|
||||
|
||||
```c
|
||||
bool layer_lock_set_user(layer_state_t locked_layers) {
|
||||
// Do something like `set_led(is_layer_locked(NAV));`
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
The argument `locked_layers` is a bitfield in which the kth bit is on if the kth
|
||||
layer is locked. Alternatively, you can use `is_layer_locked(layer)` to check if
|
||||
a given layer is locked.
|
||||
|
||||
|
||||
## Combine Layer Lock with a mod-tap
|
||||
|
||||
It is possible to create a [mod-tap MT key](../mod_tap) that acts as a modifier
|
||||
on hold and Layer Lock on tap. Since Layer Lock is not a [basic
|
||||
keycode](../keycodes_basic), attempting `MT(mod, QK_LLCK)` is invalid does not
|
||||
work directly, yet this effect can be achieved through [changing the tap
|
||||
function](../mod_tap#changing-tap-function). For example, the following
|
||||
implements a `SFTLLCK` key that acts as Shift on hold and Layer Lock on tap:
|
||||
|
||||
```c
|
||||
#define SFTLLCK LSFT_T(KC_0)
|
||||
|
||||
// Use SFTLLCK in your keymap...
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case SFTLLCK:
|
||||
if (record->tap.count) {
|
||||
if (record->event.pressed) {
|
||||
// Toggle the lock on the highest layer.
|
||||
layer_lock_invert(get_highest_layer(layer_state));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
|
||||
// Other macros...
|
||||
}
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
In the above, `KC_0` is an arbitrary placeholder for the tapping keycode. This
|
||||
keycode will never be sent, so any basic keycode will do. In
|
||||
`process_record_user()`, the tap press event is changed to toggle the lock on
|
||||
the highest layer. Layer Lock can be combined with a [layer-tap LT
|
||||
key](../feature_layers#switching-and-toggling-layers) similarly.
|
||||
|
@ -90,18 +90,22 @@ PS2_ENABLE = yes
|
||||
PS2_DRIVER = interrupt
|
||||
```
|
||||
|
||||
In your keyboard config.h:
|
||||
In your keyboard `config.h`:
|
||||
|
||||
```c
|
||||
#define PS2_CLOCK_PIN A8
|
||||
#define PS2_DATA_PIN A9
|
||||
```
|
||||
|
||||
And in the chibios specifig halconf.h:
|
||||
```c
|
||||
#define PAL_USE_CALLBACKS TRUE
|
||||
```
|
||||
And in the ChibiOS specific `halconf.h`:
|
||||
|
||||
```c
|
||||
#pragma once
|
||||
|
||||
#define PAL_USE_CALLBACKS TRUE // [!code focus]
|
||||
|
||||
#include_next <halconf.h>
|
||||
```
|
||||
|
||||
### USART Version {#usart-version}
|
||||
|
||||
|
@ -59,6 +59,10 @@ Changing the **Value** sets the overall brightness.<br>
|
||||
|
||||
## Keycodes
|
||||
|
||||
::: warning
|
||||
These keycodes also simultaneously control [RGB Matrix](rgb_matrix), if enabled. This behaviour is in the process of being deprecated, so during this time it is recommended to additionally include the dedicated RGB Matrix keycodes to your keymap, and add `#define RGB_MATRIX_DISABLE_SHARED_KEYCODES` to `config.h`.
|
||||
:::
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------------------------|----------|---------------------------------------------------------------------|
|
||||
|`QK_UNDERGLOW_TOGGLE` |`UG_TOGG` |Toggle RGB lighting on or off |
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Bluetooth
|
||||
# Wireless / Bluetooth
|
||||
|
||||
## Bluetooth Known Supported Hardware
|
||||
|
||||
@ -40,7 +40,19 @@ BLUETOOTH_DRIVER = bluefruit_le # or rn42
|
||||
This is used when multiple keyboard outputs can be selected. Currently this only allows for switching between USB and Bluetooth on keyboards that support both.
|
||||
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------|----------------------|------------------------------------------------|
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |
|
||||
|-----------------------------|-----------|-----------------------------------------------------------------------------------------------|
|
||||
| `QK_OUTPUT_AUTO` | `OU_AUTO` | Automatically switch to USB when plugged in, otherwise use wireless |
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT` | Cycle forwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_PREV` | `OU_PREV` | Cycle backwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_NONE` | `OU_NONE` | Disable all output **(not yet implemented)** |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | Output to USB only |
|
||||
| `QK_OUTPUT_2P4GHZ` | `OU_2P4G` | Output to 2.4GHz only **(not yet implemented)** |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Output to Bluetooth only |
|
||||
| `QK_BLUETOOTH_PROFILE_NEXT` | `BT_NEXT` | Move to the next Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE_PREV` | `BT_PREV` | Move to the previous Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_UNPAIR` | `BT_UNPR` | Un-pair the current Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE1` | `BT_PRF1` | Swap to Bluetooth profile #1 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE2` | `BT_PRF2` | Swap to Bluetooth profile #2 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE3` | `BT_PRF3` | Swap to Bluetooth profile #3 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE4` | `BT_PRF4` | Swap to Bluetooth profile #4 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE5` | `BT_PRF5` | Swap to Bluetooth profile #5 **(not yet implemented)** |
|
@ -345,6 +345,39 @@ Flashing sequence:
|
||||
3. Flash a .bin file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
## AT32 DFU
|
||||
|
||||
All AT32 MCUs come preloaded with a factory bootloader that cannot be modified nor deleted.
|
||||
|
||||
To ensure compatibility with the AT32-DFU bootloader, make sure this block is present in your `rules.mk`:
|
||||
|
||||
```make
|
||||
# Bootloader selection
|
||||
BOOTLOADER = at32-dfu
|
||||
```
|
||||
|
||||
Compatible flashers:
|
||||
|
||||
* [dfu-util](https://dfu-util.sourceforge.net/) / `:dfu-util` target in QMK (recommended command line)
|
||||
```
|
||||
dfu-util -a 0 -d 2E3C:DF11 -s 0x8000000:leave -D <filename>
|
||||
```
|
||||
|
||||
Flashing sequence:
|
||||
|
||||
1. Enter the bootloader using any of the following methods:
|
||||
* Tap the `QK_BOOT` keycode
|
||||
* If a reset circuit is present, tap the `RESET` button on the PCB; some boards may also have a toggle switch that must be flipped
|
||||
* Otherwise, you need to bridge `BOOT0` to VCC (via `BOOT0` button or jumper), short `RESET` to GND (via `RESET` button or jumper), and then let go of the `BOOT0` bridge
|
||||
2. Wait for the OS to detect the device
|
||||
3. Flash a .bin file
|
||||
4. Reset the device into application mode (may be done automatically)
|
||||
|
||||
### `make` Targets
|
||||
|
||||
* `:dfu-util`: Waits until an AT32 bootloader device is available, and then flashes the firmware.
|
||||
* `:dfu-util-split-left` and `:dfu-util-split-right`: Flashes the firmware as with `:dfu-util`, but also sets the handedness setting in EEPROM.
|
||||
|
||||
## tinyuf2
|
||||
|
||||
Keyboards may opt into supporting the tinyuf2 bootloader. This is currently only supported on F303/F401/F411.
|
||||
|
@ -290,15 +290,27 @@ See also: [Backlighting](features/backlight)
|
||||
| `QK_BACKLIGHT_DOWN` | `BL_DOWN` | Decrease the backlight level |
|
||||
| `QK_BACKLIGHT_TOGGLE_BREATHING` | `BL_BRTG` | Toggle backlight breathing |
|
||||
|
||||
## Bluetooth {#bluetooth}
|
||||
## Wireless/Bluetooth {#bluetooth}
|
||||
|
||||
See also: [Bluetooth](features/bluetooth)
|
||||
See also: [Wireless](features/wireless)
|
||||
|
||||
| Key | Aliases | Description |
|
||||
|-----------------------|----------------------|------------------------------------------------|
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT`, `OU_AUTO` | Automatically switch between USB and Bluetooth |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | USB only |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Bluetooth only |
|
||||
|-----------------------------|-----------|-----------------------------------------------------------------------------------------------|
|
||||
| `QK_OUTPUT_AUTO` | `OU_AUTO` | Automatically switch to USB when plugged in, otherwise use wireless |
|
||||
| `QK_OUTPUT_NEXT` | `OU_NEXT` | Cycle forwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_PREV` | `OU_PREV` | Cycle backwards through USB, Bluetooth, and 2.4GHz (when available) **(not yet implemented)** |
|
||||
| `QK_OUTPUT_NONE` | `OU_NONE` | Disable all output **(not yet implemented)** |
|
||||
| `QK_OUTPUT_USB` | `OU_USB` | Output to USB only |
|
||||
| `QK_OUTPUT_2P4GHZ` | `OU_2P4G` | Output to 2.4GHz only **(not yet implemented)** |
|
||||
| `QK_OUTPUT_BLUETOOTH` | `OU_BT` | Output to Bluetooth only |
|
||||
| `QK_BLUETOOTH_PROFILE_NEXT` | `BT_NEXT` | Move to the next Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE_PREV` | `BT_PREV` | Move to the previous Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_UNPAIR` | `BT_UNPR` | Un-pair the current Bluetooth profile **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE1` | `BT_PRF1` | Swap to Bluetooth profile #1 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE2` | `BT_PRF2` | Swap to Bluetooth profile #2 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE3` | `BT_PRF3` | Swap to Bluetooth profile #3 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE4` | `BT_PRF4` | Swap to Bluetooth profile #4 **(not yet implemented)** |
|
||||
| `QK_BLUETOOTH_PROFILE5` | `BT_PRF5` | Swap to Bluetooth profile #5 **(not yet implemented)** |
|
||||
|
||||
## Caps Word {#caps-word}
|
||||
|
||||
@ -375,6 +387,14 @@ See also: [Key Lock](features/key_lock)
|
||||
|---------|--------------------------------------------------------------|
|
||||
|`QK_LOCK`|Hold down the next key pressed, until the key is pressed again|
|
||||
|
||||
## Layer Lock {#layer-lock}
|
||||
|
||||
See also: [Layer Lock](features/layer_lock)
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|---------------|---------|----------------------------------|
|
||||
|`QK_LAYER_LOCK`|`QK_LLCK`|Locks or unlocks the highest layer|
|
||||
|
||||
## Layer Switching {#layer-switching}
|
||||
|
||||
See also: [Layer Switching](feature_layers#switching-and-toggling-layers)
|
||||
|
@ -4,52 +4,51 @@ This page describes the support for [Compatible Microcontrollers](compatible_mic
|
||||
|
||||
If you have not yet you should read the [Keyboard Guidelines](hardware_keyboard_guidelines) to get a sense of how keyboards fit into QMK.
|
||||
|
||||
|
||||
QMK has a number of features to simplify working with keyboards. For most, you don't have to write a single line of code. To get started, run `qmk new-keyboard`:
|
||||
|
||||
```
|
||||
$ qmk new-keyboard
|
||||
Ψ Generating a new QMK keyboard directory
|
||||
|
||||
Name Your Keyboard Project
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboardproject
|
||||
|
||||
keyboard Name? mycoolkeeb
|
||||
|
||||
Attribution
|
||||
Used for maintainer, copyright, etc
|
||||
|
||||
Ψ Name Your Keyboard Project
|
||||
Ψ For more information, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboard-project
|
||||
Keyboard Name? mycoolkeeb
|
||||
Ψ Attribution
|
||||
Ψ Used for maintainer, copyright, etc.
|
||||
Your GitHub Username? [jsmith]
|
||||
|
||||
More Attribution
|
||||
Used for maintainer, copyright, etc
|
||||
|
||||
Ψ More Attribution
|
||||
Ψ Used for maintainer, copyright, etc.
|
||||
Your Real Name? [John Smith]
|
||||
|
||||
Pick Base Layout
|
||||
As a starting point, one of the common layouts can be used to bootstrap the process
|
||||
|
||||
Ψ Pick Base Layout
|
||||
Ψ As a starting point, one of the common layouts can be used to
|
||||
bootstrap the process
|
||||
Default Layout?
|
||||
1. 60_ansi
|
||||
1. 60_abnt2
|
||||
...
|
||||
50. tkl_iso
|
||||
51. none of the above
|
||||
Please enter your choice: [51]
|
||||
65. none of the above
|
||||
Please enter your choice: [65]
|
||||
Ψ What Powers Your Project
|
||||
Ψ Is your board using a separate development board, such as a Pro Micro,
|
||||
or is the microcontroller integrated onto the PCB?
|
||||
|
||||
What Powers Your Project
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/#/compatible_microcontrollers
|
||||
|
||||
MCU?
|
||||
1. atmega32u4
|
||||
For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers
|
||||
Using a Development Board? [y/n] y
|
||||
Ψ Select Development Board
|
||||
Ψ For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers
|
||||
Development Board?
|
||||
1. bit_c_pro
|
||||
...
|
||||
22. STM32F303
|
||||
Please enter your choice: [12]
|
||||
14. promicro
|
||||
...
|
||||
18. svlinky
|
||||
Please enter your choice: [14]
|
||||
Ψ Created a new keyboard called mycoolkeeb.
|
||||
Ψ To start working on things, `cd` into keyboards/mycoolkeeb,
|
||||
Ψ or open the directory in your preferred text editor.
|
||||
Ψ And build with qmk compile -kb mycoolkeeb -km default.
|
||||
Ψ Build Command: qmk compile -kb mycoolkeeb -km default.
|
||||
Ψ Project Location: /Users/jsmith/qmk_firmware/keyboards/mycoolkeeb.
|
||||
Ψ Now update the config files to match the hardware!
|
||||
```
|
||||
|
||||
This will create all the files needed to support your new keyboard, and populate the settings with default values. Now you just need to customize it for your keyboard.
|
||||
@ -58,13 +57,13 @@ This will create all the files needed to support your new keyboard, and populate
|
||||
|
||||
This is where you'll describe your keyboard. Please follow the [Keyboard Readme Template](documentation_templates#keyboard-readmemd-template) when writing your `readme.md`. You're encouraged to place an image at the top of your `readme.md`, please use an external service such as [Imgur](https://imgur.com) to host the images.
|
||||
|
||||
## `info.json`
|
||||
## `keyboard.json`
|
||||
|
||||
The `info.json` file is where you configure the hardware and feature set for your keyboard. There are a lot of options that can be placed in that file, too many to list here. For a complete overview of available options see the [Data Driven Configuration Options](reference_info_json) page.
|
||||
The `keyboard.json` file is where you configure the hardware and feature set for your keyboard. There are a lot of options that can be placed in that file, too many to list here. For a complete overview of available options see the [Data Driven Configuration Options](reference_info_json) page.
|
||||
|
||||
### Hardware Configuration
|
||||
|
||||
At the top of the `info.json` you'll find USB related settings. These control how your keyboard appears to the Operating System. If you don't have a good reason to change you should leave the `usb.vid` as `0xFEED`. For the `usb.pid` you should pick a number that is not yet in use.
|
||||
At the top of the `keyboard.json` you'll find USB related settings. These control how your keyboard appears to the Operating System. If you don't have a good reason to change you should leave the `usb.vid` as `0xFEED`. For the `usb.pid` you should pick a number that is not yet in use.
|
||||
|
||||
Do change the `manufacturer` and `keyboard_name` lines to accurately reflect your keyboard.
|
||||
|
||||
@ -82,10 +81,11 @@ Do change the `manufacturer` and `keyboard_name` lines to accurately reflect you
|
||||
Windows and macOS will display the `manufacturer` and `keyboard_name` in the list of USB devices. `lsusb` on Linux instead prefers the values in the list maintained by the [USB ID Repository](http://www.linux-usb.org/usb-ids.html). By default, it will only use `manufacturer` and `keyboard_name` if the list does not contain that `usb.vid` / `usb.pid`. `sudo lsusb -v` will show the values reported by the device, and they are also present in kernel logs after plugging it in.
|
||||
:::
|
||||
|
||||
|
||||
### Matrix Configuration
|
||||
|
||||
The next section of the `info` file deals with your keyboard's matrix. The first thing you should define is which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
|
||||
The next section of the `keyboard.json` deals with your keyboard's matrix. The first thing you should define is which pins on your MCU are connected to rows and columns. To do so simply specify the names of those pins:
|
||||
|
||||
#### Diode Matrix
|
||||
|
||||
```json
|
||||
"matrix_pins": {
|
||||
@ -94,7 +94,7 @@ The next section of the `info` file deals with your keyboard's matrix. The first
|
||||
},
|
||||
```
|
||||
|
||||
The size of the `matrix_pins.cols` and `matrix_pins.rows` arrays infer the size of the matrix (previously `MATRIX_ROWS` and `MATRIX_COLS`).
|
||||
The matrix dimensions are inferred from the length of the `matrix_pins.cols` and `matrix_pins.rows` arrays (previously specified explicitly in `config.h` with `MATRIX_ROWS` and `MATRIX_COLS`).
|
||||
|
||||
Finally, you can specify the direction your diodes point. This can be `COL2ROW` or `ROW2COL`.
|
||||
|
||||
@ -103,7 +103,8 @@ Finally, you can specify the direction your diodes point. This can be `COL2ROW`
|
||||
```
|
||||
|
||||
#### Direct Pin Matrix
|
||||
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `matrix_pins.direct`. The mapping defines the pins of each switch in rows and columns, from left to right. The size of the `matrix_pins.direct` array infers the size of the matrix. Use `NO_PIN` to fill in blank spaces. Overrides the behaviour of `diode_direction`, `matrix_pins.cols` and `matrix_pins.rows`.
|
||||
|
||||
To configure a keyboard where each switch is connected to a separate pin and ground instead of sharing row and column pins, use `matrix_pins.direct`. This overrides the behaviour of `diode_direction`, `matrix_pins.cols` and `matrix_pins.rows`, and they should not be specified together.
|
||||
|
||||
```json
|
||||
"matrix_pins": {
|
||||
@ -111,14 +112,16 @@ To configure a keyboard where each switch is connected to a separate pin and gro
|
||||
["F1", "E6", "B0", "B2", "B3"],
|
||||
["F5", "F0", "B1", "B7", "D2"],
|
||||
["F6", "F7", "C7", "D5", "D3"],
|
||||
["B5", "C6", "B6", "NO_PIN", "NO_PIN"]
|
||||
["B5", "C6", "B6", null, null]
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
### Layout macros
|
||||
Here, the matrix dimensions are inferred directly from the dimensions of the `matrix_pins.direct` array. Since there are no row or column pins to prescribe the matrix dimensions, you can arrange it however you like. Each "row" must contain the same number of "column"s; use `null` to fill in blank spaces, but try to minimize them.
|
||||
|
||||
Next is configuring Layout Macro(s). These define the physical arrangement of keys, and its position within the matrix that a switch are connected to. This allows you to have a physical arrangement of keys that differs from the wiring matrix.
|
||||
### Layout Macros
|
||||
|
||||
Next is configuring layout macro(s). These define the physical arrangement of keys, and their position within the matrix that switches are connected to. This allows you to have a physical arrangement of keys that differs from the wiring matrix.
|
||||
|
||||
```json
|
||||
"layouts": {
|
||||
@ -143,14 +146,13 @@ Next is configuring Layout Macro(s). These define the physical arrangement of ke
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
In the above example,
|
||||
|
||||
* `LAYOUT_ortho_4x4` defines the name of the layout macro
|
||||
* It must conform to the [layout guidelines](hardware_keyboard_guidelines#keyboard-name-h)
|
||||
* `"matrix": [0, 0]` defines the electrical position
|
||||
* `"matrix": [0, 0]` defines the matrix row and column that the key is associated with
|
||||
|
||||
::: tip
|
||||
See also: [Split Keyboard Layout Macro](features/split_keyboard#layout-macro) and [Matrix to Physical Layout](understanding_qmk#matrix-to-physical-layout-map).
|
||||
@ -158,9 +160,10 @@ See also: [Split Keyboard Layout Macro](features/split_keyboard#layout-macro) an
|
||||
|
||||
## Additional Configuration
|
||||
|
||||
There are a lot of features that can be turned on or off, configured or tuned. Some of these have yet to be migrated over to [Data Driven Configuration](data_driven_config). The following sections cover the process for when an `info.json` option is unavailable.
|
||||
There are a lot of features that can be turned on or off, configured or tuned. Some of these have yet to be migrated over to [Data Driven Configuration](data_driven_config). The following sections cover the process for when a data-driven option is unavailable.
|
||||
|
||||
### Configuration Options
|
||||
|
||||
For available options for `config.h`, you should see the [Config Options](config_options#the-configh-file) page for more details.
|
||||
|
||||
### Build Options
|
||||
|
@ -177,9 +177,9 @@ Configures the [Backlight](features/backlight) feature.
|
||||
* `pins` <Badge type="info">Array: Pin</Badge>
|
||||
* A list of GPIO pins connected to the backlight LEDs (`software` and `timer` drivers only).
|
||||
|
||||
## Bluetooth {#bluetooth}
|
||||
## Wireless/Bluetooth {#bluetooth}
|
||||
|
||||
Configures the [Bluetooth](features/bluetooth) feature.
|
||||
Configures the [Wireless](features/wireless) feature.
|
||||
|
||||
* `bluetooth`
|
||||
* `driver` <Badge type="info">String</Badge>
|
||||
|
@ -2,9 +2,31 @@
|
||||
|
||||
Keyboards are able to support a wide range of languages. However, this support is not actually achieved within the keyboard itself - instead, it sends numerical codes, which the operating system maps to the appropriate characters depending on the user's configured keyboard layout. By default (and per the HID spec), this is the US ANSI layout. For example, when a Swedish person presses the key with the `å` character printed on it, the keyboard is *actually* sending the keycode for `[`.
|
||||
|
||||
Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap.
|
||||
Obviously, this can get confusing, so QMK provides language-specific keycode aliases for many keyboard layouts. These are used in place of the `KC_` prefixed ones. They won't do much on their own - you still have to set the matching keyboard layout in your OS settings. Think of them more as keycap labels for your keymap. The language-specific keycode aliases are defined in the files listed in the [Keycodes Header](#header-files) column below.
|
||||
|
||||
Simply `#include` one of the keycode headers below at the top of your `keymap.c`, and assign the keycodes defined in the header in place of the `KC_` prefixed ones.
|
||||
## Selecting Your Host Keyboard Layout
|
||||
|
||||
To select a host keyboard layout, simply `#include` one of the [keycode headers](#header-files) below at the top of your `keymap.c`. Example:
|
||||
|
||||
```c
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#include "keymap_japanese.h" // [!code focus]
|
||||
```
|
||||
|
||||
Alternatively, if using `keymap.json`, add the `host_language` key as shown in the following example. The available languages are those with a _Sendstring LUT Header_ entry in one of the [Header Files](#header-files) tables.
|
||||
|
||||
```json
|
||||
{
|
||||
"keyboard": "handwired/my_macropad",
|
||||
"keymap": "my_keymap",
|
||||
"host_language": "swedish", // [!code focus]
|
||||
"layout": "LAYOUT_all",
|
||||
"layers": [
|
||||
["SE_ARNG"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Sendstring Support
|
||||
|
||||
|
@ -60,6 +60,14 @@
|
||||
"resync": true
|
||||
}
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2}
|
||||
]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_default": {
|
||||
"layout": [
|
||||
|
@ -44,3 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
)
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(UG_HUED, UG_HUEU), ENCODER_CCW_CW(UG_SATD, UG_SATU) },
|
||||
[1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU), ENCODER_CCW_CW(UG_SPDD, UG_SPDU), ENCODER_CCW_CW(UG_PREV, UG_NEXT), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
|
||||
};
|
||||
#endif
|
||||
|
@ -0,0 +1,2 @@
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2024 Nick Brassel (@tzarc)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#if defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
||||
|
||||
# if !defined(ENCODER_SETTLE_PIN_STATE_DELAY_US)
|
||||
# define ENCODER_SETTLE_PIN_STATE_DELAY_US 2
|
||||
# endif
|
||||
|
||||
static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
|
||||
void encoder_driver_task(void) {
|
||||
// Set all relevant rows to output, which is different to the matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_output(matrix_row_pins[i]);
|
||||
}
|
||||
|
||||
// Read each encoder
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
// Set the row pin low for the corresponding encoder...
|
||||
for (uint8_t j = 0; j < 4; j++) {
|
||||
gpio_write_pin(matrix_row_pins[j], (i == j) ? 0 : 1);
|
||||
}
|
||||
// ...and let them settle.
|
||||
wait_us(ENCODER_SETTLE_PIN_STATE_DELAY_US);
|
||||
|
||||
// Run the normal encoder handling
|
||||
extern void encoder_quadrature_handle_read(uint8_t index, uint8_t pin_a_state, uint8_t pin_b_state);
|
||||
extern uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b);
|
||||
encoder_quadrature_handle_read(i, encoder_quadrature_read_pin(i, false), encoder_quadrature_read_pin(i, true));
|
||||
}
|
||||
|
||||
// Set all rows back to input-high as per matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_input_high(matrix_row_pins[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
131
keyboards/druah/majestouch_redux/keyboard.json
Normal file
131
keyboards/druah/majestouch_redux/keyboard.json
Normal file
@ -0,0 +1,131 @@
|
||||
{
|
||||
"manufacturer": "FILCO",
|
||||
"keyboard_name": "Majestouch Redux",
|
||||
"maintainer": "Druah",
|
||||
"bootloader": "atmel-dfu",
|
||||
"build": {
|
||||
"lto": true
|
||||
},
|
||||
"diode_direction": "COL2ROW",
|
||||
"features": {
|
||||
"bootmagic": true,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"nkro": true
|
||||
},
|
||||
"indicators": {
|
||||
"caps_lock": "C1",
|
||||
"scroll_lock": "C0"
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["A0", "A1", "A2", "F6", "F7", "E6", "F0", "F1", "F2", "B3", "B2", "B1", "F3", "F4", "C5", "C6", "C3"],
|
||||
"rows": ["C2", "B4", "B5", "F5", "C7", "C4"]
|
||||
},
|
||||
"processor": "at90usb646",
|
||||
"qmk": {
|
||||
"locking": {
|
||||
"enabled": true,
|
||||
"resync": true
|
||||
}
|
||||
},
|
||||
"url": "https://druah.moe",
|
||||
"usb": {
|
||||
"device_version": "1.0.0",
|
||||
"pid": "0x0003",
|
||||
"vid": "0x444E"
|
||||
},
|
||||
"community_layouts": ["tkl_ansi"],
|
||||
"layouts": {
|
||||
"LAYOUT_tkl_ansi": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
{"matrix": [0, 4], "x": 4, "y": 0},
|
||||
{"matrix": [0, 5], "x": 5, "y": 0},
|
||||
{"matrix": [0, 6], "x": 6.5, "y": 0},
|
||||
{"matrix": [0, 7], "x": 7.5, "y": 0},
|
||||
{"matrix": [0, 8], "x": 8.5, "y": 0},
|
||||
{"matrix": [0, 9], "x": 9.5, "y": 0},
|
||||
{"matrix": [0, 10], "x": 11, "y": 0},
|
||||
{"matrix": [0, 11], "x": 12, "y": 0},
|
||||
{"matrix": [0, 12], "x": 13, "y": 0},
|
||||
{"matrix": [0, 13], "x": 14, "y": 0},
|
||||
{"matrix": [0, 14], "x": 15.25, "y": 0},
|
||||
{"matrix": [0, 15], "x": 16.25, "y": 0},
|
||||
{"matrix": [0, 16], "x": 17.25, "y": 0},
|
||||
{"matrix": [1, 0], "x": 0, "y": 1.5},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1.5},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1.5},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1.5},
|
||||
{"matrix": [1, 4], "x": 4, "y": 1.5},
|
||||
{"matrix": [1, 5], "x": 5, "y": 1.5},
|
||||
{"matrix": [1, 6], "x": 6, "y": 1.5},
|
||||
{"matrix": [1, 7], "x": 7, "y": 1.5},
|
||||
{"matrix": [1, 8], "x": 8, "y": 1.5},
|
||||
{"matrix": [1, 9], "x": 9, "y": 1.5},
|
||||
{"matrix": [1, 10], "x": 10, "y": 1.5},
|
||||
{"matrix": [1, 11], "x": 11, "y": 1.5},
|
||||
{"matrix": [1, 12], "x": 12, "y": 1.5},
|
||||
{"matrix": [1, 13], "x": 13, "y": 1.5, "w": 2},
|
||||
{"matrix": [1, 14], "x": 15.25, "y": 1.5},
|
||||
{"matrix": [1, 15], "x": 16.25, "y": 1.5},
|
||||
{"matrix": [1, 16], "x": 17.25, "y": 1.5},
|
||||
{"matrix": [2, 0], "x": 0, "y": 2.5, "w": 1.5},
|
||||
{"matrix": [2, 1], "x": 1.5, "y": 2.5},
|
||||
{"matrix": [2, 2], "x": 2.5, "y": 2.5},
|
||||
{"matrix": [2, 3], "x": 3.5, "y": 2.5},
|
||||
{"matrix": [2, 4], "x": 4.5, "y": 2.5},
|
||||
{"matrix": [2, 5], "x": 5.5, "y": 2.5},
|
||||
{"matrix": [2, 6], "x": 6.5, "y": 2.5},
|
||||
{"matrix": [2, 7], "x": 7.5, "y": 2.5},
|
||||
{"matrix": [2, 8], "x": 8.5, "y": 2.5},
|
||||
{"matrix": [2, 9], "x": 9.5, "y": 2.5},
|
||||
{"matrix": [2, 10], "x": 10.5, "y": 2.5},
|
||||
{"matrix": [2, 11], "x": 11.5, "y": 2.5},
|
||||
{"matrix": [2, 12], "x": 12.5, "y": 2.5},
|
||||
{"matrix": [2, 13], "x": 13.5, "y": 2.5, "w": 1.5},
|
||||
{"matrix": [2, 14], "x": 15.25, "y": 2.5},
|
||||
{"matrix": [2, 15], "x": 16.25, "y": 2.5},
|
||||
{"matrix": [2, 16], "x": 17.25, "y": 2.5},
|
||||
{"matrix": [3, 0], "x": 0, "y": 3.5, "w": 1.75},
|
||||
{"matrix": [3, 1], "x": 1.75, "y": 3.5},
|
||||
{"matrix": [3, 2], "x": 2.75, "y": 3.5},
|
||||
{"matrix": [3, 3], "x": 3.75, "y": 3.5},
|
||||
{"matrix": [3, 4], "x": 4.75, "y": 3.5},
|
||||
{"matrix": [3, 5], "x": 5.75, "y": 3.5},
|
||||
{"matrix": [3, 6], "x": 6.75, "y": 3.5},
|
||||
{"matrix": [3, 7], "x": 7.75, "y": 3.5},
|
||||
{"matrix": [3, 8], "x": 8.75, "y": 3.5},
|
||||
{"matrix": [3, 9], "x": 9.75, "y": 3.5},
|
||||
{"matrix": [3, 10], "x": 10.75, "y": 3.5},
|
||||
{"matrix": [3, 11], "x": 11.75, "y": 3.5},
|
||||
{"matrix": [3, 13], "x": 12.75, "y": 3.5, "w": 2.25},
|
||||
{"matrix": [4, 0], "x": 0, "y": 4.5, "w": 2.25},
|
||||
{"matrix": [4, 2], "x": 2.25, "y": 4.5},
|
||||
{"matrix": [4, 3], "x": 3.25, "y": 4.5},
|
||||
{"matrix": [4, 4], "x": 4.25, "y": 4.5},
|
||||
{"matrix": [4, 5], "x": 5.25, "y": 4.5},
|
||||
{"matrix": [4, 6], "x": 6.25, "y": 4.5},
|
||||
{"matrix": [4, 7], "x": 7.25, "y": 4.5},
|
||||
{"matrix": [4, 8], "x": 8.25, "y": 4.5},
|
||||
{"matrix": [4, 9], "x": 9.25, "y": 4.5},
|
||||
{"matrix": [4, 10], "x": 10.25, "y": 4.5},
|
||||
{"matrix": [4, 11], "x": 11.25, "y": 4.5},
|
||||
{"matrix": [4, 13], "x": 12.25, "y": 4.5, "w": 2.75},
|
||||
{"matrix": [4, 15], "x": 16.25, "y": 4.5},
|
||||
{"matrix": [5, 0], "x": 0, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 1], "x": 1.25, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 2], "x": 2.5, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 7], "x": 3.75, "y": 5.5, "w": 6.25},
|
||||
{"matrix": [5, 10], "x": 10, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 11], "x": 11.25, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 12], "x": 12.5, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 13], "x": 13.75, "y": 5.5, "w": 1.25},
|
||||
{"matrix": [5, 14], "x": 15.25, "y": 5.5},
|
||||
{"matrix": [5, 15], "x": 16.25, "y": 5.5},
|
||||
{"matrix": [5, 16], "x": 17.25, "y": 5.5}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
32
keyboards/druah/majestouch_redux/keymaps/default/keymap.c
Normal file
32
keyboards/druah/majestouch_redux/keymaps/default/keymap.c
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2024 Druah (@Druah)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* ┌───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐┌───┬───┬───┐
|
||||
* │Esc│ │F1 │F2 │F3 │F4 │ │F5 │F6 │F7 │F8 │ │F9 │F10│F11│F12││PSc│Scr│Pse│
|
||||
* └───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘└───┴───┴───┘
|
||||
* ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐┌───┬───┬───┐
|
||||
* │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ Backsp││Ins│Hom│PgU│
|
||||
* ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤├───┼───┼───┤
|
||||
* │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ ││Del│End│PgD│
|
||||
* ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤└───┴───┴───┘
|
||||
* │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Enter │
|
||||
* ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤ ┌───┐
|
||||
* │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ │ ↑ │
|
||||
* ├────┬───┴┬──┴─┬─┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤┌───┼───┼───┐
|
||||
* │Ctrl│GUI │Alt │ │ Alt│ GUI│Menu│Ctrl││ ← │ ↓ │ → │
|
||||
* └────┴────┴────┴────────────────────────┴────┴────┴────┴────┘└───┴───┴───┘
|
||||
*/
|
||||
[0] = LAYOUT_tkl_ansi(
|
||||
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_PSCR, KC_SCRL, KC_PAUS,
|
||||
|
||||
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_BSPC, KC_INS, KC_HOME, KC_PGUP,
|
||||
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, 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_ENT,
|
||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
|
||||
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
|
||||
)
|
||||
};
|
27
keyboards/druah/majestouch_redux/readme.md
Normal file
27
keyboards/druah/majestouch_redux/readme.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Majestouch Redux
|
||||
|
||||
![PCB](https://i.imgur.com/LjoywMI.png)
|
||||
|
||||
A replacement PCB for the FILCO Majestouch TKL line of keyboards (and other keyboards) compatible with [Phantom TKL](https://deskthority.net/wiki/Phantom) PCB spacing
|
||||
|
||||
* Keyboard Maintainer: [Druah](https://github.com/Druah)
|
||||
* Hardware Supported: Majestouch Redux
|
||||
* Hardware Availability: Private buy
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make druah/majestouch_redux:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make druah/majestouch_redux:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 3 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the Escape/top left key) and plug in the keyboard
|
||||
* **Physical reset button**: Briefly press the button on the back of the PCB labelled with "RESET"
|
||||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
|
10
keyboards/handwired/onekey/at_start_f415/board.h
Normal file
10
keyboards/handwired/onekey/at_start_f415/board.h
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <board.h>
|
||||
|
||||
#undef AT32F415KB
|
||||
#define AT32F415RC
|
10
keyboards/handwired/onekey/at_start_f415/config.h
Normal file
10
keyboards/handwired/onekey/at_start_f415/config.h
Normal file
@ -0,0 +1,10 @@
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define ADC_PIN A0
|
||||
|
||||
#define BACKLIGHT_PWM_DRIVER PWMD5
|
||||
#define BACKLIGHT_PWM_CHANNEL 1
|
13
keyboards/handwired/onekey/at_start_f415/halconf.h
Normal file
13
keyboards/handwired/onekey/at_start_f415/halconf.h
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_ADC TRUE
|
||||
|
||||
#define HAL_USE_I2C TRUE
|
||||
|
||||
#define HAL_USE_PWM TRUE
|
||||
|
||||
#include_next <halconf.h>
|
20
keyboards/handwired/onekey/at_start_f415/keyboard.json
Normal file
20
keyboards/handwired/onekey/at_start_f415/keyboard.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"keyboard_name": "Onekey AT-START-F415",
|
||||
"processor": "AT32F415",
|
||||
"bootloader": "at32-dfu",
|
||||
"usb": {
|
||||
"shared_endpoint": {
|
||||
"keyboard": true
|
||||
}
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["B3"],
|
||||
"rows": ["B4"]
|
||||
},
|
||||
"backlight": {
|
||||
"pin": "A0"
|
||||
},
|
||||
"ws2812": {
|
||||
"pin": "B0"
|
||||
}
|
||||
}
|
16
keyboards/handwired/onekey/at_start_f415/mcuconf.h
Normal file
16
keyboards/handwired/onekey/at_start_f415/mcuconf.h
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef AT32_ADC_USE_ADC1
|
||||
#define AT32_ADC_USE_ADC1 TRUE
|
||||
|
||||
#undef AT32_I2C_USE_I2C1
|
||||
#define AT32_I2C_USE_I2C1 TRUE
|
||||
|
||||
#undef AT32_PWM_USE_TMR5
|
||||
#define AT32_PWM_USE_TMR5 TRUE
|
3
keyboards/handwired/onekey/at_start_f415/readme.md
Normal file
3
keyboards/handwired/onekey/at_start_f415/readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Artery AT-START-F415 Board Onekey
|
||||
|
||||
To trigger keypress, short together pins *B3* and *B4*.
|
@ -3,9 +3,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
#define DEBUG_MATRIX_SCAN_RATE
|
||||
|
||||
#define QMK_WAITING_TEST_BUSY_PIN GP8
|
||||
#define QMK_WAITING_TEST_YIELD_PIN GP9
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
"pin": "GP25"
|
||||
},
|
||||
"ws2812": {
|
||||
"driver": "vendor",
|
||||
"pin": "GP25"
|
||||
}
|
||||
}
|
||||
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -16,3 +16,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -17,3 +17,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
14
keyboards/lily58/lite_rev3/config.h
Normal file
14
keyboards/lily58/lite_rev3/config.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2023 yuchi
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
|
||||
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U
|
||||
|
||||
#define SERIAL_USART_FULL_DUPLEX
|
||||
#define SERIAL_USART_TX_PIN GP0
|
||||
#define SERIAL_USART_RX_PIN GP1
|
||||
|
||||
#define I2C_DRIVER I2CD1
|
||||
#define I2C1_SDA_PIN GP14
|
||||
#define I2C1_SCL_PIN GP15
|
7
keyboards/lily58/lite_rev3/halconf.h
Normal file
7
keyboards/lily58/lite_rev3/halconf.h
Normal file
@ -0,0 +1,7 @@
|
||||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE
|
||||
|
||||
#include_next <halconf.h>
|
104
keyboards/lily58/lite_rev3/keyboard.json
Normal file
104
keyboards/lily58/lite_rev3/keyboard.json
Normal file
@ -0,0 +1,104 @@
|
||||
{
|
||||
"keyboard_name": "Lily58 Lite Rev3",
|
||||
"manufacturer": "Liliums",
|
||||
"maintainer": "yuchi",
|
||||
"url": "",
|
||||
"processor": "RP2040",
|
||||
"bootloader": "rp2040",
|
||||
"diode_direction": "COL2ROW",
|
||||
"usb": {
|
||||
"vid": "0x1209",
|
||||
"pid": "0x5801",
|
||||
"device_version": "1.0.0"
|
||||
},
|
||||
"split": {
|
||||
"enabled": true,
|
||||
"serial": {
|
||||
"driver": "vendor"
|
||||
}
|
||||
},
|
||||
"matrix_pins": {
|
||||
"cols": ["GP8", "GP7", "GP6", "GP5", "GP4", "GP3"],
|
||||
"rows": ["GP13", "GP12", "GP11", "GP10", "GP9"]
|
||||
},
|
||||
"features": {
|
||||
"oled": true,
|
||||
"bootmagic": true,
|
||||
"extrakey": true,
|
||||
"mousekey": true,
|
||||
"nkro": true
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{"matrix": [0, 0], "x": 0, "y": 0.5},
|
||||
{"matrix": [0, 1], "x": 1, "y": 0.375},
|
||||
{"matrix": [0, 2], "x": 2, "y": 0.125},
|
||||
{"matrix": [0, 3], "x": 3, "y": 0},
|
||||
{"matrix": [0, 4], "x": 4, "y": 0.125},
|
||||
{"matrix": [0, 5], "x": 5, "y": 0.25},
|
||||
|
||||
{"matrix": [5, 5], "x": 10.5, "y": 0.25},
|
||||
{"matrix": [5, 4], "x": 11.5, "y": 0.125},
|
||||
{"matrix": [5, 3], "x": 12.5, "y": 0},
|
||||
{"matrix": [5, 2], "x": 13.5, "y": 0.125},
|
||||
{"matrix": [5, 1], "x": 14.5, "y": 0.375},
|
||||
{"matrix": [5, 0], "x": 15.5, "y": 0.5},
|
||||
|
||||
{"matrix": [1, 0], "x": 0, "y": 1.5},
|
||||
{"matrix": [1, 1], "x": 1, "y": 1.375},
|
||||
{"matrix": [1, 2], "x": 2, "y": 1.125},
|
||||
{"matrix": [1, 3], "x": 3, "y": 1},
|
||||
{"matrix": [1, 4], "x": 4, "y": 1.125},
|
||||
{"matrix": [1, 5], "x": 5, "y": 1.25},
|
||||
|
||||
{"matrix": [6, 5], "x": 10.5, "y": 1.25},
|
||||
{"matrix": [6, 4], "x": 11.5, "y": 1.125},
|
||||
{"matrix": [6, 3], "x": 12.5, "y": 1},
|
||||
{"matrix": [6, 2], "x": 13.5, "y": 1.125},
|
||||
{"matrix": [6, 1], "x": 14.5, "y": 1.375},
|
||||
{"matrix": [6, 0], "x": 15.5, "y": 1.5},
|
||||
|
||||
{"matrix": [2, 0], "x": 0, "y": 2.5},
|
||||
{"matrix": [2, 1], "x": 1, "y": 2.375},
|
||||
{"matrix": [2, 2], "x": 2, "y": 2.125},
|
||||
{"matrix": [2, 3], "x": 3, "y": 2},
|
||||
{"matrix": [2, 4], "x": 4, "y": 2.125},
|
||||
{"matrix": [2, 5], "x": 5, "y": 2.25},
|
||||
|
||||
{"matrix": [7, 5], "x": 10.5, "y": 2.25},
|
||||
{"matrix": [7, 4], "x": 11.5, "y": 2.125},
|
||||
{"matrix": [7, 3], "x": 12.5, "y": 2},
|
||||
{"matrix": [7, 2], "x": 13.5, "y": 2.125},
|
||||
{"matrix": [7, 1], "x": 14.5, "y": 2.375},
|
||||
{"matrix": [7, 0], "x": 15.5, "y": 2.5},
|
||||
|
||||
{"matrix": [3, 0], "x": 0, "y": 3.5},
|
||||
{"matrix": [3, 1], "x": 1, "y": 3.375},
|
||||
{"matrix": [3, 2], "x": 2, "y": 3.125},
|
||||
{"matrix": [3, 3], "x": 3, "y": 3},
|
||||
{"matrix": [3, 4], "x": 4, "y": 3.125},
|
||||
{"matrix": [3, 5], "x": 5, "y": 3.25},
|
||||
{"matrix": [4, 5], "x": 6, "y": 2.75},
|
||||
|
||||
{"matrix": [9, 5], "x": 9.5, "y": 2.75},
|
||||
{"matrix": [8, 5], "x": 10.5, "y": 3.25},
|
||||
{"matrix": [8, 4], "x": 11.5, "y": 3.125},
|
||||
{"matrix": [8, 3], "x": 12.5, "y": 3},
|
||||
{"matrix": [8, 2], "x": 13.5, "y": 3.125},
|
||||
{"matrix": [8, 1], "x": 14.5, "y": 3.375},
|
||||
{"matrix": [8, 0], "x": 15.5, "y": 3.5},
|
||||
|
||||
{"matrix": [4, 1], "x": 2.5, "y": 4.125},
|
||||
{"matrix": [4, 2], "x": 3.5, "y": 4.15},
|
||||
{"matrix": [4, 3], "x": 4.5, "y": 4.25},
|
||||
{"matrix": [4, 4], "x": 6, "y": 4.25, "h": 1.5},
|
||||
|
||||
{"matrix": [9, 4], "x": 9.5, "y": 4.25, "h": 1.5},
|
||||
{"matrix": [9, 3], "x": 11, "y": 4.25},
|
||||
{"matrix": [9, 2], "x": 12, "y": 4.15},
|
||||
{"matrix": [9, 1], "x": 13, "y": 4.15}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
11
keyboards/lily58/lite_rev3/mcuconf.h
Normal file
11
keyboards/lily58/lite_rev3/mcuconf.h
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2024 QMK
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef RP_I2C_USE_I2C0
|
||||
#define RP_I2C_USE_I2C0 FALSE
|
||||
|
||||
#undef RP_I2C_USE_I2C1
|
||||
#define RP_I2C_USE_I2C1 TRUE
|
28
keyboards/lily58/lite_rev3/readme.md
Normal file
28
keyboards/lily58/lite_rev3/readme.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Lily58 Lite Rev3
|
||||
|
||||
![lily58_lite](https://i.imgur.com/RCx5Xym.jpeg)
|
||||
![lily58_lite_rev3_pcb](https://i.imgur.com/rIjVjCE.png)
|
||||
|
||||
|
||||
* Keyboard Maintainer: [yuchi](https://github.com/kata0510)
|
||||
* Hardware Supported: RP2040-Zero
|
||||
* Hardware Availability: [PCB Link](https://github.com/kata0510/Lily58/tree/master/Lite_Rev3)
|
||||
* Other Information(ja) [Link](https://docs.liliums.net/lily58-lite-rev3/about/)
|
||||
|
||||
Make example for this keyboard (after setting up your build environment):
|
||||
|
||||
make lily58/lite_rev3:default
|
||||
|
||||
Flashing example for this keyboard:
|
||||
|
||||
make lily58/lite_rev3:default:flash
|
||||
|
||||
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
|
||||
|
||||
## Bootloader
|
||||
|
||||
Enter the bootloader in 3 ways:
|
||||
|
||||
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
|
||||
* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
|
||||
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -30,3 +30,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN E6
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -9,3 +9,5 @@
|
||||
#define WORK_LOUDER_LED_PIN_1 B6
|
||||
#define WORK_LOUDER_LED_PIN_2 B7
|
||||
#define WORK_LOUDER_LED_PIN_3 B5
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN C7
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -5,3 +5,5 @@
|
||||
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -4,6 +4,8 @@ from enum import Enum
|
||||
import re
|
||||
import shutil
|
||||
from subprocess import DEVNULL, TimeoutExpired
|
||||
from tempfile import TemporaryDirectory
|
||||
from pathlib import Path
|
||||
|
||||
from milc import cli
|
||||
from qmk import submodules
|
||||
@ -44,7 +46,35 @@ def _check_arm_gcc_version():
|
||||
version_number = ESSENTIAL_BINARIES['arm-none-eabi-gcc']['output'].strip()
|
||||
cli.log.info('Found arm-none-eabi-gcc version %s', version_number)
|
||||
|
||||
return CheckStatus.OK # Right now all known arm versions are ok
|
||||
# Right now all known ARM versions are ok, so check that it can produce binaries
|
||||
return _check_arm_gcc_installation()
|
||||
|
||||
|
||||
def _check_arm_gcc_installation():
|
||||
"""Returns OK if the arm-none-eabi-gcc is fully installed and can produce binaries.
|
||||
"""
|
||||
with TemporaryDirectory() as temp_dir:
|
||||
temp_file = Path(temp_dir) / 'test.elf'
|
||||
|
||||
args = ['arm-none-eabi-gcc', '-mcpu=cortex-m0', '-mthumb', '-mno-thumb-interwork', '--specs=nosys.specs', '--specs=nano.specs', '-x', 'c', '-o', str(temp_file), '-']
|
||||
result = cli.run(args, stdin=None, stdout=None, stderr=None, input='#include <newlib.h>\nint main() { return __NEWLIB__ * __NEWLIB_MINOR__ * __NEWLIB_PATCHLEVEL__; }')
|
||||
if result.returncode == 0:
|
||||
cli.log.info('Successfully compiled using arm-none-eabi-gcc')
|
||||
else:
|
||||
cli.log.error(f'Failed to compile a simple program with arm-none-eabi-gcc, return code {result.returncode}')
|
||||
cli.log.error(f'Command: {" ".join(args)}')
|
||||
return CheckStatus.ERROR
|
||||
|
||||
args = ['arm-none-eabi-size', str(temp_file)]
|
||||
result = cli.run(args, stdin=None, stdout=None, stderr=None)
|
||||
if result.returncode == 0:
|
||||
cli.log.info('Successfully tested arm-none-eabi-binutils using arm-none-eabi-size')
|
||||
else:
|
||||
cli.log.error(f'Failed to execute arm-none-eabi-size, perhaps corrupt arm-none-eabi-binutils, return code {result.returncode}')
|
||||
cli.log.error(f'Command: {" ".join(args)}')
|
||||
return CheckStatus.ERROR
|
||||
|
||||
return CheckStatus.OK
|
||||
|
||||
|
||||
def _check_avr_gcc_version():
|
||||
@ -53,6 +83,34 @@ def _check_avr_gcc_version():
|
||||
version_number = ESSENTIAL_BINARIES['avr-gcc']['output'].strip()
|
||||
cli.log.info('Found avr-gcc version %s', version_number)
|
||||
|
||||
# Right now all known AVR versions are ok, so check that it can produce binaries
|
||||
return _check_avr_gcc_installation()
|
||||
|
||||
|
||||
def _check_avr_gcc_installation():
|
||||
"""Returns OK if the avr-gcc is fully installed and can produce binaries.
|
||||
"""
|
||||
with TemporaryDirectory() as temp_dir:
|
||||
temp_file = Path(temp_dir) / 'test.elf'
|
||||
|
||||
args = ['avr-gcc', '-mmcu=atmega32u4', '-x', 'c', '-o', str(temp_file), '-']
|
||||
result = cli.run(args, stdin=None, stdout=None, stderr=None, input='int main() { return 0; }')
|
||||
if result.returncode == 0:
|
||||
cli.log.info('Successfully compiled using avr-gcc')
|
||||
else:
|
||||
cli.log.error(f'Failed to compile a simple program with avr-gcc, return code {result.returncode}')
|
||||
cli.log.error(f'Command: {" ".join(args)}')
|
||||
return CheckStatus.ERROR
|
||||
|
||||
args = ['avr-size', str(temp_file)]
|
||||
result = cli.run(args, stdin=None, stdout=None, stderr=None)
|
||||
if result.returncode == 0:
|
||||
cli.log.info('Successfully tested avr-binutils using avr-size')
|
||||
else:
|
||||
cli.log.error(f'Failed to execute avr-size, perhaps corrupt avr-binutils, return code {result.returncode}')
|
||||
cli.log.error(f'Command: {" ".join(args)}')
|
||||
return CheckStatus.ERROR
|
||||
|
||||
return CheckStatus.OK
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ from pathlib import Path
|
||||
from dotty_dict import dotty
|
||||
|
||||
from milc import cli
|
||||
from milc.questions import choice, question
|
||||
from milc.questions import choice, question, yesno
|
||||
|
||||
from qmk.git import git_get_username
|
||||
from qmk.json_schema import load_jsonschema
|
||||
@ -131,60 +131,70 @@ def _question(*args, **kwargs):
|
||||
return ret
|
||||
|
||||
|
||||
def prompt_keyboard():
|
||||
prompt = """{fg_yellow}Name Your Keyboard Project{style_reset_all}
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboard-project
|
||||
def prompt_heading_subheading(heading, subheading):
|
||||
cli.log.info(f"{{fg_yellow}}{heading}{{style_reset_all}}")
|
||||
cli.log.info(subheading)
|
||||
|
||||
Keyboard Name? """
|
||||
|
||||
def prompt_keyboard():
|
||||
prompt_heading_subheading("Name Your Keyboard Project", """For more information, see:
|
||||
https://docs.qmk.fm/hardware_keyboard_guidelines#naming-your-keyboard-project""")
|
||||
|
||||
errmsg = 'Keyboard already exists! Please choose a different name:'
|
||||
|
||||
return _question(prompt, reprompt=errmsg, validate=lambda x: not keyboard(x).exists())
|
||||
return _question("Keyboard Name?", reprompt=errmsg, validate=lambda x: not keyboard(x).exists())
|
||||
|
||||
|
||||
def prompt_user():
|
||||
prompt = """
|
||||
{fg_yellow}Attribution{style_reset_all}
|
||||
Used for maintainer, copyright, etc
|
||||
prompt_heading_subheading("Attribution", "Used for maintainer, copyright, etc.")
|
||||
|
||||
Your GitHub Username? """
|
||||
return question(prompt, default=git_get_username())
|
||||
return question("Your GitHub Username?", default=git_get_username())
|
||||
|
||||
|
||||
def prompt_name(def_name):
|
||||
prompt = """
|
||||
{fg_yellow}More Attribution{style_reset_all}
|
||||
Used for maintainer, copyright, etc
|
||||
prompt_heading_subheading("More Attribution", "Used for maintainer, copyright, etc.")
|
||||
|
||||
Your Real Name? """
|
||||
return question(prompt, default=def_name)
|
||||
return question("Your Real Name?", default=def_name)
|
||||
|
||||
|
||||
def prompt_layout():
|
||||
prompt = """
|
||||
{fg_yellow}Pick Base Layout{style_reset_all}
|
||||
As a starting point, one of the common layouts can be used to bootstrap the process
|
||||
prompt_heading_subheading("Pick Base Layout", """As a starting point, one of the common layouts can be used to
|
||||
bootstrap the process""")
|
||||
|
||||
Default Layout? """
|
||||
# avoid overwhelming user - remove some?
|
||||
filtered_layouts = [x for x in available_layouts if not any(xs in x for xs in ['_split', '_blocker', '_tsangan', '_f13'])]
|
||||
filtered_layouts.append("none of the above")
|
||||
|
||||
return choice(prompt, filtered_layouts, default=len(filtered_layouts) - 1)
|
||||
return choice("Default Layout?", filtered_layouts, default=len(filtered_layouts) - 1)
|
||||
|
||||
|
||||
def prompt_mcu_type():
|
||||
prompt_heading_subheading(
|
||||
"What Powers Your Project", """Is your board using a separate development board, such as a Pro Micro,
|
||||
or is the microcontroller integrated onto the PCB?
|
||||
|
||||
For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers"""
|
||||
)
|
||||
|
||||
return yesno("Using a Development Board?")
|
||||
|
||||
|
||||
def prompt_dev_board():
|
||||
prompt_heading_subheading("Select Development Board", """For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers""")
|
||||
|
||||
return choice("Development Board?", dev_boards, default=dev_boards.index("promicro"))
|
||||
|
||||
|
||||
def prompt_mcu():
|
||||
prompt = """
|
||||
{fg_yellow}What Powers Your Project{style_reset_all}
|
||||
For more infomation, see:
|
||||
https://docs.qmk.fm/#/compatible_microcontrollers
|
||||
prompt_heading_subheading("Select Microcontroller", """For more information, see:
|
||||
https://docs.qmk.fm/compatible_microcontrollers""")
|
||||
|
||||
MCU? """
|
||||
# remove any options strictly used for compatibility
|
||||
filtered_mcu = [x for x in (dev_boards + mcu_types) if not any(xs in x for xs in ['cortex', 'unknown'])]
|
||||
filtered_mcu = [x for x in mcu_types if not any(xs in x for xs in ['cortex', 'unknown'])]
|
||||
|
||||
return choice(prompt, filtered_mcu, default=filtered_mcu.index("atmega32u4"))
|
||||
return choice("Microcontroller?", filtered_mcu, default=filtered_mcu.index("atmega32u4"))
|
||||
|
||||
|
||||
@cli.argument('-kb', '--keyboard', help='Specify the name for the new keyboard directory', arg_only=True, type=keyboard_name)
|
||||
@ -211,7 +221,11 @@ def new_keyboard(cli):
|
||||
user_name = cli.config.new_keyboard.name if cli.config.new_keyboard.name else prompt_user()
|
||||
real_name = cli.args.realname or cli.config.new_keyboard.name if cli.args.realname or cli.config.new_keyboard.name else prompt_name(user_name)
|
||||
default_layout = cli.args.layout if cli.args.layout else prompt_layout()
|
||||
mcu = cli.args.type if cli.args.type else prompt_mcu()
|
||||
|
||||
if cli.args.type:
|
||||
mcu = cli.args.type
|
||||
else:
|
||||
mcu = prompt_dev_board() if prompt_mcu_type() else prompt_mcu()
|
||||
|
||||
config = {}
|
||||
if mcu in dev_boards:
|
||||
|
@ -1,5 +1,6 @@
|
||||
"""This script automates the copying of the default keymap into your own keymap.
|
||||
"""
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from milc import cli
|
||||
@ -13,6 +14,13 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
|
||||
from qmk.userspace import UserspaceDefs
|
||||
|
||||
|
||||
def validate_keymap_name(name):
|
||||
"""Returns True if the given keymap name contains only a-z, 0-9 and underscore characters.
|
||||
"""
|
||||
regex = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]+$')
|
||||
return bool(regex.match(name))
|
||||
|
||||
|
||||
def prompt_keyboard():
|
||||
prompt = """{fg_yellow}Select Keyboard{style_reset_all}
|
||||
If you`re unsure you can view a full list of supported keyboards with {fg_yellow}qmk list-keyboards{style_reset_all}.
|
||||
@ -60,6 +68,10 @@ def new_keymap(cli):
|
||||
cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!')
|
||||
return False
|
||||
|
||||
if not validate_keymap_name(user_name):
|
||||
cli.log.error('Keymap names must contain only {fg_cyan}a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
|
||||
return False
|
||||
|
||||
if keymap_path_new.exists():
|
||||
cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.')
|
||||
return False
|
||||
|
@ -60,9 +60,7 @@ def painter_convert_graphics(cli):
|
||||
return
|
||||
|
||||
# Work out the text substitutions for rendering the output data
|
||||
args_str = " ".join((f"--{arg} {getattr(cli.args, arg.replace('-', '_'))}" for arg in ["input", "output", "format", "no-rle", "no-deltas"]))
|
||||
command = f"qmk painter-convert-graphics {args_str}"
|
||||
subs = generate_subs(cli, out_bytes, image_metadata=metadata, command=command)
|
||||
subs = generate_subs(cli, out_bytes, image_metadata=metadata, command_name="painter_convert_graphics")
|
||||
|
||||
# Render and write the header file
|
||||
header_text = render_header(subs)
|
||||
|
@ -61,10 +61,8 @@ def painter_convert_font_image(cli):
|
||||
return
|
||||
|
||||
# Work out the text substitutions for rendering the output data
|
||||
args_str = " ".join((f"--{arg} {getattr(cli.args, arg.replace('-', '_'))}" for arg in ["input", "output", "no-ascii", "unicode-glyphs", "format", "no-rle"]))
|
||||
command = f"qmk painter-convert-font-image {args_str}"
|
||||
metadata = {"glyphs": _generate_font_glyphs_list(not cli.args.no_ascii, cli.args.unicode_glyphs)}
|
||||
subs = generate_subs(cli, out_bytes, font_metadata=metadata, command=command)
|
||||
subs = generate_subs(cli, out_bytes, font_metadata=metadata, command_name="painter_convert_font_image")
|
||||
|
||||
# Render and write the header file
|
||||
header_text = render_header(subs)
|
||||
|
@ -29,6 +29,7 @@ def _convert_macros(via_macros):
|
||||
if len(via_macros) == 0:
|
||||
return list()
|
||||
split_regex = re.compile(r'(}\,)|(\,{)')
|
||||
macro_group_regex = re.compile(r'({.+?})')
|
||||
macros = list()
|
||||
for via_macro in via_macros:
|
||||
# Split VIA macro to its elements
|
||||
@ -38,13 +39,28 @@ def _convert_macros(via_macros):
|
||||
macro_data = list()
|
||||
for m in macro:
|
||||
if '{' in m or '}' in m:
|
||||
# Found keycode(s)
|
||||
keycodes = m.split(',')
|
||||
# Remove whitespaces and curly braces from around keycodes
|
||||
keycodes = list(map(lambda s: s.strip(' {}'), keycodes))
|
||||
# Remove the KC prefix
|
||||
keycodes = list(map(lambda s: s.replace('KC_', ''), keycodes))
|
||||
macro_data.append({"action": "tap", "keycodes": keycodes})
|
||||
# Split macro groups
|
||||
macro_groups = macro_group_regex.findall(m)
|
||||
for macro_group in macro_groups:
|
||||
# Remove whitespaces and curly braces from around group
|
||||
macro_group = macro_group.strip(' {}')
|
||||
|
||||
macro_action = 'tap'
|
||||
macro_keycodes = []
|
||||
|
||||
if macro_group[0] == '+':
|
||||
macro_action = 'down'
|
||||
macro_keycodes.append(macro_group[1:])
|
||||
elif macro_group[0] == '-':
|
||||
macro_action = 'up'
|
||||
macro_keycodes.append(macro_group[1:])
|
||||
else:
|
||||
macro_keycodes.extend(macro_group.split(',') if ',' in macro_group else [macro_group])
|
||||
|
||||
# Remove the KC prefixes
|
||||
macro_keycodes = list(map(lambda s: s.replace('KC_', ''), macro_keycodes))
|
||||
|
||||
macro_data.append({"action": macro_action, "keycodes": macro_keycodes})
|
||||
else:
|
||||
# Found text
|
||||
macro_data.append(m)
|
||||
@ -54,13 +70,13 @@ def _convert_macros(via_macros):
|
||||
|
||||
|
||||
def _fix_macro_keys(keymap_data):
|
||||
macro_no = re.compile(r'MACRO0?([0-9]{1,2})')
|
||||
macro_no = re.compile(r'MACRO0?\(([0-9]{1,2})\)')
|
||||
for i in range(0, len(keymap_data)):
|
||||
for j in range(0, len(keymap_data[i])):
|
||||
kc = keymap_data[i][j]
|
||||
m = macro_no.match(kc)
|
||||
if m:
|
||||
keymap_data[i][j] = f'MACRO_{m.group(1)}'
|
||||
keymap_data[i][j] = f'MC_{m.group(1)}'
|
||||
return keymap_data
|
||||
|
||||
|
||||
|
@ -22,7 +22,7 @@ QMK_FIRMWARE_UPSTREAM = 'qmk/qmk_firmware'
|
||||
MAX_KEYBOARD_SUBFOLDERS = 5
|
||||
|
||||
# Supported processor types
|
||||
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95'
|
||||
CHIBIOS_PROCESSORS = 'cortex-m0', 'cortex-m0plus', 'cortex-m3', 'cortex-m4', 'MKL26Z64', 'MK20DX128', 'MK20DX256', 'MK64FX512', 'MK66FX1M0', 'RP2040', 'STM32F042', 'STM32F072', 'STM32F103', 'STM32F303', 'STM32F401', 'STM32F405', 'STM32F407', 'STM32F411', 'STM32F446', 'STM32G431', 'STM32G474', 'STM32H723', 'STM32H733', 'STM32L412', 'STM32L422', 'STM32L432', 'STM32L433', 'STM32L442', 'STM32L443', 'GD32VF103', 'WB32F3G71', 'WB32FQ95', 'AT32F415'
|
||||
LUFA_PROCESSORS = 'at90usb162', 'atmega16u2', 'atmega32u2', 'atmega16u4', 'atmega32u4', 'at90usb646', 'at90usb647', 'at90usb1286', 'at90usb1287', None
|
||||
VUSB_PROCESSORS = 'atmega32a', 'atmega328p', 'atmega328', 'attiny85'
|
||||
|
||||
@ -55,6 +55,7 @@ MCU2BOOTLOADER = {
|
||||
"GD32VF103": "gd32v-dfu",
|
||||
"WB32F3G71": "wb32-dfu",
|
||||
"WB32FQ95": "wb32-dfu",
|
||||
"AT32F415": "at32-dfu",
|
||||
"atmega16u2": "atmel-dfu",
|
||||
"atmega32u2": "atmel-dfu",
|
||||
"atmega16u4": "atmel-dfu",
|
||||
@ -93,6 +94,7 @@ BOOTLOADER_VIDS_PIDS = {
|
||||
'apm32-dfu': {("314b", "0106")},
|
||||
'gd32v-dfu': {("28e9", "0189")},
|
||||
'wb32-dfu': {("342d", "dfa0")},
|
||||
'at32-dfu': {("2e3c", "df11")},
|
||||
'bootloadhid': {("16c0", "05df")},
|
||||
'usbasploader': {("16c0", "05dc")},
|
||||
'usbtinyisp': {("1782", "0c9f")},
|
||||
|
@ -3,6 +3,7 @@
|
||||
import datetime
|
||||
import math
|
||||
import re
|
||||
from pathlib import Path
|
||||
from string import Template
|
||||
from PIL import Image, ImageOps
|
||||
|
||||
@ -137,10 +138,31 @@ def _render_image_metadata(metadata):
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
def generate_subs(cli, out_bytes, *, font_metadata=None, image_metadata=None, command):
|
||||
def command_args_str(cli, command_name):
|
||||
"""Given a command name, introspect milc to get the arguments passed in."""
|
||||
|
||||
args = {}
|
||||
max_length = 0
|
||||
for arg_name, was_passed in cli.args_passed[command_name].items():
|
||||
max_length = max(max_length, len(arg_name))
|
||||
|
||||
val = getattr(cli.args, arg_name.replace("-", "_"))
|
||||
|
||||
# do not leak full paths, keep just file name
|
||||
if isinstance(val, Path):
|
||||
val = val.name
|
||||
|
||||
args[arg_name] = val
|
||||
|
||||
return "\n".join(f"// {arg_name.ljust(max_length)} | {val}" for arg_name, val in args.items())
|
||||
|
||||
|
||||
def generate_subs(cli, out_bytes, *, font_metadata=None, image_metadata=None, command_name):
|
||||
if font_metadata is not None and image_metadata is not None:
|
||||
raise ValueError("Cant generate subs for font and image at the same time")
|
||||
|
||||
args = command_args_str(cli, command_name)
|
||||
|
||||
subs = {
|
||||
"year": datetime.date.today().strftime("%Y"),
|
||||
"input_file": cli.args.input.name,
|
||||
@ -148,7 +170,8 @@ def generate_subs(cli, out_bytes, *, font_metadata=None, image_metadata=None, co
|
||||
"byte_count": len(out_bytes),
|
||||
"bytes_lines": render_bytes(out_bytes),
|
||||
"format": cli.args.format,
|
||||
"generator_command": command,
|
||||
"generator_command": command_name.replace("_", "-"),
|
||||
"command_args": args,
|
||||
}
|
||||
|
||||
if font_metadata is not None:
|
||||
@ -167,7 +190,7 @@ def generate_subs(cli, out_bytes, *, font_metadata=None, image_metadata=None, co
|
||||
subs.update({
|
||||
"generated_type": "image",
|
||||
"var_prefix": "gfx",
|
||||
"generator_command": command,
|
||||
"generator_command": command_name,
|
||||
"metadata": _render_image_metadata(image_metadata),
|
||||
})
|
||||
|
||||
@ -183,7 +206,8 @@ license_template = """\
|
||||
// Copyright ${year} QMK -- generated source code only, ${generated_type} retains original copyright
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
// This file was auto-generated by `${generator_command}`
|
||||
// This file was auto-generated by `${generator_command}` with arguments:
|
||||
${command_args}
|
||||
"""
|
||||
|
||||
|
||||
|
101
platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c
Normal file
101
platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.c
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2023..2024 HorrorTroll
|
||||
ChibiOS - Copyright (C) 2023..2024 Zhaqian
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local definitions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported variables. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local variables and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief PAL setup.
|
||||
* @details Digital I/O ports static configuration as defined in @p board.h.
|
||||
* This variable is used by the HAL when initializing the PAL driver.
|
||||
*/
|
||||
#if HAL_USE_PAL || defined(__DOXYGEN__)
|
||||
const PALConfig pal_default_config =
|
||||
{
|
||||
{VAL_GPIOAODT, VAL_GPIOACFGLR, VAL_GPIOACFGHR},
|
||||
{VAL_GPIOBODT, VAL_GPIOBCFGLR, VAL_GPIOBCFGHR},
|
||||
#if AT32_HAS_GPIOC
|
||||
{VAL_GPIOCODT, VAL_GPIOCCFGLR, VAL_GPIOCCFGHR},
|
||||
#endif
|
||||
{VAL_GPIODODT, VAL_GPIODCFGLR, VAL_GPIODCFGHR},
|
||||
#if AT32_HAS_GPIOF
|
||||
{VAL_GPIOFODT, VAL_GPIOFCFGLR, VAL_GPIOFCFGHR},
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver local functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver interrupt handlers. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver exported functions. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Early initialization code.
|
||||
* @details System clocks are initialized before everything else.
|
||||
*/
|
||||
void __early_init(void) {
|
||||
at32_clock_init();
|
||||
}
|
||||
|
||||
#if HAL_USE_SDC || defined(__DOXYGEN__)
|
||||
/**
|
||||
* @brief SDC card detection.
|
||||
*/
|
||||
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
|
||||
static bool last_status = false;
|
||||
|
||||
if (blkIsTransferring(sdcp))
|
||||
return last_status;
|
||||
return last_status = (bool)palReadPad(GPIOC, GPIOC_PIN11);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief SDC card write protection detection.
|
||||
*/
|
||||
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
|
||||
|
||||
(void)sdcp;
|
||||
return false;
|
||||
}
|
||||
#endif /* HAL_USE_SDC */
|
||||
|
||||
/**
|
||||
* @brief Board-specific initialization code.
|
||||
* @note You can add your board-specific code here.
|
||||
*/
|
||||
void boardInit(void) {
|
||||
IOMUX->REMAP |= IOMUX_REMAP_SWJTAG_MUX_JTAGDIS;
|
||||
}
|
207
platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
Normal file
207
platforms/chibios/boards/GENERIC_AT32_F415XX/board/board.h
Normal file
@ -0,0 +1,207 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2023..2024 HorrorTroll
|
||||
ChibiOS - Copyright (C) 2023..2024 Zhaqian
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef _BOARD_H_
|
||||
#define _BOARD_H_
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*
|
||||
* Setup for a Generic AT32F415 board.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Board identifier.
|
||||
*/
|
||||
#define BOARD_GENERIC_AT32_F415XX
|
||||
#define BOARD_NAME "GENERIC AT32F415 board"
|
||||
|
||||
/*
|
||||
* Board oscillators-related settings.
|
||||
*/
|
||||
#if !defined(AT32_LEXTCLK)
|
||||
#define AT32_LEXTCLK 32768
|
||||
#endif
|
||||
|
||||
#if !defined(AT32_HEXTCLK)
|
||||
#define AT32_HEXTCLK 8000000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
|
||||
*/
|
||||
#define AT32F415KB
|
||||
|
||||
/*
|
||||
* IO pins assignments.
|
||||
*/
|
||||
#define GPIOA_PIN0 0U
|
||||
#define GPIOA_PIN1 1U
|
||||
#define GPIOA_PIN2 2U
|
||||
#define GPIOA_PIN3 3U
|
||||
#define GPIOA_PIN4 4U
|
||||
#define GPIOA_PIN5 5U
|
||||
#define GPIOA_PIN6 6U
|
||||
#define GPIOA_PIN7 7U
|
||||
#define GPIOA_PIN8 8U
|
||||
#define GPIOA_PIN9 9U
|
||||
#define GPIOA_PIN10 10U
|
||||
#define GPIOA_PIN11 11U
|
||||
#define GPIOA_PIN12 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_PIN3 3U
|
||||
#define GPIOB_PIN4 4U
|
||||
#define GPIOB_PIN5 5U
|
||||
#define GPIOB_PIN6 6U
|
||||
#define GPIOB_PIN7 7U
|
||||
#define GPIOB_PIN8 8U
|
||||
#define GPIOB_PIN9 9U
|
||||
#define GPIOB_PIN10 10U
|
||||
#define GPIOB_PIN11 11U
|
||||
#define GPIOB_PIN12 12U
|
||||
#define GPIOB_PIN13 13U
|
||||
#define GPIOB_PIN14 14U
|
||||
#define GPIOB_PIN15 15U
|
||||
|
||||
#define GPIOC_PIN0 0U
|
||||
#define GPIOC_PIN1 1U
|
||||
#define GPIOC_PIN2 2U
|
||||
#define GPIOC_PIN3 3U
|
||||
#define GPIOC_PIN4 4U
|
||||
#define GPIOC_PIN5 5U
|
||||
#define GPIOC_PIN6 6U
|
||||
#define GPIOC_PIN7 7U
|
||||
#define GPIOC_PIN8 8U
|
||||
#define GPIOC_PIN9 9U
|
||||
#define GPIOC_PIN10 10U
|
||||
#define GPIOC_PIN11 11U
|
||||
#define GPIOC_PIN12 12U
|
||||
#define GPIOC_PIN13 13U
|
||||
#define GPIOC_PIN14 14U
|
||||
#define GPIOC_PIN15 15U
|
||||
|
||||
#define GPIOD_HEXT_IN 0U
|
||||
#define GPIOD_HEXT_OUT 1U
|
||||
#define GPIOD_PIN2 2U
|
||||
|
||||
#define GPIOF_PIN4 4U
|
||||
#define GPIOF_PIN5 5U
|
||||
#define GPIOF_PIN6 6U
|
||||
#define GPIOF_PIN7 7U
|
||||
|
||||
/*===========================================================================*/
|
||||
/* 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.
|
||||
*
|
||||
* The digits have the following meaning:
|
||||
* 0 - Analog input.
|
||||
* 1 - Push Pull output 10MHz.
|
||||
* 2 - Push Pull output 2MHz.
|
||||
* 3 - Push Pull output 50MHz.
|
||||
* 4 - Digital input.
|
||||
* 5 - Open Drain output 10MHz.
|
||||
* 6 - Open Drain output 2MHz.
|
||||
* 7 - Open Drain output 50MHz.
|
||||
* 8 - Digital input with Pull-Up or Pull-Down resistor depending on ODT.
|
||||
* 9 - Alternate Push Pull output 10MHz.
|
||||
* A - Alternate Push Pull output 2MHz.
|
||||
* B - Alternate Push Pull output 50MHz.
|
||||
* C - Reserved.
|
||||
* D - Alternate Open Drain output 10MHz.
|
||||
* E - Alternate Open Drain output 2MHz.
|
||||
* F - Alternate Open Drain output 50MHz.
|
||||
* Please refer to the AT32 Reference Manual for details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Port A setup.
|
||||
*/
|
||||
#define VAL_GPIOACFGLR 0x88888B88 /* PA7...PA0 */
|
||||
#define VAL_GPIOACFGHR 0x888888B8 /* PA15...PA8 */
|
||||
#define VAL_GPIOAODT 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port B setup.
|
||||
*/
|
||||
#define VAL_GPIOBCFGLR 0x88888888 /* PB7...PB0 */
|
||||
#define VAL_GPIOBCFGHR 0x88888888 /* PB15...PB8 */
|
||||
#define VAL_GPIOBODT 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port C setup.
|
||||
*/
|
||||
#define VAL_GPIOCCFGLR 0x88888888 /* PC7...PC0 */
|
||||
#define VAL_GPIOCCFGHR 0x88888888 /* PC15...PC8 */
|
||||
#define VAL_GPIOCODT 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port D setup.
|
||||
* Everything input with pull-up except:
|
||||
* PD0 - Normal input (GPIOD_HEXT_IN).
|
||||
* PD1 - Normal input (GPIOD_HEXT_OUT).
|
||||
*/
|
||||
#define VAL_GPIODCFGLR 0x88888844 /* PD7...PD0 */
|
||||
#define VAL_GPIODCFGHR 0x88888888 /* PD15...PD8 */
|
||||
#define VAL_GPIODODT 0xFFFFFFFF
|
||||
|
||||
/*
|
||||
* Port F setup.
|
||||
*/
|
||||
#define VAL_GPIOFCFGLR 0x88888888 /* PF7...PF0 */
|
||||
#define VAL_GPIOFCFGHR 0x88888888 /* PF15...PF8 */
|
||||
#define VAL_GPIOFODT 0xFFFFFFFF
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if !defined(_FROM_ASM_)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void boardInit(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* _FROM_ASM_ */
|
||||
|
||||
#endif /* _BOARD_H_ */
|
@ -0,0 +1,9 @@
|
||||
# List of all the board related files.
|
||||
BOARDSRC = $(BOARD_PATH)/board/board.c
|
||||
|
||||
# Required include directories
|
||||
BOARDINC = $(BOARD_PATH)/board
|
||||
|
||||
# Shared variables
|
||||
ALLCSRC += $(BOARDSRC)
|
||||
ALLINC += $(BOARDINC)
|
@ -0,0 +1,13 @@
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BOARD_OTG_VBUSIG
|
||||
|
||||
#define USB_ENDPOINTS_ARE_REORDERABLE
|
||||
|
||||
#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
|
||||
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
|
||||
#endif
|
236
platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h
Normal file
236
platforms/chibios/boards/GENERIC_AT32_F415XX/configs/mcuconf.h
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2020 Giovanni Di Sirio
|
||||
ChibiOS - Copyright (C) 2023..2024 HorrorTroll
|
||||
ChibiOS - Copyright (C) 2023..2024 Zhaqian
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
#ifndef MCUCONF_H
|
||||
#define MCUCONF_H
|
||||
|
||||
/*
|
||||
* AT32F415 drivers configuration.
|
||||
* The following settings override the default settings present in
|
||||
* the various device driver implementation headers.
|
||||
* Note that the settings for each driver only have effect if the whole
|
||||
* driver is enabled in halconf.h.
|
||||
*
|
||||
* IRQ priorities:
|
||||
* 15...0 Lowest...Highest.
|
||||
*
|
||||
* DMA priorities:
|
||||
* 0...3 Lowest...Highest.
|
||||
*/
|
||||
|
||||
#define AT32F415_MCUCONF
|
||||
|
||||
/*
|
||||
* General settings.
|
||||
*/
|
||||
#define AT32_NO_INIT FALSE
|
||||
|
||||
/*
|
||||
* HAL driver system settings.
|
||||
*/
|
||||
#define AT32_HICK_ENABLED TRUE
|
||||
#define AT32_LICK_ENABLED FALSE
|
||||
#define AT32_HEXT_ENABLED TRUE
|
||||
#define AT32_LEXT_ENABLED FALSE
|
||||
#define AT32_SCLKSEL AT32_SCLKSEL_PLL
|
||||
#define AT32_PLLRCS AT32_PLLRCS_HEXT
|
||||
#define AT32_PLLHEXTDIV AT32_PLLHEXTDIV_DIV1
|
||||
#define AT32_PLLCFGEN AT32_PLLCFGEN_SOLID
|
||||
#define AT32_PLLMULT_VALUE 18
|
||||
#define AT32_PLL_FR_VALUE 4
|
||||
#define AT32_PLL_MS_VALUE 1
|
||||
#define AT32_PLL_NS_VALUE 72
|
||||
#define AT32_AHBDIV AT32_AHBDIV_DIV1
|
||||
#define AT32_APB1DIV AT32_APB1DIV_DIV2
|
||||
#define AT32_APB2DIV AT32_APB2DIV_DIV2
|
||||
#define AT32_ADCDIV AT32_ADCDIV_DIV4
|
||||
#define AT32_USB_CLOCK_REQUIRED TRUE
|
||||
#define AT32_USBDIV AT32_USBDIV_DIV3
|
||||
#define AT32_CLKOUT_SEL AT32_CLKOUT_SEL_NOCLOCK
|
||||
#define AT32_CLKOUTDIV AT32_CLKOUTDIV_DIV1
|
||||
#define AT32_ERTCSEL AT32_ERTCSEL_HEXTDIV
|
||||
#define AT32_PVM_ENABLE FALSE
|
||||
#define AT32_PVMSEL AT32_PVMSEL_LEV1
|
||||
|
||||
/*
|
||||
* IRQ system settings.
|
||||
*/
|
||||
#define AT32_IRQ_EXINT0_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT1_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT2_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT3_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT4_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT5_9_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT10_15_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT16_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT17_PRIORITY 15
|
||||
#define AT32_IRQ_EXINT18_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT19_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT20_PRIORITY 6
|
||||
#define AT32_IRQ_EXINT21_PRIORITY 15
|
||||
#define AT32_IRQ_EXINT22_PRIORITY 15
|
||||
|
||||
#define AT32_IRQ_TMR1_BRK_TMR9_PRIORITY 7
|
||||
#define AT32_IRQ_TMR1_OVF_TMR10_PRIORITY 7
|
||||
#define AT32_IRQ_TMR1_HALL_TMR11_PRIORITY 7
|
||||
#define AT32_IRQ_TMR1_CH_PRIORITY 7
|
||||
#define AT32_IRQ_TMR2_PRIORITY 7
|
||||
#define AT32_IRQ_TMR3_PRIORITY 7
|
||||
#define AT32_IRQ_TMR4_PRIORITY 7
|
||||
#define AT32_IRQ_TMR5_PRIORITY 7
|
||||
|
||||
#define AT32_IRQ_USART1_PRIORITY 12
|
||||
#define AT32_IRQ_USART2_PRIORITY 12
|
||||
#define AT32_IRQ_USART3_PRIORITY 12
|
||||
#define AT32_IRQ_UART4_PRIORITY 12
|
||||
#define AT32_IRQ_UART5_PRIORITY 12
|
||||
|
||||
/*
|
||||
* ADC driver system settings.
|
||||
*/
|
||||
#define AT32_ADC_USE_ADC1 FALSE
|
||||
#define AT32_ADC_ADC1_DMA_PRIORITY 2
|
||||
#define AT32_ADC_ADC1_IRQ_PRIORITY 6
|
||||
|
||||
/*
|
||||
* CAN driver system settings.
|
||||
*/
|
||||
#define AT32_CAN_USE_CAN1 FALSE
|
||||
#define AT32_CAN_CAN1_IRQ_PRIORITY 11
|
||||
|
||||
/*
|
||||
* DMA driver system settings.
|
||||
*/
|
||||
#define AT32_DMA_USE_DMAMUX TRUE
|
||||
|
||||
/*
|
||||
* GPT driver system settings.
|
||||
*/
|
||||
#define AT32_GPT_USE_TMR1 FALSE
|
||||
#define AT32_GPT_USE_TMR2 FALSE
|
||||
#define AT32_GPT_USE_TMR3 FALSE
|
||||
#define AT32_GPT_USE_TMR4 FALSE
|
||||
#define AT32_GPT_USE_TMR5 FALSE
|
||||
#define AT32_GPT_USE_TMR9 FALSE
|
||||
#define AT32_GPT_USE_TMR10 FALSE
|
||||
#define AT32_GPT_USE_TMR11 FALSE
|
||||
|
||||
/*
|
||||
* I2C driver system settings.
|
||||
*/
|
||||
#define AT32_I2C_USE_I2C1 FALSE
|
||||
#define AT32_I2C_USE_I2C2 FALSE
|
||||
#define AT32_I2C_BUSY_TIMEOUT 50
|
||||
#define AT32_I2C_I2C1_IRQ_PRIORITY 5
|
||||
#define AT32_I2C_I2C2_IRQ_PRIORITY 5
|
||||
#define AT32_I2C_I2C1_DMA_PRIORITY 3
|
||||
#define AT32_I2C_I2C2_DMA_PRIORITY 3
|
||||
#define AT32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure")
|
||||
|
||||
/*
|
||||
* ICU driver system settings.
|
||||
*/
|
||||
#define AT32_ICU_USE_TMR1 FALSE
|
||||
#define AT32_ICU_USE_TMR2 FALSE
|
||||
#define AT32_ICU_USE_TMR3 FALSE
|
||||
#define AT32_ICU_USE_TMR4 FALSE
|
||||
#define AT32_ICU_USE_TMR5 FALSE
|
||||
#define AT32_ICU_USE_TMR9 FALSE
|
||||
#define AT32_ICU_USE_TMR10 FALSE
|
||||
#define AT32_ICU_USE_TMR11 FALSE
|
||||
|
||||
/*
|
||||
* PWM driver system settings.
|
||||
*/
|
||||
#define AT32_PWM_USE_TMR1 FALSE
|
||||
#define AT32_PWM_USE_TMR2 FALSE
|
||||
#define AT32_PWM_USE_TMR3 FALSE
|
||||
#define AT32_PWM_USE_TMR4 FALSE
|
||||
#define AT32_PWM_USE_TMR5 FALSE
|
||||
#define AT32_PWM_USE_TMR9 FALSE
|
||||
#define AT32_PWM_USE_TMR10 FALSE
|
||||
#define AT32_PWM_USE_TMR11 FALSE
|
||||
|
||||
/*
|
||||
* RTC driver system settings.
|
||||
*/
|
||||
#define AT32_ERTC_DIVA_VALUE 32
|
||||
#define AT32_ERTC_DIVB_VALUE 1024
|
||||
#define AT32_ERTC_CTRL_INIT 0
|
||||
#define AT32_ERTC_TAMP_INIT 0
|
||||
|
||||
/*
|
||||
* SDC driver system settings.
|
||||
*/
|
||||
#define AT32_SDC_SDIO_DMA_PRIORITY 3
|
||||
#define AT32_SDC_SDIO_IRQ_PRIORITY 9
|
||||
#define AT32_SDC_WRITE_TIMEOUT_MS 1000
|
||||
#define AT32_SDC_READ_TIMEOUT_MS 1000
|
||||
#define AT32_SDC_CLOCK_ACTIVATION_DELAY 10
|
||||
#define AT32_SDC_SDIO_UNALIGNED_SUPPORT TRUE
|
||||
|
||||
/*
|
||||
* SERIAL driver system settings.
|
||||
*/
|
||||
#define AT32_SERIAL_USE_USART1 FALSE
|
||||
#define AT32_SERIAL_USE_USART2 FALSE
|
||||
#define AT32_SERIAL_USE_USART3 FALSE
|
||||
#define AT32_SERIAL_USE_UART4 FALSE
|
||||
#define AT32_SERIAL_USE_UART5 FALSE
|
||||
|
||||
/*
|
||||
* SPI driver system settings.
|
||||
*/
|
||||
#define AT32_SPI_USE_SPI1 FALSE
|
||||
#define AT32_SPI_USE_SPI2 FALSE
|
||||
#define AT32_SPI_SPI1_DMA_PRIORITY 1
|
||||
#define AT32_SPI_SPI2_DMA_PRIORITY 1
|
||||
#define AT32_SPI_SPI1_IRQ_PRIORITY 10
|
||||
#define AT32_SPI_SPI2_IRQ_PRIORITY 10
|
||||
#define AT32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure")
|
||||
|
||||
/*
|
||||
* ST driver system settings.
|
||||
*/
|
||||
#define AT32_ST_IRQ_PRIORITY 8
|
||||
#define AT32_ST_USE_TIMER 2
|
||||
|
||||
/*
|
||||
* UART driver system settings.
|
||||
*/
|
||||
#define AT32_UART_USE_USART1 FALSE
|
||||
#define AT32_UART_USE_USART2 FALSE
|
||||
#define AT32_UART_USE_USART3 FALSE
|
||||
#define AT32_UART_USART1_DMA_PRIORITY 0
|
||||
#define AT32_UART_USART2_DMA_PRIORITY 0
|
||||
#define AT32_UART_USART3_DMA_PRIORITY 0
|
||||
#define AT32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure")
|
||||
|
||||
/*
|
||||
* USB driver system settings.
|
||||
*/
|
||||
#define AT32_USB_USE_OTG1 TRUE
|
||||
#define AT32_USB_OTG1_IRQ_PRIORITY 14
|
||||
#define AT32_USB_OTG1_RX_FIFO_SIZE 512
|
||||
|
||||
/*
|
||||
* WDG driver system settings.
|
||||
*/
|
||||
#define AT32_WDG_USE_WDT FALSE
|
||||
|
||||
#endif /* MCUCONF_H */
|
@ -1,117 +0,0 @@
|
||||
/*
|
||||
ChibiOS - Copyright (C) 2006..2021 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* RP2040 memory setup.
|
||||
*/
|
||||
MEMORY
|
||||
{
|
||||
flash0 (rx) : org = 0x00000000, len = 16k /* ROM */
|
||||
flash1 (rx) : org = 0x10000000, len = DEFINED(FLASH_LEN) ? FLASH_LEN : 2048k /* XIP */
|
||||
flash2 (rx) : org = 0x00000000, len = 0
|
||||
flash3 (rx) : org = 0x00000000, len = 0
|
||||
flash4 (rx) : org = 0x00000000, len = 0
|
||||
flash5 (rx) : org = 0x00000000, len = 0
|
||||
flash6 (rx) : org = 0x00000000, len = 0
|
||||
flash7 (rx) : org = 0x00000000, len = 0
|
||||
ram0 (wx) : org = 0x20000000, len = 256k /* SRAM0 striped */
|
||||
ram1 (wx) : org = 0x00000000, len = 256k /* SRAM0 non striped */
|
||||
ram2 (wx) : org = 0x00000000, len = 0
|
||||
ram3 (wx) : org = 0x00000000, len = 0
|
||||
ram4 (wx) : org = 0x20040000, len = 4k /* SRAM4 */
|
||||
ram5 (wx) : org = 0x20041000, len = 4k /* SRAM5 */
|
||||
ram6 (wx) : org = 0x00000000, len = 0
|
||||
ram7 (wx) : org = 0x20041f00, len = 256 /* SRAM5 boot */
|
||||
}
|
||||
|
||||
/* For each data/text section two region are defined, a virtual region
|
||||
and a load region (_LMA suffix).*/
|
||||
|
||||
/* Flash region to be used for exception vectors.*/
|
||||
REGION_ALIAS("VECTORS_FLASH", flash1);
|
||||
REGION_ALIAS("VECTORS_FLASH_LMA", flash1);
|
||||
|
||||
/* Flash region to be used for constructors and destructors.*/
|
||||
REGION_ALIAS("XTORS_FLASH", flash1);
|
||||
REGION_ALIAS("XTORS_FLASH_LMA", flash1);
|
||||
|
||||
/* Flash region to be used for code text.*/
|
||||
REGION_ALIAS("TEXT_FLASH", flash1);
|
||||
REGION_ALIAS("TEXT_FLASH_LMA", flash1);
|
||||
|
||||
/* Flash region to be used for read only data.*/
|
||||
REGION_ALIAS("RODATA_FLASH", flash1);
|
||||
REGION_ALIAS("RODATA_FLASH_LMA", flash1);
|
||||
|
||||
/* Flash region to be used for various.*/
|
||||
REGION_ALIAS("VARIOUS_FLASH", flash1);
|
||||
REGION_ALIAS("VARIOUS_FLASH_LMA", flash1);
|
||||
|
||||
/* Flash region to be used for RAM(n) initialization data.*/
|
||||
REGION_ALIAS("RAM_INIT_FLASH_LMA", flash1);
|
||||
|
||||
/* RAM region to be used for Main stack. This stack accommodates the processing
|
||||
of all exceptions and interrupts.*/
|
||||
REGION_ALIAS("MAIN_STACK_RAM", ram4);
|
||||
|
||||
/* RAM region to be used for the process stack. This is the stack used by
|
||||
the main() function.*/
|
||||
REGION_ALIAS("PROCESS_STACK_RAM", ram4);
|
||||
|
||||
/* RAM region to be used for Main stack. This stack accommodates the processing
|
||||
of all exceptions and interrupts.*/
|
||||
REGION_ALIAS("C1_MAIN_STACK_RAM", ram5);
|
||||
|
||||
/* RAM region to be used for the process stack. This is the stack used by
|
||||
the main() function.*/
|
||||
REGION_ALIAS("C1_PROCESS_STACK_RAM", ram5);
|
||||
|
||||
/* RAM region to be used for data segment.*/
|
||||
REGION_ALIAS("DATA_RAM", ram0);
|
||||
REGION_ALIAS("DATA_RAM_LMA", flash1);
|
||||
|
||||
/* RAM region to be used for BSS segment.*/
|
||||
REGION_ALIAS("BSS_RAM", ram0);
|
||||
|
||||
/* RAM region to be used for the default heap.*/
|
||||
REGION_ALIAS("HEAP_RAM", ram0);
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.flash_begin : {
|
||||
__flash_binary_start = .;
|
||||
} > flash1
|
||||
|
||||
.boot2 : {
|
||||
__boot2_start__ = .;
|
||||
KEEP (*(.boot2))
|
||||
__boot2_end__ = .;
|
||||
} > flash1
|
||||
}
|
||||
|
||||
/* Generic rules inclusion.*/
|
||||
INCLUDE rules_stacks.ld
|
||||
INCLUDE rules_stacks_c1.ld
|
||||
INCLUDE RP2040_rules_code_with_boot2.ld
|
||||
INCLUDE RP2040_rules_data_with_timecrit.ld
|
||||
INCLUDE rules_memory.ld
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.flash_end : {
|
||||
__flash_binary_end = .;
|
||||
} > flash1
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
.data : ALIGN(4)
|
||||
{
|
||||
PROVIDE(_textdata = LOADADDR(.data));
|
||||
PROVIDE(_data = .);
|
||||
__textdata_base__ = LOADADDR(.data);
|
||||
__data_base__ = .;
|
||||
*(vtable)
|
||||
*(.time_critical*)
|
||||
. = ALIGN(4);
|
||||
*(.data)
|
||||
*(.data.*)
|
||||
*(.ramtext)
|
||||
. = ALIGN(4);
|
||||
PROVIDE(_edata = .);
|
||||
__data_end__ = .;
|
||||
} > DATA_RAM AT > DATA_RAM_LMA
|
||||
|
||||
.bss (NOLOAD) : ALIGN(4)
|
||||
{
|
||||
__bss_base__ = .;
|
||||
*(.bss)
|
||||
*(.bss.*)
|
||||
*(COMMON)
|
||||
. = ALIGN(4);
|
||||
__bss_end__ = .;
|
||||
PROVIDE(end = .);
|
||||
} > BSS_RAM
|
||||
}
|
@ -26,6 +26,7 @@
|
||||
# stm32-dfu STM32 USB DFU in ROM
|
||||
# apm32-dfu APM32 USB DFU in ROM
|
||||
# wb32-dfu WB32 USB DFU in ROM
|
||||
# at32-dfu AT32 USB DFU in ROM
|
||||
# tinyuf2 TinyUF2
|
||||
# rp2040 Raspberry Pi RP2040
|
||||
# Current options for RISC-V:
|
||||
@ -119,6 +120,14 @@ ifeq ($(strip $(BOOTLOADER)), wb32-dfu)
|
||||
OPT_DEFS += -DBOOTLOADER_WB32_DFU
|
||||
BOOTLOADER_TYPE = wb32_dfu
|
||||
endif
|
||||
ifeq ($(strip $(BOOTLOADER)), at32-dfu)
|
||||
OPT_DEFS += -DBOOTLOADER_AT32_DFU
|
||||
BOOTLOADER_TYPE = at32_dfu
|
||||
|
||||
# Options to pass to dfu-util when flashing
|
||||
DFU_ARGS ?= -d 2E3C:DF11 -a 0 -s 0x08000000:leave
|
||||
DFU_SUFFIX_ARGS ?= -v 2E3C -p DF11
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(BOOTLOADER_TYPE)),)
|
||||
ifneq ($(strip $(BOOTLOADER)),)
|
||||
|
83
platforms/chibios/bootloaders/at32_dfu.c
Normal file
83
platforms/chibios/bootloaders/at32_dfu.c
Normal file
@ -0,0 +1,83 @@
|
||||
// Copyright 2021-2023 QMK
|
||||
// Copyright 2023-2024 HorrorTroll <https://github.com/HorrorTroll>
|
||||
// Copyright 2023-2024 Zhaqian <https://github.com/zhaqian12>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "bootloader.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <ch.h>
|
||||
#include <hal.h>
|
||||
#include "wait.h"
|
||||
|
||||
#ifndef AT32_BOOTLOADER_RAM_SYMBOL
|
||||
# define AT32_BOOTLOADER_RAM_SYMBOL __ram0_end__
|
||||
#endif
|
||||
|
||||
extern uint32_t AT32_BOOTLOADER_RAM_SYMBOL;
|
||||
|
||||
/* This code should be checked whether it runs correctly on platforms */
|
||||
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
|
||||
#define BOOTLOADER_MAGIC 0xDEADBEEF
|
||||
#define MAGIC_ADDR (unsigned long *)(SYMVAL(AT32_BOOTLOADER_RAM_SYMBOL) - 4)
|
||||
|
||||
__attribute__((weak)) void bootloader_marker_enable(void) {
|
||||
uint32_t *marker = (uint32_t *)MAGIC_ADDR;
|
||||
*marker = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
|
||||
}
|
||||
|
||||
__attribute__((weak)) bool bootloader_marker_active(void) {
|
||||
const uint32_t *marker = (const uint32_t *)MAGIC_ADDR;
|
||||
return (*marker == BOOTLOADER_MAGIC) ? true : false;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void bootloader_marker_disable(void) {
|
||||
uint32_t *marker = (uint32_t *)MAGIC_ADDR;
|
||||
*marker = 0;
|
||||
}
|
||||
|
||||
__attribute__((weak)) void bootloader_jump(void) {
|
||||
bootloader_marker_enable();
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
__attribute__((weak)) void mcu_reset(void) {
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
|
||||
void enter_bootloader_mode_if_requested(void) {
|
||||
if (bootloader_marker_active()) {
|
||||
bootloader_marker_disable();
|
||||
|
||||
struct system_memory_vector_t {
|
||||
uint32_t stack_top;
|
||||
void (*entrypoint)(void);
|
||||
};
|
||||
const struct system_memory_vector_t *bootloader = (const struct system_memory_vector_t *)(AT32_BOOTLOADER_ADDRESS);
|
||||
|
||||
__disable_irq();
|
||||
|
||||
#if defined(__MPU_PRESENT) && (__MPU_PRESENT == 1U)
|
||||
ARM_MPU_Disable();
|
||||
#endif
|
||||
|
||||
SysTick->CTRL = 0;
|
||||
SysTick->VAL = 0;
|
||||
SysTick->LOAD = 0;
|
||||
|
||||
// Clear interrupt enable and interrupt pending registers
|
||||
for (int i = 0; i < ARRAY_SIZE(NVIC->ICER); i++) {
|
||||
NVIC->ICER[i] = 0xFFFFFFFF;
|
||||
NVIC->ICPR[i] = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
__set_CONTROL(0);
|
||||
__set_MSP(bootloader->stack_top);
|
||||
__enable_irq();
|
||||
|
||||
// Jump to bootloader
|
||||
bootloader->entrypoint();
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
#include "gpio.h"
|
||||
#include "wait.h"
|
||||
#include "pico/bootrom.h"
|
||||
#include "pico/runtime_init.h"
|
||||
|
||||
#if !defined(RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED)
|
||||
# define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED_MASK 0U
|
||||
@ -39,7 +40,7 @@ const uint32_t magic_token = 0xCAFEB0BA;
|
||||
void __late_init(void) {
|
||||
// All clocks have to be enabled before jumping to the bootloader function,
|
||||
// otherwise the bootrom will be stuck infinitely.
|
||||
clocks_init();
|
||||
runtime_init_clocks();
|
||||
|
||||
if (magic_location != magic_token) {
|
||||
magic_location = magic_token;
|
||||
|
@ -142,6 +142,19 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// AT32 compatibility
|
||||
#if defined(MCU_AT32)
|
||||
# define CPU_CLOCK AT32_SYSCLK
|
||||
|
||||
# if defined(AT32F415)
|
||||
# define USE_GPIOV1
|
||||
# define USE_I2CV1
|
||||
# define PAL_MODE_ALTERNATE_OPENDRAIN PAL_MODE_AT32_ALTERNATE_OPENDRAIN
|
||||
# define PAL_MODE_ALTERNATE_PUSHPULL PAL_MODE_AT32_ALTERNATE_PUSHPULL
|
||||
# define AUDIO_PWM_PAL_MODE PAL_MODE_ALTERNATE_PUSHPULL
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(GD32VF103)
|
||||
/* This chip has the same API as STM32F103, but uses different names for literally the same thing.
|
||||
* As of 4.7.2021 QMK is tailored to use STM32 defines/names, for compatibility sake
|
||||
|
@ -22,7 +22,7 @@
|
||||
# error "You need to set HAL_USE_ADC to TRUE in your halconf.h to use the ADC."
|
||||
#endif
|
||||
|
||||
#if !RP_ADC_USE_ADC1 && !STM32_ADC_USE_ADC1 && !STM32_ADC_USE_ADC2 && !STM32_ADC_USE_ADC3 && !STM32_ADC_USE_ADC4 && !WB32_ADC_USE_ADC1
|
||||
#if !RP_ADC_USE_ADC1 && !STM32_ADC_USE_ADC1 && !STM32_ADC_USE_ADC2 && !STM32_ADC_USE_ADC3 && !STM32_ADC_USE_ADC4 && !WB32_ADC_USE_ADC1 && !AT32_ADC_USE_ADC1
|
||||
# error "You need to set one of the 'xxx_ADC_USE_ADCx' settings to TRUE in your mcuconf.h to use the ADC."
|
||||
#endif
|
||||
|
||||
@ -45,7 +45,7 @@
|
||||
// Otherwise assume V3
|
||||
#if defined(STM32F0XX) || defined(STM32L0XX)
|
||||
# define USE_ADCV1
|
||||
#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx)
|
||||
#elif defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx) || defined(AT32F415)
|
||||
# define USE_ADCV2
|
||||
#endif
|
||||
|
||||
@ -82,7 +82,7 @@
|
||||
|
||||
/* User configurable ADC options */
|
||||
#ifndef ADC_COUNT
|
||||
# if defined(RP2040) || defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx)
|
||||
# if defined(RP2040) || defined(STM32F0XX) || defined(STM32F1XX) || defined(STM32F4XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx) || defined(AT32F415)
|
||||
# define ADC_COUNT 1
|
||||
# elif defined(STM32F3XX) || defined(STM32G4XX)
|
||||
# define ADC_COUNT 4
|
||||
@ -142,11 +142,16 @@ static ADCConversionGroup adcConversionGroup = {
|
||||
.cfgr1 = ADC_CFGR1_CONT | ADC_RESOLUTION,
|
||||
.smpr = ADC_SAMPLING_RATE,
|
||||
#elif defined(USE_ADCV2)
|
||||
# if !defined(STM32F1XX) && !defined(GD32VF103) && !defined(WB32F3G71xx) && !defined(WB32FQ95xx)
|
||||
# if !defined(STM32F1XX) && !defined(GD32VF103) && !defined(WB32F3G71xx) && !defined(WB32FQ95xx) && !defined(AT32F415)
|
||||
.cr2 = ADC_CR2_SWSTART, // F103 seem very unhappy with, F401 seems very unhappy without...
|
||||
# endif
|
||||
# if defined(AT32F415)
|
||||
.spt2 = ADC_SPT2_CSPT_AN0(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN1(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN2(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN3(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN4(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN5(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN6(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN7(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN8(ADC_SAMPLING_RATE) | ADC_SPT2_CSPT_AN9(ADC_SAMPLING_RATE),
|
||||
.spt1 = ADC_SPT1_CSPT_AN10(ADC_SAMPLING_RATE) | ADC_SPT1_CSPT_AN11(ADC_SAMPLING_RATE) | ADC_SPT1_CSPT_AN12(ADC_SAMPLING_RATE) | ADC_SPT1_CSPT_AN13(ADC_SAMPLING_RATE) | ADC_SPT1_CSPT_AN14(ADC_SAMPLING_RATE) | ADC_SPT1_CSPT_AN15(ADC_SAMPLING_RATE),
|
||||
# else
|
||||
.smpr2 = ADC_SMPR2_SMP_AN0(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN1(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN2(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN3(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN4(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN5(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN6(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN7(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN8(ADC_SAMPLING_RATE) | ADC_SMPR2_SMP_AN9(ADC_SAMPLING_RATE),
|
||||
.smpr1 = ADC_SMPR1_SMP_AN10(ADC_SAMPLING_RATE) | ADC_SMPR1_SMP_AN11(ADC_SAMPLING_RATE) | ADC_SMPR1_SMP_AN12(ADC_SAMPLING_RATE) | ADC_SMPR1_SMP_AN13(ADC_SAMPLING_RATE) | ADC_SMPR1_SMP_AN14(ADC_SAMPLING_RATE) | ADC_SMPR1_SMP_AN15(ADC_SAMPLING_RATE),
|
||||
# endif
|
||||
#elif defined(RP2040)
|
||||
// RP2040 does not have any extra config here
|
||||
#else
|
||||
@ -242,7 +247,7 @@ __attribute__((weak)) adc_mux pinToMux(pin_t pin) {
|
||||
case F9: return TO_MUX( ADC_CHANNEL_IN7, 2 );
|
||||
case F10: return TO_MUX( ADC_CHANNEL_IN8, 2 );
|
||||
# endif
|
||||
#elif defined(STM32F1XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx)
|
||||
#elif defined(STM32F1XX) || defined(GD32VF103) || defined(WB32F3G71xx) || defined(WB32FQ95xx) || defined(AT32F415)
|
||||
case A0: return TO_MUX( ADC_CHANNEL_IN0, 0 );
|
||||
case A1: return TO_MUX( ADC_CHANNEL_IN1, 0 );
|
||||
case A2: return TO_MUX( ADC_CHANNEL_IN2, 0 );
|
||||
@ -344,7 +349,7 @@ __attribute__((weak)) adc_mux pinToMux(pin_t pin) {
|
||||
|
||||
static inline ADCDriver* intToADCDriver(uint8_t adcInt) {
|
||||
switch (adcInt) {
|
||||
#if RP_ADC_USE_ADC1 || STM32_ADC_USE_ADC1 || WB32_ADC_USE_ADC1
|
||||
#if RP_ADC_USE_ADC1 || STM32_ADC_USE_ADC1 || WB32_ADC_USE_ADC1 || AT32_ADC_USE_ADC1
|
||||
case 0:
|
||||
return &ADCD1;
|
||||
#endif
|
||||
@ -391,7 +396,11 @@ int16_t adc_read(adc_mux mux) {
|
||||
// TODO: fix previous assumption of only 1 input...
|
||||
adcConversionGroup.chselr = 1 << mux.input; /*no macro to convert N to ADC_CHSELR_CHSEL1*/
|
||||
#elif defined(USE_ADCV2)
|
||||
# if defined(AT32F415)
|
||||
adcConversionGroup.osq3 = ADC_OSQ3_OSN1_N(mux.input);
|
||||
# else
|
||||
adcConversionGroup.sqr3 = ADC_SQR3_SQ1_N(mux.input);
|
||||
# endif
|
||||
#elif defined(RP2040)
|
||||
adcConversionGroup.channel_mask = 1 << mux.input;
|
||||
#else
|
||||
|
@ -9,6 +9,17 @@
|
||||
|
||||
#if defined(SERIAL_USART_CONFIG)
|
||||
static QMKSerialConfig serial_config = SERIAL_USART_CONFIG;
|
||||
#elif defined(MCU_AT32) /* AT32 MCUs */
|
||||
static QMKSerialConfig serial_config = {
|
||||
.speed = (SERIAL_USART_SPEED),
|
||||
.ctrl1 = (SERIAL_USART_CTRL1),
|
||||
.ctrl2 = (SERIAL_USART_CTRL2),
|
||||
# if !defined(SERIAL_USART_FULL_DUPLEX)
|
||||
.ctrl3 = ((SERIAL_USART_CTRL3) | USART_CTRL3_SLBEN) /* activate half-duplex mode */
|
||||
# else
|
||||
.ctrl3 = (SERIAL_USART_CTRL3)
|
||||
# endif
|
||||
};
|
||||
#elif defined(MCU_STM32) /* STM32 MCUs */
|
||||
static QMKSerialConfig serial_config = {
|
||||
# if HAL_USE_SERIAL
|
||||
@ -160,7 +171,7 @@ inline bool serial_transport_receive_blocking(uint8_t* destination, const size_t
|
||||
* @brief Initiate pins for USART peripheral. Half-duplex configuration.
|
||||
*/
|
||||
__attribute__((weak)) void usart_init(void) {
|
||||
# if defined(MCU_STM32) /* STM32 MCUs */
|
||||
# if defined(MCU_STM32) || defined(MCU_AT32) /* STM32 and AT32 MCUs */
|
||||
# if defined(USE_GPIOV1)
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE_OPENDRAIN);
|
||||
# else
|
||||
@ -183,7 +194,7 @@ __attribute__((weak)) void usart_init(void) {
|
||||
* @brief Initiate pins for USART peripheral. Full-duplex configuration.
|
||||
*/
|
||||
__attribute__((weak)) void usart_init(void) {
|
||||
# if defined(MCU_STM32) /* STM32 MCUs */
|
||||
# if defined(MCU_STM32) || defined(MCU_AT32) /* STM32 and AT32 MCUs */
|
||||
# if defined(USE_GPIOV1)
|
||||
palSetLineMode(SERIAL_USART_TX_PIN, PAL_MODE_ALTERNATE_PUSHPULL);
|
||||
palSetLineMode(SERIAL_USART_RX_PIN, PAL_MODE_INPUT);
|
||||
|
@ -74,6 +74,7 @@ typedef SIOConfig QMKSerialConfig;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MCU_STM32) /* STM32 MCUs */
|
||||
# if !defined(USART_CR1_M0)
|
||||
# define USART_CR1_M0 USART_CR1_M // some platforms (f1xx) dont have this so
|
||||
# endif
|
||||
@ -111,3 +112,37 @@ typedef SIOConfig QMKSerialConfig;
|
||||
(AFIO->MAPR |= AFIO_MAPR_USART3_REMAP_FULLREMAP); \
|
||||
} while (0)
|
||||
# endif
|
||||
#elif defined(MCU_AT32) /* AT32 MCUs */
|
||||
# if !defined(USART_CTRL1_DBN0)
|
||||
# define USART_CTRL1_DBN0 USART_CTRL1_DBN
|
||||
# endif
|
||||
|
||||
# if !defined(SERIAL_USART_CTRL1)
|
||||
# define SERIAL_USART_CTRL1 (USART_CTRL1_PEN | USART_CTRL1_PSEL | USART_CTRL1_DBN0) // parity enable, odd parity, 9 bit length
|
||||
# endif
|
||||
|
||||
# if !defined(SERIAL_USART_CTRL2)
|
||||
# define SERIAL_USART_CTRL2 (USART_CTRL2_STOPBN_1) // 2 stop bits
|
||||
# endif
|
||||
|
||||
# if !defined(SERIAL_USART_CTRL3)
|
||||
# define SERIAL_USART_CTRL3 0
|
||||
# endif
|
||||
|
||||
# if defined(USART1_REMAP)
|
||||
# define USART_REMAP \
|
||||
do { \
|
||||
(IOMUX->REMAP |= IOMUX_REMAP_USART1_MUX); \
|
||||
} while (0)
|
||||
# elif defined(USART3_PARTIALREMAP)
|
||||
# define USART_REMAP \
|
||||
do { \
|
||||
(IOMUX->REMAP |= IOMUX_REMAP_USART3_MUX_MUX1); \
|
||||
} while (0)
|
||||
# elif defined(USART3_FULLREMAP)
|
||||
# define USART_REMAP \
|
||||
do { \
|
||||
(IOMUX->REMAP |= IOMUX_REMAP_USART3_MUX_MUX2); \
|
||||
} while (0)
|
||||
# endif
|
||||
#endif
|
||||
|
@ -103,10 +103,16 @@ bool spi_start_extended(spi_start_config_t *start_config) {
|
||||
roundedDivisor <<= 1;
|
||||
}
|
||||
|
||||
# if defined(AT32F415)
|
||||
if (roundedDivisor < 2 || roundedDivisor > 1024) {
|
||||
return false;
|
||||
}
|
||||
# else
|
||||
if (roundedDivisor < 2 || roundedDivisor > 256) {
|
||||
return false;
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(K20x) || defined(KL2x)
|
||||
spiConfig.tar0 = SPIx_CTARn_FMSZ(7) | SPIx_CTARn_ASC(1);
|
||||
@ -240,6 +246,59 @@ bool spi_start_extended(spi_start_config_t *start_config) {
|
||||
spiConfig.SSPCR0 |= SPI_SSPCR0_SPH; // Clock phase: sample on second edge transition
|
||||
break;
|
||||
}
|
||||
#elif defined(AT32F415)
|
||||
spiConfig.ctrl1 = 0;
|
||||
|
||||
if (lsbFirst) {
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_LTF;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_CLKPHA;
|
||||
break;
|
||||
case 2:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_CLKPOL;
|
||||
break;
|
||||
case 3:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_CLKPHA | SPI_CTRL1_CLKPOL;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (roundedDivisor) {
|
||||
case 2:
|
||||
break;
|
||||
case 4:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_0;
|
||||
break;
|
||||
case 8:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_1;
|
||||
break;
|
||||
case 16:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_1 | SPI_CTRL1_MDIV_0;
|
||||
break;
|
||||
case 32:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_2;
|
||||
break;
|
||||
case 64:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_0;
|
||||
break;
|
||||
case 128:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_1;
|
||||
break;
|
||||
case 256:
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_1 | SPI_CTRL1_MDIV_0;
|
||||
break;
|
||||
case 512:
|
||||
spiConfig.ctrl2 |= SPI_CTRL1_MDIV_3;
|
||||
break;
|
||||
case 1024:
|
||||
spiConfig.ctrl2 |= SPI_CTRL1_MDIV_3;
|
||||
spiConfig.ctrl1 |= SPI_CTRL1_MDIV_0;
|
||||
break;
|
||||
}
|
||||
#else
|
||||
spiConfig.cr1 = 0;
|
||||
|
||||
|
@ -33,7 +33,7 @@ static inline uint32_t detect_flash_size(void) {
|
||||
#elif defined(FLASH_SIZE)
|
||||
return FLASH_SIZE;
|
||||
#elif defined(FLASHSIZE_BASE)
|
||||
# if defined(QMK_MCU_SERIES_STM32F0XX) || defined(QMK_MCU_SERIES_STM32F1XX) || defined(QMK_MCU_SERIES_STM32F3XX) || defined(QMK_MCU_SERIES_STM32F4XX) || defined(QMK_MCU_SERIES_STM32G4XX) || defined(QMK_MCU_SERIES_STM32L0XX) || defined(QMK_MCU_SERIES_STM32L4XX) || defined(QMK_MCU_SERIES_GD32VF103)
|
||||
# if defined(QMK_MCU_SERIES_STM32F0XX) || defined(QMK_MCU_SERIES_STM32F1XX) || defined(QMK_MCU_SERIES_STM32F3XX) || defined(QMK_MCU_SERIES_STM32F4XX) || defined(QMK_MCU_SERIES_STM32G4XX) || defined(QMK_MCU_SERIES_STM32L0XX) || defined(QMK_MCU_SERIES_STM32L4XX) || defined(QMK_MCU_SERIES_AT32F415) || defined(QMK_MCU_SERIES_GD32VF103)
|
||||
return ((*(uint32_t *)FLASHSIZE_BASE) & 0xFFFFU) << 10U; // this register has the flash size in kB, so we convert it to bytes
|
||||
# elif defined(QMK_MCU_SERIES_STM32L1XX)
|
||||
# error This MCU family has an uncommon flash size register definition and has not been implemented. Perhaps try using the true EEPROM on the MCU instead?
|
||||
|
@ -16,6 +16,8 @@
|
||||
# define BACKING_STORE_WRITE_SIZE 4 // from hal_efl_lld.c
|
||||
# elif defined(QMK_MCU_FAMILY_WB32)
|
||||
# define BACKING_STORE_WRITE_SIZE 8 // from hal_efl_lld.c
|
||||
# elif defined(QMK_MCU_FAMILY_AT32)
|
||||
# define BACKING_STORE_WRITE_SIZE 2 // from hal_efl_lld.c
|
||||
# elif defined(QMK_MCU_FAMILY_STM32)
|
||||
# if defined(STM32_FLASH_LINE_SIZE) // from some family's stm32_registry.h file
|
||||
# define BACKING_STORE_WRITE_SIZE (STM32_FLASH_LINE_SIZE)
|
||||
|
@ -11,7 +11,7 @@
|
||||
/* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */
|
||||
|
||||
#ifndef WS2812_BITBANG_NOP_FUDGE
|
||||
# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(WB32F3G71xx) || defined(WB32FQ95xx)
|
||||
# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(WB32F3G71xx) || defined(WB32FQ95xx) || defined(AT32F415)
|
||||
# define WS2812_BITBANG_NOP_FUDGE 0.4
|
||||
# else
|
||||
# if defined(RP2040)
|
||||
|
@ -40,6 +40,9 @@
|
||||
#if (STM32_DMA_SUPPORTS_DMAMUX == TRUE) && !defined(WS2812_PWM_DMAMUX_ID)
|
||||
# error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_PWM_DMAMUX_ID STM32_DMAMUX1_TIM?_UP"
|
||||
#endif
|
||||
#if (AT32_DMA_SUPPORTS_DMAMUX == TRUE) && !defined(WS2812_PWM_DMAMUX_CHANNEL) && !defined(WS2812_PWM_DMAMUX_ID)
|
||||
# error "please consult your MCU's datasheet and specify in your config.h: #define WS2812_PWM_DMAMUX_CHANNEL 1, #define WS2812_PWM_DMAMUX_ID AT32_DMAMUX_TMR?_OVERFLOW"
|
||||
#endif
|
||||
|
||||
/* Summarize https://www.st.com/resource/en/application_note/an4013-stm32-crossseries-timer-overview-stmicroelectronics.pdf to
|
||||
* figure out if we are using a 32bit timer. This is needed to setup the DMA controller correctly.
|
||||
@ -269,6 +272,14 @@ typedef uint32_t ws2812_buffer_t;
|
||||
# define WS2812_PWM_DMA_PERIPHERAL_WIDTH STM32_DMA_CR_PSIZE_HWORD
|
||||
typedef uint16_t ws2812_buffer_t;
|
||||
# endif
|
||||
#elif defined(AT32F415)
|
||||
# define WS2812_PWM_DMA_MEMORY_WIDTH AT32_DMA_CCTRL_MWIDTH_BYTE
|
||||
# if defined(WS2812_PWM_TIMER_32BIT)
|
||||
# define WS2812_PWM_DMA_PERIPHERAL_WIDTH AT32_DMA_CCTRL_PWIDTH_WORD
|
||||
# else
|
||||
# define WS2812_PWM_DMA_PERIPHERAL_WIDTH AT32_DMA_CCTRL_PWIDTH_HWORD
|
||||
# endif
|
||||
typedef uint8_t ws2812_buffer_t;
|
||||
#else
|
||||
# define WS2812_PWM_DMA_MEMORY_WIDTH STM32_DMA_CR_MSIZE_BYTE
|
||||
# if defined(WS2812_PWM_TIMER_32BIT)
|
||||
@ -309,8 +320,13 @@ void ws2812_init(void) {
|
||||
[0 ... 3] = {.mode = PWM_OUTPUT_DISABLED, .callback = NULL}, // Channels default to disabled
|
||||
[WS2812_PWM_CHANNEL - 1] = {.mode = WS2812_PWM_OUTPUT_MODE, .callback = NULL}, // Turn on the channel we care about
|
||||
},
|
||||
#if defined(AT32F415)
|
||||
.ctrl2 = 0,
|
||||
.iden = AT32_TMR_IDEN_OVFDEN, // DMA on update event for next period
|
||||
#else
|
||||
.cr2 = 0,
|
||||
.dier = TIM_DIER_UDE, // DMA on update event for next period
|
||||
#endif
|
||||
};
|
||||
//#pragma GCC diagnostic pop // Restore command-line warning options
|
||||
|
||||
@ -321,6 +337,11 @@ void ws2812_init(void) {
|
||||
dmaStreamSetSource(WS2812_PWM_DMA_STREAM, ws2812_frame_buffer);
|
||||
dmaStreamSetDestination(WS2812_PWM_DMA_STREAM, &(WS2812_PWM_DRIVER.tim->CCR[WS2812_PWM_CHANNEL - 1])); // Ziel ist der An-Zeit im Cap-Comp-Register
|
||||
dmaStreamSetMode(WS2812_PWM_DMA_STREAM, WB32_DMA_CHCFG_HWHIF(WS2812_PWM_DMA_CHANNEL) | WB32_DMA_CHCFG_DIR_M2P | WB32_DMA_CHCFG_PSIZE_WORD | WB32_DMA_CHCFG_MSIZE_WORD | WB32_DMA_CHCFG_MINC | WB32_DMA_CHCFG_CIRC | WB32_DMA_CHCFG_TCIE | WB32_DMA_CHCFG_PL(3));
|
||||
#elif defined(AT32F415)
|
||||
dmaStreamAlloc(WS2812_PWM_DMA_STREAM - AT32_DMA_STREAM(0), 10, NULL, NULL);
|
||||
dmaStreamSetPeripheral(WS2812_PWM_DMA_STREAM, &(WS2812_PWM_DRIVER.tmr->CDT[WS2812_PWM_CHANNEL - 1])); // Ziel ist der An-Zeit im Cap-Comp-Register
|
||||
dmaStreamSetMemory0(WS2812_PWM_DMA_STREAM, ws2812_frame_buffer);
|
||||
dmaStreamSetMode(WS2812_PWM_DMA_STREAM, AT32_DMA_CCTRL_DTD_M2P | WS2812_PWM_DMA_PERIPHERAL_WIDTH | WS2812_PWM_DMA_MEMORY_WIDTH | AT32_DMA_CCTRL_MINCM | AT32_DMA_CCTRL_LM | AT32_DMA_CCTRL_CHPL(3));
|
||||
#else
|
||||
dmaStreamAlloc(WS2812_PWM_DMA_STREAM - STM32_DMA_STREAM(0), 10, NULL, NULL);
|
||||
dmaStreamSetPeripheral(WS2812_PWM_DMA_STREAM, &(WS2812_PWM_DRIVER.tim->CCR[WS2812_PWM_CHANNEL - 1])); // Ziel ist der An-Zeit im Cap-Comp-Register
|
||||
@ -335,6 +356,11 @@ void ws2812_init(void) {
|
||||
dmaSetRequestSource(WS2812_PWM_DMA_STREAM, WS2812_PWM_DMAMUX_ID);
|
||||
#endif
|
||||
|
||||
#if (AT32_DMA_SUPPORTS_DMAMUX == TRUE)
|
||||
// If the MCU has a DMAMUX we need to assign the correct resource
|
||||
dmaSetRequestSource(WS2812_PWM_DMA_STREAM, WS2812_PWM_DMAMUX_CHANNEL, WS2812_PWM_DMAMUX_ID);
|
||||
#endif
|
||||
|
||||
// Start DMA
|
||||
dmaStreamEnable(WS2812_PWM_DMA_STREAM);
|
||||
|
||||
|
@ -40,6 +40,32 @@
|
||||
|
||||
// Define SPI config speed
|
||||
// baudrate should target 3.2MHz
|
||||
#if defined(AT32F415)
|
||||
# if WS2812_SPI_DIVISOR == 2
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (0)
|
||||
# elif WS2812_SPI_DIVISOR == 4
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_0)
|
||||
# elif WS2812_SPI_DIVISOR == 8
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_1)
|
||||
# elif WS2812_SPI_DIVISOR == 16 // default
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_1 | SPI_CTRL1_MDIV_0)
|
||||
# elif WS2812_SPI_DIVISOR == 32
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_2)
|
||||
# elif WS2812_SPI_DIVISOR == 64
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_0)
|
||||
# elif WS2812_SPI_DIVISOR == 128
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_1)
|
||||
# elif WS2812_SPI_DIVISOR == 256
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_2 | SPI_CTRL1_MDIV_1 | SPI_CTRL1_MDIV_0)
|
||||
# elif WS2812_SPI_DIVISOR == 512
|
||||
# define WS2812_SPI_DIVISOR_CTRL2_MDIV_X (SPI_CTRL1_MDIV_3)
|
||||
# elif WS2812_SPI_DIVISOR == 1024
|
||||
# define WS2812_SPI_DIVISOR_CTRL2_MDIV_X (SPI_CTRL1_MDIV_3)
|
||||
# define WS2812_SPI_DIVISOR_CTRL1_MDIV_X (SPI_CTRL1_MDIV_0)
|
||||
# else
|
||||
# error "Configured WS2812_SPI_DIVISOR value is not supported at this time."
|
||||
# endif
|
||||
#else
|
||||
// F072 fpclk = 48MHz
|
||||
// 48/16 = 3Mhz
|
||||
# if WS2812_SPI_DIVISOR == 2
|
||||
@ -61,6 +87,7 @@
|
||||
# else
|
||||
# error "Configured WS2812_SPI_DIVISOR value is not supported at this time."
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Use SPI circular buffer
|
||||
#ifdef WS2812_SPI_USE_CIRCULAR_BUFFER
|
||||
@ -176,8 +203,16 @@ void ws2812_init(void) {
|
||||
NULL, // error_cb
|
||||
PAL_PORT(WS2812_DI_PIN),
|
||||
PAL_PAD(WS2812_DI_PIN),
|
||||
# if defined(AT32F415)
|
||||
WS2812_SPI_DIVISOR_CTRL1_MDIV_X,
|
||||
# if (WS2812_SPI_DIVISOR == 512 || WS2812_SPI_DIVISOR == 1024)
|
||||
WS2812_SPI_DIVISOR_CTRL2_MDIV_X,
|
||||
# endif
|
||||
0
|
||||
# else
|
||||
WS2812_SPI_DIVISOR_CR1_BR_X,
|
||||
0
|
||||
# endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -113,6 +113,8 @@ else ifeq ($(strip $(MCU_FAMILY)),STM32)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),WB32)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_WB32_DFU_UPDATER)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),AT32)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
|
||||
else ifeq ($(strip $(MCU_FAMILY)),GD32V)
|
||||
$(UNSYNC_OUTPUT_CMD) && $(call EXEC_DFU_UTIL)
|
||||
else
|
||||
|
@ -159,8 +159,8 @@ ifneq ($(findstring RP2040, $(MCU)),)
|
||||
# Linker script to use
|
||||
# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
|
||||
# or <keyboard_dir>/ld/
|
||||
MCU_LDSCRIPT ?= RP2040_FLASH
|
||||
STARTUPLD_CONTRIB = $(CHIBIOS_CONTRIB)/os/common/startup/ARMCMx/compilers/GCC/ld
|
||||
MCU_LDSCRIPT ?= RP2040_FLASH_TIMECRIT
|
||||
LDFLAGS += -L $(STARTUPLD_CONTRIB)
|
||||
|
||||
# Startup code to use
|
||||
@ -809,6 +809,40 @@ ifneq ($(findstring WB32FQ95, $(MCU)),)
|
||||
WB32_BOOTLOADER_ADDRESS ?= 0x1FFFE000
|
||||
endif
|
||||
|
||||
ifneq ($(findstring AT32F415, $(MCU)),)
|
||||
# Cortex version
|
||||
MCU = cortex-m4
|
||||
|
||||
# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7
|
||||
ARMV = 7
|
||||
|
||||
## chip/board settings
|
||||
# - the next two should match the directories in
|
||||
# <chibios[-contrib]>/os/hal/ports/$(MCU_PORT_NAME)/$(MCU_SERIES)
|
||||
# OR
|
||||
# <chibios[-contrib]>/os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||
MCU_FAMILY = AT32
|
||||
MCU_SERIES = AT32F415
|
||||
|
||||
# Linker script to use
|
||||
# - it should exist either in <chibios>/os/common/startup/ARMCMx/compilers/GCC/ld/
|
||||
# or <keyboard_dir>/ld/
|
||||
MCU_LDSCRIPT ?= AT32F415xB
|
||||
|
||||
# Startup code to use
|
||||
# - it should exist in <chibios>/os/common/startup/ARMCMx/compilers/GCC/mk/
|
||||
MCU_STARTUP ?= at32f415
|
||||
|
||||
# Board: it should exist either in <chibios>/os/hal/boards/,
|
||||
# <keyboard_dir>/boards/, or drivers/boards/
|
||||
BOARD ?= GENERIC_AT32_F415XX
|
||||
|
||||
USE_FPU ?= no
|
||||
|
||||
# Bootloader address for AT32 DFU
|
||||
AT32_BOOTLOADER_ADDRESS ?= 0x1FFFAC00
|
||||
endif
|
||||
|
||||
ifneq ($(findstring GD32VF103, $(MCU)),)
|
||||
# RISC-V
|
||||
MCU = risc-v
|
||||
|
@ -155,6 +155,10 @@ ifdef WB32_BOOTLOADER_ADDRESS
|
||||
OPT_DEFS += -DWB32_BOOTLOADER_ADDRESS=$(WB32_BOOTLOADER_ADDRESS)
|
||||
endif
|
||||
|
||||
ifdef AT32_BOOTLOADER_ADDRESS
|
||||
OPT_DEFS += -DAT32_BOOTLOADER_ADDRESS=$(AT32_BOOTLOADER_ADDRESS)
|
||||
endif
|
||||
|
||||
# Work out if we need to set up the include for the bootloader definitions
|
||||
ifneq ("$(wildcard $(KEYBOARD_PATH_5)/bootloader_defs.h)","")
|
||||
OPT_DEFS += -include $(KEYBOARD_PATH_5)/bootloader_defs.h
|
||||
@ -298,11 +302,14 @@ EXTRAINCDIRS += $(CHIBIOS)/os/license \
|
||||
# QMK specific MCU family support selection.
|
||||
##############################################################################
|
||||
ifneq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_SERIES).mk)","")
|
||||
# Either by MCU series e.g. STM32/STM32F1xx.mk or...
|
||||
# MCU series e.g. STM32/STM32F1xx.mk
|
||||
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_SERIES).mk
|
||||
else ifneq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_FAMILY).mk)","")
|
||||
# By MCU family e.g. STM32/STM32.mk
|
||||
# MCU family e.g. STM32/STM32.mk
|
||||
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_FAMILY).mk
|
||||
else ifneq ("$(wildcard $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_SERIES)/$(MCU_SERIES).mk)","")
|
||||
# MCU series in subfolders e.g. RP/RP2040/RP2040.mk
|
||||
include $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)/$(MCU_SERIES)/$(MCU_SERIES).mk
|
||||
endif
|
||||
|
||||
#
|
||||
|
101
platforms/chibios/vendors/RP/RP2040.mk
vendored
101
platforms/chibios/vendors/RP/RP2040.mk
vendored
@ -1,101 +0,0 @@
|
||||
#
|
||||
# Raspberry Pi RP2040 specific drivers
|
||||
##############################################################################
|
||||
COMMON_VPATH += $(PLATFORM_PATH)/$(PLATFORM_KEY)/$(DRIVER_DIR)/vendor/$(MCU_FAMILY)/$(MCU_SERIES)
|
||||
|
||||
ifeq ($(strip $(WS2812_DRIVER)), vendor)
|
||||
OPT_DEFS += -DRP_DMA_REQUIRED=TRUE
|
||||
endif
|
||||
|
||||
#
|
||||
# Raspberry Pi Pico SDK Support
|
||||
##############################################################################
|
||||
ADEFS += -DCRT0_VTOR_INIT=1 \
|
||||
-DCRT0_EXTRA_CORES_NUMBER=0 \
|
||||
-DCRT0_INIT_VECTORS=1
|
||||
|
||||
CFLAGS += -DPICO_NO_FPGA_CHECK \
|
||||
-DNDEBUG
|
||||
|
||||
#
|
||||
# Pico SDK source and header files needed by QMK and ChibiOS
|
||||
##############################################################################
|
||||
PICOSDKROOT := $(TOP_DIR)/lib/pico-sdk
|
||||
|
||||
PICOSDKSRC = $(PICOSDKROOT)/src/rp2_common/hardware_clocks/clocks.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_pll/pll.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_pio/pio.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_timer/timer.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_flash/flash.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_gpio/gpio.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_claim/claim.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_watchdog/watchdog.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_xosc/xosc.c \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_bootrom/bootrom.c
|
||||
|
||||
PICOSDKINC = $(CHIBIOS)//os/various/pico_bindings/dumb/include \
|
||||
$(PICOSDKROOT)/src/common/pico_base/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_platform/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_base/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_clocks/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_claim/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_flash/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_gpio/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_irq/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_pll/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_pio/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_sync/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_timer/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_resets/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_watchdog/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_xosc/include \
|
||||
$(PICOSDKROOT)/src/rp2040/hardware_regs/include \
|
||||
$(PICOSDKROOT)/src/rp2040/hardware_structs/include \
|
||||
$(PICOSDKROOT)/src/boards/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_bootrom/include
|
||||
|
||||
PLATFORM_SRC += $(PICOSDKSRC)
|
||||
EXTRAINCDIRS += $(PICOSDKINC)
|
||||
|
||||
PLATFORM_RP2040_PATH := $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)
|
||||
|
||||
PLATFORM_SRC += $(PLATFORM_RP2040_PATH)/stage2_bootloaders.c \
|
||||
$(PLATFORM_RP2040_PATH)/pico_sdk_shims.c
|
||||
|
||||
EXTRAINCDIRS += $(PLATFORM_RP2040_PATH)
|
||||
|
||||
#
|
||||
# RP2040 optimized compiler intrinsics
|
||||
##############################################################################
|
||||
|
||||
# The RP2040 sdk provides optimized compiler intrinsics which override the GCC
|
||||
# built-ins. Some of these functions are located in the bootrom of the RP2040.
|
||||
# Execution of these functions is realized via a vtable that is populated on
|
||||
# bootup. This mechanism needs startup code and linker script support from
|
||||
# ChibiOS, which is currently not implemented thus these functions are disabled
|
||||
# ATM.
|
||||
PICOSDKINTRINSICSSRC = $(PICOSDKROOT)/src/rp2_common/pico_divider/divider.S \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S
|
||||
|
||||
PICOSDKINTRINSICSINC = $(PICOSDKROOT)/src/common/pico_base/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_platfrom/include \
|
||||
$(PICOSDKROOT)/src/rp2_common/hardware_divider/include
|
||||
|
||||
# integer division intrinsics utilizing the RP2040 hardware divider
|
||||
OPT_DEFS += -DPICO_DIVIDER_IN_RAM=1
|
||||
OPT_DEFS += -DPICO_DIVIDER_DISABLE_INTERRUPTS=1
|
||||
|
||||
CFLAGS += -Wl,--wrap=__aeabi_idiv
|
||||
CFLAGS += -Wl,--wrap=__aeabi_idivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_ldivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uidiv
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uidivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uldivmod
|
||||
|
||||
# 64bit integer intrinsics
|
||||
OPT_DEFS += -DPICO_INT64_OPS_IN_RAM=1
|
||||
|
||||
CFLAGS += -Wl,--wrap=__aeabi_lmul
|
||||
|
||||
PLATFORM_SRC += $(PICOSDKINTRINSICSSRC)
|
||||
EXTRAINCDIRS += $(PICOSDKINTRINSICSINC)
|
52
platforms/chibios/vendors/RP/RP2040/RP2040.mk
vendored
Normal file
52
platforms/chibios/vendors/RP/RP2040/RP2040.mk
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
PLATFORM_RP_PATH := $(PLATFORM_PATH)/$(PLATFORM_KEY)/vendors/$(MCU_FAMILY)
|
||||
PLATFORM_RP2040_PATH := $(PLATFORM_RP_PATH)/$(MCU_SERIES)
|
||||
|
||||
include $(PLATFORM_RP_PATH)/rp_common.mk
|
||||
|
||||
#
|
||||
# RP2040 specific source and header files needed by QMK and ChibiOS
|
||||
##############################################################################
|
||||
RP2040_INC = $(PICOSDKROOT)/src/rp2040/hardware_regs/include \
|
||||
$(PICOSDKROOT)/src/rp2040/hardware_structs/include \
|
||||
$(PICOSDKROOT)/src/rp2040/pico_platform/include \
|
||||
$(PLATFORM_RP2040_PATH)
|
||||
|
||||
RP2040_SRC = $(PLATFORM_RP2040_PATH)/stage2_bootloaders.c
|
||||
|
||||
CFLAGS += -DPICO_RP2040=1
|
||||
|
||||
#
|
||||
# RP2040 optimized compiler intrinsics
|
||||
##############################################################################
|
||||
|
||||
# The RP2040 sdk provides optimized compiler intrinsics which override the GCC
|
||||
# built-ins. Some of these functions are located in the bootrom of the RP2040.
|
||||
# Execution of these functions is realized via a vtable that is populated on
|
||||
# bootup. This mechanism needs startup code and linker script support from
|
||||
# ChibiOS, which is currently not implemented thus these functions are disabled
|
||||
# ATM.
|
||||
RP2040_SRC += $(PICOSDKROOT)/src/rp2_common/hardware_divider/divider.S \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_divider/divider_hardware.S \
|
||||
$(PICOSDKROOT)/src/rp2_common/pico_int64_ops/pico_int64_ops_aeabi.S
|
||||
|
||||
RP2040_INC += $(PICOSDKROOT)/src/rp2_common/hardware_divider/include \
|
||||
$(PICOSDKROOT)/src/common/pico_divider_headers/include
|
||||
|
||||
# integer division intrinsics utilizing the RP2040 hardware divider
|
||||
OPT_DEFS += -DPICO_DIVIDER_IN_RAM=1
|
||||
OPT_DEFS += -DPICO_DIVIDER_DISABLE_INTERRUPTS=1
|
||||
|
||||
CFLAGS += -Wl,--wrap=__aeabi_idiv
|
||||
CFLAGS += -Wl,--wrap=__aeabi_idivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_ldivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uidiv
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uidivmod
|
||||
CFLAGS += -Wl,--wrap=__aeabi_uldivmod
|
||||
|
||||
# 64bit integer intrinsics
|
||||
OPT_DEFS += -DPICO_INT64_OPS_IN_RAM=1
|
||||
|
||||
CFLAGS += -Wl,--wrap=__aeabi_lmul
|
||||
|
||||
PLATFORM_SRC += $(RP2040_SRC)
|
||||
EXTRAINCDIRS += $(RP2040_INC)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user