diff --git a/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/config.h b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/config.h new file mode 100644 index 0000000000..398e4041c0 --- /dev/null +++ b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/config.h @@ -0,0 +1,86 @@ +/* +Copyright 2012 Jun Wako +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 . +*/ + +#pragma once + +#include "config_common.h" + +// #define PRODUCT_ID 0x3836 +// #define DEVICE_VER 0x0001 +// #define PRODUCT Trenctyl Manuform(6x6) BlackPill F01 + +#define MATRIX_ROW_PINS \ + { A15, B13, B14, B15, A8, B6, B7 } +#define MATRIX_COL_PINS \ + { B10, B0, A1, A0, B4, C14 } + +#define MATRIX_ROW_PINS_RIGHT \ + { A15, B13, B14, B15, A8, B6, B7 } +#define MATRIX_COL_PINS_RIGHT \ + { B1, B0, A1, A0, B4, C14 } + +#define DIODE_DIRECTION ROW2COL + +#define RGB_DI_PIN B3 +#define RGBLED_NUM 74 +#define DRIVER_LED_TOTAL 74 +#define RGB_MATRIX_LED_COUNT 74 + +#define RGBLIGHT_SPLIT +#define RGBLED_SPLIT \ + { 38, 36 } +#define RGBLIGHT_LIMIT_VAL 200 +#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 200 +#define RGB_MATRIX_SPLIT \ + { 38, 36 } +#define RGB_MATRIX_CENTER \ + { 110, 19 } + +#define SERIAL_USART_RX_PIN A2 +#define SELECT_SOFT_SERIAL_SPEED 1 +#define FORCED_SYNC_THROTTLE_MS 200 +#define SERIAL_USART_DRIVER SD2 +#define SERIAL_USART_TX_PAL_MODE 7 +#define SERIAL_USART_RX_PAL_MODE 7 +#define SERIAL_USART_TIMEOUT 10 +#define I2C1_SCL_PIN B8 +#define I2C1_SDA_PIN B9 + +#define PMW33XX_CS_PIN A4 + +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_SCK_PAL_MODE 5 +#define SPI_MOSI_PIN A7 +#define SPI_MOSI_PAL_MODE 5 +#define SPI_MISO_PIN A6 +#define SPI_MISO_PAL_MODE 5 + +#define ENCODERS_PAD_A \ + { C13 } +#define ENCODERS_PAD_B \ + { C15 } + +#define WS2812_PWM_DRIVER PWMD2 +#define WS2812_PWM_CHANNEL 2 +#define WS2812_DMA_STREAM STM32_DMA1_STREAM7 +#define WS2812_DMA_CHANNEL 3 +#define WS2812_PWM_PAL_MODE 1 + +// hw rnd generator +// #define ENC_HW_RND_STM32F4 diff --git a/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/f401.h b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/f401.h new file mode 100644 index 0000000000..c278adc2cf --- /dev/null +++ b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/f401.h @@ -0,0 +1,19 @@ +/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) + * + * 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 "6x6.h" diff --git a/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/halconf.h b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/halconf.h new file mode 100644 index 0000000000..0b4f9cfaae --- /dev/null +++ b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/halconf.h @@ -0,0 +1,8 @@ +#pragma once + +#define HAL_USE_SERIAL TRUE +#define HAL_USE_I2C TRUE +#define HAL_USE_SPI TRUE +#define HAL_USE_PWM TRUE + +#include_next diff --git a/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/mcuconf.h b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/mcuconf.h new file mode 100644 index 0000000000..43b60f8024 --- /dev/null +++ b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/mcuconf.h @@ -0,0 +1,33 @@ +#pragma once + +#include_next "mcuconf.h" + +#undef STM32_SERIAL_USE_USART2 +#define STM32_SERIAL_USE_USART2 TRUE + +#undef STM32_UART_USART2_RX_DMA_STREAM +#define STM32_UART_USART2_RX_DMA_STREAM STM32_DMA_STREAM_ID(1, 5) +#undef STM32_UART_USART2_TX_DMA_STREAM +#define STM32_UART_USART2_TX_DMA_STREAM STM32_DMA_STREAM_ID(1, 6) + +#undef STM32_PWM_USE_TIM2 +#define STM32_PWM_USE_TIM2 TRUE + +#undef STM32_ST_USE_TIMER +#define STM32_ST_USE_TIMER 5 + +#undef STM32_SPI_USE_SPI1 +#define STM32_SPI_USE_SPI1 TRUE + +#undef STM32_SPI_SPI1_RX_DMA_STREAM +#define STM32_SPI_SPI1_RX_DMA_STREAM STM32_DMA_STREAM_ID(2, 0) +#undef STM32_SPI_SPI1_TX_DMA_STREAM +#define STM32_SPI_SPI1_TX_DMA_STREAM STM32_DMA_STREAM_ID(2, 3) + +#undef STM32_I2C_USE_I2C1 +#define STM32_I2C_USE_I2C1 TRUE + +#undef STM32_ADC_USE_ADC0 +#define STM32_ADC_USE_ADC0 TRUE +#undef STM32_ADC_USE_ADC1 +#define STM32_ADC_USE_ADC1 TRUE diff --git a/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/rules.mk b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/rules.mk new file mode 100644 index 0000000000..3580583315 --- /dev/null +++ b/keyboards/handwired/trenctyl_manuform/6x6/f01uf2/rules.mk @@ -0,0 +1,6 @@ +MCU = STM32F401 + +BOOTLOADER = tinyuf2 + +LTO_ENABLE = no +SERIAL_DRIVER = usart diff --git a/keyboards/handwired/trenctyl_manuform/6x6/info.json b/keyboards/handwired/trenctyl_manuform/6x6/info.json index 4055ae06ee..10e462af6b 100644 --- a/keyboards/handwired/trenctyl_manuform/6x6/info.json +++ b/keyboards/handwired/trenctyl_manuform/6x6/info.json @@ -1,10 +1,10 @@ { - "keyboard_name": "Trenctyl Manuform(6x6) BlackPill F01", + "keyboard_name": "Trenctyl Manuform(6x6) BlackPill F401", "url": "", "usb": { "vid": "0x44FD", "pid": "0x3836", - "device_version": "0.0.1" + "device_version": "0.1.0" }, "manufacturer": "mfulz", "maintainer": "Matthias Fulz", diff --git a/keyboards/handwired/trenctyl_manuform/6x6/keymaps/default/keymap.c b/keyboards/handwired/trenctyl_manuform/6x6/keymaps/default/keymap.c index 66cbb25a7e..f134abe0af 100644 --- a/keyboards/handwired/trenctyl_manuform/6x6/keymaps/default/keymap.c +++ b/keyboards/handwired/trenctyl_manuform/6x6/keymaps/default/keymap.c @@ -18,6 +18,8 @@ #ifdef RGB_MATRIX_ENABLE // clang-format off +extern rgb_config_t rgb_matrix_config; + led_config_t g_led_config = {{ { 0, 5, 10, 16, 22, 30, }, { 1, 6, 11, 17, 23, 31, }, @@ -163,10 +165,118 @@ int get_speed_percent(void) { static uint16_t _cpi; #endif -static uint8_t _vis_timeout_sec; +static uint16_t _vis_timeout_sec; static uint32_t _vis_timer; static bool _vis_status; +#if defined(RGB_MATRIX_EFFECT) +# undef RGB_MATRIX_EFFECT +#endif // defined(RGB_MATRIX_EFFECT) + +#define RGB_MATRIX_EFFECT(x) RGB_MATRIX_EFFECT_##x, +enum { + RGB_MATRIX_EFFECT_NONE, +#include "rgb_matrix_effects.inc" +#undef RGB_MATRIX_EFFECT +#ifdef RGB_MATRIX_CUSTOM_KB +# include "rgb_matrix_kb.inc" +#endif +#ifdef RGB_MATRIX_CUSTOM_USER +# include "rgb_matrix_user.inc" +#endif +}; + +#define RGB_MATRIX_EFFECT(x) \ + case RGB_MATRIX_EFFECT_##x: \ + return #x; +const char* rgb_matrix_name(uint8_t effect) { + switch (effect) { + case RGB_MATRIX_EFFECT_NONE: + return "NONE"; +#include "rgb_matrix_effects.inc" +#undef RGB_MATRIX_EFFECT +#ifdef RGB_MATRIX_CUSTOM_KB +# include "rgb_matrix_kb.inc" +#endif +#ifdef RGB_MATRIX_CUSTOM_USER +# include "rgb_matrix_user.inc" +#endif + default: + return "UNKNOWN"; + } +} + +void oled_write_rgb_matrix(void) { + /*char rgb_matrix_info_str[24] = {0};*/ + oled_write("RGB: ", false); + /*switch (rgb_matrix_config.mode) {*/ + /*case 1:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Solid Color");*/ + /*break;*/ + /*case 2:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Alphas Mods");*/ + /*break;*/ + /*case 3:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Gradient up down");*/ + /*break;*/ + /*case 4:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Gradient left right");*/ + /*break;*/ + /*case 5:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Breathing");*/ + /*break;*/ + /*case 6:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Sat");*/ + /*break;*/ + /*case 7:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Val");*/ + /*break;*/ + /*case 8:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Pinwheel Sat");*/ + /*break;*/ + /*case 9:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Pinwheel Val");*/ + /*break;*/ + /*case 10:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Spiral Sat");*/ + /*break;*/ + /*case 11:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Band Spiral Val");*/ + /*break;*/ + /*case 12:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle All");*/ + /*break;*/ + /*case 13:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle left right");*/ + /*break;*/ + /*case 14:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle up down");*/ + /*break;*/ + /*case 15:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle out in");*/ + /*break;*/ + /*case 16:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle out in dual");*/ + /*break;*/ + /*case 17:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Rainbow mov chevron");*/ + /*break;*/ + /*case 18:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle Pinwheel");*/ + /*break;*/ + /*case 19:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Cycle Spiral");*/ + /*break;*/ + /*case 20:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "Dual Beacon");*/ + /*break;*/ + /*default:*/ + /*snprintf(rgb_matrix_info_str, sizeof(rgb_matrix_info_str), "%2d", rgb_matrix_config.mode);*/ + /*break;*/ + /*}*/ + oled_write_ln(rgb_matrix_name(rgb_matrix_config.mode), false); +} + bool oled_task_user(void) { // Host Keyboard Layer Status if(is_keyboard_master()) { @@ -226,7 +336,7 @@ bool oled_task_user(void) { #endif oled_write_P(PSTR("V: "), false); - oled_write_P(get_u8_str(_oled_timeout, ' '), false); + oled_write_P(get_u16_str(_oled_timeout, ' '), false); oled_write_P(PSTR("s\n"), false); } else { #ifdef ENC_ENABLE @@ -250,6 +360,8 @@ bool oled_task_user(void) { default: oled_write_P(PSTR("Undefined\n"), false); } + + oled_write_rgb_matrix(); } return true; @@ -429,7 +541,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) { void keyboard_pre_init_user(void) { _vis_status = true; - _vis_timeout_sec = 120; + _vis_timeout_sec = 600; _vis_timer = timer_read32(); #ifdef ENC_ENABLE pre_init_enc();