From 35475820adfc8f8a7bf4613902f4886c7cf4f017 Mon Sep 17 00:00:00 2001 From: FredericG Date: Sat, 5 Mar 2011 09:23:57 +0000 Subject: [PATCH] 2 new PIOS_DEBUG functions to output a value on the debug-pins. In its current implementation it will probably not work on CC.... git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2971 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/PiOS/STM32F10x/pios_debug.c | 22 ++++++++++++++++++++++ flight/PiOS/inc/pios_debug.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/flight/PiOS/STM32F10x/pios_debug.c b/flight/PiOS/STM32F10x/pios_debug.c index 38195d9b9..63539c8d1 100644 --- a/flight/PiOS/STM32F10x/pios_debug.c +++ b/flight/PiOS/STM32F10x/pios_debug.c @@ -100,6 +100,28 @@ void PIOS_DEBUG_PinLow(uint8_t Pin) #endif // PIOS_ENABLE_DEBUG_PINS } + +void PIOS_DEBUG_PinValue8Bit(uint8_t value) +{ +#ifdef PIOS_ENABLE_DEBUG_PINS + uint32_t bsrr_l = ((~(value & 0x0F)<<(16+6))) | ((value & 0x0F)<<6); + uint32_t bsrr_h = ((~(value & 0xF0)<<(16+6-4))) | ((value & 0xF0)<<(6-4)); + PIOS_IRQ_Disable(); + PIOS_SERVO_GPIO_PORT_1TO4->BSRR = bsrr_l; + PIOS_SERVO_GPIO_PORT_5TO8->BSRR = bsrr_h; + PIOS_IRQ_Enable(); +#endif // PIOS_ENABLE_DEBUG_PINS +} + +void PIOS_DEBUG_PinValue4BitL(uint8_t value) +{ +#ifdef PIOS_ENABLE_DEBUG_PINS + uint32_t bsrr_l = ((~(value & 0x0F)<<(16+6))) | ((value & 0x0F)<<6); + PIOS_SERVO_GPIO_PORT_1TO4->BSRR = bsrr_l; +#endif // PIOS_ENABLE_DEBUG_PINS +} + + /** * Report a serious error and halt */ diff --git a/flight/PiOS/inc/pios_debug.h b/flight/PiOS/inc/pios_debug.h index f62f7e841..e663d224e 100644 --- a/flight/PiOS/inc/pios_debug.h +++ b/flight/PiOS/inc/pios_debug.h @@ -36,6 +36,8 @@ extern const char *PIOS_DEBUG_AssertMsg; void PIOS_DEBUG_Init(void); void PIOS_DEBUG_PinHigh(uint8_t pin); void PIOS_DEBUG_PinLow(uint8_t pin); +void PIOS_DEBUG_PinValue8Bit(uint8_t value); +void PIOS_DEBUG_PinValue4BitL(uint8_t value); void PIOS_DEBUG_Panic(const char *msg); #ifdef DEBUG