Skip to content

Commit

Permalink
target cleanup + buzzer fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rtlopez committed Jan 9, 2025
1 parent aaa17a9 commit 0459e88
Show file tree
Hide file tree
Showing 14 changed files with 11 additions and 36 deletions.
4 changes: 0 additions & 4 deletions lib/Espfc/src/Cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
Expand Down Expand Up @@ -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),
Expand Down
12 changes: 1 addition & 11 deletions lib/Espfc/src/Espfc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
4 changes: 0 additions & 4 deletions lib/Espfc/src/Espfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include "SerialManager.h"
#include "Output/Mixer.h"
#include "Blackbox/Blackbox.h"
#ifdef ESPFC_BUZER
#include "Buzzer.h"
#endif

namespace Espfc {

Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 0 additions & 4 deletions lib/Espfc/src/ModelConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions lib/Espfc/src/Target/Target.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetESP32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetESP32c3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetESP32s2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetESP32s3.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetESP8266.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetNRF52840.h

This file was deleted.

1 change: 0 additions & 1 deletion lib/Espfc/src/Target/TargetRP2040.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/Espfc/src/Target/TargetUnitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define SERIAL_TX_FIFO_SIZE 0xFF

#define ESPFC_SERIAL_DEBUG_PORT 0
#define ESPFC_BUZZER_PIN -1

inline void targetReset()
{
Expand Down
13 changes: 9 additions & 4 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 0459e88

Please sign in to comment.