mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@15 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
9b77b473c4
commit
5efc81f6c9
@ -28,7 +28,7 @@
|
||||
#ifndef PIOS_IRQ_H
|
||||
#define PIOS_IRQ_H
|
||||
|
||||
/* Function Prototypes */
|
||||
/* Public Functions */
|
||||
extern void UARTInit(void);
|
||||
extern void EnableAuxUART(void);
|
||||
extern void DisableAuxUART(void);
|
||||
|
@ -31,7 +31,7 @@
|
||||
/* Type Definitions */
|
||||
typedef enum {LED1 = 0, LED2 = 1} LedTypeDef;
|
||||
|
||||
/* Exported Functions */
|
||||
/* Public Functions */
|
||||
extern void LED_INIT(void);
|
||||
extern void LED_ON(LedTypeDef LEDNum);
|
||||
extern void LED_OFF(LedTypeDef LEDNum);
|
||||
|
@ -25,15 +25,35 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* Project Includes */
|
||||
#include "pios.h"
|
||||
|
||||
|
||||
/* Public Function Prototypes */
|
||||
void LoadSettings(void);
|
||||
|
||||
|
||||
/* Private Function Prototypes */
|
||||
|
||||
|
||||
/* Local Variables */
|
||||
SettingsTypeDef Settings;
|
||||
|
||||
/* Loads Settings from INI file */
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : LoadSettings
|
||||
* Description : Populate System global Vars into Structs using MinIni,
|
||||
* : defaults are also set here. Only function in the file
|
||||
* : and where all our system data is handled.
|
||||
* : Called from the end of SysInit()
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
/* Value Reading: ini_getl("Section", "Key", (DefaultValue), IniFile); */
|
||||
/* String Reading: ini_gets("Section", "Key", "DefaultValue", StrBuffer, sizearray(StrBuffer), IniFile); */
|
||||
|
||||
void LoadSettings(void)
|
||||
{
|
||||
char StrBuffer[100];
|
||||
|
@ -57,10 +57,10 @@ typedef struct {
|
||||
UARTSettingsTypeDef AuxUART;
|
||||
} SettingsTypeDef;
|
||||
|
||||
/*Global Veriables */
|
||||
/*Global Variables */
|
||||
extern SettingsTypeDef Settings;
|
||||
|
||||
/* Function Prototypes */
|
||||
/* Public Functions */
|
||||
extern void LoadSettings(void);
|
||||
|
||||
#endif /* PIOS_SETTINGS_H */
|
@ -25,12 +25,31 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* Project Includes */
|
||||
#include "pios.h"
|
||||
|
||||
|
||||
/* Public Function Prototypes */
|
||||
void SysInit(void);
|
||||
|
||||
|
||||
/* Private Function Prototypes */
|
||||
void NVIC_Configuration(void);
|
||||
|
||||
|
||||
/* Local Variables */
|
||||
FATFS Fatfs[_DRIVES]; // File system object for each logical drive */
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : SysInit
|
||||
* Description : Brings up the System and Initializes peripherals
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
//TODO: Get these in the right order, settings need to be loaded ASAP
|
||||
void SysInit(void)
|
||||
{
|
||||
/* Setup STM32 system (RCC, clock, PLL and Flash configuration) - CMSIS Function */
|
||||
@ -51,13 +70,15 @@ void SysInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* Call LoadSettings which populates System Vars */
|
||||
LoadSettings();
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : GPIO_Configuration
|
||||
* Description : Configures the different GPIO ports.
|
||||
* Description : Configures base level GPIO ports.
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
@ -67,9 +88,10 @@ void GPIO_Configuration(void)
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : NVIC_Configuration
|
||||
* Description : Configures Vector Table base location.
|
||||
* Description : Configures Vector Table base location and SysTick
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
@ -78,6 +100,8 @@ void NVIC_Configuration(void)
|
||||
{
|
||||
/* Set the Vector Table base address as specified in .ld file */
|
||||
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
|
||||
|
||||
/* 4 bits for Interupt priorities so no sub priorities */
|
||||
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_4);
|
||||
|
||||
/* Configure HCLK clock as SysTick clock source. */
|
||||
|
@ -28,9 +28,7 @@
|
||||
#ifndef PIOS_SYS_H
|
||||
#define PIOS_SYS_H
|
||||
|
||||
/* Exported Functions */
|
||||
/* Public Functions */
|
||||
extern void SysInit(void);
|
||||
extern void GPIO_Configuration(void);
|
||||
extern void NVIC_Configuration(void);
|
||||
|
||||
#endif /* PIOS_SYS_H */
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @author The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2009.
|
||||
*
|
||||
* @file pios_uart.c
|
||||
* UART commands, Inits UARTS, controls & talks to UARTS
|
||||
* UART commands. Inits USARTs, controls UARTs & Interupt handlers
|
||||
*
|
||||
* @see The GNU Public License (GPL)
|
||||
*/
|
||||
@ -25,9 +25,21 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
/* Project Includes */
|
||||
#include "pios.h"
|
||||
|
||||
|
||||
/* Public Function Prototypes */
|
||||
void UARTInit(void);
|
||||
void EnableAuxUART(void);
|
||||
void DisableAuxUART(void);
|
||||
void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud);
|
||||
|
||||
|
||||
/* Private Function Prototypes */
|
||||
|
||||
|
||||
/* Local Variables */
|
||||
static u8 rx_buffer[UART_NUM][UART_RX_BUFFER_SIZE];
|
||||
static volatile u8 rx_buffer_tail[UART_NUM];
|
||||
@ -39,7 +51,14 @@ static volatile u8 tx_buffer_tail[UART_NUM];
|
||||
static volatile u8 tx_buffer_head[UART_NUM];
|
||||
static volatile u8 tx_buffer_size[UART_NUM];
|
||||
|
||||
/* Initialise the GPS and TELEM onboard UARTs */
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UARTInit
|
||||
* Description : Initialise the GPS and TELEM onboard UARTs
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UARTInit(void)
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
@ -129,17 +148,41 @@ void UARTInit(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : EnableAuxUART
|
||||
* Description : Enables AUX UART at the expense of servo inputs
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void EnableAuxUART(void)
|
||||
{
|
||||
//Implement after servo inputs are implemented
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : DisableAuxUART
|
||||
* Description : Disables AUX UART reclaims two servo inputs
|
||||
* Input : None
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void DisableAuxUART(void)
|
||||
{
|
||||
//Implement after servo inputs are implemented
|
||||
}
|
||||
|
||||
/* Changes the baud rate of the USART peripherial without re-initialising */
|
||||
|
||||
/*******************************************************************************
|
||||
* Function Name : UARTInit
|
||||
* Description : Changes the baud rate of the USART peripherial without
|
||||
* : re-initialising.
|
||||
* Input : USART to change, new baud rate
|
||||
* Output : None
|
||||
* Return : None
|
||||
*******************************************************************************/
|
||||
void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud)
|
||||
{
|
||||
/* USART BRR Configuration */
|
||||
@ -171,6 +214,7 @@ void UARTChangeBaud(USART_TypeDef* USARTx, uint32_t Baud)
|
||||
USARTx->BRR = (uint16_t)tmpreg;
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/* WORK IN PROGRESS BELOW */
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
|
@ -28,7 +28,7 @@
|
||||
#ifndef PIOS_UART_H
|
||||
#define PIOS_UART_H
|
||||
|
||||
/* Function Prototypes */
|
||||
/* Public Functions */
|
||||
extern void UARTInit(void);
|
||||
extern void EnableAuxUART(void);
|
||||
extern void DisableAuxUART(void);
|
||||
|
Loading…
Reference in New Issue
Block a user