1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00
This commit is contained in:
Sambas 2012-02-28 20:32:44 +02:00
parent ebd2ae7e59
commit 8e31f84058
8 changed files with 53 additions and 299 deletions

View File

@ -84,6 +84,7 @@ OPUAVOBJINC = $(OPUAVOBJ)/inc
OPSYSINC = $(OPDIR)/System/inc
BOOT = ../Bootloaders/AHRS
BOOTINC = $(BOOT)/inc
HWDEFSINC = ../board_hw_defs/$(BOARD_NAME)
OPUAVSYNTHDIR = $(OUTDIR)/../uavobject-synthetics/flight
@ -243,6 +244,7 @@ EXTRAINCDIRS += $(RTOSSRCDIR)/portable/GCC/ARM_CM3
EXTRAINCDIRS += $(AHRSINC)
EXTRAINCDIRS += $(OPUAVSYNTHDIR)
EXTRAINCDIRS += $(BOOTINC)
EXTRAINCDIRS += $(HWDEFSINC)
EXTRAINCDIRS += ${foreach MOD, ${MODULES}, ${OPMODULEDIR}/${MOD}/inc} ${OPMODULEDIR}/System/inc

View File

@ -41,7 +41,7 @@
#define PIOS_INCLUDE_FREERTOS
#define PIOS_INCLUDE_BL_HELPER
#define PIOS_INCLUDE_GPIO
//#define PIOS_INCLUDE_GPIO
#define PIOS_INCLUDE_EXTI
#define PIOS_INCLUDE_USB
#define PIOS_INCLUDE_USB_HID

View File

