Subversion Repositories FlightCtrl

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
763 killagreg 1
#include <inttypes.h>
2
#include "led.h"
3
#include "fc.h"
4
 
5
uint16_t LED_OffTime = 0;
6
uint16_t LED_OnTime = 0;
7
 
8
 
9
// initializes the LED control outputs J16, J17
10
void LED_Init(void)
11
{
12
    // set PC2 & PC3 as output (control of J16 & J17)
13
        DDRC |= (1<<DDC2)|(1<<DDC3);
14
        J16_OFF;
15
        J17_OFF;
16
}
17
 
18
 
19
// called in UpdateMotors() every 2ms
20
void LED_Update(void)
21
{
22
        static uint16_t J16_blinkcount = 0;
23
 
24
        if(J16_blinkcount < LED_OnTime) J16_ON;
25
        else J16_OFF;
26
        if( J16_blinkcount++ >= (LED_OnTime + LED_OffTime)) J16_blinkcount = 0;
27
}