The last version programs

Dependencies:   mbed TrapezoidControl Pulse QEI

Committer:
Ryosei
Date:
Fri Mar 27 14:03:12 2020 +0000
Revision:
30:76b140d176f0
Parent:
29:5365ee0521f6
h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
t_yamamoto 0:669ef71cba68 1 #ifndef PROCESS_H_
t_yamamoto 0:669ef71cba68 2 #define PROCESS_H_
t_yamamoto 0:669ef71cba68 3
t_yamamoto 0:669ef71cba68 4 #include "mbed.h"
t_yamamoto 0:669ef71cba68 5
M_souta 22:7d93f79a3686 6 #define BUZZER_PIN PB_3
kishibekairohan 16:3f2c2d89372b 7 #define EMG_0 LimitSw::IsPressed(0)
kishibekairohan 16:3f2c2d89372b 8 #define EMG_1 LimitSw::IsPressed(1)
kishibekairohan 12:c09b3e08a316 9
kishibekairohan 16:3f2c2d89372b 10 void SystemProcess();
t_yamamoto 0:669ef71cba68 11
M_souta 25:b3a9f34b201d 12 /* ---------- motor ---------- */
M_souta 25:b3a9f34b201d 13
M_souta 22:7d93f79a3686 14 #define TIRE_FL 0
M_souta 25:b3a9f34b201d 15 #define TIRE_BL 1
M_souta 22:7d93f79a3686 16 #define TIRE_BR 2
M_souta 25:b3a9f34b201d 17 #define TIRE_FR 3
M_souta 21:e3b58d675c1c 18 #define LIFT_LB 4
Ryosei 29:5365ee0521f6 19 #define LIFT_RB 6
Ryosei 29:5365ee0521f6 20 #define LIFT_U 5
M_souta 21:e3b58d675c1c 21
M_souta 25:b3a9f34b201d 22 /* ---------- motor ---------- */
M_souta 25:b3a9f34b201d 23
M_souta 25:b3a9f34b201d 24 /* ---------- limitswitch ---------- */
M_souta 25:b3a9f34b201d 25
Ryosei 27:dd9f27fce7d1 26 #define LSW_LB 3 // 上下1段目 左 リミット
Ryosei 27:dd9f27fce7d1 27 #define LSW_RB 8 // 上下1段目 右 リミット
M_souta 25:b3a9f34b201d 28 #define LSW_UU 2 // 上下2段目 上 リミット
Ryosei 27:dd9f27fce7d1 29 #define LSW_UB 16 // 上下2段目 下 リミット
M_souta 25:b3a9f34b201d 30 #define TOW_1L 4 // タオル1 左 リミット
M_souta 25:b3a9f34b201d 31 #define TOW_1R 5 // タオル1 右 リミット
M_souta 25:b3a9f34b201d 32 #define TOW_2L 6 // タオル2 左 リミット
M_souta 25:b3a9f34b201d 33 #define TOW_2R 7 // タオル2 右 リミット
Ryosei 27:dd9f27fce7d1 34 #define LEFTlim 0
Ryosei 27:dd9f27fce7d1 35 #define RIGHTlim 1
M_souta 25:b3a9f34b201d 36
Ryosei 27:dd9f27fce7d1 37 #define SETTING_SW 10 // セッティングタイム用
M_souta 25:b3a9f34b201d 38 #define QF_SW 9 // 予選・決勝 切り替え
Ryosei 27:dd9f27fce7d1 39 #define UNFOLD_ZYOUGE_SW 11 // タオルセット用の展開
Ryosei 27:dd9f27fce7d1 40 //#define TOWEL1_SW 11 // タオル1 切り替え
M_souta 25:b3a9f34b201d 41 #define REDBLUE_SW 12 // 赤青 切り替え
Ryosei 27:dd9f27fce7d1 42 #define SHEETS_SW 13 // シーツのみモード
Ryosei 27:dd9f27fce7d1 43 #define UNFOLD_TOWL_SW 14
M_souta 25:b3a9f34b201d 44 #define START_SW 15 // スタートボタン
M_souta 21:e3b58d675c1c 45
M_souta 25:b3a9f34b201d 46 /* ---------- limitswitch ---------- */
M_souta 21:e3b58d675c1c 47
M_souta 25:b3a9f34b201d 48 /* ---------- linetrace ---------- */
M_souta 25:b3a9f34b201d 49
M_souta 25:b3a9f34b201d 50 #define LINE_FRONT 0
M_souta 25:b3a9f34b201d 51 #define LINE_BACK 2
M_souta 25:b3a9f34b201d 52 #define LINE_LEFT 3
M_souta 25:b3a9f34b201d 53 #define LINE_RIGHT 4
M_souta 25:b3a9f34b201d 54 #define LINE_TOW_1 5
M_souta 25:b3a9f34b201d 55 #define LINE_TOW_2 6
M_souta 25:b3a9f34b201d 56
M_souta 25:b3a9f34b201d 57 /* ---------- linetrace ---------- */
M_souta 25:b3a9f34b201d 58
M_souta 25:b3a9f34b201d 59 /* ---------- solenoid ---------- */
M_souta 25:b3a9f34b201d 60
Ryosei 27:dd9f27fce7d1 61 #define TOWEL0 3
Ryosei 27:dd9f27fce7d1 62 // タオル横 展開
Ryosei 27:dd9f27fce7d1 63 #define TOWEL1 0 // タオル1
Ryosei 27:dd9f27fce7d1 64 #define TOWEL2 1 // タオル2
Ryosei 27:dd9f27fce7d1 65 #define CLOTHESPIN 2 // シーツの洗濯ばさみ
M_souta 25:b3a9f34b201d 66
M_souta 25:b3a9f34b201d 67 /* ---------- solenoid ---------- */
M_souta 21:e3b58d675c1c 68
Ryosei 27:dd9f27fce7d1 69 #define ECHO_0 PC_3
Ryosei 27:dd9f27fce7d1 70 #define ECHO_1 PC_1
Ryosei 27:dd9f27fce7d1 71
Ryosei 27:dd9f27fce7d1 72 #define TRIG_0 PC_0
Ryosei 27:dd9f27fce7d1 73 #define TRIG_1 PB_0
M_souta 21:e3b58d675c1c 74
Ryosei 27:dd9f27fce7d1 75 #define SELECT_1 PB_8//LS18
Ryosei 27:dd9f27fce7d1 76 #define SELECT_2 PC_9//LS19
Ryosei 27:dd9f27fce7d1 77 #define SELECT_3 PC_8//LS20
M_souta 21:e3b58d675c1c 78
M_souta 21:e3b58d675c1c 79
kishibekairohan 11:028a150943b5 80 typedef union
kishibekairohan 11:028a150943b5 81 {
kishibekairohan 11:028a150943b5 82 struct
kishibekairohan 11:028a150943b5 83 {
kishibekairohan 11:028a150943b5 84 unsigned int blue : 8;
kishibekairohan 11:028a150943b5 85 unsigned int green : 8;
kishibekairohan 11:028a150943b5 86 unsigned int red : 8;
kishibekairohan 11:028a150943b5 87 unsigned int : 8;
kishibekairohan 11:028a150943b5 88 };
kishibekairohan 11:028a150943b5 89 uint32_t code;
kishibekairohan 11:028a150943b5 90 } TapeLedData;
kishibekairohan 11:028a150943b5 91
kishibekairohan 11:028a150943b5 92 enum TapeLED_Mode
kishibekairohan 11:028a150943b5 93 {
kishibekairohan 11:028a150943b5 94 EMS,
kishibekairohan 11:028a150943b5 95 Normal,
kishibekairohan 11:028a150943b5 96 Launch,
kishibekairohan 11:028a150943b5 97 };
kishibekairohan 11:028a150943b5 98
kishibekairohan 11:028a150943b5 99 enum TapeLED_Color
kishibekairohan 11:028a150943b5 100 {
kishibekairohan 11:028a150943b5 101 Black = 0x000000,
kishibekairohan 11:028a150943b5 102 // Red = 0xff0000,
kishibekairohan 11:028a150943b5 103 Green = 0x008000,
kishibekairohan 11:028a150943b5 104 Blue = 0x0000ff,
kishibekairohan 11:028a150943b5 105 White = 0xffffff,
kishibekairohan 11:028a150943b5 106 // Orange = 0xffa500,
kishibekairohan 11:028a150943b5 107 // Yellow = 0xffff00,
kishibekairohan 11:028a150943b5 108 // Purple = 0x800080,
kishibekairohan 11:028a150943b5 109 // Cyan = 0x00ffff,
kishibekairohan 11:028a150943b5 110 // Magenta = 0xff00ff,
kishibekairohan 11:028a150943b5 111 // Lime = 0x00ff00
t_yamamoto 0:669ef71cba68 112
t_yamamoto 0:669ef71cba68 113
kishibekairohan 11:028a150943b5 114 Dimgray = 0x696969,
kishibekairohan 11:028a150943b5 115 Gray = 0x808080,
kishibekairohan 11:028a150943b5 116 DarkGray = 0xa9a9a9,
kishibekairohan 11:028a150943b5 117 Silver = 0xc0c0c0,
kishibekairohan 11:028a150943b5 118 LightGray = 0xd3d3d3,
kishibekairohan 11:028a150943b5 119 Gainsboro = 0xdcdcdc,
kishibekairohan 11:028a150943b5 120 Whitesmoke = 0xf5f5f5,
kishibekairohan 11:028a150943b5 121 Snow = 0xfffafa,
kishibekairohan 11:028a150943b5 122 Ghostwhite = 0xf8f8ff,
kishibekairohan 11:028a150943b5 123 Floralwhite = 0xfffaf0,
kishibekairohan 11:028a150943b5 124 Linen = 0xfaf0e6,
kishibekairohan 11:028a150943b5 125 Antiquewhite = 0xfaebd7,
kishibekairohan 11:028a150943b5 126 Papayawhip = 0xffefd5,
kishibekairohan 11:028a150943b5 127 Blanchedalmond = 0xffebcd,
kishibekairohan 11:028a150943b5 128 Bisque = 0xffe4c4,
kishibekairohan 11:028a150943b5 129 Moccasin = 0xffe4b5,
kishibekairohan 11:028a150943b5 130 Navajowhite = 0xffdead,
kishibekairohan 11:028a150943b5 131 Peachpuff = 0xffdab9,
kishibekairohan 11:028a150943b5 132 Mistyrose = 0xffe4e1,
kishibekairohan 11:028a150943b5 133 Lavenderblush = 0xfff0f5,
kishibekairohan 11:028a150943b5 134 Seashell = 0xfff5ee,
kishibekairohan 11:028a150943b5 135 Oldlace = 0xfdf5e6,
kishibekairohan 11:028a150943b5 136 Ivory = 0xfffff0,
kishibekairohan 11:028a150943b5 137 Honeydew = 0xf0fff0,
kishibekairohan 11:028a150943b5 138 Mintcream = 0xf5fffa,
kishibekairohan 11:028a150943b5 139 Azure = 0xf0ffff,
kishibekairohan 11:028a150943b5 140 Aliceblue = 0xf0f8ff,
kishibekairohan 11:028a150943b5 141 Lavender = 0xe6e6fa,
kishibekairohan 11:028a150943b5 142 Lightsteelblue = 0xb0c4de,
kishibekairohan 11:028a150943b5 143 Lightslategray = 0x778899,
kishibekairohan 11:028a150943b5 144 Slategray = 0x708090,
kishibekairohan 11:028a150943b5 145 Steelblue = 0x4682b4,
kishibekairohan 11:028a150943b5 146 Royalblue = 0x4169e1,
kishibekairohan 11:028a150943b5 147 Midnightblue = 0x191970,
kishibekairohan 11:028a150943b5 148 Navy = 0x000080,
kishibekairohan 11:028a150943b5 149 Darkblue = 0x00008b,
kishibekairohan 11:028a150943b5 150 Mediumblue = 0x0000cd,
kishibekairohan 11:028a150943b5 151 Dodgerblue = 0x1e90ff,
kishibekairohan 11:028a150943b5 152 Cornflowerblue = 0x6495ed,
kishibekairohan 11:028a150943b5 153 Deepskyblue = 0x00bfff,
kishibekairohan 11:028a150943b5 154 Lightskyblue = 0x87cefa,
kishibekairohan 11:028a150943b5 155 Skyblue = 0x87ceeb,
kishibekairohan 11:028a150943b5 156 Lightblue = 0xadd8e6,
kishibekairohan 11:028a150943b5 157 Powderblue = 0xb0e0e6,
kishibekairohan 11:028a150943b5 158 Paleturquoise = 0xafeeee,
kishibekairohan 11:028a150943b5 159 // Lightcyan = 0xe0ffff,
kishibekairohan 11:028a150943b5 160 Cyan = 0x00ffff,
kishibekairohan 11:028a150943b5 161 // Aqua = 0x00ffff,
kishibekairohan 11:028a150943b5 162 Turquoise = 0x40e0d0,
kishibekairohan 11:028a150943b5 163 Mediumturquoise = 0x48d1cc,
kishibekairohan 11:028a150943b5 164 Darkturquoise = 0x00ced1,
kishibekairohan 11:028a150943b5 165 Lightseagreen = 0x20b2aa,
kishibekairohan 11:028a150943b5 166 Cabetblue = 0x5f9ea0,
kishibekairohan 11:028a150943b5 167 Darkcyan = 0x008b8b,
kishibekairohan 11:028a150943b5 168 Teal = 0x008080,
kishibekairohan 11:028a150943b5 169 Darkslategray = 0x2f4f4f,
kishibekairohan 11:028a150943b5 170 Darkgreen = 0x006400,
kishibekairohan 11:028a150943b5 171 Forestgreen = 0x228b22,
kishibekairohan 11:028a150943b5 172 Seagreen = 0x2e8b57,
kishibekairohan 11:028a150943b5 173 Mediumseagreen = 0x3cb371,
kishibekairohan 11:028a150943b5 174 Mediumaquamarine = 0x66cdaa,
kishibekairohan 11:028a150943b5 175 Darkseagreen = 0x8fbc8f,
kishibekairohan 11:028a150943b5 176 Aquamarine = 0x7fffd4,
kishibekairohan 11:028a150943b5 177 Palegreen = 0x98fb98,
kishibekairohan 11:028a150943b5 178 Lightgreen = 0x90ee90,
kishibekairohan 11:028a150943b5 179 Springgreen = 0x00ff7f,
kishibekairohan 11:028a150943b5 180 Mediumspringgreen = 0x00fa9a,
kishibekairohan 11:028a150943b5 181 Lawngreen = 0x7cfc00,
kishibekairohan 11:028a150943b5 182 Chartreuse = 0x7fff00,
kishibekairohan 11:028a150943b5 183 Greenyellow = 0xadff2f,
kishibekairohan 11:028a150943b5 184 Lime = 0x00ff00,
kishibekairohan 11:028a150943b5 185 Limegreen = 0x32cd32,
kishibekairohan 11:028a150943b5 186 Yellowgreen = 0x9acd32,
kishibekairohan 11:028a150943b5 187 Darkolivegreen = 0x556b2f,
kishibekairohan 11:028a150943b5 188 Olivedrab = 0x6b8e23,
kishibekairohan 11:028a150943b5 189 Olive = 0x808000,
kishibekairohan 11:028a150943b5 190 Darkkhaki = 0xbdb76b,
kishibekairohan 11:028a150943b5 191 Palegoldenrod = 0xeee8aa,
kishibekairohan 11:028a150943b5 192 Cornsilk = 0xfff8dc,
kishibekairohan 11:028a150943b5 193 Beige = 0xf5f5dc,
kishibekairohan 11:028a150943b5 194 Lightyellow = 0xffffe0,
kishibekairohan 11:028a150943b5 195 Lightgoldenrodyellow = 0xfafad2,
kishibekairohan 11:028a150943b5 196 Lemonchiffon = 0xfffacd,
kishibekairohan 11:028a150943b5 197 Wheat = 0xf5deb3,
kishibekairohan 11:028a150943b5 198 Burlywood = 0xdeb887,
kishibekairohan 11:028a150943b5 199 Tan = 0xd2b48c,
kishibekairohan 11:028a150943b5 200 Khaki = 0xf0e68c,
kishibekairohan 11:028a150943b5 201 Yellow = 0xffff00,
kishibekairohan 11:028a150943b5 202 Gold = 0xffd700,
kishibekairohan 11:028a150943b5 203 // Orange = 0xffa500,
kishibekairohan 11:028a150943b5 204 Orange = 0xff2500,
kishibekairohan 11:028a150943b5 205 Sandybrown = 0xf4a460,
kishibekairohan 11:028a150943b5 206 Darkorange = 0xff8c00,
kishibekairohan 11:028a150943b5 207 Goldenrod = 0xdaa520,
kishibekairohan 11:028a150943b5 208 Peru = 0xcd853f,
kishibekairohan 11:028a150943b5 209 Darkgoldenrod = 0xb8860d,
kishibekairohan 11:028a150943b5 210 Chocolate = 0xd2691e,
kishibekairohan 11:028a150943b5 211 Sienna = 0xa0522d,
kishibekairohan 11:028a150943b5 212 Saddlebrown = 0x8b4513,
kishibekairohan 11:028a150943b5 213 Marron = 0x800000,
kishibekairohan 11:028a150943b5 214 Darkred = 0x8b0000,
kishibekairohan 11:028a150943b5 215 Brown = 0xa52a2a,
kishibekairohan 11:028a150943b5 216 Firebrick = 0xb22222,
kishibekairohan 11:028a150943b5 217 Indeanred = 0xcd5c5c,
kishibekairohan 11:028a150943b5 218 Rosybrown = 0xbc8f8f,
kishibekairohan 11:028a150943b5 219 Darksalmon = 0xe9967a,
kishibekairohan 11:028a150943b5 220 Lightcoral = 0xf08080,
kishibekairohan 11:028a150943b5 221 Salmon = 0xfa8072,
kishibekairohan 11:028a150943b5 222 Lightsalmon = 0xffa07a,
kishibekairohan 11:028a150943b5 223 Coral = 0xff7f50,
kishibekairohan 11:028a150943b5 224 Tomato = 0xff6347,
kishibekairohan 11:028a150943b5 225 Orangered = 0xff4500,
kishibekairohan 11:028a150943b5 226 Red = 0xff0000,
kishibekairohan 11:028a150943b5 227 Crimson = 0xdc143c,
kishibekairohan 11:028a150943b5 228 Mediumvioletred = 0xc71585,
kishibekairohan 11:028a150943b5 229 Deeppink = 0xff1493,
kishibekairohan 11:028a150943b5 230 Hotpink = 0xff69b4,
kishibekairohan 11:028a150943b5 231 Palevioletred = 0xdb7093,
kishibekairohan 11:028a150943b5 232 Pink = 0xffc0cb,
kishibekairohan 11:028a150943b5 233 Lightpink = 0xffb6c1,
kishibekairohan 11:028a150943b5 234 Thistle = 0xd8bfd8,
kishibekairohan 11:028a150943b5 235 Magenta = 0xff00ff,
kishibekairohan 11:028a150943b5 236 // Fuchsia = 0xff00ff,
kishibekairohan 11:028a150943b5 237 Violet = 0xee82ee,
kishibekairohan 11:028a150943b5 238 Plum = 0xdda0dd,
kishibekairohan 11:028a150943b5 239 Orchid = 0xda70d6,
kishibekairohan 11:028a150943b5 240 Mediumorchid = 0xba55d3,
kishibekairohan 11:028a150943b5 241 Darkorchid = 0x9932cc,
kishibekairohan 11:028a150943b5 242 Darkviolet = 0x9400d3,
kishibekairohan 11:028a150943b5 243 Darkmagenta = 0x8b008b,
kishibekairohan 11:028a150943b5 244 Purple = 0x800080,
kishibekairohan 11:028a150943b5 245 Indigo = 0x4b0082,
kishibekairohan 11:028a150943b5 246 Darkslateblue = 0x483d8b,
kishibekairohan 11:028a150943b5 247 Blueviolet = 0x8a2be2,
kishibekairohan 11:028a150943b5 248 Mediumpurple = 0x9370db,
kishibekairohan 11:028a150943b5 249 Slateblue = 0x6a5acd,
kishibekairohan 11:028a150943b5 250 Mediumslateblue = 0x7b68ee
kishibekairohan 11:028a150943b5 251 };
kishibekairohan 11:028a150943b5 252
kishibekairohan 11:028a150943b5 253 extern TapeLedData sendLedData;
kishibekairohan 12:c09b3e08a316 254
t_yamamoto 0:669ef71cba68 255 #endif