mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 03:20:00 +03:00
PICO: Implement debug pin
This commit is contained in:
parent
1743a43d19
commit
156020cf01
7 changed files with 97 additions and 6 deletions
|
@ -53,7 +53,6 @@ PG_SRC = \
|
||||||
COMMON_SRC = \
|
COMMON_SRC = \
|
||||||
build/build_config.c \
|
build/build_config.c \
|
||||||
build/debug.c \
|
build/debug.c \
|
||||||
build/debug_pin.c \
|
|
||||||
build/version.c \
|
build/version.c \
|
||||||
main.c \
|
main.c \
|
||||||
common/bitarray.c \
|
common/bitarray.c \
|
||||||
|
|
|
@ -189,7 +189,8 @@ MCU_COMMON_SRC = \
|
||||||
common/stm32/serial_uart_pinconfig.c \
|
common/stm32/serial_uart_pinconfig.c \
|
||||||
drivers/serial_escserial.c \
|
drivers/serial_escserial.c \
|
||||||
drivers/serial_pinconfig.c \
|
drivers/serial_pinconfig.c \
|
||||||
APM32/system_apm32f4xx.c
|
APM32/system_apm32f4xx.c \
|
||||||
|
common/stm32/debug_pin.c
|
||||||
|
|
||||||
VCP_SRC = \
|
VCP_SRC = \
|
||||||
APM32/usb/vcp/usbd_cdc_descriptor.c \
|
APM32/usb/vcp/usbd_cdc_descriptor.c \
|
||||||
|
|
|
@ -135,7 +135,8 @@ MCU_COMMON_SRC = \
|
||||||
msc/usbd_storage_emfat.c \
|
msc/usbd_storage_emfat.c \
|
||||||
msc/emfat.c \
|
msc/emfat.c \
|
||||||
msc/emfat_file.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 += \
|
SPEED_OPTIMISED_SRC += \
|
||||||
common/stm32/dshot_bitbang_shared.c \
|
common/stm32/dshot_bitbang_shared.c \
|
||||||
|
|
84
src/platform/PICO/debug_pin.c
Normal file
84
src/platform/PICO/debug_pin.c
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/*
|
||||||
|
* 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)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IOHi(dbgPinIOs[index]);
|
||||||
|
#else
|
||||||
|
UNUSED(index);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void dbgPinLo(int index)
|
||||||
|
{
|
||||||
|
#ifdef USE_DEBUG_PIN
|
||||||
|
if ((unsigned)index >= ARRAYLEN(dbgPinIOs)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
IOLo(dbgPinIOs[index]);
|
||||||
|
#else
|
||||||
|
UNUSED(index);
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -408,7 +408,8 @@ MCU_COMMON_SRC = \
|
||||||
PICO/serial_usb_vcp_pico.c \
|
PICO/serial_usb_vcp_pico.c \
|
||||||
PICO/system.c \
|
PICO/system.c \
|
||||||
PICO/usb/usb_cdc.c \
|
PICO/usb/usb_cdc.c \
|
||||||
PICO/multicore.c
|
PICO/multicore.c \
|
||||||
|
PICO/debug_pin.c
|
||||||
|
|
||||||
DEVICE_STDPERIPH_SRC := \
|
DEVICE_STDPERIPH_SRC := \
|
||||||
$(PICO_LIB_SRC) \
|
$(PICO_LIB_SRC) \
|
||||||
|
|
|
@ -17,7 +17,8 @@ MCU_COMMON_SRC += \
|
||||||
STM32/pwm_output_hw.c \
|
STM32/pwm_output_hw.c \
|
||||||
common/stm32/pwm_output_dshot_shared.c \
|
common/stm32/pwm_output_dshot_shared.c \
|
||||||
common/stm32/pwm_output_beeper.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 += \
|
SIZE_OPTIMISED_SRC += \
|
||||||
drivers/bus_spi_config.c \
|
drivers/bus_spi_config.c \
|
||||||
|
|
|
@ -20,10 +20,14 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
#include "debug_pin.h"
|
#include "build/debug_pin.h"
|
||||||
|
|
||||||
#ifdef USE_DEBUG_PIN
|
#ifdef USE_DEBUG_PIN
|
||||||
|
|
||||||
|
#ifndef DEBUG_PIN_COUNT
|
||||||
|
#define DEBUG_PIN_COUNT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "drivers/io.h"
|
#include "drivers/io.h"
|
||||||
#include "drivers/io_impl.h"
|
#include "drivers/io_impl.h"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue