1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-12 19:10:32 +03:00
This commit is contained in:
Jay Blackman 2025-07-10 18:14:14 +01:00 committed by GitHub
commit 7c1809afff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 99 additions and 6 deletions

View file

@ -53,7 +53,6 @@ PG_SRC = \
COMMON_SRC = \
build/build_config.c \
build/debug.c \
build/debug_pin.c \
build/version.c \
main.c \
common/bitarray.c \

View file

@ -189,7 +189,8 @@ MCU_COMMON_SRC = \
common/stm32/serial_uart_pinconfig.c \
drivers/serial_escserial.c \
drivers/serial_pinconfig.c \
APM32/system_apm32f4xx.c
APM32/system_apm32f4xx.c \
common/stm32/debug_pin.c
VCP_SRC = \
APM32/usb/vcp/usbd_cdc_descriptor.c \

View file

@ -135,7 +135,8 @@ MCU_COMMON_SRC = \
msc/usbd_storage_emfat.c \
msc/emfat.c \
msc/emfat_file.c \
msc/usbd_storage_sd_spi.c
msc/usbd_storage_sd_spi.c \
common/stm32/debug_pin.c
SPEED_OPTIMISED_SRC += \
common/stm32/dshot_bitbang_shared.c \

View file

@ -0,0 +1,86 @@
/*
* This file is part of Betaflight.
*
* Betaflight is free software. You can redistribute this software
* and/or modify this software under the terms of the GNU General
* Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later
* version.
*
* Betaflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "platform.h"
#include "build/debug_pin.h"
#ifdef USE_DEBUG_PIN
#ifndef DEBUG_PIN_COUNT
#define DEBUG_PIN_COUNT 0
#endif
#include "drivers/io.h"
#include "drivers/io_impl.h"
dbgPin_t dbgPins[DEBUG_PIN_COUNT] = {
#ifdef DEBUG_PIN1
{ .tag = IO_TAG(DEBUG_PIN1) },
#endif
#ifdef DEBUG_PIN2
{ .tag = IO_TAG(DEBUG_PIN2) },
#endif
};
IO_t dbgPinIOs[DEBUG_PIN_COUNT] = { 0 };
#endif
void dbgPinInit(void)
{
#ifdef USE_DEBUG_PIN
for (unsigned i = 0; i < ARRAYLEN(dbgPins); i++) {
const dbgPin_t *dbgPin = &dbgPins[i];
IO_t io = IOGetByTag(dbgPin->tag);
if (!io) {
continue;
}
IOInit(io, OWNER_SYSTEM, 0);
IOConfigGPIO(io, IOCFG_OUT_PP);
dbgPinIOs[i] = io;
}
#endif
}
void dbgPinHi(int index)
{
#ifdef USE_DEBUG_PIN
if ((unsigned)index >= ARRAYLEN(dbgPinIOs) || !dbgPinIOs[index]) {
return;
}
IOHi(dbgPinIOs[index]);
#else
UNUSED(index);
#endif
}
void dbgPinLo(int index)
{
#ifdef USE_DEBUG_PIN
if ((unsigned)index >= ARRAYLEN(dbgPinIOs) || !dbgPinIOs[index]) {
return;
}
IOLo(dbgPinIOs[index]);
#else
UNUSED(index);
#endif
}

View file

@ -408,7 +408,8 @@ MCU_COMMON_SRC = \
PICO/serial_usb_vcp_pico.c \
PICO/system.c \
PICO/usb/usb_cdc.c \
PICO/multicore.c
PICO/multicore.c \
PICO/debug_pin.c
DEVICE_STDPERIPH_SRC := \
$(PICO_LIB_SRC) \

View file

@ -17,7 +17,8 @@ MCU_COMMON_SRC += \
STM32/pwm_output_hw.c \
common/stm32/pwm_output_dshot_shared.c \
common/stm32/pwm_output_beeper.c \
common/stm32/dshot_bitbang_shared.c
common/stm32/dshot_bitbang_shared.c \
common/stm32/debug_pin.c
SIZE_OPTIMISED_SRC += \
drivers/bus_spi_config.c \

View file

@ -20,10 +20,14 @@
#include "platform.h"
#include "debug_pin.h"
#include "build/debug_pin.h"
#ifdef USE_DEBUG_PIN
#ifndef DEBUG_PIN_COUNT
#define DEBUG_PIN_COUNT 0
#endif
#include "drivers/io.h"
#include "drivers/io_impl.h"