[TractylM] Add weact f405 support

This commit is contained in:
Drashna Jael're 2024-06-02 16:40:12 -07:00
parent 9bcdb99fa4
commit 977a327718
No known key found for this signature in database
GPG Key ID: DBA1FD3A860D1B11
8 changed files with 343 additions and 0 deletions

View File

@ -0,0 +1,23 @@
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once
#include_next <board.h>
#undef STM32_HSECLK
#define STM32_HSECLK 8000000U
#undef STM32_LSECLK
#define STM32_LSECLK 32768U

View File

@ -0,0 +1,78 @@
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>
Copyright 2015 Jack Humbert
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
// #define USB_VBUS_PIN B10 // doesn't seem to work for me on one of my controllers... */
#define SPLIT_HAND_PIN A13 // high = left, low = right
// WS2812 RGB LED strip input and number of LEDs
#define WS2812_PWM_DRIVER PWMD1 // default: PWMD2
#define WS2812_PWM_CHANNEL 2 // default: 2
#define WS2812_PWM_PAL_MODE 1 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 2
#define WS2812_EXTERNAL_PULLUP
#define WS2812_PWM_COMPLEMENTARY_OUTPUT // Define for a complementary timer output (TIMx_CHyN); omit for a normal timer output (TIMx_CHy).
#define WS2812_PWM_DMA_STREAM STM32_DMA2_STREAM5 // DMA Stream for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_DMA_CHANNEL 6 // DMA Channel for TIMx_UP, see the respective reference manual for the appropriate values for your MCU.
#define WS2812_PWM_TARGET_PERIOD 800000
#define DEBUG_LED_PIN C13
/* Audio config */
#define AUDIO_PIN A4
#define AUDIO_PIN_ALT A5
#define AUDIO_PIN_ALT_AS_NEGATIVE
/* serial.c configuration for split keyboard */
#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode.
#define SERIAL_USART_TX_PIN A9
#define SERIAL_USART_RX_PIN A10
#define SERIAL_USART_DRIVER SD1
#define SERIAL_USART_TX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
#define SERIAL_USART_RX_PAL_MODE 7 // Pin "alternate function", see the respective datasheet for the appropriate values for your MCU. default: 7
#define SERIAL_USART_TIMEOUT 100 // USART driver timeout. default 100
#define SERIAL_USART_SPEED 921600
#define CRC8_USE_TABLE
#define CRC8_OPTIMIZE_SPEED
/* i2c config for oleds */
#define I2C_DRIVER I2CD1
#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_16_9
/* spi config for eeprom and pmw3360 sensor */
#define SPI_DRIVER SPID2
#define SPI_SCK_PIN B13
#define SPI_SCK_PAL_MODE 5
#define SPI_MOSI_PIN B14
#define SPI_MOSI_PAL_MODE 5
#define SPI_MISO_PIN B15
#define SPI_MISO_PAL_MODE 5
/* pmw3360 config */
#define PMW33XX_CS_PIN A4
// lcd
/*
RST C6
DC C7
CS B12
*/

View File

@ -0,0 +1,67 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "tractyl_manuform.h"
void keyboard_pre_init_sub(void) {
// gpio_set_pin_input_high(A0);
}
void matrix_scan_sub_kb(void) {
// if (!gpio_read_pin(A0)) {
// reset_keyboard();
// }
}
// __attribute__((weak)) void bootmagic_scan(void) {
// // We need multiple scans because debouncing can't be turned off.
// matrix_scan();
// #if defined(DEBOUNCE) && DEBOUNCE > 0
// wait_ms(DEBOUNCE * 2);
// #else
// wait_ms(30);
// #endif
// matrix_scan();
// uint8_t row = BOOTMAGIC_ROW;
// uint8_t col = BOOTMAGIC_COLUMN;
// #if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_ROW_RIGHT) && defined(BOOTMAGIC_COLUMN_RIGHT)
// if (!is_keyboard_left()) {
// row = BOOTMAGIC_ROW_RIGHT;
// col = BOOTMAGIC_COLUMN_RIGHT;
// }
// #endif
// if (matrix_get_row(row) & (1 << col) || !gpio_read_pin(A0)) {
// eeconfig_disable();
// bootloader_jump();
// }
// }
#ifdef USB_VBUS_PIN
bool usb_vbus_state(void) {
gpio_set_pin_input_low(USB_VBUS_PIN);
wait_us(5);
return gpio_read_pin(USB_VBUS_PIN);
}
#endif
void matrix_output_unselect_delay(uint8_t line, bool key_pressed) {
for (int32_t i = 0; i < 40; i++) {
__asm__ volatile("nop" ::: "memory");
}
}

View File

@ -0,0 +1,27 @@
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once
#define HAL_USE_PWM TRUE
#define HAL_USE_SERIAL TRUE
#define HAL_USE_I2C TRUE
#define HAL_USE_DAC TRUE
#define HAL_USE_GPT TRUE
#define HAL_USE_SPI TRUE
#define SPI_USE_WAIT TRUE
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#include_next <halconf.h>

View File

