summaryrefslogtreecommitdiffstats
path: root/keyboards/annepro2/boards/ANNEPRO2_C15
diff options
context:
space:
mode:
authorbwisn <56162793+bwisn@users.noreply.github.com>2022-03-08 02:12:53 +0100
committerGitHub <noreply@github.com>2022-03-08 12:12:53 +1100
commit893d86cb896d82eb8c9d16251062dd6afa802533 (patch)
treecfadc87d02f22b583542f0e6030ad4c8150e279a /keyboards/annepro2/boards/ANNEPRO2_C15
parent2ff646c642152df064da8dcf62ef328585de0197 (diff)
Add Anne Pro 2 keyboard (#14385)
* [keyboard] Initial support for Anne Pro 2 * [keyboard][AnnePro2] Keymap:update to a reasonable keymap with caps+hjkl => arrow * :( * changed to use HSI * support for annepro2 c18 * keyboard/annepro2: Very stupid matrix scan bug fix. * typo * swap COL14/13 * keyboard/annepro2: startup secondary LED MCU * keyboard/annepro2: typo fix * Add IO Values * Disable Combo feature * Update default keymap to Anne Pro 2 Official Keymap * keyboard/annepro2: keymap layer name changes * keyboard/annepro2 BLE Support * Fix keymap comment FN1 ESC was listed as ~ instead of ` * keyboard/annepro2: Bluetooth path * Keyboard annepro2 bidir led comms (#5) * Added bidirectional shine comms and moved led functionality to new file * Added bidirectional shine comms and moved led functionality to new file * Restore original functionality to existing keymaps using new shine commands * Fix dangling bracketless if statements * PR cleanup * add custom keycodes to switch led profiles * Optimize code * switch to prev profile before turning leds off * Add persistent led support with eeprom (#9) * adding HT32 support to chibios SPI master driver * add support for W25X20CL SPI eeprom * add makefile flag for eeprom feature * add spi support to keyboard startup and config * example keymap using eeprom profile loading * Cleanup to fix C15 eeprom/spi build errors (#11) * Cleanup to fix C15 eeprom/spi build errors * add newline at eof * LED Masking support for Shine Introduce companion update to ledSetMask and ledClearMask. In keymap `codetector` there is example of how to map caps_lock to the caps_lock key light on the keyboard. * [AnnePro2]: update bluetooth connection * Merge the custom keys enums on annepro2.h (#13) * Keyboard annepro2 ble caps lock (#12) * Move matrix_scan_kb out of board.c to annepro2.c * add buffer clear after init and caplock polling * Add support for LED intensity (#15) * Improve logic for switching off and on of LEDs (#16) * Implement animation speed (#17) * Include logic to send solid colors as foreground to shine and add sample profiles (#14) Include the logic to send a solid color from qmk to shine. That solid color will act as a foreground (will override the current profile) until reset (witch will reactivate the current profile). This functionality depends on changes made for shine as well. Include 3 new profiles: default-full-caps -> same as default, but with the logic of using the red foreground color on caps lock. default-layer-indicators -> same as default, but with the logic of red foreground on caps lock, green foreground on FN1 and blue foreground on FN2. thomazmoura -> my own profile as a sample of an over-engineered advanced case scenario. * Implement reactive lighting effects (#18) * Added multiarrow keymap (#19) * Add LED documentation (#26) * add LED documentation * add LED documentation to other default profiles * Implement QMK's IAP default keybind (#29) * Add keymap for going into IAP * switch to default QMK keybind for IAP mode * implement bluetooth IAP mode * Make default config more like Obins stock default (#30) * Add new message type for resetting foreground color (#31) * annepro2(bluetooth): add media keys support (#41) * Asynchronous, robust serial protocol. (#39) * bla personal ap2-c18 keymap. * Bidirectional, asynchronous message-based communication with Shine. - Requires a matching Shine version. - Protocol is resiliant to loosing bytes during communication, chips won't lock waiting for bytes that aren't coming. - Chips resynchronize in event of loosing a byte using a AA0D header. Regressions: - Key masking/locking doesn't work right now. (did it work before?) - Not all user keymaps build against it. * Clang-format + code to ease reducing speed of LED UART. - Did clang-format --style=file -i on multiple files according to coding_conventions_c.md - Added separate serial speed for IAP boot and Led communication, it's possible that reducing this to 9600 helped someone with faulty HW. With this code they can do it with simple replacing of a value. * Main chip can set/clear foreground using a mask mechanism. - Some preparations for selective colouring. * Selective mask works - tested on capslock. - Migrated personal keymaps to new status API. * Clear the foreground colors to show profile when it's modified. - Show example of achieving selective caps-lock painting + foreground painting for layers. - annepro2LedMaskSetRow is implemented, but still requires testing. * Implement the QMK side of led blinking to indicate the command was received. - This stupidly blinks the key when user presses one of the bluetooth commands to let the user know that the command was received and forwarded to the BT chip. - TODO: Row/col key positions are hardcoded and not taken from the keymap. * Reduce memory footprint. Applying code review suggestions. Moved msgId to globals - preparing for transmission without copying payload when no retries are necessary. Added empty readme.md files - required by QMK lint. Co-authored-by: Tomasz bla Fortuna <bla@thera.be> * Let the LED chip settle a bit before waking it from the bootloader. (#42) At least for one person that helps to reliably get the LEDs working without disconnecting/reconnecting the power to the board multiple times. Co-authored-by: Tomasz bla Fortuna <bla@thera.be> * annepro2: rename KEYMAP to LAYOUT, as required by new version of QMK * annepro2: update ChibiOS configuration files * annepro2: fix undefined reference to dprint and timer_read32 * annepro2: update ChibiOS MCU name * update spi driver, fix bad merging with master * annepro2: add readme and info.json * annepro2: make code compatible with QMK coding conventions * tmk_core: temporary fix to allow HT32 based keyboards to work without patched ChibiOS-contrib (AnnePro2) * AnnePro2: removed core changes * AnnePro2: Leave only default keymaps Missing keymaps will be restored in another PR * annepro2: add licence information * annepro2: satisfy qmk lint * annepro2: fix drashna's suggestions * annepro2: fix matrix * annepro2: apply code review suggestions * annepro2: apply remaining code review suggestions * annepro2: update info.json * annepro2: remove include * annepro2: rename keymap to layout * annepro2: fix typing * annepro2: apply suggestions from tzarc's code review Co-authored-by: Nick Brassel <nick@tzarc.org> * annepro2: more fixes * annepro2: apply suggestions from code review Co-authored-by: Joel Challis <git@zvecr.com> * annepro2: rename file * more fixes * Apply suggestions from @tzarc code review Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/annepro2/protocol.h Co-authored-by: Nick Brassel <nick@tzarc.org> * Update keyboards/annepro2/chconf.h Co-authored-by: Nick Brassel <nick@tzarc.org> * apply CR suggestions * upgrade readme * IAP * update IAP comments, defines * led fix * init fix * annepro2: GPIO cleanup * annepro2: ioline * change waiting time * Start develop for 2022q2 * [Core] Squeeze AVR some more with `-mrelax` and `-mcall-prologues` (#16269) * Rework generate-api CLI command to use .build directory (#16441) * Remove `send_unicode_hex_string()` (#16518) * Change data driven "str" type to represent a quoted string literal (#16516) * Change data driven "str" type to represent a quoted string literal * Update docs * Map data driven `DESCRIPTION` as string literal (#16523) * update bootloader * Revert "Merge pull request #2 from qmk/develop" This reverts commit 9c76065188c3adda98bdaa1f28dad85600e73ee9, reversing changes made to 240745dc05783c612e92bab153da5c46e037d675. * Revert "update bootloader" This reverts commit 240745dc05783c612e92bab153da5c46e037d675. * fix rules.mk * change PROGRAM_CMD Co-authored-by: codetector <codetector@codetector.cn> Co-authored-by: Fagl4 <18francisco18@gmail.com> Co-authored-by: Jakob Gillich <jakob@gillich.me> Co-authored-by: tech2077 <tech2077@gmail.com> Co-authored-by: jcdeA <31413538+JcdeA@users.noreply.github.com> Co-authored-by: Thomaz Moura <5599621+thomazmoura@users.noreply.github.com> Co-authored-by: Darkhan <darkhanu@gmail.com> Co-authored-by: Paco <70448173+packorf@users.noreply.github.com> Co-authored-by: jmarmstrong1207 <32995055+jmarmstrong1207@users.noreply.github.com> Co-authored-by: 1Conan <7620342+1Conan@users.noreply.github.com> Co-authored-by: Tomasz bla Fortuna <blagh@thera.be> Co-authored-by: Tomasz bla Fortuna <bla@thera.be> Co-authored-by: Nick Brassel <nick@tzarc.org> Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: QMK Bot <hello@qmk.fm> Co-authored-by: Stefan Kerkmann <karlk90@pm.me> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/annepro2/boards/ANNEPRO2_C15')
-rw-r--r--keyboards/annepro2/boards/ANNEPRO2_C15/board.c103
-rw-r--r--keyboards/annepro2/boards/ANNEPRO2_C15/board.h39
-rw-r--r--keyboards/annepro2/boards/ANNEPRO2_C15/board.mk5
3 files changed, 147 insertions, 0 deletions
diff --git a/keyboards/annepro2/boards/ANNEPRO2_C15/board.c b/keyboards/annepro2/boards/ANNEPRO2_C15/board.c
new file mode 100644
index 0000000000..60c1826155
--- /dev/null
+++ b/keyboards/annepro2/boards/ANNEPRO2_C15/board.c
@@ -0,0 +1,103 @@
+/*
+ Copyright (C) 2020 Yaotian Feng, Codetector<codetector@codetector.cn>
+
+ 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"
+
+/* ============ Private Defines ===================== */
+
+/* ============ Function Prototypes ================== */
+
+#define PBIT(PORT, LINE) ((PAL_PORT(LINE) == PORT) ? (1 << PAL_PAD(LINE)) : 0)
+#define PAFIO_L(PORT, LINE, AF) (((PAL_PORT(LINE) == PORT) && (PAL_PAD(LINE) < 8)) ? (AF << (PAL_PAD(LINE) << 2)) : 0)
+#define PAFIO_H(PORT, LINE, AF) (((PAL_PORT(LINE) == PORT) && (PAL_PAD(LINE) >= 8)) ? (AF << ((PAL_PAD(LINE) - 8) << 2)) : 0)
+#define PAFIO(PORT, N, LINE, AF) ((N) ? PAFIO_H(PORT, LINE, AF) : PAFIO_L(PORT, LINE, AF))
+
+#define OUT_BITS(PORT) (PBIT(PORT, C2) | PBIT(PORT, C1) | PBIT(PORT, B5) | PBIT(PORT, B4) | PBIT(PORT, C3) | 0)
+
+#define IN_BITS(PORT) (PBIT(PORT, C4) | PBIT(PORT, C5) | PBIT(PORT, B10) | PBIT(PORT, B11) | PBIT(PORT, C0) | PBIT(PORT, A15) | PBIT(PORT, A8) | PBIT(PORT, A10) | PBIT(PORT, A11) | PBIT(PORT, A12) | PBIT(PORT, A13) | PBIT(PORT, A14) | PBIT(PORT, B2) | PBIT(PORT, B3) | 0)
+
+// Alternate Functions
+#define AF_BITS(PORT, N) (PAFIO(PORT, N, LINE_UART_RX, AFIO_USART) | PAFIO(PORT, N, LINE_UART_TX, AFIO_USART) | PAFIO(PORT, N, LINE_BT_UART_TX, AFIO_USART) | PAFIO(PORT, N, LINE_BT_UART_RX, AFIO_USART) | PAFIO(PORT, N, C2, AFIO_GPIO) | PAFIO(PORT, N, C1, AFIO_GPIO) | PAFIO(PORT, N, B5, AFIO_GPIO) | PAFIO(PORT, N, B4, AFIO_GPIO) | PAFIO(PORT, N, C3, AFIO_GPIO) | PAFIO(PORT, N, C4, AFIO_GPIO) | PAFIO(PORT, N, C5, AFIO_GPIO) | PAFIO(PORT, N, B10, AFIO_GPIO) | PAFIO(PORT, N, B11, AFIO_GPIO) | PAFIO(PORT, N, C0, AFIO_GPIO) | PAFIO(PORT, N, A15, AFIO_GPIO) | PAFIO(PORT, N, A8, AFIO_GPIO) | PAFIO(PORT, N, A10, AFIO_GPIO) | PAFIO(PORT, N, A11, AFIO_GPIO) | PAFIO(PORT, N, A12, AFIO_GPIO) | PAFIO(PORT, N, A13, AFIO_GPIO) | PAFIO(PORT, N, A14, AFIO_GPIO) | PAFIO(PORT, N, B2, AFIO_GPIO) | PAFIO(PORT, N, B3, AFIO_GPIO) | 0)
+
+/**
+ * @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.
+ */
+const PALConfig pal_default_config = {
+ // GPIO A
+ .setup[0] =
+ {
+ .DIR = OUT_BITS(IOPORTA),
+ .INE = IN_BITS(IOPORTA),
+ .PU = IN_BITS(IOPORTA),
+ .PD = 0x0000,
+ .OD = 0x0000,
+ .DRV = 0x0000,
+ .LOCK = 0x0000,
+ .OUT = 0x0000,
+ .CFG[0] = AF_BITS(IOPORTA, 0),
+ .CFG[1] = AF_BITS(IOPORTA, 1),
+ },
+ // GPIO B
+ .setup[1] =
+ {
+ .DIR = OUT_BITS(IOPORTB),
+ .INE = IN_BITS(IOPORTB),
+ .PU = IN_BITS(IOPORTB),
+ .PD = 0x0000,
+ .OD = 0x0000,
+ .DRV = 0x0000,
+ .LOCK = 0x0000,
+ .OUT = 0x0000,
+ .CFG[0] = AF_BITS(IOPORTB, 0),
+ .CFG[1] = AF_BITS(IOPORTB, 1),
+ },
+ // GPIO C
+ .setup[2] =
+ {
+ .DIR = OUT_BITS(IOPORTC),
+ .INE = IN_BITS(IOPORTC),
+ .PU = IN_BITS(IOPORTC),
+ .PD = 0x0000,
+ .OD = 0x0000,
+ .DRV = 0x0000,
+ .LOCK = 0x0000,
+ .OUT = 0x0000,
+ .CFG[0] = AF_BITS(IOPORTC, 0),
+ .CFG[1] = AF_BITS(IOPORTC, 1),
+ },
+ // GPIO D
+ .setup[3] =
+ {
+ .DIR = OUT_BITS(IOPORTD),
+ .INE = IN_BITS(IOPORTD),
+ .PU = IN_BITS(IOPORTD),
+ .PD = 0x0000,
+ .OD = 0x0000,
+ .DRV = 0x0000,
+ .LOCK = 0x0000,
+ .OUT = 0x0000,
+ .CFG[0] = AF_BITS(IOPORTD, 0),
+ .CFG[1] = AF_BITS(IOPORTD, 1),
+ },
+ .ESSR[0] = 0x00000000,
+ .ESSR[1] = 0x00000000,
+};
+
+void __early_init(void) { ht32_clock_init(); }
+
+void boardInit(void) {}
diff --git a/keyboards/annepro2/boards/ANNEPRO2_C15/board.h b/keyboards/annepro2/boards/ANNEPRO2_C15/board.h
new file mode 100644
index 0000000000..0a044ea181
--- /dev/null
+++ b/keyboards/annepro2/boards/ANNEPRO2_C15/board.h
@@ -0,0 +1,39 @@
+/*
+ ChibiOS - Copyright (C) 2020 Codetector <codetector@codetector.cn>
+
+ 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.
+*/
+
+#pragma once
+/*
+ * Setup for Anne Pro 2 board.
+ */
+
+/*
+ * Board identifier.
+ */
+#define BOARD_NAME "Anne Pro 2"
+
+#define HT32F52342
+
+#define FLASH_SIZE (0x10000 - 0x4000) // 64kB - 16kB
+
+#if !defined(_FROM_ASM_)
+#ifdef __cplusplus
+extern "C" {
+#endif
+void boardInit(void);
+#ifdef __cplusplus
+}
+#endif
+#endif /* _FROM_ASM_ */ \ No newline at end of file
diff --git a/keyboards/annepro2/boards/ANNEPRO2_C15/board.mk b/keyboards/annepro2/boards/ANNEPRO2_C15/board.mk
new file mode 100644
index 0000000000..f308892e7c
--- /dev/null
+++ b/keyboards/annepro2/boards/ANNEPRO2_C15/board.mk
@@ -0,0 +1,5 @@
+# List of all the board related files.
+BOARDSRC = $(BOARD_PATH)/boards/ANNEPRO2_C15/board.c
+
+# Required include directories
+BOARDINC = $(BOARD_PATH)/boards/ANNEPRO2_C15