From ac5e6b6a3bfad12ab7d9786a18fcc90f8bf4caf7 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sun, 3 Jul 2022 00:12:45 +1000 Subject: Tentative Teensy 3.5 support (#14420) * Tentative Teensy 3.5 support * Set firmware format to .hex for ARM Teensys * Got to "device descriptor failed" by comparing with Teensy 3.6 code * Drop down to 96MHz... * Bump back up to 120MHz --- keyboards/handwired/onekey/teensy_35/chconf.h | 28 +++++++++++++++ keyboards/handwired/onekey/teensy_35/config.h | 32 +++++++++++++++++ keyboards/handwired/onekey/teensy_35/halconf.h | 28 +++++++++++++++ keyboards/handwired/onekey/teensy_35/mcuconf.h | 50 ++++++++++++++++++++++++++ keyboards/handwired/onekey/teensy_35/rules.mk | 8 +++++ 5 files changed, 146 insertions(+) create mode 100644 keyboards/handwired/onekey/teensy_35/chconf.h create mode 100644 keyboards/handwired/onekey/teensy_35/config.h create mode 100644 keyboards/handwired/onekey/teensy_35/halconf.h create mode 100644 keyboards/handwired/onekey/teensy_35/mcuconf.h create mode 100644 keyboards/handwired/onekey/teensy_35/rules.mk (limited to 'keyboards') diff --git a/keyboards/handwired/onekey/teensy_35/chconf.h b/keyboards/handwired/onekey/teensy_35/chconf.h new file mode 100644 index 0000000000..ee8312c526 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/chconf.h @@ -0,0 +1,28 @@ +/* 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/teensy_35/chconf.h -r platforms/chibios/common/configs/chconf.h` + */ + +#pragma once + +#define CH_CFG_ST_TIMEDELTA 0 + +#define CH_CFG_TIME_QUANTUM 20 + +#include_next diff --git a/keyboards/handwired/onekey/teensy_35/config.h b/keyboards/handwired/onekey/teensy_35/config.h new file mode 100644 index 0000000000..a5f2c945c4 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/config.h @@ -0,0 +1,32 @@ +/* Copyright 2019 + * + * 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 + +// TODO: including this causes "error: expected identifier before '(' token" errors +//#include "config_common.h" + +#define PRODUCT Onekey Teensy 3.5 + +#define MATRIX_COL_PINS { D5 } // 20/A6 +#define MATRIX_ROW_PINS { B2 } // 19/A5 +#define UNUSED_PINS + +// i2c_master defines +#define I2C1_SCL_PIN B0 // 16/A2 on pinout +#define I2C1_SDA_PIN B1 // 17/A3 on pinout +#define I2C1_SCL_PAL_MODE PAL_MODE_ALTERNATIVE_2 +#define I2C1_SDA_PAL_MODE PAL_MODE_ALTERNATIVE_2 diff --git a/keyboards/handwired/onekey/teensy_35/halconf.h b/keyboards/handwired/onekey/teensy_35/halconf.h new file mode 100644 index 0000000000..6ac756d0f2 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/halconf.h @@ -0,0 +1,28 @@ +/* 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/handwired/onekey/teensy_35/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +#define HAL_USE_SERIAL TRUE + +#define SERIAL_USB_BUFFERS_SIZE 256 + +#include_next diff --git a/keyboards/handwired/onekey/teensy_35/mcuconf.h b/keyboards/handwired/onekey/teensy_35/mcuconf.h new file mode 100644 index 0000000000..dc508eee7d --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/mcuconf.h @@ -0,0 +1,50 @@ +/* + 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. +*/ + +#ifndef _MCUCONF_H_ +#define _MCUCONF_H_ + +#define K60x_MCUCONF + +/* + * HAL driver system settings. + */ + +/* Select the MCU clocking mode below by enabling the appropriate block. */ + +/* PEE mode - 120MHz system clock driven by external crystal. */ +#define KINETIS_MCG_MODE KINETIS_MCG_MODE_PEE +#define KINETIS_PLLCLK_FREQUENCY 120000000UL // 120 MHz (RUN) +#define KINETIS_SYSCLK_FREQUENCY KINETIS_PLLCLK_FREQUENCY +#define KINETIS_BUSCLK_FREQUENCY 60000000UL +#define KINETIS_FLASHCLK_FREQUENCY 24000000UL // 24 MHz (RUN) + +#define KINETIS_CLKDIV1_OUTDIV1 1 // -> 0 +#define KINETIS_CLKDIV1_OUTDIV2 2 // -> 1 +#define KINETIS_CLKDIV1_OUTDIV4 5 // -> 4 + +/* + * SERIAL driver system settings. + */ +#define KINETIS_SERIAL_USE_UART0 TRUE + +/* + * USB driver settings + */ +#define KINETIS_USB_USE_USB0 TRUE +#define KINETIS_USB_USB0_IRQ_PRIORITY 5 + +#endif /* _MCUCONF_H_ */ diff --git a/keyboards/handwired/onekey/teensy_35/rules.mk b/keyboards/handwired/onekey/teensy_35/rules.mk new file mode 100644 index 0000000000..8ebefd03f5 --- /dev/null +++ b/keyboards/handwired/onekey/teensy_35/rules.mk @@ -0,0 +1,8 @@ +# MCU name +MCU = MK64FX512 + +# Bootloader selection +BOOTLOADER = halfkay + +# Enter lower-power sleep mode when on the ChibiOS idle thread +OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE -- cgit v1.2.3