[Keyboard] Add config for F407 Tractyl Manuform

This commit is contained in:
Drashna Jael're 2024-10-05 17:39:37 -07:00
parent f758401739
commit 4570fdaf03
Signed by: drashna
GPG key ID: DBA1FD3A860D1B11
8 changed files with 393 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,88 @@
/*
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 SPLIT_HAND_PIN B11 // high = left, low = right
#define USER_BUTTON_PIN A15
#define DEBUG_LED_PIN C13
// WS2812 RGB LED strip input and number of LEDs
#define WS2812_PWM_DRIVER PWMD8
#define WS2812_PWM_CHANNEL 1
#define WS2812_PWM_PAL_MODE 3
#define WS2812_PWM_DMA_STREAM STM32_DMA2_STREAM1
#define WS2812_PWM_DMA_CHANNEL 7
#define WS2812_PWM_TARGET_PERIOD 800000
#define WS2812_EXTERNAL_PULLUP
#define BACKLIGHT_PWM_DRIVER PWMD3
#define BACKLIGHT_PWM_CHANNEL 2
#define BACKLIGHT_PAL_MODE 2
/* 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_DRIVER SD1
#define SERIAL_USART_TX_PIN A10
#define SERIAL_USART_TX_PAL_MODE 7
#define SERIAL_USART_RX_PIN A9
#define SERIAL_USART_RX_PAL_MODE 7
#define SERIAL_USART_TIMEOUT 10
#define SERIAL_USART_SPEED (1 * 1024 * 1024)
#define SERIAL_USART_FULL_DUPLEX
/* 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 SPID1
#define SPI_SCK_PIN B3
#define SPI_SCK_PAL_MODE 5
#define SPI_MOSI_PIN B5
#define SPI_MOSI_PAL_MODE 5
#define SPI_MISO_PIN B4
#define SPI_MISO_PAL_MODE 5
#define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN A8
#define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 2
#define EXTERNAL_FLASH_SIZE (8 * 1024 * 1024)
/* pmw3360 config */
#define POINTING_DEVICE_CS_PIN B8
#define POINTING_DEVICE_ROTATION_270
#undef ROTATIONAL_TRANSFORM_ANGLE
#define PMW33XX_SPI_DIVISOR 8
// lcd
#define DISPLAY_RST_PIN B13
#define DISPLAY_DC_PIN B12
#define DISPLAY_CS_PIN B9
#define DISPLAY_SPI_DIVIDER 1
#define DRV2605L_FB_ERM_LRA 0
#define DRV2605L_GREETING DRV2605L_EFFECT_750_MS_ALERT_100
#define DRV2605L_DEFAULT_MODE DRV2605L_EFFECT_BUZZ_1_100
#define VIA_FIRMWARE_VERSION 0x00000001

View file

