Subversion Repositories NaviCtrl

Compare Revisions

Ignore whitespace Rev 135 → Rev 136

/trunk/Navi-Ctrl.Uv2
74,6 → 74,7
File 2,5,<.\timer2.h><timer2.h>
File 2,5,<.\91x_conf.h><91x_conf.h>
File 2,5,<.\analog.h><analog.h>
File 2,5,<.\config.h><config.h>
File 3,2,<.\startup912.s><startup912.s>
File 4,1,<.\libstr91x\src\91x_scu.c><91x_scu.c>
File 4,1,<.\libstr91x\src\91x_gpio.c><91x_gpio.c>
/trunk/Obj/Navi-Ctrl_STR9.hex
874,7 → 874,7
:103690000050C3E5A0309FE50050C3E51703A0E349
:1036A0000D0A80E20610A0E1563A00EB1703A0E3F2
:1036B0000D0A80E20610A0E1713A00EB1400A0E3CD
:1036C0000510A0E10520A0E1C13600EB1400A0E345
:1036C0000510A0E10720A0E3C13600EB1400A0E341
:1036D0000610A0E1133600EBFA0FA0E3EB2D00EB90
:1036E00058309FE5000083E554309FE50020D3E586
:1036F0000020E0E30020C3E50110D3E50120C3E58D
2371,18 → 2371,18
:109420000E1C00EB007088E5F0A91BE9A004000405
:109430000DC0A0E170D82DE904B04CE21CD04DE283
:10944000F4009FE5BC0300EB0800A0E30110A0E3DB
:10945000AF1900EBE4409FE59634A0E34339A0E167
:10946000B030C4E134604BE20600A0E1761D00EBB1
:10945000AF1900EBE4509FE59634A0E34339A0E157
:10946000B030C5E134604BE20600A0E1761D00EBB0
:109470006030A0E3B4334BE10830E0E3B2334BE1BA
:109480000050A0E3B0534BE1B030D4E12C300BE5F9
:10949000B8524BE1033CA0E3B6324BE11040A0E3ED
:1094A000B4424BE10230A0E320300BE51C300BE569
:109480000040A0E3B0434BE1B030D5E12C300BE518
:10949000B8424BE1033CA0E3B6324BE11050A0E3ED
:1094A000B4524BE10230A0E320300BE51C400BE549
:1094B0001703A0E3010980E2CD1C00EB1703A0E332
:1094C000010980E20610A0E1E91C00EB1703A0E30C
:1094D000010980E25010A0E30120A0E3721D00EB1F
:1094E0001703A0E3010980E20110A0E3671D00EB70
:1094F0000400A0E10510A0E10920A0E3341F00EB67
:109500000400A0E10110A0E3861E00EB47FFFFEB83
:1094F0000500A0E10410A0E10520A0E3341F00EB6B
:109500000500A0E10110A0E3861E00EB47FFFFEB82
:109510002C009FE52C109FE59620A0E3A11300EB03
:1095200024009FE524109FE59620A0E39D1300EB07
:109530001C009FE5800300EB70A81BE918F70100F1
2490,7 → 2490,7
:109B9000B4244BE10830E0E3B2344BE1B0544BE184
:109BA000E13CA0E33C300BE5B8534BE1032CA0E3D0
:109BB000B6234BE11030A0E30390A0E1B4334BE1B6
:109BC00030600BE52C600BE51703A0E3050A80E28B
:109BC00030600BE52C500BE51703A0E3050A80E29B
:109BD000071B00EB1703A0E3050A80E20410A0E1D5
:109BE000231B00EB1703A0E3050A80E25010A0E35B
:109BF0000720A0E1AC1B00EB1703A0E3050A80E2FD
2738,21 → 2738,21
:10AB10002000A0E30110A0E3FD1300EB0207A0E377
:10AB20000110A0E3FA1300EB44004BE29D1600EB8A
:10AB30000160A0E344404BE20050A0E30150C4E5B3
:10AB40000430A0E344304BE50270A0E30250C4E5BA
:10AB50000360C4E50580A0E1B450C4E11603A0E39E
:10AB40000430A0E344304BE50280A0E30250C4E5AA
:10AB50000360C4E50570A0E1B450C4E11603A0E3AE
:10AB60000B0A80E20410A0E13C1600EB0208A0E30F
:10AB70000610A0E1E61300EB0400A0E1891600EB4B
:10AB80000160C4E544604BE50250C4E5B470C4E123
:10AB80000160C4E544604BE50250C4E5B480C4E113
:10AB90001603A0E3090A80E20410A0E12F1600EBDF
:10ABA0003C404BE20400A0E1A71700EB6030A0E3BB
:10ABB000BC334BE10830E0E3BA334BE1B8534BE12F
:10ABC000E13CA0E334300BE5B0534BE1033CA0E3A0
:10ABD000BE324BE11030A0E3BC324BE128700BE5F4
:10ABE00024700BE51703A0E3060A80E2001700EBD0
:10ABD000BE324BE11030A0E3BC324BE128800BE5E4
:10ABE00024500BE51703A0E3060A80E2001700EBF0
:10ABF0001703A0E3060A80E20410A0E11C1700EB93
:10AC00001703A0E3060A80E25010A0E30620A0E1AB
:10AC1000A51700EB1703A0E3060A80E20610A0E1E7
:10AC20009A1700EB1200A0E30510A0E10520A0E3B5
:10AC20009A1700EB1200A0E30510A0E10620A0E3B4
:10AC3000671900EB1200A0E30610A0E1B91800EBC1
:10AC400008009FE5BCFDFFEBF0A91BE954F70100EC
:10AC5000D4F101000DC0A0E1F0D82DE904B04CE220
3808,7 → 3808,7
:10EDF0001603A0E3030A80E20410A0E1160A00EB68
:10EE00001603A0E3030A80E20119A0E30120A0E3B6
:10EE10000E0B00EB1603A0E3030A80E20010A0E350
:10EE2000D20A00EB0500A0E30010A0E30720A0E356
:10EE2000D20A00EB0500A0E30010A0E30820A0E355
:10EE3000E70800EB0500A0E30110A0E3390800EBB0
:10EE40003C309FE50010A0E3B010C3E10210C3E521
:10EE50000310C3E50410C3E50510C3E50610C3E5C0
/trunk/analog.c
57,6 → 57,7
#include "91x_lib.h"
#include "uart1.h"
#include "analog.h"
#include "config.h"
 
