From cafea5016d27b43db7e7349c18831424150c2e9a Mon Sep 17 00:00:00 2001 From: Drashna Jael're Date: Wed, 5 Jun 2024 16:54:15 -0700 Subject: [PATCH] [MicroMod] Add SPI config and update enabled --- .../handwired/onekey/micromod/stm32f405/config.h | 13 +++++++++++++ .../handwired/onekey/micromod/stm32f405/halconf.h | 10 ++-------- .../handwired/onekey/micromod/stm32f405/mcuconf.h | 12 ++++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/keyboards/handwired/onekey/micromod/stm32f405/config.h b/keyboards/handwired/onekey/micromod/stm32f405/config.h index 1450839a2b..23e408b18d 100644 --- a/keyboards/handwired/onekey/micromod/stm32f405/config.h +++ b/keyboards/handwired/onekey/micromod/stm32f405/config.h @@ -26,3 +26,16 @@ #define ENCODERS_PAD_A { C0 } #define ENCODERS_PAD_B { C1 } + +#define SPI_DRIVER SPID1 +#define SPI_SCK_PIN A5 +#define SPI_MOSI_PIN A7 +#define SPI_MISO_PIN A6 + +/* OLED SPI Pins */ +#define OLED_DC_PIN C0 +#define OLED_RST_PIN C1 +#define OLED_CS_PIN C4 + +/* Divisor for OLED */ +#define OLED_SPI_DIVISOR 4 diff --git a/keyboards/handwired/onekey/micromod/stm32f405/halconf.h b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h index 5d0ef0fd76..dde54f516b 100644 --- a/keyboards/handwired/onekey/micromod/stm32f405/halconf.h +++ b/keyboards/handwired/onekey/micromod/stm32f405/halconf.h @@ -16,15 +16,9 @@ #pragma once -#define HAL_USE_ADC TRUE - -#define HAL_USE_I2C TRUE - -#define HAL_USE_PWM TRUE - -#define HAL_USE_SPI TRUE - +#ifdef AUDIO_DRIVER_DAC #define HAL_USE_GPT TRUE #define HAL_USE_DAC TRUE +#endif #include_next diff --git a/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h b/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h index 504dd8f9c1..8f5f1ab2df 100644 --- a/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h +++ b/keyboards/handwired/onekey/micromod/stm32f405/mcuconf.h @@ -18,21 +18,32 @@ #include_next +#if HAL_USE_ADC==TRUE #undef STM32_ADC_USE_ADC1 #define STM32_ADC_USE_ADC1 TRUE +#endif +#if HAL_USE_I2C==TRUE #undef STM32_I2C_USE_I2C2 #define STM32_I2C_USE_I2C2 TRUE +#endif +#if HAL_USE_SPI==TRUE #undef STM32_SPI_USE_SPI1 #define STM32_SPI_USE_SPI1 TRUE +#endif +#ifdef WS2812_PWM #undef STM32_PWM_USE_TIM3 #define STM32_PWM_USE_TIM3 TRUE +#endif +#ifdef AUDIO_DRIVER_PWM #undef STM32_PWM_USE_TIM8 #define STM32_PWM_USE_TIM8 TRUE +#endif +#ifdef AUDIO_DRIVER_DAC #undef STM32_DAC_USE_DAC1_CH1 #define STM32_DAC_USE_DAC1_CH1 TRUE #undef STM32_DAC_USE_DAC1_CH2 @@ -40,3 +51,4 @@ #undef STM32_GPT_USE_TIM6 #define STM32_GPT_USE_TIM6 TRUE +#endif