From 95d068884ad479f03ffdd1b5f5f53dc5a6092c09 Mon Sep 17 00:00:00 2001 From: gussy Date: Sun, 28 Feb 2010 07:01:18 +0000 Subject: [PATCH] PIOS_BMP085 now non-application specific. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@205 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/OpenPilot/System/inc/pios_board.h | 36 ++++++++++++------------ flight/PiOS/Common/pios_bmp085.c | 20 ++++++------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/flight/OpenPilot/System/inc/pios_board.h b/flight/OpenPilot/System/inc/pios_board.h index 2fd2f1b03..2d5a80ece 100644 --- a/flight/OpenPilot/System/inc/pios_board.h +++ b/flight/OpenPilot/System/inc/pios_board.h @@ -31,21 +31,21 @@ //------------------------ // DMA Channels Used //------------------------ -/* Channel 1 - */ +/* Channel 1 - */ /* Channel 2 - SPI1 RX */ /* Channel 3 - SPI1 TX */ /* Channel 4 - SPI2 RX */ /* Channel 5 - SPI2 TX */ -/* Channel 6 - */ -/* Channel 7 - */ -/* Channel 8 - */ -/* Channel 9 - */ -/* Channel 10 - */ -/* Channel 11 - */ -/* Channel 12 - */ +/* Channel 6 - */ +/* Channel 7 - */ +/* Channel 8 - */ +/* Channel 9 - */ +/* Channel 10 - */ +/* Channel 11 - */ +/* Channel 12 - */ //------------------------ -// Leds Definition +// PIOS_LED //------------------------ #define PIOS_LED_LED1_GPIO_PORT GPIOC #define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_12 @@ -59,7 +59,7 @@ #define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK } //------------------------ -// I2C +// PIOS_I2C //------------------------ #define PIOS_I2C_GPIO_PORT GPIOB #define PIOS_I2C_SDA_PIN GPIO_Pin_11 @@ -71,15 +71,15 @@ #define PIOS_I2C_IRQ_ER_PRIORITY 2 //------------------------ -// Onboard Pressure sensor +// PIOS_BMP085 //------------------------ -#define BMP085_EOC_GPIO_PORT GPIOC -#define BMP085_EOC_GPIO_PIN GPIO_Pin_15 -#define BMP085_EOC_PORT_SOURCE GPIO_PortSourceGPIOG -#define BMP085_EOC_PIN_SOURCE GPIO_PinSource8 -#define BMP085_EOC_CLK RCC_APB2Periph_GPIOC -#define BMP085_EOC_EXTI_LINE EXTI_Line15 -#define BMP085_EOC_IRQn EXTI15_10_IRQn +#define PIOS_BMP085_EOC_GPIO_PORT GPIOC +#define PIOS_BMP085_EOC_GPIO_PIN GPIO_Pin_15 +#define PIOS_BMP085_EOC_PORT_SOURCE GPIO_PortSourceGPIOG +#define PIOS_BMP085_EOC_PIN_SOURCE GPIO_PinSource8 +#define PIOS_BMP085_EOC_CLK RCC_APB2Periph_GPIOC +#define PIOS_BMP085_EOC_EXTI_LINE EXTI_Line15 +#define PIOS_BMP085_EOC_IRQn EXTI15_10_IRQn //------------------------- // GPS USART diff --git a/flight/PiOS/Common/pios_bmp085.c b/flight/PiOS/Common/pios_bmp085.c index dbb3aabea..0951b7d0b 100644 --- a/flight/PiOS/Common/pios_bmp085.c +++ b/flight/PiOS/Common/pios_bmp085.c @@ -31,7 +31,7 @@ Example of how to use this module: PIOS_BMP085_StartADC(Temperature); (Interrupt reads the ADC) - Somwhere inbetween these 2 calls we need to wait for the first one to finish + Somewhere in between these 2 calls we need to wait for the first one to finish PIOS_BMP085_StartADC(Pressure); (Interrupt reads the ADC) @@ -65,23 +65,23 @@ void PIOS_BMP085_Init(void) NVIC_InitTypeDef NVIC_InitStructure; /* Enable EOC GPIO clock */ - RCC_APB2PeriphClockCmd(BMP085_EOC_CLK | RCC_APB2Periph_AFIO, ENABLE); + RCC_APB2PeriphClockCmd(PIOS_BMP085_EOC_CLK | RCC_APB2Periph_AFIO, ENABLE); /* Configure EOC pin as input floating */ - GPIO_InitStructure.GPIO_Pin = BMP085_EOC_GPIO_PIN; + GPIO_InitStructure.GPIO_Pin = PIOS_BMP085_EOC_GPIO_PIN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; - GPIO_Init(BMP085_EOC_GPIO_PORT, &GPIO_InitStructure); + GPIO_Init(PIOS_BMP085_EOC_GPIO_PORT, &GPIO_InitStructure); - /* Configure the End Of Conversion (EOC) interrup */ - GPIO_EXTILineConfig(BMP085_EOC_PORT_SOURCE, BMP085_EOC_PIN_SOURCE); - EXTI_InitStructure.EXTI_Line = BMP085_EOC_EXTI_LINE; + /* Configure the End Of Conversion (EOC) interrupt */ + GPIO_EXTILineConfig(PIOS_BMP085_EOC_PORT_SOURCE, PIOS_BMP085_EOC_PIN_SOURCE); + EXTI_InitStructure.EXTI_Line = PIOS_BMP085_EOC_EXTI_LINE; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; //EXTI_Init(&EXTI_InitStructure); /* Enable and set EOC EXTI Interrupt to the lowest priority */ - NVIC_InitStructure.NVIC_IRQChannel = BMP085_EOC_IRQn; + NVIC_InitStructure.NVIC_IRQChannel = PIOS_BMP085_EOC_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; @@ -281,7 +281,7 @@ int32_t PIOS_BMP085_Write(uint16_t address, uint8_t *buffer, uint8_t len) */ void EXTI15_10_IRQHandler(void) { - if(EXTI_GetITStatus(BMP085_EOC_EXTI_LINE) != RESET) { + if(EXTI_GetITStatus(PIOS_BMP085_EOC_EXTI_LINE) != RESET) { /* Disable interrupts */ PIOS_IRQ_Disable(); @@ -289,7 +289,7 @@ void EXTI15_10_IRQHandler(void) PIOS_BMP085_ReadADC(); /* Clear the EOC EXTI line pending bit */ - EXTI_ClearITPendingBit(BMP085_EOC_EXTI_LINE); + EXTI_ClearITPendingBit(PIOS_BMP085_EOC_EXTI_LINE); /* Enable interrupts */ PIOS_IRQ_Enable();