- Akku Tests und Balkonkraftwerk Speicher         
Ergebnis 1 bis 10 von 33

Thema: C/C++ lib für Sonderzeichenkombinationen (F1-12, +shift, alt, ctrl) als Scancode

Baum-Darstellung

Vorheriger Beitrag Vorheriger Beitrag   Nächster Beitrag Nächster Beitrag
  1. #27
    HaWe
    Gast
    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:


    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;
    }
    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.

    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, &param);
       
        pthread_create(&thread1, NULL, thread1Go, NULL);     // low priority: keyboard monitoring (stop program)
        param.sched_priority = 20;
        pthread_setschedparam(thread1, SCHED_RR, &param);
       
        pthread_create(&thread2, NULL, thread2Go, NULL);     // medium  priority: motor control
        param.sched_priority = 40;
        pthread_setschedparam(thread2, SCHED_RR, &param);
       
        pthread_create(&thread3, NULL, thread3Go, NULL);     // highest priority: encoder reading     
        param.sched_priority = 80;
        pthread_setschedparam(thread3, SCHED_FIFO, &param);
       
        pthread_create(&thread4, NULL, thread4Go, NULL);     // medium priority:  UART comm   <<< test !!
        param.sched_priority = 40;
        pthread_setschedparam(thread4, SCHED_FIFO, &param);
       
        pthread_create(&thread5, NULL, thread5Go, NULL);     // medium priority: navigation
        param.sched_priority = 40;
        pthread_setschedparam(thread1, SCHED_FIFO, &param);
       
       //... **SNIP**
    
    }
    Geändert von HaWe (05.04.2016 um 20:41 Uhr)

Ähnliche Themen

  1. Antworten: 10
    Letzter Beitrag: 01.11.2017, 12:53
  2. Neue Atmega "A" und "PA" Typen
    Von AVR168 im Forum Basic-Programmierung (Bascom-Compiler)
    Antworten: 2
    Letzter Beitrag: 07.05.2012, 16:47
  3. Antworten: 2
    Letzter Beitrag: 15.06.2011, 21:18
  4. "Lichtverfolgung" in "TV-Remote" einbaue
    Von fabqu im Forum Robby RP6
    Antworten: 3
    Letzter Beitrag: 04.01.2011, 10:14
  5. "Soft-Reset?" und "Finger-Interrupt?"
    Von trapperjohn im Forum Asuro
    Antworten: 8
    Letzter Beitrag: 10.06.2008, 23:02

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

fchao-Sinus-Wechselrichter AliExpress