AnalogData_t AnalogData;
 
116,7 → 117,7
 
ADC_ConversionCmd(ADC_Conversion_Start);
 
VIC_Config(ADC_ITLine, VIC_IRQ, 14); //low priority
VIC_Config(ADC_ITLine, VIC_IRQ, PRIORITY_ADC);
VIC_ITCmd(ADC_ITLine, ENABLE);
 
UART1_PutString("ok");
/trunk/config.h
0,0 → 1,21
#ifndef _CONFIG_H
#define _CONFIG_H
 
// Configure the interrupt priority at a level from 0 to 15 (0 is highest priority)
#define PRIORITY_SPI0 1 // timing forced by FC
#define PRIORITY_USB 2 //
#define PRIORITY_UART0 5 // uart to GPS/MK3MAG
#define PRIORITY_UART1 4 // debug uart
#define PRIORITY_UART2 6 // uart to FC
#define PRIORITY_I2C1 7 // i2c to MK3MAG
#define PRIORITY_TIMER1 8 // system time
#define PRIORITY_TIMER2 3 // servo pwm
#define PRIORITY_ADC 14 // adc conversion
#define PRIORITY_SDSWITCH 15 // switch at sd port
 
#define UART0_BAUD_RATE 57600 //Baud Rate for the serial interfaces
#define UART1_BAUD_RATE 57600 //Baud Rate for the serial interfaces
#define UART2_BAUD_RATE 57600 //Baud Rate for the serial interfaces
#define I2C1_CLOCK 20000 // 20 kHz
 
#endif // _CONFIG_H
/trunk/i2c.c
60,6 → 60,7
#include "i2c.h"
#include "uart1.h"
#include "timer1.h"
#include "config.h"
#include "main.h"
#include "led.h"
#include "spi_slave.h"
165,7 → 166,7
I2C_StructInit(&I2C_Struct);
I2C_Struct.I2C_GeneralCall = I2C_GeneralCall_Disable;
I2C_Struct.I2C_Ack = I2C_Ack_Enable;
I2C_Struct.I2C_CLKSpeed = 20000;
I2C_Struct.I2C_CLKSpeed = I2C1_CLOCK;
I2C_Struct.I2C_OwnAddress = 0x00;
I2C_Init(I2C1, &I2C_Struct);
 
180,7 → 181,7
I2C_Cmd(I2C1, ENABLE);
I2C_ITConfig(I2C1, ENABLE);
 
