From 9bce59ef1a694d98be8badcb70864302a382f01e Mon Sep 17 00:00:00 2001 From: gussy Date: Sun, 28 Feb 2010 04:47:51 +0000 Subject: [PATCH] Small cleanup changes. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@200 ebee16cc-31ac-478f-84a7-5cbb03baadba --- flight/PiOS/Common/pios_bmp085.c | 6 +++--- flight/PiOS/STM32F10x/pios_servo.c | 5 ++++- flight/PiOS/inc/pios_bmp085.h | 2 +- flight/PiOS/pios.c | 4 ++++ 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/flight/PiOS/Common/pios_bmp085.c b/flight/PiOS/Common/pios_bmp085.c index b4e186413..ecb1e3edb 100644 --- a/flight/PiOS/Common/pios_bmp085.c +++ b/flight/PiOS/Common/pios_bmp085.c @@ -76,14 +76,14 @@ void PIOS_BMP085_Init(void) EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; - EXTI_Init(&EXTI_InitStructure); + //EXTI_Init(&EXTI_InitStructure); /* Enable and set EOC EXTI Interrupt to the lowest priority */ NVIC_InitStructure.NVIC_IRQChannel = BMP085_EOC_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 15; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; - NVIC_Init(&NVIC_InitStructure); + //NVIC_Init(&NVIC_InitStructure); /* Read all 22 bytes of calibration data in one transfer, this is a very optimised way of doing things */ uint8_t Data[22]; @@ -160,7 +160,7 @@ void PIOS_BMP085_GetValues(uint16_t *Pressure, uint16_t *Altitude, uint16_t *Tem int32_t X1, X2, X3, B3, B5, B6, P; uint32_t B4, B7; - /* Convert Temperatre */ + /* Convert Temperature */ X1 = (RawTemperature - CalibData.AC6) * CalibData.AC5 >> 15; X2 = ((int32_t) CalibData.MC << 11) / (X1 + CalibData.MD); B5 = X1 + X2; diff --git a/flight/PiOS/STM32F10x/pios_servo.c b/flight/PiOS/STM32F10x/pios_servo.c index 71a9f5a36..b949f9b69 100644 --- a/flight/PiOS/STM32F10x/pios_servo.c +++ b/flight/PiOS/STM32F10x/pios_servo.c @@ -61,7 +61,6 @@ void PIOS_Servo_Init(void) TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; TIM_TimeBaseStructInit(&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Prescaler = (MASTER_CLOCK / 1000000) - 1; - TIM_TimeBaseStructure.TIM_Period = (20000 - 1); TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; @@ -69,7 +68,9 @@ void PIOS_Servo_Init(void) TIM_OCInitTypeDef TIM_OCInitStructure; /* TIM4 */ + TIM_TimeBaseStructure.TIM_Period = (20000 - 1); TIM_TimeBaseInit(TIM4, &TIM_TimeBaseStructure); + TIM_OCStructInit(&TIM_OCInitStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; @@ -88,7 +89,9 @@ void PIOS_Servo_Init(void) TIM_Cmd(TIM4, ENABLE); /* TIM8 */ + TIM_TimeBaseStructure.TIM_Period = (20000 - 1); TIM_TimeBaseInit(TIM8, &TIM_TimeBaseStructure); + TIM_OCStructInit(&TIM_OCInitStructure); TIM_OCInitStructure.TIM_OCMode = TIM_OCMode_PWM1; TIM_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable; diff --git a/flight/PiOS/inc/pios_bmp085.h b/flight/PiOS/inc/pios_bmp085.h index 8fed7f2b8..424ae3996 100644 --- a/flight/PiOS/inc/pios_bmp085.h +++ b/flight/PiOS/inc/pios_bmp085.h @@ -36,7 +36,7 @@ #define BMP085_TEMP_ADDR 0x2E #define BMP085_ADC_MSB 0xF6 #define BMP085_ADC_LSB 0xF7 -#define BMP085_P0 101325 +#define BMP085_P0 101325 /* Local Types */ typedef struct { diff --git a/flight/PiOS/pios.c b/flight/PiOS/pios.c index c1340980e..ac04db156 100644 --- a/flight/PiOS/pios.c +++ b/flight/PiOS/pios.c @@ -100,8 +100,12 @@ int main() //PIOS_PWM_Init(); + PIOS_USB_Init(0); + PIOS_COM_ReceiveCallbackInit(CONSOLE_Parse); + //PIOS_BMP085_Init(); + /* Initialise OpenPilot application */ // OpenPilotInit();