1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

pios: common PIOS #ifdef guards

Conflicts:
	flight/PiOS/Common/pios_com.c
	flight/PiOS/Common/pios_mpu6000.c
This commit is contained in:
Oleg Semyonov 2013-03-15 16:28:53 +02:00
parent e96f717b94
commit 285cad290b
27 changed files with 86 additions and 71 deletions

View File

@ -30,6 +30,8 @@
#include "pios.h" #include "pios.h"
#ifdef PIOS_INCLUDE_ADXL345
enum pios_adxl345_dev_magic { enum pios_adxl345_dev_magic {
PIOS_ADXL345_DEV_MAGIC = 0xcb55aa55, PIOS_ADXL345_DEV_MAGIC = 0xcb55aa55,
}; };
@ -306,3 +308,5 @@ uint8_t PIOS_ADXL345_Read(struct pios_adxl345_data * data)
return rec[8] & 0x7F; // return number of remaining entries return rec[8] & 0x7F; // return number of remaining entries
} }
#endif /* PIOS_INCLUDE_ADXL345 */

View File

@ -31,7 +31,7 @@
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_BMA180) #ifdef PIOS_INCLUDE_BMA180
#include "fifo_buffer.h" #include "fifo_buffer.h"
@ -475,6 +475,7 @@ bool PIOS_BMA180_IRQHandler(void)
} }
#endif /* PIOS_INCLUDE_BMA180 */ #endif /* PIOS_INCLUDE_BMA180 */
/** /**
* @} * @}
* @} * @}

View File

@ -28,15 +28,13 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_BMP085) #ifdef PIOS_INCLUDE_BMP085
#if !defined(PIOS_INCLUDE_EXTI)
#error PIOS_EXTI Must be included in the project!
#endif /* PIOS_INCLUDE_EXTI */
#include <pios_exti.h> #ifndef PIOS_INCLUDE_EXTI
#error PIOS_EXTI must be included in the project
#endif /* PIOS_INCLUDE_EXTI */
/* Glocal Variables */ /* Glocal Variables */
ConversionTypeTypeDef CurrentRead; ConversionTypeTypeDef CurrentRead;

View File

@ -1,6 +1,5 @@
#include <pios.h> #include <pios.h>
#include <pios_board.h> #include <pios_board.h>
#include "pios_board_info.h" #include "pios_board_info.h"
const struct pios_board_info __attribute__((__used__)) __attribute__((__section__(".boardinfo"))) pios_board_info_blob = { const struct pios_board_info __attribute__((__used__)) __attribute__((__section__(".boardinfo"))) pios_board_info_blob = {

View File

@ -28,15 +28,14 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_COM) #ifdef PIOS_INCLUDE_COM
#include "fifo_buffer.h" #include "fifo_buffer.h"
#include <pios_com_priv.h> #include <pios_com_priv.h>
#if !defined(PIOS_INCLUDE_FREERTOS) #ifndef PIOS_INCLUDE_FREERTOS
#include "pios_delay.h" /* PIOS_DELAY_WaitmS */ #include "pios_delay.h" /* PIOS_DELAY_WaitmS */
#endif #endif
@ -524,7 +523,7 @@ bool PIOS_COM_Available(uint32_t com_id)
return (com_dev->driver->available)(com_dev->lower_id); return (com_dev->driver->available)(com_dev->lower_id);
} }
#endif #endif /* PIOS_INCLUDE_COM */
/** /**
* @} * @}

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_COM_MSG) #ifdef PIOS_INCLUDE_COM_MSG
#include "pios_com.h" #include "pios_com.h"

View File

@ -28,12 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_ETASV3) #ifdef PIOS_INCLUDE_ETASV3
#include "pios_etasv3.h"
static bool PIOS_ETASV3_Read(uint8_t * buffer, uint8_t len) static bool PIOS_ETASV3_Read(uint8_t * buffer, uint8_t len)
{ {

View File

@ -28,7 +28,11 @@
* with this program; if not, write to the Free Software Foundation, Inc., * with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "pios.h" #include "pios.h"
#ifdef PIOS_INCLUDE_FLASH
#include "pios_flash_jedec_priv.h" #include "pios_flash_jedec_priv.h"
#define JEDEC_WRITE_ENABLE 0x06 #define JEDEC_WRITE_ENABLE 0x06
@ -562,3 +566,4 @@ const struct pios_flash_driver pios_jedec_flash_driver = {
.read_data = PIOS_Flash_Jedec_ReadData, .read_data = PIOS_Flash_Jedec_ReadData,
}; };
#endif /* PIOS_INCLUDE_FLASH */

View File

