war ein copy + paste Fehler mit den #includes.
Leider verstehe ich deinen Code nicht, es muss in meinen Task reinpassen, der läuft mit mittlerer prio, und darum geht es ja letztendlich:
Das auslesen müsste darin laufen, und die Art der gedrückten Taste könnte genau wie meine Meldungen bei ESC (analog per printf) in der Konsole angezeigt werden.Code:void* thread1Go(void *) // medium priority: keyboard + heartbeat monitoring { int c; // keyboard key while(_TASKS_ACTIVE_) { c=0; if (kbhit()) { // <<<<<<<<<<<<<<<<<< c = getchar(); if( c==27 ) { // ESC to quit program printf("\n\n ESC pressed - program terminated by user \n"); _TASKS_ACTIVE_=0; // semaphore to stop all tasks printf("\n wait for tasks to join main()... \n\n"); return NULL; } else if( ) { } //<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< dein Code } //... ***SNIP*** delay(50); } return NULL; }
Konsolenprogramm soll nicht sein, ist meines auch nicht!
http://www.mindstormsforum.de/viewto...p=69043#p69089
Code:int main() { char sbuf[128]; int err; // **SNIP** pthread_t thread0, thread1, thread2, thread3, thread4, thread5; struct sched_param param; pthread_create(&thread0, NULL, thread0Go, NULL); // lowest priority task: screen output param.sched_priority = 10; pthread_setschedparam(thread0, SCHED_RR, ¶m); pthread_create(&thread1, NULL, thread1Go, NULL); // low priority: keyboard monitoring (stop program) param.sched_priority = 20; pthread_setschedparam(thread1, SCHED_RR, ¶m); pthread_create(&thread2, NULL, thread2Go, NULL); // medium priority: motor control param.sched_priority = 40; pthread_setschedparam(thread2, SCHED_RR, ¶m); pthread_create(&thread3, NULL, thread3Go, NULL); // highest priority: encoder reading param.sched_priority = 80; pthread_setschedparam(thread3, SCHED_FIFO, ¶m); pthread_create(&thread4, NULL, thread4Go, NULL); // medium priority: UART comm <<< test !! param.sched_priority = 40; pthread_setschedparam(thread4, SCHED_FIFO, ¶m); pthread_create(&thread5, NULL, thread5Go, NULL); // medium priority: navigation param.sched_priority = 40; pthread_setschedparam(thread1, SCHED_FIFO, ¶m); //... **SNIP** }







Zitieren

Lesezeichen