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

bmp085: create semaphore prior to configuring irq

Since the EXTI and NVIC init routines automatically enable the IRQ when it
is configured, it is possible for the EOC interrupt to fire immediately
upon configuring the IRQ.

Since the handler for the EOC interrupt (EXTI15_10_IRQHandler) does a
xSemaphoreGiveFromISR, it is important to have the semaphore initialized
prior to enabling the interrupt.

Also, added missing include for altitude module.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@654 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
stac 2010-05-24 16:33:30 +00:00 committed by stac
parent cc6348934f
commit e892dcb033

View File

@ -39,7 +39,7 @@ xSemaphoreHandle PIOS_BMP085_EOC;
/* Local Variables */
static BMP085CalibDataTypeDef CalibData;
static portBASE_TYPE xHigherPriorityTaskWoken;
/* Straight from the datasheet */
static int32_t X1, X2, X3, B3, B5, B6, P;
static uint32_t B4, B7;
@ -58,6 +58,11 @@ void PIOS_BMP085_Init(void)
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Semaphore used by ISR to signal End-Of-Conversion */
vSemaphoreCreateBinary(PIOS_BMP085_EOC);
/* Must start off empty so that first transfer waits for EOC */
xSemaphoreTake(PIOS_BMP085_EOC, portMAX_DELAY);
/* Enable EOC GPIO clock */
RCC_APB2PeriphClockCmd(PIOS_BMP085_EOC_CLK | RCC_APB2Periph_AFIO, ENABLE);
@ -101,11 +106,6 @@ void PIOS_BMP085_Init(void)
CalibData.MB = (Data[16] << 8) | Data[17];
CalibData.MC = (Data[18] << 8) | Data[19];
CalibData.MD = (Data[20] << 8) | Data[21];
/* Semaphore used by ISR to signal End-Of-Conversion */
vSemaphoreCreateBinary(PIOS_BMP085_EOC);
/* Must start off empty so that first transfer waits for EOC */
xSemaphoreTake(PIOS_BMP085_EOC, portMAX_DELAY);
}