diff options
author | px4dev <px4@purgatory.org> | 2012-10-01 00:02:38 -0700 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2012-10-01 00:02:38 -0700 |
commit | 93c200d281e7488db95806840a6976b02d1afbe0 (patch) | |
tree | 606a24e6778f54c3d7fa9939f303d89f76161d4e /apps/systemcmds | |
parent | 6005077d54e6b96a5284752eedbd026ef7952341 (diff) | |
download | px4-firmware-93c200d281e7488db95806840a6976b02d1afbe0.tar.gz px4-firmware-93c200d281e7488db95806840a6976b02d1afbe0.tar.bz2 px4-firmware-93c200d281e7488db95806840a6976b02d1afbe0.zip |
Add new 'task_spawn' interface for starting new tasks in the PX4 world
Diffstat (limited to 'apps/systemcmds')
-rw-r--r-- | apps/systemcmds/led/led.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/apps/systemcmds/led/led.c b/apps/systemcmds/led/led.c index a6d73210a..da0d99964 100644 --- a/apps/systemcmds/led/led.c +++ b/apps/systemcmds/led/led.c @@ -53,6 +53,9 @@ #include <arch/board/up_hrt.h> #include <arch/board/drv_led.h> +#include <systemlib/err.h> +#include <systemlib/systemlib.h> + __EXPORT int led_main(int argc, char *argv[]); @@ -61,7 +64,7 @@ static bool thread_running = false; /**< Deamon status flag */ static int led_task; /**< Handle of deamon task / thread */ static int leds; -static int led_init() +static int led_init(void) { leds = open("/dev/led", O_RDONLY | O_NONBLOCK); @@ -76,7 +79,7 @@ static int led_init() return 0; } -static void led_deinit() +static void led_deinit(void) { close(leds); } @@ -144,7 +147,12 @@ int led_main(int argc, char *argv[]) } thread_should_exit = false; - led_task = task_create("led", SCHED_PRIORITY_MAX - 15, 4096, led_thread_main, (argv) ? (const char **)&argv[2] : (const char **)NULL); + led_task = task_spawn("led", + SCHED_RR, + SCHED_PRIORITY_MAX - 15, + 4096, + led_thread_main, + (argv) ? (const char **)&argv[2] : (const char **)NULL); thread_running = true; exit(0); } |