From c1160429f6c82dbcb0de66774c1529ca4cee7d59 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Tue, 11 Apr 2023 23:39:20 -0400 Subject: [PATCH] [+] ESP32-S3 Config --- firmware/platformio.ini | 18 ++++++++++-------- firmware/src/config.h | 8 +++----- firmware/src/macros.h | 4 ++-- firmware/src/main.cpp | 4 ---- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/firmware/platformio.ini b/firmware/platformio.ini index 582756b..3a5ebe1 100644 --- a/firmware/platformio.ini +++ b/firmware/platformio.ini @@ -13,6 +13,11 @@ ;board = wemos_d1_uno32 ;framework = arduino +[env:s3] +platform = espressif32 +board = esp32-s3-devkitc-1 +framework = arduino + ; ESP32-S2 and C3 both has a problem where the ADC jumps around a LOT ;[env:s2] ;platform = espressif32 @@ -25,14 +30,11 @@ ;framework = arduino ; YD STM32F411CEU6 -[env:stm32f411ce] -platform = ststm32 -board = blackpill_f411ce -framework = arduino -;upload_protocol = stlink -; Flash using yd-link -;debug_tool = cmsis-dap -upload_protocol = cmsis-dap +;[env:stm32f411ce] +;platform = ststm32 +;board = blackpill_f411ce +;framework = arduino +;upload_protocol = dfu ; Arduino nano is good but too few pins ;[env:n328p] diff --git a/firmware/src/config.h b/firmware/src/config.h index 4b6365e..9a14d8e 100644 --- a/firmware/src/config.h +++ b/firmware/src/config.h @@ -1,24 +1,22 @@ #ifndef FIRMWARE_CONFIG_H #define FIRMWARE_CONFIG_H -#include "stm32f4xx_hal.h" - // ======================================== // Pin Configuration // ======================================== // LED indicator for pulling update -const int LED_REFRESH = PA13; +const int LED_REFRESH = 37; // 4 1:16 Multiplexers: GPIO pins for each analog multiplexer that handles 12 sensors of an octave // Notes are connected in order: Mux #1 (0-11), Mux #2 (12-23), Mux #3 (24-35), Mux #4 (36-47), Mux #5 (48-59) const int NUM_MUX = 5; const int PINS_PER_MUX = 12; -const int MUX_IN[NUM_MUX] = {PA0, PA1, PA2, PA3, PA4}; // Analog signal input +const int MUX_IN[NUM_MUX] = {4, 5, 6, 7, 8}; // Select pins for every multiplexer, each multiplexer has 4 select pins, all sel0 are connected to 14, etc. const int NUM_MUX_SEL = 4; -const int MUX_SEL_OUT[NUM_MUX_SEL] = {PB4, PB5, PB6, PB7}; +const int MUX_SEL_OUT[NUM_MUX_SEL] = {10, 11, 12, 13}; // 3 1:8 Multiplexers for the midi panel const int P_NUM_MUX = 3; diff --git a/firmware/src/macros.h b/firmware/src/macros.h index 254bfe1..d7b617f 100644 --- a/firmware/src/macros.h +++ b/firmware/src/macros.h @@ -5,8 +5,8 @@ #define u16 uint16_t #define u32 uint32_t #define u64 uint64_t -//#define timeMillis() std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() -#define timeMillis() HAL_GetTick() +#define timeMillis() std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count() +//#define timeMillis() HAL_GetTick() #define min(a, b) ((a) < (b) ? (a) : (b)) #define let auto #define val const auto diff --git a/firmware/src/main.cpp b/firmware/src/main.cpp index 79ca92c..4009aa5 100644 --- a/firmware/src/main.cpp +++ b/firmware/src/main.cpp @@ -1,11 +1,8 @@ #include #include -#include #include "macros.h" #include "config.h" -#include "stm32f4xx_hal.h" - // ======================================== // Code // ======================================== @@ -39,7 +36,6 @@ let led_refresh_on = false; void setup() { - HAL_Init(); // Initialize pin and serial for (int pin: MUX_IN) pinMode(pin, INPUT);