void led_initialise(void) {
#ifdef LED_GREEN_PORT
    SIM->SCGC5 |=  PORT_CLOCK_MASK(LED_GREEN_PORT);
    greenLedOff();
    PDDR(LED_GREEN_PORT)               |= (1<<LED_GREEN_NUM);
    PCR(LED_GREEN_PORT, LED_GREEN_NUM)  = PORT_PCR_MUX(1)|PORT_PCR_DSE_MASK;
#endif

#ifdef LED_RED_PORT
    SIM->SCGC5 |=  PORT_CLOCK_MASK(LED_RED_PORT);
    redLedOff();
    PDDR(LED_RED_PORT)             |= (1<<LED_RED_NUM);
    PCR(LED_RED_PORT, LED_RED_NUM)  = PORT_PCR_MUX(1)|PORT_PCR_DSE_MASK;
#endif

#ifdef LED_BLUE_PORT
    SIM->SCGC5 |=  PORT_CLOCK_MASK(LED_BLUE_PORT);
    blueLedOff();
    PDDR(LED_BLUE_PORT)              |= (1<<LED_BLUE_NUM);
    PCR(LED_BLUE_PORT, LED_BLUE_NUM)  = PORT_PCR_MUX(1)|PORT_PCR_DSE_MASK;
#endif

#ifdef LED_ORANGE_PORT
    SIM->SCGC5 |=  PORT_CLOCK_MASK(LED_ORANGE_PORT);
    orangeLedOff();
    PDDR(LED_ORANGE_PORT)                |= (1<<LED_ORANGE_NUM);
    PCR(LED_ORANGE_PORT, LED_ORANGE_NUM)  = PORT_PCR_MUX(1)|PORT_PCR_DSE_MASK;
#endif
}
Exemplo n.º 2
0
static void roGreenLedTimerCb(void *x) {
    isGreenLedOn = !isGreenLedOn;
    if (isGreenLedOn) {
        if (isRoutingInfoValid()) greenLedOn();
    } else {
        greenLedOff();
    }
    alarmSchedule(&roGreenLedTimer, isGreenLedOn ? 100 : 5000);
}
void led_initialise(void) {
   PORT_CLOCK_ENABLE_REG |=  CLOCK_MASK(LED_GREEN_PORT);
   greenLedOff();
   ORANGE_LED_PTxPF = (ORANGE_LED_PTxPF & ~ORANGE_LED_PTxPF_n(0xF))|ORANGE_LED_PTxPF_n(ORANGE_LED_FN);
   ORANGE_LED_DD   |= ORANGE_LED_MASK;

   PORT_CLOCK_ENABLE_REG |=  CLOCK_MASK(LED_ORANGE_PORT);
   orangeLedOff();
   GREEN_LED_DD    |= GREEN_LED_MASK;
   GREEN_LED_PTxPF  = (GREEN_LED_PTxPF & ~GREEN_LED_PTxPF_n(0xF))|GREEN_LED_PTxPF_n(GREEN_LED_FN);
}
void led_initialise(void) {
#ifdef LED_GREEN_PORT
   greenLedOff();
   PDDR(LED_GREEN_PORT)               |= (1<<LED_GREEN_NUM);
#endif

#ifdef LED_RED_PORT
   redLedOff();
   PDDR(LED_RED_PORT)             |= (1<<LED_RED_NUM);
#endif

#ifdef LED_BLUE_PORT
   blueLedOff();
   PDDR(LED_BLUE_PORT)              |= (1<<LED_BLUE_NUM);
#endif

#ifdef LED_ORANGE_PORT
   orangeLedOff();
   PDDR(LED_ORANGE_PORT)                |= (1<<LED_ORANGE_NUM);
#endif
}
Exemplo n.º 5
0
//-------------------------------------------
//      Entry point for the application
//-------------------------------------------
void appMain(void)
{
    while (1)
    {
        static uint_t i;
        // test 1: counter 0-7
        for (i = 0; i < 8; ++i) {
            ledsSet(i);
            msleep(PAUSE);
        }

        // test 2: all off, then red on/off, then green on/off, finally blue on/off
        ledsSet(0);
        msleep(PAUSE);
        redLedOn();
        msleep(PAUSE);
        redLedOff();
        msleep(PAUSE);

        greenLedOn();
        msleep(PAUSE);
        greenLedOff();
        msleep(PAUSE);

        blueLedOn();
        msleep(PAUSE);
        blueLedOff();
        msleep(PAUSE);

        // test 3: all on, then blue off, green off, red off
        ledsSet(7);
        msleep(PAUSE);
        blueLedOff();
        msleep(PAUSE);
        greenLedOff();
        msleep(PAUSE);
        redLedOff();
        msleep(PAUSE);

        // test 4: repeat last two tests with toggle
        redLedToggle();
        msleep(PAUSE);
        redLedToggle();
        msleep(PAUSE);

        greenLedToggle();
        msleep(PAUSE);
        greenLedToggle();
        msleep(PAUSE);

        blueLedToggle();
        msleep(PAUSE);
        blueLedToggle();
        msleep(PAUSE);

        ledsSet(7);
        msleep(PAUSE);
        blueLedToggle();
        msleep(PAUSE);
        greenLedToggle();
        msleep(PAUSE);
        redLedToggle();
        msleep(PAUSE);

        // test 5: check that isOn functions work
        ledsSet(0);
        ASSERT(!redLedGet());
        ASSERT(!greenLedGet());
        ASSERT(!blueLedGet());
        ledsSet(7);
        ASSERT(redLedGet());
        ASSERT(greenLedGet());
        ASSERT(blueLedGet());
    } // EOF while (1)
}