@ -0,0 +1,32 @@
{
"keyboard_name": "Tractyl Manuform (5x6) BlackPill",
"matrix_pins": {
"cols": ["C0", "C1", "C2", "C3", "A0", "A1"],
"rows": ["A2", "A3", "A6", "A7", "C4", "C5"]
},
"diode_direction": "COL2ROW",
"rgblight": {
"led_count": 57,
"split_count": [26, 31]
},
"build": {
"debounce_type": "asym_eager_defer_pk"
},
"audio": {
"driver": "dac_additive"
},
"ws2812": {
"pin": "B0",
"driver": "pwm"
},
"encoder": {
"rotary": [
{"pin_a": "B4", "pin_b": "B5"}
]
},
"processor": "STM32F405",
"bootloader": "stm32-dfu",
"features": {
"console": true
}
}

View File

@ -0,0 +1,74 @@
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once
#include_next <mcuconf.h>
#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE
#undef STM32_I2C_BUSY_TIMEOUT
#define STM32_I2C_BUSY_TIMEOUT 10
// #undef STM32_I2C_I2C1_RX_DMA_STREAM
// #define STM32_I2C_I2C1_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 0)
#undef STM32_I2C_I2C1_TX_DMA_STREAM
#define STM32_I2C_I2C1_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 7)
#undef STM32_PWM_USE_TIM1
#define STM32_PWM_USE_TIM1 TRUE
#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE
#undef STM32_SPI_USE_SPI2
#define STM32_SPI_USE_SPI2 TRUE
#undef STM32_SERIAL_USE_USART1
#define STM32_SERIAL_USE_USART1 TRUE
#undef STM32_UART_USART1_RX_DMA_STREAM
#define STM32_UART_USART1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
#undef STM32_UART_USART1_TX_DMA_STREAM
#define STM32_UART_USART1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 7)
#undef STM32_DAC_USE_DAC1_CH1
#define STM32_DAC_USE_DAC1_CH1 TRUE
#undef STM32_DAC_USE_DAC1_CH2
#define STM32_DAC_USE_DAC1_CH2 TRUE
#undef STM32_GPT_USE_TIM6
#define STM32_GPT_USE_TIM6 TRUE
#undef STM32_LSE_ENABLED
#define STM32_LSE_ENABLED TRUE
#undef STM32_PLLM_VALUE
#define STM32_PLLM_VALUE 4
#undef STM32_PLLN_VALUE
#define STM32_PLLN_VALUE 168
#undef STM32_PLLP_VALUE
#define STM32_PLLP_VALUE 2
#undef STM32_PLLQ_VALUE
#define STM32_PLLQ_VALUE 7
#undef STM32_RTCSEL
#define STM32_RTCSEL STM32_RTCSEL_LSE
#undef STM32_WDG_USE_IWDG
#define STM32_WDG_USE_IWDG TRUE

View File

@ -0,0 +1,38 @@
# Drashna's Blackpill Tractyl Manuform (5x6) with a right side trackball
* System Timer on TIM5
* VBUS mod, using PB10 -- does work, but not on my tractyl... bad soldering probably
* Split Hand Pin, using PC14
* Full Duplex Serial/USART using PA2 and PA3 on USART2
* PWM Audio using PB1 and TIM3 and GPT on TIM4
* PWM WS2812 RGB using PA1 TIM2
* 8KB SPI EEPROM chip sharing PA5-PA7 on SPI1 with PA4 as CS pin
* pmw3360 sensor sharing PA5-PA7 on SPI1, with B0 as CS pin
* Encoder using PA13 and PA14
* SSD1306 OLED display (128x64) using PB8-PB9 on I2C1
* Pull-up resistor (22k) on PA10 to fix reset issue.
* Pull-up resistor (5.1k) on PA1 for WS2812 LED support, and wire it's VCC to the 5V pin.
* Pins PA9 is meant for VBUS sense, and has an internal pulldown resistor. A 5.1k pullup resistor can work (but should be avoided)
* Pins PA11 and A12 are not useable because they're used for USB connection, and can't be shared.
* Pin PB2 is used by BOOT1, and is unusable
## Keyboard Info
* Keyboard Maintainer: [Drashna Jael're](https://github.com/drashna)
* Hardware Supported: [Design files](https://gitlab.com/keyboards1/dm_r_track/-/tree/master/boolean), [WeAct BlackPill (F411)](https://github.com/WeActStudio/WeActStudio.MiniSTM32F4x1), [PMW3360 Optical Sensor](https://www.tindie.com/products/jkicklighter/pmw3360-motion-sensor/)
Make example for this keyboard (after setting up your build environment):
make handwired/tractyl_manuform/5x6_right/f411:default
Flashing example for this keyboard:
make handwired/tractyl_manuform/5x6_right/f411:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Bootloader
* **Bootmagic reset**: Hold down the top right key on the right side, or the top left key on the left side while plugging in.
* **Physical reset button**: Briefly press the "USER" button on the BlackPill
* **Keycode in layout**: Press the key mapped to `QK_BOOT`.

View File

@ -0,0 +1,4 @@
KEYBOARD_SHARED_EP = yes
MOUSE_SHARED_EP = yes
SERIAL_DRIVER = usart