1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

pios: STM32F10x PIOS #ifdef guards

This commit is contained in:
Oleg Semyonov 2013-03-15 20:25:30 +02:00
parent 285cad290b
commit b73ddffbf0
26 changed files with 87 additions and 72 deletions

View File

@ -28,6 +28,9 @@
*/
#include "pios.h"
#ifdef PIOS_INCLUDE_ADC
#include <pios_adc_priv.h>
// Private types
@ -361,6 +364,8 @@ void PIOS_ADC_DMA_Handler(void)
}
}
#endif /* PIOS_INCLUDE_ADC */
/**
* @}
* @}

View File

@ -28,9 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_BL_HELPER)
#ifdef PIOS_INCLUDE_BL_HELPER
#include <pios_board_info.h>
#include "stm32f10x_flash.h"
@ -99,4 +100,5 @@ void PIOS_BL_HELPER_CRC_Ini()
{
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
}
#endif
#endif /* PIOS_INCLUDE_BL_HELPER */

View File

@ -28,7 +28,6 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
// Global variables

View File

@ -30,10 +30,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include <pios.h>
#if defined(PIOS_INCLUDE_DELAY)
#ifdef PIOS_INCLUDE_DELAY
/* these should be defined by CMSIS, but they aren't */
#define DWT_CTRL (*(volatile uint32_t *)0xe0001000)
@ -167,7 +166,7 @@ uint32_t PIOS_DELAY_DiffuS(uint32_t raw)
return diff / us_ticks;
}
#endif
#endif /* PIOS_INCLUDE_DELAY */
/**
* @}

View File

@ -28,11 +28,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#ifdef PIOS_INCLUDE_DSM
#include "pios_dsm_priv.h"
#if defined(PIOS_INCLUDE_DSM)
/* Forward Declarations */
static int32_t PIOS_DSM_Get(uint32_t rcvr_id, uint8_t channel);
@ -399,7 +400,7 @@ static void PIOS_DSM_Supervisor(uint32_t dsm_id)
}
}
#endif /* PIOS_INCLUDE_DSM */
#endif /* PIOS_INCLUDE_DSM */
/**
* @}

View File

@ -28,14 +28,13 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include <pios.h>
#include <pios_crc.h>
#ifdef PIOS_INCLUDE_FLASH_EEPROM
#include <stm32f10x_flash.h>
#include <pios_board_info.h>
#include <pios_eeprom.h>
static struct pios_eeprom_cfg config;
/**
@ -153,3 +152,5 @@ int32_t PIOS_EEPROM_Load(uint8_t *data, uint32_t len)
return 0;
}
#endif /* PIOS_INCLUDE_FLASH_EEPROM */

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_EXTI)
#ifdef PIOS_INCLUDE_EXTI
/* Map EXTI line to full config */
#define EXTI_MAX_LINES 16

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_GPIO)
#ifdef PIOS_INCLUDE_GPIO
/* Private Function Prototypes */
@ -93,7 +92,7 @@ void PIOS_GPIO_Toggle(uint8_t Pin)
GPIO_PORT[Pin]->ODR ^= GPIO_PIN[Pin];
}
#endif
#endif /* PIOS_INCLUDE_GPIO */
/**
* @}

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_I2C)
#ifdef PIOS_INCLUDE_I2C
#if defined(PIOS_INCLUDE_FREERTOS)
#define USE_FREERTOS
@ -1146,7 +1145,7 @@ void PIOS_I2C_ER_IRQ_Handler(uint32_t i2c_id)
}
}
#endif
#endif /* PIOS_INCLUDE_I2C */
/**
* @}

View File

@ -12,6 +12,8 @@
****************************************************************************************/
#include <pios.h>
#ifdef PIOS_INCLUDE_IAP
/****************************************************************************************
* Private Definitions/Macros
****************************************************************************************/
@ -120,3 +122,5 @@ void PIOS_IAP_WriteBootCount (uint16_t boot_count)
{
BKP_WriteBackupRegister ( IAP_BOOTCOUNT, boot_count );
}
#endif /* PIOS_INCLUDE_IAP */

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_IRQ)
#ifdef PIOS_INCLUDE_IRQ
/* Private Function Prototypes */
@ -90,7 +89,7 @@ int32_t PIOS_IRQ_Enable(void)
return 0;
}
#endif
#endif /* PIOS_INCLUDE_IRQ */
/**
* @}

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_LED)
#ifdef PIOS_INCLUDE_LED
#include <pios_led_priv.h>
@ -148,7 +147,7 @@ void PIOS_LED_Toggle(uint32_t led_id)
}
}
#endif
#endif /* PIOS_INCLUDE_LED */
/**
* @}

View File

@ -28,11 +28,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#ifdef PIOS_INCLUDE_PPM
#include "pios_ppm_priv.h"
#if defined(PIOS_INCLUDE_PPM)
/* Provide a RCVR driver */
static int32_t PIOS_PPM_Get(uint32_t rcvr_id, uint8_t channel);
@ -349,7 +350,7 @@ static void PIOS_PPM_Supervisor(uint32_t ppm_id) {
ppm_dev->Fresh = FALSE;
}
#endif
#endif /* PIOS_INCLUDE_PPM */
/**
* @}

View File

@ -28,11 +28,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#ifdef PIOS_INCLUDE_PWM
#include "pios_pwm_priv.h"
#if defined(PIOS_INCLUDE_PWM)
/* Provide a RCVR driver */
static int32_t PIOS_PWM_Get(uint32_t rcvr_id, uint8_t channel);
@ -274,7 +275,7 @@ static void PIOS_PWM_tim_edge_cb (uint32_t tim_id, uint32_t context, uint8_t cha
}
#endif
#endif /* PIOS_INCLUDE_PWM */
/**
* @}

View File

@ -28,10 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_RTC)
#ifdef PIOS_INCLUDE_RTC
#include <pios_rtc_priv.h>
#ifndef PIOS_RTC_PRESCALER
@ -121,7 +121,8 @@ void PIOS_RTC_irq_handler (void)
RTC_ClearITPendingBit(RTC_IT_SEC);
}
}
#endif
#endif /* PIOS_INCLUDE_RTC */
/**
* @}

View File

@ -28,8 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#ifdef PIOS_INCLUDE_SERVO
#include "pios_servo_priv.h"
#include "pios_tim_priv.h"
@ -145,3 +147,5 @@ void PIOS_Servo_Set(uint8_t servo, uint16_t position)
break;
}
}
#endif /* PIOS_INCLUDE_SERVO */