VIC_Config(I2C1_ITLine, VIC_IRQ , 0);
VIC_Config(I2C1_ITLine, VIC_IRQ , PRIORITY_I2C1);
VIC_ITCmd(I2C1_ITLine, ENABLE);
 
I2C1_Timeout = SetDelay(1000);
/trunk/spi_slave.c
64,6 → 64,7
#include "i2c.h"
#include "timer1.h"
#include "timer2.h"
#include "config.h"
#include "main.h"
#include "fifo.h"
 
269,7 → 270,7
// set the pointer to the checksum byte in the tx buffer
Ptr_TxChksum = (u8 *) &(((ToFlightCtrl_t *) &(SPI_TxBuffer[2]))->Chksum);
 
VIC_Config(SSP0_ITLine, VIC_IRQ, 1);
VIC_Config(SSP0_ITLine, VIC_IRQ, PRIORITY_SPI0);
VIC_ITCmd(SSP0_ITLine, ENABLE);
 
UART1_PutString("ok");
/trunk/ssc.c
55,6 → 55,7
// + POSSIBILITY OF SUCH DAMAGE.
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include "91x_lib.h"
#include "config.h"
 
//________________________________________________________________________________________________________________________________________
// Module name: ssc.c
187,7 → 188,7
// The EXTIT1_IRQHandler() is called every time the SD-Switch is activated (falling edge)
// by inserting an sd-card
SCU_WakeUpLineConfig(11);
VIC_Config(EXTIT1_ITLine, VIC_IRQ, 15); // lowest priority
VIC_Config(EXTIT1_ITLine, VIC_IRQ, PRIORITY_SDSWITCH);
VIC_ITCmd(EXTIT1_ITLine, ENABLE);
}
 
/trunk/timer1.c
57,6 → 57,7
#include "91x_lib.h"
#include "timer1.h"
#include "uart1.h"
#include "config.h"
 
u32 CountMilliseconds;
DateTime_t SystemTime;
100,7 → 101,7
TIM_ITConfig(TIM1, TIM_IT_OC1, ENABLE);
TIM_CounterCmd(TIM1, TIM_START);
 
VIC_Config(TIM1_ITLine, VIC_IRQ, 7);
VIC_Config(TIM1_ITLine, VIC_IRQ, PRIORITY_TIMER1);
VIC_ITCmd(TIM1_ITLine, ENABLE);
 
SystemTime.Year = 0;
/trunk/timer2.c
58,6 → 58,7
#include "timer2.h"
#include "uart1.h"
#include "spi_slave.h"
#include "config.h"
 
#define CR1_OLVL1_MASK 0x0100
#define CR1_OLVL2_MASK 0x0200
222,7 → 223,7
TIM_ITConfig(TIM2, TIM_IT_OC1|TIM_IT_OC2, ENABLE); // enable interrupts for the OC 1 & 2
TIM_CounterCmd(TIM2, TIM_START); // start the timer
 
VIC_Config(TIM2_ITLine, VIC_IRQ, 3);
VIC_Config(TIM2_ITLine, VIC_IRQ, PRIORITY_TIMER2);
VIC_ITCmd(TIM2_ITLine, ENABLE);
 
// set servo params to defaults
/trunk/uart0.c
58,6 → 58,7
#include <stdarg.h>
#include <string.h>
#include "91x_lib.h"
#include "config.h"
#include "main.h"
#include "uart0.h"
#include "uart1.h"
71,7 → 72,6
 
MKOSD_VersionInfo_t MKOSD_VersionInfo;
 
#define UART0_BAUD_RATE 57600 //Baud Rate for the serial interfaces
// UART0 MUXER
UART0_MuxerState_t UART0_Muxer = UART0_UNDEF;
u16 Uart0Baudrate = UART0_BAUD_RATE;
224,7 → 224,7
UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
UART_InitStructure.UART_FIFO = UART_FIFO_Enable;
UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_8;
 