@ -24,6 +24,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "pios.h"
#ifdef PIOS_INCLUDE_FLASH
#include "openpilot.h" #include "openpilot.h"
#include "pios_flashfs_logfs_priv.h" #include "pios_flashfs_logfs_priv.h"
@ -1020,6 +1025,8 @@ out_exit:
return rc; return rc;
} }
#endif /* PIOS_INCLUDE_FLASH */
/** /**
* @} * @}
* @} * @}

View File

@ -28,12 +28,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#include "uavobjectmanager.h" #ifdef PIOS_INCLUDE_GCSRCVR
#if defined(PIOS_INCLUDE_GCSRCVR) #include "uavobjectmanager.h"
#include "pios_gcsrcvr_priv.h" #include "pios_gcsrcvr_priv.h"

View File

@ -28,12 +28,12 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_HCSR04) #ifdef PIOS_INCLUDE_HCSR04
#if !(defined(PIOS_INCLUDE_DSM) || defined(PIOS_INCLUDE_SBUS)) #if !(defined(PIOS_INCLUDE_DSM) || defined(PIOS_INCLUDE_SBUS))
#error Only supported with Spektrum/JR DSM or S.Bus interface! #error Only supported with Spektrum/JR DSM or S.Bus interface
#endif #endif
/* Local Variables */ /* Local Variables */
@ -206,5 +206,5 @@ void TIM3_IRQHandler(void)
} }
} }
#endif /* PIOS_INCLUDE_HCSR04 */
#endif

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_HMC5843) #ifdef PIOS_INCLUDE_HMC5843
#include <pios_exti.h> #include <pios_exti.h>
@ -376,7 +375,7 @@ static bool PIOS_HMC5843_Write(uint8_t address, uint8_t buffer)
return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list)); return PIOS_I2C_Transfer(PIOS_I2C_MAIN_ADAPTER, txn_list, NELEMENTS(txn_list));
} }
#endif #endif /* PIOS_INCLUDE_HMC5843 */
/** /**
* @} * @}

View File

@ -28,10 +28,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_HMC5883) #ifdef PIOS_INCLUDE_HMC5883
/* Global Variables */ /* Global Variables */

View File

@ -29,12 +29,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_I2C_ESC) #ifdef PIOS_INCLUDE_I2C_ESC
/* HMC5843 Addresses */ /* Known i2c ESC addresses */
#define MK_I2C_ADDR 0x29 #define MK_I2C_ADDR 0x29
#define ASTEC4_I2C_ADDR 0x02 #define ASTEC4_I2C_ADDR 0x02
@ -164,7 +163,7 @@ bool PIOS_SetAstec4Speed(uint8_t motornum, uint8_t speed) {
return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list)); return PIOS_I2C_Transfer(PIOS_I2C_ESC_ADAPTER, txn_list, NELEMENTS(txn_list));
} }
#endif #endif /* PIOS_INCLUDE_I2C_ESC */
/** /**
* @} * @}

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_L3GD20) #ifdef PIOS_INCLUDE_L3GD20
#include "fifo_buffer.h" #include "fifo_buffer.h"
@ -381,7 +380,7 @@ bool PIOS_L3GD20_IRQHandler(void)
return xHigherPriorityTaskWoken == pdTRUE; return xHigherPriorityTaskWoken == pdTRUE;
} }
#endif /* L3GD20 */ #endif /* PIOS_INCLUDE_L3GD20 */
/** /**
* @} * @}

View File

@ -29,9 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_MPU6000)
#ifdef PIOS_INCLUDE_MPU6000
#include "fifo_buffer.h" #include "fifo_buffer.h"
@ -551,7 +551,7 @@ bool PIOS_MPU6000_IRQHandler(void)
return xHigherPriorityTaskWoken == pdTRUE; return xHigherPriorityTaskWoken == pdTRUE;
} }
#endif #endif /* PIOS_INCLUDE_MPU6000 */
/** /**
* @} * @}

View File

@ -30,10 +30,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_MPXV) #ifdef PIOS_INCLUDE_MPXV
#define A0 340.27f //speed of sound at standard sea level in [m/s] #define A0 340.27f //speed of sound at standard sea level in [m/s]
#define P0 101.325f //static air pressure at standard sea level in kPa #define P0 101.325f //static air pressure at standard sea level in kPa

View File

@ -28,13 +28,14 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */ #include "pios.h"
#ifdef PIOS_INCLUDE_MS5611
// TODO: Clean this up. Getting around old constant. // TODO: Clean this up. Getting around old constant.
#define PIOS_MS5611_OVERSAMPLING oversampling #define PIOS_MS5611_OVERSAMPLING oversampling
#include "pios.h"
#if defined(PIOS_INCLUDE_MS5611)
/* Glocal Variables */ /* Glocal Variables */
ConversionTypeTypeDef CurrentRead; ConversionTypeTypeDef CurrentRead;
@ -261,7 +262,7 @@ int32_t PIOS_MS5611_Test()
return 0; return 0;
} }
#endif #endif /* PIOS_INCLUDE_MS5611 */
/** /**
* @} * @}

View File

@ -1,7 +1,6 @@
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_RCVR) #ifdef PIOS_INCLUDE_RCVR
#include <pios_rcvr_priv.h> #include <pios_rcvr_priv.h>
@ -108,7 +107,7 @@ int32_t PIOS_RCVR_Read(uint32_t rcvr_id, uint8_t channel)
return rcvr_dev->driver->read(rcvr_dev->lower_id, channel); return rcvr_dev->driver->read(rcvr_dev->lower_id, channel);
} }
#endif #endif /* PIOS_INCLUDE_RCVR */
/** /**
* @} * @}

View File

@ -46,10 +46,9 @@
// //
// ***************************************************************** // *****************************************************************
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_RFM22B) #ifdef PIOS_INCLUDE_RFM22B
#include <pios_spi_priv.h> #include <pios_spi_priv.h>
#include <packet_handler.h> #include <packet_handler.h>
@ -2455,7 +2454,7 @@ static enum pios_rfm22b_event rfm22_fatal_error(struct pios_rfm22b_dev *rfm22b_d
// ************************************ // ************************************
#endif #endif /* PIOS_INCLUDE_RFM22B */
/** /**
* @} * @}

View File

@ -28,11 +28,11 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#include "pios_sbus_priv.h"
#if defined(PIOS_INCLUDE_SBUS) #ifdef PIOS_INCLUDE_SBUS
#include "pios_sbus_priv.h"
/* Forward Declarations */ /* Forward Declarations */
static int32_t PIOS_SBus_Get(uint32_t rcvr_id, uint8_t channel); static int32_t PIOS_SBus_Get(uint32_t rcvr_id, uint8_t channel);