@ -31,6 +31,9 @@
#include <manualcontrolsettings.h>
#include <gcsreceiver.h>
#include "board_hw_defs.c"
#define TxBufferSize3 33
@ -46,228 +49,6 @@ uint8_t RxBuffer3[TxBufferSize3];
/**
* PIOS_Board_Init()
* initializes all the core subsystems on this specific hardware
* called from System/openpilot.c
*/
#if defined(PIOS_INCLUDE_RTC)
/*
* Realtime Clock (RTC)
*/
#include <pios_rtc_priv.h>
void PIOS_RTC_IRQ_Handler (void);
void RTC_WKUP_IRQHandler() __attribute__ ((alias ("PIOS_RTC_IRQ_Handler")));
static const struct pios_rtc_cfg pios_rtc_main_cfg = {
.clksrc = RCC_RTCCLKSource_HSE_Div8, // Divide 8 Mhz crystal down to 1
// For some reason it's acting like crystal is 16 Mhz. This clock is then divided
// by another 16 to give a nominal 62.5 khz clock
.prescaler = 100, // Every 100 cycles gives 625 Hz
.irq = {
.init = {
.NVIC_IRQChannel = RTC_WKUP_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
};
void PIOS_RTC_IRQ_Handler (void)
{
PIOS_RTC_irq_handler ();
}
#endif
#if defined(PIOS_INCLUDE_LED)
#include <pios_led_priv.h>
static const struct pios_led pios_leds[] = {
[PIOS_LED_HEARTBEAT] = {
.pin = {
.gpio = GPIOD,
.init = {
.GPIO_Pin = GPIO_Pin_13,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
},
[PIOS_LED_ALARM] = {
.pin = {
.gpio = GPIOD,
.init = {
.GPIO_Pin = GPIO_Pin_12,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
},
};
static const struct pios_led_cfg pios_led_cfg = {
.leds = pios_leds,
.num_leds = NELEMENTS(pios_leds),
};
#endif /* PIOS_INCLUDE_LED */
#if defined(PIOS_INCLUDE_GPS)
#include <pios_usart_priv.h>
#include <pios_com_priv.h>
/*
* GPS USART
*/
static const struct pios_usart_cfg pios_usart_gps_cfg = {
.regs = USART1,
.remap = GPIO_AF_USART1,
.init = {
.USART_BaudRate = 38400,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl =
USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
#endif /* PIOS_INCLUDE_GPS */
#ifdef PIOS_INCLUDE_COM_AUX
/*
* AUX USART
*/
static const struct pios_usart_cfg pios_usart_aux_cfg = {
.regs = USART1,
.remap = GPIO_AF_USART1,
.init = {
.USART_BaudRate = 230400,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl =
USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART1_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_10,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = GPIOA,
.init = {
.GPIO_Pin = GPIO_Pin_9,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
#endif /* PIOS_COM_AUX */
#ifdef PIOS_INCLUDE_COM_TELEM
/*
* Telemetry on main USART
*/
static const struct pios_usart_cfg pios_usart_telem_main_cfg = {
.regs = USART6,
.remap = GPIO_AF_USART6,
.init = {
.USART_BaudRate = 57600,
.USART_WordLength = USART_WordLength_8b,
.USART_Parity = USART_Parity_No,
.USART_StopBits = USART_StopBits_1,
.USART_HardwareFlowControl =
USART_HardwareFlowControl_None,
.USART_Mode = USART_Mode_Rx | USART_Mode_Tx,
},
.irq = {
.init = {
.NVIC_IRQChannel = USART6_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_MID,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.rx = {
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_7,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
.tx = {
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_6,
.GPIO_Speed = GPIO_Speed_2MHz,
.GPIO_Mode = GPIO_Mode_AF,
.GPIO_OType = GPIO_OType_PP,
.GPIO_PuPd = GPIO_PuPd_UP
},
},
};
#endif /* PIOS_COM_TELEM */
#if defined(PIOS_INCLUDE_VIDEO)
@ -275,11 +56,11 @@ static const struct pios_usart_cfg pios_usart_telem_main_cfg = {
#include <pios_video.h>
static const struct pios_exti_cfg pios_exti_hsync_cfg __exti_config = {
.vector = PIOS_Hsync_ISR,
.line = EXTI_Line0,
.line = EXTI_Line2,
.pin = {
.gpio = GPIOD,
.init = {
.GPIO_Pin = GPIO_Pin_0,
.GPIO_Pin = GPIO_Pin_2,
.GPIO_Speed = GPIO_Speed_100MHz,
.GPIO_Mode = GPIO_Mode_IN,
.GPIO_OType = GPIO_OType_OD,
@ -288,7 +69,7 @@ static const struct pios_exti_cfg pios_exti_hsync_cfg __exti_config = {
},
.irq = {
.init = {
.NVIC_IRQChannel = EXTI0_IRQn,
.NVIC_IRQChannel = EXTI2_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
.NVIC_IRQChannelSubPriority = 0,
.NVIC_IRQChannelCmd = ENABLE,
@ -296,7 +77,7 @@ static const struct pios_exti_cfg pios_exti_hsync_cfg __exti_config = {
},
.exti = {
.init = {
.EXTI_Line = EXTI_Line0, // matches above GPIO pin
.EXTI_Line = EXTI_Line2, // matches above GPIO pin
.EXTI_Mode = EXTI_Mode_Interrupt,
.EXTI_Trigger = EXTI_Trigger_Rising_Falling,
.EXTI_LineCmd = ENABLE,
@ -866,65 +647,6 @@ void init_USART_dma()
}
#if defined(PIOS_INCLUDE_USB)
#include "pios_usb_priv.h"
static const struct pios_usb_cfg pios_usb_main_cfg = {
.irq = {
.init = {
.NVIC_IRQChannel = OTG_FS_IRQn,
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_LOW,
.NVIC_IRQChannelSubPriority = 3,
.NVIC_IRQChannelCmd = ENABLE,
},
},
.vsense = {
.gpio = GPIOD,
.init = {
.GPIO_Pin = GPIO_Pin_11,
.GPIO_Speed = GPIO_Speed_25MHz,
.GPIO_Mode = GPIO_Mode_IN,
.GPIO_OType = GPIO_OType_OD,
},
}
};
#include "pios_usb_board_data_priv.h"
#include "pios_usb_desc_hid_cdc_priv.h"
#include "pios_usb_desc_hid_only_priv.h"
#include "pios_usbhook.h"
#endif /* PIOS_INCLUDE_USB */
#if defined(PIOS_INCLUDE_COM_MSG)
#include <pios_com_msg_priv.h>
#endif /* PIOS_INCLUDE_COM_MSG */
#if defined(PIOS_INCLUDE_USB_HID)
#include <pios_usb_hid_priv.h>
const struct pios_usb_hid_cfg pios_usb_hid_cfg = {
.data_if = 0,
.data_rx_ep = 1,
.data_tx_ep = 1,
};
#endif /* PIOS_INCLUDE_USB_HID */
#if defined(PIOS_INCLUDE_USB_CDC)
#include <pios_usb_cdc_priv.h>
const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
.ctrl_if = 1,
.ctrl_tx_ep = 2,
.data_if = 2,
.data_rx_ep = 3,
.data_tx_ep = 3,
};
#endif /* PIOS_INCLUDE_USB_CDC */
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 512
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 512

View File

@ -134,6 +134,7 @@ TIM4 | STOPWATCH |
#define PIOS_LED_HEARTBEAT 0
#define PIOS_LED_ALARM 1
#if 0
#define PIOS_LED_LED1_GPIO_PORT GPIOD
#define PIOS_LED_LED1_GPIO_PIN GPIO_Pin_13 //LD3
#define PIOS_LED_LED1_GPIO_CLK RCC_APB2Periph_GPIOD
@ -150,7 +151,7 @@ TIM4 | STOPWATCH |
#define PIOS_LED_PORTS { PIOS_LED_LED1_GPIO_PORT, PIOS_LED_LED2_GPIO_PORT, PIOS_LED_LED3_GPIO_PORT, PIOS_LED_LED4_GPIO_PORT }
#define PIOS_LED_PINS { PIOS_LED_LED1_GPIO_PIN, PIOS_LED_LED2_GPIO_PIN, PIOS_LED_LED3_GPIO_PIN, PIOS_LED_LED4_GPIO_PIN }
#define PIOS_LED_CLKS { PIOS_LED_LED1_GPIO_CLK, PIOS_LED_LED2_GPIO_CLK, PIOS_LED_LED3_GPIO_CLK, PIOS_LED_LED4_GPIO_CLK }
#endif
/*#define USB_LED_ON PIOS_LED_On(LED1)
#define USB_LED_OFF PIOS_LED_Off(LED1)
@ -251,6 +252,7 @@ extern uint32_t pios_com_telem_usb_id;
{GPIOC, GPIO_Pin_1, ADC_Channel_11}, \
{GPIOC, GPIO_Pin_2, ADC_Channel_12}, \
{GPIOC, GPIO_Pin_3, ADC_Channel_13}, \
{GPIOA, GPIO_Pin_7, ADC_Channel_7}, \
{NULL, 0, ADC_Channel_Vrefint}, /* Voltage reference */\
{NULL, 0, ADC_Channel_TempSensor} /* Temperature sensor */\
}
@ -258,10 +260,12 @@ extern uint32_t pios_com_telem_usb_id;
/* we have to do all this to satisfy the PIOS_ADC_MAX_SAMPLES define in pios_adc.h */
/* which is annoying because this then determines the rate at which we generate buffer turnover events */
/* the objective here is to get enough buffer space to support 100Hz averaging rate */
#define PIOS_ADC_NUM_CHANNELS 6
#define PIOS_ADC_NUM_CHANNELS 7
#define PIOS_ADC_MAX_OVERSAMPLING 10
#define PIOS_ADC_USE_ADC2 0
#if 0
// *****************************************************************
// GPIO output pins
@ -410,6 +414,8 @@ extern uint32_t pios_com_telem_usb_id;
#define RF_INT_PIN 5
#define RF_MISC_PIN 6
#endif
// *****************************************************************
// USB
@ -424,6 +430,7 @@ extern uint32_t pios_com_telem_usb_id;
#endif
#if 0
// *****************************************************************
// VIDEO
#define PIOS_VIDEO_HSYNC_GPIO_PORT GPIOD
@ -448,7 +455,7 @@ extern uint32_t pios_com_telem_usb_id;
#define PIOS_VIDEO_VSYNC_EXTI_PIN_SOURCE EXTI_PinSource11
#define PIOS_VIDEO_VSYNC_IRQn EXTI15_10_IRQn
#define PIOS_VIDEO_VSYNC_PRIO PIOS_IRQ_PRIO_HIGHEST
#endif
// *****************************************************************
//--------------------------

View File

@ -94,8 +94,8 @@ void PIOS_Hsync_ISR() {
asm("nop");
}*/
//PIOS_DELAY_WaituS(5); // wait 5us to see if H or V sync
//if(dev_cfg->hsync_io.gpio->IDR & dev_cfg->hsync_io.init.GPIO_Pin) {
if(PIOS_VIDEO_HSYNC_GPIO_PORT->IDR & PIOS_VIDEO_HSYNC_GPIO_PIN) {
if(dev_cfg->hsync->pin.gpio->IDR & dev_cfg->hsync->pin.init.GPIO_Pin) {
//if(PIOS_VIDEO_HSYNC_GPIO_PORT->IDR & PIOS_VIDEO_HSYNC_GPIO_PIN) {
//rising
//if (gActiveLine != 0) {
//PIOS_LED_On(LED2);

View File

@ -34,9 +34,9 @@
static const struct pios_led pios_leds[] = {
[PIOS_LED_HEARTBEAT] = {
.pin = {
.gpio = GPIOD,
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_13,
.GPIO_Pin = GPIO_Pin_5,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,
@ -46,9 +46,9 @@ static const struct pios_led pios_leds[] = {
},
[PIOS_LED_ALARM] = {
.pin = {
.gpio = GPIOD,
.gpio = GPIOC,
.init = {
.GPIO_Pin = GPIO_Pin_12,
.GPIO_Pin = GPIO_Pin_4,
.GPIO_Speed = GPIO_Speed_50MHz,
.GPIO_Mode = GPIO_Mode_OUT,
.GPIO_OType = GPIO_OType_PP,

View File

@ -4,7 +4,8 @@ BOOTLOADER_VERSION := 0x01
HW_TYPE := 0x00
MCU := cortex-m4
CHIP := STM32F407VGT6
#CHIP := STM32F407VGT6
CHIP := STM32F405RGT6
BOARD := STM32F4xx_OSD
MODEL := HD
MODEL_SUFFIX :=
@ -12,9 +13,9 @@ MODEL_SUFFIX :=
OPENOCD_CONFIG := stm32f4xx.cfg
# Note: These must match the values in link_$(BOARD)_memory.ld
BL_BANK_BASE := 0x08000000 # Start of bootloader flash
BL_BANK_SIZE := 0x00008000 # Should include BD_INFO region
FW_BANK_BASE := 0x08008000 # Start of firmware flash
#BL_BANK_BASE := 0x08000000 # Start of bootloader flash
#BL_BANK_SIZE := 0x00008000 # Should include BD_INFO region
FW_BANK_BASE := 0x08000000 # Start of firmware flash
FW_BANK_SIZE := 0x000F8000 # Should include FW_DESC_SIZE
FW_DESC_SIZE := 0x00000064

View File

@ -0,0 +1,22 @@
<xml>
<object name="OsdSettings" singleinstance="true" settings="true">
<description>OSD settings used by the OSDgen module</description>
<field name="Attitude" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="AttitudeSetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="168,135"/>
<field name="Time" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="TimeSetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="10,250"/>
<field name="Battery" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="BatterySetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="316,210"/>
<field name="Speed" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="SpeedSetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="2,145"/>
<field name="Altitude" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="AltitudeSetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="2,145"/>
<field name="Heading" units="" type="enum" elements="1" options="Disabled,Enabled" defaultvalue="Enabled"/>
<field name="HeadingSetup" units="" type="int16" elements="2" elementnames="X,Y" defaultvalue="168,250"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>