diff --git a/flight/modules/Osd/OsdEtStd/OsdEtStd.c b/flight/modules/Osd/OsdEtStd/OsdEtStd.c index edd148942..a1e4a5d69 100644 --- a/flight/modules/Osd/OsdEtStd/OsdEtStd.c +++ b/flight/modules/Osd/OsdEtStd/OsdEtStd.c @@ -41,7 +41,7 @@ // #define DEBUG_PORT PIOS_COM_GPS //#define ENABLE_DEBUG_MSG -//#define USE_DEBUG_PINS +//#define PIOS_ENABLE_DEBUG_PINS //#define DUMP_CONFIG // Enable this do read and dump the OSD config // @@ -78,7 +78,7 @@ #define OSDMSG_GPS_STAT_FIX 0x2B #define OSDMSG_GPS_STAT_HB_FLAG 0x10 -#ifdef USE_DEBUG_PINS +#ifdef PIOS_ENABLE_DEBUG_PINS #define DEBUG_PIN_RUNNING 0 #define DEBUG_PIN_I2C 1 #define DebugPinHigh(x) PIOS_DEBUG_PinHigh(x) diff --git a/flight/pios/pios.h b/flight/pios/pios.h index 5e581b345..f1e7e7f4a 100644 --- a/flight/pios/pios.h +++ b/flight/pios/pios.h @@ -65,6 +65,7 @@ /* PIOS debug interface */ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ #include /* PIOS common functions */ diff --git a/flight/pios/stm32f10x/pios_debug.c b/flight/pios/stm32f10x/pios_debug.c index f7c9d6cf3..e7e7e148e 100644 --- a/flight/pios/stm32f10x/pios_debug.c +++ b/flight/pios/stm32f10x/pios_debug.c @@ -7,7 +7,7 @@ * @{ * * @file pios_debug.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. * @brief Debugging Functions * @see The GNU Public License (GPL) Version 3 * @@ -60,13 +60,13 @@ void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_chann GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Pin = chan->init->GPIO_Pin; + GPIO_InitStructure.GPIO_Pin = chan->pin.init.GPIO_Pin; /* Initialize the GPIO */ - GPIO_Init(chan->init->port, &GPIO_InitStructure); + GPIO_Init(chan->pin.gpio, &GPIO_InitStructure); /* Set the pin low */ - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_RESET); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_RESET); } #endif // PIOS_ENABLE_DEBUG_PINS } @@ -84,7 +84,7 @@ void PIOS_DEBUG_PinHigh(uint8_t pin) const struct pios_tim_channel * chan = &debug_channels[pin]; - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_Set); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_SET); #endif // PIOS_ENABLE_DEBUG_PINS } @@ -102,7 +102,7 @@ void PIOS_DEBUG_PinLow(uint8_t pin) const struct pios_tim_channel * chan = &debug_channels[pin]; - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_RESET); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_RESET); #endif // PIOS_ENABLE_DEBUG_PINS } @@ -124,8 +124,8 @@ void PIOS_DEBUG_PinValue8Bit(uint8_t value) * This is sketchy since it assumes a particular ordering * and bitwise layout of the channels provided to the debug code. */ - debug_channels[0].init.port->BSRR = bsrr_l; - debug_channels[4].init.port->BSRR = bsrr_h; + debug_channels[0].pin.gpio->BSRR = bsrr_l; + debug_channels[4].pin.gpio->BSRR = bsrr_h; PIOS_IRQ_Enable(); #endif // PIOS_ENABLE_DEBUG_PINS @@ -143,7 +143,7 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value) * and bitwise layout of the channels provided to the debug code. */ uint32_t bsrr_l = ((~(value & 0x0F)<<(16+6))) | ((value & 0x0F)<<6); - debug_channels[0].init.port->BSRR = bsrr_l; + debug_channels[0].pin.gpio->BSRR = bsrr_l; #endif // PIOS_ENABLE_DEBUG_PINS } diff --git a/flight/pios/stm32f4xx/pios_debug.c b/flight/pios/stm32f4xx/pios_debug.c index 51efbc188..e7e7e148e 100644 --- a/flight/pios/stm32f4xx/pios_debug.c +++ b/flight/pios/stm32f4xx/pios_debug.c @@ -7,7 +7,7 @@ * @{ * * @file pios_debug.c - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012. + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2013. * @brief Debugging Functions * @see The GNU Public License (GPL) Version 3 * @@ -60,13 +60,13 @@ void PIOS_DEBUG_Init(const struct pios_tim_channel * channels, uint8_t num_chann GPIO_StructInit(&GPIO_InitStructure); GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; - GPIO_InitStructure.GPIO_Pin = chan->init->GPIO_Pin; + GPIO_InitStructure.GPIO_Pin = chan->pin.init.GPIO_Pin; /* Initialize the GPIO */ - GPIO_Init(chan->init->port, &GPIO_InitStructure); + GPIO_Init(chan->pin.gpio, &GPIO_InitStructure); /* Set the pin low */ - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_RESET); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_RESET); } #endif // PIOS_ENABLE_DEBUG_PINS } @@ -84,7 +84,7 @@ void PIOS_DEBUG_PinHigh(uint8_t pin) const struct pios_tim_channel * chan = &debug_channels[pin]; - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_Set); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_SET); #endif // PIOS_ENABLE_DEBUG_PINS } @@ -102,7 +102,7 @@ void PIOS_DEBUG_PinLow(uint8_t pin) const struct pios_tim_channel * chan = &debug_channels[pin]; - GPIO_WriteBit(chan->init->port, chan->init->GPIO_Pin, Bit_RESET); + GPIO_WriteBit(chan->pin.gpio, chan->pin.init.GPIO_Pin, Bit_RESET); #endif // PIOS_ENABLE_DEBUG_PINS } @@ -124,8 +124,8 @@ void PIOS_DEBUG_PinValue8Bit(uint8_t value) * This is sketchy since it assumes a particular ordering * and bitwise layout of the channels provided to the debug code. */ - debug_channels[0].init.port->BSRR = bsrr_l; - debug_channels[4].init.port->BSRR = bsrr_h; + debug_channels[0].pin.gpio->BSRR = bsrr_l; + debug_channels[4].pin.gpio->BSRR = bsrr_h; PIOS_IRQ_Enable(); #endif // PIOS_ENABLE_DEBUG_PINS @@ -143,7 +143,7 @@ void PIOS_DEBUG_PinValue4BitL(uint8_t value) * and bitwise layout of the channels provided to the debug code. */ uint32_t bsrr_l = ((~(value & 0x0F)<<(16+6))) | ((value & 0x0F)<<6); - debug_channels[0].init.port->BSRR = bsrr_l; + debug_channels[0].pin.gpio->BSRR = bsrr_l; #endif // PIOS_ENABLE_DEBUG_PINS } diff --git a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h index ea4f2ae1d..207920f98 100644 --- a/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h +++ b/flight/targets/boards/coptercontrol/firmware/inc/pios_config.h @@ -38,6 +38,7 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ /* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS diff --git a/flight/targets/boards/coptercontrol/firmware/pios_board.c b/flight/targets/boards/coptercontrol/firmware/pios_board.c index d620acfee..12b38640d 100644 --- a/flight/targets/boards/coptercontrol/firmware/pios_board.c +++ b/flight/targets/boards/coptercontrol/firmware/pios_board.c @@ -773,7 +773,7 @@ void PIOS_Board_Init(void) { /* Remap AFIO pin for PB4 (Servo 5 Out)*/ GPIO_PinRemapConfig( GPIO_Remap_SWJ_NoJTRST, ENABLE); -#ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS +#ifndef PIOS_ENABLE_DEBUG_PINS switch (hwsettings_rcvrport) { case HWSETTINGS_CC_RCVRPORT_DISABLED: case HWSETTINGS_CC_RCVRPORT_PWM: @@ -787,8 +787,8 @@ void PIOS_Board_Init(void) { break; } #else - PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels)); -#endif /* PIOS_DEBUG_ENABLE_DEBUG_PINS */ + PIOS_DEBUG_Init(pios_tim_servoport_all_pins, NELEMENTS(pios_tim_servoport_all_pins)); +#endif /* PIOS_ENABLE_DEBUG_PINS */ switch(bdinfo->board_rev) { case BOARD_REVISION_CC: diff --git a/flight/targets/boards/oplinkmini/firmware/inc/pios_config.h b/flight/targets/boards/oplinkmini/firmware/inc/pios_config.h index 1da5edbe0..6d149e4f1 100644 --- a/flight/targets/boards/oplinkmini/firmware/inc/pios_config.h +++ b/flight/targets/boards/oplinkmini/firmware/inc/pios_config.h @@ -38,6 +38,7 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ /* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS diff --git a/flight/targets/boards/osd/firmware/inc/pios_config.h b/flight/targets/boards/osd/firmware/inc/pios_config.h index c08dda8b5..3772c5939 100644 --- a/flight/targets/boards/osd/firmware/inc/pios_config.h +++ b/flight/targets/boards/osd/firmware/inc/pios_config.h @@ -38,6 +38,7 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ /* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS diff --git a/flight/targets/boards/revolution/firmware/inc/pios_config.h b/flight/targets/boards/revolution/firmware/inc/pios_config.h index 1df7180b3..1025db7e3 100644 --- a/flight/targets/boards/revolution/firmware/inc/pios_config.h +++ b/flight/targets/boards/revolution/firmware/inc/pios_config.h @@ -38,6 +38,7 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ /* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS diff --git a/flight/targets/boards/revolution/firmware/pios_board.c b/flight/targets/boards/revolution/firmware/pios_board.c index 5263da346..559ab4a81 100644 --- a/flight/targets/boards/revolution/firmware/pios_board.c +++ b/flight/targets/boards/revolution/firmware/pios_board.c @@ -777,11 +777,11 @@ void PIOS_Board_Init(void) { pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_GCS] = pios_gcsrcvr_rcvr_id; #endif /* PIOS_INCLUDE_GCSRCVR */ -#ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS +#ifndef PIOS_ENABLE_DEBUG_PINS // pios_servo_cfg points to the correct configuration based on input port settings PIOS_Servo_Init(pios_servo_cfg); #else - PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels)); + PIOS_DEBUG_Init(pios_tim_servoport_all_pins, NELEMENTS(pios_tim_servoport_all_pins)); #endif if (PIOS_I2C_Init(&pios_i2c_mag_pressure_adapter_id, &pios_i2c_mag_pressure_adapter_cfg)) { diff --git a/flight/targets/boards/revoproto/firmware/inc/pios_config.h b/flight/targets/boards/revoproto/firmware/inc/pios_config.h index c148d9142..2e428bd01 100644 --- a/flight/targets/boards/revoproto/firmware/inc/pios_config.h +++ b/flight/targets/boards/revoproto/firmware/inc/pios_config.h @@ -38,6 +38,7 @@ /* #define PIOS_INCLUDE_DEBUG_CONSOLE */ /* #define DEBUG_LEVEL 0 */ +/* #define PIOS_ENABLE_DEBUG_PINS */ /* PIOS FreeRTOS support */ #define PIOS_INCLUDE_FREERTOS diff --git a/flight/targets/boards/revoproto/firmware/pios_board.c b/flight/targets/boards/revoproto/firmware/pios_board.c index d4b390b72..8a0679a5b 100644 --- a/flight/targets/boards/revoproto/firmware/pios_board.c +++ b/flight/targets/boards/revoproto/firmware/pios_board.c @@ -826,7 +826,7 @@ void PIOS_Board_Init(void) { pios_rcvr_group_map[MANUALCONTROLSETTINGS_CHANNELGROUPS_GCS] = pios_gcsrcvr_rcvr_id; #endif /* PIOS_INCLUDE_GCSRCVR */ -#ifndef PIOS_DEBUG_ENABLE_DEBUG_PINS +#ifndef PIOS_ENABLE_DEBUG_PINS switch (hwsettings_rcvrport) { case HWSETTINGS_RV_RCVRPORT_DISABLED: case HWSETTINGS_RV_RCVRPORT_PWM: @@ -842,7 +842,7 @@ void PIOS_Board_Init(void) { break; } #else - PIOS_DEBUG_Init(&pios_tim_servo_all_channels, NELEMENTS(pios_tim_servo_all_channels)); + PIOS_DEBUG_Init(pios_tim_servoport_all_pins, NELEMENTS(pios_tim_servoport_all_pins)); #endif if (PIOS_I2C_Init(&pios_i2c_mag_adapter_id, &pios_i2c_mag_adapter_cfg)) {