View File

@ -35,7 +35,7 @@
#include <pios.h>
#if defined(PIOS_INCLUDE_SPI)
#ifdef PIOS_INCLUDE_SPI
#include <pios_spi_priv.h>
@ -577,7 +577,7 @@ void PIOS_SPI_IRQ_Handler(uint32_t spi_id)
}
}
#endif
#endif /* PIOS_INCLUDE_SPI */
/**
* @}

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_SYS)
#ifdef PIOS_INCLUDE_SYS
/* Private Function Prototypes */
void NVIC_Configuration(void);
@ -212,7 +211,7 @@ void assert_failed(uint8_t * file, uint32_t line)
}
#endif
#endif
#endif /* PIOS_INCLUDE_SYS */
/**
* @}

View File

@ -1,6 +1,7 @@
#include "pios.h"
#include "pios_tim.h"
#ifdef PIOS_INCLUDE_TIM
#include "pios_tim_priv.h"
enum pios_tim_dev_magic {
@ -425,3 +426,4 @@ static void PIOS_TIM_8_CC_irq_handler (void)
PIOS_TIM_generic_irq_handler (TIM8);
}
#endif /* PIOS_INCLUDE_TIM */

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_USART)
#ifdef PIOS_INCLUDE_USART
#include <pios_usart_priv.h>
@ -324,7 +323,7 @@ static void PIOS_USART_generic_irq_handler(uint32_t usart_id)
#endif /* PIOS_INCLUDE_FREERTOS */
}
#endif
#endif /* PIOS_INCLUDE_USART */
/**
* @}

View File

@ -28,16 +28,17 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#ifdef PIOS_INCLUDE_USB
#include "usb_lib.h"
#include "pios_usb_board_data.h"
#include "stm32f10x.h"
#include "pios_usb.h"
#include "pios_usb_priv.h"
#if defined(PIOS_INCLUDE_USB_HID)
#ifdef PIOS_INCLUDE_USB_HID
/* Rx/Tx status */
static bool transfer_possible = false;
@ -66,7 +67,7 @@ static int32_t PIOS_USB_validate(struct pios_usb_dev * usb_dev)
return 0;
}
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
static struct pios_usb_dev * PIOS_USB_alloc(void)
{
struct pios_usb_dev * usb_dev;
@ -156,14 +157,14 @@ int32_t PIOS_USB_ChangeConnectionState(bool Connected)
//TODO: Check SetEPRxValid(ENDP1);
#if defined(USB_LED_ON)
#ifdef USB_LED_ON
USB_LED_ON; // turn the USB led on
#endif
} else {
// Cable disconnected: disable transfers
transfer_possible = false;
#if defined(USB_LED_OFF)
#ifdef USB_LED_OFF
USB_LED_OFF; // turn the USB led off
#endif
}
@ -233,7 +234,9 @@ bool PIOS_USB_CheckAvailable(uint32_t id)
return PIOS_USB_CableConnected(id) && transfer_possible;
}
#endif
#endif /* PIOS_INCLUDE_USB_HID */
#endif /* PIOS_INCLUDE_USB */
/**
* @}

View File

@ -29,12 +29,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_USB_CDC)
#ifdef PIOS_INCLUDE_USB_CDC
#include "pios_usb.h"
#include "pios_usb_cdc_priv.h"
#include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */
@ -417,4 +415,4 @@ static void PIOS_USB_CDC_CTRL_EP_IN_Callback(void)
SetEPTxValid(usb_cdc_dev->cfg->data_tx_ep);
}
#endif /* PIOS_INCLUDE_USB_CDC */
#endif /* PIOS_INCLUDE_USB_CDC */

