mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
Updated BMP085 test code.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@375 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
fde3c41890
commit
41fd921b14
@ -99,6 +99,7 @@ TIM8 | Servo 5 | Servo 6 | Servo 7 | Servo 8
|
||||
#define PIOS_BMP085_EOC_EXTI_LINE EXTI_Line15
|
||||
#define PIOS_BMP085_EOC_IRQn EXTI15_10_IRQn
|
||||
#define PIOS_BMP085_EOC_PRIO PIOS_IRQ_PRIO_HIGH
|
||||
#define PIOS_BMP085_OVERSAMPLING 2
|
||||
|
||||
//-------------------------
|
||||
// PIOS_USART1 (TELEM)
|
||||
|
@ -67,20 +67,23 @@ static void TaskTesting(void *pvParameters)
|
||||
|
||||
for(;;)
|
||||
{
|
||||
uint16_t temp;
|
||||
uint16_t pressure;
|
||||
PIOS_LED_Toggle(LED2);
|
||||
|
||||
int16_t temp;
|
||||
int32_t pressure;
|
||||
|
||||
PIOS_BMP085_StartADC(TemperatureConv);
|
||||
xSemaphoreTake(PIOS_BMP085_EOC, xTimeout);
|
||||
PIOS_BMP085_ReadADC();
|
||||
temp = PIOS_BMP085_GetTemperature();
|
||||
|
||||
PIOS_BMP085_StartADC(PressureConv);
|
||||
xSemaphoreTake(PIOS_BMP085_EOC, xTimeout);
|
||||
PIOS_BMP085_ReadADC();
|
||||
|
||||
temp = PIOS_BMP085_GetTemperature();
|
||||
pressure = PIOS_BMP085_GetPressure();
|
||||
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "temp=%3u pressure=%4u\r", temp, pressure);
|
||||
PIOS_COM_SendFormattedStringNonBlocking(COM_DEBUG_USART, "%3u,%4u\r", temp, pressure);
|
||||
|
||||
vTaskDelay(xDelay);
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ void PIOS_BMP085_Init(void)
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,11 +42,14 @@ void EXTI15_10_IRQHandler(void)
|
||||
{
|
||||
#if defined(PIOS_INCLUDE_BMP085)
|
||||
if(EXTI_GetITStatus(PIOS_BMP085_EOC_EXTI_LINE) != RESET) {
|
||||
/* Read the ADC Value */
|
||||
xSemaphoreGiveFromISR(PIOS_BMP085_EOC, &xHigherPriorityTaskWoken);
|
||||
|
||||
/* Clear the EXTI line pending bit */
|
||||
EXTI_ClearITPendingBit(PIOS_BMP085_EOC_EXTI_LINE);
|
||||
|
||||
/* Read the ADC Value */
|
||||
xSemaphoreGiveFromISR(PIOS_BMP085_EOC, &xHigherPriorityTaskWoken);
|
||||
/* Yield From ISR if needed */
|
||||
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
#define BMP085_CALIB_ADDR 0xAA
|
||||
#define BMP085_CALIB_LEN 22
|
||||
#define BMP085_CTRL_ADDR 0xF4
|
||||
#define BMP085_OVERSAMPLING 0
|
||||
#define BMP085_OVERSAMPLING PIOS_BMP085_OVERSAMPLING
|
||||
#define BMP085_PRES_ADDR (0x34 + (BMP085_OVERSAMPLING << 6))
|
||||
#define BMP085_TEMP_ADDR 0x2E
|
||||
#define BMP085_ADC_MSB 0xF6
|
||||
|
Loading…
x
Reference in New Issue
Block a user