main function is now executed as kosmos thread

This commit is contained in:
tkl
2016-08-20 10:24:03 +02:00
parent 2fb1904de5
commit 2e874a9d56
5 changed files with 39 additions and 29 deletions

View File

@@ -16,10 +16,7 @@
#include "list.h"
#include "shell.h"
#define TH_STACK_SIZE 256
stack_t th_stack[TH_STACK_SIZE];
struct thread_context th_ctx;
static void th_func(void *arg)
int main(void)
{
drv_open(&pwm_1);
drv_open(&pwm_2);
@@ -41,13 +38,6 @@ static void th_func(void *arg)
sleep_ms(10);
}
}
}
int main(void)
{
board_init();
thread_create(&th_ctx, th_stack, TH_STACK_SIZE, th_func, NULL, THREAD_PRIO_LOW);
schedule_start();
return 0;
}

View File

@@ -33,10 +33,12 @@ static struct command cmd = {
int main(void)
{
board_init();
shell_init(&uart_1);
shell_add_command(&cmd);
schedule_start();
while(1) {
sleep_ms(1000);
}
return 0;
}

View File

@@ -20,26 +20,13 @@
#pragma GCC diagnostic ignored "-Wmissing-declarations"
#pragma GCC diagnostic ignored "-Wreturn-type"
#define TH_STACK_SIZE 256
stack_t th_stack[TH_STACK_SIZE];
struct thread_context th_ctx;
static void th_func(void *arg)
int main(int argc, char* argv[])
{
drv_open(&uart_1);
while(1) {
drv_write(&uart_1, "test\r\n", 6);
sleep_ms(1000);
}
}
int main(int argc, char* argv[])
{
board_init();
timer_open(&timer_1);
thread_create(&th_ctx, th_stack, TH_STACK_SIZE, th_func, NULL, THREAD_PRIO_LOW);
schedule_start();
return 0;
}