• R/O
  • SSH
  • HTTPS

panda-p: Commit


Commit MetaInfo

Revisión3 (tree)
Tiempo2012-06-11 09:40:57
Autortekken_boss

Log Message

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.

Cambiar Resumen

Diferencia incremental

--- trunk/src/srcver.h (revision 2)
+++ trunk/src/srcver.h (revision 3)
@@ -15,9 +15,10 @@
1515
1616 #define SRCVER_MAJOR 0
1717 #define SRCVER_MINOR 1
18-#define SRCVER_BUILD 1
18+#define SRCVER_BUILD 3
1919
2020 /* --------------------------------------------------------------------
21+000.001.003: 2012/06/11 09:39 : SCI config UI function is added.
2122 000.001.002: 2012/06/11 02:15 : Character code(ISO/EIA) conversion are added.
2223 000.001.001: 2012/06/08 14:33 : Bug related to endian calculation is fixed.
2324 000.001.000: 2012/06/08 01:18 : All of function was implemented anyway.
--- trunk/src/serial.c (revision 2)
+++ trunk/src/serial.c (revision 3)
@@ -47,6 +47,7 @@
4747 static unsigned char Cnv2Eia( unsigned char ascii_char );
4848 static int ui_function_serial_nop(UI_COMMAND uicmd, int param);
4949 static int ui_function_serial_debug(UI_COMMAND uicmd, int param);
50+static int ui_function_serial_config(UI_COMMAND uicmd, int param);
5051
5152 // -------------------------------------------
5253 // Variables
@@ -114,19 +115,27 @@
114115
115116 static const MODULE_MENU_TABLE serial_app_table[] = { // interval time will be ignored.
116117 { 0, 0, ui_function_serial_debug, " Debug ", },
117- { 2, 0, ui_function_serial_nop, " Control ", },
118+ { 2, 0, ui_function_serial_config, " Config ", },
118119 { -1, 0, ui_function_serial_nop, "0123456789ABCDEF", },
119120 };
120121
121122 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, },
125126 { 1, 3, "txsts.file_size:", &tx_status.file_size, },
126127 { 1, 4, "Receive Buffer: ", ReceiveBuf, },
127128 { -1, 1, "0123456789ABCDEF", 0, },
128129 };
129130
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+
130139 // -------------------------------------------
131140 // Interrupt handlers (1ms)
132141 // -------------------------------------------
@@ -479,6 +488,78 @@
479488 }
480489
481490 // -------------------------------------------
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+// -------------------------------------------
482563 // UI Sub Function - SERIAL nop
483564 // -------------------------------------------
484565 static int ui_function_serial_nop(UI_COMMAND uicmd, int param) {
Show on old repository browser