mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-30 15:52:12 +01:00
PIOS_BMP085 now non-application specific.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@205 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
22f02cb460
commit
95d068884a
@ -31,21 +31,21 @@
|
|||||||
//------------------------
|
//------------------------
|
||||||
// DMA Channels Used
|
// DMA Channels Used
|
||||||
//------------------------
|
//------------------------
|
||||||
/* Channel 1 - */
|
/* Channel 1 - */
|
||||||
/* Channel 2 - SPI1 RX */
|
/* Channel 2 - SPI1 RX */
|
||||||
/* Channel 3 - SPI1 TX */
|
/* Channel 3 - SPI1 TX */
|
||||||
/* Channel 4 - SPI2 RX */
|
/* Channel 4 - SPI2 RX */
|
||||||
/* Channel 5 - SPI2 TX */
|
/* Channel 5 - SPI2 TX */
|
||||||
/* Channel 6 - */
|
/* Channel 6 - */
|
||||||
/* Channel 7 - */
|
/* Channel 7 - */
|
||||||
/* Channel 8 - */
|
/* Channel 8 - */
|
||||||
/* Channel 9 - */
|
/* Channel 9 - */
|
||||||
/* Channel 10 - */
|
/* Channel 10 - */
|
||||||
/* Channel 11 - */
|
/* Channel 11 - */
|
||||||
/* Channel 12 - */
|
/* Channel 12 - */
|
||||||
|
|
||||||
//------------------------
|
//------------------------
|
||||||
// Leds Definition
|
// PIOS_LED
|
||||||
//------------------------
|
//------------------------
|
||||||
#define PIOS_LED_LED1_GPIO_PORT GPIOC
|
#define PIOS_LED_LED1_GPIO_PORT GPIOC
|
||||||
#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_12
|
#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 }
|
#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_GPIO_PORT GPIOB
|
||||||
#define PIOS_I2C_SDA_PIN GPIO_Pin_11
|
#define PIOS_I2C_SDA_PIN GPIO_Pin_11
|
||||||
@ -71,15 +71,15 @@
|
|||||||
#define PIOS_I2C_IRQ_ER_PRIORITY 2
|
#define PIOS_I2C_IRQ_ER_PRIORITY 2
|
||||||
|
|
||||||
//------------------------
|
//------------------------
|
||||||
// Onboard Pressure sensor
|
// PIOS_BMP085
|
||||||
//------------------------
|
//------------------------
|
||||||
#define BMP085_EOC_GPIO_PORT GPIOC
|
#define PIOS_BMP085_EOC_GPIO_PORT GPIOC
|
||||||
#define BMP085_EOC_GPIO_PIN GPIO_Pin_15
|
#define PIOS_BMP085_EOC_GPIO_PIN GPIO_Pin_15
|
||||||
#define BMP085_EOC_PORT_SOURCE GPIO_PortSourceGPIOG
|
#define PIOS_BMP085_EOC_PORT_SOURCE GPIO_PortSourceGPIOG
|
||||||
#define BMP085_EOC_PIN_SOURCE GPIO_PinSource8
|
#define PIOS_BMP085_EOC_PIN_SOURCE GPIO_PinSource8
|
||||||
#define BMP085_EOC_CLK RCC_APB2Periph_GPIOC
|
#define PIOS_BMP085_EOC_CLK RCC_APB2Periph_GPIOC
|
||||||
#define BMP085_EOC_EXTI_LINE EXTI_Line15
|
#define PIOS_BMP085_EOC_EXTI_LINE EXTI_Line15
|
||||||
#define BMP085_EOC_IRQn EXTI15_10_IRQn
|
#define PIOS_BMP085_EOC_IRQn EXTI15_10_IRQn
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
// GPS USART
|
// GPS USART
|
||||||
|
@ -31,7 +31,7 @@ Example of how to use this module:
|
|||||||
PIOS_BMP085_StartADC(Temperature);
|
PIOS_BMP085_StartADC(Temperature);
|
||||||
(Interrupt reads the ADC)
|
(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);
|
PIOS_BMP085_StartADC(Pressure);
|
||||||
(Interrupt reads the ADC)
|
(Interrupt reads the ADC)
|
||||||
@ -65,23 +65,23 @@ void PIOS_BMP085_Init(void)
|
|||||||
NVIC_InitTypeDef NVIC_InitStructure;
|
NVIC_InitTypeDef NVIC_InitStructure;
|
||||||
|
|
||||||
/* Enable EOC GPIO clock */
|
/* 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 */
|
/* 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_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 */
|
/* Configure the End Of Conversion (EOC) interrupt */
|
||||||
GPIO_EXTILineConfig(BMP085_EOC_PORT_SOURCE, BMP085_EOC_PIN_SOURCE);
|
GPIO_EXTILineConfig(PIOS_BMP085_EOC_PORT_SOURCE, PIOS_BMP085_EOC_PIN_SOURCE);
|
||||||
EXTI_InitStructure.EXTI_Line = BMP085_EOC_EXTI_LINE;
|
EXTI_InitStructure.EXTI_Line = PIOS_BMP085_EOC_EXTI_LINE;
|
||||||
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
|
||||||
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
|
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
|
||||||
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
|
||||||
//EXTI_Init(&EXTI_InitStructure);
|
//EXTI_Init(&EXTI_InitStructure);
|
||||||
|
|
||||||
/* Enable and set EOC EXTI Interrupt to the lowest priority */
|
/* 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_IRQChannelPreemptionPriority = 15;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
|
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
|
||||||
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
|
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)
|
void EXTI15_10_IRQHandler(void)
|
||||||
{
|
{
|
||||||
if(EXTI_GetITStatus(BMP085_EOC_EXTI_LINE) != RESET) {
|
if(EXTI_GetITStatus(PIOS_BMP085_EOC_EXTI_LINE) != RESET) {
|
||||||
/* Disable interrupts */
|
/* Disable interrupts */
|
||||||
PIOS_IRQ_Disable();
|
PIOS_IRQ_Disable();
|
||||||
|
|
||||||
@ -289,7 +289,7 @@ void EXTI15_10_IRQHandler(void)
|
|||||||
PIOS_BMP085_ReadADC();
|
PIOS_BMP085_ReadADC();
|
||||||
|
|
||||||
/* Clear the EOC EXTI line pending bit */
|
/* Clear the EOC EXTI line pending bit */
|
||||||
EXTI_ClearITPendingBit(BMP085_EOC_EXTI_LINE);
|
EXTI_ClearITPendingBit(PIOS_BMP085_EOC_EXTI_LINE);
|
||||||
|
|
||||||
/* Enable interrupts */
|
/* Enable interrupts */
|
||||||
PIOS_IRQ_Enable();
|
PIOS_IRQ_Enable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user