Subversion Repositories FlightCtrl

Rev

Rev 707 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 707 Rev 712
Line 83... Line 83...
83
        unsigned int timer;
83
        unsigned int timer;
Line 84... Line 84...
84
 
84
 
85
        // disable interrupts global
85
        // disable interrupts global
Line -... Line 86...
-
 
86
        cli();
86
        cli();
87
 
87
 
88
        // get board release
88
    DDRB  = 0x00;
89
    DDRB  = 0x00;
89
    PORTB = 0x00;
-
 
90
    for(timer = 0; timer < 1000; timer++); // make delay
-
 
91
 
90
    PORTB = 0x00;
92
 
91
    for(timer = 0; timer < 1000; timer++); // make delay
Line 93... Line -...
93
    if(PINB & 0x01) BoardRelease = 11;
-
 
94
    else BoardRelease = 10;
92
    if(PINB & 0x01) BoardRelease = 11;
95
 
-
 
96
    DDRC  = 0x81; // SCL & Speaker
93
    else BoardRelease = 10;
97
    PORTC = 0xff; // Pullup SDA
-
 
98
    DDRB  = 0x1B; // LEDs und Druckoffset
94
 
99
    PORTB = 0x01; // LED_Rot
-
 
100
    DDRD  = 0x3E; // Speaker & TXD & J3 J4 J5
95
        // Set LED Ports as output
101
    DDRD  |=0x80; // J7
-
 
Line 102... Line 96...
102
 
96
        DDRB |= (1<<DDB1)|(1<<DDB0);
103
        PORTD = 0xF7; // LED
97
        ROT_ON;
104
 
98
        GRN_OFF;
Line 114... Line 108...
114
        StickRoll = 0;
108
        StickRoll = 0;
115
        StickPitch = 0;
109
        StickPitch = 0;
Line 116... Line 110...
116
 
110
 
Line -... Line 111...
-
 
111
    ROT_OFF;
117
    ROT_OFF;
112
 
118
 
113
        // initalize modules
119
    TIMER0_Init();
114
    TIMER0_Init();
120
    TIMER2_Init();
115
    TIMER2_Init();
121
        USART0_Init();
116
        USART0_Init();
122
        if (BoardRelease == 11) USART1_Init();
117
        if (BoardRelease == 11) USART1_Init();
123
    rc_sum_init();
118
    RC_Init();
124
        ADC_Init();
119
        ADC_Init();
125
        i2c_init();
120
        i2c_init();
Line 183... Line 178...
183
    LCD_Clear();
178
    LCD_Clear();
Line 184... Line 179...
184
 
179
 
185
    I2CTimeout = 5000;
180
    I2CTimeout = 5000;
186
        while (1)
181
        while (1)
187
        {
182
        {
188
        if(UpdateMotor)      // ReglerIntervall
183
        if(UpdateMotor)      // control interval
189
            {
184
            {
190
            //SPI_TransmitByte(); //#
185
            //SPI_TransmitByte(); //#
191
                        UpdateMotor=0;
186
                        UpdateMotor=0; // reset Flag, is enabled every 2 ms by isr of timer0
192
//PORTD |= 0x08;
187
//PORTD |= 0x08;
Line 193... Line 188...
193
            MotorRegler();
188
            MotorControl();
194
 
189
 
195
//PORTD &= ~0x08;
190
//PORTD &= ~0x08;
196
            SendMotorData();
191
            SendMotorData();
197
            ROT_OFF;
192
            ROT_OFF;
198
            if(PcAccess) PcAccess--;
193
            if(PcAccess) PcAccess--;
199
             else
194
            else
200
              {
195
              {
201
               DubWiseKeys[0] = 0;
196
               DubWiseKeys[0] = 0;
202
               DubWiseKeys[1] = 0;
197
               DubWiseKeys[1] = 0;