View File

@ -29,12 +29,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_USB_HID)
#ifdef PIOS_INCLUDE_USB_HID
#include "pios_usb.h"
#include "pios_usb_hid_priv.h"
#include "pios_usb_board_data.h" /* PIOS_BOARD_*_DATA_LENGTH */
@ -81,7 +79,7 @@ static bool PIOS_USB_HID_validate(struct pios_usb_hid_dev * usb_hid_dev)
return (usb_hid_dev->magic == PIOS_USB_HID_DEV_MAGIC);
}
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
{
struct pios_usb_hid_dev * usb_hid_dev;
@ -193,7 +191,7 @@ static void PIOS_USB_HID_SendReport(struct pios_usb_hid_dev * usb_hid_dev)
SetEPTxCount(usb_hid_dev->cfg->data_tx_ep, sizeof(usb_hid_dev->tx_packet_buffer));
SetEPTxValid(usb_hid_dev->cfg->data_tx_ep);
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
if (need_yield) {
vPortYieldFromISR();
}
@ -354,7 +352,7 @@ static void PIOS_USB_HID_EP_OUT_Callback(void)
SetEPRxStatus(usb_hid_dev->cfg->data_rx_ep, EP_RX_NAK);
}
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
if (need_yield) {
vPortYieldFromISR();
}

View File

@ -14,8 +14,8 @@
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "usb_lib.h"
#include "pios.h"
#include "usb_lib.h"
#include "pios_usb_hid_pwr.h"
#include "pios_usb_hid_istr.h"
#include "pios_usb_hid.h"

View File

@ -28,12 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* Project Includes */
#include "pios.h"
#if defined(PIOS_INCLUDE_USB_RCTX)
#ifdef PIOS_INCLUDE_USB_RCTX
#include "pios_usb.h"
#include "pios_usb_rctx_priv.h"
/* STM32 USB Library Definitions */
@ -62,7 +60,7 @@ static bool PIOS_USB_RCTX_validate(struct pios_usb_rctx_dev * usb_rctx_dev)
return (usb_rctx_dev->magic == PIOS_USB_RCTX_DEV_MAGIC);
}
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
static struct pios_usb_rctx_dev * PIOS_USB_RCTX_alloc(void)
{
struct pios_usb_rctx_dev * usb_rctx_dev;
@ -126,7 +124,7 @@ out_fail:
static void PIOS_USB_RCTX_SendReport(struct pios_usb_rctx_dev * usb_rctx_dev)
{
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
bool need_yield = false;
#endif /* PIOS_INCLUDE_FREERTOS */
@ -139,7 +137,7 @@ static void PIOS_USB_RCTX_SendReport(struct pios_usb_rctx_dev * usb_rctx_dev)
SetEPTxCount(usb_rctx_dev->cfg->data_tx_ep, sizeof(usb_rctx_dev->report));
SetEPTxValid(usb_rctx_dev->cfg->data_tx_ep);
#if defined(PIOS_INCLUDE_FREERTOS)
#ifdef PIOS_INCLUDE_FREERTOS
if (need_yield) {
vPortYieldFromISR();
}
@ -208,4 +206,4 @@ void PIOS_USB_RCTX_Update(uint32_t usbrctx_id, const uint16_t channel[], const i
PIOS_USB_RCTX_SendReport(usb_rctx_dev);
}
#endif /* PIOS_INCLUDE_USB_RCTX */
#endif /* PIOS_INCLUDE_USB_RCTX */

View File

@ -33,6 +33,9 @@
*/
#include "pios.h"
#ifdef PIOS_INCLUDE_WDG
#include "stm32f10x_iwdg.h"
#include "stm32f10x_dbgmcu.h"
@ -173,3 +176,5 @@ void PIOS_WDG_Clear(void)
IWDG_ReloadCounter();
#endif
}
#endif /* PIOS_INCLUDE_WDG */