Beispiel #1
0
void app_invoke(ot_u8 channel) {
/// The "External Task" is the place where the kernel runs the main user app.
/// Our app has 4 functions (call types).
/// <LI> The task event state is set to 1.  Event 0 is always Task-off, but
///      otherwise each task manages its own event numbers </LI>
/// <LI> We store the channel in the cursor, which is not being used otherwise.
///      The Task "cursor" can be used for additional state control, beyond the
///      event number. </LI>
/// <LI> We give it a runtime reservation of 1 tick (it runs pretty fast).
///      This is also short enough to pre-empt RX listening, but not RX data.
///      Try changing to a higher number, and observing how the kernel
///      manages this task. </LI>
/// <LI> We give it a latency of 255.  Latency is unimportant for run-once
///      tasks, so giving it the max latency will prevent it from blocking
///      any other tasks. </LI>
/// <LI> We tell it to start ASAP (preemption delay parameter = 0) </LI>
///
/// @note The latency parameter is mostly useful for protocol management,
/// for which you probably want to enforce a request-response turnaround time.
/// for processing and for iterative tasks it is not important: set to 255.
///
    sys_task_setevent(APP_TASK, 1);
    sys_task_setcursor(APP_TASK, channel);
    sys_task_setreserve(APP_TASK, 1);
    sys_task_setlatency(APP_TASK, 255);
    sys_preempt(APP_TASK, 0);
}
Beispiel #2
0
void PALFI_WAKE_ISR(void) {
/// In this demo the PALFI LF interface is not initialized.  However, there are
/// some switches (buttons) that are attached to the PaLFI core, and they use
/// the same interrupt.  Those buttons are attached.

    if (PALFI_WAKE_PORT->IFG & BOARD_SW2_PIN) {
        sys_task_setevent(PALFI_TASK, 2);
        sys_task_setreserve(PALFI_TASK, 64);
        sys_task_setlatency(PALFI_TASK, 255);
        sys_preempt(PALFI_TASK, 0);
    }
    //if (PALFI_WAKE_PORT->IFG & PALFI_WAKE_PIN) {
    //    sys_task_setevent(PALFI_TASK, 1);
    //}

    PALFI_WAKE_PORT->IFG = 0;
}
Beispiel #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);
}
Beispiel #4
0
void app_invoke(ot_u8 call_type) {
/// The "External Task" is the place where the kernel runs the main user app.
/// Our app has 4 functions (call types).
/// <LI> We give it a runtime reservation of 1 tick (it runs pretty fast).
///      This is also short enough to pre-empt RX listening, but not RX data.
///      Try changing to a higher number, and observing how the kernel
///      manages this task. </LI>
/// <LI> We give it a latency of 255.  Latency is unimportant for run-once
///      tasks, so giving it the max latency will prevent it from blocking
///      any other tasks. </LI>
/// <LI> We tell it to start ASAP (next = 0) </LI>
///
/// @note The latency parameter is mostly useful for protocol management,
/// for which you probably want to enforce a request-response turnaround time.
/// for processing and basic, iterative tasks it is not important: set to 255.
///
	sys_task_setevent(OPMODE_TASK, call_type);
    sys_task_setreserve(OPMODE_TASK, 1);
    sys_task_setlatency(OPMODE_TASK, 255);
    sys_preempt(OPMODE_TASK, 0);
}