From 0459e88a8d872d083b6713883461f382dba7fa2e Mon Sep 17 00:00:00 2001 From: rtlopez Date: Fri, 18 Oct 2024 23:25:56 +0200 Subject: [PATCH] target cleanup + buzzer fix --- lib/Espfc/src/Cli.h | 4 ---- lib/Espfc/src/Espfc.cpp | 12 +----------- lib/Espfc/src/Espfc.h | 4 ---- lib/Espfc/src/ModelConfig.h | 4 ---- lib/Espfc/src/Target/Target.h | 2 -- lib/Espfc/src/Target/TargetESP32.h | 1 - lib/Espfc/src/Target/TargetESP32c3.h | 1 - lib/Espfc/src/Target/TargetESP32s2.h | 1 - lib/Espfc/src/Target/TargetESP32s3.h | 1 - lib/Espfc/src/Target/TargetESP8266.h | 1 - lib/Espfc/src/Target/TargetNRF52840.h | 1 - lib/Espfc/src/Target/TargetRP2040.h | 1 - lib/Espfc/src/Target/TargetUnitTest.h | 1 + platformio.ini | 13 +++++++++---- 14 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 lib/Espfc/src/Target/TargetNRF52840.h diff --git a/lib/Espfc/src/Cli.h b/lib/Espfc/src/Cli.h index 5bc36ec0..618aff37 100644 --- a/lib/Espfc/src/Cli.h +++ b/lib/Espfc/src/Cli.h @@ -667,9 +667,7 @@ class Cli #if ESPFC_OUTPUT_COUNT > 7 Param(PSTR("pin_output_7"), &c.pin[PIN_OUTPUT_7]), #endif -#ifdef ESPFC_BUZZER Param(PSTR("pin_buzzer"), &c.pin[PIN_BUZZER]), -#endif #if defined(ESPFC_SERIAL_0) && defined(ESPFC_SERIAL_REMAP_PINS) Param(PSTR("pin_serial_0_tx"), &c.pin[PIN_SERIAL_0_TX]), Param(PSTR("pin_serial_0_rx"), &c.pin[PIN_SERIAL_0_RX]), @@ -700,9 +698,7 @@ class Cli Param(PSTR("pin_spi_cs_1"), &c.pin[PIN_SPI_CS1]), Param(PSTR("pin_spi_cs_2"), &c.pin[PIN_SPI_CS2]), #endif -#ifdef ESPFC_BUZZER Param(PSTR("pin_buzzer_invert"), &c.buzzer.inverted), -#endif #ifdef ESPFC_I2C_0 Param(PSTR("i2c_speed"), &c.i2cSpeed), diff --git a/lib/Espfc/src/Espfc.cpp b/lib/Espfc/src/Espfc.cpp index a1d7014f..7e705b14 100644 --- a/lib/Espfc/src/Espfc.cpp +++ b/lib/Espfc/src/Espfc.cpp @@ -5,11 +5,7 @@ namespace Espfc { Espfc::Espfc(): _hardware(_model), _controller(_model), _input(_model), _actuator(_model), _sensor(_model), - _mixer(_model), _blackbox(_model) -#ifdef ESPFC_BUZER - , _buzzer(_model) -#endif - , _serial(_model) + _mixer(_model), _blackbox(_model), _buzzer(_model), _serial(_model) {} int Espfc::load() @@ -32,9 +28,7 @@ int Espfc::begin() _actuator.begin(); // requires _model.begin() _controller.begin(); _blackbox.begin(); // requires _serial.begin(), _actuator.begin() -#ifdef ESPFC_BUZER _buzzer.begin(); -#endif _model.state.buzzer.push(BUZZER_SYSTEM_INIT); return 1; @@ -65,9 +59,7 @@ int FAST_CODE_ATTR Espfc::update(bool externalTrigger) } _serial.update(); -#ifdef ESPFC_BUZER _buzzer.update(); -#endif _model.state.stats.update(); #else @@ -93,9 +85,7 @@ int FAST_CODE_ATTR Espfc::update(bool externalTrigger) _sensor.updateDelayed(); _serial.update(); -#ifdef ESPFC_BUZER _buzzer.update(); -#endif _model.state.stats.update(); #endif diff --git a/lib/Espfc/src/Espfc.h b/lib/Espfc/src/Espfc.h index 06f0ea64..5a56980b 100644 --- a/lib/Espfc/src/Espfc.h +++ b/lib/Espfc/src/Espfc.h @@ -9,9 +9,7 @@ #include "SerialManager.h" #include "Output/Mixer.h" #include "Blackbox/Blackbox.h" -#ifdef ESPFC_BUZER #include "Buzzer.h" -#endif namespace Espfc { @@ -39,9 +37,7 @@ class Espfc SensorManager _sensor; Output::Mixer _mixer; Blackbox::Blackbox _blackbox; -#ifdef ESPFC_BUZER Buzzer _buzzer; -#endif SerialManager _serial; uint32_t _loop_next; }; diff --git a/lib/Espfc/src/ModelConfig.h b/lib/Espfc/src/ModelConfig.h index 6e437721..5906df73 100644 --- a/lib/Espfc/src/ModelConfig.h +++ b/lib/Espfc/src/ModelConfig.h @@ -257,9 +257,7 @@ enum PinFunction { #if ESPFC_OUTPUT_COUNT > 7 PIN_OUTPUT_7, #endif -#ifdef ESPFC_BUZZER PIN_BUZZER, -#endif #ifdef ESPFC_SERIAL_0 PIN_SERIAL_0_TX, PIN_SERIAL_0_RX, @@ -658,9 +656,7 @@ class ModelConfig #if ESPFC_OUTPUT_COUNT > 7 pin[PIN_OUTPUT_7] = ESPFC_OUTPUT_7; #endif -#ifdef ESPFC_BUZZER pin[PIN_BUZZER] = ESPFC_BUZZER_PIN; -#endif #ifdef ESPFC_SERIAL_0 pin[PIN_SERIAL_0_TX] = ESPFC_SERIAL_0_TX; pin[PIN_SERIAL_0_RX] = ESPFC_SERIAL_0_RX; diff --git a/lib/Espfc/src/Target/Target.h b/lib/Espfc/src/Target/Target.h index b73e29e7..4ae4d19d 100644 --- a/lib/Espfc/src/Target/Target.h +++ b/lib/Espfc/src/Target/Target.h @@ -12,8 +12,6 @@ #include "TargetESP8266.h" #elif defined(ARCH_RP2040) #include "TargetRP2040.h" -#elif defined(ARCH_NRF52840) - #include "TargetNRF52840.h" #elif defined(UNIT_TEST) #include "TargetUnitTest.h" #else diff --git a/lib/Espfc/src/Target/TargetESP32.h b/lib/Espfc/src/Target/TargetESP32.h index 47a4f131..5b3a49aa 100644 --- a/lib/Espfc/src/Target/TargetESP32.h +++ b/lib/Espfc/src/Target/TargetESP32.h @@ -62,7 +62,6 @@ #define ESPFC_I2C_0_SDA 21 #define ESPFC_I2C_0_SOFT -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN 0 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetESP32c3.h b/lib/Espfc/src/Target/TargetESP32c3.h index 4ba66808..11a3fb9a 100644 --- a/lib/Espfc/src/Target/TargetESP32c3.h +++ b/lib/Espfc/src/Target/TargetESP32c3.h @@ -59,7 +59,6 @@ #define ESPFC_I2C_0_SDA 8 #define ESPFC_I2C_0_SOFT -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN -1 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetESP32s2.h b/lib/Espfc/src/Target/TargetESP32s2.h index d379dc91..ba95a765 100644 --- a/lib/Espfc/src/Target/TargetESP32s2.h +++ b/lib/Espfc/src/Target/TargetESP32s2.h @@ -56,7 +56,6 @@ #define ESPFC_I2C_0_SDA 9 #define ESPFC_I2C_0_SOFT -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN 5 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetESP32s3.h b/lib/Espfc/src/Target/TargetESP32s3.h index bf6366fd..d598a453 100644 --- a/lib/Espfc/src/Target/TargetESP32s3.h +++ b/lib/Espfc/src/Target/TargetESP32s3.h @@ -71,7 +71,6 @@ #define ESPFC_I2C_0_SDA 9 #define ESPFC_I2C_0_SOFT -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN 5 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetESP8266.h b/lib/Espfc/src/Target/TargetESP8266.h index ba25375a..2a62dadb 100644 --- a/lib/Espfc/src/Target/TargetESP8266.h +++ b/lib/Espfc/src/Target/TargetESP8266.h @@ -41,7 +41,6 @@ #define ESPFC_I2C_0_SDA 4 // D2 #define ESPFC_I2C_0_SOFT -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN 16 // D0 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetNRF52840.h b/lib/Espfc/src/Target/TargetNRF52840.h deleted file mode 100644 index 7b9637ef..00000000 --- a/lib/Espfc/src/Target/TargetNRF52840.h +++ /dev/null @@ -1 +0,0 @@ -#pragma once \ No newline at end of file diff --git a/lib/Espfc/src/Target/TargetRP2040.h b/lib/Espfc/src/Target/TargetRP2040.h index 54a060c2..fb57386c 100644 --- a/lib/Espfc/src/Target/TargetRP2040.h +++ b/lib/Espfc/src/Target/TargetRP2040.h @@ -54,7 +54,6 @@ #define ESPFC_I2C_0_SDA 16 #define ESPFC_I2C_0_SCL 17 -#define ESPFC_BUZZER #define ESPFC_BUZZER_PIN -1 #define ESPFC_ADC_0 diff --git a/lib/Espfc/src/Target/TargetUnitTest.h b/lib/Espfc/src/Target/TargetUnitTest.h index 7103ccf5..58937f5f 100644 --- a/lib/Espfc/src/Target/TargetUnitTest.h +++ b/lib/Espfc/src/Target/TargetUnitTest.h @@ -22,6 +22,7 @@ #define SERIAL_TX_FIFO_SIZE 0xFF #define ESPFC_SERIAL_DEBUG_PORT 0 +#define ESPFC_BUZZER_PIN -1 inline void targetReset() { diff --git a/platformio.ini b/platformio.ini index 03e1d8be..8b5932ad 100644 --- a/platformio.ini +++ b/platformio.ini @@ -136,16 +136,21 @@ build_flags = -DIRAM_ATTR="" ; -DIRAM_ATTR='__attribute__ ((section(".time_critical.iram_attr")))' -[env:nrf52840] -platform = https://github.com/maxgerhardt/platform-nordicnrf52 -board = xiaoblesense +[env:rp2350] +board = rpipico2 +;platform = https://github.com/maxgerhardt/platform-raspberrypi.git#rp2350_picosdk +platform = https://github.com/maxgerhardt/platform-raspberrypi.git framework = arduino +board_build.core = earlephilhower lib_deps = build_flags = ${env.build_flags} - -DARCH_NRF52840 + -DARCH_RP2040 + -DARCH_RP2350 -DIRAM_ATTR="" +; -DIRAM_ATTR='__attribute__ ((section(".time_critical.iram_attr")))' +; target for unit tests [env:native] platform = native lib_deps =