From 5a3e96bef31959a287b8696778d7d8cf911a7dc4 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 13 Aug 2011 18:36:18 -0700 Subject: altosui: Clean up eeprom parsing a bit Export basic parsing and checksum functions for shared use. Create 'erased' function to check a chunk of eeprom data for data. Signed-off-by: Keith Packard --- altosui/AltosEepromChunk.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'altosui/AltosEepromChunk.java') diff --git a/altosui/AltosEepromChunk.java b/altosui/AltosEepromChunk.java index 1e42077f..fb632a3f 100644 --- a/altosui/AltosEepromChunk.java +++ b/altosui/AltosEepromChunk.java @@ -52,6 +52,13 @@ public class AltosEepromChunk { return data[offset] | (data[offset + 1] << 8); } + boolean erased(int start, int len) { + for (int i = 0; i < len; i++) + if (data[start+i] != 0xff) + return false; + return true; + } + public AltosEepromChunk(AltosSerial serial_line, int block) throws TimeoutException, InterruptedException { -- cgit v1.2.3