View File

@ -29,10 +29,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* Project Includes */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_SDCARD) #ifdef PIOS_INCLUDE_SDCARD
/* Global Variables */ /* Global Variables */
VOLINFO PIOS_SDCARD_VolInfo; VOLINFO PIOS_SDCARD_VolInfo;
@ -1000,7 +999,7 @@ int32_t PIOS_SDCARD_FileDelete(char *Filename)
return 0; return 0;
} }
#endif #endif /* PIOS_INCLUDE_SDCARD */
/** /**
* @} * @}

View File

@ -28,6 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "pios.h"
#ifdef PIOS_INCLUDE_USB
#include "pios_usb_desc_hid_cdc_priv.h" /* exported API */ #include "pios_usb_desc_hid_cdc_priv.h" /* exported API */
#include "pios_usb_defs.h" /* struct usb_*, USB_* */ #include "pios_usb_defs.h" /* struct usb_*, USB_* */
#include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */ #include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */
@ -324,3 +328,5 @@ int32_t PIOS_USB_DESC_HID_CDC_Init(void)
return 0; return 0;
} }
#endif /* PIOS_INCLUDE_USB */

View File

@ -28,6 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "pios.h"
#ifdef PIOS_INCLUDE_USB
#include "pios_usb_desc_hid_only_priv.h" /* exported API */ #include "pios_usb_desc_hid_only_priv.h" /* exported API */
#include "pios_usb_defs.h" /* struct usb_*, USB_* */ #include "pios_usb_defs.h" /* struct usb_*, USB_* */
#include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */ #include "pios_usb_board_data.h" /* PIOS_USB_BOARD_* */
@ -163,3 +167,5 @@ int32_t PIOS_USB_DESC_HID_ONLY_Init(void)
return 0; return 0;
} }
#endif /* PIOS_INCLUDE_USB */

View File

@ -28,6 +28,10 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include "pios.h"
#ifdef PIOS_INCLUDE_USB
#include "pios_usb_util.h" #include "pios_usb_util.h"
uint8_t * PIOS_USB_UTIL_AsciiToUtf8(uint8_t * dst, uint8_t * src, uint16_t srclen) uint8_t * PIOS_USB_UTIL_AsciiToUtf8(uint8_t * dst, uint8_t * src, uint16_t srclen)
@ -40,3 +44,5 @@ uint8_t * PIOS_USB_UTIL_AsciiToUtf8(uint8_t * dst, uint8_t * src, uint16_t srcle
return dst; return dst;
} }
#endif /* PIOS_INCLUDE_USB */

View File

@ -30,7 +30,8 @@
*/ */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_VIDEO)
#ifdef PIOS_INCLUDE_VIDEO
extern xSemaphoreHandle osdSemaphore; extern xSemaphoreHandle osdSemaphore;
@ -277,7 +278,4 @@ void PIOS_VIDEO_DMA_Handler(void)
} }
#endif /* PIOS_INCLUDE_VIDEO */
#endif

View File

@ -30,7 +30,8 @@
*/ */
#include "pios.h" #include "pios.h"
#if defined(PIOS_INCLUDE_WAVE)
#ifdef PIOS_INCLUDE_WAVE
static const struct pios_dac_cfg * dev_cfg; static const struct pios_dac_cfg * dev_cfg;
@ -606,7 +607,4 @@ void DAC_DMA_Handler(void)
} }
} }
#endif /* PIOS_INCLUDE_WAVE */
#endif