Subversion Repositories FlightCtrl

Rev

Rev 1554 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
927 hbuss 1
#include <inttypes.h>
2
#include "main.h"
3
 
4
uint16_t LED1_Timing = 0;
5
uint16_t LED2_Timing = 0;
6
unsigned char J16Blinkcount = 0, J16Mask = 1;
7
unsigned char J17Blinkcount = 0, J17Mask = 1;
8
 
9
// initializes the LED control outputs J16, J17
10
void LED_Init(void)
11
{
1554 FredericG 12
    // set PC2 & PC3 as output (control of J16 & J17)
13
    DDRC |= (1<<DDC2)|(1<<DDC3);
14
    J16_OFF;
15
    J17_OFF;
16
    J16Blinkcount = 0; J16Mask = 128;
17
    J17Blinkcount = 0; J17Mask = 128;
927 hbuss 18
}
19
 
20
// called in UpdateMotors() every 2ms
21
void LED_Update(void)
22
{
1554 FredericG 23
    static char delay = 0;
1607 FredericG 24
 
1554 FredericG 25
    if(!delay--)  // 10ms Intervall
26
    {
27
        delay = 4;
1254 killagreg 28
 
1607 FredericG 29
        if (Parameter_J16Timing < 10)
1554 FredericG 30
        {
1607 FredericG 31
            J16_OFF;
32
            J17_OFF;
1554 FredericG 33
        }
1607 FredericG 34
        else if (Parameter_J16Timing < 180)
35
        {
36
            J16_ON;
37
            J17_OFF;
38
        }
1554 FredericG 39
        else
40
        {
1607 FredericG 41
            J16_ON;
42
            J17_ON;
1554 FredericG 43
        }
44
    }
927 hbuss 45
}