summaryrefslogtreecommitdiff
path: root/device-functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'device-functions.c')
-rw-r--r--device-functions.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/device-functions.c b/device-functions.c
index 26d2a5f..0e5338a 100644
--- a/device-functions.c
+++ b/device-functions.c
@@ -4622,7 +4622,7 @@ void Main_update_shift_registers()
}
-int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo)
+int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char hardhand, char echo, gboolean update_flash)
{
// debugging
printf ("baud: %d, parity %d, stop bits %d, data bits %d, handshaking %d, echo %d\n\r",
@@ -4643,24 +4643,13 @@ int IO_Setup_RS232(int baud, char parity, char stopbits, char databits, char har
globals.Flash.hardhand = hardhand;
globals.Flash.echo = echo;
- int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.baud));
-
- eprom_loc = (char *) &(globals.Flash.parity) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.parity));
-
- eprom_loc = (char *) &(globals.Flash.stopbits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.stopbits));
-
- eprom_loc = (char *) &(globals.Flash.databits) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.databits));
-
- eprom_loc = (char *) &(globals.Flash.hardhand) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.hardhand));
-
- eprom_loc = (char *) &(globals.Flash.echo) - (char *) &(globals.Flash.flash_start);
- writeUserBlock(&globals.Flash, eprom_loc, sizeof(globals.Flash.echo));
+ if (update_flash) {
+ int size = sizeof(globals.Flash.baud) + sizeof(globals.Flash.parity) + sizeof(globals.Flash.stopbits) +
+ sizeof(globals.Flash.databits) + sizeof(globals.Flash.hardhand) + sizeof(globals.Flash.echo);
+ int eprom_loc = (char *) &(globals.Flash.baud) - (char *) &(globals.Flash.flash_start);
+ writeUserBlock(&globals.Flash, eprom_loc, size);
+ }
return OK;
} else {
return HardwareError;