Committer:
daan
Date:
Fri Dec 16 07:14:05 2011 +0000
Revision:
1:578d6bbe9f09
Parent:
0:01be2d5eaf72
Child:
2:ce4c7e5ab241

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
daan 1:578d6bbe9f09 1 #ifndef OLC_VECTOR_H
daan 1:578d6bbe9f09 2 #define OLC_VECTOR_H
daan 0:01be2d5eaf72 3
daan 0:01be2d5eaf72 4 #include "stdint.h"
daan 0:01be2d5eaf72 5
daan 0:01be2d5eaf72 6 namespace olc {
daan 1:578d6bbe9f09 7
daan 1:578d6bbe9f09 8 #define OLC_DEVICE_RECEIVING_PORT 3000
daan 1:578d6bbe9f09 9 #define OLC_DEVICE_SENDING_PORT 3001
daan 0:01be2d5eaf72 10
daan 1:578d6bbe9f09 11 /**
daan 1:578d6bbe9f09 12 * the protocol so far.
daan 1:578d6bbe9f09 13 *
daan 1:578d6bbe9f09 14 * it is packet based. packets should not be longer than 1024 bytes due to hardware
daan 1:578d6bbe9f09 15 * restrictions. We assume udp should be error free enough being the only device on the
daan 1:578d6bbe9f09 16 * cable.
daan 1:578d6bbe9f09 17
daan 1:578d6bbe9f09 18 * MOVE_TO move mirrors to position x,y
daan 1:578d6bbe9f09 19 * LINE_TO move mirrors to position x,y and laser on
daan 1:578d6bbe9f09 20 * these commands are 5 bytes long (uint8 opcode, uint16 x, uint16 y)
daan 1:578d6bbe9f09 21
daan 1:578d6bbe9f09 22 * H_MOVE_TO move mirror horizontaly to position x
daan 1:578d6bbe9f09 23 * use imagination for V_MOVE_TO, H_LINE_TO, V_LINE_TO
daan 1:578d6bbe9f09 24 * these commands are 3 bytes long (uint8 opcode, uint16 l)
daan 1:578d6bbe9f09 25
daan 1:578d6bbe9f09 26 * LASER_POWER sets the laser intensity (uint8 opcode, uint16 power)
daan 1:578d6bbe9f09 27 * we can extend if we need color.
daan 1:578d6bbe9f09 28
daan 1:578d6bbe9f09 29 * (not implemented) FAST_MODE (uint8) Sets the laser in fast mode.
daan 1:578d6bbe9f09 30 in fast mode, the motion commands will be set, and the galvo goes to the new position
daan 1:578d6bbe9f09 31 as fast as possible.
daan 1:578d6bbe9f09 32 // i guess we should have a precise timing parameters.
daan 1:578d6bbe9f09 33
daan 1:578d6bbe9f09 34 ----- slow speed ------
daan 1:578d6bbe9f09 35 * (not implemented) SLOW_MODE (uint8 opcode) (default) Sets the laser in slow mode.
daan 1:578d6bbe9f09 36 in slow mode means that we go step for step over each pixel with a line raster algorithm.
daan 1:578d6bbe9f09 37
daan 1:578d6bbe9f09 38
daan 1:578d6bbe9f09 39 * STEP_SIZE (uint8 opcode, uint16 size) sets the galvo step size when drawing lines.
daan 1:578d6bbe9f09 40 using cheap optics and a short throw the laser spot size is probably a few orders of
daan 1:578d6bbe9f09 41 maginitude larger than the theoretical step size of the galvo. This parameter allows
daan 1:578d6bbe9f09 42 you to control the step size when going slow.
daan 1:578d6bbe9f09 43
daan 1:578d6bbe9f09 44 * STEP_DELAY (uint8 opcode, uint16 delay) sets an optional delay when drawing each pixels.
daan 1:578d6bbe9f09 45 this is sometimes neccesairy for extra illumination of the surface.
daan 1:578d6bbe9f09 46 */
daan 1:578d6bbe9f09 47
daan 0:01be2d5eaf72 48 // bit 7 (128) means pen_down
daan 0:01be2d5eaf72 49 //
daan 0:01be2d5eaf72 50 // laser_power r,g,b
daan 0:01be2d5eaf72 51
daan 0:01be2d5eaf72 52
daan 1:578d6bbe9f09 53 enum PathCommands {
daan 1:578d6bbe9f09 54 E_STOP = 0, // 1 uint8 opcode
daan 1:578d6bbe9f09 55 PEN_DOWN = 128, // 1 uint8 opcode
daan 1:578d6bbe9f09 56
daan 1:578d6bbe9f09 57
daan 1:578d6bbe9f09 58 MOVE_TO = 1, // 5 uint8 opcode, uint16 x, uint16 y
daan 1:578d6bbe9f09 59 H_MOVE_TO = 2, // 3 uint8 opcode, uint16 x
daan 1:578d6bbe9f09 60 V_MOVE_TO = 3, // 3 uint8 opcode, uint16 y
daan 1:578d6bbe9f09 61
daan 1:578d6bbe9f09 62 STEP_SIZE = 10, // 3 uint8 opcode, uint16 step_size
daan 1:578d6bbe9f09 63 STEP_DELAY = 11, // 3 uint8 opcode, uint16 step_delay
daan 0:01be2d5eaf72 64
daan 1:578d6bbe9f09 65 PEN_UP = 15, // 1 uint8 opcode
daan 1:578d6bbe9f09 66 READY = 16, // 1 uint8 opcode
daan 1:578d6bbe9f09 67
daan 1:578d6bbe9f09 68 CALIBRATION_SCAN = 17, // 1 uint8 opcode uint16 top_x, uint16 left_y, uint16 bottom_x, uint16 right_y
daan 1:578d6bbe9f09 69 POINT = 18, // 1 unit8 opcode uint16 x, uint16 y
daan 1:578d6bbe9f09 70
daan 1:578d6bbe9f09 71 READ_RGB = 19, // 1 uint8 opcode uint8
daan 1:578d6bbe9f09 72
daan 1:578d6bbe9f09 73 MESSAGE = 20, // 3+x uint8 opcode, level, length of message, x bytes
daan 1:578d6bbe9f09 74 BUFFER_LEFT_REPORT = 21, // opcode, uint16_t
daan 1:578d6bbe9f09 75 WAIT = 22, // opcode, uint16t time
daan 1:578d6bbe9f09 76 AYT = 23, // are you there
daan 1:578d6bbe9f09 77
daan 1:578d6bbe9f09 78 REPORT_RGB = 25, // 1 + 3 x uint8
daan 1:578d6bbe9f09 79
daan 1:578d6bbe9f09 80 LINE_TO = PEN_DOWN + MOVE_TO, // 5 uint8 opcode, uint16 x, uint16 y
daan 1:578d6bbe9f09 81 H_LINE_TO = PEN_DOWN + H_MOVE_TO, // 3 uint8 opcode, uint16 x
daan 1:578d6bbe9f09 82 V_LINE_TO = PEN_DOWN + H_MOVE_TO, // 3 uint8 opcode, uint16 y
daan 1:578d6bbe9f09 83
daan 1:578d6bbe9f09 84 LASER_POWER = 100, // 3 uint8 opcode, uint16 power
daan 1:578d6bbe9f09 85 LASER_POWER_RGB = 101, // 4 uint8 opcode, 3x uint8 power r,g,b
daan 1:578d6bbe9f09 86
daan 1:578d6bbe9f09 87 // writing bitmaps. horizontally. based on step_size.
daan 1:578d6bbe9f09 88 BITMAPU8 = 150, // variable uint8 opcode, uint8 size, max 256 uint8 power
daan 1:578d6bbe9f09 89 // BITMAP16_RGB = 151, // 49 uint8 opcode, 16 x 3 x uint8 power r,g,b
daan 1:578d6bbe9f09 90
daan 1:578d6bbe9f09 91 NOTHING = 255
daan 1:578d6bbe9f09 92 };
daan 0:01be2d5eaf72 93
daan 0:01be2d5eaf72 94 }; // end namespace
daan 0:01be2d5eaf72 95
daan 0:01be2d5eaf72 96 #endif