Revisión | 3 (tree) |
---|---|
Tiempo | 2012-06-11 09:40:57 |
Autor | tekken_boss |
000.001.003: 2012/06/11 09:39 : SCI config UI function is added.
[Modification]
+ [SCI] SCI config UI function is added.
[Confirmation]
+ Compilable.
+ RX is still have problem.
@@ -15,9 +15,10 @@ | ||
15 | 15 | |
16 | 16 | #define SRCVER_MAJOR 0 |
17 | 17 | #define SRCVER_MINOR 1 |
18 | -#define SRCVER_BUILD 1 | |
18 | +#define SRCVER_BUILD 3 | |
19 | 19 | |
20 | 20 | /* -------------------------------------------------------------------- |
21 | +000.001.003: 2012/06/11 09:39 : SCI config UI function is added. | |
21 | 22 | 000.001.002: 2012/06/11 02:15 : Character code(ISO/EIA) conversion are added. |
22 | 23 | 000.001.001: 2012/06/08 14:33 : Bug related to endian calculation is fixed. |
23 | 24 | 000.001.000: 2012/06/08 01:18 : All of function was implemented anyway. |
@@ -47,6 +47,7 @@ | ||
47 | 47 | static unsigned char Cnv2Eia( unsigned char ascii_char ); |
48 | 48 | static int ui_function_serial_nop(UI_COMMAND uicmd, int param); |
49 | 49 | static int ui_function_serial_debug(UI_COMMAND uicmd, int param); |
50 | +static int ui_function_serial_config(UI_COMMAND uicmd, int param); | |
50 | 51 | |
51 | 52 | // ------------------------------------------- |
52 | 53 | // Variables |
@@ -114,19 +115,27 @@ | ||
114 | 115 | |
115 | 116 | static const MODULE_MENU_TABLE serial_app_table[] = { // interval time will be ignored. |
116 | 117 | { 0, 0, ui_function_serial_debug, " Debug ", }, |
117 | - { 2, 0, ui_function_serial_nop, " Control ", }, | |
118 | + { 2, 0, ui_function_serial_config, " Config ", }, | |
118 | 119 | { -1, 0, ui_function_serial_nop, "0123456789ABCDEF", }, |
119 | 120 | }; |
120 | 121 | |
121 | 122 | static const DEBUG_VAR_TABLE debug_var_table[] = { |
122 | - { 0, 1, "Process number: ", &serial_proc, }, | |
123 | - { 1, 1, "Error Code: ", &serial_error, }, | |
124 | - { 1, 3, "txsts.sentbytes:", &tx_status.sent_bytes, }, | |
123 | + { 0, 1, "Process number: ", &sci_setting, }, | |
124 | + { 1, 1, "Error Code: ", &sci_setting, }, | |
125 | + { 1, 3, "txsts.sentbytes:", &sci_setting, }, | |
125 | 126 | { 1, 3, "txsts.file_size:", &tx_status.file_size, }, |
126 | 127 | { 1, 4, "Receive Buffer: ", ReceiveBuf, }, |
127 | 128 | { -1, 1, "0123456789ABCDEF", 0, }, |
128 | 129 | }; |
129 | 130 | |
131 | +// Only for this table, "type" member SHOULD BE index number. | |
132 | +static const DEBUG_VAR_TABLE config_var_table[] = { | |
133 | + { 0, 0, "Speed setting : ", &sci_setting.speed_setting_index }, | |
134 | + { 1, 1, "Code setting: ", &sci_setting.code_setting_index }, | |
135 | + { 2, 2, "COM Parameter: ", &sci_setting.param_setting_index }, | |
136 | + { -1, 1, "0123456789ABCDEF", 0, }, | |
137 | +}; | |
138 | + | |
130 | 139 | // ------------------------------------------- |
131 | 140 | // Interrupt handlers (1ms) |
132 | 141 | // ------------------------------------------- |
@@ -479,6 +488,78 @@ | ||
479 | 488 | } |
480 | 489 | |
481 | 490 | // ------------------------------------------- |
491 | +// UI Function - SERIAL config | |
492 | +// ------------------------------------------- | |
493 | +static int ui_function_serial_config(UI_COMMAND uicmd, int param) { | |
494 | + static unsigned char current_index; | |
495 | + int ret_val; | |
496 | + | |
497 | + ret_val = UI_RET_READY; | |
498 | + | |
499 | + switch( uicmd.cmd ) { | |
500 | + case UI_CMD_NOP: | |
501 | + break; | |
502 | + | |
503 | + case UI_CMD_KEY_PRESS_OK: | |
504 | + if( uicmd.param == OFF_EDGE ) break; // Ignore off edge | |
505 | + switch( current_index ) { | |
506 | + case 0: | |
507 | + sci_setting.speed_setting_index++; | |
508 | + if( speed_setting[sci_setting.speed_setting_index].index == 0xFF ) | |
509 | + sci_setting.speed_setting_index = 0x01; | |
510 | + break; | |
511 | + case 1: | |
512 | + sci_setting.code_setting_index++; | |
513 | + if( code_setting[sci_setting.code_setting_index].index == 0xFF ) | |
514 | + sci_setting.code_setting_index = 0x01; | |
515 | + break; | |
516 | + case 2: | |
517 | + sci_setting.param_setting_index++; | |
518 | + if( param_setting[sci_setting.param_setting_index].index == 0xFF ) | |
519 | + sci_setting.param_setting_index = 0x01; | |
520 | + break; | |
521 | + default: | |
522 | + break; | |
523 | + } | |
524 | + break; | |
525 | + | |
526 | + case UI_CMD_INTEVAL: | |
527 | + // Title | |
528 | + sc1602_set_buffer( 0, config_var_table[current_index].display ); | |
529 | + switch( current_index ) { | |
530 | + case 0: | |
531 | + sc1602_set_buffer ( 1, speed_setting[sci_setting.speed_setting_index].Name ); | |
532 | + break; | |
533 | + case 1: | |
534 | + sc1602_set_buffer ( 1, code_setting[sci_setting.code_setting_index].Name ); | |
535 | + break; | |
536 | + case 2: | |
537 | + sc1602_set_buffer ( 1, param_setting[sci_setting.param_setting_index].Name ); | |
538 | + break; | |
539 | + } | |
540 | + break; | |
541 | + | |
542 | + case UI_CMD_STARTED: | |
543 | + current_index = 0; | |
544 | + break; | |
545 | + | |
546 | + case UI_CMD_KEY_PRESS_UP: | |
547 | + if( uicmd.param == OFF_EDGE ) break; // Ignore off edge | |
548 | + if( current_index != 0 ) current_index--; | |
549 | + break; | |
550 | + case UI_CMD_KEY_PRESS_DOWN: | |
551 | + if( uicmd.param == OFF_EDGE ) break; // Ignore off edge | |
552 | + if( config_var_table[current_index+1].num != -1 ) current_index++; | |
553 | + break; | |
554 | + case UI_CMD_KEY_PRESS_BACK: | |
555 | + if( uicmd.param == OFF_EDGE ) break; // Ignore off edge | |
556 | + ret_val = UI_RET_QUIT; | |
557 | + break; | |
558 | + } | |
559 | + return ret_val; | |
560 | +} | |
561 | + | |
562 | +// ------------------------------------------- | |
482 | 563 | // UI Sub Function - SERIAL nop |
483 | 564 | // ------------------------------------------- |
484 | 565 | static int ui_function_serial_nop(UI_COMMAND uicmd, int param) { |