Subversion Repositories FlightCtrl

Rev

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

#include <inttypes.h>
#include "led.h"
#include "fc.h"

uint16_t LED_OffTime = 0;
uint16_t LED_OnTime = 0;


// initializes the LED control outputs J16, J17
void LED_Init(void)
{
    // set PC2 & PC3 as output (control of J16 & J17)
        DDRC |= (1<<DDC2)|(1<<DDC3);
        J16_OFF;
        J17_OFF;
}


// called in UpdateMotors() every 2ms
void LED_Update(void)
{
        static uint16_t J16_blinkcount = 0;

        if(J16_blinkcount < LED_OnTime) J16_ON;
        else J16_OFF;
        if( J16_blinkcount++ >= (LED_OnTime + LED_OffTime)) J16_blinkcount = 0;
}