@ -0,0 +1,50 @@
/* 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"
#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 user_button_init(void) {
gpio_set_pin_output(DEBUG_LED_PIN);
// Pin needs to be configured as input low
#ifdef USER_BUTTON_PIN
gpio_set_pin_input_high(USER_BUTTON_PIN);
#endif // USER_BUTTON_PIN
}
bool check_user_button_state(void) {
#ifdef DEBUG_LED_PIN
gpio_write_pin(DEBUG_LED_PIN, !is_keyboard_master());
#endif // DEBUG_LED_PIN
#ifdef USER_BUTTON_PIN
return !gpio_read_pin(USER_BUTTON_PIN);
#endif // USER_BUTTON_PIN
return false;
}
void board_init(void) {
// unset improper SPI pins
gpio_set_pin_input(A5);
gpio_set_pin_input(A6);
gpio_set_pin_input(A7);
}

View file

@ -0,0 +1,35 @@
/* 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_SERIAL TRUE
#define SERIAL_BUFFERS_SIZE 256
#if defined(WS2812_PWM) || defined(BACKLIGHT_PWM)
# define HAL_USE_PWM TRUE
#endif // defined(WS2812_PWM) || defined(BACKLIGHT_PWM)
#if HAL_USE_SPI == TRUE
# define SPI_USE_WAIT TRUE
# define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
#ifdef AUDIO_DRIVER_DAC
# define HAL_USE_GPT TRUE
# define HAL_USE_DAC TRUE
#endif
#include_next <halconf.h>

View file

@ -0,0 +1,66 @@
{
"keyboard_name": "Tractyl Manuform (5x6) STM32F407",
"audio": {
"driver": "dac_additive",
"power_control": {
"pin": "A3"
}
},
"backlight": {
"levels": 16,
"pin": "C7"
},
"bootloader": "tinyuf2",
"build": {
"debounce_type": "asym_eager_defer_pk"
},
"diode_direction": "COL2ROW",
"eeprom": {
"driver": "wear_leveling",
"wear_leveling": {
"driver": "spi_flash"
}
},
"encoder": {
"rotary": [
{"pin_a": "D14", "pin_b": "C0"}
]
},
"features": {
"haptic": true
},
"haptic": {
"driver": "drv2605l"
},
"matrix_pins": {
"cols": ["C1", "C2", "C3", "A0", "A1", "A2"],
"rows": ["A6", "A7", "C4", "C5", "B0", "B1"]
},
"processor": "STM32F407",
"rgblight": {
"led_count": 24,
"split": true
},
"split": {
"serial": {
"driver": "usart"
},
"transport": {
"sync": {
"activity": true,
"haptic": true,
"matrix_state": true
}
}
},
"usb": {
"shared_endpoint": {
"keyboard": true,
"mouse": true
}
},
"ws2812": {
"driver": "pwm",
"pin": "C6"
}
}

View file

@ -0,0 +1,80 @@
/* 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_LSE_ENABLED
#define STM32_LSE_ENABLED TRUE
#undef STM32_PLLM_VALUE
#define STM32_PLLM_VALUE 8
#undef STM32_RTCSEL
#define STM32_RTCSEL STM32_RTCSEL_LSE
#undef STM32_SERIAL_USE_USART1
#define STM32_SERIAL_USE_USART1 TRUE
#if HAL_USE_WDG == TRUE
# undef STM32_WDG_USE_IWDG
# define STM32_WDG_USE_IWDG TRUE
#endif
#if HAL_USE_I2C == TRUE
# 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)
#endif // HAL_USE_I2C
#ifdef WS2812_PWM
# undef STM32_PWM_USE_TIM8
# define STM32_PWM_USE_TIM8 TRUE
#endif // WS2812_PWM
#ifdef BACKLIGHT_PWM
# undef STM32_PWM_USE_TIM3
# define STM32_PWM_USE_TIM3 TRUE
#endif
#if HAL_USE_SPI == TRUE
# undef STM32_SPI_USE_SPI1
# define STM32_SPI_USE_SPI1 TRUE
# undef STM32_SPI_SPI1_TX_DMA_STREAM
# define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 5)
# undef STM32_SPI_SPI1_RX_DMA_STREAM
# define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0)
#endif
#ifdef AUDIO_DRIVER_DAC
# 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
#endif // AUDIO_DRIVER_DAC

View file

@ -0,0 +1,50 @@
A0 - Column 3
A1 - Column 4
A2 - Colume 5
A3 - Audio Enable
A4 - DAC Audio
A5 - DAC Aduio
A6 - Row 0
A7 - Row 1
A8 -
A9 - VBUS Sense -- Don't use - USART TX
A10 - USART RX (weak internal pullup)
A11 - USB D-
A12 - USB D+
A13 - SWD DIO
A14 - SWD CLK
A15 - Encoder Pin B
B0 - Row 4
B1 - Row 5
B2 - Boot1 - user LED
B3 - SPI SCK
B4 - SPI MISO
B5 - SPI MOSI
B6 - I2C SCL
B7 - I2C SDA
B8 - LCD Display CS Pin
B9 - Pointing Device CS Pin
B10 - Manual VBUS Detect Pin
B11 - Split Hand Pin
B12 - (weak internal pullup) - LCD Display DC Pin
B13 - LCD Display RST Pin
B14 -
B15 -
C0 - Encoder Pin A
C1 - Column 0
C2 - Column 1
C3 - Column 2
C4 - Row 2
C5 - Row 3
C6 - WS2812 PWM Pin
C7 - Backlight PWM Pin
C8 - TF Interface
C9 - TF Interface
C10 - TF Interface
C11 - TF Interface
C12 - TF Interface
C13 - User Button
C14 - LSE Crystal
C15 - LSE Crystal

View file

@ -0,0 +1 @@
MCU_LDSCRIPT = STM32F407xG