mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
207 lines
7.0 KiB
C
207 lines
7.0 KiB
C
|
|
||
|
/**
|
||
|
* Project: OpenPilot
|
||
|
*
|
||
|
* @author The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
|
||
|
*
|
||
|
* @see The GNU Public License (GPL)
|
||
|
*/
|
||
|
/*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 3 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful, but
|
||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||
|
* for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU General Public License along
|
||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||
|
*/
|
||
|
|
||
|
|
||
|
#ifndef PIOS_BOARD_H
|
||
|
#define PIOS_BOARD_H
|
||
|
|
||
|
//------------------------
|
||
|
// DMA Channels Used
|
||
|
//------------------------
|
||
|
/* Channel 1 - */
|
||
|
/* Channel 2 - SPI1 (SPI_SD_RX) */
|
||
|
/* Channel 3 - SPI1 (SPI_SD_TX) */
|
||
|
/* Channel 4 - */
|
||
|
/* Channel 5 - */
|
||
|
/* Channel 6 - */
|
||
|
/* Channel 7 - */
|
||
|
/* Channel 8 - */
|
||
|
/* Channel 9 - */
|
||
|
/* Channel 10 - */
|
||
|
/* Channel 11 - */
|
||
|
/* Channel 12 - */
|
||
|
|
||
|
//------------------------
|
||
|
// Leds Definition
|
||
|
//------------------------
|
||
|
#define LED1_GPIO_PORT GPIOC
|
||
|
#define LED1_GPIO_PIN GPIO_Pin_12
|
||
|
#define LED1_GPIO_CLK RCC_APB2Periph_GPIOC
|
||
|
#define LED2_GPIO_PORT GPIOC
|
||
|
#define LED2_GPIO_PIN GPIO_Pin_13
|
||
|
#define LED2_GPIO_CLK RCC_APB2Periph_GPIOC
|
||
|
#define NUM_LED 2
|
||
|
|
||
|
//------------------------
|
||
|
// I2C
|
||
|
//------------------------
|
||
|
#define I2C_GPIO_PORT GPIOB
|
||
|
#define I2C_SDA_PIN GPIO_Pin_11
|
||
|
#define I2C_SCL_PIN GPIO_Pin_10
|
||
|
|
||
|
//------------------------
|
||
|
// Onboard Pressure sensor
|
||
|
//------------------------
|
||
|
#define HP03D_XCLR_GPIO_PORT GPIOC
|
||
|
#define HP03D_XCLR_GPIO_PIN GPIO_Pin_15
|
||
|
#define HP03D_MCLK_GPIO_PORT GPIOA
|
||
|
#define HP03D_MCLK_GPIO_PIN GPIO_Pin_1
|
||
|
|
||
|
//-------------------------
|
||
|
// GPS UART
|
||
|
//-------------------------
|
||
|
#define GPS_UART USART2
|
||
|
#define GPS_BAUD 57600
|
||
|
#define GPS_GPIO_PORT GPIOA
|
||
|
#define GPS_RX_PIN GPIO_Pin_3
|
||
|
#define GPS_TX_PIN GPIO_Pin_2
|
||
|
#define GPS_REMAP_FUNC { }
|
||
|
#define GPS_IRQ_CHANNEL USART2_IRQn
|
||
|
#define GPS_IRQHANDLER_FUNC void USART2_IRQHandler(void)
|
||
|
#define GPS_CLK_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE)
|
||
|
#define GPS_NVIC_PRIO IRQ_PRIO_HIGHEST
|
||
|
|
||
|
//-------------------------
|
||
|
// Telemetry radio UART
|
||
|
//-------------------------
|
||
|
#define TELEM_UART USART3
|
||
|
#define TELEM_BAUD 115200
|
||
|
#define TELEM_GPIO_PORT GPIOC
|
||
|
#define TELEM_RX_PIN GPIO_Pin_11
|
||
|
#define TELEM_TX_PIN GPIO_Pin_10
|
||
|
#define TELEM_REMAP_FUNC { GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); }
|
||
|
#define TELEM_IRQ_CHANNEL USART3_IRQn
|
||
|
#define TELEM_IRQHANDLER_FUNC void USART3_IRQHandler(void)
|
||
|
#define TELEM_CLK_FUNC RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE)
|
||
|
#define TELEM_NVIC_PRIO IRQ_PRIO_HIGHEST
|
||
|
|
||
|
//-------------------------
|
||
|
// AUXSER USART (available instead of RX5/RX6)
|
||
|
//-------------------------
|
||
|
#define AUX_UART_BAUD 19200
|
||
|
#define AUX_UART_UART USART1
|
||
|
#define AUX_UART_GPIO_PORT GPIOA
|
||
|
#define AUX_UART_RX_PIN GPIO_Pin_10
|
||
|
#define AUX_UART_TX_PIN GPIO_Pin_9
|
||
|
#define GPS_REMAP_FUNC { }
|
||
|
#define AUX_UART_IRQ_CHANNEL USART1_IRQn
|
||
|
#define AUX_UART_IRQHANDLER_FUNC void USART1_IRQHandler(void)
|
||
|
#define AUX_UART_CLK_FUNC RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE)
|
||
|
#define AUX_UART_NVIC_PRIO IRQ_PRIO_HIGH
|
||
|
|
||
|
//-------------------------
|
||
|
// USART Serial Ports
|
||
|
//-------------------------
|
||
|
#define UART_NUM 3
|
||
|
#define UART_RX_BUFFER_SIZE 128
|
||
|
#define UART_TX_BUFFER_SIZE 128
|
||
|
|
||
|
//-------------------------
|
||
|
// Receiver PWM inputs
|
||
|
//-------------------------
|
||
|
#define RECEIVER1_GPIO_PORT GPIOB
|
||
|
#define RECEIVER1_PIN GPIO_Pin_2 // PB2
|
||
|
#define RECEIVER1_TIM_PORT TIM3
|
||
|
#define RECEIVER1_CH TIM_Channel_3 // TIM3_CH3
|
||
|
#define RECEIVER2_GPIO_PORT GPIOB
|
||
|
#define RECEIVER2_PIN GPIO_Pin_1 // PB1
|
||
|
#define RECEIVER2_TIM_PORT TIM3
|
||
|
#define RECEIVER2_CH TIM_Channel_4 // TIM3_CH4
|
||
|
#define RECEIVER3_GPIO_PORT GPIOA
|
||
|
#define RECEIVER3_PIN GPIO_Pin_8 // PA8
|
||
|
#define RECEIVER3_TIM_PORT TIM1
|
||
|
#define RECEIVER3_CH TIM_Channel_1 // TIM1_CH1
|
||
|
#define RECEIVER4_GPIO_PORT GPIOA
|
||
|
#define RECEIVER4_PIN GPIO_Pin_0 // PA0
|
||
|
#define RECEIVER4_TIM_PORT TIM5
|
||
|
#define RECEIVER4_CH TIM_Channel_1 // TIM5_CH1
|
||
|
#define RECEIVER5_GPIO_PORT GPIOA
|
||
|
#define RECEIVER5_PIN GPIO_Pin_10 // PA10
|
||
|
#define RECEIVER5_TIM_PORT TIM1
|
||
|
#define RECEIVER5_CH TIM_Channel_3 // TIM1_CH3
|
||
|
#define RECEIVER6_GPIO_PORT GPIOA
|
||
|
#define RECEIVER6_PIN GPIO_Pin_9 // PA9
|
||
|
#define RECEIVER6_TIM_PORT TIM1
|
||
|
#define RECEIVER6_CH TIM_Channel_2 // TIM1_CH2
|
||
|
|
||
|
/* Not used in v1.2 HW
|
||
|
#define RECEIVER7_GPIO_PORT GPIOB
|
||
|
#define RECEIVER7_PIN GPIO_Pin_4 // PB4
|
||
|
#define RECEIVER7_TIM_PORT TIM3
|
||
|
#define RECEIVER7_CH TIM_Channel_1 // TIM3_CH1
|
||
|
#define RECEIVER8_GPIO_PORT GPIOB
|
||
|
#define RECEIVER8_PIN GPIO_Pin_5 // PB5
|
||
|
#define RECEIVER8_TIM_PORT TIM3
|
||
|
#define RECEIVER8_CH TIM_Channel_2 // TIM3_CH2
|
||
|
*/
|
||
|
|
||
|
#define NUM_RECEIVER_INPUTS 6
|
||
|
|
||
|
//-------------------------
|
||
|
// Servo outputs
|
||
|
//-------------------------
|
||
|
#define SERVO1_4_PORT GPIOB
|
||
|
#define SERVO1_PIN GPIO_Pin_6
|
||
|
#define SERVO2_PIN GPIO_Pin_7
|
||
|
#define SERVO3_PIN GPIO_Pin_8
|
||
|
#define SERVO4_PIN GPIO_Pin_9
|
||
|
#define SERVO5_8_PORT GPIOC
|
||
|
#define SERVO5_PIN GPIO_Pin_6
|
||
|
#define SERVO6_PIN GPIO_Pin_7
|
||
|
#define SERVO7_PIN GPIO_Pin_8
|
||
|
#define SERVO8_PIN GPIO_Pin_9
|
||
|
|
||
|
#define NUM_SERVO_OUTPUTS 8
|
||
|
|
||
|
//-------------------------
|
||
|
// Leveler (analog inputs)
|
||
|
//-------------------------
|
||
|
#define LEVELER_GPIO_PORT GPIOC
|
||
|
#define LEVELER_Z_PIN GPIO_Pin_0 // ADC123_IN10
|
||
|
#define LEVELER_A_PIN GPIO_Pin_1 // ADC123_IN11
|
||
|
#define LEVELER_B_PIN GPIO_Pin_2 // ADC123_IN12
|
||
|
|
||
|
//-------------------------
|
||
|
// USB
|
||
|
//-------------------------
|
||
|
#define USB_ACC_GPIO_PORT GPIOC
|
||
|
#define USB_DETECT_PIN GPIO_Pin_4
|
||
|
#define USB_PULLUP_PIN GPIO_Pin_14
|
||
|
|
||
|
//-------------------------
|
||
|
// Master Clock
|
||
|
//-------------------------
|
||
|
#define MASTER_CLOCK 72000000
|
||
|
#define PERIPHERAL_CLOCK (MASTER_CLOCK/2)
|
||
|
|
||
|
//-------------------------
|
||
|
// USB
|
||
|
//-------------------------
|
||
|
#define IRQ_PRIO_LOW 12 // lower than RTOS
|
||
|
#define IRQ_PRIO_MID 8 // higher than RTOS
|
||
|
#define IRQ_PRIO_HIGH 5 // for like SPI, AIN, I2C etc...
|
||
|
#define IRQ_PRIO_HIGHEST 4 // for UART etc...
|
||
|
|
||
|
#endif /* PIOS_BOARD_H */
|