summaryrefslogtreecommitdiff
path: root/menus.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-11 09:23:09 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-11 09:23:09 -0400
commitc9b47b6f58017ce6a0ae48a454545edb4715ca7a (patch)
tree873df2844e82edf1f77c5c31a66906eb1cccbe0d /menus.c
parent959e1cf54cea0a3252c4852224a290c56c50df2a (diff)
added support for serial parameters
Diffstat (limited to 'menus.c')
-rw-r--r--menus.c70
1 files changed, 33 insertions, 37 deletions
diff --git a/menus.c b/menus.c
index 2f3ab22..58d0214 100644
--- a/menus.c
+++ b/menus.c
@@ -1575,6 +1575,7 @@ static void Submenu_Display(int change_selection)
title = g_strdup ("Baud Rate:");
Submenu_max_entry=3;
+ // FIXME: generate structure from valid baud rate list
Submenu_Structure[0]=mode_1200;
Submenu_Structure[1]=mode_2400;
Submenu_Structure[2]=mode_4800;
@@ -1953,91 +1954,91 @@ static void Submenu_Display(int change_selection)
break;
case mode_1200:
strcpy(mode_name[i],"1200 baud");
- if (globals.RS232.baud==rs232_1200_baud) {
+ if (globals.Flash.baud==1200) {
current_operating_mode=i;
}
break;
case mode_2400:
strcpy(mode_name[i],"2400 baud");
- if (globals.RS232.baud==rs232_2400_baud) {
+ if (globals.Flash.baud==2400) {
current_operating_mode=i;
}
break;
case mode_4800:
strcpy(mode_name[i],"4800 baud");
- if (globals.RS232.baud==rs232_4800_baud) {
+ if (globals.Flash.baud==4800) {
current_operating_mode=i;
}
break;
case mode_9600:
strcpy(mode_name[i],"9600 baud");
- if (globals.RS232.baud==rs232_9600_baud) {
+ if (globals.Flash.baud==9600) {
current_operating_mode=i;
}
break;
case mode_7bits:
strcpy(mode_name[i],"7 bits");
- if (globals.RS232.databits==rs232_7data_bits) {
+ if (globals.Flash.databits==7) {
current_operating_mode=i;
}
break;
case mode_8bits:
strcpy(mode_name[i],"8 bits");
- if (globals.RS232.databits==rs232_8data_bits) {
+ if (globals.Flash.databits==8) {
current_operating_mode=i;
}
break;
case mode_par_none:
strcpy(mode_name[i],"None");
- if (globals.RS232.parity==rs232_parity_none) {
+ if (globals.Flash.parity==rs232_parity_none) {
current_operating_mode=i;
}
break;
case mode_par_even:
strcpy(mode_name[i],"Even");
- if (globals.RS232.parity==rs232_parity_even) {
+ if (globals.Flash.parity==rs232_parity_even) {
current_operating_mode=i;
}
break;
case mode_par_odd:
strcpy(mode_name[i],"Odd");
- if (globals.RS232.parity==rs232_parity_odd) {
+ if (globals.Flash.parity==rs232_parity_odd) {
current_operating_mode=i;
}
break;
case mode_1bit:
strcpy(mode_name[i],"1 bit");
- if (globals.RS232.stopbits==rs232_1stop_bit) {
+ if (globals.Flash.stopbits==1) {
current_operating_mode=i;
}
break;
case mode_2bits:
strcpy(mode_name[i],"2 bits");
- if (globals.RS232.stopbits==rs232_2stop_bits) {
+ if (globals.Flash.stopbits==2) {
current_operating_mode=i;
}
break;
case mode_hand_hard:
strcpy(mode_name[i],"Hardware");
- if (globals.RS232.hardhand==rs232_hard_on) {
+ if (globals.Flash.hardhand) {
current_operating_mode=i;
}
break;
case mode_hand_off:
strcpy(mode_name[i],"None");
- if (globals.RS232.hardhand==rs232_hard_off) {
+ if (!globals.Flash.hardhand) {
current_operating_mode=i;
}
break;
case mode_echo_on:
strcpy(mode_name[i],"On");
- if (globals.RS232.echo==rs232_echo_on) {
+ if (globals.Flash.echo) {
current_operating_mode=i;
}
break;
case mode_echo_off:
strcpy(mode_name[i],"Off");
- if (globals.RS232.echo==rs232_echo_off) {
+ if (!globals.Flash.echo) {
current_operating_mode=i;
}
break;
@@ -2765,13 +2766,7 @@ static void Nonstd_menu_default_rs232(void)
LCD_write(2,0,"hardware handshaking on, and echo on.");
LCD_write(3,0,Press_Change_Message);
- globals.RS232.baud = rs232_1200_baud;
- globals.RS232.parity = rs232_parity_none;
- globals.RS232.stopbits = rs232_1stop_bit;
- globals.RS232.databits = rs232_8data_bits;
- globals.RS232.hardhand = rs232_hard_on;
- globals.RS232.echo = rs232_echo_on;
- IO_Setup_RS232();
+ IO_Setup_RS232(1200, rs232_parity_none, 1, 8, 1, 1);
Menu_Clear_Buttons();
@@ -3290,89 +3285,90 @@ static int Submenu_Implement_Changes(void)
globals.MenuStatus.Selected_Submenu=Submenu1_setup;
break;
case mode_1200:
- globals.RS232.baud = rs232_1200_baud;
+ // FIXME: check that serial menus actually work
+ IO_Setup_RS232(1200, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_2400:
- globals.RS232.baud = rs232_2400_baud;
+ IO_Setup_RS232(2400, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_4800:
- globals.RS232.baud = rs232_4800_baud;
+ IO_Setup_RS232(4800, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_9600:
- globals.RS232.baud = rs232_9600_baud;
+ IO_Setup_RS232(9600, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_databits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_7bits:
- globals.RS232.databits = rs232_7data_bits;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 7, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_parity;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_8bits:
- globals.RS232.databits = rs232_8data_bits;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 8, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_parity;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_none:
- globals.RS232.parity = rs232_parity_none;
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_none, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_odd:
- globals.RS232.parity = rs232_parity_odd;
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_odd, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_par_even:
- globals.RS232.parity = rs232_parity_even;
+ IO_Setup_RS232(globals.Flash.baud, rs232_parity_even, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_stopbits;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_1bit:
- globals.RS232.stopbits = rs232_1stop_bit;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 1, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_2bits:
- globals.RS232.stopbits = rs232_2stop_bits;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, 2, globals.Flash.databits, globals.Flash.hardhand, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_hardhand;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_hand_hard:
- globals.RS232.hardhand = rs232_hard_on;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 1, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_hand_off:
- globals.RS232.hardhand = rs232_hard_off;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, 0, globals.Flash.echo);
globals.MenuStatus.Selected_Submenu=Submenu2_rs232_echo;
call_new_submenu=YES;
Submenu_Display(NO);
break;
case mode_echo_on:
- globals.RS232.echo = rs232_echo_on;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 1);
globals.MenuStatus.Selected_Submenu=Submenu1_setup;
break;
case mode_echo_off:
- globals.RS232.echo = rs232_echo_off;
+ IO_Setup_RS232(globals.Flash.baud, globals.Flash.parity, globals.Flash.stopbits, globals.Flash.databits, globals.Flash.hardhand, 0);
globals.MenuStatus.Selected_Submenu=Submenu1_setup;
break;
}