Root/
| Source at commit 121acf6ffad8f1bcd4b08e50e293e597880b68eb created 10 years 11 months ago. By Werner Almesberger, tornado/cpu/cpu.brd: make connection to the MCU's GND pad straighter | |
|---|---|
| 1 | /* |
| 2 | * fw/proto.h - Wireless protocol constants |
| 3 | * |
| 4 | * Written 2012 by Werner Almesberger |
| 5 | * Copyright 2012 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #ifndef PROTO_H |
| 14 | #define PROTO_H |
| 15 | |
| 16 | #include <stdint.h> |
| 17 | |
| 18 | |
| 19 | #define PAYLOAD 64 /* most messages use a fixed 64 bytes payload */ |
| 20 | |
| 21 | enum pck_type { |
| 22 | PING = 0, /* version query */ |
| 23 | PONG = 1, /* version response */ |
| 24 | RESET = 2, /* reset to boot loader */ |
| 25 | FIRMWARE = 4, /* firmware upload */ |
| 26 | FIRMWARE_ACK = 5, /* firmware upload acknowledgement */ |
| 27 | IMAGE = 6, /* image upload */ |
| 28 | IMAGE_ACK = 7, /* image upload acknowledgement */ |
| 29 | PARAM = 8, /* parameter upload */ |
| 30 | PARAM_ACK = 9, /* parameter upload acknowledgement */ |
| 31 | SAMPLE = 10, /* start/stop sampling */ |
| 32 | SAMPLE_ACK = 11, /* start/stop sampling acknowledgement */ |
| 33 | SAMPLES = 13, /* samples */ |
| 34 | DIAG = 14, /* diagnostic request */ |
| 35 | DIAG_ACK = 15, /* diagnostic response */ |
| 36 | |
| 37 | }; |
| 38 | |
| 39 | |
| 40 | #define MAX_LINES 80 |
| 41 | |
| 42 | #define DIAG_SAMPLES 4 |
| 43 | |
| 44 | #define XA_HIGH_DEFAULT 850 |
| 45 | #define XA_LOW_DEFAULT 170 |
| 46 | |
| 47 | #define PX_FWD_LEFT_DEFAULT 0 |
| 48 | #define PX_FWD_RIGHT_DEFAULT (MAX_LINES-1) |
| 49 | #define PX_BWD_LEFT_DEFAULT 0 |
| 50 | #define PX_BWD_RIGHT_DEFAULT (MAX_LINES-1) |
| 51 | |
| 52 | #define TP_FWD_START_DEFAULT 70000 /* 70 ms */ |
| 53 | #define TP_BWD_START_DEFAULT 70000 /* 70 ms */ |
| 54 | #define TP_FWD_PIX_DEFAULT 1100 /* 1.1 ms */ |
| 55 | #define TP_BWD_PIX_DEFAULT 1100 /* 1.1 ms */ |
| 56 | |
| 57 | |
| 58 | struct params { |
| 59 | /* Accelerator thresholds */ |
| 60 | |
| 61 | uint16_t xa_high; /* X acceleration high threshold */ |
| 62 | uint16_t xa_low; /* X acceleration low threshold */ |
| 63 | |
| 64 | /* Pixel offsets (in image) */ |
| 65 | |
| 66 | uint8_t px_fwd_left; /* first column in forward move */ |
| 67 | uint8_t px_fwd_right; /* last column in forward move */ |
| 68 | uint8_t px_bwd_left; /* last (low) column in backward move */ |
| 69 | uint8_t px_bwd_right; /* first (high) col. in backward move */ |
| 70 | |
| 71 | /* Timer periods, for imaging */ |
| 72 | |
| 73 | uint32_t tp_fwd_start; /* forward image start */ |
| 74 | uint32_t tp_bwd_start; /* backward image start */ |
| 75 | uint16_t tp_fwd_pix; /* pixel size in forward move */ |
| 76 | uint16_t tp_bwd_pix; /* pixel size in backward move */ |
| 77 | }; |
| 78 | |
| 79 | #endif /* !PROTO_H */ |
| 80 | |
Branches:
master
tornado-v1
