#include "uos.h"
#include "board.h"
#include "sysdef.h"
#include "task_led.h"
#include "task_tty.h"
int main(void)
{
board_init();
uos_kernel_init();
uos_task_setup(SYSDEF_TASK_ID_LED, task_led, SYSDEF_TASK_PRIORITY_LED);
uos_task_setup(SYSDEF_TASK_ID_TTY, task_tty, SYSDEF_TASK_PRIORITY_TTY);
uos_kernel_start();
return 0;
}
#include "uos.h"
#include "board.h"
#include "sysdef.h"
#include "task_led.h"
void task_led(void)
{
while (1) {
#if (UOSDEF_USE_EVENT)
TASKID tid;
unsigned int value;
uos_task_event_recv(&tid, &value);
switch (value) {
case 0xAA:
board_led(1);
break;
case 0x55:
board_led(0);
break;
default:
break;
}
#else
board_led(1);
uos_task_sleep(500);
board_led(0);
uos_task_sleep(500);
#endif
}
}
void task_led_api_led_on(void)
{
#if (UOSDEF_USE_EVENT)
uos_task_event_send(SYSDEF_TASK_ID_LED, 0xAA);
#endif
}
void task_led_api_led_off(void)
{
#if (UOSDEF_USE_EVENT)
uos_task_event_send(SYSDEF_TASK_ID_LED, 0x55);
#endif
}
#include "uos.h"
#include "board.h"
#include "task_tty.h"
#include "task_led.h"
static void my_puts(char *p)
{
while (*p) {
while (board_uart_putc(*p) != *p) {
}
p++;
}
}
void task_tty(void)
{
int led = 0;
uos_time_t ut_kernel, ut_task;
while (1) {
led = !led;
if (led) {
my_puts("LED[On ] \r\n");
task_led_api_led_on();
} else {
my_puts("LED[Off] \r\n");
task_led_api_led_off();
}
uos_task_sleep(500);
#if (UOSDEF_USE_TIME)
uos_time_kernel(&ut_kernel);
uos_time_task(&ut_task);
#endif
}
}
Debug configuration | Release configuration |
---|---|
text data bss dec hex filename 3508 4 596 4108 100c UOS-LPC800.axf |
text data bss dec hex filename 2088 4 596 2688 a80 UOS-LPC800.axf |
Debug configuration | Release configuration |
---|---|
text data bss dec hex filename 4020 4 632 4656 1230 UOS-LPC800.axf |
text data bss dec hex filename 2296 4 632 2932 b74 UOS-LPC800.axf |
Debug configuration | Release configuration |
---|---|
text data bss dec hex filename 4072 4 656 4732 127c UOS-LPC800.axf |
text data bss dec hex filename 2324 4 656 2984 ba8 UOS-LPC800.axf |
Debug configuration | Release configuration |
---|---|
text data bss dec hex filename 4400 4 656 5060 13c4 UOS-LPC800.axf |
text data bss dec hex filename 2476 4 656 3136 c40 UOS-LPC800.axf |
Debug configuration | Release configuration |
---|---|
text data bss dec hex filename 3504 4 576 4084 ff4 UOS-LPC800.axf |
text data bss dec hex filename 2272 4 576 2852 b24 UOS-LPC800.axf |