UART_DeInit(UART0); // reset uart 0 to default
UART_Init(UART0, &UART_InitStructure); // initialize uart 0
232,8 → 232,8
// enable uart 0 interrupts selective
UART_ITConfig(UART0, UART_IT_Receive | UART_IT_ReceiveTimeOut /*| UART_IT_FrameError*/, ENABLE);
UART_Cmd(UART0, ENABLE); // enable uart 0
// configure the uart 0 interupt line as an IRQ with priority 9 (0 is highest)
VIC_Config(UART0_ITLine, VIC_IRQ, 9);
// configure the uart 0 interupt line
VIC_Config(UART0_ITLine, VIC_IRQ, PRIORITY_UART0);
// enable the uart 0 IRQ
VIC_ITCmd(UART0_ITLine, ENABLE);
UART0_Connect_to_MKGPS();
253,7 → 253,7
void UART0_IRQHandler(void)
{
u8 c;
// if receive irq or receive timeout irq has occured
// if receive irq (FIFO is over trigger level) or receive timeout irq (FIFO is not empty for longer times) has occured
if((UART_GetITStatus(UART0, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART0, UART_IT_ReceiveTimeOut) != RESET) )
{
UART_ClearITPendingBit(UART0, UART_IT_Receive); // clear receive interrupt flag
/trunk/uart1.c
59,6 → 59,7
#include <string.h>
 
#include "91x_lib.h"
#include "config.h"
#include "menu.h"
#include "printf_P.h"
#include "GPS.h"
93,8 → 94,6
 
UART_TypeDef *DebugUART = UART1;
 
#define UART1_BAUD_RATE 57600 //Baud Rate for the serial interfaces
 
// the tx buffer
#define UART1_TX_BUFFER_LEN 150
u8 UART1_tbuffer[UART1_TX_BUFFER_LEN];
207,7 → 206,7
UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
UART_InitStructure.UART_FIFO = UART_FIFO_Enable;
UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_8;
 
UART_DeInit(UART1); // reset uart 1 to default
UART_Init(UART1, &UART_InitStructure); // initialize uart 1
214,8 → 213,8
// enable uart 1 interrupts selective
UART_ITConfig(UART1, UART_IT_Receive | UART_IT_ReceiveTimeOut, ENABLE);
UART_Cmd(UART1, ENABLE); // enable uart 1
// configure the uart 1 interupt line as an IRQ with priority 4 (0 is highest)
VIC_Config(UART1_ITLine, VIC_IRQ, 4);
// configure the uart 1 interupt line
VIC_Config(UART1_ITLine, VIC_IRQ, PRIORITY_UART1);
// enable the uart 1 IRQ
VIC_ITCmd(UART1_ITLine, ENABLE);
// initialize the debug timer
281,7 → 280,7
abortState = 0;
break;
}
// if the Debug uart is not UART1, rederect input to the Debug UART
// if the Debug uart is not UART1, redirect input to the Debug UART
if (DebugUART != UART1)
{
// wait for space in the tx buffer of the DebugUART
/trunk/uart2.c
56,11 → 56,9
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//#include <stdio.h>
#include "91x_lib.h"
#include "config.h"
#include "uart1.h"
 
#define UART2_BAUD_RATE 57600 //Baud Rate for the serial interfaces
 
 
/********************************************************/
/* Initialize UART2 */
/********************************************************/
111,7 → 109,7
UART_InitStructure.UART_Mode = UART_Mode_Tx_Rx;
UART_InitStructure.UART_FIFO = UART_FIFO_Enable;
UART_InitStructure.UART_TxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_2;
UART_InitStructure.UART_RxFIFOLevel = UART_FIFOLevel_1_8;
 
UART_DeInit(UART2); // reset uart 2 to default
UART_Init(UART2, &UART_InitStructure); // initialize uart 2
119,8 → 117,8
// enable uart 2 interrupts selective
UART_ITConfig(UART2, UART_IT_Receive | UART_IT_ReceiveTimeOut, ENABLE);
UART_Cmd(UART2, ENABLE); // enable uart 2
// configure the uart 2 interupt line as an IRQ with priority 5(0 is highest)
VIC_Config(UART2_ITLine, VIC_IRQ, 5);
// configure the uart 2 interupt line
VIC_Config(UART2_ITLine, VIC_IRQ, PRIORITY_UART2);
// enable the uart 2 IRQ
VIC_ITCmd(UART2_ITLine, ENABLE);
 
/trunk/usb.c
56,6 → 56,7
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#include <string.h>
#include "91x_lib.h"
#include "config.h"
#include "main.h"
#include "uart1.h"
#include "usb.h"
143,7 → 144,7
PowerOff();
Virtual_Com_Port_Reset();
VIC_Config(USBLP_ITLine, VIC_IRQ, 2);
VIC_Config(USBLP_ITLine, VIC_IRQ, PRIORITY_USB);
VIC_ITCmd(USBLP_ITLine, ENABLE);
USB_Init();