1
0
Эх сурвалжийг харах

Add basic command generation

Baglio Tabifata 4 жил өмнө
parent
commit
c6ad8d7287

+ 3 - 1
src/net/hkzlab/dupal/App.java

@@ -1,7 +1,9 @@
 package net.hkzlab.dupal;
 
+import net.hkzlab.dupal.dupalproto.DuPALProto;
+
 public class App {
     public static void main(String[] args) throws Exception {
-        System.out.println("Hello, World!");
+        System.out.println(DuPALProto.buildWRITECommand(0xAABBCCDD));
     }
 }

+ 9 - 9
src/net/hkzlab/dupal/dupalproto/DuPALProto.java

@@ -1,21 +1,21 @@
 package net.hkzlab.dupal.dupalproto;
 
 public class DuPALProto {
-    private static char CMD_START = '>';
-    private static char CMD_END = '<';
+    private static String CMD_START = ">";
+    private static String CMD_END = "<";
 
-    private static char CMD_WRITE = 'W';
-    private static char CMD_READ = 'R';
-    private static char CMD_EXIT = 'X';
-    private static char CMD_RESET = 'K';
+    private static String CMD_WRITE = "W";
+    private static String CMD_READ = "R";
+    private static String CMD_EXIT = "X";
+    private static String CMD_RESET = "K";
 
     private static String CMD_RESP_ERROR = "CMD_ERROR";
 
     public static String buildREADCommand() {
-        return null;
+        return CMD_START+CMD_READ+CMD_END;
     }
 
-    public static String buildWRITECommand(long address) {
-        return null;
+    public static String buildWRITECommand(int address) {
+        return CMD_START+CMD_WRITE+" "+String.format("%08X", address & 0x3FFFF)+CMD_END;
     }
 }