From 54fbf3a36b7269afa44bbb1077e78b0912955d67 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 22 Jun 2019 14:57:03 +0200 Subject: [PATCH 01/68] Initial commit for Anne Pro keyboard --- keyboards/anne_pro/anne_pro.c | 99 ++ keyboards/anne_pro/anne_pro.h | 34 + .../boards/STM32L151_ANNE_PRO/board.c | 129 +++ .../boards/STM32L151_ANNE_PRO/board.h | 935 ++++++++++++++++++ .../boards/STM32L151_ANNE_PRO/board.mk | 5 + keyboards/anne_pro/chconf.h | 524 ++++++++++ keyboards/anne_pro/config.h | 115 +++ keyboards/anne_pro/halconf.h | 353 +++++++ keyboards/anne_pro/keymaps/default/keymap.c | 27 + keyboards/anne_pro/ld/STM32L151.ld | 85 ++ keyboards/anne_pro/mcuconf.h | 203 ++++ keyboards/anne_pro/rules.mk | 37 + 12 files changed, 2546 insertions(+) create mode 100644 keyboards/anne_pro/anne_pro.c create mode 100644 keyboards/anne_pro/anne_pro.h create mode 100644 keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c create mode 100644 keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h create mode 100644 keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk create mode 100644 keyboards/anne_pro/chconf.h create mode 100644 keyboards/anne_pro/config.h create mode 100644 keyboards/anne_pro/halconf.h create mode 100644 keyboards/anne_pro/keymaps/default/keymap.c create mode 100644 keyboards/anne_pro/ld/STM32L151.ld create mode 100644 keyboards/anne_pro/mcuconf.h create mode 100644 keyboards/anne_pro/rules.mk diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c new file mode 100644 index 00000000000..f8a62621fb8 --- /dev/null +++ b/keyboards/anne_pro/anne_pro.c @@ -0,0 +1,99 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "anne_pro.h" +#include "ch.h" +#include "hal.h" + +/* + * This callback is invoked when a transmission buffer has been completely + * read by the driver. + */ +static void txend1(UARTDriver *uartp) { + (void)uartp; +} + +/* + * This callback is invoked when a transmission has physically completed. + */ +static void txend2(UARTDriver *uartp) { + (void)uartp; +} + +/* + * This callback is invoked on a receive error, the errors mask is passed + * as parameter. + */ +static void rxerr(UARTDriver *uartp, uartflags_t e) { + (void)uartp; + (void)e; +} + +/* + * This callback is invoked when a character is received but the application + * was not ready to receive it, the character is passed as parameter. + */ +static void rxchar(UARTDriver *uartp, uint16_t c) { + (void)uartp; + (void)c; +} + +/* + * This callback is invoked when a receive buffer has been completely written. + */ +static void rxend(UARTDriver *uartp) { + (void)uartp; +} + + +static UARTConfig uart_cfg = { + .txend1_cb = txend1, + .txend2_cb = txend2, + .rxend_cb = rxend, + .rxchar_cb = rxchar, + .rxerr_cb = rxerr, + .speed = 38400, + .cr1 = 0, + .cr2 = USART_CR2_LINEN, + .cr3 = 0 +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + if (!record->event.pressed) { + // Send 'next theme' command to lighting controller + uartStartSend(&UARTD3, 4, "\x09\x04\x05\x01\x00\x00"); + } + return true; +} + +void matrix_init_kb(void) { + // Turn on lighting controller + setPinOutput(C15); + writePinLow(C15); + chThdSleepMilliseconds(100); + writePinHigh(C15); + chThdSleepMilliseconds(100); + + // Initialize the lighting UART + uartStart(&UARTD3, &uart_cfg); + palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); + palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); + + // Send 'set theme' command to lighting controller + uartStartSend(&UARTD3, 4, "\x09\x02\x01\x01"); + + matrix_init_user(); +} diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h new file mode 100644 index 00000000000..5662343fac4 --- /dev/null +++ b/keyboards/anne_pro/anne_pro.h @@ -0,0 +1,34 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include "quantum.h" + +/* The fully-featured LAYOUT_all() that has every single key available in the matrix. + */ +#define LAYOUT(\ + k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ + k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \ + k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, \ + k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3d, \ + k40, k41, k42, k45, k4a, k4b, k4c, k4d \ +) { \ + { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d }, \ + { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d }, \ + { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, KC_NO, k2d }, \ + { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, KC_NO, KC_NO, k3d }, \ + { k40, k41, k42, KC_NO, KC_NO, k45, KC_NO, KC_NO, KC_NO, KC_NO, k4a, k4b, k4c, k4d }, \ +} diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c new file mode 100644 index 00000000000..4b26d39f8a5 --- /dev/null +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c @@ -0,0 +1,129 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * This file has been automatically generated using ChibiStudio board + * generator plugin. Do not edit manually. + */ + +#include "hal.h" + +#if HAL_USE_PAL || defined(__DOXYGEN__) +/** + * @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 = { +#if STM32_HAS_GPIOA + {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, + VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, +#endif +#if STM32_HAS_GPIOB + {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, + VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, +#endif +#if STM32_HAS_GPIOC + {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, + VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, +#endif +#if STM32_HAS_GPIOD + {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, + VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, +#endif +#if STM32_HAS_GPIOE + {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, + VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, +#endif +#if STM32_HAS_GPIOF + {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, + VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, +#endif +#if STM32_HAS_GPIOG + {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, + VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, +#endif +#if STM32_HAS_GPIOH + {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, + VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, +#endif +#if STM32_HAS_GPIOI + {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, + VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} +#endif +}; +#endif + +/** + * @brief Early initialization code. + * @details This initialization must be performed just after stack setup + * and before any other initialization. + */ +void __early_init(void) { + + stm32_clock_init(); +} + +#if HAL_USE_SDC || defined(__DOXYGEN__) +/** + * @brief SDC card detection. + */ +bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { + + (void)sdcp; + /* TODO: Fill the implementation.*/ + return true; +} + +/** + * @brief SDC card write protection detection. + */ +bool sdc_lld_is_write_protected(SDCDriver *sdcp) { + + (void)sdcp; + /* TODO: Fill the implementation.*/ + return false; +} +#endif /* HAL_USE_SDC */ + +#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) +/** + * @brief MMC_SPI card detection. + */ +bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { + + (void)mmcp; + /* TODO: Fill the implementation.*/ + return true; +} + +/** + * @brief MMC_SPI card write protection detection. + */ +bool mmc_lld_is_write_protected(MMCDriver *mmcp) { + + (void)mmcp; + /* TODO: Fill the implementation.*/ + return false; +} +#endif + +/** + * @brief Board-specific initialization code. + * @todo Add your board-specific code, if any. + */ +void boardInit(void) { +} diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h new file mode 100644 index 00000000000..1e1f628effb --- /dev/null +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h @@ -0,0 +1,935 @@ +/* + ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + * This file has been automatically generated using ChibiStudio board + * generator plugin. Do not edit manually. + */ + +#ifndef BOARD_H +#define BOARD_H + +/* + * Setup for ST STM32L-Discovery board. + */ + +/* + * Board identifier. + */ +#define BOARD_STM32L151_ANNE_PRO +#define BOARD_NAME "STM32L151 Anne Pro" + +/* + * Board oscillators-related settings. + * NOTE: HSE not fitted. + */ +#if !defined(STM32_LSECLK) +#define STM32_LSECLK 0U +#endif + +#if !defined(STM32_HSECLK) +#define STM32_HSECLK 16000000U +#endif + +// #define STM32_HSE_BYPASS + +/* + * MCU type as defined in the ST header file stm32l1xx.h. + */ +#define STM32L151xB + +/* + * 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_USB_DM 11U +#define GPIOA_USB_DP 12U +#define GPIOA_JTAG_TMS 13U +#define GPIOA_JTAG_TCK 14U +#define GPIOA_JTAG_TDI 15U + +#define GPIOB_PIN0 0U +#define GPIOB_PIN1 1U +#define GPIOB_BOOT1 2U +#define GPIOB_JTAG_TDO 3U +#define GPIOB_JTAG_TRST 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_OSC32_IN 14U +#define GPIOC_OSC32_OUT 15U + +#define GPIOD_PIN0 0U +#define GPIOD_PIN1 1U +#define GPIOD_PIN2 2U +#define GPIOD_PIN3 3U +#define GPIOD_PIN4 4U +#define GPIOD_PIN5 5U +#define GPIOD_PIN6 6U +#define GPIOD_PIN7 7U +#define GPIOD_PIN8 8U +#define GPIOD_PIN9 9U +#define GPIOD_PIN10 10U +#define GPIOD_PIN11 11U +#define GPIOD_PIN12 12U +#define GPIOD_PIN13 13U +#define GPIOD_PIN14 14U +#define GPIOD_PIN15 15U + +#define GPIOE_PIN0 0U +#define GPIOE_PIN1 1U +#define GPIOE_PIN2 2U +#define GPIOE_PIN3 3U +#define GPIOE_PIN4 4U +#define GPIOE_PIN5 5U +#define GPIOE_PIN6 6U +#define GPIOE_PIN7 7U +#define GPIOE_PIN8 8U +#define GPIOE_PIN9 9U +#define GPIOE_PIN10 10U +#define GPIOE_PIN11 11U +#define GPIOE_PIN12 12U +#define GPIOE_PIN13 13U +#define GPIOE_PIN14 14U +#define GPIOE_PIN15 15U + +#define GPIOH_OSC_IN 0U +#define GPIOH_OSC_OUT 1U +#define GPIOH_PIN2 2U +#define GPIOH_PIN3 3U +#define GPIOH_PIN4 4U +#define GPIOH_PIN5 5U +#define GPIOH_PIN6 6U +#define GPIOH_PIN7 7U +#define GPIOH_PIN8 8U +#define GPIOH_PIN9 9U +#define GPIOH_PIN10 10U +#define GPIOH_PIN11 11U +#define GPIOH_PIN12 12U +#define GPIOH_PIN13 13U +#define GPIOH_PIN14 14U +#define GPIOH_PIN15 15U + +/* + * IO lines assignments. + */ +#define LINE_JTAG_TMS PAL_LINE(GPIOA, 13U) +#define LINE_JTAG_TCK PAL_LINE(GPIOA, 14U) +#define LINE_JTAG_TDI PAL_LINE(GPIOA, 15U) + +#define LINE_BOOT1 PAL_LINE(GPIOB, 2U) +#define LINE_JTAG_TDO PAL_LINE(GPIOB, 3U) +#define LINE_JTAG_TRST PAL_LINE(GPIOB, 4U) + +#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) +#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) + +#define LINE_OSC_IN PAL_LINE(GPIOH, 0U) +#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U) + +/* + * I/O ports initial setup, this configuration is established soon after reset + * in the initialization code. + * Please refer to the STM32 Reference Manual for details. + */ +#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) +#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) +#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) +#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) +#define PIN_ODR_LOW(n) (0U << (n)) +#define PIN_ODR_HIGH(n) (1U << (n)) +#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) +#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) +#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) +#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) +#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) +#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) +#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) +#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) +#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) +#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) + +/* + * GPIOA setup: + * + * PA0 - PIN0 (input pullup). + * PA1 - PIN1 (input pullup). + * PA2 - PIN2 (input pullup). + * PA3 - PIN3 (input pullup). + * PA4 - PIN4 (input pullup). + * PA5 - PIN5 (input pullup). + * PA6 - PIN6 (input pullup). + * PA7 - PIN7 (input pullup). + * PA8 - PIN8 (input pullup). + * PA9 - PIN9 (input pullup). + * PA10 - PIN10 (input pullup). + * PA11 - USB_DM (fast input pullup). + * PA12 - USB_DP (fast input pullup). + * PA13 - JTAG_TMS (alternate 0). + * PA14 - JTAG_TCK (alternate 0). + * PA15 - JTAG_TDI (alternate 0). + */ +#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ + PIN_MODE_INPUT(GPIOA_PIN1) | \ + PIN_MODE_INPUT(GPIOA_PIN2) | \ + PIN_MODE_INPUT(GPIOA_PIN3) | \ + PIN_MODE_INPUT(GPIOA_PIN4) | \ + PIN_MODE_INPUT(GPIOA_PIN5) | \ + PIN_MODE_INPUT(GPIOA_PIN6) | \ + PIN_MODE_INPUT(GPIOA_PIN7) | \ + PIN_MODE_INPUT(GPIOA_PIN8) | \ + PIN_MODE_INPUT(GPIOA_PIN9) | \ + PIN_MODE_INPUT(GPIOA_PIN10) | \ + PIN_MODE_INPUT(GPIOA_USB_DM) | \ + PIN_MODE_INPUT(GPIOA_USB_DP) | \ + PIN_MODE_ALTERNATE(GPIOA_JTAG_TMS) | \ + PIN_MODE_ALTERNATE(GPIOA_JTAG_TCK) | \ + PIN_MODE_ALTERNATE(GPIOA_JTAG_TDI)) +#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \ + PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \ + PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TMS) | \ + PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TCK) | \ + PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TDI)) +#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \ + PIN_OSPEED_HIGH(GPIOA_USB_DM) | \ + PIN_OSPEED_HIGH(GPIOA_USB_DP) | \ + PIN_OSPEED_HIGH(GPIOA_JTAG_TMS) | \ + PIN_OSPEED_HIGH(GPIOA_JTAG_TCK) | \ + PIN_OSPEED_HIGH(GPIOA_JTAG_TDI)) +#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN1) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN2) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN3) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOA_USB_DM) | \ + PIN_PUPDR_PULLUP(GPIOA_USB_DP) | \ + PIN_PUPDR_PULLUP(GPIOA_JTAG_TMS) | \ + PIN_PUPDR_PULLDOWN(GPIOA_JTAG_TCK) | \ + PIN_PUPDR_PULLUP(GPIOA_JTAG_TDI)) +#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ + PIN_ODR_HIGH(GPIOA_PIN1) | \ + PIN_ODR_HIGH(GPIOA_PIN2) | \ + PIN_ODR_HIGH(GPIOA_PIN3) | \ + PIN_ODR_HIGH(GPIOA_PIN4) | \ + PIN_ODR_HIGH(GPIOA_PIN5) | \ + PIN_ODR_HIGH(GPIOA_PIN6) | \ + PIN_ODR_HIGH(GPIOA_PIN7) | \ + PIN_ODR_HIGH(GPIOA_PIN8) | \ + PIN_ODR_HIGH(GPIOA_PIN9) | \ + PIN_ODR_HIGH(GPIOA_PIN10) | \ + PIN_ODR_HIGH(GPIOA_USB_DM) | \ + PIN_ODR_HIGH(GPIOA_USB_DP) | \ + PIN_ODR_HIGH(GPIOA_JTAG_TMS) | \ + PIN_ODR_HIGH(GPIOA_JTAG_TCK) | \ + PIN_ODR_HIGH(GPIOA_JTAG_TDI)) +#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN1, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN2, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN3, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN4, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN7, 0U)) +#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOA_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOA_USB_DM, 0U) | \ + PIN_AFIO_AF(GPIOA_USB_DP, 0U) | \ + PIN_AFIO_AF(GPIOA_JTAG_TMS, 0U) | \ + PIN_AFIO_AF(GPIOA_JTAG_TCK, 0U) | \ + PIN_AFIO_AF(GPIOA_JTAG_TDI, 0U)) + +/* + * GPIOB setup: + * + * PB0 - PIN0 (input pullup). + * PB1 - PIN1 (input pullup). + * PB2 - BOOT1 (input floating). + * PB3 - JTAG_TDO (alternate 0). + * PB4 - JTAG_TRST (alternate 0). + * PB5 - PIN5 (input pullup). + * PB6 - PIN6 (input pullup). + * PB7 - PIN7 (input pullup). + * PB8 - PIN8 (input pullup). + * PB9 - PIN9 (input pullup). + * PB10 - PIN10 (input pullup). + * PB11 - PIN11 (input pullup). + * PB12 - PIN12 (input pullup). + * PB13 - PIN13 (input pullup). + * PB14 - PIN14 (input pullup). + * PB15 - PIN15 (input pullup). + */ +#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ + PIN_MODE_INPUT(GPIOB_PIN1) | \ + PIN_MODE_INPUT(GPIOB_BOOT1) | \ + PIN_MODE_ALTERNATE(GPIOB_JTAG_TDO) | \ + PIN_MODE_ALTERNATE(GPIOB_JTAG_TRST) | \ + PIN_MODE_INPUT(GPIOB_PIN5) | \ + PIN_MODE_INPUT(GPIOB_PIN6) | \ + PIN_MODE_INPUT(GPIOB_PIN7) | \ + PIN_MODE_INPUT(GPIOB_PIN8) | \ + PIN_MODE_INPUT(GPIOB_PIN9) | \ + PIN_MODE_INPUT(GPIOB_PIN10) | \ + PIN_MODE_INPUT(GPIOB_PIN11) | \ + PIN_MODE_INPUT(GPIOB_PIN12) | \ + PIN_MODE_INPUT(GPIOB_PIN13) | \ + PIN_MODE_INPUT(GPIOB_PIN14) | \ + PIN_MODE_INPUT(GPIOB_PIN15)) +#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ + PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \ + PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TDO) | \ + PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TRST) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ + PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) +#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \ + PIN_OSPEED_HIGH(GPIOB_BOOT1) | \ + PIN_OSPEED_HIGH(GPIOB_JTAG_TDO) | \ + PIN_OSPEED_HIGH(GPIOB_JTAG_TRST) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \ + PIN_OSPEED_VERYLOW(GPIOB_PIN15)) +#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ + PIN_PUPDR_FLOATING(GPIOB_BOOT1) | \ + PIN_PUPDR_FLOATING(GPIOB_JTAG_TDO) | \ + PIN_PUPDR_PULLUP(GPIOB_JTAG_TRST) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ + PIN_PUPDR_PULLUP(GPIOB_PIN15)) +#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ + PIN_ODR_HIGH(GPIOB_PIN1) | \ + PIN_ODR_HIGH(GPIOB_BOOT1) | \ + PIN_ODR_HIGH(GPIOB_JTAG_TDO) | \ + PIN_ODR_HIGH(GPIOB_JTAG_TRST) | \ + PIN_ODR_HIGH(GPIOB_PIN5) | \ + PIN_ODR_HIGH(GPIOB_PIN6) | \ + PIN_ODR_HIGH(GPIOB_PIN7) | \ + PIN_ODR_HIGH(GPIOB_PIN8) | \ + PIN_ODR_HIGH(GPIOB_PIN9) | \ + PIN_ODR_HIGH(GPIOB_PIN10) | \ + PIN_ODR_HIGH(GPIOB_PIN11) | \ + PIN_ODR_HIGH(GPIOB_PIN12) | \ + PIN_ODR_HIGH(GPIOB_PIN13) | \ + PIN_ODR_HIGH(GPIOB_PIN14) | \ + PIN_ODR_HIGH(GPIOB_PIN15)) +#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN1, 0U) | \ + PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \ + PIN_AFIO_AF(GPIOB_JTAG_TDO, 0U) | \ + PIN_AFIO_AF(GPIOB_JTAG_TRST, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN7, 0U)) +#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN12, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN13, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN14, 0U) | \ + PIN_AFIO_AF(GPIOB_PIN15, 0U)) + +/* + * GPIOC setup: + * + * PC0 - PIN0 (input pullup). + * PC1 - PIN1 (input pullup). + * PC2 - PIN2 (input pullup). + * PC3 - PIN3 (input pullup). + * PC4 - PIN4 (input pullup). + * PC5 - PIN5 (input pullup). + * PC6 - PIN6 (input pullup). + * PC7 - PIN7 (input pullup). + * PC8 - PIN8 (input pullup). + * PC9 - PIN9 (input pullup). + * PC10 - PIN10 (input pullup). + * PC11 - PIN11 (input pullup). + * PC12 - PIN12 (input pullup). + * PC13 - PIN13 (input pullup). + * PC14 - OSC32_IN (input floating). + * PC15 - OSC32_OUT (input floating). + */ +#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ + PIN_MODE_INPUT(GPIOC_PIN1) | \ + PIN_MODE_INPUT(GPIOC_PIN2) | \ + PIN_MODE_INPUT(GPIOC_PIN3) | \ + PIN_MODE_INPUT(GPIOC_PIN4) | \ + PIN_MODE_INPUT(GPIOC_PIN5) | \ + PIN_MODE_INPUT(GPIOC_PIN6) | \ + PIN_MODE_INPUT(GPIOC_PIN7) | \ + PIN_MODE_INPUT(GPIOC_PIN8) | \ + PIN_MODE_INPUT(GPIOC_PIN9) | \ + PIN_MODE_INPUT(GPIOC_PIN10) | \ + PIN_MODE_INPUT(GPIOC_PIN11) | \ + PIN_MODE_INPUT(GPIOC_PIN12) | \ + PIN_MODE_INPUT(GPIOC_PIN13) | \ + PIN_MODE_INPUT(GPIOC_OSC32_IN) | \ + PIN_MODE_INPUT(GPIOC_OSC32_OUT)) +#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ + PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ + PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \ + PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT)) +#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \ + PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \ + PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \ + PIN_OSPEED_HIGH(GPIOC_OSC32_OUT)) +#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN11) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN12) | \ + PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ + PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \ + PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT)) +#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ + PIN_ODR_HIGH(GPIOC_PIN1) | \ + PIN_ODR_HIGH(GPIOC_PIN2) | \ + PIN_ODR_HIGH(GPIOC_PIN3) | \ + PIN_ODR_HIGH(GPIOC_PIN4) | \ + PIN_ODR_HIGH(GPIOC_PIN5) | \ + PIN_ODR_HIGH(GPIOC_PIN6) | \ + PIN_ODR_HIGH(GPIOC_PIN7) | \ + PIN_ODR_HIGH(GPIOC_PIN8) | \ + PIN_ODR_HIGH(GPIOC_PIN9) | \ + PIN_ODR_HIGH(GPIOC_PIN10) | \ + PIN_ODR_HIGH(GPIOC_PIN11) | \ + PIN_ODR_HIGH(GPIOC_PIN12) | \ + PIN_ODR_HIGH(GPIOC_PIN13) | \ + PIN_ODR_HIGH(GPIOC_OSC32_IN) | \ + PIN_ODR_HIGH(GPIOC_OSC32_OUT)) +#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN1, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN2, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN3, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN4, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN7, 0U)) +#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN12, 0U) | \ + PIN_AFIO_AF(GPIOC_PIN13, 0U) | \ + PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \ + PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U)) + +/* + * GPIOD setup: + * + * PD0 - PIN0 (input pullup). + * PD1 - PIN1 (input pullup). + * PD2 - PIN2 (input pullup). + * PD3 - PIN3 (input pullup). + * PD4 - PIN4 (input pullup). + * PD5 - PIN5 (input pullup). + * PD6 - PIN6 (input pullup). + * PD7 - PIN7 (input pullup). + * PD8 - PIN8 (input pullup). + * PD9 - PIN9 (input pullup). + * PD10 - PIN10 (input pullup). + * PD11 - PIN11 (input pullup). + * PD12 - PIN12 (input pullup). + * PD13 - PIN13 (input pullup). + * PD14 - PIN14 (input pullup). + * PD15 - PIN15 (input pullup). + */ +#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ + PIN_MODE_INPUT(GPIOD_PIN1) | \ + PIN_MODE_INPUT(GPIOD_PIN2) | \ + PIN_MODE_INPUT(GPIOD_PIN3) | \ + PIN_MODE_INPUT(GPIOD_PIN4) | \ + PIN_MODE_INPUT(GPIOD_PIN5) | \ + PIN_MODE_INPUT(GPIOD_PIN6) | \ + PIN_MODE_INPUT(GPIOD_PIN7) | \ + PIN_MODE_INPUT(GPIOD_PIN8) | \ + PIN_MODE_INPUT(GPIOD_PIN9) | \ + PIN_MODE_INPUT(GPIOD_PIN10) | \ + PIN_MODE_INPUT(GPIOD_PIN11) | \ + PIN_MODE_INPUT(GPIOD_PIN12) | \ + PIN_MODE_INPUT(GPIOD_PIN13) | \ + PIN_MODE_INPUT(GPIOD_PIN14) | \ + PIN_MODE_INPUT(GPIOD_PIN15)) +#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ + PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) +#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \ + PIN_OSPEED_VERYLOW(GPIOD_PIN15)) +#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN12) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ + PIN_PUPDR_PULLUP(GPIOD_PIN15)) +#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ + PIN_ODR_HIGH(GPIOD_PIN1) | \ + PIN_ODR_HIGH(GPIOD_PIN2) | \ + PIN_ODR_HIGH(GPIOD_PIN3) | \ + PIN_ODR_HIGH(GPIOD_PIN4) | \ + PIN_ODR_HIGH(GPIOD_PIN5) | \ + PIN_ODR_HIGH(GPIOD_PIN6) | \ + PIN_ODR_HIGH(GPIOD_PIN7) | \ + PIN_ODR_HIGH(GPIOD_PIN8) | \ + PIN_ODR_HIGH(GPIOD_PIN9) | \ + PIN_ODR_HIGH(GPIOD_PIN10) | \ + PIN_ODR_HIGH(GPIOD_PIN11) | \ + PIN_ODR_HIGH(GPIOD_PIN12) | \ + PIN_ODR_HIGH(GPIOD_PIN13) | \ + PIN_ODR_HIGH(GPIOD_PIN14) | \ + PIN_ODR_HIGH(GPIOD_PIN15)) +#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN1, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN2, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN3, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN4, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN7, 0U)) +#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN12, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN13, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN14, 0U) | \ + PIN_AFIO_AF(GPIOD_PIN15, 0U)) + +/* + * GPIOE setup: + * + * PE0 - PIN0 (input pullup). + * PE1 - PIN1 (input pullup). + * PE2 - PIN2 (input pullup). + * PE3 - PIN3 (input pullup). + * PE4 - PIN4 (input pullup). + * PE5 - PIN5 (input pullup). + * PE6 - PIN6 (input pullup). + * PE7 - PIN7 (input pullup). + * PE8 - PIN8 (input pullup). + * PE9 - PIN9 (input pullup). + * PE10 - PIN10 (input pullup). + * PE11 - PIN11 (input pullup). + * PE12 - PIN12 (input pullup). + * PE13 - PIN13 (input pullup). + * PE14 - PIN14 (input pullup). + * PE15 - PIN15 (input pullup). + */ +#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \ + PIN_MODE_INPUT(GPIOE_PIN1) | \ + PIN_MODE_INPUT(GPIOE_PIN2) | \ + PIN_MODE_INPUT(GPIOE_PIN3) | \ + PIN_MODE_INPUT(GPIOE_PIN4) | \ + PIN_MODE_INPUT(GPIOE_PIN5) | \ + PIN_MODE_INPUT(GPIOE_PIN6) | \ + PIN_MODE_INPUT(GPIOE_PIN7) | \ + PIN_MODE_INPUT(GPIOE_PIN8) | \ + PIN_MODE_INPUT(GPIOE_PIN9) | \ + PIN_MODE_INPUT(GPIOE_PIN10) | \ + PIN_MODE_INPUT(GPIOE_PIN11) | \ + PIN_MODE_INPUT(GPIOE_PIN12) | \ + PIN_MODE_INPUT(GPIOE_PIN13) | \ + PIN_MODE_INPUT(GPIOE_PIN14) | \ + PIN_MODE_INPUT(GPIOE_PIN15)) +#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \ + PIN_OTYPE_PUSHPULL(GPIOE_PIN15)) +#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \ + PIN_OSPEED_VERYLOW(GPIOE_PIN15)) +#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN1) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN2) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN3) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN4) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN11) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN12) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN13) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN14) | \ + PIN_PUPDR_PULLUP(GPIOE_PIN15)) +#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \ + PIN_ODR_HIGH(GPIOE_PIN1) | \ + PIN_ODR_HIGH(GPIOE_PIN2) | \ + PIN_ODR_HIGH(GPIOE_PIN3) | \ + PIN_ODR_HIGH(GPIOE_PIN4) | \ + PIN_ODR_HIGH(GPIOE_PIN5) | \ + PIN_ODR_HIGH(GPIOE_PIN6) | \ + PIN_ODR_HIGH(GPIOE_PIN7) | \ + PIN_ODR_HIGH(GPIOE_PIN8) | \ + PIN_ODR_HIGH(GPIOE_PIN9) | \ + PIN_ODR_HIGH(GPIOE_PIN10) | \ + PIN_ODR_HIGH(GPIOE_PIN11) | \ + PIN_ODR_HIGH(GPIOE_PIN12) | \ + PIN_ODR_HIGH(GPIOE_PIN13) | \ + PIN_ODR_HIGH(GPIOE_PIN14) | \ + PIN_ODR_HIGH(GPIOE_PIN15)) +#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN1, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN2, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN3, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN4, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN7, 0U)) +#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN12, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN13, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN14, 0U) | \ + PIN_AFIO_AF(GPIOE_PIN15, 0U)) + +/* + * GPIOH setup: + * + * PH0 - OSC_IN (input floating). + * PH1 - OSC_OUT (input floating). + * PH2 - PIN2 (input pullup). + * PH3 - PIN3 (input pullup). + * PH4 - PIN4 (input pullup). + * PH5 - PIN5 (input pullup). + * PH6 - PIN6 (input pullup). + * PH7 - PIN7 (input pullup). + * PH8 - PIN8 (input pullup). + * PH9 - PIN9 (input pullup). + * PH10 - PIN10 (input pullup). + * PH11 - PIN11 (input pullup). + * PH12 - PIN12 (input pullup). + * PH13 - PIN13 (input pullup). + * PH14 - PIN14 (input pullup). + * PH15 - PIN15 (input pullup). + */ +#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \ + PIN_MODE_INPUT(GPIOH_OSC_OUT) | \ + PIN_MODE_INPUT(GPIOH_PIN2) | \ + PIN_MODE_INPUT(GPIOH_PIN3) | \ + PIN_MODE_INPUT(GPIOH_PIN4) | \ + PIN_MODE_INPUT(GPIOH_PIN5) | \ + PIN_MODE_INPUT(GPIOH_PIN6) | \ + PIN_MODE_INPUT(GPIOH_PIN7) | \ + PIN_MODE_INPUT(GPIOH_PIN8) | \ + PIN_MODE_INPUT(GPIOH_PIN9) | \ + PIN_MODE_INPUT(GPIOH_PIN10) | \ + PIN_MODE_INPUT(GPIOH_PIN11) | \ + PIN_MODE_INPUT(GPIOH_PIN12) | \ + PIN_MODE_INPUT(GPIOH_PIN13) | \ + PIN_MODE_INPUT(GPIOH_PIN14) | \ + PIN_MODE_INPUT(GPIOH_PIN15)) +#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \ + PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ + PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) +#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \ + PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \ + PIN_OSPEED_VERYLOW(GPIOH_PIN15)) +#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \ + PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ + PIN_PUPDR_PULLUP(GPIOH_PIN15)) +#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \ + PIN_ODR_HIGH(GPIOH_OSC_OUT) | \ + PIN_ODR_HIGH(GPIOH_PIN2) | \ + PIN_ODR_HIGH(GPIOH_PIN3) | \ + PIN_ODR_HIGH(GPIOH_PIN4) | \ + PIN_ODR_HIGH(GPIOH_PIN5) | \ + PIN_ODR_HIGH(GPIOH_PIN6) | \ + PIN_ODR_HIGH(GPIOH_PIN7) | \ + PIN_ODR_HIGH(GPIOH_PIN8) | \ + PIN_ODR_HIGH(GPIOH_PIN9) | \ + PIN_ODR_HIGH(GPIOH_PIN10) | \ + PIN_ODR_HIGH(GPIOH_PIN11) | \ + PIN_ODR_HIGH(GPIOH_PIN12) | \ + PIN_ODR_HIGH(GPIOH_PIN13) | \ + PIN_ODR_HIGH(GPIOH_PIN14) | \ + PIN_ODR_HIGH(GPIOH_PIN15)) +#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \ + PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN2, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN3, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN4, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN5, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN6, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN7, 0U)) +#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN9, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN10, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN11, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN12, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN13, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN14, 0U) | \ + PIN_AFIO_AF(GPIOH_PIN15, 0U)) + +/* + * USB bus activation macro, required by the USB driver. + */ +/* The point is that most of the generic STM32F103* boards + have a 1.5k resistor connected on one end to the D+ line + and on the other end to some pin. Or even a slightly more + complicated "USB enable" circuit, controlled by a pin. + That should go here. + + However on some boards (e.g. one that I have), there's no + such hardware. In which case it's better to not do anything. +*/ +/* +#define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) +*/ +#define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); + +/* + * USB bus de-activation macro, required by the USB driver. + */ +/* +#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) +*/ +#define usb_lld_disconnect_bus(usbp) while(0) { palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12); } + +#if !defined(_FROM_ASM_) +#ifdef __cplusplus +extern "C" { +#endif + void boardInit(void); +#ifdef __cplusplus +} +#endif +#endif /* _FROM_ASM_ */ + +#endif /* BOARD_H */ diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk new file mode 100644 index 00000000000..5eef1f01977 --- /dev/null +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk @@ -0,0 +1,5 @@ +# List of all the board related files. +BOARDSRC = $(BOARD_PATH)/boards/STM32L151_ANNE_PRO/board.c + +# Required include directories +BOARDINC = $(BOARD_PATH)/boards/STM32L151_ANNE_PRO diff --git a/keyboards/anne_pro/chconf.h b/keyboards/anne_pro/chconf.h new file mode 100644 index 00000000000..dfb1f9dfb9e --- /dev/null +++ b/keyboards/anne_pro/chconf.h @@ -0,0 +1,524 @@ +/* + ChibiOS - Copyright (C) 2006..2015 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. +*/ + +/** + * @file templates/chconf.h + * @brief Configuration file template. + * @details A copy of this file must be placed in each project directory, it + * contains the application specific kernel settings. + * + * @addtogroup config + * @details Kernel related settings and hooks. + * @{ + */ + +#ifndef CHCONF_H +#define CHCONF_H + +#define _CHIBIOS_RT_CONF_ + +/*===========================================================================*/ +/** + * @name System timers settings + * @{ + */ +/*===========================================================================*/ + +/** + * @brief System time counter resolution. + * @note Allowed values are 16 or 32 bits. + */ +#define CH_CFG_ST_RESOLUTION 16 + +/** + * @brief System tick frequency. + * @details Frequency of the system timer that drives the system ticks. This + * setting also defines the system tick time unit. + */ +#define CH_CFG_ST_FREQUENCY 2000 + +/** + * @brief Time delta constant for the tick-less mode. + * @note If this value is zero then the system uses the classic + * periodic tick. This value represents the minimum number + * of ticks that is safe to specify in a timeout directive. + * The value one is not valid, timeouts are rounded up to + * this value. + */ +#define CH_CFG_ST_TIMEDELTA 2 + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel parameters and options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Round robin interval. + * @details This constant is the number of system ticks allowed for the + * threads before preemption occurs. Setting this value to zero + * disables the preemption for threads with equal priority and the + * round robin becomes cooperative. Note that higher priority + * threads can still preempt, the kernel is always preemptive. + * @note Disabling the round robin preemption makes the kernel more compact + * and generally faster. + * @note The round robin preemption is not supported in tickless mode and + * must be set to zero in that case. + */ +#define CH_CFG_TIME_QUANTUM 0 + +/** + * @brief Managed RAM size. + * @details Size of the RAM area to be managed by the OS. If set to zero + * then the whole available RAM is used. The core memory is made + * available to the heap allocator and/or can be used directly through + * the simplified core memory allocator. + * + * @note In order to let the OS manage the whole RAM the linker script must + * provide the @p __heap_base__ and @p __heap_end__ symbols. + * @note Requires @p CH_CFG_USE_MEMCORE. + */ +#define CH_CFG_MEMCORE_SIZE 0 + +/** + * @brief Idle thread automatic spawn suppression. + * @details When this option is activated the function @p chSysInit() + * does not spawn the idle thread. The application @p main() + * function becomes the idle thread and must implement an + * infinite loop. + */ +#define CH_CFG_NO_IDLE_THREAD FALSE + +/* Use __WFI in the idle thread for waiting. Does lower the power + * consumption. */ +#define CORTEX_ENABLE_WFI_IDLE TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Performance options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief OS optimization. + * @details If enabled then time efficient rather than space efficient code + * is used when two possible implementations exist. + * + * @note This is not related to the compiler optimization options. + * @note The default is @p TRUE. + */ +#define CH_CFG_OPTIMIZE_SPEED TRUE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Subsystem options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Time Measurement APIs. + * @details If enabled then the time measurement APIs are included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_TM FALSE + +/** + * @brief Threads registry APIs. + * @details If enabled then the registry APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_REGISTRY TRUE + +/** + * @brief Threads synchronization APIs. + * @details If enabled then the @p chThdWait() function is included in + * the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_WAITEXIT TRUE + +/** + * @brief Semaphores APIs. + * @details If enabled then the Semaphores APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_SEMAPHORES TRUE + +/** + * @brief Semaphores queuing mode. + * @details If enabled then the threads are enqueued on semaphores by + * priority rather than in FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE + +/** + * @brief Mutexes APIs. + * @details If enabled then the mutexes APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MUTEXES TRUE + +/** + * @brief Enables recursive behavior on mutexes. + * @note Recursive mutexes are heavier and have an increased + * memory footprint. + * + * @note The default is @p FALSE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE + +/** + * @brief Conditional Variables APIs. + * @details If enabled then the conditional variables APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MUTEXES. + */ +#define CH_CFG_USE_CONDVARS TRUE + +/** + * @brief Conditional Variables APIs with timeout. + * @details If enabled then the conditional variables APIs with timeout + * specification are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_CONDVARS. + */ +#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE + +/** + * @brief Events Flags APIs. + * @details If enabled then the event flags APIs are included in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_EVENTS TRUE + +/** + * @brief Events Flags APIs with timeout. + * @details If enabled then the events APIs with timeout specification + * are included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_EVENTS. + */ +#define CH_CFG_USE_EVENTS_TIMEOUT TRUE + +/** + * @brief Synchronous Messages APIs. + * @details If enabled then the synchronous messages APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MESSAGES TRUE + +/** + * @brief Synchronous Messages queuing mode. + * @details If enabled then messages are served by priority rather than in + * FIFO order. + * + * @note The default is @p FALSE. Enable this if you have special + * requirements. + * @note Requires @p CH_CFG_USE_MESSAGES. + */ +#define CH_CFG_USE_MESSAGES_PRIORITY FALSE + +/** + * @brief Mailboxes APIs. + * @details If enabled then the asynchronous messages (mailboxes) APIs are + * included in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_SEMAPHORES. + */ +#define CH_CFG_USE_MAILBOXES TRUE + +/** + * @brief Core Memory Manager APIs. + * @details If enabled then the core memory manager APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMCORE TRUE + +/** + * @brief Heap Allocator APIs. + * @details If enabled then the memory heap allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or + * @p CH_CFG_USE_SEMAPHORES. + * @note Mutexes are recommended. + */ +#define CH_CFG_USE_HEAP TRUE + +/** + * @brief Memory Pools Allocator APIs. + * @details If enabled then the memory pools allocator APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#define CH_CFG_USE_MEMPOOLS FALSE + +/** + * @brief Dynamic Threads APIs. + * @details If enabled then the dynamic threads creation APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + * @note Requires @p CH_CFG_USE_WAITEXIT. + * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. + */ +#define CH_CFG_USE_DYNAMIC FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Debug options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Debug option, kernel statistics. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_STATISTICS FALSE + +/** + * @brief Debug option, system state check. + * @details If enabled the correct call protocol for system APIs is checked + * at runtime. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_SYSTEM_STATE_CHECK FALSE + +/** + * @brief Debug option, parameters checks. + * @details If enabled then the checks on the API functions input + * parameters are activated. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_CHECKS FALSE + +/** + * @brief Debug option, consistency checks. + * @details If enabled then all the assertions in the kernel code are + * activated. This includes consistency checks inside the kernel, + * runtime anomalies and port-defined checks. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_ENABLE_ASSERTS FALSE + +/** + * @brief Debug option, trace buffer. + * @details If enabled then the trace buffer is activated. + * + * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED + +/** + * @brief Trace buffer entries. + * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is + * different from @p CH_DBG_TRACE_MASK_DISABLED. + */ +#define CH_DBG_TRACE_BUFFER_SIZE 128 + +/** + * @brief Debug option, stack checks. + * @details If enabled then a runtime stack check is performed. + * + * @note The default is @p FALSE. + * @note The stack check is performed in a architecture/port dependent way. + * It may not be implemented or some ports. + * @note The default failure mode is to halt the system with the global + * @p panic_msg variable set to @p NULL. + */ +#define CH_DBG_ENABLE_STACK_CHECK FALSE + +/** + * @brief Debug option, stacks initialization. + * @details If enabled then the threads working area is filled with a byte + * value when a thread is created. This can be useful for the + * runtime measurement of the used stack. + * + * @note The default is @p FALSE. + */ +#define CH_DBG_FILL_THREADS FALSE + +/** + * @brief Debug option, threads profiling. + * @details If enabled then a field is added to the @p thread_t structure that + * counts the system ticks occurred while executing the thread. + * + * @note The default is @p FALSE. + * @note This debug option is not currently compatible with the + * tickless mode. + */ +#define CH_DBG_THREADS_PROFILING FALSE + +/** @} */ + +/*===========================================================================*/ +/** + * @name Kernel hooks + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Threads descriptor structure extension. + * @details User fields added to the end of the @p thread_t structure. + */ +#define CH_CFG_THREAD_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief Threads initialization hook. + * @details User initialization code added to the @p chThdInit() API. + * + * @note It is invoked from within @p chThdInit() and implicitly from all + * the threads creation APIs. + */ +#define CH_CFG_THREAD_INIT_HOOK(tp) { \ + /* Add threads initialization code here.*/ \ +} + +/** + * @brief Threads finalization hook. + * @details User finalization code added to the @p chThdExit() API. + */ +#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ + /* Add threads finalization code here.*/ \ +} + +/** + * @brief Context switch hook. + * @details This hook is invoked just before switching between threads. + */ +#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ + /* Context switch code here.*/ \ +} + +/** + * @brief ISR enter hook. + */ +#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ + /* IRQ prologue code here.*/ \ +} + +/** + * @brief ISR exit hook. + */ +#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ + /* IRQ epilogue code here.*/ \ +} + +/** + * @brief Idle thread enter hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to activate a power saving mode. + */ +#define CH_CFG_IDLE_ENTER_HOOK() { \ + /* Idle-enter code here.*/ \ +} + +/** + * @brief Idle thread leave hook. + * @note This hook is invoked within a critical zone, no OS functions + * should be invoked from here. + * @note This macro can be used to deactivate a power saving mode. + */ +#define CH_CFG_IDLE_LEAVE_HOOK() { \ + /* Idle-leave code here.*/ \ +} + +/** + * @brief Idle Loop hook. + * @details This hook is continuously invoked by the idle thread loop. + */ +#define CH_CFG_IDLE_LOOP_HOOK() { \ + /* Idle loop code here.*/ \ +} + +/** + * @brief System tick event hook. + * @details This hook is invoked in the system tick handler immediately + * after processing the virtual timers queue. + */ +#define CH_CFG_SYSTEM_TICK_HOOK() { \ + /* System tick event code here.*/ \ +} + +/** + * @brief System halt hook. + * @details This hook is invoked in case to a system halting error before + * the system is halted. + */ +#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ + /* System halt code here.*/ \ +} + +/** + * @brief Trace hook. + * @details This hook is invoked each time a new record is written in the + * trace buffer. + */ +#define CH_CFG_TRACE_HOOK(tep) { \ + /* Trace code here.*/ \ +} + +/** @} */ + +/*===========================================================================*/ +/* Port-specific settings (override port settings defaulted in chcore.h). */ +/*===========================================================================*/ + +#endif /* CHCONF_H */ + +/** @} */ diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h new file mode 100644 index 00000000000..305cf714065 --- /dev/null +++ b/keyboards/anne_pro/config.h @@ -0,0 +1,115 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once + +#include "config_common.h" + +/* USB Device descriptor parameter */ +#define VENDOR_ID 0xFEED +#define PRODUCT_ID 0x6060 +#define DEVICE_VER 0x0006 + +#define MANUFACTURER QMK +#define PRODUCT Anne Pro +#define DESCRIPTION Anne Pro Keyboard + +/* key matrix size */ +#define MATRIX_ROWS 5 +#define MATRIX_COLS 14 + +#define MATRIX_ROW_PINS { B9, B8, B7, B6, A0 } +#define MATRIX_COL_PINS { A5, A6, A7, B0, B1, B12, B13, B14, A8, A9, A15, B3, B4, B5 } + +/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ +#define DEBOUNCE 6 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +//#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +//#define LOCKING_RESYNC_ENABLE + +/* + * Force NKRO + * + * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved + * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the + * makefile for this to work.) + * + * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) + * until the next keyboard reset. + * + * NKRO may prevent your keystrokes from being detected in the BIOS, but it is + * fully operational during normal computer usage. + * + * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) + * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by + * bootmagic, NKRO mode will always be enabled until it is toggled again during a + * power-up. + * + */ +//#define FORCE_NKRO + +/* + * Feature disable options + * These options are also useful to firmware size reduction. + */ + +/* disable debug print */ +//#define NO_DEBUG + +/* disable print */ +//#define NO_PRINT + +/* disable action features */ +//#define NO_ACTION_LAYER +//#define NO_ACTION_TAPPING +//#define NO_ACTION_ONESHOT +//#define NO_ACTION_MACRO +//#define NO_ACTION_FUNCTION + +/* + * MIDI options + */ + +/* Prevent use of disabled MIDI features in the keymap */ +//#define MIDI_ENABLE_STRICT 1 + +/* enable basic MIDI features: + - MIDI notes can be sent when in Music mode is on +*/ +//#define MIDI_BASIC + +/* enable advanced MIDI features: + - MIDI notes can be added to the keymap + - Octave shift and transpose + - Virtual sustain, portamento, and modulation wheel + - etc. +*/ +//#define MIDI_ADVANCED + +/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ +//#define MIDI_TONE_KEYCODE_OCTAVES 1 + +// #define WS2812_LED_N 2 +// #define RGBLED_NUM WS2812_LED_N +// #define WS2812_TIM_N 2 +// #define WS2812_TIM_CH 2 +// #define PORT_WS2812 GPIOA +// #define PIN_WS2812 1 +// #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) +//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP +//#define WS2812_EXTERNAL_PULLUP diff --git a/keyboards/anne_pro/halconf.h b/keyboards/anne_pro/halconf.h new file mode 100644 index 00000000000..1ceefe34a90 --- /dev/null +++ b/keyboards/anne_pro/halconf.h @@ -0,0 +1,353 @@ +/* + ChibiOS - Copyright (C) 2006..2015 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. +*/ + +/** + * @file templates/halconf.h + * @brief HAL configuration header. + * @details HAL configuration file, this file allows to enable or disable the + * various device drivers from your application. You may also use + * this file in order to override the device drivers default settings. + * + * @addtogroup HAL_CONF + * @{ + */ + +#ifndef _HALCONF_H_ +#define _HALCONF_H_ + +#include "mcuconf.h" + +/** + * @brief Enables the PAL subsystem. + */ +#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) +#define HAL_USE_PAL TRUE +#endif + +/** + * @brief Enables the ADC subsystem. + */ +#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) +#define HAL_USE_ADC FALSE +#endif + +/** + * @brief Enables the CAN subsystem. + */ +#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the DAC subsystem. + */ +#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) +#define HAL_USE_DAC FALSE +#endif + +/** + * @brief Enables the EXT subsystem. + */ +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE +#endif + +/** + * @brief Enables the GPT subsystem. + */ +#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) +#define HAL_USE_GPT FALSE +#endif + +/** + * @brief Enables the I2C subsystem. + */ +#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) +#define HAL_USE_I2C FALSE +#endif + +/** + * @brief Enables the I2S subsystem. + */ +#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) +#define HAL_USE_I2S FALSE +#endif + +/** + * @brief Enables the ICU subsystem. + */ +#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) +#define HAL_USE_ICU FALSE +#endif + +/** + * @brief Enables the MAC subsystem. + */ +#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) +#define HAL_USE_MAC FALSE +#endif + +/** + * @brief Enables the MMC_SPI subsystem. + */ +#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) +#define HAL_USE_MMC_SPI FALSE +#endif + +/** + * @brief Enables the PWM subsystem. + */ +#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) +#define HAL_USE_PWM FALSE +#endif + +/** + * @brief Enables the RTC subsystem. + */ +#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) +#define HAL_USE_RTC FALSE +#endif + +/** + * @brief Enables the SDC subsystem. + */ +#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) +#define HAL_USE_SDC FALSE +#endif + +/** + * @brief Enables the SERIAL subsystem. + */ +#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL FALSE +#endif + +/** + * @brief Enables the SERIAL over USB subsystem. + */ +#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) +#define HAL_USE_SERIAL_USB FALSE +#endif + +/** + * @brief Enables the SPI subsystem. + */ +#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the UART subsystem. + */ +#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) +#define HAL_USE_UART TRUE +#endif + +/** + * @brief Enables the USB subsystem. + */ +#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) +#define HAL_USE_USB TRUE +#endif + +/** + * @brief Enables the WDG subsystem. + */ +#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) +#define HAL_USE_WDG FALSE +#endif + +/*===========================================================================*/ +/* ADC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) +#define ADC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define ADC_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* CAN driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Sleep mode related APIs inclusion switch. + */ +#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/*===========================================================================*/ +/* I2C driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the mutual exclusion APIs on the I2C bus. + */ +#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define I2C_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* MAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) +#define MAC_USE_ZERO_COPY FALSE +#endif + +/** + * @brief Enables an event sources for incoming packets. + */ +#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) +#define MAC_USE_EVENTS TRUE +#endif + +/*===========================================================================*/ +/* MMC_SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + * This option is recommended also if the SPI driver does not + * use a DMA channel and heavily loads the CPU. + */ +#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) +#define MMC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SDC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Number of initialization attempts before rejecting the card. + * @note Attempts are performed at 10mS intervals. + */ +#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) +#define SDC_INIT_RETRY 100 +#endif + +/** + * @brief Include support for MMC cards. + * @note MMC support is not yet implemented so this option must be kept + * at @p FALSE. + */ +#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) +#define SDC_MMC_SUPPORT FALSE +#endif + +/** + * @brief Delays insertions. + * @details If enabled this options inserts delays into the MMC waiting + * routines releasing some extra CPU time for the threads with + * lower priority, this may slow down the driver a bit however. + */ +#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) +#define SDC_NICE_WAITING TRUE +#endif + +/*===========================================================================*/ +/* SERIAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Default bit rate. + * @details Configuration parameter, this is the baud rate selected for the + * default configuration. + */ +#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) +#define SERIAL_DEFAULT_BITRATE 38400 +#endif + +/** + * @brief Serial buffers size. + * @details Configuration parameter, you can change the depth of the queue + * buffers depending on the requirements of your application. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_BUFFERS_SIZE 16 +#endif + +/*===========================================================================*/ +/* SERIAL_USB driver related setting. */ +/*===========================================================================*/ + +/** + * @brief Serial over USB buffers size. + * @details Configuration parameter, the buffer size must be a multiple of + * the USB data endpoint maximum packet size. + * @note The default is 64 bytes for both the transmission and receive + * buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_SIZE 1 +#endif + +/*===========================================================================*/ +/* SPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) +#define SPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +/*===========================================================================*/ +/* USB driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) +#define USB_USE_WAIT TRUE +#endif + +#endif /* _HALCONF_H_ */ + +/** @} */ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c new file mode 100644 index 00000000000..b88d6089d63 --- /dev/null +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -0,0 +1,27 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + 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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, KC_NO, KC_NO, KC_RCTL + ) +}; diff --git a/keyboards/anne_pro/ld/STM32L151.ld b/keyboards/anne_pro/ld/STM32L151.ld new file mode 100644 index 00000000000..60fe9b9e3c7 --- /dev/null +++ b/keyboards/anne_pro/ld/STM32L151.ld @@ -0,0 +1,85 @@ +/* + ChibiOS - Copyright (C) 2006..2016 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. +*/ + +/* + * ST32L151 memory map. + */ +MEMORY +{ + flash0 : org = 0x08000000, len = 64k + flash1 : org = 0x00000000, len = 0 + flash2 : org = 0x00000000, len = 0 + flash3 : org = 0x00000000, len = 0 + flash4 : org = 0x00000000, len = 0 + flash5 : org = 0x00000000, len = 0 + flash6 : org = 0x00000000, len = 0 + flash7 : org = 0x00000000, len = 0 + ram0 : org = 0x20000000, len = 10k + ram1 : org = 0x00000000, len = 0 + ram2 : org = 0x00000000, len = 0 + ram3 : org = 0x00000000, len = 0 + ram4 : org = 0x00000000, len = 0 + ram5 : org = 0x00000000, len = 0 + ram6 : org = 0x00000000, len = 0 + ram7 : org = 0x00000000, len = 0 +} + +/* 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", flash0); +REGION_ALIAS("VECTORS_FLASH_LMA", flash0); + +/* Flash region to be used for constructors and destructors.*/ +REGION_ALIAS("XTORS_FLASH", flash0); +REGION_ALIAS("XTORS_FLASH_LMA", flash0); + +/* Flash region to be used for code text.*/ +REGION_ALIAS("TEXT_FLASH", flash0); +REGION_ALIAS("TEXT_FLASH_LMA", flash0); + +/* Flash region to be used for read only data.*/ +REGION_ALIAS("RODATA_FLASH", flash0); +REGION_ALIAS("RODATA_FLASH_LMA", flash0); + +/* Flash region to be used for various.*/ +REGION_ALIAS("VARIOUS_FLASH", flash0); +REGION_ALIAS("VARIOUS_FLASH_LMA", flash0); + +/* Flash region to be used for RAM(n) initialization data.*/ +REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); + +/* RAM region to be used for Main stack. This stack accommodates the processing + of all exceptions and interrupts.*/ +REGION_ALIAS("MAIN_STACK_RAM", ram0); + +/* RAM region to be used for the process stack. This is the stack used by + the main() function.*/ +REGION_ALIAS("PROCESS_STACK_RAM", ram0); + +/* RAM region to be used for data segment.*/ +REGION_ALIAS("DATA_RAM", ram0); +REGION_ALIAS("DATA_RAM_LMA", flash0); + +/* 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); + +/* Generic rules inclusion.*/ +INCLUDE rules.ld diff --git a/keyboards/anne_pro/mcuconf.h b/keyboards/anne_pro/mcuconf.h new file mode 100644 index 00000000000..5fa5ff0129a --- /dev/null +++ b/keyboards/anne_pro/mcuconf.h @@ -0,0 +1,203 @@ +/* + 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. +*/ + +#ifndef MCUCONF_H +#define MCUCONF_H + +/* + * STM32L1xx 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 STM32L1xx_MCUCONF + +/* + * HAL driver system settings. + */ +#define STM32_NO_INIT FALSE +#define STM32_HSI_ENABLED TRUE +#define STM32_LSI_ENABLED TRUE +#define STM32_HSE_ENABLED TRUE +#define STM32_LSE_ENABLED FALSE +#define STM32_ADC_CLOCK_ENABLED FALSE +#define STM32_USB_CLOCK_ENABLED TRUE +#define STM32_MSIRANGE STM32_MSIRANGE_2M +#define STM32_SW STM32_SW_PLL +#define STM32_PLLSRC STM32_PLLSRC_HSE +#define STM32_PLLMUL_VALUE 6 +#define STM32_PLLDIV_VALUE 3 +#define STM32_HPRE STM32_HPRE_DIV1 +#define STM32_PPRE1 STM32_PPRE1_DIV2 +#define STM32_PPRE2 STM32_PPRE2_DIV2 +#define STM32_MCOSEL STM32_MCOSEL_NOCLOCK +#define STM32_MCOPRE STM32_MCOPRE_DIV1 +#define STM32_RTCSEL STM32_RTCSEL_LSI +#define STM32_RTCPRE STM32_RTCPRE_DIV2 +#define STM32_VOS STM32_VOS_1P8 +#define STM32_PVD_ENABLE FALSE +#define STM32_PLS STM32_PLS_LEV0 + +/* + * IRQ system settings. + */ +#define STM32_IRQ_EXTI0_PRIORITY 6 +#define STM32_IRQ_EXTI1_PRIORITY 6 +#define STM32_IRQ_EXTI2_PRIORITY 6 +#define STM32_IRQ_EXTI3_PRIORITY 6 +#define STM32_IRQ_EXTI4_PRIORITY 6 +#define STM32_IRQ_EXTI5_9_PRIORITY 6 +#define STM32_IRQ_EXTI10_15_PRIORITY 6 +#define STM32_IRQ_EXTI16_PRIORITY 6 +#define STM32_IRQ_EXTI17_PRIORITY 6 +#define STM32_IRQ_EXTI18_PRIORITY 6 +#define STM32_IRQ_EXTI19_PRIORITY 6 +#define STM32_IRQ_EXTI20_PRIORITY 6 +#define STM32_IRQ_EXTI21_22_PRIORITY 6 + +/* + * ADC driver system settings. + */ +#define STM32_ADC_USE_ADC1 FALSE +#define STM32_ADC_ADC1_DMA_PRIORITY 2 +#define STM32_ADC_IRQ_PRIORITY 6 +#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 6 + +/* + * DAC driver system settings. + */ +#define STM32_DAC_DUAL_MODE FALSE +#define STM32_DAC_USE_DAC1_CH1 FALSE +#define STM32_DAC_USE_DAC1_CH2 FALSE +#define STM32_DAC_DAC1_CH1_IRQ_PRIORITY 10 +#define STM32_DAC_DAC1_CH2_IRQ_PRIORITY 10 +#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 +#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 + +/* + * GPT driver system settings. + */ +#define STM32_GPT_USE_TIM2 FALSE +#define STM32_GPT_USE_TIM3 FALSE +#define STM32_GPT_USE_TIM4 FALSE +#define STM32_GPT_USE_TIM6 FALSE +#define STM32_GPT_USE_TIM7 FALSE +#define STM32_GPT_USE_TIM9 FALSE +#define STM32_GPT_USE_TIM11 FALSE +#define STM32_GPT_TIM2_IRQ_PRIORITY 7 +#define STM32_GPT_TIM3_IRQ_PRIORITY 7 +#define STM32_GPT_TIM4_IRQ_PRIORITY 7 +#define STM32_GPT_TIM6_IRQ_PRIORITY 7 +#define STM32_GPT_TIM7_IRQ_PRIORITY 7 +#define STM32_GPT_TIM9_IRQ_PRIORITY 7 +#define STM32_GPT_TIM11_IRQ_PRIORITY 7 + +/* + * I2C driver system settings. + */ +#define STM32_I2C_USE_I2C1 FALSE +#define STM32_I2C_USE_I2C2 FALSE +#define STM32_I2C_BUSY_TIMEOUT 50 +#define STM32_I2C_I2C1_IRQ_PRIORITY 5 +#define STM32_I2C_I2C2_IRQ_PRIORITY 5 +#define STM32_I2C_I2C1_DMA_PRIORITY 3 +#define STM32_I2C_I2C2_DMA_PRIORITY 3 +#define STM32_I2C_DMA_ERROR_HOOK(i2cp) osalSysHalt("DMA failure") + +/* + * ICU driver system settings. + */ +#define STM32_ICU_USE_TIM2 FALSE +#define STM32_ICU_USE_TIM3 FALSE +#define STM32_ICU_USE_TIM4 FALSE +#define STM32_ICU_USE_TIM9 FALSE +#define STM32_ICU_TIM2_IRQ_PRIORITY 7 +#define STM32_ICU_TIM3_IRQ_PRIORITY 7 +#define STM32_ICU_TIM4_IRQ_PRIORITY 7 +#define STM32_ICU_TIM9_IRQ_PRIORITY 7 + +/* + * PWM driver system settings. + */ +#define STM32_PWM_USE_TIM2 FALSE +#define STM32_PWM_USE_TIM3 FALSE +#define STM32_PWM_USE_TIM4 FALSE +#define STM32_PWM_USE_TIM9 FALSE +#define STM32_PWM_TIM2_IRQ_PRIORITY 7 +#define STM32_PWM_TIM3_IRQ_PRIORITY 7 +#define STM32_PWM_TIM4_IRQ_PRIORITY 7 +#define STM32_PWM_TIM9_IRQ_PRIORITY 7 + +/* + * SERIAL driver system settings. + */ +#define STM32_SERIAL_USE_USART1 FALSE +#define STM32_SERIAL_USE_USART2 FALSE +#define STM32_SERIAL_USE_USART3 FALSE +#define STM32_SERIAL_USART1_PRIORITY 12 +#define STM32_SERIAL_USART2_PRIORITY 12 +#define STM32_SERIAL_USART3_PRIORITY 12 + +/* + * SPI driver system settings. + */ +#define STM32_SPI_USE_SPI1 FALSE +#define STM32_SPI_USE_SPI2 FALSE +#define STM32_SPI_SPI1_DMA_PRIORITY 1 +#define STM32_SPI_SPI2_DMA_PRIORITY 1 +#define STM32_SPI_SPI1_IRQ_PRIORITY 10 +#define STM32_SPI_SPI2_IRQ_PRIORITY 10 +#define STM32_SPI_DMA_ERROR_HOOK(spip) osalSysHalt("DMA failure") + +/* + * ST driver system settings. + */ +#define STM32_ST_IRQ_PRIORITY 8 +#define STM32_ST_USE_TIMER 2 + +/* + * UART driver system settings. + */ +#define STM32_UART_USE_USART1 FALSE +#define STM32_UART_USE_USART2 FALSE +#define STM32_UART_USE_USART3 TRUE +#define STM32_UART_USART1_IRQ_PRIORITY 12 +#define STM32_UART_USART2_IRQ_PRIORITY 12 +#define STM32_UART_USART3_IRQ_PRIORITY 12 +#define STM32_UART_USART1_DMA_PRIORITY 0 +#define STM32_UART_USART2_DMA_PRIORITY 0 +#define STM32_UART_USART3_DMA_PRIORITY 0 +#define STM32_UART_DMA_ERROR_HOOK(uartp) osalSysHalt("DMA failure") + +/* + * USB driver system settings. + */ +#define STM32_USB_USE_USB1 TRUE +#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE +#define STM32_USB_USB1_HP_IRQ_PRIORITY 13 +#define STM32_USB_USB1_LP_IRQ_PRIORITY 14 + +/* + * WDG driver system settings. + */ +#define STM32_WDG_USE_IWDG FALSE + +#endif /* MCUCONF_H */ diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk new file mode 100644 index 00000000000..fda74b4518f --- /dev/null +++ b/keyboards/anne_pro/rules.mk @@ -0,0 +1,37 @@ +## chip/board settings +# the next two should match the directories in +# /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) +MCU_FAMILY = STM32 +MCU_SERIES = STM32L1xx +# linker script to use +# it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ +# or /ld/ +MCU_LDSCRIPT = STM32L151 +# startup code to use +# is should exist in /os/common/ports/ARMCMx/compilers/GCC/mk/ +MCU_STARTUP = stm32l1xx +# board to use +# it should exist either in /os/hal/boards/ +# or /boards +BOARD = STM32L151_ANNE_PRO +# Cortex version +# Teensy LC is cortex-m0; Teensy 3.x are cortex-m4 +MCU = cortex-m3 +# ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 +ARMV = 7 + +# Build Options +# comment out to disable the options. +# +BACKLIGHT_ENABLE = no +BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration +## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) +MOUSEKEY_ENABLE = yes # Mouse keys +EXTRAKEY_ENABLE = yes # Audio control and System control +CONSOLE_ENABLE = yes # Console for debug +COMMAND_ENABLE = yes # Commands for debug and configuration +#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend +NKRO_ENABLE = yes # USB Nkey Rollover +AUDIO_ENABLE = no +RGBLIGHT_ENABLE = no +# SERIAL_LINK_ENABLE = no From a7e0b14d9e5745cae1d5d380a90fd0590a50b122 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 22 Jun 2019 15:08:57 +0200 Subject: [PATCH 02/68] Update formatting --- keyboards/anne_pro/anne_pro.c | 58 +++++++++++++++++------------------ keyboards/anne_pro/anne_pro.h | 2 +- keyboards/anne_pro/config.h | 38 ----------------------- 3 files changed, 30 insertions(+), 68 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index f8a62621fb8..48e8265183e 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -30,7 +30,7 @@ static void txend1(UARTDriver *uartp) { * This callback is invoked when a transmission has physically completed. */ static void txend2(UARTDriver *uartp) { - (void)uartp; + (void)uartp; } /* @@ -38,8 +38,8 @@ static void txend2(UARTDriver *uartp) { * as parameter. */ static void rxerr(UARTDriver *uartp, uartflags_t e) { - (void)uartp; - (void)e; + (void)uartp; + (void)e; } /* @@ -47,53 +47,53 @@ static void rxerr(UARTDriver *uartp, uartflags_t e) { * was not ready to receive it, the character is passed as parameter. */ static void rxchar(UARTDriver *uartp, uint16_t c) { - (void)uartp; - (void)c; + (void)uartp; + (void)c; } /* * This callback is invoked when a receive buffer has been completely written. */ static void rxend(UARTDriver *uartp) { - (void)uartp; + (void)uartp; } static UARTConfig uart_cfg = { - .txend1_cb = txend1, - .txend2_cb = txend2, - .rxend_cb = rxend, - .rxchar_cb = rxchar, - .rxerr_cb = rxerr, - .speed = 38400, - .cr1 = 0, - .cr2 = USART_CR2_LINEN, - .cr3 = 0 + .txend1_cb = txend1, + .txend2_cb = txend2, + .rxend_cb = rxend, + .rxchar_cb = rxchar, + .rxerr_cb = rxerr, + .speed = 38400, + .cr1 = 0, + .cr2 = USART_CR2_LINEN, + .cr3 = 0 }; bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { - // Send 'next theme' command to lighting controller + /* Send 'next theme' command to lighting controller */ uartStartSend(&UARTD3, 4, "\x09\x04\x05\x01\x00\x00"); } return true; } void matrix_init_kb(void) { - // Turn on lighting controller - setPinOutput(C15); - writePinLow(C15); - chThdSleepMilliseconds(100); - writePinHigh(C15); - chThdSleepMilliseconds(100); + /* Turn on lighting controller */ + setPinOutput(C15); + writePinLow(C15); + chThdSleepMilliseconds(100); + writePinHigh(C15); + chThdSleepMilliseconds(100); - // Initialize the lighting UART - uartStart(&UARTD3, &uart_cfg); - palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); - palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); + /* Initialize the lighting UART */ + uartStart(&UARTD3, &uart_cfg); + palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); + palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); - // Send 'set theme' command to lighting controller - uartStartSend(&UARTD3, 4, "\x09\x02\x01\x01"); + /* Send 'set theme' command to lighting controller */ + uartStartSend(&UARTD3, 4, "\x09\x02\x01\x01"); - matrix_init_user(); + matrix_init_user(); } diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 5662343fac4..ea02a264231 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -17,7 +17,7 @@ #pragma once #include "quantum.h" -/* The fully-featured LAYOUT_all() that has every single key available in the matrix. +/* The fully-featured LAYOUT() that has every single key available in the matrix. */ #define LAYOUT(\ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 305cf714065..2705b09b1b4 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -37,11 +37,6 @@ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 6 -/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ -//#define LOCKING_SUPPORT_ENABLE -/* Locking resynchronize hack */ -//#define LOCKING_RESYNC_ENABLE - /* * Force NKRO * @@ -80,36 +75,3 @@ //#define NO_ACTION_ONESHOT //#define NO_ACTION_MACRO //#define NO_ACTION_FUNCTION - -/* - * MIDI options - */ - -/* Prevent use of disabled MIDI features in the keymap */ -//#define MIDI_ENABLE_STRICT 1 - -/* enable basic MIDI features: - - MIDI notes can be sent when in Music mode is on -*/ -//#define MIDI_BASIC - -/* enable advanced MIDI features: - - MIDI notes can be added to the keymap - - Octave shift and transpose - - Virtual sustain, portamento, and modulation wheel - - etc. -*/ -//#define MIDI_ADVANCED - -/* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ -//#define MIDI_TONE_KEYCODE_OCTAVES 1 - -// #define WS2812_LED_N 2 -// #define RGBLED_NUM WS2812_LED_N -// #define WS2812_TIM_N 2 -// #define WS2812_TIM_CH 2 -// #define PORT_WS2812 GPIOA -// #define PIN_WS2812 1 -// #define WS2812_DMA_STREAM STM32_DMA1_STREAM2 // DMA stream for TIMx_UP (look up in reference manual under DMA Channel selection) -//#define WS2812_DMA_CHANNEL 7 // DMA channel for TIMx_UP -//#define WS2812_EXTERNAL_PULLUP From e53b797ad32ea94d26d2b2a74836359207037946 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 22 Jun 2019 15:58:23 +0200 Subject: [PATCH 03/68] Automatically patch ChibiOS for the STM32L1xx series --- keyboards/anne_pro/chibios_stm32l151.patch | 15 +++++++++++++++ keyboards/anne_pro/rules.mk | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 keyboards/anne_pro/chibios_stm32l151.patch diff --git a/keyboards/anne_pro/chibios_stm32l151.patch b/keyboards/anne_pro/chibios_stm32l151.patch new file mode 100644 index 00000000000..76fedda343f --- /dev/null +++ b/keyboards/anne_pro/chibios_stm32l151.patch @@ -0,0 +1,15 @@ +diff --git a/os/hal/ports/STM32/STM32L1xx/platform.mk b/os/hal/ports/STM32/STM32L1xx/platform.mk +index e2c2344af..dcf6f83bc 100644 +--- a/os/hal/ports/STM32/STM32L1xx/platform.mk ++++ b/os/hal/ports/STM32/STM32L1xx/platform.mk +@@ -17,8 +17,8 @@ ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),) + PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c + endif + else +- $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c +-PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c ++PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c \ ++ $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c + endif + + # Drivers compatible with the platform. diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index fda74b4518f..7062263a98f 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -2,7 +2,8 @@ # the next two should match the directories in # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) MCU_FAMILY = STM32 -MCU_SERIES = STM32L1xx +# This is a hack to automatically apply the patch to ChibiOS +MCU_SERIES = $(shell echo STM32L1xx; cd lib/chibios; git apply ../../keyboards/anne_pro/chibios_stm32l151.patch 2>/dev/null) # linker script to use # it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ # or /ld/ From 0ac3727521b68cc5096ea2cc0870059d69ba7c06 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 22 Jun 2019 16:14:24 +0200 Subject: [PATCH 04/68] Make patch a script --- keyboards/anne_pro/apply_patch.sh | 3 +++ keyboards/anne_pro/rules.mk | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100755 keyboards/anne_pro/apply_patch.sh diff --git a/keyboards/anne_pro/apply_patch.sh b/keyboards/anne_pro/apply_patch.sh new file mode 100755 index 00000000000..6ef0edbaf63 --- /dev/null +++ b/keyboards/anne_pro/apply_patch.sh @@ -0,0 +1,3 @@ +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +cd $SCRIPTPATH/../../lib/chibios +git apply $SCRIPTPATH/chibios_stm32l151.patch diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 7062263a98f..fda74b4518f 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -2,8 +2,7 @@ # the next two should match the directories in # /os/hal/ports/$(MCU_FAMILY)/$(MCU_SERIES) MCU_FAMILY = STM32 -# This is a hack to automatically apply the patch to ChibiOS -MCU_SERIES = $(shell echo STM32L1xx; cd lib/chibios; git apply ../../keyboards/anne_pro/chibios_stm32l151.patch 2>/dev/null) +MCU_SERIES = STM32L1xx # linker script to use # it should exist either in /os/common/ports/ARMCMx/compilers/GCC/ld/ # or /ld/ From 70d24768a5a357a35a48bbb8f9932221f2c89950 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sun, 23 Jun 2019 15:15:36 +0200 Subject: [PATCH 05/68] Get USB working --- .../boards/STM32L151_ANNE_PRO/board.h | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h index 1e1f628effb..31151209982 100644 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h @@ -258,8 +258,8 @@ PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \ PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \ PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \ - PIN_OSPEED_HIGH(GPIOA_USB_DM) | \ - PIN_OSPEED_HIGH(GPIOA_USB_DP) | \ + PIN_OSPEED_VERYLOW(GPIOA_USB_DM) | \ + PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \ PIN_OSPEED_HIGH(GPIOA_JTAG_TMS) | \ PIN_OSPEED_HIGH(GPIOA_JTAG_TCK) | \ PIN_OSPEED_HIGH(GPIOA_JTAG_TDI)) @@ -274,8 +274,8 @@ PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOA_USB_DM) | \ - PIN_PUPDR_PULLUP(GPIOA_USB_DP) | \ + PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \ + PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \ PIN_PUPDR_PULLUP(GPIOA_JTAG_TMS) | \ PIN_PUPDR_PULLDOWN(GPIOA_JTAG_TCK) | \ PIN_PUPDR_PULLUP(GPIOA_JTAG_TDI)) @@ -290,8 +290,8 @@ PIN_ODR_HIGH(GPIOA_PIN8) | \ PIN_ODR_HIGH(GPIOA_PIN9) | \ PIN_ODR_HIGH(GPIOA_PIN10) | \ - PIN_ODR_HIGH(GPIOA_USB_DM) | \ - PIN_ODR_HIGH(GPIOA_USB_DP) | \ + PIN_ODR_LOW(GPIOA_USB_DM) | \ + PIN_ODR_LOW(GPIOA_USB_DP) | \ PIN_ODR_HIGH(GPIOA_JTAG_TMS) | \ PIN_ODR_HIGH(GPIOA_JTAG_TCK) | \ PIN_ODR_HIGH(GPIOA_JTAG_TDI)) @@ -897,31 +897,6 @@ PIN_AFIO_AF(GPIOH_PIN14, 0U) | \ PIN_AFIO_AF(GPIOH_PIN15, 0U)) -/* - * USB bus activation macro, required by the USB driver. - */ -/* The point is that most of the generic STM32F103* boards - have a 1.5k resistor connected on one end to the D+ line - and on the other end to some pin. Or even a slightly more - complicated "USB enable" circuit, controlled by a pin. - That should go here. - - However on some boards (e.g. one that I have), there's no - such hardware. In which case it's better to not do anything. -*/ -/* -#define usb_lld_connect_bus(usbp) palClearPad(GPIOB, GPIOB_USB_DISC) -*/ -#define usb_lld_connect_bus(usbp) palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); - -/* - * USB bus de-activation macro, required by the USB driver. - */ -/* -#define usb_lld_disconnect_bus(usbp) palSetPad(GPIOB, GPIOB_USB_DISC) -*/ -#define usb_lld_disconnect_bus(usbp) while(0) { palSetPadMode(GPIOA, 12, PAL_MODE_OUTPUT_PUSHPULL); palClearPad(GPIOA, 12); } - #if !defined(_FROM_ASM_) #ifdef __cplusplus extern "C" { From e9c334de3fa4ebb6ce0aa603f5a8eb0471fac26c Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 18:13:59 +0200 Subject: [PATCH 06/68] Anne Pro working with Obins DFU bootloader --- keyboards/anne_pro/anne_pro.c | 12 +--- keyboards/anne_pro/anne_pro.h | 3 +- .../boards/STM32L151_ANNE_PRO/board.c | 8 +++ keyboards/anne_pro/config.h | 6 +- keyboards/anne_pro/keymaps/default/keymap.c | 58 ++++++++++++++++++- keyboards/anne_pro/ld/STM32L151.ld | 2 +- keyboards/anne_pro/rules.mk | 4 +- 7 files changed, 75 insertions(+), 18 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 48e8265183e..84a912743d4 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -58,7 +58,6 @@ static void rxend(UARTDriver *uartp) { (void)uartp; } - static UARTConfig uart_cfg = { .txend1_cb = txend1, .txend2_cb = txend2, @@ -71,13 +70,7 @@ static UARTConfig uart_cfg = { .cr3 = 0 }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - if (!record->event.pressed) { - /* Send 'next theme' command to lighting controller */ - uartStartSend(&UARTD3, 4, "\x09\x04\x05\x01\x00\x00"); - } - return true; -} +extern volatile bool leds_enabled; void matrix_init_kb(void) { /* Turn on lighting controller */ @@ -93,7 +86,8 @@ void matrix_init_kb(void) { palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); /* Send 'set theme' command to lighting controller */ - uartStartSend(&UARTD3, 4, "\x09\x02\x01\x01"); + leds_enabled = true; + uartStartSend(&UARTD3, 4, "\x09\x01\x01"); matrix_init_user(); } diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index ea02a264231..5557e58ecae 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -17,8 +17,7 @@ #pragma once #include "quantum.h" -/* The fully-featured LAYOUT() that has every single key available in the matrix. - */ +/* The fully-featured LAYOUT() that has every single key available in the matrix. */ #define LAYOUT(\ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \ diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c index 4b26d39f8a5..bb32b59416f 100644 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c @@ -73,6 +73,14 @@ const PALConfig pal_default_config = { * and before any other initialization. */ void __early_init(void) { + /* Disable all external interrupt vectors, they are left enabled by the bootloader */ + nvicDisableVector(EXTI0_IRQn); + nvicDisableVector(EXTI1_IRQn); + nvicDisableVector(EXTI2_IRQn); + nvicDisableVector(EXTI3_IRQn); + nvicDisableVector(EXTI4_IRQn); + nvicDisableVector(EXTI9_5_IRQn); + nvicDisableVector(EXTI15_10_IRQn); stm32_clock_init(); } diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 2705b09b1b4..9a36c9b13a1 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -19,9 +19,9 @@ #include "config_common.h" /* USB Device descriptor parameter */ -#define VENDOR_ID 0xFEED -#define PRODUCT_ID 0x6060 -#define DEVICE_VER 0x0006 +#define VENDOR_ID 0x0483 +#define PRODUCT_ID 0xdf11 +#define DEVICE_VER 0x0200 #define MANUFACTURER QMK #define PRODUCT Anne Pro diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index b88d6089d63..54b97f81ef3 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -16,12 +16,68 @@ #include QMK_KEYBOARD_H +/* Custom keycodes for the lighting control for the Anne Pro */ +enum my_keycodes { + ANNERGB = SAFE_RANGE, + ANNERAT, + ANNEBRT, + ANNEMOD +}; + +/* Default Anne Pro layout, macOS style with LALT and LWIN switched */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, 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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, KC_NO, KC_NO, KC_RCTL + KC_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), KC_NO, KC_RCTL + ), + [1] = LAYOUT( + KC_GRV, 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_UP, _______, ANNERGB, ANNERAT, ANNEBRT, ANNEMOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, _______, + _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, _______, + _______, _______, _______, _______, _______, _______, _______, _______ ) }; + +/* State of the leds on the keyboard */ +volatile bool leds_enabled = false; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case ANNERGB: + /* Toggle the RGB enabled/disabled */ + if (record->event.pressed) { + leds_enabled = !leds_enabled; + if (leds_enabled) { + uartStartSend(&UARTD3, 3, "\x09\x01\x01"); + } else { + uartStartSend(&UARTD3, 4, "\x09\x02\x01\x00"); + } + } + return false; + case ANNERAT: + /* Change the animation rate */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x01\x00"); + } + return false; + case ANNEBRT: + /* Change the brightness */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x00\x01"); + } + return false; + case ANNEMOD: + /* Change the lighting mode */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); + } + return false; + default: + /* Handle other keycodes normally */ + return true; + } +} diff --git a/keyboards/anne_pro/ld/STM32L151.ld b/keyboards/anne_pro/ld/STM32L151.ld index 60fe9b9e3c7..f8019baa471 100644 --- a/keyboards/anne_pro/ld/STM32L151.ld +++ b/keyboards/anne_pro/ld/STM32L151.ld @@ -19,7 +19,7 @@ */ MEMORY { - flash0 : org = 0x08000000, len = 64k + flash0 : org = 0x08004000, len = 48k flash1 : org = 0x00000000, len = 0 flash2 : org = 0x00000000, len = 0 flash3 : org = 0x00000000, len = 0 diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index fda74b4518f..1148a1a5e15 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -28,8 +28,8 @@ BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) MOUSEKEY_ENABLE = yes # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = yes # Console for debug -COMMAND_ENABLE = yes # Commands for debug and configuration +CONSOLE_ENABLE = no # Console for debug +COMMAND_ENABLE = no # Commands for debug and configuration #SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover AUDIO_ENABLE = no From 39464480ee626e977b727a1a1da5c1c12a6f68f0 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 18:53:36 +0200 Subject: [PATCH 07/68] Add dfu-convert script and README with flashing information --- keyboards/anne_pro/README.md | 34 ++++++++++ util/dfu-convert.py | 127 +++++++++++++++++++++++++++++++++++ 2 files changed, 161 insertions(+) create mode 100644 keyboards/anne_pro/README.md create mode 100755 util/dfu-convert.py diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md new file mode 100644 index 00000000000..daa36be6c59 --- /dev/null +++ b/keyboards/anne_pro/README.md @@ -0,0 +1,34 @@ +# Anne Pro +QMK firmware port for the Obins Anne Pro 60% keyboard. + +__This firmware is not created or supported by the creator of this keyboard!__ + +## Building the firmware +To build the firmware a few things have to be done. +First ChibiOS has to be patched, to do this use the provided script in the keyboard folder. +``` +$ ./apply_patch.sh +``` +After this build the Anne Pro firmware from the main folder. +``` +$ make anne_pro +``` +This produces a file `anne_pro_default.bin` in the main folder. To covert this to a DFU file use the script provided. +``` +./dfu-convert.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu +``` + +## Flashing the firmware +First find the correct device to flash. +``` +$ dfu-util -l +... +Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=2, name="@BluetoothFlash /0x1c000000/14*256 a,192*256 g", serial="017D37663036" +Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=1, name="@Internal Flash /0x0c000000/64*256 a,192*256 g", serial="017D37663036" +Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=0, name="@Internal Flash /0x08000000/64*256 a,192*256 g", serial="017D37663036" +... +``` +Then flash the firmware. +``` +$ dfu-util --alt 0 --intf 0 --download anne_pro_default.dfu +``` diff --git a/util/dfu-convert.py b/util/dfu-convert.py new file mode 100755 index 00000000000..2022e417933 --- /dev/null +++ b/util/dfu-convert.py @@ -0,0 +1,127 @@ +#!/usr/bin/env python2 + +# Written by Antonio Galea - 2010/11/18 +# Distributed under Gnu LGPL 3.0 +# see http://www.gnu.org/licenses/lgpl-3.0.txt +# +# Removed ihex functionality and dependency, Bitcraze - 2014-12-11 + +import sys,struct,zlib,os +from optparse import OptionParser + +DEFAULT_DEVICE="0x0483:0xdf11" + +def named(tuple,names): + return dict(zip(names.split(),tuple)) +def consume(fmt,data,names): + n = struct.calcsize(fmt) + return named(struct.unpack(fmt,data[:n]),names),data[n:] +def cstring(string): + return string.split('\0',1)[0] +def compute_crc(data): + return 0xFFFFFFFF & -zlib.crc32(data) -1 + +def parse(file,dump_images=False): + print 'File: "%s"' % file + data = open(file,'rb').read() + crc = compute_crc(data[:-4]) + prefix, data = consume('<5sBIB',data,'signature version size targets') + print '%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d' % prefix + for t in range(prefix['targets']): + tprefix, data = consume('<6sBI255s2I',data,'signature altsetting named name size elements') + tprefix['num'] = t + if tprefix['named']: + tprefix['name'] = cstring(tprefix['name']) + else: + tprefix['name'] = '' + print '%(signature)s %(num)d, alt setting: %(altsetting)s, name: "%(name)s", size: %(size)d, elements: %(elements)d' % tprefix + tsize = tprefix['size'] + target, data = data[:tsize], data[tsize:] + for e in range(tprefix['elements']): + eprefix, target = consume('<2I',target,'address size') + eprefix['num'] = e + print ' %(num)d, address: 0x%(address)08x, size: %(size)d' % eprefix + esize = eprefix['size'] + image, target = target[:esize], target[esize:] + if dump_images: + out = '%s.target%d.image%d.bin' % (file,t,e) + open(out,'wb').write(image) + print ' DUMPED IMAGE TO "%s"' % out + if len(target): + print "target %d: PARSE ERROR" % t + suffix = named(struct.unpack('<4H3sBI',data[:16]),'device product vendor dfu ufd len crc') + print 'usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix + if crc != suffix['crc']: + print "CRC ERROR: computed crc32 is 0x%08x" % crc + data = data[16:] + if data: + print "PARSE ERROR" + +def build(file,targets,device=DEFAULT_DEVICE): + data = '' + for t,target in enumerate(targets): + tdata = '' + for image in target: + tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data'] + tdata = struct.pack('<6sBI255s2I','Target',0,1,'ST...',len(tdata),len(target)) + tdata + data += tdata + data = struct.pack('<5sBIB','DfuSe',1,len(data)+11,len(targets)) + data + v,d=map(lambda x: int(x,0) & 0xFFFF, device.split(':',1)) + data += struct.pack('<4H3sB',0,d,v,0x011a,'UFD',16) + crc = compute_crc(data) + data += struct.pack(' Date: Mon, 24 Jun 2019 18:59:31 +0200 Subject: [PATCH 08/68] Fix README and add to gitignore --- .gitignore | 4 ++++ keyboards/anne_pro/README.md | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 20e706a2b59..21cfbca00c3 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,10 @@ .clang_complete .build/ *.elf +*.hex +*.qmk +!util/bootloader.hex +!quantum/tools/eeprom_reset.hex *.log *.lss *.lst diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index daa36be6c59..66d42022be1 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -15,7 +15,7 @@ $ make anne_pro ``` This produces a file `anne_pro_default.bin` in the main folder. To covert this to a DFU file use the script provided. ``` -./dfu-convert.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu +./util/dfu-convert.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu ``` ## Flashing the firmware From 1f0a8052430f284bf4e330e6c97aa50711066406 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 22:16:38 +0200 Subject: [PATCH 09/68] Flash without converting file to DFU --- keyboards/anne_pro/README.md | 9 +-- util/dfu-convert.py | 127 ----------------------------------- 2 files changed, 3 insertions(+), 133 deletions(-) delete mode 100755 util/dfu-convert.py diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 66d42022be1..42e84160e9c 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -13,10 +13,7 @@ After this build the Anne Pro firmware from the main folder. ``` $ make anne_pro ``` -This produces a file `anne_pro_default.bin` in the main folder. To covert this to a DFU file use the script provided. -``` -./util/dfu-convert.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu -``` +This produces a file `anne_pro_default.bin` in the main folder. ## Flashing the firmware First find the correct device to flash. @@ -28,7 +25,7 @@ Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=1, Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=0, name="@Internal Flash /0x08000000/64*256 a,192*256 g", serial="017D37663036" ... ``` -Then flash the firmware. +Use the device with `Internal Flash 0x08000000` and specify the interface and alt. To flash use the following command. ``` -$ dfu-util --alt 0 --intf 0 --download anne_pro_default.dfu +$ dfu-util --alt 0 --intf 0 --dfuse-address 0x08004000 --download anne_pro_default.bin ``` diff --git a/util/dfu-convert.py b/util/dfu-convert.py deleted file mode 100755 index 2022e417933..00000000000 --- a/util/dfu-convert.py +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env python2 - -# Written by Antonio Galea - 2010/11/18 -# Distributed under Gnu LGPL 3.0 -# see http://www.gnu.org/licenses/lgpl-3.0.txt -# -# Removed ihex functionality and dependency, Bitcraze - 2014-12-11 - -import sys,struct,zlib,os -from optparse import OptionParser - -DEFAULT_DEVICE="0x0483:0xdf11" - -def named(tuple,names): - return dict(zip(names.split(),tuple)) -def consume(fmt,data,names): - n = struct.calcsize(fmt) - return named(struct.unpack(fmt,data[:n]),names),data[n:] -def cstring(string): - return string.split('\0',1)[0] -def compute_crc(data): - return 0xFFFFFFFF & -zlib.crc32(data) -1 - -def parse(file,dump_images=False): - print 'File: "%s"' % file - data = open(file,'rb').read() - crc = compute_crc(data[:-4]) - prefix, data = consume('<5sBIB',data,'signature version size targets') - print '%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d' % prefix - for t in range(prefix['targets']): - tprefix, data = consume('<6sBI255s2I',data,'signature altsetting named name size elements') - tprefix['num'] = t - if tprefix['named']: - tprefix['name'] = cstring(tprefix['name']) - else: - tprefix['name'] = '' - print '%(signature)s %(num)d, alt setting: %(altsetting)s, name: "%(name)s", size: %(size)d, elements: %(elements)d' % tprefix - tsize = tprefix['size'] - target, data = data[:tsize], data[tsize:] - for e in range(tprefix['elements']): - eprefix, target = consume('<2I',target,'address size') - eprefix['num'] = e - print ' %(num)d, address: 0x%(address)08x, size: %(size)d' % eprefix - esize = eprefix['size'] - image, target = target[:esize], target[esize:] - if dump_images: - out = '%s.target%d.image%d.bin' % (file,t,e) - open(out,'wb').write(image) - print ' DUMPED IMAGE TO "%s"' % out - if len(target): - print "target %d: PARSE ERROR" % t - suffix = named(struct.unpack('<4H3sBI',data[:16]),'device product vendor dfu ufd len crc') - print 'usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix - if crc != suffix['crc']: - print "CRC ERROR: computed crc32 is 0x%08x" % crc - data = data[16:] - if data: - print "PARSE ERROR" - -def build(file,targets,device=DEFAULT_DEVICE): - data = '' - for t,target in enumerate(targets): - tdata = '' - for image in target: - tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data'] - tdata = struct.pack('<6sBI255s2I','Target',0,1,'ST...',len(tdata),len(target)) + tdata - data += tdata - data = struct.pack('<5sBIB','DfuSe',1,len(data)+11,len(targets)) + data - v,d=map(lambda x: int(x,0) & 0xFFFF, device.split(':',1)) - data += struct.pack('<4H3sB',0,d,v,0x011a,'UFD',16) - crc = compute_crc(data) - data += struct.pack(' Date: Mon, 24 Jun 2019 22:20:30 +0200 Subject: [PATCH 10/68] Remove excess callbacks for LED UART --- keyboards/anne_pro/anne_pro.c | 50 ++++------------------------------- 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 84a912743d4..bae1bebd660 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -18,52 +18,12 @@ #include "ch.h" #include "hal.h" -/* - * This callback is invoked when a transmission buffer has been completely - * read by the driver. - */ -static void txend1(UARTDriver *uartp) { - (void)uartp; -} - -/* - * This callback is invoked when a transmission has physically completed. - */ -static void txend2(UARTDriver *uartp) { - (void)uartp; -} - -/* - * This callback is invoked on a receive error, the errors mask is passed - * as parameter. - */ -static void rxerr(UARTDriver *uartp, uartflags_t e) { - (void)uartp; - (void)e; -} - -/* - * This callback is invoked when a character is received but the application - * was not ready to receive it, the character is passed as parameter. - */ -static void rxchar(UARTDriver *uartp, uint16_t c) { - (void)uartp; - (void)c; -} - -/* - * This callback is invoked when a receive buffer has been completely written. - */ -static void rxend(UARTDriver *uartp) { - (void)uartp; -} - static UARTConfig uart_cfg = { - .txend1_cb = txend1, - .txend2_cb = txend2, - .rxend_cb = rxend, - .rxchar_cb = rxchar, - .rxerr_cb = rxerr, + .txend1_cb = NULL, + .txend2_cb = NULL, + .rxend_cb = NULL, + .rxchar_cb = NULL, + .rxerr_cb = NULL, .speed = 38400, .cr1 = 0, .cr2 = USART_CR2_LINEN, From 968d55a784fd85fcf9375d6d94203510325adab6 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 22:21:44 +0200 Subject: [PATCH 11/68] Move LED code from keymap to keyboard file --- keyboards/anne_pro/anne_pro.c | 46 ++++++++++++++-- keyboards/anne_pro/anne_pro.h | 8 +++ keyboards/anne_pro/keymaps/default/keymap.c | 59 +++------------------ 3 files changed, 56 insertions(+), 57 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index bae1bebd660..8be52a32edf 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -30,15 +30,53 @@ static UARTConfig uart_cfg = { .cr3 = 0 }; -extern volatile bool leds_enabled; +/* State of the leds on the keyboard */ +volatile bool leds_enabled = false; -void matrix_init_kb(void) { +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case APL_RGB: + /* Toggle the RGB enabled/disabled */ + if (record->event.pressed) { + leds_enabled = !leds_enabled; + if (leds_enabled) { + uartStartSend(&UARTD3, 3, "\x09\x01\x01"); + } else { + uartStartSend(&UARTD3, 4, "\x09\x02\x01\x00"); + } + } + return false; + case APL_RAT: + /* Change the animation rate */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x01\x00"); + } + return false; + case APL_BRT: + /* Change the brightness */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x00\x01"); + } + return false; + case APL_MOD: + /* Change the lighting mode */ + if (leds_enabled && record->event.pressed) { + uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); + } + return false; + default: + /* Handle other keycodes normally */ + return true; + } +} + +void keyboard_post_init_kb(void) { /* Turn on lighting controller */ setPinOutput(C15); writePinLow(C15); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(10); writePinHigh(C15); - chThdSleepMilliseconds(100); + chThdSleepMilliseconds(10); /* Initialize the lighting UART */ uartStart(&UARTD3, &uart_cfg); diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 5557e58ecae..4d3c75bd7e1 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -17,6 +17,14 @@ #pragma once #include "quantum.h" +/* Custom keycodes for the lighting control for the Anne Pro */ +enum anne_pro_keycodes { + APL_RGB = SAFE_RANGE, + APL_RAT, + APL_BRT, + APL_MOD +}; + /* The fully-featured LAYOUT() that has every single key available in the matrix. */ #define LAYOUT(\ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index 54b97f81ef3..2939aec5194 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -16,13 +16,6 @@ #include QMK_KEYBOARD_H -/* Custom keycodes for the lighting control for the Anne Pro */ -enum my_keycodes { - ANNERGB = SAFE_RANGE, - ANNERAT, - ANNEBRT, - ANNEMOD -}; /* Default Anne Pro layout, macOS style with LALT and LWIN switched */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { @@ -31,53 +24,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), KC_NO, KC_RCTL + KC_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), XXXXXXX, KC_RCTL ), [1] = LAYOUT( - KC_GRV, 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_UP, _______, ANNERGB, ANNERAT, ANNEBRT, ANNEMOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, - _______, KC_LEFT, KC_DOWN, KC_RGHT, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, _______, - _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_INS, KC_DEL, _______, - _______, _______, _______, _______, _______, _______, _______, _______ + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ) }; - -/* State of the leds on the keyboard */ -volatile bool leds_enabled = false; - -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - switch (keycode) { - case ANNERGB: - /* Toggle the RGB enabled/disabled */ - if (record->event.pressed) { - leds_enabled = !leds_enabled; - if (leds_enabled) { - uartStartSend(&UARTD3, 3, "\x09\x01\x01"); - } else { - uartStartSend(&UARTD3, 4, "\x09\x02\x01\x00"); - } - } - return false; - case ANNERAT: - /* Change the animation rate */ - if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x01\x00"); - } - return false; - case ANNEBRT: - /* Change the brightness */ - if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x00\x01"); - } - return false; - case ANNEMOD: - /* Change the lighting mode */ - if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); - } - return false; - default: - /* Handle other keycodes normally */ - return true; - } -} From 38aa1f44c8dd29f6ef7e1928c77d5966c087d8df Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 22:22:10 +0200 Subject: [PATCH 12/68] Disable mousekey for now, as it makes scrollbars appear on macOS --- keyboards/anne_pro/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 1148a1a5e15..2948e55916b 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -26,7 +26,7 @@ ARMV = 7 BACKLIGHT_ENABLE = no BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration ## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) -MOUSEKEY_ENABLE = yes # Mouse keys +MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control CONSOLE_ENABLE = no # Console for debug COMMAND_ENABLE = no # Commands for debug and configuration From ab12e84003020f5c6380c84bdd259fd7f9e429ce Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 23:10:22 +0200 Subject: [PATCH 13/68] Allow reset to DFU without pressing the reset button --- keyboards/anne_pro/anne_pro.c | 8 ++++++++ keyboards/anne_pro/anne_pro.h | 3 ++- keyboards/anne_pro/keymaps/default/keymap.c | 9 ++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 8be52a32edf..03be92176ff 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -64,6 +64,14 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); } return false; + case AP_RST: + /* Reset the keyboard, enter DFU when ESC is pressed */ + __disable_irq(); + SCB->VTOR = 0x08000000; + NVIC_SystemReset(); + /* This should not be reached */ + while(1); + return false; default: /* Handle other keycodes normally */ return true; diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 4d3c75bd7e1..066cc577e81 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -22,7 +22,8 @@ enum anne_pro_keycodes { APL_RGB = SAFE_RANGE, APL_RAT, APL_BRT, - APL_MOD + APL_MOD, + AP_RST }; /* The fully-featured LAYOUT() that has every single key available in the matrix. */ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index 2939aec5194..bc36330cd80 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -24,7 +24,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), XXXXXXX, KC_RCTL + KC_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), MO(2), KC_RCTL ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, @@ -32,5 +32,12 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [2] = LAYOUT( + AP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ) }; From 31a12e1c36265ba049a40b04c6127a39b90ede41 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 23:24:24 +0200 Subject: [PATCH 14/68] Use built-in function to do bootloader reset --- keyboards/anne_pro/anne_pro.c | 18 ++++++++++-------- keyboards/anne_pro/anne_pro.h | 3 +-- keyboards/anne_pro/keymaps/default/keymap.c | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 03be92176ff..3f9851a75aa 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -64,14 +64,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); } return false; - case AP_RST: - /* Reset the keyboard, enter DFU when ESC is pressed */ - __disable_irq(); - SCB->VTOR = 0x08000000; - NVIC_SystemReset(); - /* This should not be reached */ - while(1); - return false; default: /* Handle other keycodes normally */ return true; @@ -97,3 +89,13 @@ void keyboard_post_init_kb(void) { matrix_init_user(); } + +/* Instead of doing some magic to get to the bootloader, just press ESC and reset */ +void bootloader_jump(void) { + /* Disable interrupts as changing the vector table can mess them up */ + __disable_irq(); + /* Move the vector table back to the bootloader */ + SCB->VTOR = 0x08000000; + /* Reset the system into the bootloader */ + NVIC_SystemReset(); +} diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 066cc577e81..4d3c75bd7e1 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -22,8 +22,7 @@ enum anne_pro_keycodes { APL_RGB = SAFE_RANGE, APL_RAT, APL_BRT, - APL_MOD, - AP_RST + APL_MOD }; /* The fully-featured LAYOUT() that has every single key available in the matrix. */ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index bc36330cd80..37cce3d48bc 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -34,7 +34,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - AP_RST, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, From cb8379d304ac65ac171392d727b5030e146203cc Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 23:47:00 +0200 Subject: [PATCH 15/68] Small comments and changes --- keyboards/anne_pro/anne_pro.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 3f9851a75aa..1881907ef03 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -33,6 +33,7 @@ static UARTConfig uart_cfg = { /* State of the leds on the keyboard */ volatile bool leds_enabled = false; +/* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { switch (keycode) { case APL_RGB: @@ -66,10 +67,11 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { return false; default: /* Handle other keycodes normally */ - return true; + return process_record_user(keycode, record); } } +/* Initialize custom keyboard features */ void keyboard_post_init_kb(void) { /* Turn on lighting controller */ setPinOutput(C15); @@ -85,7 +87,7 @@ void keyboard_post_init_kb(void) { /* Send 'set theme' command to lighting controller */ leds_enabled = true; - uartStartSend(&UARTD3, 4, "\x09\x01\x01"); + uartStartSend(&UARTD3, 3, "\x09\x01\x01"); matrix_init_user(); } From 67b86e87ca329d8390790ed45ed7435a3b619272 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 24 Jun 2019 23:47:16 +0200 Subject: [PATCH 16/68] Even simpler jump to bootloader --- keyboards/anne_pro/anne_pro.c | 10 ---------- keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h | 3 +++ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 1881907ef03..daa6fcba257 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -91,13 +91,3 @@ void keyboard_post_init_kb(void) { matrix_init_user(); } - -/* Instead of doing some magic to get to the bootloader, just press ESC and reset */ -void bootloader_jump(void) { - /* Disable interrupts as changing the vector table can mess them up */ - __disable_irq(); - /* Move the vector table back to the bootloader */ - SCB->VTOR = 0x08000000; - /* Reset the system into the bootloader */ - NVIC_SystemReset(); -} diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h index 31151209982..d15eab57ad4 100644 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h @@ -32,6 +32,9 @@ #define BOARD_STM32L151_ANNE_PRO #define BOARD_NAME "STM32L151 Anne Pro" +/* Address of the bootloader */ +#define STM32_BOOTLOADER_ADDRESS 0x08000000 + /* * Board oscillators-related settings. * NOTE: HSE not fitted. From 9b964d3f5a3a378ee861fd1543ee23151a42ea8e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 25 Jun 2019 20:56:53 +0200 Subject: [PATCH 17/68] Update README and apply dfu-util parameters --- keyboards/anne_pro/README.md | 46 ++++++++++++++++-------------------- keyboards/anne_pro/rules.mk | 3 +++ 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 42e84160e9c..3a4998ba624 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -1,31 +1,25 @@ # Anne Pro -QMK firmware port for the Obins Anne Pro 60% keyboard. + +![Anne Pro](https://i.imgur.com/wF7mz7u.jpg) + +QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.obins.net). __This firmware is not created or supported by the creator of this keyboard!__ -## Building the firmware -To build the firmware a few things have to be done. -First ChibiOS has to be patched, to do this use the provided script in the keyboard folder. -``` -$ ./apply_patch.sh -``` -After this build the Anne Pro firmware from the main folder. -``` -$ make anne_pro -``` -This produces a file `anne_pro_default.bin` in the main folder. +Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) +Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) +Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) -## Flashing the firmware -First find the correct device to flash. -``` -$ dfu-util -l -... -Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=2, name="@BluetoothFlash /0x1c000000/14*256 a,192*256 g", serial="017D37663036" -Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=1, name="@Internal Flash /0x0c000000/64*256 a,192*256 g", serial="017D37663036" -Found DFU: [0483:df11] ver=0200, devnum=30, cfg=1, intf=0, path="20-1.1", alt=0, name="@Internal Flash /0x08000000/64*256 a,192*256 g", serial="017D37663036" -... -``` -Use the device with `Internal Flash 0x08000000` and specify the interface and alt. To flash use the following command. -``` -$ dfu-util --alt 0 --intf 0 --dfuse-address 0x08004000 --download anne_pro_default.bin -``` +Before building the firmware for this keyboard a patch has to be applied: + + ./keyboards/anne_pro/apply_patch.sh + +Make example for this keyboard (after setting up your build environment): + + make anne_pro:default + +Flashing the firmware can easily be done when the keyboard is in DFU mode: + + make anne_pro:default:dfu-util + +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). diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 2948e55916b..3307fa0dc7a 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -20,6 +20,9 @@ MCU = cortex-m3 # ARM version, CORTEX-M0/M1 are 6, CORTEX-M3/M4/M7 are 7 ARMV = 7 +# Extra arguments for dfu-util to flash to the correct location +DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 + # Build Options # comment out to disable the options. # From 73dd038347be5280d2cbe83b63c4c5da43a9742b Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 26 Jun 2019 09:07:44 +0200 Subject: [PATCH 18/68] Update USB id to match the original of the Anne Pro --- keyboards/anne_pro/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 9a36c9b13a1..a7cff9a8730 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -20,7 +20,7 @@ /* USB Device descriptor parameter */ #define VENDOR_ID 0x0483 -#define PRODUCT_ID 0xdf11 +#define PRODUCT_ID 0x5710 #define DEVICE_VER 0x0200 #define MANUFACTURER QMK From 51e0148da01df6f40ead2a4a4417fff699059a71 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 26 Jun 2019 09:30:12 +0200 Subject: [PATCH 19/68] Make sure the patch is commited exactly as line-endings matter --- keyboards/anne_pro/.gitattributes | 1 + keyboards/anne_pro/chibios_stm32l151.patch | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) create mode 100644 keyboards/anne_pro/.gitattributes diff --git a/keyboards/anne_pro/.gitattributes b/keyboards/anne_pro/.gitattributes new file mode 100644 index 00000000000..f268b0b497b --- /dev/null +++ b/keyboards/anne_pro/.gitattributes @@ -0,0 +1 @@ +chibios_stm32l151.patch binary diff --git a/keyboards/anne_pro/chibios_stm32l151.patch b/keyboards/anne_pro/chibios_stm32l151.patch index 76fedda343f..295b77e845c 100644 --- a/keyboards/anne_pro/chibios_stm32l151.patch +++ b/keyboards/anne_pro/chibios_stm32l151.patch @@ -3,13 +3,13 @@ index e2c2344af..dcf6f83bc 100644 --- a/os/hal/ports/STM32/STM32L1xx/platform.mk +++ b/os/hal/ports/STM32/STM32L1xx/platform.mk @@ -17,8 +17,8 @@ ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),) - PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c - endif - else -- $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c --PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c -+PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c \ -+ $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c - endif - - # Drivers compatible with the platform. + PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c + endif + else +- $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c +-PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c ++PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c \ ++ $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c + endif + + # Drivers compatible with the platform. From 2995daadfbb37d87492da6cf00ea93216f12c3ef Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 26 Jun 2019 09:33:10 +0200 Subject: [PATCH 20/68] Change README to show git submodule init --- keyboards/anne_pro/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 3a4998ba624..4b97c4594e6 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -10,8 +10,9 @@ Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) -Before building the firmware for this keyboard a patch has to be applied: +Before building the firmware for this keyboard submodules have to be loaded and a patch has to be applied: + make git-submodule ./keyboards/anne_pro/apply_patch.sh Make example for this keyboard (after setting up your build environment): From b345c782bd34b85cdf2451bc5476fd390aa19f5e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 26 Jun 2019 21:45:57 +0200 Subject: [PATCH 21/68] Add script for packing bin into dfu --- keyboards/anne_pro/README.md | 4 + keyboards/anne_pro/dfuse-pack.py | 220 +++++++++++++++++++++++++++++++ 2 files changed, 224 insertions(+) create mode 100755 keyboards/anne_pro/dfuse-pack.py diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 4b97c4594e6..9d91e905a48 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -23,4 +23,8 @@ Flashing the firmware can easily be done when the keyboard is in DFU mode: make anne_pro:default:dfu-util +To convert the `bin` file to a `dfu` file the following script can be used + + ./keyboards/anne_pro/dfuse-pack.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu + 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). diff --git a/keyboards/anne_pro/dfuse-pack.py b/keyboards/anne_pro/dfuse-pack.py new file mode 100755 index 00000000000..199ac70f148 --- /dev/null +++ b/keyboards/anne_pro/dfuse-pack.py @@ -0,0 +1,220 @@ +#!/usr/bin/python + +# Written by Antonio Galea - 2010/11/18 +# Distributed under Gnu LGPL 3.0 +# see http://www.gnu.org/licenses/lgpl-3.0.txt +# retrieved from https://github.com/kiibohd/dfu-util + +import sys,struct,zlib,os +import binascii +from optparse import OptionParser + +try: + from intelhex import IntelHex +except ImportError: + IntelHex = None + +DEFAULT_DEVICE="0x0483:0xdf11" +DEFAULT_NAME=b'ST...' + +def named(tuple,names): + return dict(list(zip(names.split(),tuple))) +def consume(fmt,data,names): + n = struct.calcsize(fmt) + return named(struct.unpack(fmt,data[:n]),names),data[n:] +def cstring(bytestring): + return bytestring.partition(b'\0')[0] +def compute_crc(data): + return 0xFFFFFFFF & -zlib.crc32(data) -1 + +def parse(file,dump_images=False): + print('File: "%s"' % file) + data = open(file,'rb').read() + crc = compute_crc(data[:-4]) + prefix, data = consume('<5sBIB',data,'signature version size targets') + print('%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d' % prefix) + for t in range(prefix['targets']): + tprefix, data = consume('<6sBI255s2I',data,'signature altsetting named name size elements') + tprefix['num'] = t + if tprefix['named']: + tprefix['name'] = cstring(tprefix['name']) + else: + tprefix['name'] = '' + print('%(signature)s %(num)d, alt setting: %(altsetting)s, name: "%(name)s", size: %(size)d, elements: %(elements)d' % tprefix) + tsize = tprefix['size'] + target, data = data[:tsize], data[tsize:] + for e in range(tprefix['elements']): + eprefix, target = consume('<2I',target,'address size') + eprefix['num'] = e + print(' %(num)d, address: 0x%(address)08x, size: %(size)d' % eprefix) + esize = eprefix['size'] + image, target = target[:esize], target[esize:] + if dump_images: + out = '%s.target%d.image%d.bin' % (file,t,e) + open(out,'wb').write(image) + print(' DUMPED IMAGE TO "%s"' % out) + if len(target): + print("target %d: PARSE ERROR" % t) + suffix = named(struct.unpack('<4H3sBI',data[:16]),'device product vendor dfu ufd len crc') + print('usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix) + if crc != suffix['crc']: + print("CRC ERROR: computed crc32 is 0x%08x" % crc) + data = data[16:] + if data: + print("PARSE ERROR") + +def checkbin(binfile): + data = open(binfile,'rb').read() + if (len(data) < 16): + return + crc = compute_crc(data[:-4]) + suffix = named(struct.unpack('<4H3sBI',data[-16:]),'device product vendor dfu ufd len crc') + if crc == suffix['crc'] and suffix['ufd'] == b'UFD': + print('usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix) + print("It looks like the file %s has a DFU suffix!" % binfile) + print("Please remove any DFU suffix and retry.") + sys.exit(1) + +def build(file,targets,name=DEFAULT_NAME,device=DEFAULT_DEVICE): + data = b'' + for t,target in enumerate(targets): + tdata = b'' + for image in target: + tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data'] + tdata = struct.pack('<6sBI255s2I',b'Target',0,1,name,len(tdata),len(target)) + tdata + data += tdata + data = struct.pack('<5sBIB',b'DfuSe',1,len(data)+11,len(targets)) + data + v,d=[int(x,0) & 0xFFFF for x in device.split(':',1)] + data += struct.pack('<4H3sB',0,d,v,0x011a,b'UFD',16) + crc = compute_crc(data) + data += struct.pack(' Date: Wed, 26 Jun 2019 22:21:46 +0200 Subject: [PATCH 22/68] Add matrix scan code for reactive ligthing modes --- keyboards/anne_pro/anne_pro.c | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index daa6fcba257..ee087b6bcd1 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -91,3 +91,45 @@ void keyboard_post_init_kb(void) { matrix_init_user(); } + +/* Current state of the matrix */ +static matrix_row_t matrix_status[MATRIX_ROWS]; +/* Buffer for the keystate packet */ +static uint8_t keystate[12] = {9, 10, 7, 0}; + +/* Update the reactive lighting on every keymatrix scan when lighting is enabled */ +void matrix_scan_kb(void) { + matrix_row_t matrix_row = 0; + matrix_row_t matrix_change = 0; + + /* Determine if the matrix state has changed, and update the state */ + for (uint8_t r = 0; r < MATRIX_ROWS; r++) { + matrix_row = matrix_get_row(r); + matrix_change |= matrix_row ^ matrix_status[r]; + matrix_status[r] = matrix_row; + } + + /* If the leds are enabled and the state changed */ + if (leds_enabled && matrix_change) { + /* Go through every scan position */ + for (uint8_t r = 0; r < MATRIX_ROWS; r++) { + for (uint8_t c = 0; c < MATRIX_COLS; c++) { + int position = r * MATRIX_COLS + c; + int index = position / 8; + int bit = position % 8; + + /* Update the keystate based on the state of the matrix */ + if (matrix_status[r] & (1 << c)) { + keystate[3 + index] |= (1 << bit); + } else { + keystate[3 + index] &= ~(1 << bit); + } + } + } + /* Send the keystate to the LED controller */ + uartStartSend(&UARTD3, 12, keystate); + } + + /* Run matrix_scan_user code */ + matrix_scan_user(); +} From d315d7f264d7c148e44e097711fdb1cecec61e6a Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 10 Jul 2019 13:20:04 +0200 Subject: [PATCH 23/68] Refactor LED UART code --- keyboards/anne_pro/anne_pro.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index ee087b6bcd1..fbb698e9929 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -18,7 +18,8 @@ #include "ch.h" #include "hal.h" -static UARTConfig uart_cfg = { +static UARTDriver *LED_UART = &UARTD3; +static UARTConfig led_uart_cfg = { .txend1_cb = NULL, .txend2_cb = NULL, .rxend_cb = NULL, @@ -41,28 +42,28 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { leds_enabled = !leds_enabled; if (leds_enabled) { - uartStartSend(&UARTD3, 3, "\x09\x01\x01"); + uartStartSend(LED_UART, 3, "\x09\x01\x01"); } else { - uartStartSend(&UARTD3, 4, "\x09\x02\x01\x00"); + uartStartSend(LED_UART, 4, "\x09\x02\x01\x00"); } } return false; case APL_RAT: /* Change the animation rate */ if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x01\x00"); + uartStartSend(LED_UART, 6, "\x09\x04\x05\x00\x01\x00"); } return false; case APL_BRT: /* Change the brightness */ if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x00\x00\x01"); + uartStartSend(LED_UART, 6, "\x09\x04\x05\x00\x00\x01"); } return false; case APL_MOD: /* Change the lighting mode */ if (leds_enabled && record->event.pressed) { - uartStartSend(&UARTD3, 6, "\x09\x04\x05\x01\x00\x00"); + uartStartSend(LED_UART, 6, "\x09\x04\x05\x01\x00\x00"); } return false; default: @@ -81,13 +82,13 @@ void keyboard_post_init_kb(void) { chThdSleepMilliseconds(10); /* Initialize the lighting UART */ - uartStart(&UARTD3, &uart_cfg); + uartStart(LED_UART, &led_uart_cfg); palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); /* Send 'set theme' command to lighting controller */ leds_enabled = true; - uartStartSend(&UARTD3, 3, "\x09\x01\x01"); + uartStartSend(LED_UART, 3, "\x09\x01\x01"); matrix_init_user(); } @@ -127,7 +128,7 @@ void matrix_scan_kb(void) { } } /* Send the keystate to the LED controller */ - uartStartSend(&UARTD3, 12, keystate); + uartStartSend(LED_UART, 12, keystate); } /* Run matrix_scan_user code */ From 9a2e490f00d4cea8679b4fdc866cca61ac32ef9e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 10 Jul 2019 13:41:57 +0200 Subject: [PATCH 24/68] Simplify the sending of LED update events --- keyboards/anne_pro/anne_pro.c | 67 +++++++++++++---------------------- 1 file changed, 24 insertions(+), 43 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index fbb698e9929..aedfbae724c 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -34,8 +34,31 @@ static UARTConfig led_uart_cfg = { /* State of the leds on the keyboard */ volatile bool leds_enabled = false; +/* Buffer for the keystate packet */ +static uint8_t keystate[12] = {9, 10, 7, 0}; + /* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + /* Only update dynamic lighting modes when leds are enabled */ + if (leds_enabled) { + /* Calculate the position of the key that was pressed */ + uint8_t row = record->event.key.row; + uint8_t col = record->event.key.col; + int position = row * MATRIX_COLS + col; + int index = position / 8; + int bit = position % 8; + + /* Update the keystate based on the location */ + if (record->event.pressed) { + keystate[3 + index] |= (1 << bit); + } else { + keystate[3 + index] &= ~(1 << bit); + } + + /* Send the keystate to the LED controller */ + uartStartSend(LED_UART, 12, keystate); + } + switch (keycode) { case APL_RGB: /* Toggle the RGB enabled/disabled */ @@ -88,49 +111,7 @@ void keyboard_post_init_kb(void) { /* Send 'set theme' command to lighting controller */ leds_enabled = true; - uartStartSend(LED_UART, 3, "\x09\x01\x01"); + uartStartSend(LED_UART, 4, "\x09\x02\x01\x01"); matrix_init_user(); } - -/* Current state of the matrix */ -static matrix_row_t matrix_status[MATRIX_ROWS]; -/* Buffer for the keystate packet */ -static uint8_t keystate[12] = {9, 10, 7, 0}; - -/* Update the reactive lighting on every keymatrix scan when lighting is enabled */ -void matrix_scan_kb(void) { - matrix_row_t matrix_row = 0; - matrix_row_t matrix_change = 0; - - /* Determine if the matrix state has changed, and update the state */ - for (uint8_t r = 0; r < MATRIX_ROWS; r++) { - matrix_row = matrix_get_row(r); - matrix_change |= matrix_row ^ matrix_status[r]; - matrix_status[r] = matrix_row; - } - - /* If the leds are enabled and the state changed */ - if (leds_enabled && matrix_change) { - /* Go through every scan position */ - for (uint8_t r = 0; r < MATRIX_ROWS; r++) { - for (uint8_t c = 0; c < MATRIX_COLS; c++) { - int position = r * MATRIX_COLS + c; - int index = position / 8; - int bit = position % 8; - - /* Update the keystate based on the state of the matrix */ - if (matrix_status[r] & (1 << c)) { - keystate[3 + index] |= (1 << bit); - } else { - keystate[3 + index] &= ~(1 << bit); - } - } - } - /* Send the keystate to the LED controller */ - uartStartSend(LED_UART, 12, keystate); - } - - /* Run matrix_scan_user code */ - matrix_scan_user(); -} From 590de9d85744893c40c43c74ae3b252e1927a7fe Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 10 Jul 2019 17:45:36 +0200 Subject: [PATCH 25/68] Cleanup lighting code and add ringbuffer to the LED tx UART --- keyboards/anne_pro/anne_pro.c | 74 +++++++++++++++---- keyboards/anne_pro/uart_tx_ringbuf.h | 102 +++++++++++++++++++++++++++ 2 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 keyboards/anne_pro/uart_tx_ringbuf.h diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index aedfbae724c..5adacd183bb 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -15,12 +15,37 @@ */ #include "anne_pro.h" +#include "uart_tx_ringbuf.h" #include "ch.h" #include "hal.h" -static UARTDriver *LED_UART = &UARTD3; +#define LED_UART (&UARTD3) +/* UART transmission ringbuffer for the LED UART */ +static uint8_t led_uart_tx_buffer[256] = {0}; +static uart_tx_ringbuf_t led_uart_ringbuf = { + .buf = led_uart_tx_buffer, + .uart = LED_UART, + .size = sizeof(led_uart_tx_buffer), + .sending_elements = 0, + .head = 0, + .tail = 0, +}; + +/* Should the main loop try a transmission, used when transmission finishes + to send any data that might have been added to the buffer while the + transmission was in progress. +*/ +static volatile bool led_uart_try_transmission = false; + +/* Handler for finsihed LED UART transmissions */ +static void led_uart_txend(UARTDriver *uart) { + uart_tx_ringbuf_finish_transmission(&led_uart_ringbuf); + led_uart_try_transmission = true; +} + +/* LED UART configuration */ static UARTConfig led_uart_cfg = { - .txend1_cb = NULL, + .txend1_cb = led_uart_txend, .txend2_cb = NULL, .rxend_cb = NULL, .rxchar_cb = NULL, @@ -32,13 +57,13 @@ static UARTConfig led_uart_cfg = { }; /* State of the leds on the keyboard */ -volatile bool leds_enabled = false; +static volatile bool leds_enabled = false; /* Buffer for the keystate packet */ static uint8_t keystate[12] = {9, 10, 7, 0}; -/* Process the Anne Pro custom keycodes */ -bool process_record_kb(uint16_t keycode, keyrecord_t *record) { +/* Update the dynamic lighting packet based on a keypress */ +void update_dynamic_lighting(keyrecord_t *record) { /* Only update dynamic lighting modes when leds are enabled */ if (leds_enabled) { /* Calculate the position of the key that was pressed */ @@ -56,8 +81,13 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } /* Send the keystate to the LED controller */ - uartStartSend(LED_UART, 12, keystate); + uart_tx_ringbuf_write(&led_uart_ringbuf, 12, keystate); } +} + +/* Process the Anne Pro custom keycodes */ +bool process_record_kb(uint16_t keycode, keyrecord_t *record) { + update_dynamic_lighting(record); switch (keycode) { case APL_RGB: @@ -65,28 +95,28 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { if (record->event.pressed) { leds_enabled = !leds_enabled; if (leds_enabled) { - uartStartSend(LED_UART, 3, "\x09\x01\x01"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); } else { - uartStartSend(LED_UART, 4, "\x09\x02\x01\x00"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x00"); } } return false; case APL_RAT: /* Change the animation rate */ if (leds_enabled && record->event.pressed) { - uartStartSend(LED_UART, 6, "\x09\x04\x05\x00\x01\x00"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x01\x00"); } return false; case APL_BRT: /* Change the brightness */ if (leds_enabled && record->event.pressed) { - uartStartSend(LED_UART, 6, "\x09\x04\x05\x00\x00\x01"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x00\x01"); } return false; case APL_MOD: /* Change the lighting mode */ if (leds_enabled && record->event.pressed) { - uartStartSend(LED_UART, 6, "\x09\x04\x05\x01\x00\x00"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x01\x00\x00"); } return false; default: @@ -96,7 +126,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { } /* Initialize custom keyboard features */ -void keyboard_post_init_kb(void) { +void keyboard_pre_init_kb(void) { /* Turn on lighting controller */ setPinOutput(C15); writePinLow(C15); @@ -109,9 +139,25 @@ void keyboard_post_init_kb(void) { palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); + keyboard_pre_init_user(); +} + +/* Turn on the lighting when init is finished */ +void keyboard_post_init_kb(void) { /* Send 'set theme' command to lighting controller */ leds_enabled = true; - uartStartSend(LED_UART, 4, "\x09\x02\x01\x01"); + uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); - matrix_init_user(); + keyboard_post_init_user(); +} + +/* Start transmissions when the flag is set */ +void matrix_scan_kb(void) { + if (led_uart_try_transmission) { + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); + led_uart_try_transmission = false; + } + + /* Run matrix_scan_user code */ + matrix_scan_user(); } diff --git a/keyboards/anne_pro/uart_tx_ringbuf.h b/keyboards/anne_pro/uart_tx_ringbuf.h new file mode 100644 index 00000000000..abdb37f0d63 --- /dev/null +++ b/keyboards/anne_pro/uart_tx_ringbuf.h @@ -0,0 +1,102 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include "hal.h" + +typedef struct { + uint8_t *buf; + UARTDriver *uart; + size_t size; + volatile size_t sending_elements; + volatile size_t head; + volatile size_t tail; +} uart_tx_ringbuf_t; + +int uart_tx_ringbuf_elements(uart_tx_ringbuf_t *ringbuf) { + return ringbuf->head - ringbuf->tail; +} + +int uart_tx_ringbuf_space(uart_tx_ringbuf_t *ringbuf) { + return ringbuf->size - uart_tx_ringbuf_elements(ringbuf); +} + +bool uart_tx_ringbuf_empty(uart_tx_ringbuf_t *ringbuf) { + return uart_tx_ringbuf_elements(ringbuf) == 0; +} + +bool uart_tx_ringbuf_full(uart_tx_ringbuf_t *ringbuf) { + return uart_tx_ringbuf_elements(ringbuf) == ringbuf->size; +} + +void uart_tx_ringbuf_start_transmission(uart_tx_ringbuf_t *ringbuf) { + /* Do not start transmission when one is already in progress */ + if (ringbuf->sending_elements != 0) return; + + size_t elements = uart_tx_ringbuf_elements(ringbuf); + /* Do not start transmission when ringbuffer is empty */ + if (elements == 0) return; + + /* Get the offset of the first and last item */ + size_t first_offset = (ringbuf->tail & (ringbuf->size - 1)); + + /* Determine if this wraps around the end of the buffer */ + if (first_offset + elements >= ringbuf->size) { + /* If so only send until the end of the buffer */ + elements = ringbuf->size - first_offset; + } + + /* Send the selected elements */ + ringbuf->sending_elements = elements; + uartStartSend(ringbuf->uart, elements, ringbuf->buf + first_offset); +} + +void uart_tx_ringbuf_finish_transmission(uart_tx_ringbuf_t *ringbuf) { + /* Update the tail of the ringbuffer */ + ringbuf->tail += ringbuf->sending_elements; + /* Clear the sending elements */ + ringbuf->sending_elements = 0; +} + +bool uart_tx_ringbuf_put(uart_tx_ringbuf_t *ringbuf, uint8_t c) { + /* If the ringbuffer is full, ignore the request */ + if (uart_tx_ringbuf_full(ringbuf)) return false; + + /* Put the character into the ringbuffer */ + size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); + ringbuf->buf[head_offset] = c; + ringbuf->head++; + + /* Try to start the transmission immediately */ + uart_tx_ringbuf_start_transmission(ringbuf); + return true; +} + +bool uart_tx_ringbuf_write(uart_tx_ringbuf_t *ringbuf, size_t count, void *data) { + /* If there is not enough space, ignore the request */ + if (uart_tx_ringbuf_space(ringbuf) < count) return false; + + for (int i = 0; i < count; i++) { + /* Put the character into the ringbuffer */ + size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); + ringbuf->buf[head_offset] = ((uint8_t *) data)[i]; + ringbuf->head++; + } + + /* Try to start the transmission immediately */ + uart_tx_ringbuf_start_transmission(ringbuf); + return true; +} From b1fe38cf59259c8a27d85415a56a76f28f98350a Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 10 Jul 2019 18:10:48 +0200 Subject: [PATCH 26/68] Start with rainbow lighting effect --- keyboards/anne_pro/anne_pro.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 5adacd183bb..b116a9dcd2d 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -145,8 +145,11 @@ void keyboard_pre_init_kb(void) { /* Turn on the lighting when init is finished */ void keyboard_post_init_kb(void) { /* Send 'set theme' command to lighting controller */ + uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x0e"); + /* Send 'set speed and brightness' command to lighting controller */ + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x02\x80\x01\x00"); + /* Mark LEDs as enabled */ leds_enabled = true; - uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); keyboard_post_init_user(); } From 80da5d59260e1a4b1924fcdeb15add1f04a1cbe6 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 10 Jul 2019 18:40:11 +0200 Subject: [PATCH 27/68] Remove mess of options in rules.mk --- keyboards/anne_pro/config.h | 2 +- keyboards/anne_pro/rules.mk | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index a7cff9a8730..6381084dcaf 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -35,7 +35,7 @@ #define MATRIX_COL_PINS { A5, A6, A7, B0, B1, B12, B13, B14, A8, A9, A15, B3, B4, B5 } /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 6 +#define DEBOUNCE 5 /* * Force NKRO diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 3307fa0dc7a..2e09e348f0b 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -26,15 +26,6 @@ DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 # Build Options # comment out to disable the options. # -BACKLIGHT_ENABLE = no -BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration -## (Note that for BOOTMAGIC on Teensy LC you have to use a custom .ld script.) -MOUSEKEY_ENABLE = no # Mouse keys +MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control -CONSOLE_ENABLE = no # Console for debug -COMMAND_ENABLE = no # Commands for debug and configuration -#SLEEP_LED_ENABLE = yes # Breathing sleep LED during USB suspend NKRO_ENABLE = yes # USB Nkey Rollover -AUDIO_ENABLE = no -RGBLIGHT_ENABLE = no -# SERIAL_LINK_ENABLE = no From 3bb749b7cd17ea05d2d552ade033fd20a385a2a8 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Thu, 11 Jul 2019 17:04:52 +0200 Subject: [PATCH 28/68] Move lighting code into separate file --- keyboards/anne_pro/anne_pro.c | 121 +++--------------- keyboards/anne_pro/anne_pro_lighting.c | 169 +++++++++++++++++++++++++ keyboards/anne_pro/anne_pro_lighting.h | 51 ++++++++ keyboards/anne_pro/rules.mk | 3 + 4 files changed, 243 insertions(+), 101 deletions(-) create mode 100644 keyboards/anne_pro/anne_pro_lighting.c create mode 100644 keyboards/anne_pro/anne_pro_lighting.h diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index b116a9dcd2d..ea43a662c06 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -15,108 +15,38 @@ */ #include "anne_pro.h" -#include "uart_tx_ringbuf.h" +#include "anne_pro_lighting.h" #include "ch.h" #include "hal.h" -#define LED_UART (&UARTD3) -/* UART transmission ringbuffer for the LED UART */ -static uint8_t led_uart_tx_buffer[256] = {0}; -static uart_tx_ringbuf_t led_uart_ringbuf = { - .buf = led_uart_tx_buffer, - .uart = LED_UART, - .size = sizeof(led_uart_tx_buffer), - .sending_elements = 0, - .head = 0, - .tail = 0, -}; - -/* Should the main loop try a transmission, used when transmission finishes - to send any data that might have been added to the buffer while the - transmission was in progress. -*/ -static volatile bool led_uart_try_transmission = false; - -/* Handler for finsihed LED UART transmissions */ -static void led_uart_txend(UARTDriver *uart) { - uart_tx_ringbuf_finish_transmission(&led_uart_ringbuf); - led_uart_try_transmission = true; -} - -/* LED UART configuration */ -static UARTConfig led_uart_cfg = { - .txend1_cb = led_uart_txend, - .txend2_cb = NULL, - .rxend_cb = NULL, - .rxchar_cb = NULL, - .rxerr_cb = NULL, - .speed = 38400, - .cr1 = 0, - .cr2 = USART_CR2_LINEN, - .cr3 = 0 -}; - -/* State of the leds on the keyboard */ -static volatile bool leds_enabled = false; - -/* Buffer for the keystate packet */ -static uint8_t keystate[12] = {9, 10, 7, 0}; - -/* Update the dynamic lighting packet based on a keypress */ -void update_dynamic_lighting(keyrecord_t *record) { - /* Only update dynamic lighting modes when leds are enabled */ - if (leds_enabled) { - /* Calculate the position of the key that was pressed */ - uint8_t row = record->event.key.row; - uint8_t col = record->event.key.col; - int position = row * MATRIX_COLS + col; - int index = position / 8; - int bit = position % 8; - - /* Update the keystate based on the location */ - if (record->event.pressed) { - keystate[3 + index] |= (1 << bit); - } else { - keystate[3 + index] &= ~(1 << bit); - } - - /* Send the keystate to the LED controller */ - uart_tx_ringbuf_write(&led_uart_ringbuf, 12, keystate); - } -} - /* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - update_dynamic_lighting(record); + /* Update the key status for the reactive effects */ + anne_pro_lighting_update_dynamic(record); switch (keycode) { case APL_RGB: /* Toggle the RGB enabled/disabled */ if (record->event.pressed) { - leds_enabled = !leds_enabled; - if (leds_enabled) { - uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); - } else { - uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x00"); - } + anne_pro_lighting_toggle(); } return false; case APL_RAT: /* Change the animation rate */ - if (leds_enabled && record->event.pressed) { - uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x01\x00"); + if (record->event.pressed) { + anne_pro_lighting_rate_next(); } return false; case APL_BRT: /* Change the brightness */ - if (leds_enabled && record->event.pressed) { - uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x00\x01"); + if (record->event.pressed) { + anne_pro_lighting_brightness_next(); } return false; case APL_MOD: /* Change the lighting mode */ - if (leds_enabled && record->event.pressed) { - uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x01\x00\x00"); + if (record->event.pressed) { + anne_pro_lighting_mode_next(); } return false; default: @@ -127,39 +57,28 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { /* Initialize custom keyboard features */ void keyboard_pre_init_kb(void) { - /* Turn on lighting controller */ - setPinOutput(C15); - writePinLow(C15); - chThdSleepMilliseconds(10); - writePinHigh(C15); - chThdSleepMilliseconds(10); - - /* Initialize the lighting UART */ - uartStart(LED_UART, &led_uart_cfg); - palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); - palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); + /* Initialize the ligthing controller */ + anne_pro_lighting_init(); keyboard_pre_init_user(); } /* Turn on the lighting when init is finished */ void keyboard_post_init_kb(void) { - /* Send 'set theme' command to lighting controller */ - uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x0e"); - /* Send 'set speed and brightness' command to lighting controller */ - uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x02\x80\x01\x00"); - /* Mark LEDs as enabled */ - leds_enabled = true; + /* Turn on the lighting */ + anne_pro_lighting_on(); + /* Set the theme to rainbow */ + anne_pro_lighting_mode(APL_MODE_RAINBOW); + /* Set the effect rate to average and the brightness to average */ + anne_pro_lighting_rate_brightness(128, 5); keyboard_post_init_user(); } /* Start transmissions when the flag is set */ void matrix_scan_kb(void) { - if (led_uart_try_transmission) { - uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); - led_uart_try_transmission = false; - } + /* Run some update code for the lighting */ + anne_pro_lighting_update(); /* Run matrix_scan_user code */ matrix_scan_user(); diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c new file mode 100644 index 00000000000..3fffab12b75 --- /dev/null +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -0,0 +1,169 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "anne_pro_lighting.h" +#include "uart_tx_ringbuf.h" +#include "quantum.h" +#include "ch.h" +#include "hal.h" + +#define LED_UART (&UARTD3) +/* UART transmission ringbuffer for the LED UART */ +static uint8_t led_uart_tx_buffer[256] = {0}; +static uart_tx_ringbuf_t led_uart_ringbuf = { + .buf = led_uart_tx_buffer, + .uart = LED_UART, + .size = sizeof(led_uart_tx_buffer), + .sending_elements = 0, + .head = 0, + .tail = 0, +}; + +/* Should the main loop try a transmission, used when transmission finishes + to send any data that might have been added to the buffer while the + transmission was in progress. +*/ +static volatile bool led_uart_try_transmission = false; + +/* Handler for finsihed LED UART transmissions */ +static void led_uart_txend(UARTDriver *uart) { + uart_tx_ringbuf_finish_transmission(&led_uart_ringbuf); + led_uart_try_transmission = true; +} + +/* LED UART configuration */ +static UARTConfig led_uart_cfg = { + .txend1_cb = led_uart_txend, + .txend2_cb = NULL, + .rxend_cb = NULL, + .rxchar_cb = NULL, + .rxerr_cb = NULL, + .speed = 38400, + .cr1 = 0, + .cr2 = USART_CR2_LINEN, + .cr3 = 0 +}; + +/* State of the leds on the keyboard */ +static volatile bool leds_enabled = false; + +void anne_pro_lighting_init(void) { + /* Turn on lighting controller */ + setPinOutput(C15); + writePinLow(C15); + chThdSleepMilliseconds(10); + writePinHigh(C15); + chThdSleepMilliseconds(10); + + /* Initialize the lighting UART */ + uartStart(LED_UART, &led_uart_cfg); + palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); + palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); +} + +/* Buffer for the keystate packet */ +static uint8_t keystate[12] = {9, 10, 7, 0}; + +/* Update the dynamic lighting packet based on a keypress */ +void anne_pro_lighting_update_dynamic(keyrecord_t *record) { + /* Only update dynamic lighting modes when leds are enabled */ + if (leds_enabled) { + /* Calculate the position of the key that was pressed */ + uint8_t row = record->event.key.row; + uint8_t col = record->event.key.col; + int position = row * MATRIX_COLS + col; + int index = position / 8; + int bit = position % 8; + + /* Update the keystate based on the location */ + if (record->event.pressed) { + keystate[3 + index] |= (1 << bit); + } else { + keystate[3 + index] &= ~(1 << bit); + } + + /* Send the keystate to the LED controller */ + uart_tx_ringbuf_write(&led_uart_ringbuf, 12, keystate); + } +} + +/* Update lighting, should be called every matrix scan */ +void anne_pro_lighting_update(void) { + if (led_uart_try_transmission) { + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); + led_uart_try_transmission = false; + } +} + +/* Toggle the lighting on/off */ +void anne_pro_lighting_toggle(void) { + if (!leds_enabled) { + anne_pro_lighting_on(); + } else { + anne_pro_lighting_off(); + } +} + +/* Turn the lighting on */ +void anne_pro_lighting_on(void) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); + leds_enabled = true; +} + +/* Turn the lighting off */ +void anne_pro_lighting_off(void) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x00"); + leds_enabled = false; +} + +/* Select the next effect rate */ +void anne_pro_lighting_rate_next(void) { + if (leds_enabled) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x01\x00"); + } +} + +/* Select the next brightness */ +void anne_pro_lighting_brightness_next(void) { + if (leds_enabled) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x00\x00\x01"); + } +} + +/* Select the next lighting mode */ +void anne_pro_lighting_mode_next(void) { + if (leds_enabled) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, "\x09\x04\x05\x01\x00\x00"); + } +} + +/* Set the lighting mode */ +void anne_pro_lighting_mode(uint8_t mode) { + if (leds_enabled) { + uint8_t buf[] = {9, 2, 1, mode}; + uart_tx_ringbuf_write(&led_uart_ringbuf, 4, buf); + } +} + +/* Set the rate and brightness */ +void anne_pro_lighting_rate_brightness(uint8_t rate, uint8_t brightness) { + if (leds_enabled) { + if (brightness > 10) brightness = 10; + + uint8_t buf[] = {9, 4, 2, rate, brightness, 0}; + uart_tx_ringbuf_write(&led_uart_ringbuf, 6, buf); + } +} diff --git a/keyboards/anne_pro/anne_pro_lighting.h b/keyboards/anne_pro/anne_pro_lighting.h new file mode 100644 index 00000000000..e2e6bcd171a --- /dev/null +++ b/keyboards/anne_pro/anne_pro_lighting.h @@ -0,0 +1,51 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include "quantum.h" + +#define APL_MODE_OFF 0 +#define APL_MODE_RED 1 +#define APL_MODE_YELLOW 2 +#define APL_MODE_GREEN 3 +#define APL_MODE_CYAN 4 +#define APL_MODE_BLUE 5 +#define APL_MODE_PURPLE 6 +#define APL_MODE_PINK 7 +#define APL_MODE_ORANGE 8 +#define APL_MODE_WHITE 9 +#define APL_MODE_FLAG_FANCE 10 +#define APL_MODE_FLAG_ITALY 11 +#define APL_MODE_FLAG_ARGENTINA 12 +#define APL_MODE_BREATHING 13 +#define APL_MODE_RAINBOW 14 +#define APL_MODE_REACTIVE_FADE 15 +#define APL_MODE_REACTIVE_HOLD 16 +#define APL_MODE_REACTIVE_LINE 17 +#define APL_MODE_RANDOM 18 +#define APL_MODE_CUSTOM 128 + +void anne_pro_lighting_init(void); +void anne_pro_lighting_update(void); +void anne_pro_lighting_update_dynamic(keyrecord_t *record); +void anne_pro_lighting_toggle(void); +void anne_pro_lighting_on(void); +void anne_pro_lighting_off(void); +void anne_pro_lighting_rate_next(void); +void anne_pro_lighting_brightness_next(void); +void anne_pro_lighting_mode_next(void); +void anne_pro_lighting_mode(uint8_t mode); +void anne_pro_lighting_rate_brightness(uint8_t speed, uint8_t brightness); diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 2e09e348f0b..6c537567e67 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -23,6 +23,9 @@ ARMV = 7 # Extra arguments for dfu-util to flash to the correct location DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 +# Extra source files +SRC += anne_pro_lighting.c + # Build Options # comment out to disable the options. # From e904e2cbd3e56357e62bed8bc93e7962540b9f92 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Fri, 12 Jul 2019 17:04:39 +0200 Subject: [PATCH 29/68] Change ringbuf to not automatically start sending when written to --- keyboards/anne_pro/anne_pro_lighting.c | 13 ++-- keyboards/anne_pro/rules.mk | 2 +- keyboards/anne_pro/uart_tx_ringbuf.c | 89 ++++++++++++++++++++++++++ keyboards/anne_pro/uart_tx_ringbuf.h | 82 +++--------------------- 4 files changed, 102 insertions(+), 84 deletions(-) create mode 100644 keyboards/anne_pro/uart_tx_ringbuf.c diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 3fffab12b75..f983143ef24 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -32,16 +32,9 @@ static uart_tx_ringbuf_t led_uart_ringbuf = { .tail = 0, }; -/* Should the main loop try a transmission, used when transmission finishes - to send any data that might have been added to the buffer while the - transmission was in progress. -*/ -static volatile bool led_uart_try_transmission = false; - /* Handler for finsihed LED UART transmissions */ static void led_uart_txend(UARTDriver *uart) { uart_tx_ringbuf_finish_transmission(&led_uart_ringbuf); - led_uart_try_transmission = true; } /* LED UART configuration */ @@ -97,14 +90,14 @@ void anne_pro_lighting_update_dynamic(keyrecord_t *record) { /* Send the keystate to the LED controller */ uart_tx_ringbuf_write(&led_uart_ringbuf, 12, keystate); + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } } /* Update lighting, should be called every matrix scan */ void anne_pro_lighting_update(void) { - if (led_uart_try_transmission) { + if (!uart_tx_ringbuf_empty(&led_uart_ringbuf)) { uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); - led_uart_try_transmission = false; } } @@ -120,12 +113,14 @@ void anne_pro_lighting_toggle(void) { /* Turn the lighting on */ void anne_pro_lighting_on(void) { uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); leds_enabled = true; } /* Turn the lighting off */ void anne_pro_lighting_off(void) { uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x00"); + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); leds_enabled = false; } diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 6c537567e67..41d7ee92fbb 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -24,7 +24,7 @@ ARMV = 7 DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 # Extra source files -SRC += anne_pro_lighting.c +SRC += uart_tx_ringbuf.c anne_pro_lighting.c # Build Options # comment out to disable the options. diff --git a/keyboards/anne_pro/uart_tx_ringbuf.c b/keyboards/anne_pro/uart_tx_ringbuf.c new file mode 100644 index 00000000000..1a27a543479 --- /dev/null +++ b/keyboards/anne_pro/uart_tx_ringbuf.c @@ -0,0 +1,89 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "uart_tx_ringbuf.h" +#include "hal.h" + +int uart_tx_ringbuf_elements(uart_tx_ringbuf_t *ringbuf) { + return ringbuf->head - ringbuf->tail; +} + +int uart_tx_ringbuf_space(uart_tx_ringbuf_t *ringbuf) { + return ringbuf->size - uart_tx_ringbuf_elements(ringbuf); +} + +bool uart_tx_ringbuf_empty(uart_tx_ringbuf_t *ringbuf) { + return uart_tx_ringbuf_elements(ringbuf) == 0; +} + +bool uart_tx_ringbuf_full(uart_tx_ringbuf_t *ringbuf) { + return uart_tx_ringbuf_elements(ringbuf) == ringbuf->size; +} + +void uart_tx_ringbuf_start_transmission(uart_tx_ringbuf_t *ringbuf) { + /* Do not start transmission when one is already in progress */ + if (ringbuf->sending_elements != 0) return; + + size_t elements = uart_tx_ringbuf_elements(ringbuf); + /* Do not start transmission when ringbuffer is empty */ + if (elements == 0) return; + + /* Get the offset of the first and last item */ + size_t first_offset = (ringbuf->tail & (ringbuf->size - 1)); + + /* Determine if this wraps around the end of the buffer */ + if (first_offset + elements >= ringbuf->size) { + /* If so only send until the end of the buffer */ + elements = ringbuf->size - first_offset; + } + + /* Send the selected elements */ + ringbuf->sending_elements = elements; + uartStartSend(ringbuf->uart, elements, ringbuf->buf + first_offset); +} + +void uart_tx_ringbuf_finish_transmission(uart_tx_ringbuf_t *ringbuf) { + /* Update the tail of the ringbuffer */ + ringbuf->tail += ringbuf->sending_elements; + /* Clear the sending elements */ + ringbuf->sending_elements = 0; +} + +bool uart_tx_ringbuf_put(uart_tx_ringbuf_t *ringbuf, uint8_t c) { + /* If the ringbuffer is full, ignore the request */ + if (uart_tx_ringbuf_full(ringbuf)) return false; + + /* Put the character into the ringbuffer */ + size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); + ringbuf->buf[head_offset] = c; + ringbuf->head++; + + return true; +} + +bool uart_tx_ringbuf_write(uart_tx_ringbuf_t *ringbuf, size_t count, void *data) { + /* If there is not enough space, ignore the request */ + if (uart_tx_ringbuf_space(ringbuf) < count) return false; + + for (int i = 0; i < count; i++) { + /* Put the character into the ringbuffer */ + size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); + ringbuf->buf[head_offset] = ((uint8_t *) data)[i]; + ringbuf->head++; + } + + return true; +} diff --git a/keyboards/anne_pro/uart_tx_ringbuf.h b/keyboards/anne_pro/uart_tx_ringbuf.h index abdb37f0d63..fa20156ed90 100644 --- a/keyboards/anne_pro/uart_tx_ringbuf.h +++ b/keyboards/anne_pro/uart_tx_ringbuf.h @@ -26,77 +26,11 @@ typedef struct { volatile size_t tail; } uart_tx_ringbuf_t; -int uart_tx_ringbuf_elements(uart_tx_ringbuf_t *ringbuf) { - return ringbuf->head - ringbuf->tail; -} - -int uart_tx_ringbuf_space(uart_tx_ringbuf_t *ringbuf) { - return ringbuf->size - uart_tx_ringbuf_elements(ringbuf); -} - -bool uart_tx_ringbuf_empty(uart_tx_ringbuf_t *ringbuf) { - return uart_tx_ringbuf_elements(ringbuf) == 0; -} - -bool uart_tx_ringbuf_full(uart_tx_ringbuf_t *ringbuf) { - return uart_tx_ringbuf_elements(ringbuf) == ringbuf->size; -} - -void uart_tx_ringbuf_start_transmission(uart_tx_ringbuf_t *ringbuf) { - /* Do not start transmission when one is already in progress */ - if (ringbuf->sending_elements != 0) return; - - size_t elements = uart_tx_ringbuf_elements(ringbuf); - /* Do not start transmission when ringbuffer is empty */ - if (elements == 0) return; - - /* Get the offset of the first and last item */ - size_t first_offset = (ringbuf->tail & (ringbuf->size - 1)); - - /* Determine if this wraps around the end of the buffer */ - if (first_offset + elements >= ringbuf->size) { - /* If so only send until the end of the buffer */ - elements = ringbuf->size - first_offset; - } - - /* Send the selected elements */ - ringbuf->sending_elements = elements; - uartStartSend(ringbuf->uart, elements, ringbuf->buf + first_offset); -} - -void uart_tx_ringbuf_finish_transmission(uart_tx_ringbuf_t *ringbuf) { - /* Update the tail of the ringbuffer */ - ringbuf->tail += ringbuf->sending_elements; - /* Clear the sending elements */ - ringbuf->sending_elements = 0; -} - -bool uart_tx_ringbuf_put(uart_tx_ringbuf_t *ringbuf, uint8_t c) { - /* If the ringbuffer is full, ignore the request */ - if (uart_tx_ringbuf_full(ringbuf)) return false; - - /* Put the character into the ringbuffer */ - size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); - ringbuf->buf[head_offset] = c; - ringbuf->head++; - - /* Try to start the transmission immediately */ - uart_tx_ringbuf_start_transmission(ringbuf); - return true; -} - -bool uart_tx_ringbuf_write(uart_tx_ringbuf_t *ringbuf, size_t count, void *data) { - /* If there is not enough space, ignore the request */ - if (uart_tx_ringbuf_space(ringbuf) < count) return false; - - for (int i = 0; i < count; i++) { - /* Put the character into the ringbuffer */ - size_t head_offset = (ringbuf->head & (ringbuf->size - 1)); - ringbuf->buf[head_offset] = ((uint8_t *) data)[i]; - ringbuf->head++; - } - - /* Try to start the transmission immediately */ - uart_tx_ringbuf_start_transmission(ringbuf); - return true; -} +int uart_tx_ringbuf_elements(uart_tx_ringbuf_t *ringbuf); +int uart_tx_ringbuf_space(uart_tx_ringbuf_t *ringbuf); +bool uart_tx_ringbuf_empty(uart_tx_ringbuf_t *ringbuf); +bool uart_tx_ringbuf_full(uart_tx_ringbuf_t *ringbuf); +void uart_tx_ringbuf_start_transmission(uart_tx_ringbuf_t *ringbuf); +void uart_tx_ringbuf_finish_transmission(uart_tx_ringbuf_t *ringbuf); +bool uart_tx_ringbuf_put(uart_tx_ringbuf_t *ringbuf, uint8_t c); +bool uart_tx_ringbuf_write(uart_tx_ringbuf_t *ringbuf, size_t count, void *data); From 09260691e65fe105b62bcfbf62367238c0c0a000 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 13 Jul 2019 13:50:00 +0200 Subject: [PATCH 30/68] Add basic Bluetooth support --- keyboards/anne_pro/anne_pro.c | 33 ++++ keyboards/anne_pro/anne_pro.h | 3 +- keyboards/anne_pro/anne_pro_bluetooth.c | 176 ++++++++++++++++++++ keyboards/anne_pro/anne_pro_bluetooth.h | 27 +++ keyboards/anne_pro/halconf.h | 20 +++ keyboards/anne_pro/keymaps/default/keymap.c | 2 +- keyboards/anne_pro/mcuconf.h | 2 +- keyboards/anne_pro/rules.mk | 2 +- 8 files changed, 261 insertions(+), 4 deletions(-) create mode 100644 keyboards/anne_pro/anne_pro_bluetooth.c create mode 100644 keyboards/anne_pro/anne_pro_bluetooth.h diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index ea43a662c06..afce4f39c57 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -16,9 +16,15 @@ #include "anne_pro.h" #include "anne_pro_lighting.h" +#include "anne_pro_bluetooth.h" #include "ch.h" #include "hal.h" +#ifdef NKRO_ENABLE +static bool nkro_enabled_last = false; +#endif +static host_driver_t *host_driver_last; + /* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { /* Update the key status for the reactive effects */ @@ -49,6 +55,29 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { anne_pro_lighting_mode_next(); } return false; + case APB_TOG: + /* Toggle the output driver between USB and Bluetooth */ + if (record->event.pressed) { + if (host_get_driver() != &anne_pro_bluetooth_driver) { + clear_keyboard(); + host_driver_last = host_get_driver(); +#ifdef NKRO_ENABLE + nkro_enabled_last = keymap_config.nkro; + keymap_config.nkro = false; +#endif + host_set_driver(&anne_pro_bluetooth_driver); + anne_pro_bluetooth_on(); + anne_pro_bluetooth_broadcast(); + } else { + clear_keyboard(); +#ifdef NKRO_ENABLE + keymap_config.nkro = nkro_enabled_last; +#endif + host_set_driver(host_driver_last); + anne_pro_bluetooth_off(); + } + } + return false; default: /* Handle other keycodes normally */ return process_record_user(keycode, record); @@ -59,6 +88,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { void keyboard_pre_init_kb(void) { /* Initialize the ligthing controller */ anne_pro_lighting_init(); + /* Initialize the bluetooth controller */ + anne_pro_bluetooth_init(); keyboard_pre_init_user(); } @@ -79,6 +110,8 @@ void keyboard_post_init_kb(void) { void matrix_scan_kb(void) { /* Run some update code for the lighting */ anne_pro_lighting_update(); + /* Run some update code for the bluetooth */ + anne_pro_bluetooth_update(); /* Run matrix_scan_user code */ matrix_scan_user(); diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 4d3c75bd7e1..984a2ad4bcc 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -22,7 +22,8 @@ enum anne_pro_keycodes { APL_RGB = SAFE_RANGE, APL_RAT, APL_BRT, - APL_MOD + APL_MOD, + APB_TOG, }; /* The fully-featured LAYOUT() that has every single key available in the matrix. */ diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c new file mode 100644 index 00000000000..a5dc94dba80 --- /dev/null +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -0,0 +1,176 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "anne_pro_bluetooth.h" +#include "uart_tx_ringbuf.h" +#include "host.h" +#include "host_driver.h" + +#define BLUETOOTH_UART (&UARTD2) +/* UART transmission ringbuffer for the Bluetooth UART */ +static uint8_t bluetooth_uart_tx_buffer[256] = {0}; +static uart_tx_ringbuf_t bluetooth_uart_ringbuf = { + .buf = bluetooth_uart_tx_buffer, + .uart = BLUETOOTH_UART, + .size = sizeof(bluetooth_uart_tx_buffer), + .sending_elements = 0, + .head = 0, + .tail = 0, +}; + +/* Handler for finsihed Bluetooth UART transmissions */ +static void bluetooth_uart_txend(UARTDriver *uart) { + uart_tx_ringbuf_finish_transmission(&bluetooth_uart_ringbuf); +} + +/* Wakeup bluetooth chip and wait for acknoledgement */ +msg_t bluetooth_wakeup(void) { + char rx_buf[3]; + size_t frames = 3; + palSetPad(GPIOA, 1); + msg_t result = uartReceiveTimeout(BLUETOOTH_UART, &frames, &rx_buf, 10); + palClearPad(GPIOA, 1); + return result; +} + +/* Update Bluetooth, should be called every matrix scan */ +void anne_pro_bluetooth_update(void) { + if (!uart_tx_ringbuf_empty(&bluetooth_uart_ringbuf)) { + if (bluetooth_wakeup() == MSG_OK) { + uart_tx_ringbuf_start_transmission(&bluetooth_uart_ringbuf); + } + } +} + +void bluetooth_rx_char(UARTDriver *driver, uint16_t c); +/* Bluetooth UART configuration */ +static UARTConfig bluetooth_uart_cfg = { + .txend1_cb = bluetooth_uart_txend, + .txend2_cb = NULL, + .rxend_cb = NULL, + .rxchar_cb = bluetooth_rx_char, + .rxerr_cb = NULL, + .speed = 38400, + .cr1 = 0, + .cr2 = USART_CR2_LINEN, + .cr3 = 0 +}; + +/* Receive buffer for the Bluetooth UART */ +uint8_t bluetooth_rx_buffer[256] = {0}; +size_t bluetooth_rx_index = 0; + +/* Lookup table for translation to hex */ +char hex_lookup[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + +/* Handle packets from the bluetooth receive buffer */ +void bluetooth_handle_packet(void) { + /* Packet type and length */ + uint8_t packet_type = bluetooth_rx_buffer[0]; + // uint8_t packet_len = bluetooth_rx_buffer[1]; + + /* Handle incomming packets over Bluetooth */ + switch (packet_type) { + case 2: // System + switch (bluetooth_rx_buffer[2]) { + case 1: // GetId + // [2, 15, 129, 10, 2, 0, 1, 2, 50, 55, 71, 1, 50, 48] + // [2, 15, 129, 8, 2, 1, 54, 48, 52, 0, 54, 0, 50, 48] + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 28, "\x02\x0f\x81\x0a\x02\x00\x01\x02\x32\x37\x47\x01\x32\x30" + "\x02\x0f\x81\x08\x02\x01\x36\x30\x34\x00\x36\x00\x32\x30"); + break; + } + break; + } +} + +/* Receive single character from the Bluetooth UART */ +void bluetooth_rx_char(UARTDriver *driver, uint16_t c) { + bluetooth_rx_buffer[bluetooth_rx_index++] = c; + + if (bluetooth_rx_index > 2) { + uint8_t packet_len = bluetooth_rx_buffer[1]; + if (bluetooth_rx_index >= (2 + packet_len)) { + bluetooth_handle_packet(); + bluetooth_rx_index = 0; + } + } +} + +/* Initialize the Anne Pro Bluetooth */ +void anne_pro_bluetooth_init(void) { + /* Initialize the bleutooth UART */ + uartStart(BLUETOOTH_UART, &bluetooth_uart_cfg); + palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7)); + palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7)); + palSetPadMode(GPIOA, 1, PAL_MODE_OUTPUT_PUSHPULL); + palClearPad(GPIOA, 1); + + /* Disable bluetooth on startup */ + anne_pro_bluetooth_off(); +} + +/* Turn on Bluetooth */ +void anne_pro_bluetooth_on(void) { + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x01"); +} + +/* Turn off Bluetooth */ +void anne_pro_bluetooth_off(void) { + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x02"); +} + +/* Start broadcasting on Bluetooth */ +void anne_pro_bluetooth_broadcast(void) { + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x07"); +} + +/* Status of keyboard leds for Bluetooth driver*/ +static uint8_t keyboard_leds(void) { + return 0; +} + +/* Send keyboard HID report for Bluetooth driver */ +static void send_keyboard(report_keyboard_t *report) { + uint8_t bluetooth_report[11] = {7, 9, 1, 0}; + bluetooth_report[3] = report->mods; + bluetooth_report[4] = report->reserved; + for (int i = 0; i < 6; i++) { + bluetooth_report[5+i] = report->keys[i]; + } + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 11, bluetooth_report); +} + +/* Send mouse HID report for Bluetooth driver */ +static void send_mouse(report_mouse_t *report) { +} + +/* Send system report for Bluetooth driver */ +static void send_system(uint16_t data) { +} + +/* Send consumer report for Bluetooth driver */ +static void send_consumer(uint16_t data) { +} + +/* Bluetooth host driver, this allows us to switch from USB output to Bluetooth output */ +host_driver_t anne_pro_bluetooth_driver = { + keyboard_leds, + send_keyboard, + send_mouse, + send_system, + send_consumer +}; diff --git a/keyboards/anne_pro/anne_pro_bluetooth.h b/keyboards/anne_pro/anne_pro_bluetooth.h new file mode 100644 index 00000000000..130adedc11d --- /dev/null +++ b/keyboards/anne_pro/anne_pro_bluetooth.h @@ -0,0 +1,27 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#pragma once +#include "host_driver.h" + +extern host_driver_t anne_pro_bluetooth_driver; + +void anne_pro_bluetooth_init(void); +void anne_pro_bluetooth_update(void); + +void anne_pro_bluetooth_on(void); +void anne_pro_bluetooth_off(void); +void anne_pro_bluetooth_broadcast(void); diff --git a/keyboards/anne_pro/halconf.h b/keyboards/anne_pro/halconf.h index 1ceefe34a90..1a6f22bac1e 100644 --- a/keyboards/anne_pro/halconf.h +++ b/keyboards/anne_pro/halconf.h @@ -336,6 +336,26 @@ #define SPI_USE_MUTUAL_EXCLUSION TRUE #endif +/*===========================================================================*/ +/* UART driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) +#define UART_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define UART_USE_MUTUAL_EXCLUSION FALSE +#endif + /*===========================================================================*/ /* USB driver related settings. */ /*===========================================================================*/ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index 37cce3d48bc..faed6117df8 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [2] = LAYOUT( RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ diff --git a/keyboards/anne_pro/mcuconf.h b/keyboards/anne_pro/mcuconf.h index 5fa5ff0129a..337d12775c4 100644 --- a/keyboards/anne_pro/mcuconf.h +++ b/keyboards/anne_pro/mcuconf.h @@ -177,7 +177,7 @@ * UART driver system settings. */ #define STM32_UART_USE_USART1 FALSE -#define STM32_UART_USE_USART2 FALSE +#define STM32_UART_USE_USART2 TRUE #define STM32_UART_USE_USART3 TRUE #define STM32_UART_USART1_IRQ_PRIORITY 12 #define STM32_UART_USART2_IRQ_PRIORITY 12 diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 41d7ee92fbb..9a00bb69217 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -24,7 +24,7 @@ ARMV = 7 DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 # Extra source files -SRC += uart_tx_ringbuf.c anne_pro_lighting.c +SRC += uart_tx_ringbuf.c anne_pro_lighting.c anne_pro_bluetooth.c # Build Options # comment out to disable the options. From 35b29e4a18dba33ec2e08de2c569ee33b8064c1e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sat, 13 Jul 2019 13:50:27 +0200 Subject: [PATCH 31/68] Sleep LED controller when lights are off --- keyboards/anne_pro/anne_pro_lighting.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index f983143ef24..5fbfea05b66 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -55,11 +55,8 @@ static volatile bool leds_enabled = false; void anne_pro_lighting_init(void) { /* Turn on lighting controller */ - setPinOutput(C15); writePinLow(C15); - chThdSleepMilliseconds(10); - writePinHigh(C15); - chThdSleepMilliseconds(10); + setPinOutput(C15); /* Initialize the lighting UART */ uartStart(LED_UART, &led_uart_cfg); @@ -112,6 +109,10 @@ void anne_pro_lighting_toggle(void) { /* Turn the lighting on */ void anne_pro_lighting_on(void) { + /* Wake up the LED controller */ + writePinHigh(C15); + chThdSleepMilliseconds(50); + /* Send turn light on command */ uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); leds_enabled = true; @@ -119,9 +120,12 @@ void anne_pro_lighting_on(void) { /* Turn the lighting off */ void anne_pro_lighting_off(void) { + /* Send turn light off command */ uart_tx_ringbuf_write(&led_uart_ringbuf, 4, "\x09\x02\x01\x00"); uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); leds_enabled = false; + /* Sleep the LED controller */ + writePinLow(C15); } /* Select the next effect rate */ From dcbbbafd40d0dccd51a651a40cf10dd83670a14e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Sun, 14 Jul 2019 20:19:35 +0200 Subject: [PATCH 32/68] Fix some lighting code --- keyboards/anne_pro/anne_pro_lighting.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 5fbfea05b66..effa04640e7 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -69,6 +69,8 @@ static uint8_t keystate[12] = {9, 10, 7, 0}; /* Update the dynamic lighting packet based on a keypress */ void anne_pro_lighting_update_dynamic(keyrecord_t *record) { + /* Make sure this is actually a keypress event */ + if (IS_NOEVENT(record->event)) return; /* Only update dynamic lighting modes when leds are enabled */ if (leds_enabled) { /* Calculate the position of the key that was pressed */ @@ -116,6 +118,8 @@ void anne_pro_lighting_on(void) { uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); leds_enabled = true; + /* Wait for the message to be sent */ + chThdSleepMilliseconds(10); } /* Turn the lighting off */ @@ -154,6 +158,7 @@ void anne_pro_lighting_mode(uint8_t mode) { if (leds_enabled) { uint8_t buf[] = {9, 2, 1, mode}; uart_tx_ringbuf_write(&led_uart_ringbuf, 4, buf); + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } } @@ -164,5 +169,6 @@ void anne_pro_lighting_rate_brightness(uint8_t rate, uint8_t brightness) { uint8_t buf[] = {9, 4, 2, rate, brightness, 0}; uart_tx_ringbuf_write(&led_uart_ringbuf, 6, buf); + uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } } From f6923babe4c3ea335f75504fef9d2f3cab7a9def Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 15 Jul 2019 19:29:38 +0200 Subject: [PATCH 33/68] Add the Windows and Arrows layouts --- keyboards/anne_pro/README.md | 2 + keyboards/anne_pro/keymaps/arrow/keymap.c | 42 +++++++++++++++++++++ keyboards/anne_pro/keymaps/default/keymap.c | 5 +-- keyboards/anne_pro/keymaps/macos/keymap.c | 42 +++++++++++++++++++++ 4 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 keyboards/anne_pro/keymaps/arrow/keymap.c create mode 100644 keyboards/anne_pro/keymaps/macos/keymap.c diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 9d91e905a48..3f43f0c55b9 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -23,6 +23,8 @@ Flashing the firmware can easily be done when the keyboard is in DFU mode: make anne_pro:default:dfu-util +The default Arrows and macOS keyboard layouts are also included and can be used with `arrow` or `macos` instead of `default`. + To convert the `bin` file to a `dfu` file the following script can be used ./keyboards/anne_pro/dfuse-pack.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu diff --git a/keyboards/anne_pro/keymaps/arrow/keymap.c b/keyboards/anne_pro/keymaps/arrow/keymap.c new file mode 100644 index 00000000000..0f602fe321d --- /dev/null +++ b/keyboards/anne_pro/keymaps/arrow/keymap.c @@ -0,0 +1,42 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +/* Default Anne Pro layout, arrows style */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + 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_UP, KC_RSFT, + KC_LCTL, MO(2), KC_LALT, KC_SPACE, KC_LEFT, KC_DOWN, KC_RGHT, MO(1) + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_SLSH, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [2] = LAYOUT( + RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ) +}; diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index faed6117df8..8c6581f2175 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -16,15 +16,14 @@ #include QMK_KEYBOARD_H - -/* Default Anne Pro layout, macOS style with LALT and LWIN switched */ +/* Default Anne Pro layout, windows style */ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [0] = LAYOUT( KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, 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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), MO(2), KC_RCTL + KC_LCTL, KC_LWIN, KC_LALT, KC_SPACE, KC_RALT, MO(1), MO(2), KC_RCTL ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, diff --git a/keyboards/anne_pro/keymaps/macos/keymap.c b/keyboards/anne_pro/keymaps/macos/keymap.c new file mode 100644 index 00000000000..bf71f9e47cc --- /dev/null +++ b/keyboards/anne_pro/keymaps/macos/keymap.c @@ -0,0 +1,42 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +/* Default Anne Pro layout, macOS style with LALT and LWIN switched */ +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + 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_LCTL, KC_LALT, KC_LWIN, KC_SPACE, KC_RALT, MO(1), MO(2), KC_RCTL + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [2] = LAYOUT( + RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ) +}; From 5565ccb12b22f162f5b09340a0a2e7a7764ce63b Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 16 Jul 2019 14:33:35 +0200 Subject: [PATCH 34/68] Fix problems with Bluetooth breaking when USB goes into suspend --- keyboards/anne_pro/rules.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 9a00bb69217..d322adb9afc 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -26,6 +26,9 @@ DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 # Extra source files SRC += uart_tx_ringbuf.c anne_pro_lighting.c anne_pro_bluetooth.c +# Required for functionality with Bluetooth +NO_USB_STARTUP_CHECK = yes + # Build Options # comment out to disable the options. # From e0e390bf9f139384a70b5c8e203bf40491ca6232 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 16 Jul 2019 18:55:59 +0200 Subject: [PATCH 35/68] Better and improved support for Bluetooth, with automatic switching --- keyboards/anne_pro/anne_pro.c | 116 ++++++++--- keyboards/anne_pro/anne_pro.h | 17 +- keyboards/anne_pro/anne_pro_bluetooth.c | 207 +++++++++++++++++++- keyboards/anne_pro/anne_pro_bluetooth.h | 8 + keyboards/anne_pro/anne_pro_lighting.c | 20 ++ keyboards/anne_pro/anne_pro_lighting.h | 3 + keyboards/anne_pro/keymaps/arrow/keymap.c | 13 +- keyboards/anne_pro/keymaps/default/keymap.c | 13 +- keyboards/anne_pro/keymaps/macos/keymap.c | 13 +- 9 files changed, 373 insertions(+), 37 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index afce4f39c57..36f21b11951 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -20,11 +20,6 @@ #include "ch.h" #include "hal.h" -#ifdef NKRO_ENABLE -static bool nkro_enabled_last = false; -#endif -static host_driver_t *host_driver_last; - /* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { /* Update the key status for the reactive effects */ @@ -55,29 +50,106 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { anne_pro_lighting_mode_next(); } return false; - case APB_TOG: - /* Toggle the output driver between USB and Bluetooth */ + case APB_OFF: + /* Turn off Bluetooth */ if (record->event.pressed) { - if (host_get_driver() != &anne_pro_bluetooth_driver) { - clear_keyboard(); - host_driver_last = host_get_driver(); -#ifdef NKRO_ENABLE - nkro_enabled_last = keymap_config.nkro; - keymap_config.nkro = false; -#endif - host_set_driver(&anne_pro_bluetooth_driver); + anne_pro_bluetooth_off(); + } + return false; + case APB_ON: + /* Turn on Bluetooth, if on start broadcasting */ + if (record->event.pressed) { + if (!anne_pro_bluetooth_enabled()) { anne_pro_bluetooth_on(); - anne_pro_bluetooth_broadcast(); } else { - clear_keyboard(); -#ifdef NKRO_ENABLE - keymap_config.nkro = nkro_enabled_last; -#endif - host_set_driver(host_driver_last); - anne_pro_bluetooth_off(); + anne_pro_bluetooth_broadcast(); } } return false; + case APB_LGC: + /* Toggle Bluetooth legacy mode */ + if (record->event.pressed) { + anne_pro_bluetooth_legacy_toggle(); + } + return false; + case APB_HLQ: + /* Query hostlist */ + if (record->event.pressed) { + anne_pro_bluetooth_hostlist_query(); + } + return false; + case APB_HC1: + /* Connect saved host 1 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_connect(1); + } + return false; + case APB_HC2: + /* Connect saved host 2 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_connect(2); + } + return false; + case APB_HC3: + /* Connect saved host 3 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_connect(3); + } + return false; + case APB_HC4: + /* Connect saved host 4 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_connect(4); + } + return false; + case APB_HS1: + /* Save connected host 1 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_save(1); + } + return false; + case APB_HS2: + /* Save connected host 2 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_save(2); + } + return false; + case APB_HS3: + /* Save connected host 3 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_save(3); + } + return false; + case APB_HS4: + /* Save connected host 4 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_save(4); + } + return false; + case APB_HD1: + /* Delete saved host 1 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_delete(1); + } + return false; + case APB_HD2: + /* Delete saved host 2 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_delete(2); + } + return false; + case APB_HD3: + /* Delete saved host 3 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_delete(3); + } + return false; + case APB_HD4: + /* Delete saved host 4 */ + if (record->event.pressed) { + anne_pro_bluetooth_host_delete(4); + } + return false; default: /* Handle other keycodes normally */ return process_record_user(keycode, record); diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 984a2ad4bcc..6973b5f1755 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -23,7 +23,22 @@ enum anne_pro_keycodes { APL_RAT, APL_BRT, APL_MOD, - APB_TOG, + APB_OFF, + APB_ON, + APB_LGC, + APB_HLQ, + APB_HC1, + APB_HC2, + APB_HC3, + APB_HC4, + APB_HS1, + APB_HS2, + APB_HS3, + APB_HS4, + APB_HD1, + APB_HD2, + APB_HD3, + APB_HD4, }; /* The fully-featured LAYOUT() that has every single key available in the matrix. */ diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index a5dc94dba80..3465fa84a2d 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -15,10 +15,12 @@ */ #include "anne_pro_bluetooth.h" +#include "anne_pro_lighting.h" #include "uart_tx_ringbuf.h" #include "host.h" #include "host_driver.h" +#define BLUETOOTH_LAYER 3 #define BLUETOOTH_UART (&UARTD2) /* UART transmission ringbuffer for the Bluetooth UART */ static uint8_t bluetooth_uart_tx_buffer[256] = {0}; @@ -69,23 +71,87 @@ static UARTConfig bluetooth_uart_cfg = { .cr3 = 0 }; +/* Bluetooth processor state */ +static bool bluetooth_enabled = false; +static volatile bool bluetooth_legacy = false; +static volatile uint8_t bluetooth_saved_hosts = 0; +static volatile uint8_t bluetooth_connected_host = 0; + +/* State for lighting effect when opening the bluetooth layer */ +static bool bluetooth_layer_enabled = false; +static bool lighting_before_bluetooth_layer = false; +/* Handle when layers are switched */ +uint32_t layer_state_set_kb(uint32_t state) { + if (!bluetooth_layer_enabled && (state & (1 << BLUETOOTH_LAYER)) != 0) { + /* Bluetooth layer turned on */ + lighting_before_bluetooth_layer = anne_pro_lighting_enabled(); + bluetooth_layer_enabled = true; + if (!lighting_before_bluetooth_layer) { + anne_pro_lighting_on(); + } + anne_pro_bluetooth_lighting_update(); + } else if (bluetooth_layer_enabled && (state & (1 << BLUETOOTH_LAYER)) == 0) { + /* Bluetooth layer turned off */ + bluetooth_layer_enabled = false; + if (!lighting_before_bluetooth_layer) { + anne_pro_lighting_off(); + } else { + anne_pro_lighting_mode_last(); + } + } + + return layer_state_set_user(state); +} + +/* Save state for QMK HID driver */ +#ifdef NKRO_ENABLE +static bool nkro_enabled_last = false; +#endif +static host_driver_t *host_driver_last; + +/* Enable the Bluetooth HID driver */ +static void driver_enable_bluetooth(void) { + /* Skip if the driver is already enabled */ + if (host_get_driver() == &anne_pro_bluetooth_driver) return; + + clear_keyboard(); + host_driver_last = host_get_driver(); +#ifdef NKRO_ENABLE + nkro_enabled_last = keymap_config.nkro; + keymap_config.nkro = false; +#endif + host_set_driver(&anne_pro_bluetooth_driver); +} + +/* Enable the last HID driver */ +static void driver_enable_last(void) { + /* Skip if the driver is already enabled */ + if (host_get_driver() != &anne_pro_bluetooth_driver) return; + + clear_keyboard(); +#ifdef NKRO_ENABLE + keymap_config.nkro = nkro_enabled_last; +#endif + host_set_driver(host_driver_last); +} + /* Receive buffer for the Bluetooth UART */ uint8_t bluetooth_rx_buffer[256] = {0}; size_t bluetooth_rx_index = 0; -/* Lookup table for translation to hex */ -char hex_lookup[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; - /* Handle packets from the bluetooth receive buffer */ void bluetooth_handle_packet(void) { /* Packet type and length */ uint8_t packet_type = bluetooth_rx_buffer[0]; - // uint8_t packet_len = bluetooth_rx_buffer[1]; + uint8_t packet_len = bluetooth_rx_buffer[1]; + uint8_t message_type = bluetooth_rx_buffer[2]; + uint8_t data_len = packet_len - 1; + uint8_t *packet_data = &bluetooth_rx_buffer[3]; /* Handle incomming packets over Bluetooth */ switch (packet_type) { case 2: // System - switch (bluetooth_rx_buffer[2]) { + switch (message_type) { case 1: // GetId // [2, 15, 129, 10, 2, 0, 1, 2, 50, 55, 71, 1, 50, 48] // [2, 15, 129, 8, 2, 1, 54, 48, 52, 0, 54, 0, 50, 48] @@ -94,6 +160,43 @@ void bluetooth_handle_packet(void) { break; } break; + case 6: // BLE + switch (message_type) { + case 13: // Pair + if (bluetooth_connected_host == 0) { + /* Connected, turn to bluetooth */ + bluetooth_connected_host = 12; + driver_enable_bluetooth(); + layer_off(BLUETOOTH_LAYER); + } + break; + case 133: // AckDeleteHost + /* Update the hostlist information when a saved host is deleted */ + anne_pro_bluetooth_hostlist_query(); + break; + case 134: // AckHostListQuery + if (data_len == 3) { + if (bluetooth_connected_host == 0 && packet_data[1] != 0) { + /* Connected, turn to bluetooth */ + driver_enable_bluetooth(); + } else if (bluetooth_connected_host != 0 && packet_data[1] == 0) { + /* Disconnected, turn off bluetooth */ + driver_enable_last(); + } + + /* Save the hostlist query information */ + bluetooth_saved_hosts = packet_data[0]; + bluetooth_connected_host = packet_data[1]; + bluetooth_legacy = (packet_data[2] != 0); + + /* Update lighting if the bluetooth layer is active */ + if (bluetooth_layer_enabled) { + anne_pro_bluetooth_lighting_update(); + } + } + break; + } + break; } } @@ -126,11 +229,31 @@ void anne_pro_bluetooth_init(void) { /* Turn on Bluetooth */ void anne_pro_bluetooth_on(void) { uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x01"); + bluetooth_enabled = true; } /* Turn off Bluetooth */ void anne_pro_bluetooth_off(void) { + /* When there is a connection disable it first, otherwise switching drivers + will reactivate the Bluetooth controller */ + if (bluetooth_connected_host != 0) { + /* Disconnected, turn off bluetooth */ + bluetooth_connected_host = 0; + driver_enable_last(); + + if (bluetooth_layer_enabled) { + anne_pro_bluetooth_lighting_update(); + } + } + + /* Disable the Bluetooth controller */ uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x02"); + bluetooth_enabled = false; +} + +/* Query if Bluetooth is enabled */ +bool anne_pro_bluetooth_enabled(void) { + return bluetooth_enabled; } /* Start broadcasting on Bluetooth */ @@ -138,6 +261,80 @@ void anne_pro_bluetooth_broadcast(void) { uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x07"); } +/* Turn Bluetooth legacy mode on or off */ +void anne_pro_bluetooth_legacy(bool enable) { + uint8_t buf[] = {6, 2, 12, enable ? 1 : 0}; + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 4, buf); + bluetooth_legacy = enable; +} + +/* Toggle Bluetooth legacy mode */ +void anne_pro_bluetooth_legacy_toggle(void) { + anne_pro_bluetooth_legacy(!bluetooth_legacy); +} + +/* Connect to a saved host */ +void anne_pro_bluetooth_host_connect(uint8_t host) { + uint8_t buf[] = {6, 2, 4, host}; + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 4, buf); +} + +/* Save the current host into a slot */ +void anne_pro_bluetooth_host_save(uint8_t host) { + uint8_t buf[] = {6, 2, 3, host}; + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 4, buf); +} + +/* Delete the host from a slot */ +void anne_pro_bluetooth_host_delete(uint8_t host) { + uint8_t buf[] = {6, 2, 5, host}; + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 4, buf); +} + +/* Query the hostlist of the Bluetooth controller */ +void anne_pro_bluetooth_hostlist_query(void) { + uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 3, "\x06\x01\x06"); +} + +/* Update the lighting effect for the Bluetooth layer */ +void anne_pro_bluetooth_lighting_update(void) { + /* Status of host 1 */ + uint8_t r1 = (bluetooth_connected_host != 1) ? 255 : 0; + uint8_t g1 = (bluetooth_connected_host == 1 || bluetooth_saved_hosts & (1 << 0)) ? 255 : 0; + /* Status of host 2 */ + uint8_t r2 = (bluetooth_connected_host != 2) ? 255 : 0; + uint8_t g2 = (bluetooth_connected_host == 2 || bluetooth_saved_hosts & (1 << 1)) ? 255 : 0; + /* Status of host 3 */ + uint8_t r3 = (bluetooth_connected_host != 3) ? 255 : 0; + uint8_t g3 = (bluetooth_connected_host == 3 || bluetooth_saved_hosts & (1 << 2)) ? 255 : 0; + /* Status of host 4 */ + uint8_t r4 = (bluetooth_connected_host != 4) ? 255 : 0; + uint8_t g4 = (bluetooth_connected_host == 4 || bluetooth_saved_hosts & (1 << 3)) ? 255 : 0; + /* Legacy mode? */ + uint8_t leg = (bluetooth_legacy) ? 255 : 0; + /* Bluetooth driver selected? */ + bool connected = (bluetooth_connected_host != 0); + bool drvr = (host_get_driver() == &anne_pro_bluetooth_driver); + + /* Payload for the lighting effect */ + uint8_t keybuf[] = { + 0, drvr ? 0 : 255, connected ? 255 : 0, drvr ? 255 : 0, 1, // ESC-key + 1, r1, g1, 0, 1, // 1-key + 2, r2, g2, 0, 1, // 2-key + 3, r3, g3, 0, 1, // 3-key + 4, r4, g4, 0, 1, // 4-key + 10, leg, 255, 0, 1, // 0-key (legacy) + 11, 255, 0, 0, 1, // '-'-key (off) + 12, 0, 255, 0, 2, // '='-key (on) + }; + + anne_pro_lighting_set_keys(8, keybuf); +} + +/* + Anne Pro Bluetooth HID driver for QMK + */ + /* Status of keyboard leds for Bluetooth driver*/ static uint8_t keyboard_leds(void) { return 0; diff --git a/keyboards/anne_pro/anne_pro_bluetooth.h b/keyboards/anne_pro/anne_pro_bluetooth.h index 130adedc11d..be402c08636 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.h +++ b/keyboards/anne_pro/anne_pro_bluetooth.h @@ -24,4 +24,12 @@ void anne_pro_bluetooth_update(void); void anne_pro_bluetooth_on(void); void anne_pro_bluetooth_off(void); +bool anne_pro_bluetooth_enabled(void); void anne_pro_bluetooth_broadcast(void); +void anne_pro_bluetooth_legacy(bool enable); +void anne_pro_bluetooth_legacy_toggle(void); +void anne_pro_bluetooth_host_connect(uint8_t host); +void anne_pro_bluetooth_host_save(uint8_t host); +void anne_pro_bluetooth_host_delete(uint8_t host); +void anne_pro_bluetooth_hostlist_query(void); +void anne_pro_bluetooth_lighting_update(void); diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index effa04640e7..886350bf092 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -132,6 +132,11 @@ void anne_pro_lighting_off(void) { writePinLow(C15); } +/* Is the lighting enabled? */ +bool anne_pro_lighting_enabled(void) { + return leds_enabled; +} + /* Select the next effect rate */ void anne_pro_lighting_rate_next(void) { if (leds_enabled) { @@ -162,6 +167,13 @@ void anne_pro_lighting_mode(uint8_t mode) { } } +/* Set the lighting mode to the last lighting mode */ +void anne_pro_lighting_mode_last(void) { + if (leds_enabled) { + uart_tx_ringbuf_write(&led_uart_ringbuf, 3, "\x09\x01\x01"); + } +} + /* Set the rate and brightness */ void anne_pro_lighting_rate_brightness(uint8_t rate, uint8_t brightness) { if (leds_enabled) { @@ -172,3 +184,11 @@ void anne_pro_lighting_rate_brightness(uint8_t rate, uint8_t brightness) { uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } } + +/* Set lighting for individual keys, this takes number of keys and a payload + that describes which keys and the colors of those keys */ +void anne_pro_lighting_set_keys(uint8_t keys, uint8_t *payload) { + uint8_t buf[] = {9, 3 + 5 * keys, 11, 202, keys}; + uart_tx_ringbuf_write(&led_uart_ringbuf, 5, buf); + uart_tx_ringbuf_write(&led_uart_ringbuf, 5 * keys, payload); +} diff --git a/keyboards/anne_pro/anne_pro_lighting.h b/keyboards/anne_pro/anne_pro_lighting.h index e2e6bcd171a..29b93b74a83 100644 --- a/keyboards/anne_pro/anne_pro_lighting.h +++ b/keyboards/anne_pro/anne_pro_lighting.h @@ -44,8 +44,11 @@ void anne_pro_lighting_update_dynamic(keyrecord_t *record); void anne_pro_lighting_toggle(void); void anne_pro_lighting_on(void); void anne_pro_lighting_off(void); +bool anne_pro_lighting_enabled(void); void anne_pro_lighting_rate_next(void); void anne_pro_lighting_brightness_next(void); void anne_pro_lighting_mode_next(void); void anne_pro_lighting_mode(uint8_t mode); +void anne_pro_lighting_mode_last(void); void anne_pro_lighting_rate_brightness(uint8_t speed, uint8_t brightness); +void anne_pro_lighting_set_keys(uint8_t keys, uint8_t *payload); diff --git a/keyboards/anne_pro/keymaps/arrow/keymap.c b/keyboards/anne_pro/keymaps/arrow/keymap.c index 0f602fe321d..0072dd5c103 100644 --- a/keyboards/anne_pro/keymaps/arrow/keymap.c +++ b/keyboards/anne_pro/keymaps/arrow/keymap.c @@ -29,14 +29,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_SLSH, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_SLSH, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ - ) + ), + [3] = LAYOUT( + TG(3), APB_HC1, APB_HC2, APB_HC3, APB_HC4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, APB_LGC, APB_OFF, APB_ON, XXXXXXX, + XXXXXXX, APB_HS1, APB_HS2, APB_HS3, APB_HS4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, APB_HD1, APB_HD2, APB_HD3, APB_HD4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_HLQ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), }; diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index 8c6581f2175..45911fbb628 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -29,14 +29,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ - ) + ), + [3] = LAYOUT( + TG(3), APB_HC1, APB_HC2, APB_HC3, APB_HC4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, APB_LGC, APB_OFF, APB_ON, XXXXXXX, + XXXXXXX, APB_HS1, APB_HS2, APB_HS3, APB_HS4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, APB_HD1, APB_HD2, APB_HD3, APB_HD4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_HLQ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), }; diff --git a/keyboards/anne_pro/keymaps/macos/keymap.c b/keyboards/anne_pro/keymaps/macos/keymap.c index bf71f9e47cc..8cf76484e24 100644 --- a/keyboards/anne_pro/keymaps/macos/keymap.c +++ b/keyboards/anne_pro/keymaps/macos/keymap.c @@ -29,14 +29,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, - _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, - APB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ - ) + ), + [3] = LAYOUT( + TG(3), APB_HC1, APB_HC2, APB_HC3, APB_HC4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, APB_LGC, APB_OFF, APB_ON, XXXXXXX, + XXXXXXX, APB_HS1, APB_HS2, APB_HS3, APB_HS4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, APB_HD1, APB_HD2, APB_HD3, APB_HD4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_HLQ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), }; From d2af9f9442c6f06735d21fcae9d4eb5424bea301 Mon Sep 17 00:00:00 2001 From: Vitya Angelov Date: Sat, 20 Jul 2019 14:05:59 +0300 Subject: [PATCH 36/68] AP2 layout with media keys (#4) * add tap ap2 feature. add ap2-like backlight control. fixel win layout key location * media keyzzz, brightness fix * Revert "media keyzzz, brightness fix" This reverts commit d875c06c77c1132d47921edf5c21f3af758e2a0a. * media keyzzz, some fixes, manual * 1 * Update manual.txt * Update manual.txt * Upload * Delete readme.md * Delete readme.md * Add files via upload * Update readme.md * Update readme.md * Create readme.md * Update readme.md * Update readme.md * Update readme.md * update * update --- .../anne_pro/keymaps/anne-pro-2-mac/keymap.c | 51 +++++++++++++++++++ .../anne_pro/keymaps/anne-pro-2-mac/readme.md | 45 ++++++++++++++++ .../anne_pro/keymaps/anne-pro-2-win/keymap.c | 51 +++++++++++++++++++ .../anne_pro/keymaps/anne-pro-2-win/readme.md | 45 ++++++++++++++++ 4 files changed, 192 insertions(+) create mode 100644 keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c create mode 100644 keyboards/anne_pro/keymaps/anne-pro-2-mac/readme.md create mode 100644 keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c create mode 100644 keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c new file mode 100644 index 00000000000..5879660ad7b --- /dev/null +++ b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +/* Anne Pro 2 MacOS layout +Includes Media Keys and TAP features, see readme.md */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + 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, MT(MOD_RSFT, KC_UP), + KC_LCTL, KC_LALT, KC_LGUI, KC_SPACE, KC_LALT, LT(1,KC_LEFT), LT(2,KC_DOWN), MT(MOD_RCTL, KC_RGHT) + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [2] = LAYOUT( + RESET, KC_MSTP, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [3] = LAYOUT( + TG(3), APB_HC1, APB_HC2, APB_HC3, APB_HC4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, APB_LGC, APB_OFF, APB_ON, XXXXXXX, + XXXXXXX, APB_HS1, APB_HS2, APB_HS3, APB_HS4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, APB_HD1, APB_HD2, APB_HD3, APB_HD4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_HLQ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), +}; diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-mac/readme.md b/keyboards/anne_pro/keymaps/anne-pro-2-mac/readme.md new file mode 100644 index 00000000000..9c96f871415 --- /dev/null +++ b/keyboards/anne_pro/keymaps/anne-pro-2-mac/readme.md @@ -0,0 +1,45 @@ +# Anne Pro 2 MAC keymap + +### This keymap adds TAP, Media Keys features and AP2-like backlight control. +### Maintainer: [angelokofficial](https://github.com/angelokofficial) + + +__Keys:__ + +ANNE+0 - off/on the backlight +ANNE+9 - switch the backlight profile +ANNE + =/+ - increases brightness +ANNE + - -/_ - changes backlight speed +ANNE+ESC - reset the keyboard (instead of button on the back side) +ANNE+ESC+hold ESC - enter to the bootloader (DFU) mode + +__TAP:__ + +Right Shift - up arrow +ANNE - down arrow +FN - left arrow +Right CTRL - right arrow + + +__Bluetooth:__ + +Fn+B - enter BT mode +=/+ - turn ON BT +-/_ - turn OFF BT +0 - enter legacy BT mode +1,2,3,4 - should work as bt profiles for switch among connected devices + + +**Media keys:** + +ANNE+1 - stop +ANNE+2 - volume down +ANNE+3 - volume up +ANNE+4 - previous track +ANNE+5 - pause/play +ANNE+6 - next track +ANNE+7 - mute/unmute volume + + +All other keys remain on their own places. +To compile: `make anne_pro:` diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c new file mode 100644 index 00000000000..90b4488b868 --- /dev/null +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c @@ -0,0 +1,51 @@ +/* Copyright 2019 Michiel Visser + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include QMK_KEYBOARD_H + +/* Anne Pro 2 default layout +Includes Media Keys and TAP features, see readme.md */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT( + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, + 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, MT(MOD_RSFT, KC_UP), + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_LALT, LT(1,KC_LEFT), LT(2,KC_DOWN), MT(MOD_RCTL, KC_RGHT) + ), + [1] = LAYOUT( + KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [2] = LAYOUT( + RESET, KC_MSTP, KC_VOLD, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, + _______, _______, _______, XXXXXXX, _______, _______, _______, _______ + ), + [3] = LAYOUT( + TG(3), APB_HC1, APB_HC2, APB_HC3, APB_HC4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, APB_LGC, APB_OFF, APB_ON, XXXXXXX, + XXXXXXX, APB_HS1, APB_HS2, APB_HS3, APB_HS4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, APB_HD1, APB_HD2, APB_HD3, APB_HD4, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + APB_HLQ, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX + ), +}; diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md b/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md new file mode 100644 index 00000000000..9aa90526259 --- /dev/null +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md @@ -0,0 +1,45 @@ +# Anne Pro 2 Windows keymap + +### This keymap adds TAP, Media Keys features and AP2-like backlight control. +### Maintainer: [angelokofficial](https://github.com/angelokofficial) + + +__Keys:__ + +ANNE+0 - off/on the backlight +ANNE+9 - switch the backlight profile +ANNE + =/+ - increases brightness +ANNE + - -/_ - changes backlight speed +ANNE+ESC - reset the keyboard (instead of button on the back side) +ANNE+ESC+hold ESC - enter to the bootloader (DFU) mode + +__TAP:__ + +Right Shift - up arrow +ANNE - down arrow +FN - left arrow +Right CTRL - right arrow + + +__Bluetooth:__ + +Fn+B - enter BT mode +=/+ - turn ON BT +-/_ - turn OFF BT +0 - enter legacy BT mode +1,2,3,4 - should work as bt profiles for switch among connected devices + + +**Media keys:** + +ANNE+1 - stop +ANNE+2 - volume down +ANNE+3 - volume up +ANNE+4 - previous track +ANNE+5 - pause/play +ANNE+6 - next track +ANNE+7 - mute/unmute volume + + +All other keys remain on their own places. +To compile: `make anne_pro:` From af8d448fcf48e7d5c02e6949ca98a858997920f0 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 23 Jul 2019 14:12:55 +0200 Subject: [PATCH 37/68] Add basic keyboard idling feature (resolves #3) --- keyboards/anne_pro/anne_pro.c | 1 + keyboards/anne_pro/anne_pro_lighting.c | 46 ++++++++++++++++++++++++++ keyboards/anne_pro/anne_pro_lighting.h | 1 + keyboards/anne_pro/config.h | 6 ++++ 4 files changed, 54 insertions(+) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 36f21b11951..0fd6b304cc4 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -24,6 +24,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { /* Update the key status for the reactive effects */ anne_pro_lighting_update_dynamic(record); + anne_pro_lighting_update_timeout(record); switch (keycode) { case APL_RGB: diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 886350bf092..6659dd1a53a 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -50,6 +50,19 @@ static UARTConfig led_uart_cfg = { .cr3 = 0 }; +/* Timer to keep track of seconds, this allows the backlight timeout */ +static virtual_timer_t seconds_timer; +static volatile uint32_t seconds_timer_counter = 0; + +/* Timer callback to update the seconds timer */ +static void update_seconds_timer(void *p) { + chSysLockFromISR(); + chVTSetI(&seconds_timer, MS2ST(1000), update_seconds_timer, p); + chSysUnlockFromISR(); + + seconds_timer_counter++; +} + /* State of the leds on the keyboard */ static volatile bool leds_enabled = false; @@ -62,6 +75,9 @@ void anne_pro_lighting_init(void) { uartStart(LED_UART, &led_uart_cfg); palSetPadMode(GPIOB, 10, PAL_MODE_ALTERNATE(7)); palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); + + /* Enable the seconds timer for backlight timeout */ + chVTSet(&seconds_timer, MS2ST(1000), update_seconds_timer, NULL); } /* Buffer for the keystate packet */ @@ -93,8 +109,38 @@ void anne_pro_lighting_update_dynamic(keyrecord_t *record) { } } + +/* Timer keeping track of the last keypress */ +static uint32_t last_keypress_timer = 0; +/* Was the lighting turned off by the timeout */ +static bool turned_off_by_timeout = false; + +/* Update the last keypress timer when a key is pressed */ +void anne_pro_lighting_update_timeout(keyrecord_t *record) { + /* Make sure this is actually a keypress event */ + if (IS_NOEVENT(record->event)) return; + + if (record->event.pressed) { + /* Update the last keypress timer */ + last_keypress_timer = seconds_timer_counter; + + /* If the lighting was turned off by a timeout, turn it back on */ + if (turned_off_by_timeout) { + anne_pro_lighting_on(); + turned_off_by_timeout = false; + } + } +} + /* Update lighting, should be called every matrix scan */ void anne_pro_lighting_update(void) { + /* If the backlight in on, and the last keypress timeout is hit */ + if (leds_enabled && (seconds_timer_counter - last_keypress_timer) >= BACKLIGHT_TIMEOUT) { + /* Turn off the backlight */ + anne_pro_lighting_off(); + turned_off_by_timeout = true; + } + if (!uart_tx_ringbuf_empty(&led_uart_ringbuf)) { uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } diff --git a/keyboards/anne_pro/anne_pro_lighting.h b/keyboards/anne_pro/anne_pro_lighting.h index 29b93b74a83..749ab5b6c23 100644 --- a/keyboards/anne_pro/anne_pro_lighting.h +++ b/keyboards/anne_pro/anne_pro_lighting.h @@ -41,6 +41,7 @@ void anne_pro_lighting_init(void); void anne_pro_lighting_update(void); void anne_pro_lighting_update_dynamic(keyrecord_t *record); +void anne_pro_lighting_update_timeout(keyrecord_t *record); void anne_pro_lighting_toggle(void); void anne_pro_lighting_on(void); void anne_pro_lighting_off(void); diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 6381084dcaf..fdd468edb0d 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -37,6 +37,12 @@ /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 +/* + * Timeout after which the backlight of the keyboard is disabled if no keypresses are received. + * If this feature is not needed you can set the timeout to UINT32_MAX, this is more than 100 years. + */ +#define BACKLIGHT_TIMEOUT 60 + /* * Force NKRO * From e684aaf38c06c77e61448bb471a1dcc85972bbed Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 23 Sep 2019 23:26:41 +0200 Subject: [PATCH 38/68] Start sending Bluetooth keystrokes directly This was added to support the SEND_STRING macros, which send all keystrokes at once without returning to the matrix update loop, which meant the update function did not run and the transmission buffer was not emptied. However, if you would like to use SEND_STRING macros with this commit you still need to use the delayed version, otherwise you will overwhelm the Bluetooth UART connection with keystrokes. Example: ``` send_string_with_delay_P(PSTR("QMK is the best thing ever!"), 50); ``` --- keyboards/anne_pro/anne_pro_bluetooth.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index 3465fa84a2d..2058abf11e4 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -349,6 +349,12 @@ static void send_keyboard(report_keyboard_t *report) { bluetooth_report[5+i] = report->keys[i]; } uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 11, bluetooth_report); + /* If the Bluetooth UART is currently not sending anything, start sending */ + if (bluetooth_uart_ringbuf.sending_elements == 0) { + if (bluetooth_wakeup() == MSG_OK) { + uart_tx_ringbuf_start_transmission(&bluetooth_uart_ringbuf); + } + } } /* Send mouse HID report for Bluetooth driver */ From 14b98e8d2fd374dbd21b4e3b755c1d008917f7f6 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 23 Sep 2019 23:58:24 +0200 Subject: [PATCH 39/68] Add note about correct branch to readme --- keyboards/anne_pro/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 3f43f0c55b9..a6e36de7c60 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -10,6 +10,10 @@ Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) +Make sure you check out the correct branch for this keyboard! + + git checkout anne_pro + Before building the firmware for this keyboard submodules have to be loaded and a patch has to be applied: make git-submodule From 53c28ed79941c714cb2e4d65076d59925467f4fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Carlsson?= Date: Mon, 21 Oct 2019 21:02:13 +0200 Subject: [PATCH 40/68] Added NEW_SAFE_RANGE for keymap specific keycodes (#9) --- keyboards/anne_pro/anne_pro.h | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 6973b5f1755..f156bedf226 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -39,6 +39,7 @@ enum anne_pro_keycodes { APB_HD2, APB_HD3, APB_HD4, + NEW_SAFE_RANGE, }; /* The fully-featured LAYOUT() that has every single key available in the matrix. */ From 6904400fc8c95936c237c0788309c860792fd351 Mon Sep 17 00:00:00 2001 From: Diego Lhambi Pereira Date: Mon, 21 Oct 2019 16:07:22 -0300 Subject: [PATCH 41/68] Configured System Tick to work properly (#12) --- keyboards/anne_pro/chconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/chconf.h b/keyboards/anne_pro/chconf.h index dfb1f9dfb9e..285b5e2ede1 100644 --- a/keyboards/anne_pro/chconf.h +++ b/keyboards/anne_pro/chconf.h @@ -48,7 +48,7 @@ * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ -#define CH_CFG_ST_FREQUENCY 2000 +#define CH_CFG_ST_FREQUENCY 1000 /** * @brief Time delta constant for the tick-less mode. From f300e684f36184b0240a159c88a1965fa5c18348 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Mon, 21 Oct 2019 21:08:44 +0200 Subject: [PATCH 42/68] Fix right ALT on Anne Pro 2 Windows layout (fixes #13) --- keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c index 90b4488b868..698febe779d 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c @@ -25,7 +25,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 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_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, MT(MOD_RSFT, KC_UP), - KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_LALT, LT(1,KC_LEFT), LT(2,KC_DOWN), MT(MOD_RCTL, KC_RGHT) + KC_LCTL, KC_LGUI, KC_LALT, KC_SPACE, KC_RALT, LT(1,KC_LEFT), LT(2,KC_DOWN), MT(MOD_RCTL, KC_RGHT) ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, From 11a97745e1885fb9040693e8358eebb8e3abf3e7 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 26 Nov 2019 12:14:52 +0100 Subject: [PATCH 43/68] Revert "Start sending Bluetooth keystrokes directly" (fixes #14) This reverts commit 2dde284d1738c451f98505d6b961dbf3858e224a. These changes are reverted as they caused the Bluetooth pairing to break. A different solution will have to be found, as Bluetooth is currently completely unusable with this change. --- keyboards/anne_pro/anne_pro_bluetooth.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index 2058abf11e4..3465fa84a2d 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -349,12 +349,6 @@ static void send_keyboard(report_keyboard_t *report) { bluetooth_report[5+i] = report->keys[i]; } uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 11, bluetooth_report); - /* If the Bluetooth UART is currently not sending anything, start sending */ - if (bluetooth_uart_ringbuf.sending_elements == 0) { - if (bluetooth_wakeup() == MSG_OK) { - uart_tx_ringbuf_start_transmission(&bluetooth_uart_ringbuf); - } - } } /* Send mouse HID report for Bluetooth driver */ From 30b781b196add051174aeba4dcd66ac87e3abaac Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Thu, 28 Nov 2019 17:35:14 +0100 Subject: [PATCH 44/68] Add documentation to the three default keymaps --- keyboards/anne_pro/keymaps/arrow/readme.md | 22 ++++++++++++++++++++ keyboards/anne_pro/keymaps/default/readme.md | 22 ++++++++++++++++++++ keyboards/anne_pro/keymaps/macos/readme.md | 22 ++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 keyboards/anne_pro/keymaps/arrow/readme.md create mode 100644 keyboards/anne_pro/keymaps/default/readme.md create mode 100644 keyboards/anne_pro/keymaps/macos/readme.md diff --git a/keyboards/anne_pro/keymaps/arrow/readme.md b/keyboards/anne_pro/keymaps/arrow/readme.md new file mode 100644 index 00000000000..87ff650b8dc --- /dev/null +++ b/keyboards/anne_pro/keymaps/arrow/readme.md @@ -0,0 +1,22 @@ +# Anne Pro Arrow keymap + +### Maintainer: [msvisser](https://github.com/msvisser) + +This keymap is the arrows keymap supplied on the original Anne Pro firmware. +However the interface for Bluetooth is changed slightly. + +### Bluetooth +To enable the Bluetooht layer press `FN+B`. + +While in the Bluetooth layer: +- `ESC` - Exit Bluetooth layer +- `1, 2, 3, 4` - Connect to saved profile +- `Q, W, E, R` - Save connection to profile +- `A, S, D, F` - Delete saved connection +- `0` - Toggle legacy Bluetooth mode +- `-` - Disable Bluetooth +- `+` - Enable Bluetooth + +Finally the lighting on the `ESC` key tries to indicate the connection status +of the Bluetooth. However this might sometimes go out of sync. To update the +connection status press the left `CTRL` key. diff --git a/keyboards/anne_pro/keymaps/default/readme.md b/keyboards/anne_pro/keymaps/default/readme.md new file mode 100644 index 00000000000..1d2aa725b92 --- /dev/null +++ b/keyboards/anne_pro/keymaps/default/readme.md @@ -0,0 +1,22 @@ +# Anne Pro Default (Windows) keymap + +### Maintainer: [msvisser](https://github.com/msvisser) + +This keymap is the default Windows keymap supplied on the original Anne Pro +firmware. However the interface for Bluetooth is changed slightly. + +### Bluetooth +To enable the Bluetooht layer press `FN+B`. + +While in the Bluetooth layer: +- `ESC` - Exit Bluetooth layer +- `1, 2, 3, 4` - Connect to saved profile +- `Q, W, E, R` - Save connection to profile +- `A, S, D, F` - Delete saved connection +- `0` - Toggle legacy Bluetooth mode +- `-` - Disable Bluetooth +- `+` - Enable Bluetooth + +Finally the lighting on the `ESC` key tries to indicate the connection status +of the Bluetooth. However this might sometimes go out of sync. To update the +connection status press the left `CTRL` key. diff --git a/keyboards/anne_pro/keymaps/macos/readme.md b/keyboards/anne_pro/keymaps/macos/readme.md new file mode 100644 index 00000000000..1fca1acad85 --- /dev/null +++ b/keyboards/anne_pro/keymaps/macos/readme.md @@ -0,0 +1,22 @@ +# Anne Pro macOS keymap + +### Maintainer: [msvisser](https://github.com/msvisser) + +This keymap is the macOS keymap supplied on the original Anne Pro firmware. +However the interface for Bluetooth is changed slightly. + +### Bluetooth +To enable the Bluetooht layer press `FN+B`. + +While in the Bluetooth layer: +- `ESC` - Exit Bluetooth layer +- `1, 2, 3, 4` - Connect to saved profile +- `Q, W, E, R` - Save connection to profile +- `A, S, D, F` - Delete saved connection +- `0` - Toggle legacy Bluetooth mode +- `-` - Disable Bluetooth +- `+` - Enable Bluetooth + +Finally the lighting on the `ESC` key tries to indicate the connection status +of the Bluetooth. However this might sometimes go out of sync. To update the +connection status press the left `CTRL` key. From 72d7374ffc32f8ee5e2a19150b112d3ad81fec18 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Thu, 28 Nov 2019 17:56:47 +0100 Subject: [PATCH 45/68] Remove trailing whitespace from some documents --- keyboards/anne_pro/README.md | 4 +- .../anne_pro/keymaps/anne-pro-2-win/readme.md | 50 +++++++++---------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index a6e36de7c60..db93120f7e3 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -6,8 +6,8 @@ QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.ob __This firmware is not created or supported by the creator of this keyboard!__ -Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) -Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) +Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) +Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) Make sure you check out the correct branch for this keyboard! diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md b/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md index 9aa90526259..b471d6d019d 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/readme.md @@ -1,45 +1,45 @@ -# Anne Pro 2 Windows keymap +# Anne Pro 2 Windows keymap -### This keymap adds TAP, Media Keys features and AP2-like backlight control. +### This keymap adds TAP, Media Keys features and AP2-like backlight control. ### Maintainer: [angelokofficial](https://github.com/angelokofficial) __Keys:__ -ANNE+0 - off/on the backlight -ANNE+9 - switch the backlight profile -ANNE + =/+ - increases brightness -ANNE + - -/_ - changes backlight speed -ANNE+ESC - reset the keyboard (instead of button on the back side) -ANNE+ESC+hold ESC - enter to the bootloader (DFU) mode +ANNE+0 - off/on the backlight +ANNE+9 - switch the backlight profile +ANNE + =/+ - increases brightness +ANNE + - -/_ - changes backlight speed +ANNE+ESC - reset the keyboard (instead of button on the back side) +ANNE+ESC+hold ESC - enter to the bootloader (DFU) mode __TAP:__ -Right Shift - up arrow -ANNE - down arrow -FN - left arrow -Right CTRL - right arrow +Right Shift - up arrow +ANNE - down arrow +FN - left arrow +Right CTRL - right arrow __Bluetooth:__ -Fn+B - enter BT mode -=/+ - turn ON BT --/_ - turn OFF BT -0 - enter legacy BT mode -1,2,3,4 - should work as bt profiles for switch among connected devices +Fn+B - enter BT mode +=/+ - turn ON BT +-/_ - turn OFF BT +0 - enter legacy BT mode +1,2,3,4 - should work as bt profiles for switch among connected devices **Media keys:** -ANNE+1 - stop -ANNE+2 - volume down -ANNE+3 - volume up -ANNE+4 - previous track -ANNE+5 - pause/play -ANNE+6 - next track -ANNE+7 - mute/unmute volume +ANNE+1 - stop +ANNE+2 - volume down +ANNE+3 - volume up +ANNE+4 - previous track +ANNE+5 - pause/play +ANNE+6 - next track +ANNE+7 - mute/unmute volume -All other keys remain on their own places. +All other keys remain on their own places. To compile: `make anne_pro:` From 47438f8e1d314a3360d37af087d1aa3b55d99780 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Thu, 28 Nov 2019 18:02:18 +0100 Subject: [PATCH 46/68] Change the style on some comments --- keyboards/anne_pro/anne_pro_bluetooth.c | 34 +++++++++++++------------ 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index 3465fa84a2d..e4bc84acde1 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -150,19 +150,21 @@ void bluetooth_handle_packet(void) { /* Handle incomming packets over Bluetooth */ switch (packet_type) { - case 2: // System + case 2: /* System packet */ switch (message_type) { - case 1: // GetId - // [2, 15, 129, 10, 2, 0, 1, 2, 50, 55, 71, 1, 50, 48] - // [2, 15, 129, 8, 2, 1, 54, 48, 52, 0, 54, 0, 50, 48] + case 1: /* GetId */ + /* These two buffers of data were extracted from the original Anne Pro firmware + however the exact meaning of all fields is unknown. + [2, 15, 129, 10, 2, 0, 1, 2, 50, 55, 71, 1, 50, 48] + [2, 15, 129, 8, 2, 1, 54, 48, 52, 0, 54, 0, 50, 48] */ uart_tx_ringbuf_write(&bluetooth_uart_ringbuf, 28, "\x02\x0f\x81\x0a\x02\x00\x01\x02\x32\x37\x47\x01\x32\x30" "\x02\x0f\x81\x08\x02\x01\x36\x30\x34\x00\x36\x00\x32\x30"); break; } break; - case 6: // BLE + case 6: /* Bluetooth packet */ switch (message_type) { - case 13: // Pair + case 13: /* Pair request */ if (bluetooth_connected_host == 0) { /* Connected, turn to bluetooth */ bluetooth_connected_host = 12; @@ -170,11 +172,11 @@ void bluetooth_handle_packet(void) { layer_off(BLUETOOTH_LAYER); } break; - case 133: // AckDeleteHost + case 133: /* AckDeleteHost */ /* Update the hostlist information when a saved host is deleted */ anne_pro_bluetooth_hostlist_query(); break; - case 134: // AckHostListQuery + case 134: /* AckHostListQuery */ if (data_len == 3) { if (bluetooth_connected_host == 0 && packet_data[1] != 0) { /* Connected, turn to bluetooth */ @@ -318,14 +320,14 @@ void anne_pro_bluetooth_lighting_update(void) { /* Payload for the lighting effect */ uint8_t keybuf[] = { - 0, drvr ? 0 : 255, connected ? 255 : 0, drvr ? 255 : 0, 1, // ESC-key - 1, r1, g1, 0, 1, // 1-key - 2, r2, g2, 0, 1, // 2-key - 3, r3, g3, 0, 1, // 3-key - 4, r4, g4, 0, 1, // 4-key - 10, leg, 255, 0, 1, // 0-key (legacy) - 11, 255, 0, 0, 1, // '-'-key (off) - 12, 0, 255, 0, 2, // '='-key (on) + 0, drvr ? 0 : 255, connected ? 255 : 0, drvr ? 255 : 0, 1, /* ESC-key */ + 1, r1, g1, 0, 1, /* 1-key */ + 2, r2, g2, 0, 1, /* 2-key */ + 3, r3, g3, 0, 1, /* 3-key */ + 4, r4, g4, 0, 1, /* 4-key */ + 10, leg, 255, 0, 1, /* 0-key (legacy) */ + 11, 255, 0, 0, 1, /* '-'-key (off) */ + 12, 0, 255, 0, 2, /* '='-key (on) */ }; anne_pro_lighting_set_keys(8, keybuf); From 1a8cb4bfa7596f99188377750db180f0f87a6653 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Thu, 28 Nov 2019 18:04:28 +0100 Subject: [PATCH 47/68] Fix DFU packer python script for python3 (fixes #10) --- keyboards/anne_pro/dfuse-pack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/dfuse-pack.py b/keyboards/anne_pro/dfuse-pack.py index 199ac70f148..257ba4f57e9 100755 --- a/keyboards/anne_pro/dfuse-pack.py +++ b/keyboards/anne_pro/dfuse-pack.py @@ -140,7 +140,7 @@ if __name__=="__main__": try: address = address & 0xFFFFFFFF except ValueError: - print "Address %s invalid." % address + print("Address %s invalid." % address) sys.exit(1) target.append({ 'address': address, 'data': ih.tobinstr(start=address, end=end-1)}) From 40f823988753ea9598eab5abb50188086e40bce1 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Tue, 30 Jun 2020 21:05:46 +0200 Subject: [PATCH 48/68] Try to get AP1 working with new ChibiOS --- keyboards/anne_pro/anne_pro_lighting.c | 4 +- .../boards/STM32L151_ANNE_PRO/board.c | 155 ++++++++++- keyboards/anne_pro/chconf.h | 226 ++++++++++++++-- keyboards/anne_pro/config.h | 1 + keyboards/anne_pro/halconf.h | 254 ++++++++++++++---- 5 files changed, 560 insertions(+), 80 deletions(-) diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 6659dd1a53a..c8bbb66c5f3 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -57,7 +57,7 @@ static volatile uint32_t seconds_timer_counter = 0; /* Timer callback to update the seconds timer */ static void update_seconds_timer(void *p) { chSysLockFromISR(); - chVTSetI(&seconds_timer, MS2ST(1000), update_seconds_timer, p); + chVTSetI(&seconds_timer, TIME_MS2I(1000), update_seconds_timer, p); chSysUnlockFromISR(); seconds_timer_counter++; @@ -77,7 +77,7 @@ void anne_pro_lighting_init(void) { palSetPadMode(GPIOB, 11, PAL_MODE_ALTERNATE(7)); /* Enable the seconds timer for backlight timeout */ - chVTSet(&seconds_timer, MS2ST(1000), update_seconds_timer, NULL); + chVTSet(&seconds_timer, TIME_MS2I(1000), update_seconds_timer, NULL); } /* Buffer for the keystate packet */ diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c index bb32b59416f..bafd95f7beb 100644 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio + 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. @@ -20,14 +20,76 @@ */ #include "hal.h" +#include "stm32_gpio.h" + +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported variables. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver local variables and types. */ +/*===========================================================================*/ -#if HAL_USE_PAL || defined(__DOXYGEN__) /** - * @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. + * @brief Type of STM32 GPIO port setup. */ -const PALConfig pal_default_config = { +typedef struct { + uint32_t moder; + uint32_t otyper; + uint32_t ospeedr; + uint32_t pupdr; + uint32_t odr; + uint32_t afrl; + uint32_t afrh; +} gpio_setup_t; + +/** + * @brief Type of STM32 GPIO initialization data. + */ +typedef struct { +#if STM32_HAS_GPIOA || defined(__DOXYGEN__) + gpio_setup_t PAData; +#endif +#if STM32_HAS_GPIOB || defined(__DOXYGEN__) + gpio_setup_t PBData; +#endif +#if STM32_HAS_GPIOC || defined(__DOXYGEN__) + gpio_setup_t PCData; +#endif +#if STM32_HAS_GPIOD || defined(__DOXYGEN__) + gpio_setup_t PDData; +#endif +#if STM32_HAS_GPIOE || defined(__DOXYGEN__) + gpio_setup_t PEData; +#endif +#if STM32_HAS_GPIOF || defined(__DOXYGEN__) + gpio_setup_t PFData; +#endif +#if STM32_HAS_GPIOG || defined(__DOXYGEN__) + gpio_setup_t PGData; +#endif +#if STM32_HAS_GPIOH || defined(__DOXYGEN__) + gpio_setup_t PHData; +#endif +#if STM32_HAS_GPIOI || defined(__DOXYGEN__) + gpio_setup_t PIData; +#endif +#if STM32_HAS_GPIOJ || defined(__DOXYGEN__) + gpio_setup_t PJData; +#endif +#if STM32_HAS_GPIOK || defined(__DOXYGEN__) + gpio_setup_t PKData; +#endif +} gpio_config_t; + +/** + * @brief STM32 GPIO static initialization data. + */ +static const gpio_config_t gpio_default_config = { #if STM32_HAS_GPIOA {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, @@ -62,15 +124,88 @@ const PALConfig pal_default_config = { #endif #if STM32_HAS_GPIOI {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, - VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} + VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, +#endif +#if STM32_HAS_GPIOJ + {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, + VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, +#endif +#if STM32_HAS_GPIOK + {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, + VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} #endif }; + +/*===========================================================================*/ +/* Driver local functions. */ +/*===========================================================================*/ + +static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { + + gpiop->OTYPER = config->otyper; + gpiop->OSPEEDR = config->ospeedr; + gpiop->PUPDR = config->pupdr; + gpiop->ODR = config->odr; + gpiop->AFRL = config->afrl; + gpiop->AFRH = config->afrh; + gpiop->MODER = config->moder; +} + +static void stm32_gpio_init(void) { + + /* Enabling GPIO-related clocks, the mask comes from the + registry header file.*/ + rccResetAHB(STM32_GPIO_EN_MASK); + rccEnableAHB(STM32_GPIO_EN_MASK, true); + + /* Initializing all the defined GPIO ports.*/ +#if STM32_HAS_GPIOA + gpio_init(GPIOA, &gpio_default_config.PAData); #endif +#if STM32_HAS_GPIOB + gpio_init(GPIOB, &gpio_default_config.PBData); +#endif +#if STM32_HAS_GPIOC + gpio_init(GPIOC, &gpio_default_config.PCData); +#endif +#if STM32_HAS_GPIOD + gpio_init(GPIOD, &gpio_default_config.PDData); +#endif +#if STM32_HAS_GPIOE + gpio_init(GPIOE, &gpio_default_config.PEData); +#endif +#if STM32_HAS_GPIOF + gpio_init(GPIOF, &gpio_default_config.PFData); +#endif +#if STM32_HAS_GPIOG + gpio_init(GPIOG, &gpio_default_config.PGData); +#endif +#if STM32_HAS_GPIOH + gpio_init(GPIOH, &gpio_default_config.PHData); +#endif +#if STM32_HAS_GPIOI + gpio_init(GPIOI, &gpio_default_config.PIData); +#endif +#if STM32_HAS_GPIOJ + gpio_init(GPIOJ, &gpio_default_config.PJData); +#endif +#if STM32_HAS_GPIOK + gpio_init(GPIOK, &gpio_default_config.PKData); +#endif +} + +/*===========================================================================*/ +/* Driver interrupt handlers. */ +/*===========================================================================*/ + +/*===========================================================================*/ +/* Driver exported functions. */ +/*===========================================================================*/ /** * @brief Early initialization code. - * @details This initialization must be performed just after stack setup - * and before any other initialization. + * @details GPIO ports and system clocks are initialized before everything + * else. */ void __early_init(void) { /* Disable all external interrupt vectors, they are left enabled by the bootloader */ @@ -82,6 +217,7 @@ void __early_init(void) { nvicDisableVector(EXTI9_5_IRQn); nvicDisableVector(EXTI15_10_IRQn); + stm32_gpio_init(); stm32_clock_init(); } @@ -134,4 +270,5 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) { * @todo Add your board-specific code, if any. */ void boardInit(void) { + } diff --git a/keyboards/anne_pro/chconf.h b/keyboards/anne_pro/chconf.h index 285b5e2ede1..b4a16d83e1f 100644 --- a/keyboards/anne_pro/chconf.h +++ b/keyboards/anne_pro/chconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + 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. @@ -15,7 +15,7 @@ */ /** - * @file templates/chconf.h + * @file rt/templates/chconf.h * @brief Configuration file template. * @details A copy of this file must be placed in each project directory, it * contains the application specific kernel settings. @@ -29,6 +29,7 @@ #define CHCONF_H #define _CHIBIOS_RT_CONF_ +#define _CHIBIOS_RT_CONF_VER_6_0_ /*===========================================================================*/ /** @@ -41,14 +42,34 @@ * @brief System time counter resolution. * @note Allowed values are 16 or 32 bits. */ +#if !defined(CH_CFG_ST_RESOLUTION) #define CH_CFG_ST_RESOLUTION 16 +#endif /** * @brief System tick frequency. * @details Frequency of the system timer that drives the system ticks. This * setting also defines the system tick time unit. */ +#if !defined(CH_CFG_ST_FREQUENCY) #define CH_CFG_ST_FREQUENCY 1000 +#endif + +/** + * @brief Time intervals data size. + * @note Allowed values are 16, 32 or 64 bits. + */ +#if !defined(CH_CFG_INTERVALS_SIZE) +#define CH_CFG_INTERVALS_SIZE 32 +#endif + +/** + * @brief Time types data size. + * @note Allowed values are 16 or 32 bits. + */ +#if !defined(CH_CFG_TIME_TYPES_SIZE) +#define CH_CFG_TIME_TYPES_SIZE 32 +#endif /** * @brief Time delta constant for the tick-less mode. @@ -58,7 +79,9 @@ * The value one is not valid, timeouts are rounded up to * this value. */ +#if !defined(CH_CFG_ST_TIMEDELTA) #define CH_CFG_ST_TIMEDELTA 2 +#endif /** @} */ @@ -81,7 +104,9 @@ * @note The round robin preemption is not supported in tickless mode and * must be set to zero in that case. */ +#if !defined(CH_CFG_TIME_QUANTUM) #define CH_CFG_TIME_QUANTUM 0 +#endif /** * @brief Managed RAM size. @@ -94,7 +119,9 @@ * provide the @p __heap_base__ and @p __heap_end__ symbols. * @note Requires @p CH_CFG_USE_MEMCORE. */ +#if !defined(CH_CFG_MEMCORE_SIZE) #define CH_CFG_MEMCORE_SIZE 0 +#endif /** * @brief Idle thread automatic spawn suppression. @@ -103,11 +130,9 @@ * function becomes the idle thread and must implement an * infinite loop. */ +#if !defined(CH_CFG_NO_IDLE_THREAD) #define CH_CFG_NO_IDLE_THREAD FALSE - -/* Use __WFI in the idle thread for waiting. Does lower the power - * consumption. */ -#define CORTEX_ENABLE_WFI_IDLE TRUE +#endif /** @} */ @@ -126,7 +151,9 @@ * @note This is not related to the compiler optimization options. * @note The default is @p TRUE. */ +#if !defined(CH_CFG_OPTIMIZE_SPEED) #define CH_CFG_OPTIMIZE_SPEED TRUE +#endif /** @} */ @@ -144,7 +171,9 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_TM FALSE +#if !defined(CH_CFG_USE_TM) +#define CH_CFG_USE_TM TRUE +#endif /** * @brief Threads registry APIs. @@ -152,7 +181,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_REGISTRY) #define CH_CFG_USE_REGISTRY TRUE +#endif /** * @brief Threads synchronization APIs. @@ -161,7 +192,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_WAITEXIT) #define CH_CFG_USE_WAITEXIT TRUE +#endif /** * @brief Semaphores APIs. @@ -169,7 +202,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_SEMAPHORES) #define CH_CFG_USE_SEMAPHORES TRUE +#endif /** * @brief Semaphores queuing mode. @@ -180,7 +215,9 @@ * requirements. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE +#endif /** * @brief Mutexes APIs. @@ -188,7 +225,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MUTEXES) #define CH_CFG_USE_MUTEXES TRUE +#endif /** * @brief Enables recursive behavior on mutexes. @@ -198,7 +237,9 @@ * @note The default is @p FALSE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE +#endif /** * @brief Conditional Variables APIs. @@ -208,7 +249,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_MUTEXES. */ +#if !defined(CH_CFG_USE_CONDVARS) #define CH_CFG_USE_CONDVARS TRUE +#endif /** * @brief Conditional Variables APIs with timeout. @@ -218,7 +261,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_CONDVARS. */ -#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE +#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) +#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE +#endif /** * @brief Events Flags APIs. @@ -226,7 +271,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_EVENTS) #define CH_CFG_USE_EVENTS TRUE +#endif /** * @brief Events Flags APIs with timeout. @@ -236,7 +283,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_EVENTS. */ +#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) #define CH_CFG_USE_EVENTS_TIMEOUT TRUE +#endif /** * @brief Synchronous Messages APIs. @@ -245,7 +294,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MESSAGES) #define CH_CFG_USE_MESSAGES TRUE +#endif /** * @brief Synchronous Messages queuing mode. @@ -256,7 +307,9 @@ * requirements. * @note Requires @p CH_CFG_USE_MESSAGES. */ +#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) #define CH_CFG_USE_MESSAGES_PRIORITY FALSE +#endif /** * @brief Mailboxes APIs. @@ -266,7 +319,9 @@ * @note The default is @p TRUE. * @note Requires @p CH_CFG_USE_SEMAPHORES. */ +#if !defined(CH_CFG_USE_MAILBOXES) #define CH_CFG_USE_MAILBOXES TRUE +#endif /** * @brief Core Memory Manager APIs. @@ -275,7 +330,9 @@ * * @note The default is @p TRUE. */ +#if !defined(CH_CFG_USE_MEMCORE) #define CH_CFG_USE_MEMCORE TRUE +#endif /** * @brief Heap Allocator APIs. @@ -287,7 +344,9 @@ * @p CH_CFG_USE_SEMAPHORES. * @note Mutexes are recommended. */ +#if !defined(CH_CFG_USE_HEAP) #define CH_CFG_USE_HEAP TRUE +#endif /** * @brief Memory Pools Allocator APIs. @@ -296,7 +355,31 @@ * * @note The default is @p TRUE. */ -#define CH_CFG_USE_MEMPOOLS FALSE +#if !defined(CH_CFG_USE_MEMPOOLS) +#define CH_CFG_USE_MEMPOOLS TRUE +#endif + +/** + * @brief Objects FIFOs APIs. + * @details If enabled then the objects FIFOs APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_OBJ_FIFOS) +#define CH_CFG_USE_OBJ_FIFOS TRUE +#endif + +/** + * @brief Pipes APIs. + * @details If enabled then the pipes APIs are included + * in the kernel. + * + * @note The default is @p TRUE. + */ +#if !defined(CH_CFG_USE_PIPES) +#define CH_CFG_USE_PIPES TRUE +#endif /** * @brief Dynamic Threads APIs. @@ -307,7 +390,80 @@ * @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. */ -#define CH_CFG_USE_DYNAMIC FALSE +#if !defined(CH_CFG_USE_DYNAMIC) +#define CH_CFG_USE_DYNAMIC TRUE +#endif + +/** @} */ + +/*===========================================================================*/ +/** + * @name Objects factory options + * @{ + */ +/*===========================================================================*/ + +/** + * @brief Objects Factory APIs. + * @details If enabled then the objects factory APIs are included in the + * kernel. + * + * @note The default is @p FALSE. + */ +#if !defined(CH_CFG_USE_FACTORY) +#define CH_CFG_USE_FACTORY TRUE +#endif + +/** + * @brief Maximum length for object names. + * @details If the specified length is zero then the name is stored by + * pointer but this could have unintended side effects. + */ +#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) +#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 +#endif + +/** + * @brief Enables the registry of generic objects. + */ +#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) +#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE +#endif + +/** + * @brief Enables factory for generic buffers. + */ +#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) +#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE +#endif + +/** + * @brief Enables factory for semaphores. + */ +#if !defined(CH_CFG_FACTORY_SEMAPHORES) +#define CH_CFG_FACTORY_SEMAPHORES TRUE +#endif + +/** + * @brief Enables factory for mailboxes. + */ +#if !defined(CH_CFG_FACTORY_MAILBOXES) +#define CH_CFG_FACTORY_MAILBOXES TRUE +#endif + +/** + * @brief Enables factory for objects FIFOs. + */ +#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) +#define CH_CFG_FACTORY_OBJ_FIFOS TRUE +#endif + +/** + * @brief Enables factory for Pipes. + */ +#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) +#define CH_CFG_FACTORY_PIPES TRUE +#endif /** @} */ @@ -323,7 +479,9 @@ * * @note The default is @p FALSE. */ +#if !defined(CH_DBG_STATISTICS) #define CH_DBG_STATISTICS FALSE +#endif /** * @brief Debug option, system state check. @@ -332,7 +490,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_SYSTEM_STATE_CHECK FALSE +#if !defined(CH_DBG_SYSTEM_STATE_CHECK) +#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#endif /** * @brief Debug option, parameters checks. @@ -341,7 +501,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_CHECKS FALSE +#if !defined(CH_DBG_ENABLE_CHECKS) +#define CH_DBG_ENABLE_CHECKS TRUE +#endif /** * @brief Debug option, consistency checks. @@ -351,7 +513,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_ENABLE_ASSERTS FALSE +#if !defined(CH_DBG_ENABLE_ASSERTS) +#define CH_DBG_ENABLE_ASSERTS TRUE +#endif /** * @brief Debug option, trace buffer. @@ -359,14 +523,18 @@ * * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED +#if !defined(CH_DBG_TRACE_MASK) +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#endif /** * @brief Trace buffer entries. * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * different from @p CH_DBG_TRACE_MASK_DISABLED. */ +#if !defined(CH_DBG_TRACE_BUFFER_SIZE) #define CH_DBG_TRACE_BUFFER_SIZE 128 +#endif /** * @brief Debug option, stack checks. @@ -378,7 +546,9 @@ * @note The default failure mode is to halt the system with the global * @p panic_msg variable set to @p NULL. */ -#define CH_DBG_ENABLE_STACK_CHECK FALSE +#if !defined(CH_DBG_ENABLE_STACK_CHECK) +#define CH_DBG_ENABLE_STACK_CHECK TRUE +#endif /** * @brief Debug option, stacks initialization. @@ -388,7 +558,9 @@ * * @note The default is @p FALSE. */ -#define CH_DBG_FILL_THREADS FALSE +#if !defined(CH_DBG_FILL_THREADS) +#define CH_DBG_FILL_THREADS TRUE +#endif /** * @brief Debug option, threads profiling. @@ -399,7 +571,9 @@ * @note This debug option is not currently compatible with the * tickless mode. */ +#if !defined(CH_DBG_THREADS_PROFILING) #define CH_DBG_THREADS_PROFILING FALSE +#endif /** @} */ @@ -410,6 +584,22 @@ */ /*===========================================================================*/ +/** + * @brief System structure extension. + * @details User fields added to the end of the @p ch_system_t structure. + */ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ + /* Add threads custom fields here.*/ + +/** + * @brief System initialization hook. + * @details User initialization code added to the @p chSysInit() function + * just before interrupts are enabled globally. + */ +#define CH_CFG_SYSTEM_INIT_HOOK() { \ + /* Add threads initialization code here.*/ \ +} + /** * @brief Threads descriptor structure extension. * @details User fields added to the end of the @p thread_t structure. @@ -419,9 +609,9 @@ /** * @brief Threads initialization hook. - * @details User initialization code added to the @p chThdInit() API. + * @details User initialization code added to the @p _thread_init() function. * - * @note It is invoked from within @p chThdInit() and implicitly from all + * @note It is invoked from within @p _thread_init() and implicitly from all * the threads creation APIs. */ #define CH_CFG_THREAD_INIT_HOOK(tp) { \ diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index fdd468edb0d..c89c4545117 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -33,6 +33,7 @@ #define MATRIX_ROW_PINS { B9, B8, B7, B6, A0 } #define MATRIX_COL_PINS { A5, A6, A7, B0, B1, B12, B13, B14, A8, A9, A15, B3, B4, B5 } +#define DIODE_DIRECTION COL2ROW /* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ #define DEBOUNCE 5 diff --git a/keyboards/anne_pro/halconf.h b/keyboards/anne_pro/halconf.h index 1a6f22bac1e..e953b926fb5 100644 --- a/keyboards/anne_pro/halconf.h +++ b/keyboards/anne_pro/halconf.h @@ -1,5 +1,5 @@ /* - ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio + 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. @@ -25,8 +25,11 @@ * @{ */ -#ifndef _HALCONF_H_ -#define _HALCONF_H_ +#ifndef HALCONF_H +#define HALCONF_H + +#define _CHIBIOS_HAL_CONF_ +#define _CHIBIOS_HAL_CONF_VER_7_0_ #include "mcuconf.h" @@ -34,140 +37,181 @@ * @brief Enables the PAL subsystem. */ #if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE +#define HAL_USE_PAL TRUE #endif /** * @brief Enables the ADC subsystem. */ #if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -#define HAL_USE_ADC FALSE +#define HAL_USE_ADC FALSE #endif /** * @brief Enables the CAN subsystem. */ #if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN FALSE +#define HAL_USE_CAN FALSE +#endif + +/** + * @brief Enables the cryptographic subsystem. + */ +#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) +#define HAL_USE_CRY FALSE #endif /** * @brief Enables the DAC subsystem. */ #if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) -#define HAL_USE_DAC FALSE -#endif - -/** - * @brief Enables the EXT subsystem. - */ -#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) -#define HAL_USE_EXT FALSE +#define HAL_USE_DAC FALSE #endif /** * @brief Enables the GPT subsystem. */ #if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT FALSE +#define HAL_USE_GPT FALSE #endif /** * @brief Enables the I2C subsystem. */ #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) -#define HAL_USE_I2C FALSE +#define HAL_USE_I2C FALSE #endif /** * @brief Enables the I2S subsystem. */ #if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE +#define HAL_USE_I2S FALSE #endif /** * @brief Enables the ICU subsystem. */ #if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU FALSE +#define HAL_USE_ICU FALSE #endif /** * @brief Enables the MAC subsystem. */ #if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE +#define HAL_USE_MAC FALSE #endif /** * @brief Enables the MMC_SPI subsystem. */ #if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI FALSE +#define HAL_USE_MMC_SPI FALSE #endif /** * @brief Enables the PWM subsystem. */ #if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) -#define HAL_USE_PWM FALSE +#define HAL_USE_PWM FALSE #endif /** * @brief Enables the RTC subsystem. */ #if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) -#define HAL_USE_RTC FALSE +#define HAL_USE_RTC FALSE #endif /** * @brief Enables the SDC subsystem. */ #if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -#define HAL_USE_SDC FALSE +#define HAL_USE_SDC FALSE #endif /** * @brief Enables the SERIAL subsystem. */ #if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL FALSE +#define HAL_USE_SERIAL FALSE #endif /** * @brief Enables the SERIAL over USB subsystem. */ #if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB FALSE +#define HAL_USE_SERIAL_USB TRUE +#endif + +/** + * @brief Enables the SIO subsystem. + */ +#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) +#define HAL_USE_SIO FALSE #endif /** * @brief Enables the SPI subsystem. */ #if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) -#define HAL_USE_SPI FALSE +#define HAL_USE_SPI FALSE +#endif + +/** + * @brief Enables the TRNG subsystem. + */ +#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) +#define HAL_USE_TRNG FALSE #endif /** * @brief Enables the UART subsystem. */ #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) -#define HAL_USE_UART TRUE +#define HAL_USE_UART TRUE #endif /** * @brief Enables the USB subsystem. */ #if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE +#define HAL_USE_USB TRUE #endif /** * @brief Enables the WDG subsystem. */ #if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) -#define HAL_USE_WDG FALSE +#define HAL_USE_WDG FALSE +#endif + +/** + * @brief Enables the WSPI subsystem. + */ +#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) +#define HAL_USE_WSPI FALSE +#endif + +/*===========================================================================*/ +/* PAL driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) +#define PAL_USE_CALLBACKS TRUE +#endif + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) +#define PAL_USE_WAIT TRUE #endif /*===========================================================================*/ @@ -179,7 +223,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE +#define ADC_USE_WAIT TRUE #endif /** @@ -187,7 +231,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE +#define ADC_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ @@ -198,7 +242,56 @@ * @brief Sleep mode related APIs inclusion switch. */ #if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE +#define CAN_USE_SLEEP_MODE TRUE +#endif + +/** + * @brief Enforces the driver to use direct callbacks rather than OSAL events. + */ +#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) +#define CAN_ENFORCE_USE_CALLBACKS FALSE +#endif + +/*===========================================================================*/ +/* CRY driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables the SW fall-back of the cryptographic driver. + * @details When enabled, this option, activates a fall-back software + * implementation for algorithms not supported by the underlying + * hardware. + * @note Fall-back implementations may not be present for all algorithms. + */ +#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) +#define HAL_CRY_USE_FALLBACK FALSE +#endif + +/** + * @brief Makes the driver forcibly use the fall-back implementations. + */ +#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) +#define HAL_CRY_ENFORCE_FALLBACK FALSE +#endif + +/*===========================================================================*/ +/* DAC driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) +#define DAC_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define DAC_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ @@ -209,7 +302,7 @@ * @brief Enables the mutual exclusion APIs on the I2C bus. */ #if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE +#define I2C_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ @@ -217,17 +310,17 @@ /*===========================================================================*/ /** - * @brief Enables an event sources for incoming packets. + * @brief Enables the zero-copy API. */ #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE +#define MAC_USE_ZERO_COPY TRUE #endif /** * @brief Enables an event sources for incoming packets. */ #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE +#define MAC_USE_EVENTS TRUE #endif /*===========================================================================*/ @@ -243,7 +336,7 @@ * use a DMA channel and heavily loads the CPU. */ #if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE +#define MMC_NICE_WAITING TRUE #endif /*===========================================================================*/ @@ -255,7 +348,7 @@ * @note Attempts are performed at 10mS intervals. */ #if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) -#define SDC_INIT_RETRY 100 +#define SDC_INIT_RETRY 100 #endif /** @@ -264,7 +357,7 @@ * at @p FALSE. */ #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) -#define SDC_MMC_SUPPORT FALSE +#define SDC_MMC_SUPPORT TRUE #endif /** @@ -274,7 +367,21 @@ * lower priority, this may slow down the driver a bit however. */ #if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) -#define SDC_NICE_WAITING TRUE +#define SDC_NICE_WAITING TRUE +#endif + +/** + * @brief OCR initialization constant for V20 cards. + */ +#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) +#define SDC_INIT_OCR_V20 0x50FF8000U +#endif + +/** + * @brief OCR initialization constant for non-V20 cards. + */ +#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) +#define SDC_INIT_OCR 0x80100000U #endif /*===========================================================================*/ @@ -287,18 +394,18 @@ * default configuration. */ #if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SERIAL_DEFAULT_BITRATE 38400 +#define SERIAL_DEFAULT_BITRATE 38400 #endif /** * @brief Serial buffers size. * @details Configuration parameter, you can change the depth of the queue * buffers depending on the requirements of your application. - * @note The default is 64 bytes for both the transmission and receive + * @note The default is 16 bytes for both the transmission and receive * buffers. */ #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 +#define SERIAL_BUFFERS_SIZE 16 #endif /*===========================================================================*/ @@ -309,11 +416,19 @@ * @brief Serial over USB buffers size. * @details Configuration parameter, the buffer size must be a multiple of * the USB data endpoint maximum packet size. - * @note The default is 64 bytes for both the transmission and receive + * @note The default is 256 bytes for both the transmission and receive * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 1 +#define SERIAL_USB_BUFFERS_SIZE 256 +#endif + +/** + * @brief Serial over USB number of buffers. + * @note The default is 2 buffers. + */ +#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) +#define SERIAL_USB_BUFFERS_NUMBER 2 #endif /*===========================================================================*/ @@ -325,15 +440,32 @@ * @note Disabling this option saves both code and data space. */ #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE +#define SPI_USE_WAIT TRUE #endif +/** + * @brief Enables circular transfers APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) +#define SPI_USE_CIRCULAR FALSE +#endif + + /** * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @note Disabling this option saves both code and data space. */ #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE +#define SPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +/** + * @brief Handling method for SPI CS line. + * @note Disabling this option saves both code and data space. + */ +#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) +#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD #endif /*===========================================================================*/ @@ -345,7 +477,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) -#define UART_USE_WAIT TRUE +#define UART_USE_WAIT TRUE #endif /** @@ -353,7 +485,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define UART_USE_MUTUAL_EXCLUSION FALSE +#define UART_USE_MUTUAL_EXCLUSION TRUE #endif /*===========================================================================*/ @@ -365,9 +497,29 @@ * @note Disabling this option saves both code and data space. */ #if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT TRUE +#define USB_USE_WAIT TRUE #endif -#endif /* _HALCONF_H_ */ +/*===========================================================================*/ +/* WSPI driver related settings. */ +/*===========================================================================*/ + +/** + * @brief Enables synchronous APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) +#define WSPI_USE_WAIT TRUE +#endif + +/** + * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. + * @note Disabling this option saves both code and data space. + */ +#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) +#define WSPI_USE_MUTUAL_EXCLUSION TRUE +#endif + +#endif /* HALCONF_H */ /** @} */ From 3b7ae8592f1734d664a9feb034dbe38bbedf6942 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 13:19:21 +0200 Subject: [PATCH 49/68] Disable the EEPROM driver The keyboard seemed to get stuck somewhere inside the EEPROM driver. Since the keyboard currently does not use the EEPROM I have disabled it for now. This needs further investigation. --- keyboards/anne_pro/rules.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index d322adb9afc..d1c063c60d8 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -35,3 +35,4 @@ NO_USB_STARTUP_CHECK = yes MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control NKRO_ENABLE = yes # USB Nkey Rollover +EEPROM_DRIVER = transient From b9c2a827ad23e73b322f3301195aa846ea2299fe Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 13:19:44 +0200 Subject: [PATCH 50/68] Disable a bunch of debugging options --- keyboards/anne_pro/chconf.h | 12 ++++++------ keyboards/anne_pro/halconf.h | 26 +++++++++++++------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/keyboards/anne_pro/chconf.h b/keyboards/anne_pro/chconf.h index b4a16d83e1f..07ab82bd405 100644 --- a/keyboards/anne_pro/chconf.h +++ b/keyboards/anne_pro/chconf.h @@ -491,7 +491,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_SYSTEM_STATE_CHECK) -#define CH_DBG_SYSTEM_STATE_CHECK TRUE +#define CH_DBG_SYSTEM_STATE_CHECK FALSE #endif /** @@ -502,7 +502,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_CHECKS) -#define CH_DBG_ENABLE_CHECKS TRUE +#define CH_DBG_ENABLE_CHECKS FALSE #endif /** @@ -514,7 +514,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_ENABLE_ASSERTS) -#define CH_DBG_ENABLE_ASSERTS TRUE +#define CH_DBG_ENABLE_ASSERTS FALSE #endif /** @@ -524,7 +524,7 @@ * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. */ #if !defined(CH_DBG_TRACE_MASK) -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #endif /** @@ -547,7 +547,7 @@ * @p panic_msg variable set to @p NULL. */ #if !defined(CH_DBG_ENABLE_STACK_CHECK) -#define CH_DBG_ENABLE_STACK_CHECK TRUE +#define CH_DBG_ENABLE_STACK_CHECK FALSE #endif /** @@ -559,7 +559,7 @@ * @note The default is @p FALSE. */ #if !defined(CH_DBG_FILL_THREADS) -#define CH_DBG_FILL_THREADS TRUE +#define CH_DBG_FILL_THREADS FALSE #endif /** diff --git a/keyboards/anne_pro/halconf.h b/keyboards/anne_pro/halconf.h index e953b926fb5..e3040fc8390 100644 --- a/keyboards/anne_pro/halconf.h +++ b/keyboards/anne_pro/halconf.h @@ -203,7 +203,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS TRUE +#define PAL_USE_CALLBACKS FALSE #endif /** @@ -223,7 +223,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT TRUE +#define ADC_USE_WAIT FALSE #endif /** @@ -231,7 +231,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION TRUE +#define ADC_USE_MUTUAL_EXCLUSION FALSE #endif /*===========================================================================*/ @@ -283,7 +283,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) -#define DAC_USE_WAIT TRUE +#define DAC_USE_WAIT FALSE #endif /** @@ -291,7 +291,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define DAC_USE_MUTUAL_EXCLUSION TRUE +#define DAC_USE_MUTUAL_EXCLUSION FALSE #endif /*===========================================================================*/ @@ -313,14 +313,14 @@ * @brief Enables the zero-copy API. */ #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY TRUE +#define MAC_USE_ZERO_COPY FALSE #endif /** * @brief Enables an event sources for incoming packets. */ #if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS TRUE +#define MAC_USE_EVENTS FALSE #endif /*===========================================================================*/ @@ -357,7 +357,7 @@ * at @p FALSE. */ #if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) -#define SDC_MMC_SUPPORT TRUE +#define SDC_MMC_SUPPORT FALSE #endif /** @@ -440,7 +440,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT TRUE +#define SPI_USE_WAIT FALSE #endif /** @@ -457,7 +457,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION TRUE +#define SPI_USE_MUTUAL_EXCLUSION FALSE #endif /** @@ -485,7 +485,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define UART_USE_MUTUAL_EXCLUSION TRUE +#define UART_USE_MUTUAL_EXCLUSION FALSE #endif /*===========================================================================*/ @@ -509,7 +509,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) -#define WSPI_USE_WAIT TRUE +#define WSPI_USE_WAIT FALSE #endif /** @@ -517,7 +517,7 @@ * @note Disabling this option saves both code and data space. */ #if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define WSPI_USE_MUTUAL_EXCLUSION TRUE +#define WSPI_USE_MUTUAL_EXCLUSION FALSE #endif #endif /* HALCONF_H */ From 92ad5cb9451d4c5da2f2c6174286a0c3724016f1 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 13:23:22 +0200 Subject: [PATCH 51/68] Enable low power idle mode --- keyboards/anne_pro/rules.mk | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index d1c063c60d8..b794f5223df 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -36,3 +36,6 @@ MOUSEKEY_ENABLE = no # Mouse keys EXTRAKEY_ENABLE = yes # Audio control and System control NKRO_ENABLE = yes # USB Nkey Rollover EEPROM_DRIVER = transient + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE From 110bc54b24b13b5564de39197f532a3bb9071a5f Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 13:25:58 +0200 Subject: [PATCH 52/68] Remove ChibiOS patch and update README --- keyboards/anne_pro/README.md | 6 +----- keyboards/anne_pro/apply_patch.sh | 3 --- keyboards/anne_pro/chibios_stm32l151.patch | 15 --------------- 3 files changed, 1 insertion(+), 23 deletions(-) delete mode 100755 keyboards/anne_pro/apply_patch.sh delete mode 100644 keyboards/anne_pro/chibios_stm32l151.patch diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index db93120f7e3..a863dd2110d 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -10,14 +10,10 @@ Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) -Make sure you check out the correct branch for this keyboard! +Make sure you check out the correct branch for this keyboard and initialize the submodules! git checkout anne_pro - -Before building the firmware for this keyboard submodules have to be loaded and a patch has to be applied: - make git-submodule - ./keyboards/anne_pro/apply_patch.sh Make example for this keyboard (after setting up your build environment): diff --git a/keyboards/anne_pro/apply_patch.sh b/keyboards/anne_pro/apply_patch.sh deleted file mode 100755 index 6ef0edbaf63..00000000000 --- a/keyboards/anne_pro/apply_patch.sh +++ /dev/null @@ -1,3 +0,0 @@ -SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" -cd $SCRIPTPATH/../../lib/chibios -git apply $SCRIPTPATH/chibios_stm32l151.patch diff --git a/keyboards/anne_pro/chibios_stm32l151.patch b/keyboards/anne_pro/chibios_stm32l151.patch deleted file mode 100644 index 295b77e845c..00000000000 --- a/keyboards/anne_pro/chibios_stm32l151.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/os/hal/ports/STM32/STM32L1xx/platform.mk b/os/hal/ports/STM32/STM32L1xx/platform.mk -index e2c2344af..dcf6f83bc 100644 ---- a/os/hal/ports/STM32/STM32L1xx/platform.mk -+++ b/os/hal/ports/STM32/STM32L1xx/platform.mk -@@ -17,8 +17,8 @@ ifneq ($(findstring HAL_USE_ADC TRUE,$(HALCONF)),) - PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c - endif - else -- $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c --PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c -+PLATFORMSRC += $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_adc_lld.c \ -+ $(CHIBIOS)/os/hal/ports/STM32/STM32L1xx/hal_ext_lld_isr.c - endif - - # Drivers compatible with the platform. From d006a3dd3ff594e319e6bb92d039451cf9dc9d6e Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 13:29:35 +0200 Subject: [PATCH 53/68] Remove .gitattributes --- keyboards/anne_pro/.gitattributes | 1 - 1 file changed, 1 deletion(-) delete mode 100644 keyboards/anne_pro/.gitattributes diff --git a/keyboards/anne_pro/.gitattributes b/keyboards/anne_pro/.gitattributes deleted file mode 100644 index f268b0b497b..00000000000 --- a/keyboards/anne_pro/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -chibios_stm32l151.patch binary From dd05ef4286d4834efd15a80f8d634b76c18cf83f Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 1 Jul 2020 18:15:29 +0200 Subject: [PATCH 54/68] Update README with pairing info and known issues --- keyboards/anne_pro/README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index a863dd2110d..2f6e5025e2e 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -30,3 +30,10 @@ To convert the `bin` file to a `dfu` file the following script can be used ./keyboards/anne_pro/dfuse-pack.py -b 0x08004000:anne_pro_default.bin anne_pro_default.dfu 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). + +## Bluetooth pairing +The Bluetooth setup is similar to the original Anne Pro firmware. After pressing `Fn + B` the Bluetooth layer shows up. By pressing the `+` key Bluetooth is enabled. You can now pair your computer. Once the computer asks for the pairing code the lights on the keyboard should turn off. You can now simply enter the pairing code and hit connect on the computer, this should pair the device. + +## Known problems +- Capslock indicator light is not working. This is the results of buggy lighting firmware by Obins, which means that the complete backlight would turn on if the capslock was toggled. +- Sending macros over Bluetooth is limited to about 20 keypresses, this is because the transmit buffer is limited and only starts sending after all keypresses are put in the buffer. From f9a5f967bc472c2822a46494c4e6ff6749701841 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Wed, 8 Jul 2020 20:51:12 +0200 Subject: [PATCH 55/68] Update README with info on the LED firmware --- keyboards/anne_pro/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 2f6e5025e2e..d2a507c8f33 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -6,8 +6,8 @@ QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.ob __This firmware is not created or supported by the creator of this keyboard!__ -Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) -Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) +Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) +Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) Make sure you check out the correct branch for this keyboard and initialize the submodules! @@ -31,6 +31,9 @@ To convert the `bin` file to a `dfu` file the following script can be used 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). +## Firmware requirements for LED backlight +To get functioning backlighting for the Anne Pro the original LED firmware is required. This should be the version v1.40, which is available on the [Obins website](http://en.obins.net/firmware#1). __The backlight will not work with the newer ObinsKit firmware!__ This firmware can be installed by following the update guide on the Obins website, or using `dfu-util` if you know what you are doing. + ## Bluetooth pairing The Bluetooth setup is similar to the original Anne Pro firmware. After pressing `Fn + B` the Bluetooth layer shows up. By pressing the `+` key Bluetooth is enabled. You can now pair your computer. Once the computer asks for the pairing code the lights on the keyboard should turn off. You can now simply enter the pairing code and hit connect on the computer, this should pair the device. From 707b738eb1648e812b1d4dc0eabf1557d05f20f8 Mon Sep 17 00:00:00 2001 From: Michiel Visser Date: Fri, 24 Jul 2020 12:18:07 +0200 Subject: [PATCH 56/68] Update README.md for flashing Co-authored-by: Drashna Jaelre --- keyboards/anne_pro/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index d2a507c8f33..72651525a37 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -21,7 +21,7 @@ Make example for this keyboard (after setting up your build environment): Flashing the firmware can easily be done when the keyboard is in DFU mode: - make anne_pro:default:dfu-util + make anne_pro:default:flash The default Arrows and macOS keyboard layouts are also included and can be used with `arrow` or `macos` instead of `default`. From bb841dee0d6d5ef7e89d5813434153c390b6f5ea Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Tue, 4 Feb 2025 09:43:26 -0500 Subject: [PATCH 57/68] fix compile issues --- keyboards/anne_pro/anne_pro_bluetooth.c | 8 +- keyboards/anne_pro/anne_pro_lighting.c | 2 +- keyboards/anne_pro/chconf.h | 724 +----------------- keyboards/anne_pro/config.h | 10 - keyboards/anne_pro/halconf.h | 536 +------------ keyboards/anne_pro/keyboard.json | 10 + .../anne_pro/keymaps/anne-pro-2-mac/keymap.c | 2 +- .../anne_pro/keymaps/anne-pro-2-win/keymap.c | 2 +- keyboards/anne_pro/keymaps/arrow/keymap.c | 2 +- keyboards/anne_pro/keymaps/default/keymap.c | 2 +- keyboards/anne_pro/keymaps/macos/keymap.c | 2 +- 11 files changed, 82 insertions(+), 1218 deletions(-) create mode 100644 keyboards/anne_pro/keyboard.json diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index e4bc84acde1..76cbba66e16 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -81,7 +81,7 @@ static volatile uint8_t bluetooth_connected_host = 0; static bool bluetooth_layer_enabled = false; static bool lighting_before_bluetooth_layer = false; /* Handle when layers are switched */ -uint32_t layer_state_set_kb(uint32_t state) { +layer_state_t layer_state_set_kb(layer_state_t state) { if (!bluetooth_layer_enabled && (state & (1 << BLUETOOTH_LAYER)) != 0) { /* Bluetooth layer turned on */ lighting_before_bluetooth_layer = anne_pro_lighting_enabled(); @@ -354,15 +354,15 @@ static void send_keyboard(report_keyboard_t *report) { } /* Send mouse HID report for Bluetooth driver */ -static void send_mouse(report_mouse_t *report) { +static void send_mouse(report_nkro_t *report) { } /* Send system report for Bluetooth driver */ -static void send_system(uint16_t data) { +static void send_system(report_mouse_t *data) { } /* Send consumer report for Bluetooth driver */ -static void send_consumer(uint16_t data) { +static void send_consumer(report_extra_t *data) { } /* Bluetooth host driver, this allows us to switch from USB output to Bluetooth output */ diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index c8bbb66c5f3..73f11dafb56 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -55,7 +55,7 @@ static virtual_timer_t seconds_timer; static volatile uint32_t seconds_timer_counter = 0; /* Timer callback to update the seconds timer */ -static void update_seconds_timer(void *p) { +static void update_seconds_timer(virtual_timer_t *vtp, void *p) { chSysLockFromISR(); chVTSetI(&seconds_timer, TIME_MS2I(1000), update_seconds_timer, p); chSysUnlockFromISR(); diff --git a/keyboards/anne_pro/chconf.h b/keyboards/anne_pro/chconf.h index 07ab82bd405..84fe151c34e 100644 --- a/keyboards/anne_pro/chconf.h +++ b/keyboards/anne_pro/chconf.h @@ -1,714 +1,48 @@ +/* Copyright 2020 QMK + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + /* - 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. -*/ - -/** - * @file rt/templates/chconf.h - * @brief Configuration file template. - * @details A copy of this file must be placed in each project directory, it - * contains the application specific kernel settings. - * - * @addtogroup config - * @details Kernel related settings and hooks. - * @{ + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/anne_pro/chconf.h -r lib/chibios/os/rt/templates/chconf.h` */ -#ifndef CHCONF_H -#define CHCONF_H +#pragma once -#define _CHIBIOS_RT_CONF_ -#define _CHIBIOS_RT_CONF_VER_6_0_ +#define CH_CFG_ST_RESOLUTION 16 -/*===========================================================================*/ -/** - * @name System timers settings - * @{ - */ -/*===========================================================================*/ +#define CH_CFG_ST_FREQUENCY 1000 -/** - * @brief System time counter resolution. - * @note Allowed values are 16 or 32 bits. - */ -#if !defined(CH_CFG_ST_RESOLUTION) -#define CH_CFG_ST_RESOLUTION 16 -#endif +#define CH_DBG_SYSTEM_STATE_CHECK FALSE -/** - * @brief System tick frequency. - * @details Frequency of the system timer that drives the system ticks. This - * setting also defines the system tick time unit. - */ -#if !defined(CH_CFG_ST_FREQUENCY) -#define CH_CFG_ST_FREQUENCY 1000 -#endif +#define CH_DBG_ENABLE_CHECKS FALSE -/** - * @brief Time intervals data size. - * @note Allowed values are 16, 32 or 64 bits. - */ -#if !defined(CH_CFG_INTERVALS_SIZE) -#define CH_CFG_INTERVALS_SIZE 32 -#endif +#define CH_DBG_ENABLE_ASSERTS FALSE -/** - * @brief Time types data size. - * @note Allowed values are 16 or 32 bits. - */ -#if !defined(CH_CFG_TIME_TYPES_SIZE) -#define CH_CFG_TIME_TYPES_SIZE 32 -#endif +#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED -/** - * @brief Time delta constant for the tick-less mode. - * @note If this value is zero then the system uses the classic - * periodic tick. This value represents the minimum number - * of ticks that is safe to specify in a timeout directive. - * The value one is not valid, timeouts are rounded up to - * this value. - */ -#if !defined(CH_CFG_ST_TIMEDELTA) -#define CH_CFG_ST_TIMEDELTA 2 -#endif +#define CH_DBG_ENABLE_STACK_CHECK FALSE -/** @} */ +#define CH_DBG_FILL_THREADS FALSE -/*===========================================================================*/ -/** - * @name Kernel parameters and options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Round robin interval. - * @details This constant is the number of system ticks allowed for the - * threads before preemption occurs. Setting this value to zero - * disables the preemption for threads with equal priority and the - * round robin becomes cooperative. Note that higher priority - * threads can still preempt, the kernel is always preemptive. - * @note Disabling the round robin preemption makes the kernel more compact - * and generally faster. - * @note The round robin preemption is not supported in tickless mode and - * must be set to zero in that case. - */ -#if !defined(CH_CFG_TIME_QUANTUM) -#define CH_CFG_TIME_QUANTUM 0 -#endif - -/** - * @brief Managed RAM size. - * @details Size of the RAM area to be managed by the OS. If set to zero - * then the whole available RAM is used. The core memory is made - * available to the heap allocator and/or can be used directly through - * the simplified core memory allocator. - * - * @note In order to let the OS manage the whole RAM the linker script must - * provide the @p __heap_base__ and @p __heap_end__ symbols. - * @note Requires @p CH_CFG_USE_MEMCORE. - */ -#if !defined(CH_CFG_MEMCORE_SIZE) -#define CH_CFG_MEMCORE_SIZE 0 -#endif - -/** - * @brief Idle thread automatic spawn suppression. - * @details When this option is activated the function @p chSysInit() - * does not spawn the idle thread. The application @p main() - * function becomes the idle thread and must implement an - * infinite loop. - */ -#if !defined(CH_CFG_NO_IDLE_THREAD) -#define CH_CFG_NO_IDLE_THREAD FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Performance options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief OS optimization. - * @details If enabled then time efficient rather than space efficient code - * is used when two possible implementations exist. - * - * @note This is not related to the compiler optimization options. - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_OPTIMIZE_SPEED) -#define CH_CFG_OPTIMIZE_SPEED TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Subsystem options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Time Measurement APIs. - * @details If enabled then the time measurement APIs are included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_TM) -#define CH_CFG_USE_TM TRUE -#endif - -/** - * @brief Threads registry APIs. - * @details If enabled then the registry APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_REGISTRY) -#define CH_CFG_USE_REGISTRY TRUE -#endif - -/** - * @brief Threads synchronization APIs. - * @details If enabled then the @p chThdWait() function is included in - * the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_WAITEXIT) -#define CH_CFG_USE_WAITEXIT TRUE -#endif - -/** - * @brief Semaphores APIs. - * @details If enabled then the Semaphores APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_SEMAPHORES) -#define CH_CFG_USE_SEMAPHORES TRUE -#endif - -/** - * @brief Semaphores queuing mode. - * @details If enabled then the threads are enqueued on semaphores by - * priority rather than in FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY) -#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE -#endif - -/** - * @brief Mutexes APIs. - * @details If enabled then the mutexes APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MUTEXES) -#define CH_CFG_USE_MUTEXES TRUE -#endif - -/** - * @brief Enables recursive behavior on mutexes. - * @note Recursive mutexes are heavier and have an increased - * memory footprint. - * - * @note The default is @p FALSE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE) -#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE -#endif - -/** - * @brief Conditional Variables APIs. - * @details If enabled then the conditional variables APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MUTEXES. - */ -#if !defined(CH_CFG_USE_CONDVARS) -#define CH_CFG_USE_CONDVARS TRUE -#endif - -/** - * @brief Conditional Variables APIs with timeout. - * @details If enabled then the conditional variables APIs with timeout - * specification are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_CONDVARS. - */ -#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT) -#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE -#endif - -/** - * @brief Events Flags APIs. - * @details If enabled then the event flags APIs are included in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_EVENTS) -#define CH_CFG_USE_EVENTS TRUE -#endif - -/** - * @brief Events Flags APIs with timeout. - * @details If enabled then the events APIs with timeout specification - * are included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_EVENTS. - */ -#if !defined(CH_CFG_USE_EVENTS_TIMEOUT) -#define CH_CFG_USE_EVENTS_TIMEOUT TRUE -#endif - -/** - * @brief Synchronous Messages APIs. - * @details If enabled then the synchronous messages APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MESSAGES) -#define CH_CFG_USE_MESSAGES TRUE -#endif - -/** - * @brief Synchronous Messages queuing mode. - * @details If enabled then messages are served by priority rather than in - * FIFO order. - * - * @note The default is @p FALSE. Enable this if you have special - * requirements. - * @note Requires @p CH_CFG_USE_MESSAGES. - */ -#if !defined(CH_CFG_USE_MESSAGES_PRIORITY) -#define CH_CFG_USE_MESSAGES_PRIORITY FALSE -#endif - -/** - * @brief Mailboxes APIs. - * @details If enabled then the asynchronous messages (mailboxes) APIs are - * included in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_SEMAPHORES. - */ -#if !defined(CH_CFG_USE_MAILBOXES) -#define CH_CFG_USE_MAILBOXES TRUE -#endif - -/** - * @brief Core Memory Manager APIs. - * @details If enabled then the core memory manager APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMCORE) -#define CH_CFG_USE_MEMCORE TRUE -#endif - -/** - * @brief Heap Allocator APIs. - * @details If enabled then the memory heap allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_MEMCORE and either @p CH_CFG_USE_MUTEXES or - * @p CH_CFG_USE_SEMAPHORES. - * @note Mutexes are recommended. - */ -#if !defined(CH_CFG_USE_HEAP) -#define CH_CFG_USE_HEAP TRUE -#endif - -/** - * @brief Memory Pools Allocator APIs. - * @details If enabled then the memory pools allocator APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_MEMPOOLS) -#define CH_CFG_USE_MEMPOOLS TRUE -#endif - -/** - * @brief Objects FIFOs APIs. - * @details If enabled then the objects FIFOs APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_OBJ_FIFOS) -#define CH_CFG_USE_OBJ_FIFOS TRUE -#endif - -/** - * @brief Pipes APIs. - * @details If enabled then the pipes APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - */ -#if !defined(CH_CFG_USE_PIPES) -#define CH_CFG_USE_PIPES TRUE -#endif - -/** - * @brief Dynamic Threads APIs. - * @details If enabled then the dynamic threads creation APIs are included - * in the kernel. - * - * @note The default is @p TRUE. - * @note Requires @p CH_CFG_USE_WAITEXIT. - * @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. - */ -#if !defined(CH_CFG_USE_DYNAMIC) -#define CH_CFG_USE_DYNAMIC TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Objects factory options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Objects Factory APIs. - * @details If enabled then the objects factory APIs are included in the - * kernel. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_CFG_USE_FACTORY) -#define CH_CFG_USE_FACTORY TRUE -#endif - -/** - * @brief Maximum length for object names. - * @details If the specified length is zero then the name is stored by - * pointer but this could have unintended side effects. - */ -#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH) -#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8 -#endif - -/** - * @brief Enables the registry of generic objects. - */ -#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY) -#define CH_CFG_FACTORY_OBJECTS_REGISTRY TRUE -#endif - -/** - * @brief Enables factory for generic buffers. - */ -#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS) -#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE -#endif - -/** - * @brief Enables factory for semaphores. - */ -#if !defined(CH_CFG_FACTORY_SEMAPHORES) -#define CH_CFG_FACTORY_SEMAPHORES TRUE -#endif - -/** - * @brief Enables factory for mailboxes. - */ -#if !defined(CH_CFG_FACTORY_MAILBOXES) -#define CH_CFG_FACTORY_MAILBOXES TRUE -#endif - -/** - * @brief Enables factory for objects FIFOs. - */ -#if !defined(CH_CFG_FACTORY_OBJ_FIFOS) -#define CH_CFG_FACTORY_OBJ_FIFOS TRUE -#endif - -/** - * @brief Enables factory for Pipes. - */ -#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__) -#define CH_CFG_FACTORY_PIPES TRUE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Debug options - * @{ - */ -/*===========================================================================*/ - -/** - * @brief Debug option, kernel statistics. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_STATISTICS) -#define CH_DBG_STATISTICS FALSE -#endif - -/** - * @brief Debug option, system state check. - * @details If enabled the correct call protocol for system APIs is checked - * at runtime. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_SYSTEM_STATE_CHECK) -#define CH_DBG_SYSTEM_STATE_CHECK FALSE -#endif - -/** - * @brief Debug option, parameters checks. - * @details If enabled then the checks on the API functions input - * parameters are activated. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_CHECKS) -#define CH_DBG_ENABLE_CHECKS FALSE -#endif - -/** - * @brief Debug option, consistency checks. - * @details If enabled then all the assertions in the kernel code are - * activated. This includes consistency checks inside the kernel, - * runtime anomalies and port-defined checks. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_ENABLE_ASSERTS) -#define CH_DBG_ENABLE_ASSERTS FALSE -#endif - -/** - * @brief Debug option, trace buffer. - * @details If enabled then the trace buffer is activated. - * - * @note The default is @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_MASK) -#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED -#endif - -/** - * @brief Trace buffer entries. - * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is - * different from @p CH_DBG_TRACE_MASK_DISABLED. - */ -#if !defined(CH_DBG_TRACE_BUFFER_SIZE) -#define CH_DBG_TRACE_BUFFER_SIZE 128 -#endif - -/** - * @brief Debug option, stack checks. - * @details If enabled then a runtime stack check is performed. - * - * @note The default is @p FALSE. - * @note The stack check is performed in a architecture/port dependent way. - * It may not be implemented or some ports. - * @note The default failure mode is to halt the system with the global - * @p panic_msg variable set to @p NULL. - */ -#if !defined(CH_DBG_ENABLE_STACK_CHECK) -#define CH_DBG_ENABLE_STACK_CHECK FALSE -#endif - -/** - * @brief Debug option, stacks initialization. - * @details If enabled then the threads working area is filled with a byte - * value when a thread is created. This can be useful for the - * runtime measurement of the used stack. - * - * @note The default is @p FALSE. - */ -#if !defined(CH_DBG_FILL_THREADS) -#define CH_DBG_FILL_THREADS FALSE -#endif - -/** - * @brief Debug option, threads profiling. - * @details If enabled then a field is added to the @p thread_t structure that - * counts the system ticks occurred while executing the thread. - * - * @note The default is @p FALSE. - * @note This debug option is not currently compatible with the - * tickless mode. - */ -#if !defined(CH_DBG_THREADS_PROFILING) -#define CH_DBG_THREADS_PROFILING FALSE -#endif - -/** @} */ - -/*===========================================================================*/ -/** - * @name Kernel hooks - * @{ - */ -/*===========================================================================*/ - -/** - * @brief System structure extension. - * @details User fields added to the end of the @p ch_system_t structure. - */ -#define CH_CFG_SYSTEM_EXTRA_FIELDS \ +#define CH_CFG_SYSTEM_EXTRA_FIELDS \ /* Add threads custom fields here.*/ -/** - * @brief System initialization hook. - * @details User initialization code added to the @p chSysInit() function - * just before interrupts are enabled globally. - */ #define CH_CFG_SYSTEM_INIT_HOOK() { \ /* Add threads initialization code here.*/ \ } -/** - * @brief Threads descriptor structure extension. - * @details User fields added to the end of the @p thread_t structure. - */ -#define CH_CFG_THREAD_EXTRA_FIELDS \ - /* Add threads custom fields here.*/ +#include_next -/** - * @brief Threads initialization hook. - * @details User initialization code added to the @p _thread_init() function. - * - * @note It is invoked from within @p _thread_init() and implicitly from all - * the threads creation APIs. - */ -#define CH_CFG_THREAD_INIT_HOOK(tp) { \ - /* Add threads initialization code here.*/ \ -} - -/** - * @brief Threads finalization hook. - * @details User finalization code added to the @p chThdExit() API. - */ -#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ - /* Add threads finalization code here.*/ \ -} - -/** - * @brief Context switch hook. - * @details This hook is invoked just before switching between threads. - */ -#define CH_CFG_CONTEXT_SWITCH_HOOK(ntp, otp) { \ - /* Context switch code here.*/ \ -} - -/** - * @brief ISR enter hook. - */ -#define CH_CFG_IRQ_PROLOGUE_HOOK() { \ - /* IRQ prologue code here.*/ \ -} - -/** - * @brief ISR exit hook. - */ -#define CH_CFG_IRQ_EPILOGUE_HOOK() { \ - /* IRQ epilogue code here.*/ \ -} - -/** - * @brief Idle thread enter hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to activate a power saving mode. - */ -#define CH_CFG_IDLE_ENTER_HOOK() { \ - /* Idle-enter code here.*/ \ -} - -/** - * @brief Idle thread leave hook. - * @note This hook is invoked within a critical zone, no OS functions - * should be invoked from here. - * @note This macro can be used to deactivate a power saving mode. - */ -#define CH_CFG_IDLE_LEAVE_HOOK() { \ - /* Idle-leave code here.*/ \ -} - -/** - * @brief Idle Loop hook. - * @details This hook is continuously invoked by the idle thread loop. - */ -#define CH_CFG_IDLE_LOOP_HOOK() { \ - /* Idle loop code here.*/ \ -} - -/** - * @brief System tick event hook. - * @details This hook is invoked in the system tick handler immediately - * after processing the virtual timers queue. - */ -#define CH_CFG_SYSTEM_TICK_HOOK() { \ - /* System tick event code here.*/ \ -} - -/** - * @brief System halt hook. - * @details This hook is invoked in case to a system halting error before - * the system is halted. - */ -#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ - /* System halt code here.*/ \ -} - -/** - * @brief Trace hook. - * @details This hook is invoked each time a new record is written in the - * trace buffer. - */ -#define CH_CFG_TRACE_HOOK(tep) { \ - /* Trace code here.*/ \ -} - -/** @} */ - -/*===========================================================================*/ -/* Port-specific settings (override port settings defaulted in chcore.h). */ -/*===========================================================================*/ - -#endif /* CHCONF_H */ - -/** @} */ diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index c89c4545117..34662991a68 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -16,16 +16,6 @@ #pragma once -#include "config_common.h" - -/* USB Device descriptor parameter */ -#define VENDOR_ID 0x0483 -#define PRODUCT_ID 0x5710 -#define DEVICE_VER 0x0200 - -#define MANUFACTURER QMK -#define PRODUCT Anne Pro -#define DESCRIPTION Anne Pro Keyboard /* key matrix size */ #define MATRIX_ROWS 5 diff --git a/keyboards/anne_pro/halconf.h b/keyboards/anne_pro/halconf.h index e3040fc8390..b32462bf32d 100644 --- a/keyboards/anne_pro/halconf.h +++ b/keyboards/anne_pro/halconf.h @@ -1,525 +1,55 @@ -/* - 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. -*/ - -/** - * @file templates/halconf.h - * @brief HAL configuration header. - * @details HAL configuration file, this file allows to enable or disable the - * various device drivers from your application. You may also use - * this file in order to override the device drivers default settings. +/* Copyright 2020 QMK * - * @addtogroup HAL_CONF - * @{ + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ -#ifndef HALCONF_H -#define HALCONF_H - -#define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_0_ - -#include "mcuconf.h" - -/** - * @brief Enables the PAL subsystem. +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/anne_pro/halconf.h -r platforms/chibios/boards/common/configs/halconf.h` */ -#if !defined(HAL_USE_PAL) || defined(__DOXYGEN__) -#define HAL_USE_PAL TRUE -#endif -/** - * @brief Enables the ADC subsystem. - */ -#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__) -#define HAL_USE_ADC FALSE -#endif +#pragma once -/** - * @brief Enables the CAN subsystem. - */ -#if !defined(HAL_USE_CAN) || defined(__DOXYGEN__) -#define HAL_USE_CAN FALSE -#endif +#define HAL_USE_SERIAL_USB TRUE -/** - * @brief Enables the cryptographic subsystem. - */ -#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__) -#define HAL_USE_CRY FALSE -#endif +#define HAL_USE_UART TRUE -/** - * @brief Enables the DAC subsystem. - */ -#if !defined(HAL_USE_DAC) || defined(__DOXYGEN__) -#define HAL_USE_DAC FALSE -#endif +#define PAL_USE_WAIT TRUE -/** - * @brief Enables the GPT subsystem. - */ -#if !defined(HAL_USE_GPT) || defined(__DOXYGEN__) -#define HAL_USE_GPT FALSE -#endif +#define ADC_USE_WAIT FALSE -/** - * @brief Enables the I2C subsystem. - */ -#if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) -#define HAL_USE_I2C FALSE -#endif +#define ADC_USE_MUTUAL_EXCLUSION FALSE -/** - * @brief Enables the I2S subsystem. - */ -#if !defined(HAL_USE_I2S) || defined(__DOXYGEN__) -#define HAL_USE_I2S FALSE -#endif +#define DAC_USE_WAIT FALSE -/** - * @brief Enables the ICU subsystem. - */ -#if !defined(HAL_USE_ICU) || defined(__DOXYGEN__) -#define HAL_USE_ICU FALSE -#endif +#define DAC_USE_MUTUAL_EXCLUSION FALSE -/** - * @brief Enables the MAC subsystem. - */ -#if !defined(HAL_USE_MAC) || defined(__DOXYGEN__) -#define HAL_USE_MAC FALSE -#endif +#define MAC_USE_EVENTS FALSE -/** - * @brief Enables the MMC_SPI subsystem. - */ -#if !defined(HAL_USE_MMC_SPI) || defined(__DOXYGEN__) -#define HAL_USE_MMC_SPI FALSE -#endif +#define SERIAL_BUFFERS_SIZE 16 -/** - * @brief Enables the PWM subsystem. - */ -#if !defined(HAL_USE_PWM) || defined(__DOXYGEN__) -#define HAL_USE_PWM FALSE -#endif +#define SERIAL_USB_BUFFERS_SIZE 256 -/** - * @brief Enables the RTC subsystem. - */ -#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__) -#define HAL_USE_RTC FALSE -#endif +#define SPI_USE_WAIT FALSE -/** - * @brief Enables the SDC subsystem. - */ -#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__) -#define HAL_USE_SDC FALSE -#endif +#define SPI_USE_MUTUAL_EXCLUSION FALSE -/** - * @brief Enables the SERIAL subsystem. - */ -#if !defined(HAL_USE_SERIAL) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL FALSE -#endif +#define UART_USE_WAIT TRUE -/** - * @brief Enables the SERIAL over USB subsystem. - */ -#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__) -#define HAL_USE_SERIAL_USB TRUE -#endif +#define WSPI_USE_WAIT FALSE -/** - * @brief Enables the SIO subsystem. - */ -#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) -#define HAL_USE_SIO FALSE -#endif +#define WSPI_USE_MUTUAL_EXCLUSION FALSE -/** - * @brief Enables the SPI subsystem. - */ -#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__) -#define HAL_USE_SPI FALSE -#endif +#include_next -/** - * @brief Enables the TRNG subsystem. - */ -#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) -#define HAL_USE_TRNG FALSE -#endif - -/** - * @brief Enables the UART subsystem. - */ -#if !defined(HAL_USE_UART) || defined(__DOXYGEN__) -#define HAL_USE_UART TRUE -#endif - -/** - * @brief Enables the USB subsystem. - */ -#if !defined(HAL_USE_USB) || defined(__DOXYGEN__) -#define HAL_USE_USB TRUE -#endif - -/** - * @brief Enables the WDG subsystem. - */ -#if !defined(HAL_USE_WDG) || defined(__DOXYGEN__) -#define HAL_USE_WDG FALSE -#endif - -/** - * @brief Enables the WSPI subsystem. - */ -#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__) -#define HAL_USE_WSPI FALSE -#endif - -/*===========================================================================*/ -/* PAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__) -#define PAL_USE_CALLBACKS FALSE -#endif - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__) -#define PAL_USE_WAIT TRUE -#endif - -/*===========================================================================*/ -/* ADC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_WAIT) || defined(__DOXYGEN__) -#define ADC_USE_WAIT FALSE -#endif - -/** - * @brief Enables the @p adcAcquireBus() and @p adcReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(ADC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define ADC_USE_MUTUAL_EXCLUSION FALSE -#endif - -/*===========================================================================*/ -/* CAN driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Sleep mode related APIs inclusion switch. - */ -#if !defined(CAN_USE_SLEEP_MODE) || defined(__DOXYGEN__) -#define CAN_USE_SLEEP_MODE TRUE -#endif - -/** - * @brief Enforces the driver to use direct callbacks rather than OSAL events. - */ -#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__) -#define CAN_ENFORCE_USE_CALLBACKS FALSE -#endif - -/*===========================================================================*/ -/* CRY driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the SW fall-back of the cryptographic driver. - * @details When enabled, this option, activates a fall-back software - * implementation for algorithms not supported by the underlying - * hardware. - * @note Fall-back implementations may not be present for all algorithms. - */ -#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_USE_FALLBACK FALSE -#endif - -/** - * @brief Makes the driver forcibly use the fall-back implementations. - */ -#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__) -#define HAL_CRY_ENFORCE_FALLBACK FALSE -#endif - -/*===========================================================================*/ -/* DAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__) -#define DAC_USE_WAIT FALSE -#endif - -/** - * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define DAC_USE_MUTUAL_EXCLUSION FALSE -#endif - -/*===========================================================================*/ -/* I2C driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the mutual exclusion APIs on the I2C bus. - */ -#if !defined(I2C_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define I2C_USE_MUTUAL_EXCLUSION TRUE -#endif - -/*===========================================================================*/ -/* MAC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables the zero-copy API. - */ -#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) -#define MAC_USE_ZERO_COPY FALSE -#endif - -/** - * @brief Enables an event sources for incoming packets. - */ -#if !defined(MAC_USE_EVENTS) || defined(__DOXYGEN__) -#define MAC_USE_EVENTS FALSE -#endif - -/*===========================================================================*/ -/* MMC_SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - * This option is recommended also if the SPI driver does not - * use a DMA channel and heavily loads the CPU. - */ -#if !defined(MMC_NICE_WAITING) || defined(__DOXYGEN__) -#define MMC_NICE_WAITING TRUE -#endif - -/*===========================================================================*/ -/* SDC driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Number of initialization attempts before rejecting the card. - * @note Attempts are performed at 10mS intervals. - */ -#if !defined(SDC_INIT_RETRY) || defined(__DOXYGEN__) -#define SDC_INIT_RETRY 100 -#endif - -/** - * @brief Include support for MMC cards. - * @note MMC support is not yet implemented so this option must be kept - * at @p FALSE. - */ -#if !defined(SDC_MMC_SUPPORT) || defined(__DOXYGEN__) -#define SDC_MMC_SUPPORT FALSE -#endif - -/** - * @brief Delays insertions. - * @details If enabled this options inserts delays into the MMC waiting - * routines releasing some extra CPU time for the threads with - * lower priority, this may slow down the driver a bit however. - */ -#if !defined(SDC_NICE_WAITING) || defined(__DOXYGEN__) -#define SDC_NICE_WAITING TRUE -#endif - -/** - * @brief OCR initialization constant for V20 cards. - */ -#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__) -#define SDC_INIT_OCR_V20 0x50FF8000U -#endif - -/** - * @brief OCR initialization constant for non-V20 cards. - */ -#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__) -#define SDC_INIT_OCR 0x80100000U -#endif - -/*===========================================================================*/ -/* SERIAL driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Default bit rate. - * @details Configuration parameter, this is the baud rate selected for the - * default configuration. - */ -#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__) -#define SERIAL_DEFAULT_BITRATE 38400 -#endif - -/** - * @brief Serial buffers size. - * @details Configuration parameter, you can change the depth of the queue - * buffers depending on the requirements of your application. - * @note The default is 16 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_BUFFERS_SIZE 16 -#endif - -/*===========================================================================*/ -/* SERIAL_USB driver related setting. */ -/*===========================================================================*/ - -/** - * @brief Serial over USB buffers size. - * @details Configuration parameter, the buffer size must be a multiple of - * the USB data endpoint maximum packet size. - * @note The default is 256 bytes for both the transmission and receive - * buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 256 -#endif - -/** - * @brief Serial over USB number of buffers. - * @note The default is 2 buffers. - */ -#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_NUMBER 2 -#endif - -/*===========================================================================*/ -/* SPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__) -#define SPI_USE_WAIT FALSE -#endif - -/** - * @brief Enables circular transfers APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__) -#define SPI_USE_CIRCULAR FALSE -#endif - - -/** - * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define SPI_USE_MUTUAL_EXCLUSION FALSE -#endif - -/** - * @brief Handling method for SPI CS line. - * @note Disabling this option saves both code and data space. - */ -#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__) -#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD -#endif - -/*===========================================================================*/ -/* UART driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__) -#define UART_USE_WAIT TRUE -#endif - -/** - * @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define UART_USE_MUTUAL_EXCLUSION FALSE -#endif - -/*===========================================================================*/ -/* USB driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(USB_USE_WAIT) || defined(__DOXYGEN__) -#define USB_USE_WAIT TRUE -#endif - -/*===========================================================================*/ -/* WSPI driver related settings. */ -/*===========================================================================*/ - -/** - * @brief Enables synchronous APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__) -#define WSPI_USE_WAIT FALSE -#endif - -/** - * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs. - * @note Disabling this option saves both code and data space. - */ -#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__) -#define WSPI_USE_MUTUAL_EXCLUSION FALSE -#endif - -#endif /* HALCONF_H */ - -/** @} */ diff --git a/keyboards/anne_pro/keyboard.json b/keyboards/anne_pro/keyboard.json new file mode 100644 index 00000000000..967f8ef06fd --- /dev/null +++ b/keyboards/anne_pro/keyboard.json @@ -0,0 +1,10 @@ +{ + "manufacturer": "Obins", + "keyboard_name": "Anne Pro", + "bootloader": "stm32-dfu", + "usb": { + "device_version": "1.0.0", + "pid": "0x5710", + "vid": "0x0483" + } +} diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c index 5879660ad7b..6c7533ffa9f 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c @@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, - XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCT, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c index 698febe779d..025d80612e4 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c @@ -29,7 +29,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, - XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_UP, KC_SLCT, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ diff --git a/keyboards/anne_pro/keymaps/arrow/keymap.c b/keyboards/anne_pro/keymaps/arrow/keymap.c index 0072dd5c103..ef7a4687351 100644 --- a/keyboards/anne_pro/keymaps/arrow/keymap.c +++ b/keyboards/anne_pro/keymaps/arrow/keymap.c @@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, - XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCT, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_SLSH, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index 45911fbb628..a646a82b3d8 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, - XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCT, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ diff --git a/keyboards/anne_pro/keymaps/macos/keymap.c b/keyboards/anne_pro/keymaps/macos/keymap.c index 8cf76484e24..bdaba57e70a 100644 --- a/keyboards/anne_pro/keymaps/macos/keymap.c +++ b/keyboards/anne_pro/keymaps/macos/keymap.c @@ -27,7 +27,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [1] = LAYOUT( KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, XXXXXXX, - XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCK, KC_PAUS, KC_HOME, KC_END, KC_PSCR, + XXXXXXX, XXXXXXX, KC_UP, XXXXXXX, APL_RGB, APL_RAT, APL_BRT, APL_MOD, KC_UP, KC_SLCT, KC_PAUS, KC_HOME, KC_END, KC_PSCR, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, XXXXXXX, XXXXXXX, XXXXXXX, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGUP, KC_PGDN, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, TG(3), XXXXXXX, XXXXXXX, XXXXXXX, KC_INS, KC_DEL, _______, _______, _______, _______, XXXXXXX, _______, _______, _______, _______ From 9747fb1d7258ff92d74c048bae985bfc306053e2 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 7 Feb 2025 11:14:16 -0500 Subject: [PATCH 58/68] add info.json --- keyboards/anne_pro/anne_pro.h | 15 ------ keyboards/anne_pro/config.h | 50 ------------------ keyboards/anne_pro/keyboard.json | 89 +++++++++++++++++++++++++++++++- keyboards/anne_pro/rules.mk | 8 --- 4 files changed, 87 insertions(+), 75 deletions(-) diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index f156bedf226..9dd76e0600c 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -41,18 +41,3 @@ enum anne_pro_keycodes { APB_HD4, NEW_SAFE_RANGE, }; - -/* The fully-featured LAYOUT() that has every single key available in the matrix. */ -#define LAYOUT(\ - k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, \ - k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, \ - k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2d, \ - k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3d, \ - k40, k41, k42, k45, k4a, k4b, k4c, k4d \ -) { \ - { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d }, \ - { k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d }, \ - { k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, KC_NO, k2d }, \ - { k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, KC_NO, KC_NO, k3d }, \ - { k40, k41, k42, KC_NO, KC_NO, k45, KC_NO, KC_NO, KC_NO, KC_NO, k4a, k4b, k4c, k4d }, \ -} diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 34662991a68..7f4021ce47f 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -17,58 +17,8 @@ #pragma once -/* key matrix size */ -#define MATRIX_ROWS 5 -#define MATRIX_COLS 14 - -#define MATRIX_ROW_PINS { B9, B8, B7, B6, A0 } -#define MATRIX_COL_PINS { A5, A6, A7, B0, B1, B12, B13, B14, A8, A9, A15, B3, B4, B5 } -#define DIODE_DIRECTION COL2ROW - -/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */ -#define DEBOUNCE 5 - /* * Timeout after which the backlight of the keyboard is disabled if no keypresses are received. * If this feature is not needed you can set the timeout to UINT32_MAX, this is more than 100 years. */ #define BACKLIGHT_TIMEOUT 60 - -/* - * Force NKRO - * - * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved - * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the - * makefile for this to work.) - * - * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N) - * until the next keyboard reset. - * - * NKRO may prevent your keystrokes from being detected in the BIOS, but it is - * fully operational during normal computer usage. - * - * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N) - * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by - * bootmagic, NKRO mode will always be enabled until it is toggled again during a - * power-up. - * - */ -//#define FORCE_NKRO - -/* - * Feature disable options - * These options are also useful to firmware size reduction. - */ - -/* disable debug print */ -//#define NO_DEBUG - -/* disable print */ -//#define NO_PRINT - -/* disable action features */ -//#define NO_ACTION_LAYER -//#define NO_ACTION_TAPPING -//#define NO_ACTION_ONESHOT -//#define NO_ACTION_MACRO -//#define NO_ACTION_FUNCTION diff --git a/keyboards/anne_pro/keyboard.json b/keyboards/anne_pro/keyboard.json index 967f8ef06fd..e6ca040949f 100644 --- a/keyboards/anne_pro/keyboard.json +++ b/keyboards/anne_pro/keyboard.json @@ -1,10 +1,95 @@ { "manufacturer": "Obins", "keyboard_name": "Anne Pro", + "maintainer": "msvisser / TinfoilSubmarine", "bootloader": "stm32-dfu", + "diode_direction": "COL2ROW", + "eeprom": { + "driver": "transient" + }, + "features": { + "bootmagic": false, + "command": false, + "console": false, + "extrakey": true, + "mousekey": false, + "nkro": true + }, + "matrix_pins": { + "cols": ["A5", "A6", "A7", "B0", "B1", "B12", "B13", "B14", "A8", "A9", "A15", "B3", "B4", "B5"], + "rows": ["B9", "B8", "B7", "B6", "A0"] + }, + "url": "https://service.hexcore.xyz/manual/annepro/", "usb": { "device_version": "1.0.0", - "pid": "0x5710", - "vid": "0x0483" + "pid": "0xFBF1", + "vid": "0xAC20" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 1], "x": 1, "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, "y": 0}, + {"matrix": [0, 7], "x": 7, "y": 0}, + {"matrix": [0, 8], "x": 8, "y": 0}, + {"matrix": [0, 9], "x": 9, "y": 0}, + {"matrix": [0, 10], "x": 10, "y": 0}, + {"matrix": [0, 11], "x": 11, "y": 0}, + {"matrix": [0, 12], "x": 12, "y": 0}, + {"matrix": [0, 13], "x": 13, "y": 0, "w": 2}, + {"matrix": [1, 0], "x": 0, "y": 1, "w": 1.5}, + {"matrix": [1, 1], "x": 1.5, "y": 1}, + {"matrix": [1, 2], "x": 2.5, "y": 1}, + {"matrix": [1, 3], "x": 3.5, "y": 1}, + {"matrix": [1, 4], "x": 4.5, "y": 1}, + {"matrix": [1, 5], "x": 5.5, "y": 1}, + {"matrix": [1, 6], "x": 6.5, "y": 1}, + {"matrix": [1, 7], "x": 7.5, "y": 1}, + {"matrix": [1, 8], "x": 8.5, "y": 1}, + {"matrix": [1, 9], "x": 9.5, "y": 1}, + {"matrix": [1, 10], "x": 10.5, "y": 1}, + {"matrix": [1, 11], "x": 11.5, "y": 1}, + {"matrix": [1, 12], "x": 12.5, "y": 1}, + {"matrix": [1, 13], "x": 13.5, "y": 1, "w": 1.5}, + {"matrix": [2, 0], "x": 0, "y": 2, "w": 1.75}, + {"matrix": [2, 1], "x": 1.75, "y": 2}, + {"matrix": [2, 2], "x": 2.75, "y": 2}, + {"matrix": [2, 3], "x": 3.75, "y": 2}, + {"matrix": [2, 4], "x": 4.75, "y": 2}, + {"matrix": [2, 5], "x": 5.75, "y": 2}, + {"matrix": [2, 6], "x": 6.75, "y": 2}, + {"matrix": [2, 7], "x": 7.75, "y": 2}, + {"matrix": [2, 8], "x": 8.75, "y": 2}, + {"matrix": [2, 9], "x": 9.75, "y": 2}, + {"matrix": [2, 10], "x": 10.75, "y": 2}, + {"matrix": [2, 11], "x": 11.75, "y": 2}, + {"matrix": [2, 13], "x": 12.75, "y": 2, "w": 2.25}, + {"matrix": [3, 0], "x": 0, "y": 3, "w": 2.25}, + {"matrix": [3, 1], "x": 2.25, "y": 3}, + {"matrix": [3, 2], "x": 3.25, "y": 3}, + {"matrix": [3, 3], "x": 4.25, "y": 3}, + {"matrix": [3, 4], "x": 5.25, "y": 3}, + {"matrix": [3, 5], "x": 6.25, "y": 3}, + {"matrix": [3, 6], "x": 7.25, "y": 3}, + {"matrix": [3, 7], "x": 8.25, "y": 3}, + {"matrix": [3, 8], "x": 9.25, "y": 3}, + {"matrix": [3, 9], "x": 10.25, "y": 3}, + {"matrix": [3, 10], "x": 11.25, "y": 3}, + {"matrix": [3, 13], "x": 12.25, "y": 3, "w": 2.75}, + {"matrix": [4, 0], "x": 0, "y": 4, "w": 1.25}, + {"matrix": [4, 1], "x": 1.25, "y": 4, "w": 1.25}, + {"matrix": [4, 2], "x": 2.5, "y": 4, "w": 1.25}, + {"matrix": [4, 5], "x": 3.75, "y": 4, "w": 6.25}, + {"matrix": [4, 10], "x": 10, "y": 4, "w": 1.25}, + {"matrix": [4, 11], "x": 11.25, "y": 4, "w": 1.25}, + {"matrix": [4, 12], "x": 12.5, "y": 4, "w": 1.25}, + {"matrix": [4, 13], "x": 13.75, "y": 4, "w": 1.25} + ] + } } } diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index b794f5223df..7b7e99902bd 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -29,13 +29,5 @@ SRC += uart_tx_ringbuf.c anne_pro_lighting.c anne_pro_bluetooth.c # Required for functionality with Bluetooth NO_USB_STARTUP_CHECK = yes -# Build Options -# comment out to disable the options. -# -MOUSEKEY_ENABLE = no # Mouse keys -EXTRAKEY_ENABLE = yes # Audio control and System control -NKRO_ENABLE = yes # USB Nkey Rollover -EEPROM_DRIVER = transient - # Enter lower-power sleep mode when on the ChibiOS idle thread OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE From 0c372abd6093ed7e8bd6e3ce94b4f82bac860c5a Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Wed, 12 Feb 2025 16:39:11 -0500 Subject: [PATCH 59/68] use new name for RESET keycode --- keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c | 2 +- keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c | 2 +- keyboards/anne_pro/keymaps/arrow/keymap.c | 2 +- keyboards/anne_pro/keymaps/default/keymap.c | 2 +- keyboards/anne_pro/keymaps/macos/keymap.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c index 6c7533ffa9f..a0e8621a773 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c @@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - RESET, KC_MSTP, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, + QK_RBT, KC_MSTP, KC_VOLD, KC_VOLU, KC_MRWD, KC_MPLY, KC_MFFD, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c index 025d80612e4..005b6947c61 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c @@ -35,7 +35,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - RESET, KC_MSTP, KC_VOLD, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, + QK_RBT, KC_MSTP, KC_VOLD, KC_VOLU, KC_MPRV, KC_MPLY, KC_MNXT, KC_MUTE, XXXXXXX, APL_MOD, APL_RGB, APL_RAT, APL_BRT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, diff --git a/keyboards/anne_pro/keymaps/arrow/keymap.c b/keyboards/anne_pro/keymaps/arrow/keymap.c index ef7a4687351..27297ccab3e 100644 --- a/keyboards/anne_pro/keymaps/arrow/keymap.c +++ b/keyboards/anne_pro/keymaps/arrow/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_RBT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index a646a82b3d8..bbaa6e8f54b 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_RBT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, diff --git a/keyboards/anne_pro/keymaps/macos/keymap.c b/keyboards/anne_pro/keymaps/macos/keymap.c index bdaba57e70a..a89181bc836 100644 --- a/keyboards/anne_pro/keymaps/macos/keymap.c +++ b/keyboards/anne_pro/keymaps/macos/keymap.c @@ -33,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { _______, _______, _______, XXXXXXX, _______, _______, _______, _______ ), [2] = LAYOUT( - RESET, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + QK_RBT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, From cee761059e36d90b516efe2f6bfaac91327a2307 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Wed, 12 Feb 2025 08:26:56 -0500 Subject: [PATCH 60/68] use L152 instead of our own custom L151 board code --- keyboards/anne_pro/anne_pro.c | 11 + .../boards/STM32L151_ANNE_PRO/board.c | 274 ------ .../boards/STM32L151_ANNE_PRO/board.h | 913 ------------------ .../boards/STM32L151_ANNE_PRO/board.mk | 4 +- keyboards/anne_pro/config.h | 3 + 5 files changed, 16 insertions(+), 1189 deletions(-) delete mode 100644 keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c delete mode 100644 keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index 0fd6b304cc4..a3c6cd299b4 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -20,6 +20,17 @@ #include "ch.h" #include "hal.h" +void early_hardware_init_pre(void) { + /* Disable all external interrupt vectors, they are left enabled by the bootloader */ + nvicDisableVector(EXTI0_IRQn); + nvicDisableVector(EXTI1_IRQn); + nvicDisableVector(EXTI2_IRQn); + nvicDisableVector(EXTI3_IRQn); + nvicDisableVector(EXTI4_IRQn); + nvicDisableVector(EXTI9_5_IRQn); + nvicDisableVector(EXTI15_10_IRQn); +} + /* Process the Anne Pro custom keycodes */ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { /* Update the key status for the reactive effects */ diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c deleted file mode 100644 index bafd95f7beb..00000000000 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.c +++ /dev/null @@ -1,274 +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. -*/ - -/* - * This file has been automatically generated using ChibiStudio board - * generator plugin. Do not edit manually. - */ - -#include "hal.h" -#include "stm32_gpio.h" - -/*===========================================================================*/ -/* Driver local definitions. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported variables. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver local variables and types. */ -/*===========================================================================*/ - -/** - * @brief Type of STM32 GPIO port setup. - */ -typedef struct { - uint32_t moder; - uint32_t otyper; - uint32_t ospeedr; - uint32_t pupdr; - uint32_t odr; - uint32_t afrl; - uint32_t afrh; -} gpio_setup_t; - -/** - * @brief Type of STM32 GPIO initialization data. - */ -typedef struct { -#if STM32_HAS_GPIOA || defined(__DOXYGEN__) - gpio_setup_t PAData; -#endif -#if STM32_HAS_GPIOB || defined(__DOXYGEN__) - gpio_setup_t PBData; -#endif -#if STM32_HAS_GPIOC || defined(__DOXYGEN__) - gpio_setup_t PCData; -#endif -#if STM32_HAS_GPIOD || defined(__DOXYGEN__) - gpio_setup_t PDData; -#endif -#if STM32_HAS_GPIOE || defined(__DOXYGEN__) - gpio_setup_t PEData; -#endif -#if STM32_HAS_GPIOF || defined(__DOXYGEN__) - gpio_setup_t PFData; -#endif -#if STM32_HAS_GPIOG || defined(__DOXYGEN__) - gpio_setup_t PGData; -#endif -#if STM32_HAS_GPIOH || defined(__DOXYGEN__) - gpio_setup_t PHData; -#endif -#if STM32_HAS_GPIOI || defined(__DOXYGEN__) - gpio_setup_t PIData; -#endif -#if STM32_HAS_GPIOJ || defined(__DOXYGEN__) - gpio_setup_t PJData; -#endif -#if STM32_HAS_GPIOK || defined(__DOXYGEN__) - gpio_setup_t PKData; -#endif -} gpio_config_t; - -/** - * @brief STM32 GPIO static initialization data. - */ -static const gpio_config_t gpio_default_config = { -#if STM32_HAS_GPIOA - {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, - VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, -#endif -#if STM32_HAS_GPIOB - {VAL_GPIOB_MODER, VAL_GPIOB_OTYPER, VAL_GPIOB_OSPEEDR, VAL_GPIOB_PUPDR, - VAL_GPIOB_ODR, VAL_GPIOB_AFRL, VAL_GPIOB_AFRH}, -#endif -#if STM32_HAS_GPIOC - {VAL_GPIOC_MODER, VAL_GPIOC_OTYPER, VAL_GPIOC_OSPEEDR, VAL_GPIOC_PUPDR, - VAL_GPIOC_ODR, VAL_GPIOC_AFRL, VAL_GPIOC_AFRH}, -#endif -#if STM32_HAS_GPIOD - {VAL_GPIOD_MODER, VAL_GPIOD_OTYPER, VAL_GPIOD_OSPEEDR, VAL_GPIOD_PUPDR, - VAL_GPIOD_ODR, VAL_GPIOD_AFRL, VAL_GPIOD_AFRH}, -#endif -#if STM32_HAS_GPIOE - {VAL_GPIOE_MODER, VAL_GPIOE_OTYPER, VAL_GPIOE_OSPEEDR, VAL_GPIOE_PUPDR, - VAL_GPIOE_ODR, VAL_GPIOE_AFRL, VAL_GPIOE_AFRH}, -#endif -#if STM32_HAS_GPIOF - {VAL_GPIOF_MODER, VAL_GPIOF_OTYPER, VAL_GPIOF_OSPEEDR, VAL_GPIOF_PUPDR, - VAL_GPIOF_ODR, VAL_GPIOF_AFRL, VAL_GPIOF_AFRH}, -#endif -#if STM32_HAS_GPIOG - {VAL_GPIOG_MODER, VAL_GPIOG_OTYPER, VAL_GPIOG_OSPEEDR, VAL_GPIOG_PUPDR, - VAL_GPIOG_ODR, VAL_GPIOG_AFRL, VAL_GPIOG_AFRH}, -#endif -#if STM32_HAS_GPIOH - {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, - VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, -#endif -#if STM32_HAS_GPIOI - {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, - VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}, -#endif -#if STM32_HAS_GPIOJ - {VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, - VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH}, -#endif -#if STM32_HAS_GPIOK - {VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, - VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH} -#endif -}; - -/*===========================================================================*/ -/* Driver local functions. */ -/*===========================================================================*/ - -static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) { - - gpiop->OTYPER = config->otyper; - gpiop->OSPEEDR = config->ospeedr; - gpiop->PUPDR = config->pupdr; - gpiop->ODR = config->odr; - gpiop->AFRL = config->afrl; - gpiop->AFRH = config->afrh; - gpiop->MODER = config->moder; -} - -static void stm32_gpio_init(void) { - - /* Enabling GPIO-related clocks, the mask comes from the - registry header file.*/ - rccResetAHB(STM32_GPIO_EN_MASK); - rccEnableAHB(STM32_GPIO_EN_MASK, true); - - /* Initializing all the defined GPIO ports.*/ -#if STM32_HAS_GPIOA - gpio_init(GPIOA, &gpio_default_config.PAData); -#endif -#if STM32_HAS_GPIOB - gpio_init(GPIOB, &gpio_default_config.PBData); -#endif -#if STM32_HAS_GPIOC - gpio_init(GPIOC, &gpio_default_config.PCData); -#endif -#if STM32_HAS_GPIOD - gpio_init(GPIOD, &gpio_default_config.PDData); -#endif -#if STM32_HAS_GPIOE - gpio_init(GPIOE, &gpio_default_config.PEData); -#endif -#if STM32_HAS_GPIOF - gpio_init(GPIOF, &gpio_default_config.PFData); -#endif -#if STM32_HAS_GPIOG - gpio_init(GPIOG, &gpio_default_config.PGData); -#endif -#if STM32_HAS_GPIOH - gpio_init(GPIOH, &gpio_default_config.PHData); -#endif -#if STM32_HAS_GPIOI - gpio_init(GPIOI, &gpio_default_config.PIData); -#endif -#if STM32_HAS_GPIOJ - gpio_init(GPIOJ, &gpio_default_config.PJData); -#endif -#if STM32_HAS_GPIOK - gpio_init(GPIOK, &gpio_default_config.PKData); -#endif -} - -/*===========================================================================*/ -/* Driver interrupt handlers. */ -/*===========================================================================*/ - -/*===========================================================================*/ -/* Driver exported functions. */ -/*===========================================================================*/ - -/** - * @brief Early initialization code. - * @details GPIO ports and system clocks are initialized before everything - * else. - */ -void __early_init(void) { - /* Disable all external interrupt vectors, they are left enabled by the bootloader */ - nvicDisableVector(EXTI0_IRQn); - nvicDisableVector(EXTI1_IRQn); - nvicDisableVector(EXTI2_IRQn); - nvicDisableVector(EXTI3_IRQn); - nvicDisableVector(EXTI4_IRQn); - nvicDisableVector(EXTI9_5_IRQn); - nvicDisableVector(EXTI15_10_IRQn); - - stm32_gpio_init(); - stm32_clock_init(); -} - -#if HAL_USE_SDC || defined(__DOXYGEN__) -/** - * @brief SDC card detection. - */ -bool sdc_lld_is_card_inserted(SDCDriver *sdcp) { - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return true; -} - -/** - * @brief SDC card write protection detection. - */ -bool sdc_lld_is_write_protected(SDCDriver *sdcp) { - - (void)sdcp; - /* TODO: Fill the implementation.*/ - return false; -} -#endif /* HAL_USE_SDC */ - -#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) -/** - * @brief MMC_SPI card detection. - */ -bool mmc_lld_is_card_inserted(MMCDriver *mmcp) { - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return true; -} - -/** - * @brief MMC_SPI card write protection detection. - */ -bool mmc_lld_is_write_protected(MMCDriver *mmcp) { - - (void)mmcp; - /* TODO: Fill the implementation.*/ - return false; -} -#endif - -/** - * @brief Board-specific initialization code. - * @todo Add your board-specific code, if any. - */ -void boardInit(void) { - -} diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h deleted file mode 100644 index d15eab57ad4..00000000000 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.h +++ /dev/null @@ -1,913 +0,0 @@ -/* - ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -/* - * This file has been automatically generated using ChibiStudio board - * generator plugin. Do not edit manually. - */ - -#ifndef BOARD_H -#define BOARD_H - -/* - * Setup for ST STM32L-Discovery board. - */ - -/* - * Board identifier. - */ -#define BOARD_STM32L151_ANNE_PRO -#define BOARD_NAME "STM32L151 Anne Pro" - -/* Address of the bootloader */ -#define STM32_BOOTLOADER_ADDRESS 0x08000000 - -/* - * Board oscillators-related settings. - * NOTE: HSE not fitted. - */ -#if !defined(STM32_LSECLK) -#define STM32_LSECLK 0U -#endif - -#if !defined(STM32_HSECLK) -#define STM32_HSECLK 16000000U -#endif - -// #define STM32_HSE_BYPASS - -/* - * MCU type as defined in the ST header file stm32l1xx.h. - */ -#define STM32L151xB - -/* - * 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_USB_DM 11U -#define GPIOA_USB_DP 12U -#define GPIOA_JTAG_TMS 13U -#define GPIOA_JTAG_TCK 14U -#define GPIOA_JTAG_TDI 15U - -#define GPIOB_PIN0 0U -#define GPIOB_PIN1 1U -#define GPIOB_BOOT1 2U -#define GPIOB_JTAG_TDO 3U -#define GPIOB_JTAG_TRST 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_OSC32_IN 14U -#define GPIOC_OSC32_OUT 15U - -#define GPIOD_PIN0 0U -#define GPIOD_PIN1 1U -#define GPIOD_PIN2 2U -#define GPIOD_PIN3 3U -#define GPIOD_PIN4 4U -#define GPIOD_PIN5 5U -#define GPIOD_PIN6 6U -#define GPIOD_PIN7 7U -#define GPIOD_PIN8 8U -#define GPIOD_PIN9 9U -#define GPIOD_PIN10 10U -#define GPIOD_PIN11 11U -#define GPIOD_PIN12 12U -#define GPIOD_PIN13 13U -#define GPIOD_PIN14 14U -#define GPIOD_PIN15 15U - -#define GPIOE_PIN0 0U -#define GPIOE_PIN1 1U -#define GPIOE_PIN2 2U -#define GPIOE_PIN3 3U -#define GPIOE_PIN4 4U -#define GPIOE_PIN5 5U -#define GPIOE_PIN6 6U -#define GPIOE_PIN7 7U -#define GPIOE_PIN8 8U -#define GPIOE_PIN9 9U -#define GPIOE_PIN10 10U -#define GPIOE_PIN11 11U -#define GPIOE_PIN12 12U -#define GPIOE_PIN13 13U -#define GPIOE_PIN14 14U -#define GPIOE_PIN15 15U - -#define GPIOH_OSC_IN 0U -#define GPIOH_OSC_OUT 1U -#define GPIOH_PIN2 2U -#define GPIOH_PIN3 3U -#define GPIOH_PIN4 4U -#define GPIOH_PIN5 5U -#define GPIOH_PIN6 6U -#define GPIOH_PIN7 7U -#define GPIOH_PIN8 8U -#define GPIOH_PIN9 9U -#define GPIOH_PIN10 10U -#define GPIOH_PIN11 11U -#define GPIOH_PIN12 12U -#define GPIOH_PIN13 13U -#define GPIOH_PIN14 14U -#define GPIOH_PIN15 15U - -/* - * IO lines assignments. - */ -#define LINE_JTAG_TMS PAL_LINE(GPIOA, 13U) -#define LINE_JTAG_TCK PAL_LINE(GPIOA, 14U) -#define LINE_JTAG_TDI PAL_LINE(GPIOA, 15U) - -#define LINE_BOOT1 PAL_LINE(GPIOB, 2U) -#define LINE_JTAG_TDO PAL_LINE(GPIOB, 3U) -#define LINE_JTAG_TRST PAL_LINE(GPIOB, 4U) - -#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) -#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) - -#define LINE_OSC_IN PAL_LINE(GPIOH, 0U) -#define LINE_OSC_OUT PAL_LINE(GPIOH, 1U) - -/* - * I/O ports initial setup, this configuration is established soon after reset - * in the initialization code. - * Please refer to the STM32 Reference Manual for details. - */ -#define PIN_MODE_INPUT(n) (0U << ((n) * 2U)) -#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2U)) -#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2U)) -#define PIN_MODE_ANALOG(n) (3U << ((n) * 2U)) -#define PIN_ODR_LOW(n) (0U << (n)) -#define PIN_ODR_HIGH(n) (1U << (n)) -#define PIN_OTYPE_PUSHPULL(n) (0U << (n)) -#define PIN_OTYPE_OPENDRAIN(n) (1U << (n)) -#define PIN_OSPEED_VERYLOW(n) (0U << ((n) * 2U)) -#define PIN_OSPEED_LOW(n) (1U << ((n) * 2U)) -#define PIN_OSPEED_MEDIUM(n) (2U << ((n) * 2U)) -#define PIN_OSPEED_HIGH(n) (3U << ((n) * 2U)) -#define PIN_PUPDR_FLOATING(n) (0U << ((n) * 2U)) -#define PIN_PUPDR_PULLUP(n) (1U << ((n) * 2U)) -#define PIN_PUPDR_PULLDOWN(n) (2U << ((n) * 2U)) -#define PIN_AFIO_AF(n, v) ((v) << (((n) % 8U) * 4U)) - -/* - * GPIOA setup: - * - * PA0 - PIN0 (input pullup). - * PA1 - PIN1 (input pullup). - * PA2 - PIN2 (input pullup). - * PA3 - PIN3 (input pullup). - * PA4 - PIN4 (input pullup). - * PA5 - PIN5 (input pullup). - * PA6 - PIN6 (input pullup). - * PA7 - PIN7 (input pullup). - * PA8 - PIN8 (input pullup). - * PA9 - PIN9 (input pullup). - * PA10 - PIN10 (input pullup). - * PA11 - USB_DM (fast input pullup). - * PA12 - USB_DP (fast input pullup). - * PA13 - JTAG_TMS (alternate 0). - * PA14 - JTAG_TCK (alternate 0). - * PA15 - JTAG_TDI (alternate 0). - */ -#define VAL_GPIOA_MODER (PIN_MODE_INPUT(GPIOA_PIN0) | \ - PIN_MODE_INPUT(GPIOA_PIN1) | \ - PIN_MODE_INPUT(GPIOA_PIN2) | \ - PIN_MODE_INPUT(GPIOA_PIN3) | \ - PIN_MODE_INPUT(GPIOA_PIN4) | \ - PIN_MODE_INPUT(GPIOA_PIN5) | \ - PIN_MODE_INPUT(GPIOA_PIN6) | \ - PIN_MODE_INPUT(GPIOA_PIN7) | \ - PIN_MODE_INPUT(GPIOA_PIN8) | \ - PIN_MODE_INPUT(GPIOA_PIN9) | \ - PIN_MODE_INPUT(GPIOA_PIN10) | \ - PIN_MODE_INPUT(GPIOA_USB_DM) | \ - PIN_MODE_INPUT(GPIOA_USB_DP) | \ - PIN_MODE_ALTERNATE(GPIOA_JTAG_TMS) | \ - PIN_MODE_ALTERNATE(GPIOA_JTAG_TCK) | \ - PIN_MODE_ALTERNATE(GPIOA_JTAG_TDI)) -#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOA_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOA_USB_DM) | \ - PIN_OTYPE_PUSHPULL(GPIOA_USB_DP) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TMS) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TCK) | \ - PIN_OTYPE_PUSHPULL(GPIOA_JTAG_TDI)) -#define VAL_GPIOA_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOA_PIN0) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN1) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOA_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOA_USB_DM) | \ - PIN_OSPEED_VERYLOW(GPIOA_USB_DP) | \ - PIN_OSPEED_HIGH(GPIOA_JTAG_TMS) | \ - PIN_OSPEED_HIGH(GPIOA_JTAG_TCK) | \ - PIN_OSPEED_HIGH(GPIOA_JTAG_TDI)) -#define VAL_GPIOA_PUPDR (PIN_PUPDR_PULLUP(GPIOA_PIN0) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN1) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOA_PIN10) | \ - PIN_PUPDR_FLOATING(GPIOA_USB_DM) | \ - PIN_PUPDR_FLOATING(GPIOA_USB_DP) | \ - PIN_PUPDR_PULLUP(GPIOA_JTAG_TMS) | \ - PIN_PUPDR_PULLDOWN(GPIOA_JTAG_TCK) | \ - PIN_PUPDR_PULLUP(GPIOA_JTAG_TDI)) -#define VAL_GPIOA_ODR (PIN_ODR_HIGH(GPIOA_PIN0) | \ - PIN_ODR_HIGH(GPIOA_PIN1) | \ - PIN_ODR_HIGH(GPIOA_PIN2) | \ - PIN_ODR_HIGH(GPIOA_PIN3) | \ - PIN_ODR_HIGH(GPIOA_PIN4) | \ - PIN_ODR_HIGH(GPIOA_PIN5) | \ - PIN_ODR_HIGH(GPIOA_PIN6) | \ - PIN_ODR_HIGH(GPIOA_PIN7) | \ - PIN_ODR_HIGH(GPIOA_PIN8) | \ - PIN_ODR_HIGH(GPIOA_PIN9) | \ - PIN_ODR_HIGH(GPIOA_PIN10) | \ - PIN_ODR_LOW(GPIOA_USB_DM) | \ - PIN_ODR_LOW(GPIOA_USB_DP) | \ - PIN_ODR_HIGH(GPIOA_JTAG_TMS) | \ - PIN_ODR_HIGH(GPIOA_JTAG_TCK) | \ - PIN_ODR_HIGH(GPIOA_JTAG_TDI)) -#define VAL_GPIOA_AFRL (PIN_AFIO_AF(GPIOA_PIN0, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN1, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN7, 0U)) -#define VAL_GPIOA_AFRH (PIN_AFIO_AF(GPIOA_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOA_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOA_USB_DM, 0U) | \ - PIN_AFIO_AF(GPIOA_USB_DP, 0U) | \ - PIN_AFIO_AF(GPIOA_JTAG_TMS, 0U) | \ - PIN_AFIO_AF(GPIOA_JTAG_TCK, 0U) | \ - PIN_AFIO_AF(GPIOA_JTAG_TDI, 0U)) - -/* - * GPIOB setup: - * - * PB0 - PIN0 (input pullup). - * PB1 - PIN1 (input pullup). - * PB2 - BOOT1 (input floating). - * PB3 - JTAG_TDO (alternate 0). - * PB4 - JTAG_TRST (alternate 0). - * PB5 - PIN5 (input pullup). - * PB6 - PIN6 (input pullup). - * PB7 - PIN7 (input pullup). - * PB8 - PIN8 (input pullup). - * PB9 - PIN9 (input pullup). - * PB10 - PIN10 (input pullup). - * PB11 - PIN11 (input pullup). - * PB12 - PIN12 (input pullup). - * PB13 - PIN13 (input pullup). - * PB14 - PIN14 (input pullup). - * PB15 - PIN15 (input pullup). - */ -#define VAL_GPIOB_MODER (PIN_MODE_INPUT(GPIOB_PIN0) | \ - PIN_MODE_INPUT(GPIOB_PIN1) | \ - PIN_MODE_INPUT(GPIOB_BOOT1) | \ - PIN_MODE_ALTERNATE(GPIOB_JTAG_TDO) | \ - PIN_MODE_ALTERNATE(GPIOB_JTAG_TRST) | \ - PIN_MODE_INPUT(GPIOB_PIN5) | \ - PIN_MODE_INPUT(GPIOB_PIN6) | \ - PIN_MODE_INPUT(GPIOB_PIN7) | \ - PIN_MODE_INPUT(GPIOB_PIN8) | \ - PIN_MODE_INPUT(GPIOB_PIN9) | \ - PIN_MODE_INPUT(GPIOB_PIN10) | \ - PIN_MODE_INPUT(GPIOB_PIN11) | \ - PIN_MODE_INPUT(GPIOB_PIN12) | \ - PIN_MODE_INPUT(GPIOB_PIN13) | \ - PIN_MODE_INPUT(GPIOB_PIN14) | \ - PIN_MODE_INPUT(GPIOB_PIN15)) -#define VAL_GPIOB_OTYPER (PIN_OTYPE_PUSHPULL(GPIOB_PIN0) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN1) | \ - PIN_OTYPE_PUSHPULL(GPIOB_BOOT1) | \ - PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TDO) | \ - PIN_OTYPE_PUSHPULL(GPIOB_JTAG_TRST) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN14) | \ - PIN_OTYPE_PUSHPULL(GPIOB_PIN15)) -#define VAL_GPIOB_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOB_PIN0) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN1) | \ - PIN_OSPEED_HIGH(GPIOB_BOOT1) | \ - PIN_OSPEED_HIGH(GPIOB_JTAG_TDO) | \ - PIN_OSPEED_HIGH(GPIOB_JTAG_TRST) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN13) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN14) | \ - PIN_OSPEED_VERYLOW(GPIOB_PIN15)) -#define VAL_GPIOB_PUPDR (PIN_PUPDR_PULLUP(GPIOB_PIN0) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN1) | \ - PIN_PUPDR_FLOATING(GPIOB_BOOT1) | \ - PIN_PUPDR_FLOATING(GPIOB_JTAG_TDO) | \ - PIN_PUPDR_PULLUP(GPIOB_JTAG_TRST) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN13) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN14) | \ - PIN_PUPDR_PULLUP(GPIOB_PIN15)) -#define VAL_GPIOB_ODR (PIN_ODR_HIGH(GPIOB_PIN0) | \ - PIN_ODR_HIGH(GPIOB_PIN1) | \ - PIN_ODR_HIGH(GPIOB_BOOT1) | \ - PIN_ODR_HIGH(GPIOB_JTAG_TDO) | \ - PIN_ODR_HIGH(GPIOB_JTAG_TRST) | \ - PIN_ODR_HIGH(GPIOB_PIN5) | \ - PIN_ODR_HIGH(GPIOB_PIN6) | \ - PIN_ODR_HIGH(GPIOB_PIN7) | \ - PIN_ODR_HIGH(GPIOB_PIN8) | \ - PIN_ODR_HIGH(GPIOB_PIN9) | \ - PIN_ODR_HIGH(GPIOB_PIN10) | \ - PIN_ODR_HIGH(GPIOB_PIN11) | \ - PIN_ODR_HIGH(GPIOB_PIN12) | \ - PIN_ODR_HIGH(GPIOB_PIN13) | \ - PIN_ODR_HIGH(GPIOB_PIN14) | \ - PIN_ODR_HIGH(GPIOB_PIN15)) -#define VAL_GPIOB_AFRL (PIN_AFIO_AF(GPIOB_PIN0, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN1, 0U) | \ - PIN_AFIO_AF(GPIOB_BOOT1, 0U) | \ - PIN_AFIO_AF(GPIOB_JTAG_TDO, 0U) | \ - PIN_AFIO_AF(GPIOB_JTAG_TRST, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN7, 0U)) -#define VAL_GPIOB_AFRH (PIN_AFIO_AF(GPIOB_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN14, 0U) | \ - PIN_AFIO_AF(GPIOB_PIN15, 0U)) - -/* - * GPIOC setup: - * - * PC0 - PIN0 (input pullup). - * PC1 - PIN1 (input pullup). - * PC2 - PIN2 (input pullup). - * PC3 - PIN3 (input pullup). - * PC4 - PIN4 (input pullup). - * PC5 - PIN5 (input pullup). - * PC6 - PIN6 (input pullup). - * PC7 - PIN7 (input pullup). - * PC8 - PIN8 (input pullup). - * PC9 - PIN9 (input pullup). - * PC10 - PIN10 (input pullup). - * PC11 - PIN11 (input pullup). - * PC12 - PIN12 (input pullup). - * PC13 - PIN13 (input pullup). - * PC14 - OSC32_IN (input floating). - * PC15 - OSC32_OUT (input floating). - */ -#define VAL_GPIOC_MODER (PIN_MODE_INPUT(GPIOC_PIN0) | \ - PIN_MODE_INPUT(GPIOC_PIN1) | \ - PIN_MODE_INPUT(GPIOC_PIN2) | \ - PIN_MODE_INPUT(GPIOC_PIN3) | \ - PIN_MODE_INPUT(GPIOC_PIN4) | \ - PIN_MODE_INPUT(GPIOC_PIN5) | \ - PIN_MODE_INPUT(GPIOC_PIN6) | \ - PIN_MODE_INPUT(GPIOC_PIN7) | \ - PIN_MODE_INPUT(GPIOC_PIN8) | \ - PIN_MODE_INPUT(GPIOC_PIN9) | \ - PIN_MODE_INPUT(GPIOC_PIN10) | \ - PIN_MODE_INPUT(GPIOC_PIN11) | \ - PIN_MODE_INPUT(GPIOC_PIN12) | \ - PIN_MODE_INPUT(GPIOC_PIN13) | \ - PIN_MODE_INPUT(GPIOC_OSC32_IN) | \ - PIN_MODE_INPUT(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_OTYPER (PIN_OTYPE_PUSHPULL(GPIOC_PIN0) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN1) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOC_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOC_OSC32_IN) | \ - PIN_OTYPE_PUSHPULL(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOC_PIN0) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN1) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOC_PIN13) | \ - PIN_OSPEED_HIGH(GPIOC_OSC32_IN) | \ - PIN_OSPEED_HIGH(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_PUPDR (PIN_PUPDR_PULLUP(GPIOC_PIN0) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN1) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOC_PIN13) | \ - PIN_PUPDR_FLOATING(GPIOC_OSC32_IN) | \ - PIN_PUPDR_FLOATING(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_ODR (PIN_ODR_HIGH(GPIOC_PIN0) | \ - PIN_ODR_HIGH(GPIOC_PIN1) | \ - PIN_ODR_HIGH(GPIOC_PIN2) | \ - PIN_ODR_HIGH(GPIOC_PIN3) | \ - PIN_ODR_HIGH(GPIOC_PIN4) | \ - PIN_ODR_HIGH(GPIOC_PIN5) | \ - PIN_ODR_HIGH(GPIOC_PIN6) | \ - PIN_ODR_HIGH(GPIOC_PIN7) | \ - PIN_ODR_HIGH(GPIOC_PIN8) | \ - PIN_ODR_HIGH(GPIOC_PIN9) | \ - PIN_ODR_HIGH(GPIOC_PIN10) | \ - PIN_ODR_HIGH(GPIOC_PIN11) | \ - PIN_ODR_HIGH(GPIOC_PIN12) | \ - PIN_ODR_HIGH(GPIOC_PIN13) | \ - PIN_ODR_HIGH(GPIOC_OSC32_IN) | \ - PIN_ODR_HIGH(GPIOC_OSC32_OUT)) -#define VAL_GPIOC_AFRL (PIN_AFIO_AF(GPIOC_PIN0, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN1, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN7, 0U)) -#define VAL_GPIOC_AFRH (PIN_AFIO_AF(GPIOC_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOC_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOC_OSC32_IN, 0U) | \ - PIN_AFIO_AF(GPIOC_OSC32_OUT, 0U)) - -/* - * GPIOD setup: - * - * PD0 - PIN0 (input pullup). - * PD1 - PIN1 (input pullup). - * PD2 - PIN2 (input pullup). - * PD3 - PIN3 (input pullup). - * PD4 - PIN4 (input pullup). - * PD5 - PIN5 (input pullup). - * PD6 - PIN6 (input pullup). - * PD7 - PIN7 (input pullup). - * PD8 - PIN8 (input pullup). - * PD9 - PIN9 (input pullup). - * PD10 - PIN10 (input pullup). - * PD11 - PIN11 (input pullup). - * PD12 - PIN12 (input pullup). - * PD13 - PIN13 (input pullup). - * PD14 - PIN14 (input pullup). - * PD15 - PIN15 (input pullup). - */ -#define VAL_GPIOD_MODER (PIN_MODE_INPUT(GPIOD_PIN0) | \ - PIN_MODE_INPUT(GPIOD_PIN1) | \ - PIN_MODE_INPUT(GPIOD_PIN2) | \ - PIN_MODE_INPUT(GPIOD_PIN3) | \ - PIN_MODE_INPUT(GPIOD_PIN4) | \ - PIN_MODE_INPUT(GPIOD_PIN5) | \ - PIN_MODE_INPUT(GPIOD_PIN6) | \ - PIN_MODE_INPUT(GPIOD_PIN7) | \ - PIN_MODE_INPUT(GPIOD_PIN8) | \ - PIN_MODE_INPUT(GPIOD_PIN9) | \ - PIN_MODE_INPUT(GPIOD_PIN10) | \ - PIN_MODE_INPUT(GPIOD_PIN11) | \ - PIN_MODE_INPUT(GPIOD_PIN12) | \ - PIN_MODE_INPUT(GPIOD_PIN13) | \ - PIN_MODE_INPUT(GPIOD_PIN14) | \ - PIN_MODE_INPUT(GPIOD_PIN15)) -#define VAL_GPIOD_OTYPER (PIN_OTYPE_PUSHPULL(GPIOD_PIN0) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN1) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN14) | \ - PIN_OTYPE_PUSHPULL(GPIOD_PIN15)) -#define VAL_GPIOD_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOD_PIN0) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN1) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN13) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN14) | \ - PIN_OSPEED_VERYLOW(GPIOD_PIN15)) -#define VAL_GPIOD_PUPDR (PIN_PUPDR_PULLUP(GPIOD_PIN0) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN1) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN13) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN14) | \ - PIN_PUPDR_PULLUP(GPIOD_PIN15)) -#define VAL_GPIOD_ODR (PIN_ODR_HIGH(GPIOD_PIN0) | \ - PIN_ODR_HIGH(GPIOD_PIN1) | \ - PIN_ODR_HIGH(GPIOD_PIN2) | \ - PIN_ODR_HIGH(GPIOD_PIN3) | \ - PIN_ODR_HIGH(GPIOD_PIN4) | \ - PIN_ODR_HIGH(GPIOD_PIN5) | \ - PIN_ODR_HIGH(GPIOD_PIN6) | \ - PIN_ODR_HIGH(GPIOD_PIN7) | \ - PIN_ODR_HIGH(GPIOD_PIN8) | \ - PIN_ODR_HIGH(GPIOD_PIN9) | \ - PIN_ODR_HIGH(GPIOD_PIN10) | \ - PIN_ODR_HIGH(GPIOD_PIN11) | \ - PIN_ODR_HIGH(GPIOD_PIN12) | \ - PIN_ODR_HIGH(GPIOD_PIN13) | \ - PIN_ODR_HIGH(GPIOD_PIN14) | \ - PIN_ODR_HIGH(GPIOD_PIN15)) -#define VAL_GPIOD_AFRL (PIN_AFIO_AF(GPIOD_PIN0, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN1, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN7, 0U)) -#define VAL_GPIOD_AFRH (PIN_AFIO_AF(GPIOD_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN14, 0U) | \ - PIN_AFIO_AF(GPIOD_PIN15, 0U)) - -/* - * GPIOE setup: - * - * PE0 - PIN0 (input pullup). - * PE1 - PIN1 (input pullup). - * PE2 - PIN2 (input pullup). - * PE3 - PIN3 (input pullup). - * PE4 - PIN4 (input pullup). - * PE5 - PIN5 (input pullup). - * PE6 - PIN6 (input pullup). - * PE7 - PIN7 (input pullup). - * PE8 - PIN8 (input pullup). - * PE9 - PIN9 (input pullup). - * PE10 - PIN10 (input pullup). - * PE11 - PIN11 (input pullup). - * PE12 - PIN12 (input pullup). - * PE13 - PIN13 (input pullup). - * PE14 - PIN14 (input pullup). - * PE15 - PIN15 (input pullup). - */ -#define VAL_GPIOE_MODER (PIN_MODE_INPUT(GPIOE_PIN0) | \ - PIN_MODE_INPUT(GPIOE_PIN1) | \ - PIN_MODE_INPUT(GPIOE_PIN2) | \ - PIN_MODE_INPUT(GPIOE_PIN3) | \ - PIN_MODE_INPUT(GPIOE_PIN4) | \ - PIN_MODE_INPUT(GPIOE_PIN5) | \ - PIN_MODE_INPUT(GPIOE_PIN6) | \ - PIN_MODE_INPUT(GPIOE_PIN7) | \ - PIN_MODE_INPUT(GPIOE_PIN8) | \ - PIN_MODE_INPUT(GPIOE_PIN9) | \ - PIN_MODE_INPUT(GPIOE_PIN10) | \ - PIN_MODE_INPUT(GPIOE_PIN11) | \ - PIN_MODE_INPUT(GPIOE_PIN12) | \ - PIN_MODE_INPUT(GPIOE_PIN13) | \ - PIN_MODE_INPUT(GPIOE_PIN14) | \ - PIN_MODE_INPUT(GPIOE_PIN15)) -#define VAL_GPIOE_OTYPER (PIN_OTYPE_PUSHPULL(GPIOE_PIN0) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN1) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN14) | \ - PIN_OTYPE_PUSHPULL(GPIOE_PIN15)) -#define VAL_GPIOE_OSPEEDR (PIN_OSPEED_VERYLOW(GPIOE_PIN0) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN1) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN13) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN14) | \ - PIN_OSPEED_VERYLOW(GPIOE_PIN15)) -#define VAL_GPIOE_PUPDR (PIN_PUPDR_PULLUP(GPIOE_PIN0) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN1) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN13) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN14) | \ - PIN_PUPDR_PULLUP(GPIOE_PIN15)) -#define VAL_GPIOE_ODR (PIN_ODR_HIGH(GPIOE_PIN0) | \ - PIN_ODR_HIGH(GPIOE_PIN1) | \ - PIN_ODR_HIGH(GPIOE_PIN2) | \ - PIN_ODR_HIGH(GPIOE_PIN3) | \ - PIN_ODR_HIGH(GPIOE_PIN4) | \ - PIN_ODR_HIGH(GPIOE_PIN5) | \ - PIN_ODR_HIGH(GPIOE_PIN6) | \ - PIN_ODR_HIGH(GPIOE_PIN7) | \ - PIN_ODR_HIGH(GPIOE_PIN8) | \ - PIN_ODR_HIGH(GPIOE_PIN9) | \ - PIN_ODR_HIGH(GPIOE_PIN10) | \ - PIN_ODR_HIGH(GPIOE_PIN11) | \ - PIN_ODR_HIGH(GPIOE_PIN12) | \ - PIN_ODR_HIGH(GPIOE_PIN13) | \ - PIN_ODR_HIGH(GPIOE_PIN14) | \ - PIN_ODR_HIGH(GPIOE_PIN15)) -#define VAL_GPIOE_AFRL (PIN_AFIO_AF(GPIOE_PIN0, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN1, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN7, 0U)) -#define VAL_GPIOE_AFRH (PIN_AFIO_AF(GPIOE_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN14, 0U) | \ - PIN_AFIO_AF(GPIOE_PIN15, 0U)) - -/* - * GPIOH setup: - * - * PH0 - OSC_IN (input floating). - * PH1 - OSC_OUT (input floating). - * PH2 - PIN2 (input pullup). - * PH3 - PIN3 (input pullup). - * PH4 - PIN4 (input pullup). - * PH5 - PIN5 (input pullup). - * PH6 - PIN6 (input pullup). - * PH7 - PIN7 (input pullup). - * PH8 - PIN8 (input pullup). - * PH9 - PIN9 (input pullup). - * PH10 - PIN10 (input pullup). - * PH11 - PIN11 (input pullup). - * PH12 - PIN12 (input pullup). - * PH13 - PIN13 (input pullup). - * PH14 - PIN14 (input pullup). - * PH15 - PIN15 (input pullup). - */ -#define VAL_GPIOH_MODER (PIN_MODE_INPUT(GPIOH_OSC_IN) | \ - PIN_MODE_INPUT(GPIOH_OSC_OUT) | \ - PIN_MODE_INPUT(GPIOH_PIN2) | \ - PIN_MODE_INPUT(GPIOH_PIN3) | \ - PIN_MODE_INPUT(GPIOH_PIN4) | \ - PIN_MODE_INPUT(GPIOH_PIN5) | \ - PIN_MODE_INPUT(GPIOH_PIN6) | \ - PIN_MODE_INPUT(GPIOH_PIN7) | \ - PIN_MODE_INPUT(GPIOH_PIN8) | \ - PIN_MODE_INPUT(GPIOH_PIN9) | \ - PIN_MODE_INPUT(GPIOH_PIN10) | \ - PIN_MODE_INPUT(GPIOH_PIN11) | \ - PIN_MODE_INPUT(GPIOH_PIN12) | \ - PIN_MODE_INPUT(GPIOH_PIN13) | \ - PIN_MODE_INPUT(GPIOH_PIN14) | \ - PIN_MODE_INPUT(GPIOH_PIN15)) -#define VAL_GPIOH_OTYPER (PIN_OTYPE_PUSHPULL(GPIOH_OSC_IN) | \ - PIN_OTYPE_PUSHPULL(GPIOH_OSC_OUT) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN2) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN3) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN4) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN5) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN6) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN7) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN8) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN9) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN10) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN11) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN12) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN13) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN14) | \ - PIN_OTYPE_PUSHPULL(GPIOH_PIN15)) -#define VAL_GPIOH_OSPEEDR (PIN_OSPEED_HIGH(GPIOH_OSC_IN) | \ - PIN_OSPEED_HIGH(GPIOH_OSC_OUT) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN2) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN3) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN4) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN5) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN6) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN7) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN8) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN9) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN10) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN11) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN12) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN13) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN14) | \ - PIN_OSPEED_VERYLOW(GPIOH_PIN15)) -#define VAL_GPIOH_PUPDR (PIN_PUPDR_FLOATING(GPIOH_OSC_IN) | \ - PIN_PUPDR_FLOATING(GPIOH_OSC_OUT) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN2) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN3) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN4) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN5) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN6) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN7) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN8) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN9) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN10) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN11) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN12) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN13) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN14) | \ - PIN_PUPDR_PULLUP(GPIOH_PIN15)) -#define VAL_GPIOH_ODR (PIN_ODR_HIGH(GPIOH_OSC_IN) | \ - PIN_ODR_HIGH(GPIOH_OSC_OUT) | \ - PIN_ODR_HIGH(GPIOH_PIN2) | \ - PIN_ODR_HIGH(GPIOH_PIN3) | \ - PIN_ODR_HIGH(GPIOH_PIN4) | \ - PIN_ODR_HIGH(GPIOH_PIN5) | \ - PIN_ODR_HIGH(GPIOH_PIN6) | \ - PIN_ODR_HIGH(GPIOH_PIN7) | \ - PIN_ODR_HIGH(GPIOH_PIN8) | \ - PIN_ODR_HIGH(GPIOH_PIN9) | \ - PIN_ODR_HIGH(GPIOH_PIN10) | \ - PIN_ODR_HIGH(GPIOH_PIN11) | \ - PIN_ODR_HIGH(GPIOH_PIN12) | \ - PIN_ODR_HIGH(GPIOH_PIN13) | \ - PIN_ODR_HIGH(GPIOH_PIN14) | \ - PIN_ODR_HIGH(GPIOH_PIN15)) -#define VAL_GPIOH_AFRL (PIN_AFIO_AF(GPIOH_OSC_IN, 0U) | \ - PIN_AFIO_AF(GPIOH_OSC_OUT, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN2, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN3, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN4, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN5, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN6, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN7, 0U)) -#define VAL_GPIOH_AFRH (PIN_AFIO_AF(GPIOH_PIN8, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN9, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN10, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN11, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN12, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN13, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN14, 0U) | \ - PIN_AFIO_AF(GPIOH_PIN15, 0U)) - -#if !defined(_FROM_ASM_) -#ifdef __cplusplus -extern "C" { -#endif - void boardInit(void); -#ifdef __cplusplus -} -#endif -#endif /* _FROM_ASM_ */ - -#endif /* BOARD_H */ diff --git a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk index 5eef1f01977..11ddc8e83fd 100644 --- a/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk +++ b/keyboards/anne_pro/boards/STM32L151_ANNE_PRO/board.mk @@ -1,5 +1,5 @@ # List of all the board related files. -BOARDSRC = $(BOARD_PATH)/boards/STM32L151_ANNE_PRO/board.c +BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_L152RE/board.c # Required include directories -BOARDINC = $(BOARD_PATH)/boards/STM32L151_ANNE_PRO +BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_L152RE diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 7f4021ce47f..9635ea2e1eb 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -16,6 +16,9 @@ #pragma once +#define STM32_HSECLK 16000000U +#define STM32_BOOTLOADER_ADDRESS 0x08000000 +#define STM32L152xB /* * Timeout after which the backlight of the keyboard is disabled if no keypresses are received. From adfe30411207506b902ec795cf858bfd0a96ac8d Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Thu, 13 Feb 2025 11:32:19 -0500 Subject: [PATCH 61/68] fix lighting commands not registering --- keyboards/anne_pro/anne_pro_lighting.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 73f11dafb56..8056f80ce9f 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -142,6 +142,9 @@ void anne_pro_lighting_update(void) { } if (!uart_tx_ringbuf_empty(&led_uart_ringbuf)) { + /* we need to slightly delay transmission in order for it to register + * on the receiving end */ + chThdSleepMilliseconds(1); uart_tx_ringbuf_start_transmission(&led_uart_ringbuf); } } From 9c4fca4c91f8c60be987fdfb5cf06e8236b847df Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Thu, 13 Feb 2025 12:57:38 -0500 Subject: [PATCH 62/68] update README to follow guidelines --- keyboards/anne_pro/README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/README.md index 72651525a37..713b04a716b 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/README.md @@ -6,8 +6,8 @@ QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.ob __This firmware is not created or supported by the creator of this keyboard!__ -Keyboard Maintainer: [Michiel Visser](https://github.com/msvisser) -Hardware Supported: Anne Pro (this means no support for the _Anne Pro 2_) +Keyboard Maintainers: [Michiel Visser](https://github.com/msvisser), [Joel Beckmeyer](https://github.com/TinfoilSubmarine/) +Hardware Supported: Anne Pro (the original, not the _Anne Pro 2_) Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) Make sure you check out the correct branch for this keyboard and initialize the submodules! @@ -31,8 +31,11 @@ To convert the `bin` file to a `dfu` file the following script can be used 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 by first unplugging the keyboard. Hold down the Esc key and while holding it down, briefly press the button on the bottom of the keyboard using a paperclip or some other small object. You can then release the Esc key, at which point it will enter the bootloader. You can now plug the keyboard back in. + ## Firmware requirements for LED backlight -To get functioning backlighting for the Anne Pro the original LED firmware is required. This should be the version v1.40, which is available on the [Obins website](http://en.obins.net/firmware#1). __The backlight will not work with the newer ObinsKit firmware!__ This firmware can be installed by following the update guide on the Obins website, or using `dfu-util` if you know what you are doing. +To get functioning backlighting for the Anne Pro the original LED firmware is required. This should be the version v1.40, which is available on the [Hexcore website](https://service.hexcore.xyz/manual/annepro/#42-anne-pro-firmware). __The backlight will not work with the newer ObinsKit firmware!__ This firmware can be installed by following the update guide on the same Hexcore website, or using `dfu-util` if you know what you are doing. ## Bluetooth pairing The Bluetooth setup is similar to the original Anne Pro firmware. After pressing `Fn + B` the Bluetooth layer shows up. By pressing the `+` key Bluetooth is enabled. You can now pair your computer. Once the computer asks for the pairing code the lights on the keyboard should turn off. You can now simply enter the pairing code and hit connect on the computer, this should pair the device. From 90ec5bb5a1393132414d0fa12920e7f99fbe47b0 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Thu, 13 Feb 2025 14:08:36 -0500 Subject: [PATCH 63/68] clarify need for custom keycodes in comment --- keyboards/anne_pro/anne_pro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 9dd76e0600c..4fba593e171 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -17,7 +17,7 @@ #pragma once #include "quantum.h" -/* Custom keycodes for the lighting control for the Anne Pro */ +/* Custom keycodes for Lighting and Bluetooth control */ enum anne_pro_keycodes { APL_RGB = SAFE_RANGE, APL_RAT, From 39c28a727b44d996f3f923b58cffec5f8f78f548 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 14 Feb 2025 09:09:11 -0500 Subject: [PATCH 64/68] use QMK best practices --- keyboards/anne_pro/anne_pro.c | 2 +- keyboards/anne_pro/anne_pro.h | 5 ++--- keyboards/anne_pro/anne_pro_bluetooth.c | 2 +- keyboards/anne_pro/anne_pro_bluetooth.h | 2 +- keyboards/anne_pro/anne_pro_lighting.c | 2 +- keyboards/anne_pro/anne_pro_lighting.h | 2 +- keyboards/anne_pro/config.h | 2 +- keyboards/anne_pro/keyboard.json | 2 +- .../anne_pro/keymaps/anne-pro-2-mac/keymap.c | 2 +- .../anne_pro/keymaps/anne-pro-2-win/keymap.c | 2 +- keyboards/anne_pro/keymaps/arrow/keymap.c | 2 +- keyboards/anne_pro/keymaps/default/keymap.c | 2 +- keyboards/anne_pro/keymaps/macos/keymap.c | 2 +- keyboards/anne_pro/mcuconf.h | 4 +--- keyboards/anne_pro/{README.md => readme.md} | 19 +++++++------------ keyboards/anne_pro/uart_tx_ringbuf.c | 2 +- keyboards/anne_pro/uart_tx_ringbuf.h | 2 +- 17 files changed, 24 insertions(+), 32 deletions(-) rename keyboards/anne_pro/{README.md => readme.md} (69%) diff --git a/keyboards/anne_pro/anne_pro.c b/keyboards/anne_pro/anne_pro.c index a3c6cd299b4..0e38231bc58 100644 --- a/keyboards/anne_pro/anne_pro.c +++ b/keyboards/anne_pro/anne_pro.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 4fba593e171..087de1c487f 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ /* Custom keycodes for Lighting and Bluetooth control */ enum anne_pro_keycodes { - APL_RGB = SAFE_RANGE, + APL_RGB = QK_USER, APL_RAT, APL_BRT, APL_MOD, @@ -39,5 +39,4 @@ enum anne_pro_keycodes { APB_HD2, APB_HD3, APB_HD4, - NEW_SAFE_RANGE, }; diff --git a/keyboards/anne_pro/anne_pro_bluetooth.c b/keyboards/anne_pro/anne_pro_bluetooth.c index 76cbba66e16..59a96673067 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.c +++ b/keyboards/anne_pro/anne_pro_bluetooth.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/anne_pro_bluetooth.h b/keyboards/anne_pro/anne_pro_bluetooth.h index be402c08636..499331d4d29 100644 --- a/keyboards/anne_pro/anne_pro_bluetooth.h +++ b/keyboards/anne_pro/anne_pro_bluetooth.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/anne_pro_lighting.c b/keyboards/anne_pro/anne_pro_lighting.c index 8056f80ce9f..00a091732da 100644 --- a/keyboards/anne_pro/anne_pro_lighting.c +++ b/keyboards/anne_pro/anne_pro_lighting.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/anne_pro_lighting.h b/keyboards/anne_pro/anne_pro_lighting.h index 749ab5b6c23..e8dd418487d 100644 --- a/keyboards/anne_pro/anne_pro_lighting.h +++ b/keyboards/anne_pro/anne_pro_lighting.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/config.h b/keyboards/anne_pro/config.h index 9635ea2e1eb..24e4daea570 100644 --- a/keyboards/anne_pro/config.h +++ b/keyboards/anne_pro/config.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/keyboard.json b/keyboards/anne_pro/keyboard.json index e6ca040949f..230d114033c 100644 --- a/keyboards/anne_pro/keyboard.json +++ b/keyboards/anne_pro/keyboard.json @@ -19,7 +19,7 @@ "cols": ["A5", "A6", "A7", "B0", "B1", "B12", "B13", "B14", "A8", "A9", "A15", "B3", "B4", "B5"], "rows": ["B9", "B8", "B7", "B6", "A0"] }, - "url": "https://service.hexcore.xyz/manual/annepro/", + "url": "https://www.hexcore.xyz/annepro", "usb": { "device_version": "1.0.0", "pid": "0xFBF1", diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c index a0e8621a773..67d62538675 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-mac/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c index 005b6947c61..bea0e3f9c27 100644 --- a/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c +++ b/keyboards/anne_pro/keymaps/anne-pro-2-win/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/keymaps/arrow/keymap.c b/keyboards/anne_pro/keymaps/arrow/keymap.c index 27297ccab3e..dca5c6ce156 100644 --- a/keyboards/anne_pro/keymaps/arrow/keymap.c +++ b/keyboards/anne_pro/keymaps/arrow/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/keymaps/default/keymap.c b/keyboards/anne_pro/keymaps/default/keymap.c index bbaa6e8f54b..1dbfbdf85b1 100644 --- a/keyboards/anne_pro/keymaps/default/keymap.c +++ b/keyboards/anne_pro/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/keymaps/macos/keymap.c b/keyboards/anne_pro/keymaps/macos/keymap.c index a89181bc836..fb25de17c59 100644 --- a/keyboards/anne_pro/keymaps/macos/keymap.c +++ b/keyboards/anne_pro/keymaps/macos/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/mcuconf.h b/keyboards/anne_pro/mcuconf.h index 337d12775c4..03c75f2c32e 100644 --- a/keyboards/anne_pro/mcuconf.h +++ b/keyboards/anne_pro/mcuconf.h @@ -11,8 +11,7 @@ limitations under the License. */ -#ifndef MCUCONF_H -#define MCUCONF_H +#pragma once /* * STM32L1xx drivers configuration. @@ -200,4 +199,3 @@ */ #define STM32_WDG_USE_IWDG FALSE -#endif /* MCUCONF_H */ diff --git a/keyboards/anne_pro/README.md b/keyboards/anne_pro/readme.md similarity index 69% rename from keyboards/anne_pro/README.md rename to keyboards/anne_pro/readme.md index 713b04a716b..7288bbe13b7 100644 --- a/keyboards/anne_pro/README.md +++ b/keyboards/anne_pro/readme.md @@ -2,18 +2,11 @@ ![Anne Pro](https://i.imgur.com/wF7mz7u.jpg) -QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.obins.net). +*QMK firmware port for the Anne Pro 60% keyboard produced by [Obins](http://en.obins.net)* -__This firmware is not created or supported by the creator of this keyboard!__ - -Keyboard Maintainers: [Michiel Visser](https://github.com/msvisser), [Joel Beckmeyer](https://github.com/TinfoilSubmarine/) -Hardware Supported: Anne Pro (the original, not the _Anne Pro 2_) -Hardware Availability: Discontinued, [possible vendors](https://www.reddit.com/r/AnnePro/wiki/vendors) - -Make sure you check out the correct branch for this keyboard and initialize the submodules! - - git checkout anne_pro - make git-submodule +* Keyboard Maintainers: [Michiel Visser](https://github.com/msvisser), [Joel Beckmeyer](https://github.com/TinfoilSubmarine/) +* Hardware Supported: Anne Pro (the original, not the _Anne Pro 2_) +* Hardware Availability: Discontinued Make example for this keyboard (after setting up your build environment): @@ -32,7 +25,9 @@ To convert the `bin` file to a `dfu` file the following script can be used 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 by first unplugging the keyboard. Hold down the Esc key and while holding it down, briefly press the button on the bottom of the keyboard using a paperclip or some other small object. You can then release the Esc key, at which point it will enter the bootloader. You can now plug the keyboard back in. +If your keyboard has stock firmware, the only way to enter the bootloader is by first unplugging the keyboard. Hold down the Esc key and while holding it down, briefly press the button on the bottom of the keyboard using a paperclip or some other small object. You can then release the Esc key, at which point it will enter the bootloader. You can now plug the keyboard back in. + +If you have previously flashed QMK firmware, you can enter the bootloader with a long press of the QK_REBOOT keycode (mapped to ANNE+Esc in the included keymaps). ## Firmware requirements for LED backlight To get functioning backlighting for the Anne Pro the original LED firmware is required. This should be the version v1.40, which is available on the [Hexcore website](https://service.hexcore.xyz/manual/annepro/#42-anne-pro-firmware). __The backlight will not work with the newer ObinsKit firmware!__ This firmware can be installed by following the update guide on the same Hexcore website, or using `dfu-util` if you know what you are doing. diff --git a/keyboards/anne_pro/uart_tx_ringbuf.c b/keyboards/anne_pro/uart_tx_ringbuf.c index 1a27a543479..3ff1a82478d 100644 --- a/keyboards/anne_pro/uart_tx_ringbuf.c +++ b/keyboards/anne_pro/uart_tx_ringbuf.c @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/keyboards/anne_pro/uart_tx_ringbuf.h b/keyboards/anne_pro/uart_tx_ringbuf.h index fa20156ed90..c476dc17d60 100644 --- a/keyboards/anne_pro/uart_tx_ringbuf.h +++ b/keyboards/anne_pro/uart_tx_ringbuf.h @@ -1,4 +1,4 @@ -/* Copyright 2019 Michiel Visser +/* Copyright 2019 Michiel Visser (@msvisser) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From ad21a5fdcb12001c117ae401ddf2141101e830d4 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 14 Feb 2025 10:46:03 -0500 Subject: [PATCH 65/68] remove unused script --- .gitignore | 4 - keyboards/anne_pro/dfuse-pack.py | 220 ------------------------------- keyboards/anne_pro/readme.md | 4 - 3 files changed, 228 deletions(-) delete mode 100755 keyboards/anne_pro/dfuse-pack.py diff --git a/.gitignore b/.gitignore index 21cfbca00c3..20e706a2b59 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,6 @@ .clang_complete .build/ *.elf -*.hex -*.qmk -!util/bootloader.hex -!quantum/tools/eeprom_reset.hex *.log *.lss *.lst diff --git a/keyboards/anne_pro/dfuse-pack.py b/keyboards/anne_pro/dfuse-pack.py deleted file mode 100755 index 257ba4f57e9..00000000000 --- a/keyboards/anne_pro/dfuse-pack.py +++ /dev/null @@ -1,220 +0,0 @@ -#!/usr/bin/python - -# Written by Antonio Galea - 2010/11/18 -# Distributed under Gnu LGPL 3.0 -# see http://www.gnu.org/licenses/lgpl-3.0.txt -# retrieved from https://github.com/kiibohd/dfu-util - -import sys,struct,zlib,os -import binascii -from optparse import OptionParser - -try: - from intelhex import IntelHex -except ImportError: - IntelHex = None - -DEFAULT_DEVICE="0x0483:0xdf11" -DEFAULT_NAME=b'ST...' - -def named(tuple,names): - return dict(list(zip(names.split(),tuple))) -def consume(fmt,data,names): - n = struct.calcsize(fmt) - return named(struct.unpack(fmt,data[:n]),names),data[n:] -def cstring(bytestring): - return bytestring.partition(b'\0')[0] -def compute_crc(data): - return 0xFFFFFFFF & -zlib.crc32(data) -1 - -def parse(file,dump_images=False): - print('File: "%s"' % file) - data = open(file,'rb').read() - crc = compute_crc(data[:-4]) - prefix, data = consume('<5sBIB',data,'signature version size targets') - print('%(signature)s v%(version)d, image size: %(size)d, targets: %(targets)d' % prefix) - for t in range(prefix['targets']): - tprefix, data = consume('<6sBI255s2I',data,'signature altsetting named name size elements') - tprefix['num'] = t - if tprefix['named']: - tprefix['name'] = cstring(tprefix['name']) - else: - tprefix['name'] = '' - print('%(signature)s %(num)d, alt setting: %(altsetting)s, name: "%(name)s", size: %(size)d, elements: %(elements)d' % tprefix) - tsize = tprefix['size'] - target, data = data[:tsize], data[tsize:] - for e in range(tprefix['elements']): - eprefix, target = consume('<2I',target,'address size') - eprefix['num'] = e - print(' %(num)d, address: 0x%(address)08x, size: %(size)d' % eprefix) - esize = eprefix['size'] - image, target = target[:esize], target[esize:] - if dump_images: - out = '%s.target%d.image%d.bin' % (file,t,e) - open(out,'wb').write(image) - print(' DUMPED IMAGE TO "%s"' % out) - if len(target): - print("target %d: PARSE ERROR" % t) - suffix = named(struct.unpack('<4H3sBI',data[:16]),'device product vendor dfu ufd len crc') - print('usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix) - if crc != suffix['crc']: - print("CRC ERROR: computed crc32 is 0x%08x" % crc) - data = data[16:] - if data: - print("PARSE ERROR") - -def checkbin(binfile): - data = open(binfile,'rb').read() - if (len(data) < 16): - return - crc = compute_crc(data[:-4]) - suffix = named(struct.unpack('<4H3sBI',data[-16:]),'device product vendor dfu ufd len crc') - if crc == suffix['crc'] and suffix['ufd'] == b'UFD': - print('usb: %(vendor)04x:%(product)04x, device: 0x%(device)04x, dfu: 0x%(dfu)04x, %(ufd)s, %(len)d, 0x%(crc)08x' % suffix) - print("It looks like the file %s has a DFU suffix!" % binfile) - print("Please remove any DFU suffix and retry.") - sys.exit(1) - -def build(file,targets,name=DEFAULT_NAME,device=DEFAULT_DEVICE): - data = b'' - for t,target in enumerate(targets): - tdata = b'' - for image in target: - tdata += struct.pack('<2I',image['address'],len(image['data']))+image['data'] - tdata = struct.pack('<6sBI255s2I',b'Target',0,1,name,len(tdata),len(target)) + tdata - data += tdata - data = struct.pack('<5sBIB',b'DfuSe',1,len(data)+11,len(targets)) + data - v,d=[int(x,0) & 0xFFFF for x in device.split(':',1)] - data += struct.pack('<4H3sB',0,d,v,0x011a,b'UFD',16) - crc = compute_crc(data) - data += struct.pack(' Date: Fri, 14 Feb 2025 14:23:35 -0500 Subject: [PATCH 66/68] exit bootloader after flash --- keyboards/anne_pro/rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/rules.mk b/keyboards/anne_pro/rules.mk index 7b7e99902bd..4f91cb804c8 100644 --- a/keyboards/anne_pro/rules.mk +++ b/keyboards/anne_pro/rules.mk @@ -21,7 +21,7 @@ MCU = cortex-m3 ARMV = 7 # Extra arguments for dfu-util to flash to the correct location -DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000 +DFU_ARGS = -d 0483:df11 -a 0 -s 0x08004000:leave # Extra source files SRC += uart_tx_ringbuf.c anne_pro_lighting.c anne_pro_bluetooth.c From 71d5f85ae815eeef178af7e168813fe39cdc1fdd Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 7 Mar 2025 09:15:42 -0500 Subject: [PATCH 67/68] use correct keycode for keyboard-specific custom keycodes --- keyboards/anne_pro/anne_pro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/anne_pro/anne_pro.h b/keyboards/anne_pro/anne_pro.h index 087de1c487f..f6380369b01 100644 --- a/keyboards/anne_pro/anne_pro.h +++ b/keyboards/anne_pro/anne_pro.h @@ -19,7 +19,7 @@ /* Custom keycodes for Lighting and Bluetooth control */ enum anne_pro_keycodes { - APL_RGB = QK_USER, + APL_RGB = QK_KB, APL_RAT, APL_BRT, APL_MOD, From ee2113720701d637b68ae879fc838d08a62d8376 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Thu, 20 Mar 2025 08:21:28 -0400 Subject: [PATCH 68/68] enable working EEPROM --- keyboards/anne_pro/keyboard.json | 3 --- 1 file changed, 3 deletions(-) diff --git a/keyboards/anne_pro/keyboard.json b/keyboards/anne_pro/keyboard.json index 230d114033c..1ab3abb759a 100644 --- a/keyboards/anne_pro/keyboard.json +++ b/keyboards/anne_pro/keyboard.json @@ -4,9 +4,6 @@ "maintainer": "msvisser / TinfoilSubmarine", "bootloader": "stm32-dfu", "diode_direction": "COL2ROW", - "eeprom": { - "driver": "transient" - }, "features": { "bootmagic": false, "command": false,