diff --git a/software/main/include/config.h b/software/main/include/config.h new file mode 100644 index 0000000..07ce3e5 --- /dev/null +++ b/software/main/include/config.h @@ -0,0 +1,9 @@ +#pragma once + +#include "hal/gpio_types.h" + +#define I2S_PIN_BCK GPIO_NUM_26 +#define I2S_PIN_WS GPIO_NUM_25 +#define I2S_PIN_DATA GPIO_NUM_33 +#define TWAI_PIN_CTX GPIO_NUM_5 +#define TWAI_PIN_CRX GPIO_NUM_19 diff --git a/software/main/include/wav.h b/software/main/include/wav.h index 9786af6..efd74e0 100644 --- a/software/main/include/wav.h +++ b/software/main/include/wav.h @@ -2,7 +2,6 @@ #include -#define WAV_PLAY_HELPER(str) #str #define WAV_PLAY(NAME) {\ extern const uint8_t _binary_ ## NAME ## _wav_start[]; \ extern const uint8_t _binary_ ## NAME ## _wav_end[]; \ diff --git a/software/main/src/i2s.cpp b/software/main/src/i2s.cpp index 8502269..6b28299 100644 --- a/software/main/src/i2s.cpp +++ b/software/main/src/i2s.cpp @@ -5,6 +5,7 @@ #include "driver/i2s.h" #include "i2s.h" +#include "config.h" #define I2S_TAG "APP_I2S" @@ -62,9 +63,9 @@ void i2s::init() { i2s_pin_config_t pin_config = { .mck_io_num = 0, - .bck_io_num = 26, - .ws_io_num = 25, - .data_out_num = 33, + .bck_io_num = I2S_PIN_BCK, + .ws_io_num = I2S_PIN_WS, + .data_out_num = I2S_PIN_DATA, .data_in_num = I2S_PIN_NO_CHANGE, }; diff --git a/software/main/src/twai.cpp b/software/main/src/twai.cpp index b28154f..4f4e043 100644 --- a/software/main/src/twai.cpp +++ b/software/main/src/twai.cpp @@ -8,6 +8,7 @@ #include "hal/twai_types.h" #include "twai.h" +#include "config.h" #include "avrcp.h" #include "can_data.h" #include "volume.h" @@ -158,7 +159,7 @@ static void listen(void*) { } void twai::init() { - twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(GPIO_NUM_5, GPIO_NUM_19, TWAI_MODE_NORMAL); + twai_general_config_t g_config = TWAI_GENERAL_CONFIG_DEFAULT(TWAI_PIN_CTX, TWAI_PIN_CRX, TWAI_MODE_NORMAL); twai_timing_config_t t_config = TWAI_TIMING_CONFIG_125KBITS(); twai_filter_config_t f_config = { .acceptance_code = (0b100100101 << 5) + (0b1000011111 << 21),