📄 menus.lst
字号:
356 4 printf(" -"); // Node
357 4 printf(" --"); // DIR
358 4 printf(" -----"); // ID
359 4 printf(" -----"); // Mask
360 4 printf(" --------"); // Data
361 4 }
362 3
363 3 MoveCursor(CursorPosY, CursorPosX);
364 3
365 3 }
C166 COMPILER V6.02, MENUS 08/28/2006 10:05:57 PAGE 7
366 2 }
367 1 }
368
369 void MenuHandler(void)
370 {
371 1 unsigned int key;
372 1 volatile unsigned int i;
373 1 static unsigned int mo;
374 1 // TCAN_SWObj SW_MO;
375 1
376 1 _atomic_(0);
377 1 i = WriteIndex;
378 1 _endatomic_();
379 1 if(i != ReadIndex)
380 1 {
381 2 key = KeyBuf[ReadIndex++];
382 2 if (ReadIndex == 12)
383 2 ReadIndex = 0;
384 2
385 2 switch (MenuID)
386 2 {
387 3 case 0:
388 3 if(key== 'T' || key == 't')
389 3 {
390 4 putchar(key);
391 4 PrintPrompt(1,mo);
392 4 MenuID = 1;
393 4 }
394 3 else if(key == 'E' || key == 'e')
395 3 {
396 4 PrintPrompt(2,0);
397 4 MenuID = 2;
398 4 }
399 3 else if (key == 'R' || key == 'r')
400 3 {
401 4 printf("\033[2J"); // Clear Screen
402 4 printf("MO: Node: DIR: ID: Mask: Data: MO: Node: DIR: ID: Mask: Data:\n");
403 4 for (i = 0; i<32; i++)
404 4 {
405 5 MO_Status[i] = 1;
406 5 }
407 4 PrintPrompt(0,mo);
408 4 }
409 3 break;
410 3 case 1:
411 3 if (key == 27) // Escape
412 3 {
413 4 PrintPrompt(0,mo);
414 4 MenuID = 0;
415 4 }
416 3 if (digit_index)
417 3 {
418 4 if (key == 8) // Backspace
419 4 {
420 5 MoveCursor(CursorPosY, --CursorPosX);
421 5 putchar(' ');
422 5 MoveCursor(CursorPosY, CursorPosX);
423 5 digits[--digit_index] = 0;
424 5 }
425 4 }
426 3 if(digit_index < 3)
427 3 {
C166 COMPILER V6.02, MENUS 08/28/2006 10:05:57 PAGE 8
428 4 if (digit_index)
429 4 {
430 5 if (key == 13) //Enter
431 5 {
432 6 if (digit_index == 1)
433 6 {
434 7 mo = (digits[0]-0x30);
435 7 CAN_HWOBJ[mo].uwMSGCTR = 0xe7ff;; // Transmit MO (digits[0]-0x30)
436 7 }
437 6 else
438 6 {
439 7 mo = 10*((unsigned int)digits[0]-0x30) + (unsigned int)digits[1]-0x30;
440 7 if (mo <32)
441 7 CAN_HWOBJ[mo].uwMSGCTR = 0xe7ff;; // Transmit MO 10*(digits[0]-0x30) + digits[1]-0x30
442 7 }
443 6 PrintPrompt(0,mo);
444 6 MenuID = 0;
445 6 }
446 5 }
447 4 if (digit_index < 2)
448 4 {
449 5 if ( (key < ';') && (key > '/') ) // digit
450 5 {
451 6 putchar(key);
452 6 CursorPosX++;
453 6 digits[digit_index++] = key;
*** WARNING C192 IN LINE 453 OF MENUS.C: '=': value truncated
454 6 }
455 5 }
456 4 }
457 3
458 3 break;
459 3 case 2:
460 3 if (key == 27) // Escape
461 3 {
462 4 PrintPrompt(0,mo);
463 4 MenuID = 0;
464 4 }
465 3 if (digit_index)
466 3 {
467 4 if (key == 8) // backspace
468 4 {
469 5 MoveCursor(CursorPosY, --CursorPosX);
470 5 putchar(' ');
471 5 MoveCursor(CursorPosY, CursorPosX);
472 5 digits[--digit_index] = 0;
473 5 }
474 4 }
475 3 if(digit_index < 3)
476 3 {
477 4 if (digit_index)
478 4 {
479 5 if (key == 13) //Enter
480 5 {
481 6 if (digit_index == 1)
482 6 {
483 7 mo = (digits[0]-0x30);
484 7 }
485 6 else
486 6 {
487 7 mo = 10*(digits[0]-0x30) + digits[1]-0x30;
488 7 }
C166 COMPILER V6.02, MENUS 08/28/2006 10:05:57 PAGE 9
489 6 PrintPrompt(3, mo);
490 6 MenuID = 3;
491 6 }
492 5 }
493 4 if (digit_index < 2)
494 4 {
495 5 if ( (key < ';') && (key > '/') ) // digit
496 5 {
497 6 putchar(key);
498 6 CursorPosX++;
499 6 digits[digit_index++] = key;
*** WARNING C192 IN LINE 499 OF MENUS.C: '=': value truncated
500 6 }
501 5 }
502 4 }
503 3
504 3 break;
505 3 case 3:
506 3 if (key == 27) // Escape
507 3 {
508 4 PrintPrompt(2,mo);
509 4 MenuID = 2;
510 4 }
511 3 else if (key == 'N' || key == 'n')
512 3 {
513 4 PrintPrompt(4, mo);
514 4 MenuID = 4;
515 4 }
516 3 else if (key == 'R' || key == 'r')
517 3 {
518 4 if (CAN_HWOBJ[mo].uwMSGCTR & 0x0080) // if MO valid
519 4 {
520 5 CAN_HWOBJ[mo].uwMSGCTR = 0xff7f; // disable MO
521 5 CAN_HWOBJ[mo].uwMSGCFG &= ~0x0008; // Set to dir to rx
522 5 CAN_HWOBJ[mo].uwMSGCTR = 0xffbf; // enable MO
523 5 }
524 4 else // if MO invalid
525 4 {
526 5 CAN_HWOBJ[mo].uwMSGCFG &= ~0x0008; // Set to dir to rx
527 5 }
528 4 PrintPrompt(3,mo);
529 4 MenuID = 3;
530 4 MO_Status[mo]=1;
531 4 UpdateStatus();
532 4 }
533 3 else if (key == 'T' || key == 't')
534 3 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -