Esempio n. 1
0
/** Kernel Task to turn-off the packet-received LED <BR>
  * =======================================================================<BR>
  */
void ext_systask(ot_task task) {

    // Turn-off the Green LED
    if (task->event != 0) {
        otapi_led1_off();
    }
    
    // Turn-off the task
    task->event = 0;
}
Esempio n. 2
0
/** User Applet and Button Management Routines <BR>
  * ===========================================================================<BR>
  * The User applet is primarily activated by callbacks from the kernel.  However,
  * in this system some features are also activated by button presses.
  *
  */
void sub_led_cycle(ot_u8 i) {
    switch (i & 3) {
        case 0: PALFI_LED4_ON();        break;
        case 1: PALFI_LED3_ON();        break;
        case 2: otapi_led2_on();   		break;
        case 3: otapi_led1_on();   		break;
    }

    platform_swdelay_ms(33);

    switch (i & 3) {
        case 0: PALFI_LED4_OFF();       break;
        case 1: PALFI_LED3_OFF();       break;
        case 2: otapi_led2_off();       break;
        case 3: otapi_led1_off();       break;
    }
}
Esempio n. 3
0
/** Application Main <BR>
  * ==================================================================<BR>
  *
  */
void app_init() {
/// 1. Blink the board LEDs to show that it is starting up.  
/// 2. Configure the board input button, which for this app will send a ping
    ot_u8 i;

    i=4;
    while (i != 0) {
        if (i&1)    otapi_led1_on();
        else        otapi_led2_on();

        platform_swdelay_ms(30);
        otapi_led2_off();
        otapi_led1_off();
        i--;
    }
    
    //App Task parameters that stay the same throughout the runtime
    sys_task_setreserve(APP_TASK, 1);
    sys_task_setlatency(APP_TASK, 10);
}
Esempio n. 4
0
/** Application Main <BR>
  * ==================================================================<BR>
  *
  */
void app_init() {
/// 1. Blink the board LEDs to show that it is starting up.  
/// 2. Configure the board input button, which for this app will send a ping
    ot_u8 i;

    i=4;
    while (i != 0) {
        if (i&1)    otapi_led1_on();
        else        otapi_led2_on();

        platform_swdelay_ms(30);
        otapi_led2_off();
        otapi_led1_off();
        i--;
    }

    sub_button_init();
    
    //If you have a chronometer applet, you can initialize it here.
    //The commented function below is for example purposes.
    //chron_init(TIM0A5);
}
Esempio n. 5
0
/** Application Main <BR>
  * ==================================================================<BR>
  *
  */
void app_init() {
#if defined(BOARD_eZ430Chronos)
/// Setup LCD


#else
/// 1. Blink the board LEDs to show that it is starting up.
/// 2. Configure the board input button, which for this app will send a ping
    ot_u8 i;

    i=4;
    while (i != 0) {
        if (i&1)    otapi_led1_on();
        else        otapi_led2_on();

        platform_swdelay_ms(30);
        otapi_led2_off();
        otapi_led1_off();
        i--;
    }
#endif

    sub_button_init();
}
Esempio n. 6
0
void sys_sig_rfaterminate(ot_int pcode, ot_int scode) {
/// This is a static callback.   The kernel uses it when it is finishing a 
/// radio process.  It is used here to turn-off activity LEDs.
    otapi_led2_off();
    otapi_led1_off();
}
void sys_sig_rfaterminate(ot_int pcode, ot_int scode) {
/// Hint: RFxRX_e1 label means the received frame has bad CRC.
    ot_u8   loglabel[8] = {'R', 'F', 'F', 0, 'X', '_', 0, 0};
    ot_u8*  logdata;
    ot_int  logdata_len;

    otapi_led2_off();   //Orange LED off
    otapi_led1_off();   //Green LED off

    /// Error Handler:
    /// <LI> If there is an error code, put the code in the log label.     </LI>
    /// <LI> Else if the code is for RX termination, just return.  You can
    ///      comment this and uncomment cases 1 & 2 from the switch block if
    ///      you want to log on RX termination.  </LI>
    /// <LI> Else, the code is for TX or CCA.  Append the channel number to 
    ///      the log label (in hex) </LI> 
    if (scode < 0) {
        loglabel[6] = 'e';
        loglabel[7] = (ot_int)('0') - scode;
    }
    else if (pcode < 3) {
    	return;
    }
    else {
    	otutils_bin2hex(&(phymac[0].channel), &loglabel[6], 1);
    }

    /// Look at the control code an form the label to reflect the type
    switch (pcode) {
        /// RX driver process termination:
        /// (1) background scan ended, (2) or foreground scan ended
        //case 1: loglabel[2] = 'B';
        //case 2: loglabel[3] = 'R';
        //        logdata_len = rxq.length;
        //        logdata     = rxq.front;
        //        break;

        /// TX CCA/CSMA driver process termination:
        /// (3) TX CSMA process ended
        case 3: loglabel[2] = 'C';
                loglabel[3] = 'C';
                loglabel[4] = 'A';
                logdata_len = 0;
                logdata     = NULL; // suppress compiler warning
                break;

        /// TX driver process termination
        /// Background Flood (4) or Foreground TX (5): turn-on green and log TX
        case 4: loglabel[2] = 'B';
        case 5: loglabel[3] = 'T';
                logdata_len = txq.length;
                logdata     = txq.front;
                break;

        /// Unknown code, don't log any data
        default: return;
    }

    /// Log in ASCII hex the prepared driver message
    otapi_log_msg(MSG_raw, 8, logdata_len, loglabel, logdata);
}