[270] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 |
|
---|
| 5 | namespace WebMrbc
|
---|
| 6 | {
|
---|
[273] | 7 | public class GrSakura : TargetBoard
|
---|
[270] | 8 | {
|
---|
[273] | 9 | public override FieldDropdown Pins()
|
---|
[270] | 10 | {
|
---|
| 11 | return new FieldDropdown(new[] {
|
---|
| 12 | new[] { "IO0", "PIN_IO0" },
|
---|
| 13 | new[] { "IO1", "PIN_IO1" },
|
---|
| 14 | new[] { "IO2", "PIN_IO2" },
|
---|
| 15 | new[] { "IO3", "PIN_IO3" },
|
---|
| 16 | new[] { "IO4", "PIN_IO4" },
|
---|
| 17 | new[] { "IO5", "PIN_IO5" },
|
---|
| 18 | new[] { "IO6", "PIN_IO6" },
|
---|
| 19 | new[] { "IO7", "PIN_IO7" },
|
---|
| 20 |
|
---|
| 21 | // IO pins, header CN7.
|
---|
| 22 | new[] { "IO8", "PIN_IO8" },
|
---|
| 23 | new[] { "IO9", "PIN_IO9" },
|
---|
| 24 | new[] { "IO10", "PIN_IO10" },
|
---|
| 25 | new[] { "IO11", "PIN_IO11" },
|
---|
| 26 | new[] { "IO12", "PIN_IO12" },
|
---|
| 27 | new[] { "IO13", "PIN_IO13" },
|
---|
| 28 |
|
---|
| 29 | // IO pins, header CN7.
|
---|
| 30 | new[] { "IO14", "PIN_IO14" },
|
---|
| 31 | new[] { "IO15", "PIN_IO15" },
|
---|
| 32 | new[] { "IO16", "PIN_IO16" },
|
---|
| 33 | new[] { "IO17", "PIN_IO17" },
|
---|
| 34 | new[] { "IO18", "PIN_IO18" },
|
---|
| 35 | new[] { "IO19", "PIN_IO19" },
|
---|
| 36 | new[] { "IO20", "PIN_IO20" },
|
---|
| 37 | new[] { "IO21", "PIN_IO21" },
|
---|
| 38 |
|
---|
| 39 | // IO pins, header CN9.
|
---|
| 40 | new[] { "IO22", "PIN_IO22" },
|
---|
| 41 | new[] { "IO23", "PIN_IO23" },
|
---|
| 42 | new[] { "IO24", "PIN_IO24" },
|
---|
| 43 | new[] { "IO25", "PIN_IO25" },
|
---|
| 44 | new[] { "IO26", "PIN_IO26" },
|
---|
| 45 | new[] { "IO27", "PIN_IO27" },
|
---|
| 46 | new[] { "IO28", "PIN_IO28" },
|
---|
| 47 | new[] { "IO29", "PIN_IO29" },
|
---|
| 48 |
|
---|
| 49 | // IO pins, header CN10.
|
---|
| 50 | new[] { "IO30", "PIN_IO30" },
|
---|
| 51 | new[] { "IO31", "PIN_IO31" },
|
---|
| 52 | new[] { "IO32", "PIN_IO32" },
|
---|
| 53 | new[] { "IO33", "PIN_IO33" },
|
---|
| 54 | new[] { "IO34", "PIN_IO34" },
|
---|
| 55 | new[] { "IO35", "PIN_IO35" },
|
---|
| 56 |
|
---|
| 57 | // IO pins, header CN12.
|
---|
| 58 | new[] { "IO36", "PIN_IO36" },
|
---|
| 59 | new[] { "IO37", "PIN_IO37" },
|
---|
| 60 | new[] { "IO38", "PIN_IO38" },
|
---|
| 61 | new[] { "IO39", "PIN_IO39" },
|
---|
| 62 | new[] { "IO40", "PIN_IO40" },
|
---|
| 63 | new[] { "IO41", "PIN_IO41" },
|
---|
| 64 | new[] { "IO42", "PIN_IO42" },
|
---|
| 65 | new[] { "IO43", "PIN_IO43" },
|
---|
| 66 |
|
---|
| 67 | // IO pins, header CN11.
|
---|
| 68 | new[] { "IO44", "PIN_IO44" },
|
---|
| 69 | new[] { "IO45", "PIN_IO45" },
|
---|
| 70 | new[] { "IO46", "PIN_IO46" },
|
---|
| 71 | new[] { "IO47", "PIN_IO47" },
|
---|
| 72 | new[] { "IO48", "PIN_IO48" },
|
---|
| 73 | new[] { "IO49", "PIN_IO49" },
|
---|
| 74 | new[] { "IO50", "PIN_IO50" },
|
---|
| 75 | new[] { "IO51", "PIN_IO51" },
|
---|
| 76 |
|
---|
| 77 | // IO pins, header CN13.
|
---|
| 78 | new[] { "IO52", "PIN_IO52" },
|
---|
| 79 | new[] { "IO53", "PIN_IO53" },
|
---|
| 80 | new[] { "IO54", "PIN_IO54" },
|
---|
| 81 | new[] { "IO55", "PIN_IO55" },
|
---|
| 82 |
|
---|
| 83 | // IO pins, header CN6.
|
---|
| 84 | new[] { "IO56", "PIN_IO56" },
|
---|
| 85 | new[] { "IO57", "PIN_IO57" },
|
---|
| 86 | new[] { "IO58", "PIN_IO58" },
|
---|
| 87 | new[] { "IO59", "PIN_IO59" },
|
---|
| 88 | new[] { "IO60", "PIN_IO60" },
|
---|
| 89 |
|
---|
| 90 | // LEDs (D1-D4) and SW.
|
---|
| 91 | new[] { "LED0", "PIN_LED0" },
|
---|
| 92 | new[] { "LED1", "PIN_LED1" },
|
---|
| 93 | new[] { "LED2", "PIN_LED2" },
|
---|
| 94 | new[] { "LED3", "PIN_LED3" },
|
---|
| 95 | new[] { "SW", "PIN_SW" },
|
---|
| 96 | });
|
---|
| 97 | }
|
---|
[273] | 98 | public override FieldDropdown AnalogPins()
|
---|
[270] | 99 | {
|
---|
| 100 | return new FieldDropdown(new[] {
|
---|
| 101 | // Analog pins, header CN15.
|
---|
| 102 | new[] { "AN000", "PIN_AN000" },
|
---|
| 103 | new[] { "AN001", "PIN_AN001" },
|
---|
| 104 | new[] { "AN002", "PIN_AN002" },
|
---|
| 105 | new[] { "AN003", "PIN_AN003" },
|
---|
| 106 | new[] { "AN004", "PIN_AN004" },
|
---|
| 107 | new[] { "AN005", "PIN_AN005" },
|
---|
| 108 |
|
---|
| 109 | // Analog pins, header CN13.
|
---|
| 110 | new[] { "AN006", "PIN_AN006" },
|
---|
| 111 | new[] { "AN007", "PIN_AN007" },
|
---|
| 112 |
|
---|
| 113 | // Analog pins, header CN12.
|
---|
| 114 | new[] { "AN008", "PIN_AN008" },
|
---|
| 115 | new[] { "AN009", "PIN_AN009" },
|
---|
| 116 | new[] { "AN010", "PIN_AN010" },
|
---|
| 117 | new[] { "AN011", "PIN_AN011" },
|
---|
| 118 | new[] { "AN012", "PIN_AN012" },
|
---|
| 119 | new[] { "AN013", "PIN_AN013" },
|
---|
| 120 |
|
---|
| 121 | // Analog input, RX63N internal
|
---|
| 122 | new[] { "ANINT", "PIN_ANINT" },
|
---|
| 123 | new[] { "ANTMP", "PIN_ANTMP" },
|
---|
| 124 | });
|
---|
| 125 | }
|
---|
| 126 |
|
---|
[273] | 127 | public override FieldDropdown PwmPins()
|
---|
[270] | 128 | {
|
---|
| 129 | return new FieldDropdown(new[] {
|
---|
| 130 | new[] { "IO0", "PIN_IO0" },
|
---|
| 131 | new[] { "IO1", "PIN_IO1" },
|
---|
| 132 | new[] { "IO2", "PIN_IO2" },
|
---|
| 133 | new[] { "IO3", "PIN_IO3" },
|
---|
| 134 | new[] { "IO4", "PIN_IO4" },
|
---|
| 135 | new[] { "IO5", "PIN_IO5" },
|
---|
| 136 | new[] { "IO6", "PIN_IO6" },
|
---|
| 137 | new[] { "IO7", "PIN_IO7" },
|
---|
| 138 | new[] { "IO9", "PIN_IO9" },
|
---|
| 139 | new[] { "IO10", "PIN_IO10" },
|
---|
| 140 | });
|
---|
| 141 | }
|
---|
| 142 |
|
---|
[273] | 143 | public override int PinNameToNum(string name)
|
---|
[270] | 144 | {
|
---|
| 145 | switch (name) {
|
---|
| 146 | case "PIN_IO0": return 0;
|
---|
| 147 | case "PIN_IO1": return 1;
|
---|
| 148 | case "PIN_IO2": return 2;
|
---|
| 149 | case "PIN_IO3": return 3;
|
---|
| 150 | case "PIN_IO4": return 4;
|
---|
| 151 | case "PIN_IO5": return 5;
|
---|
| 152 | case "PIN_IO6": return 6;
|
---|
| 153 | case "PIN_IO7": return 7;
|
---|
| 154 | case "PIN_IO8": return 8;
|
---|
| 155 | case "PIN_IO9": return 9;
|
---|
| 156 | case "PIN_IO10": return 10;
|
---|
| 157 | case "PIN_IO11": return 11;
|
---|
| 158 | case "PIN_IO12": return 12;
|
---|
| 159 | case "PIN_IO13": return 13;
|
---|
| 160 | case "PIN_IO14": return 14;
|
---|
| 161 | case "PIN_IO15": return 15;
|
---|
| 162 | case "PIN_IO16": return 16;
|
---|
| 163 | case "PIN_IO17": return 17;
|
---|
| 164 | case "PIN_IO18": return 18;
|
---|
| 165 | case "PIN_IO19": return 19;
|
---|
| 166 | case "PIN_IO20": return 20;
|
---|
| 167 | case "PIN_IO21": return 21;
|
---|
| 168 | case "PIN_IO22": return 22;
|
---|
| 169 | case "PIN_IO23": return 23;
|
---|
| 170 | case "PIN_IO24": return 24;
|
---|
| 171 | case "PIN_IO25": return 25;
|
---|
| 172 | case "PIN_IO26": return 26;
|
---|
| 173 | case "PIN_IO27": return 27;
|
---|
| 174 | case "PIN_IO28": return 28;
|
---|
| 175 | case "PIN_IO29": return 29;
|
---|
| 176 | case "PIN_IO30": return 30;
|
---|
| 177 | case "PIN_IO31": return 31;
|
---|
| 178 | case "PIN_IO32": return 32;
|
---|
| 179 | case "PIN_IO33": return 33;
|
---|
| 180 | case "PIN_IO34": return 34;
|
---|
| 181 | case "PIN_IO35": return 35;
|
---|
| 182 | case "PIN_IO36": return 36;
|
---|
| 183 | case "PIN_IO37": return 37;
|
---|
| 184 | case "PIN_IO38": return 38;
|
---|
| 185 | case "PIN_IO39": return 39;
|
---|
| 186 | case "PIN_IO40": return 40;
|
---|
| 187 | case "PIN_IO41": return 41;
|
---|
| 188 | case "PIN_IO42": return 42;
|
---|
| 189 | case "PIN_IO43": return 43;
|
---|
| 190 | case "PIN_IO44": return 44;
|
---|
| 191 | case "PIN_IO45": return 45;
|
---|
| 192 | case "PIN_IO46": return 46;
|
---|
| 193 | case "PIN_IO47": return 47;
|
---|
| 194 | case "PIN_IO48": return 48;
|
---|
| 195 | case "PIN_IO49": return 49;
|
---|
| 196 | case "PIN_IO50": return 50;
|
---|
| 197 | case "PIN_IO51": return 51;
|
---|
| 198 | case "PIN_IO52": return 52;
|
---|
| 199 | case "PIN_IO53": return 53;
|
---|
| 200 | case "PIN_IO54": return 54;
|
---|
| 201 | case "PIN_IO55": return 55;
|
---|
| 202 | case "PIN_IO56": return 56;
|
---|
| 203 | case "PIN_IO57": return 57;
|
---|
| 204 | case "PIN_IO58": return 58;
|
---|
| 205 | case "PIN_IO59": return 59;
|
---|
| 206 | case "PIN_IO60": return 60;
|
---|
| 207 | case "PIN_LED0": return 61;
|
---|
| 208 | case "PIN_LED1": return 62;
|
---|
| 209 | case "PIN_LED2": return 63;
|
---|
| 210 | case "PIN_LED3": return 64;
|
---|
| 211 | case "PIN_SW": return 65;
|
---|
| 212 | case "PIN_AN000": return 14;
|
---|
| 213 | case "PIN_AN001": return 15;
|
---|
| 214 | case "PIN_AN002": return 16;
|
---|
| 215 | case "PIN_AN003": return 17;
|
---|
| 216 | case "PIN_AN004": return 18;
|
---|
| 217 | case "PIN_AN005": return 19;
|
---|
| 218 | case "PIN_AN006": return 20;
|
---|
| 219 | case "PIN_AN007": return 21;
|
---|
| 220 | case "PIN_AN008": return 22;
|
---|
| 221 | case "PIN_AN009": return 23;
|
---|
| 222 | case "PIN_AN010": return 24;
|
---|
| 223 | case "PIN_AN011": return 25;
|
---|
| 224 | case "PIN_AN012": return 26;
|
---|
| 225 | case "PIN_AN013": return 27;
|
---|
| 226 | case "PIN_ANINT": return 28;
|
---|
| 227 | case "PIN_ANTMP": return 29;
|
---|
| 228 | default: return -1;
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 |
|
---|
[273] | 232 | public override int PinModeNameToNum(string name)
|
---|
[270] | 233 | {
|
---|
| 234 | switch (name) {
|
---|
| 235 | case "INPUT": return 0;
|
---|
| 236 | case "OUTPUT": return 1;
|
---|
| 237 | default: return -1;
|
---|
| 238 | }
|
---|
| 239 | }
|
---|
| 240 |
|
---|
[273] | 241 | public override int PinValueNameToNum(string name)
|
---|
[270] | 242 | {
|
---|
| 243 | switch (name) {
|
---|
| 244 | case "LOW": return 0;
|
---|
| 245 | case "HIGH": return 1;
|
---|
| 246 | default: return -1;
|
---|
| 247 | }
|
---|
| 248 | }
|
---|
| 249 |
|
---|
[273] | 250 | public override int AnalogRefModeNameToNum(string name)
|
---|
[270] | 251 | {
|
---|
| 252 | switch (name) {
|
---|
| 253 | case "DEFAULT": return 0;
|
---|
| 254 | case "INTERNAL": return 1;
|
---|
| 255 | case "EXTERNAL": return 2;
|
---|
| 256 | case "RAW12BIT": return 3;
|
---|
| 257 | default: return -1;
|
---|
| 258 | }
|
---|
| 259 | }
|
---|
| 260 |
|
---|
[273] | 261 | public override FieldDropdown I2CPorts()
|
---|
[270] | 262 | {
|
---|
| 263 | return new FieldDropdown(new[] {
|
---|
| 264 | new[] { "SDA-0/SCL-1", "I2C0" },
|
---|
| 265 | new[] { "SDA-5/SCL-6", "I2C1" },
|
---|
| 266 | new[] { "SDA-7/SCL-8", "I2C2" },
|
---|
| 267 | new[] { "SDA-9(26)/SCL-3", "I2C3" }
|
---|
| 268 | });
|
---|
| 269 | }
|
---|
| 270 |
|
---|
[273] | 271 | public override string I2CPortNameToVariable(string name)
|
---|
[270] | 272 | {
|
---|
| 273 | switch (name) {
|
---|
| 274 | case "I2C0": return "$i2c0";
|
---|
| 275 | case "I2C1": return "$i2c1";
|
---|
| 276 | case "I2C2": return "$i2c2";
|
---|
| 277 | case "I2C3": return "$i2c3";
|
---|
| 278 | default: return name;
|
---|
| 279 | }
|
---|
| 280 | }
|
---|
| 281 |
|
---|
[273] | 282 | public override int I2CPortNameToNum(string name)
|
---|
[270] | 283 | {
|
---|
| 284 | switch (name) {
|
---|
| 285 | case "I2C0": return 0;
|
---|
| 286 | case "I2C1": return 1;
|
---|
| 287 | case "I2C2": return 2;
|
---|
| 288 | case "I2C3": return 3;
|
---|
| 289 | default: return -1;
|
---|
| 290 | }
|
---|
| 291 | }
|
---|
| 292 |
|
---|
[273] | 293 | public override FieldDropdown MemFileHandles()
|
---|
[270] | 294 | {
|
---|
| 295 | return new FieldDropdown(new[] {
|
---|
| 296 | new[] { "MemFile0", "MEM_FILE0" },
|
---|
| 297 | new[] { "MemFile1", "MEM_FILE1" }
|
---|
| 298 | });
|
---|
| 299 | }
|
---|
| 300 |
|
---|
[273] | 301 | public override int MemFileHandlerNameToNum(string name)
|
---|
[270] | 302 | {
|
---|
| 303 | switch (name) {
|
---|
| 304 | case "MEM_FILE0": return 0;
|
---|
| 305 | case "MEM_FILE1": return 1;
|
---|
| 306 | default: return -1;
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 |
|
---|
[273] | 310 | public override int MemOpenModeNameToNum(string name)
|
---|
[270] | 311 | {
|
---|
| 312 | switch (name) {
|
---|
| 313 | case "EEP_READ": return 0;
|
---|
| 314 | case "EEP_APPEND": return 1;
|
---|
| 315 | case "EEP_WRITE": return 2;
|
---|
| 316 | default: return -1;
|
---|
| 317 | }
|
---|
| 318 | }
|
---|
| 319 |
|
---|
[273] | 320 | public override int MemCpModeNameToNum(string name)
|
---|
[270] | 321 | {
|
---|
| 322 | switch (name) {
|
---|
| 323 | case "NO_OVERWRITE": return 0;
|
---|
| 324 | case "OVERWRITE": return 1;
|
---|
| 325 | default: return -1;
|
---|
| 326 | }
|
---|
| 327 | }
|
---|
| 328 |
|
---|
[273] | 329 | public override FieldDropdown SdFileHandles()
|
---|
[270] | 330 | {
|
---|
| 331 | return new FieldDropdown(new[] {
|
---|
| 332 | new[] { "SdFile0", "SD_FILE0" },
|
---|
| 333 | new[] { "SdFile1", "SD_FILE1" }
|
---|
| 334 | });
|
---|
| 335 | }
|
---|
| 336 |
|
---|
[273] | 337 | public override int SdFileHandlerNameToNum(string name)
|
---|
[270] | 338 | {
|
---|
| 339 | switch (name) {
|
---|
| 340 | case "SD_FILE0": return 0;
|
---|
| 341 | case "SD_FILE1": return 1;
|
---|
| 342 | default: return -1;
|
---|
| 343 | }
|
---|
| 344 | }
|
---|
| 345 |
|
---|
[273] | 346 | public override int SdOpenModeNameToNum(string name)
|
---|
[270] | 347 | {
|
---|
| 348 | switch (name) {
|
---|
| 349 | case "READ": return 0;
|
---|
| 350 | case "APPEND": return 1;
|
---|
| 351 | case "NEW_CREATE": return 2;
|
---|
| 352 | default: return -1;
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
| 355 |
|
---|
[273] | 356 | public override FieldDropdown SerialPorts()
|
---|
[270] | 357 | {
|
---|
| 358 | return new FieldDropdown(new[] {
|
---|
| 359 | new[] { "USB", "SERIAL0" },
|
---|
| 360 | new[] { "TX-0/RX-1", "SERIAL1" },
|
---|
| 361 | new[] { "TX-5/RX-6", "SERIAL2" },
|
---|
| 362 | new[] { "TX-7/RX-8", "SERIAL3" },
|
---|
| 363 | new[] { "TX-12/RX-11", "SERIAL4" },
|
---|
| 364 | new[] { "TX-9(26)/RX-3", "SERIAL5" }
|
---|
| 365 | });
|
---|
| 366 | }
|
---|
| 367 |
|
---|
[273] | 368 | public override int SerialPortNameToNum(string name)
|
---|
[270] | 369 | {
|
---|
| 370 | switch (name) {
|
---|
| 371 | case "SERIAL0": return 0;
|
---|
| 372 | case "SERIAL1": return 1;
|
---|
| 373 | case "SERIAL2": return 2;
|
---|
| 374 | case "SERIAL3": return 3;
|
---|
| 375 | case "SERIAL4": return 4;
|
---|
| 376 | case "SERIAL5": return 5;
|
---|
| 377 | default: return -1;
|
---|
| 378 | }
|
---|
| 379 | }
|
---|
| 380 |
|
---|
[273] | 381 | public override string SerialPortNameToVariable(string name)
|
---|
[270] | 382 | {
|
---|
| 383 | switch (name) {
|
---|
| 384 | case "SERIAL0": return "$Serial";
|
---|
| 385 | case "SERIAL1": return "$Serial1";
|
---|
| 386 | case "SERIAL2": return "$Serial2";
|
---|
| 387 | case "SERIAL3": return "$Serial3";
|
---|
| 388 | case "SERIAL4": return "$Serial4";
|
---|
| 389 | case "SERIAL5": return "$Serial5";
|
---|
| 390 | default: return name;
|
---|
| 391 | }
|
---|
| 392 | }
|
---|
| 393 | }
|
---|
| 394 | }
|
---|