Subversion Repositories FlightCtrl

Rev

Rev 754 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 754 Rev 756
Line 56... Line 56...
56
 
56
 
57
#include "main.h"
57
#include "main.h"
58
#include "timer0.h"
58
#include "timer0.h"
59
#include "timer2.h"
59
#include "timer2.h"
-
 
60
#include "uart.h"
60
#include "uart.h"
61
#if defined (__AVR_ATmega644P__)
-
 
62
#include "uart1.h"
61
#include "uart1.h"
63
#endif
62
#include "menu.h"
64
#include "menu.h"
63
#include "ubx.h"
65
#include "ubx.h"
64
#include "fc.h"
66
#include "fc.h"
65
#include "rc.h"
67
#include "rc.h"
Line 93... Line 95...
93
 
95
 
94
        // get board release
96
        // get board release
95
    DDRB  = 0x00;
97
    DDRB  = 0x00;
96
    PORTB = 0x00;
98
    PORTB = 0x00;
97
    for(timer = 0; timer < 1000; timer++); // make some delay
99
    for(timer = 0; timer < 1000; timer++); // make some delay
98
    if(PINB & (1<<PINB1)) BoardRelease = 11;
100
    if(PINB & (1<<PINB0)) BoardRelease = 11;
Line 99... Line 101...
99
    else BoardRelease = 10;
101
    else BoardRelease = 10;
100
 
102
 
101
        // set LED ports as output
103
        // set LED ports as output
Line 125... Line 127...
125
        // initalize modules
127
        // initalize modules
126
    TIMER0_Init();
128
    TIMER0_Init();
127
    TIMER2_Init();
129
    TIMER2_Init();
128
        USART0_Init();
130
        USART0_Init();
Line 129... Line 131...
129
 
131
 
130
#if defined (__AVR_ATmega644p__)
132
#if defined (__AVR_ATmega644P__)
131
        if (BoardRelease == 11) USART1_Init();
133
        if (BoardRelease == 11) USART1_Init();
Line 132... Line 134...
132
#endif
134
#endif
133
 
135
 
Line 211... Line 213...
211
        {
213
        {
212
        if(UpdateMotor)      // control interval
214
        if(UpdateMotor)      // control interval
213
            {
215
            {
214
            //SPI_TransmitByte(); //#
216
            //SPI_TransmitByte(); //#
215
                        UpdateMotor=0; // reset Flag, is enabled every 2 ms by isr of timer0
217
                        UpdateMotor=0; // reset Flag, is enabled every 2 ms by isr of timer0
216
//PORTD |= 0x08;
218
PORTD |= (1<<PORTD4);
217
            MotorControl();
219
            MotorControl();
218
 
-
 
219
//PORTD &= ~0x08;
220
PORTD &= ~(1<<PORTD4);
220
            SendMotorData();
221
            SendMotorData();
221
            ROT_OFF;
222
            ROT_OFF;
222
            if(PcAccess) PcAccess--;
223
            if(PcAccess) PcAccess--;
223
            else
224
            else
224
              {
225
              {