From 47bc6747c9e35b7a077b374d92e79d4f9e40c9f8 Mon Sep 17 00:00:00 2001 From: Simon Fortier Date: Fri, 10 Nov 2017 21:32:55 -0500 Subject: [PATCH] Created Hardware: LiDAR (markdown) --- Hardware:-LiDAR.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Hardware:-LiDAR.md diff --git a/Hardware:-LiDAR.md b/Hardware:-LiDAR.md new file mode 100644 index 0000000..f3e5240 --- /dev/null +++ b/Hardware:-LiDAR.md @@ -0,0 +1,35 @@ +Bexsh Optics's LiDAR device is used to accurately map the area around your Cubot. It is equipped with an on board path finding module and is able to detect underground resources such as iron or copper. + +### Specifications +Manufacturer: Bexsh Optics +Version: 1.0B +Default address: `0x0003` +Hardware ID: `0x0003` + +### Interrupt Behavior +| Value of A | Action | Energy cost | Result | +| --- | --- | --- | --- | +| `1` | `GET_POS` | `0 kJ` | Get the current (x,y) coordinates in the World | +| `2` | `GET_PATH` | `50 kJ` | Calculate the shortest path to the specified coordinates and copy it to memory| +| `3` | `GET_MAP` | `10 kJ` | Generate the current World's map and copy it to memory | + +`GET_PATH` Generates a path as a direction sequence of 1 word each starting at memory address `0x0000` +`GET_MAP` Generates a map of the current world as a tile sequence of 256 words starting at memory address `0x0100`, each word representing a tile. The LiDAR starts reading the tiles west to east, north to south: (0,0) (1,0) (2,0) ... (15,0) (0,1) (1,1) ... + +Each tile is is encoded as a bit field: +`1000 0000 0000 0000` (`0x8000`) : Blocked (wall) tile +`0100 0000 0000 0000` (`0x4000`) : Biomass +`0010 0000 0000 0000` (`0x2000`) : +`0001 0000 0000 0000` (`0x1000`) : +`0000 1000 0000 0000` (`0x0800`) : +`0000 0100 0000 0000` (`0x0400`) : +`0000 0010 0000 0000` (`0x0200`) : Iron tile +`0000 0001 0000 0000` (`0x0100`) : Copper tile +`0000 0000 1000 0000` (`0x0080`) : Cubot +`0000 0000 0100 0000` (`0x0040`) : +`0000 0000 0010 0000` (`0x0020`) : +`0000 0000 0001 0000` (`0x0010`) : +`0000 0000 0000 1000` (`0x008`) : +`0000 0000 0000 0100` (`0x004`) : +`0000 0000 0000 0010` (`0x002`) : +`0000 0000 0000 0001` (`0x001`) : \ No newline at end of file