├── .gitignore ├── LICENSE ├── README.md └── src ├── .cproject ├── .project ├── .settings ├── language.settings.xml ├── org.eclipse.cdt.codan.core.prefs └── org.eclipse.cdt.core.prefs ├── LICENSE ├── Makefile ├── README.rst ├── components ├── Display │ ├── Display.cpp │ ├── component.mk │ └── include │ │ └── Display.hpp ├── DisplayTask │ ├── DisplayTask.cpp │ ├── component.mk │ └── include │ │ └── DisplayTask.hpp ├── Fonts │ ├── Fonts.cpp │ ├── component.mk │ └── include │ │ └── Fonts.hpp ├── SerialTask │ ├── SerialTask.cpp │ ├── component.mk │ └── include │ │ └── SerialTask.hpp ├── UDPServer │ ├── UDPServer.c │ ├── component.mk │ └── include │ │ └── UDPServer.h └── WirelessTask │ ├── WirelessTask.cpp │ ├── component.mk │ └── include │ └── WirelessTask.hpp ├── main ├── component.mk └── main.cpp └── sdkconfig /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | *.smod 19 | 20 | # Compiled Static libraries 21 | *.lai 22 | *.la 23 | *.a 24 | *.lib 25 | 26 | # Executables 27 | *.exe 28 | *.out 29 | *.app 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 William Emfinger 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # esp32-wireless-display 2 | 3 | ⚠️ Update 2023-09-21: Archiving this repository as it is out of date and has been replaced by https://github.com/esp-cpp/wireless-debug-display which provides the same functionality in a much better and more maintainable , portable, and understandable codebase. 4 | 5 | ESP32-WROVER-KIT programmed to be a wireless display / debugger / logger for numeric and text data logs 6 | 7 | This is an example project for the 8 | [ESP-WROVER-KIT](https://www.adafruit.com/product/3384), 9 | a development / breakout board for the 10 | [Espressif ESP32](https://espressif.com/en/products/hardware/esp32/overview). 11 | 12 | This project uses the WROVER's LCD to act as a wired / wireless display for data 13 | received by the serial port or over wifi / bluetooth. 14 | 15 | There are two *tasks* in this example: 16 | 17 | 1. **SerialTask** : which handles writing data to and receiving data from 18 | the UART port connected to the USB. The serial interrupt buffers the 19 | incoming serial data, and the HFSM code periodically (in the state) 20 | reads from the queue. The SerialTask also periodically prints to the 21 | UART which state it is in. The serial interrupt is configured to detect 22 | a pattern of `+++`, after which it will trigger the `changeState` variable 23 | within the **InputOutputTask**, the **Serialtask**, and the **DisplayTask**. 24 | This task also spawns a serial receive task which is defined in its `definitions`. 25 | 2. **DisplayTask** : which handles drawing to the display periodically. 26 | It receives data from the `Serial Task` and determines if it is numeric 27 | data or text data. 28 | 29 | There are two *components* in this example: 30 | 31 | 1. **Display** : which handles the SPI communication to the **ILI9341** display 32 | and provides functions for drawing primitives and text. The driver contains 33 | a 16bit palette which is used to write out data from the 8bit video ram (vram). 34 | The component makes use of the **Fonts** component to get its font raster data. 35 | 2. **Fonts** : which contains the raster data for two different font sizes. 36 | -------------------------------------------------------------------------------- /src/.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | make 100 | 101 | flash 102 | true 103 | true 104 | true 105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ESP32_Wireless_Display 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 829 | 830 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | 871 | 872 | 873 | 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 888 | 889 | 890 | 891 | 892 | 893 | 894 | 895 | 896 | 897 | 898 | 899 | 900 | 901 | 902 | 903 | 904 | 905 | 906 | 907 | 908 | 909 | 910 | 911 | 912 | 913 | 914 | 915 | 916 | 917 | 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | 929 | 930 | 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | 942 | 943 | 944 | 945 | 946 | 947 | 948 | 949 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 970 | 971 | 972 | 973 | 974 | 975 | 976 | 977 | 978 | 979 | 980 | 981 | 982 | 983 | 984 | 985 | 986 | 987 | 988 | 989 | 990 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1027 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1064 | 1065 | 1066 | 1067 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | 1300 | 1301 | 1302 | 1303 | 1304 | 1305 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | 1314 | 1315 | 1316 | 1317 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1324 | 1325 | 1326 | 1327 | 1328 | 1329 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1337 | 1338 | 1339 | 1340 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1348 | 1349 | 1350 | 1351 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | 1358 | 1359 | 1360 | 1361 | 1362 | 1363 | 1364 | 1365 | 1366 | 1367 | 1368 | 1369 | 1370 | 1371 | 1372 | 1373 | 1374 | 1375 | 1376 | 1377 | 1378 | 1379 | 1380 | 1381 | 1382 | 1383 | 1384 | 1385 | -------------------------------------------------------------------------------- /src/.settings/org.eclipse.cdt.codan.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.cdt.codan.checkers.errnoreturn=Warning 3 | org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return\\")",implicit\=>false} 4 | org.eclipse.cdt.codan.checkers.errreturnvalue=Error 5 | org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused return value\\")"} 6 | org.eclipse.cdt.codan.checkers.nocommentinside=-Error 7 | org.eclipse.cdt.codan.checkers.nocommentinside.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Nesting comments\\")"} 8 | org.eclipse.cdt.codan.checkers.nolinecomment=-Error 9 | org.eclipse.cdt.codan.checkers.nolinecomment.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Line comments\\")"} 10 | org.eclipse.cdt.codan.checkers.noreturn=Error 11 | org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No return value\\")",implicit\=>false} 12 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error 13 | org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Abstract class cannot be instantiated\\")"} 14 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error 15 | org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Ambiguous problem\\")"} 16 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning 17 | org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment in condition\\")"} 18 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error 19 | org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Assignment to itself\\")"} 20 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=Warning 21 | org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"No break at end of case\\")",no_break_comment\=>"no break",last_case_param\=>false,empty_case_param\=>false} 22 | org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning 23 | org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Catching by reference is recommended\\")",unknown\=>false,exceptions\=>()} 24 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error 25 | org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Circular inheritance\\")"} 26 | org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning 27 | org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class members should be properly initialized\\")",skip\=>true} 28 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error 29 | org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Field cannot be resolved\\")"} 30 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error 31 | org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Function cannot be resolved\\")"} 32 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error 33 | org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid arguments\\")"} 34 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error 35 | org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid template argument\\")"} 36 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error 37 | org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Label statement not found\\")"} 38 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error 39 | org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Member declaration not found\\")"} 40 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error 41 | org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Method cannot be resolved\\")"} 42 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info 43 | org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Name convention for function\\")",pattern\=>"^[a-z]",macro\=>true,exceptions\=>()} 44 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning 45 | org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Class has a virtual method and non-virtual destructor\\")"} 46 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error 47 | org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid overload\\")"} 48 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error 49 | org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redeclaration\\")"} 50 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error 51 | org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Invalid redefinition\\")"} 52 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning 53 | org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Return with parenthesis\\")"} 54 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning 55 | org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Format String Vulnerability\\")"} 56 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning 57 | org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Statement has no effect\\")",macro\=>true,exceptions\=>()} 58 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning 59 | org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suggested parenthesis around expression\\")",paramNot\=>false} 60 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning 61 | org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Suspicious semicolon\\")",else\=>false,afterelse\=>false} 62 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error 63 | org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Type cannot be resolved\\")"} 64 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning 65 | org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused function declaration\\")",macro\=>true} 66 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning 67 | org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused static function\\")",macro\=>true} 68 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning 69 | org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Unused variable declaration in file scope\\")",macro\=>true,exceptions\=>("@(\#)","$Id")} 70 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error 71 | org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},suppression_comment\=>"@suppress(\\"Symbol is not resolved\\")"} 72 | -------------------------------------------------------------------------------- /src/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/BATCH_BUILD/delimiter=\: 3 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/BATCH_BUILD/operation=append 4 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/BATCH_BUILD/value=1 5 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/IDF_PATH/delimiter=\: 6 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/IDF_PATH/operation=append 7 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/IDF_PATH/value=/home/jeb/esp/esp-idf 8 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/PATH/delimiter=\: 9 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/PATH/operation=replace 10 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/PATH/value=/home/jeb/esp/xtensa-esp32-elf/bin\:/bin\:/home/jeb/bin\:/home/jeb/.local/bin\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/usr/games\:/usr/local/games\:/snap/bin 11 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/append=true 12 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1163174640/appendContributed=true 13 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/BATCH_BUILD/delimiter=\: 14 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/BATCH_BUILD/operation=append 15 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/BATCH_BUILD/value=1 16 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/IDF_PATH/delimiter=\: 17 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/IDF_PATH/operation=replace 18 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/IDF_PATH/value=/home/jeb/esp/esp-idf 19 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/PATH/delimiter=\: 20 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/PATH/operation=replace 21 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/PATH/value=/home/jeb/esp/xtensa-esp32-elf/bin\:/bin\:/home/jeb/bin\:/home/jeb/.local/bin\:/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/usr/games\:/usr/local/games\:/snap/bin 22 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/append=true 23 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.676477316/appendContributed=true 24 | -------------------------------------------------------------------------------- /src/LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := ESP32_Wireless_Display 7 | 8 | include /home/jeb/esp/esp-idf/make/project.mk 9 | 10 | -------------------------------------------------------------------------------- /src/README.rst: -------------------------------------------------------------------------------- 1 | ESP32 Wireless Display 2 | ================= 3 | 4 | This application was generated from WebGME-HFSM, and should be used 5 | with `Espressif IoT Development Framework`_ (ESP-IDF). 6 | 7 | Please check ESP-IDF docs for getting started instructions. 8 | 9 | .. _Espressif IoT Development Framework: https://github.com/espressif/esp-idf 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/components/Display/Display.cpp: -------------------------------------------------------------------------------- 1 | #include "Display.hpp" 2 | extern "C" { 3 | #include 4 | #include 5 | #include "sdkconfig.h" 6 | #include "rom/ets_sys.h" 7 | #include "rom/gpio.h" 8 | #include "soc/gpio_reg.h" 9 | #include "soc/gpio_sig_map.h" 10 | #include "soc/gpio_struct.h" 11 | #include "soc/io_mux_reg.h" 12 | #include "soc/spi_reg.h" 13 | #include "freertos/FreeRTOS.h" 14 | #include "freertos/task.h" 15 | } 16 | #include "Fonts.hpp" 17 | 18 | #define U16x2toU32(m,l) ((((uint32_t)(l>>8|(l&0xFF)<<8))<<16)|(m>>8|(m&0xFF)<<8)) 19 | 20 | #define MAX(a,b) ((a) > (b) ? a : b) 21 | #define MIN(a,b) ((a) < (b) ? a : b) 22 | 23 | #if CONFIG_LCD_USE_FAST_PINS 24 | #define PIN_NUM_MISO 19 25 | #define PIN_NUM_MOSI 23 26 | #define PIN_NUM_CLK 18 27 | #define PIN_NUM_CS 5 28 | 29 | #define PIN_NUM_DC 21 30 | #define PIN_NUM_RST 22 31 | #define PIN_NUM_BCKL 25 32 | #else 33 | #define PIN_NUM_MISO 25 34 | #define PIN_NUM_MOSI 23 35 | #define PIN_NUM_CLK 19 36 | #define PIN_NUM_CS 22 37 | 38 | #define PIN_NUM_DC 21 39 | #define PIN_NUM_RST 18 40 | #define PIN_NUM_BCKL 5 41 | #endif 42 | 43 | #define LCD_SEL_CMD() GPIO.out_w1tc = (1 << PIN_NUM_DC) // Low to send command 44 | #define LCD_SEL_DATA() GPIO.out_w1ts = (1 << PIN_NUM_DC) // High to send data 45 | #define LCD_RST_SET() GPIO.out_w1ts = (1 << PIN_NUM_RST) 46 | #define LCD_RST_CLR() GPIO.out_w1tc = (1 << PIN_NUM_RST) 47 | 48 | #ifdef CONFIG_WROVER_KIT_V1 49 | #define LCD_BKG_ON() GPIO.out_w1ts = (1 << PIN_NUM_BCKL) // Backlight ON 50 | #define LCD_BKG_OFF() GPIO.out_w1tc = (1 << PIN_NUM_BCKL) // Backlight OFF 51 | #else 52 | #define LCD_BKG_ON() GPIO.out_w1tc = (1 << PIN_NUM_BCKL) // Backlight ON 53 | #define LCD_BKG_OFF() GPIO.out_w1ts = (1 << PIN_NUM_BCKL) // Backlight OFF 54 | #endif 55 | 56 | #define SPI_NUM 0x3 57 | 58 | uint8_t vram[DISPLAY_WIDTH * DISPLAY_HEIGHT]; 59 | uint16_t myPalette[256] = { 60 | 0,8,23,31,256,264,279,287,512,520,535,543,768,776,791,799,1248,1256,1271,1279,1504, 61 | 1512,1527,1535,1760,1768,1783,1791,2016,2024,2039,2047,8192,8200,8215,8223,8448,8456, 62 | 8471,8479,8704,8712,8727,8735,8960,8968,8983,8991,9440,9448,9463,9471,9696,9704,9719, 63 | 9727,9952,9960,9975,9983,10208,10216,10231,10239,16384,16392,16407,16415,16640,16648, 64 | 16663,16671,16896,16904,16919,16927,17152,17160,17175,17183,17632,17640,17655,17663, 65 | 17888,17896,17911,17919,18144,18152,18167,18175,18400,18408,18423,18431,24576,24584, 66 | 24599,24607,24832,24840,24855,24863,25088,25096,25111,25119,25344,25352,25367,25375, 67 | 25824,25832,25847,25855,26080,26088,26103,26111,26336,26344,26359,26367,26592,26600, 68 | 26615,26623,38912,38920,38935,38943,39168,39176,39191,39199,39424,39432,39447,39455, 69 | 39680,39688,39703,39711,40160,40168,40183,40191,40416,40424,40439,40447,40672,40680, 70 | 40695,40703,40928,40936,40951,40959,47104,47112,47127,47135,47360,47368,47383,47391, 71 | 47616,47624,47639,47647,47872,47880,47895,47903,48352,48360,48375,48383,48608,48616, 72 | 48631,48639,48864,48872,48887,48895,49120,49128,49143,49151,55296,55304,55319,55327, 73 | 55552,55560,55575,55583,55808,55816,55831,55839,56064,56072,56087,56095,56544,56552, 74 | 56567,56575,56800,56808,56823,56831,57056,57064,57079,57087,57312,57320,57335,57343, 75 | 63488,63496,63511,63519,63744,63752,63767,63775,64000,64008,64023,64031,64256,64264, 76 | 64279,64287,64736,64744,64759,64767,64992,65000,65015,65023,65248,65256,65271,65279, 77 | 65504,65512,65527,65535 78 | }; 79 | 80 | // TEXT FUNCTIONS: 81 | void Draw_5x8_char(char* _char_matrix,int x_start,int y_start,unsigned char clr) 82 | { 83 | int row, col; 84 | 85 | for (col=0;col<=4;col++) { 86 | for (row=0;row<=7;row++) { 87 | if ((row+y_start)>=0 && (row+y_start)< DISPLAY_HEIGHT && (col+x_start)>=0 && (col+x_start)< DISPLAY_WIDTH) { 88 | if (((_char_matrix[row]>>(7-col))&0x01)) 89 | vram[(row+y_start) + (col+x_start) * DISPLAY_HEIGHT] = clr; 90 | else 91 | vram[(row+y_start) + (col+x_start) * DISPLAY_HEIGHT] = 0x00; 92 | } 93 | } 94 | } 95 | } 96 | 97 | void Draw_5x8_string(char* str,unsigned char len,int x_start,int y_start,unsigned char clr) 98 | { 99 | int i = 0; 100 | for (i=0;i=0 && (row+y_start)< DISPLAY_HEIGHT && (col+x_start)>=0 && (col+x_start)< DISPLAY_WIDTH) { 110 | if (((_char_matrix[row]>>(7-col))&0x01)) 111 | vram[(row+y_start) + (col+x_start) * DISPLAY_HEIGHT] = clr; 112 | else 113 | vram[(row+y_start) + (col+x_start) * DISPLAY_HEIGHT] = 0x00; 114 | } 115 | } 116 | } 117 | } 118 | 119 | void Draw_8x12_string(char* str,unsigned char len,int x_start,int y_start,unsigned char clr) 120 | { 121 | int i = 0; 122 | for (i=0;i=0 && col>=0 && row=0 && row< DISPLAY_HEIGHT && col>=0 && col< DISPLAY_WIDTH) vram[row + col * DISPLAY_HEIGHT] = clrfill; 162 | } 163 | } 164 | if ((cy+y)>=0 && (cy+y)< DISPLAY_HEIGHT && (cx+x)>=0 && (cx+x)< DISPLAY_WIDTH) 165 | vram[(cy+y) + (cx+x) * DISPLAY_HEIGHT] = clroutline; 166 | 167 | if (x != 0) { 168 | if ((cy+y)>=0 && (cy+y)< DISPLAY_HEIGHT && (cx-x)>=0 && (cx-x)< DISPLAY_WIDTH) 169 | vram[(cy+y) + (cx-x) * DISPLAY_HEIGHT] = clroutline; 170 | } 171 | if (y != 0) { 172 | if ((cy-y)>=0 && (cy-y)< DISPLAY_HEIGHT && (cx+x)>=0 && (cx+x)< DISPLAY_WIDTH) 173 | vram[(cy-y) + (cx+x) * DISPLAY_HEIGHT] = clroutline; 174 | } 175 | if (x != 0 && y != 0) { 176 | if ((cy-y)>=0 && (cy-y)< DISPLAY_HEIGHT && (cx-x)>=0 && (cx-x)< DISPLAY_WIDTH) 177 | vram[(cy-y) + (cx-x) * DISPLAY_HEIGHT] = clroutline; 178 | } 179 | } 180 | 181 | void plot8points(int cx, int cy, int x, int y, unsigned char clroutline,unsigned char clrfill) 182 | { 183 | plot4points(cx, cy, x, y,clroutline,clrfill); 184 | plot4points(cx, cy, y, x,clroutline,clrfill); 185 | } 186 | 187 | void circle(int cx, int cy, int radius, unsigned char clroutline, unsigned char clrfill) 188 | { 189 | int error = -radius; 190 | int x = radius; 191 | int y = 0; 192 | 193 | while (x > y) 194 | { 195 | plot8points(cx, cy, x, y,clroutline,clrfill); 196 | 197 | error += y; 198 | ++y; 199 | error += y; 200 | 201 | if (error >= 0) 202 | { 203 | --x; 204 | error -= x; 205 | error -= x; 206 | } 207 | } 208 | plot4points(cx, cy, x, y,clroutline,clrfill); 209 | } 210 | 211 | void draw_circle( 212 | const point_s pos, 213 | const uint16_t radius, 214 | const uint8_t outline, 215 | const uint8_t fill) { 216 | int cx = pos.x, 217 | cy = pos.y; 218 | circle(cx, cy, radius, outline, fill); 219 | } 220 | 221 | void draw_line( 222 | const point_s start, 223 | const point_s end, 224 | const uint8_t color) { 225 | int _dummy; 226 | int xLeft = start.x, 227 | xRight = end.x, 228 | yTop = start.y, 229 | yBottom = end.y; 230 | int steep = (abs(yBottom - yTop) > abs(xRight - xLeft)); 231 | if (steep) { 232 | _dummy = xLeft; 233 | xLeft = yTop; 234 | yTop = _dummy; 235 | _dummy = xRight; 236 | xRight = yBottom; 237 | yBottom = _dummy; 238 | } 239 | if (xLeft>xRight) { 240 | _dummy = xLeft; 241 | xLeft = xRight; 242 | xRight = _dummy; 243 | _dummy = yTop; 244 | yTop = yBottom; 245 | yBottom = _dummy; 246 | } 247 | int dx = xRight - xLeft; 248 | int dy = abs(yBottom - yTop); 249 | int error = dx>>1; // divide by 2 250 | int ystep; 251 | int row = yTop; 252 | if (yTop=0 && col>=0 && row< DISPLAY_HEIGHT && col< DISPLAY_WIDTH) { 259 | if (steep) vram[col + row * DISPLAY_HEIGHT] = color; 260 | else vram[row + col * DISPLAY_HEIGHT] = color; 261 | } 262 | error = error - dy; 263 | if (error<0) { 264 | row = row + ystep; 265 | error = error + dx; 266 | } 267 | } 268 | } 269 | 270 | 271 | // LOW LEVEL FUNCTIONS: 272 | // forward declare main low level func for displaying to screen: 273 | void ili9341_write_frame( 274 | const uint16_t x, 275 | const uint16_t y, 276 | const uint16_t width, 277 | const uint16_t height, 278 | const uint8_t *data); 279 | 280 | void clear_vram() { 281 | memset(vram, 0, DISPLAY_WIDTH * DISPLAY_HEIGHT); 282 | } 283 | 284 | void clear_vram( 285 | const uint16_t x, 286 | const uint16_t y, 287 | const uint16_t width, 288 | const uint16_t height) { 289 | int xs = MAX(0, x), 290 | xe = MIN(DISPLAY_WIDTH, xs + width), 291 | ys = MAX(0, y), 292 | ye = MIN(DISPLAY_HEIGHT, ys + height), 293 | len = ye - ys; 294 | for (int i=xs; i 4 | 5 | //***************************************************************************** 6 | // 7 | // Make sure all of the definitions in this header have a C binding. 8 | // 9 | //***************************************************************************** 10 | 11 | #define CONFIG_WROVER_KIT_V2 1 12 | #define CONFIG_LCD_USE_FAST_PINS 0 13 | 14 | #define DISPLAY_WIDTH 240 15 | #define DISPLAY_HEIGHT 320 16 | 17 | typedef struct s_point_s { 18 | uint16_t x; 19 | uint16_t y; 20 | } point_s; 21 | 22 | extern uint8_t vram[]; 23 | extern uint16_t myPalette[]; 24 | 25 | // low level screen functions 26 | void ili9341_init(); 27 | 28 | // VRAM functions 29 | void clear_vram(); 30 | void clear_vram( 31 | const uint16_t x, 32 | const uint16_t y, 33 | const uint16_t width, 34 | const uint16_t height); 35 | void display_vram(); 36 | void blit_vram( 37 | const uint16_t x, 38 | const uint16_t y, 39 | const uint16_t width, 40 | const uint16_t height); 41 | 42 | // text functions 43 | void Draw_8x12_char( 44 | char* _char_matrix, 45 | int x_start, 46 | int y_start, 47 | unsigned char clr); 48 | void Draw_8x12_string( 49 | char* str, 50 | unsigned char len, 51 | int x_start, 52 | int y_start, 53 | unsigned char clr); 54 | void Draw_5x8_char( 55 | char* _char_matrix, 56 | int x_start, 57 | int y_start, 58 | unsigned char clr); 59 | void Draw_5x8_string( 60 | char* str, 61 | unsigned char len, 62 | int x_start, 63 | int y_start, 64 | unsigned char clr); 65 | 66 | // drawing functions 67 | void draw_rectangle( 68 | const point_s pos, 69 | const uint16_t width, 70 | const uint16_t height, 71 | const uint8_t outline, 72 | const uint8_t fill); 73 | void draw_circle( 74 | const point_s pos, 75 | const uint16_t radius, 76 | const uint8_t outline, 77 | const uint8_t fill); 78 | void draw_line( 79 | const point_s start, 80 | const point_s end, 81 | const uint8_t color); 82 | #endif //DISPLAY_INCLUDE_GUARD_ -------------------------------------------------------------------------------- /src/components/DisplayTask/DisplayTask.cpp: -------------------------------------------------------------------------------- 1 | #include "DisplayTask.hpp" 2 | #include "sdkconfig.h" 3 | #include "freertos/FreeRTOS.h" 4 | #include "freertos/task.h" 5 | 6 | #define MS_TO_TICKS( xTimeInMs ) (uint32_t)( ( ( TickType_t ) xTimeInMs * configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) 7 | 8 | namespace DisplayTask { 9 | 10 | // User definitions for the task 11 | bool updateDone = false; 12 | bool hasNewPlotData = false; 13 | bool hasNewTextData = false; 14 | // for sending data to the display 15 | std::queue qData; 16 | SemaphoreHandle_t qDataMutex = NULL; 17 | 18 | void pushData ( std::string data ) { 19 | if ( xSemaphoreTake( qDataMutex, ( TickType_t ) 100 ) == pdTRUE ) { 20 | qData.push(data); 21 | xSemaphoreGive( qDataMutex ); 22 | } 23 | } 24 | 25 | std::string popData ( void ) { 26 | std::string retData = ""; 27 | if ( xSemaphoreTake( qDataMutex, ( TickType_t ) 100 ) == pdTRUE ) { 28 | if (!qData.empty()) { 29 | retData = qData.front(); 30 | qData.pop(); 31 | } 32 | xSemaphoreGive( qDataMutex ); 33 | } 34 | return retData; 35 | } 36 | 37 | int graphHeight = DISPLAY_HEIGHT * 2 / 3; 38 | int debugHeight = DISPLAY_HEIGHT - graphHeight; 39 | 40 | GraphDisplay graphDisplay( 0, DISPLAY_WIDTH, 0, graphHeight ); 41 | TextDisplay debugDisplay( 0, DISPLAY_WIDTH, graphHeight + 1, DISPLAY_HEIGHT ); 42 | 43 | // Graph Display 44 | 45 | void GraphDisplay::Plot::init( const std::string& newName ) { 46 | name = newName; 47 | color = rand() % 256; 48 | range = 1; 49 | min = 0; 50 | max = 0; 51 | memset( data, 0, MAX_PLOT_DATA_LEN ); 52 | } 53 | 54 | void GraphDisplay::Plot::update( void ) { 55 | for (int i=0; i max) 57 | max = data[i]; 58 | else if (data[i] < min) 59 | min = data[i]; 60 | } 61 | range = max - min; 62 | if (range == 0) range = 1; 63 | } 64 | 65 | void GraphDisplay::Plot::shift( int newData ) { 66 | shift(); 67 | data[MAX_PLOT_DATA_LEN - 1] = newData; 68 | update(); 69 | } 70 | 71 | void GraphDisplay::Plot::shift( void ) { 72 | for (int i=0; idata[i-1] - plot->min)*(bottom-top))/plot->range) }, 81 | { (uint16_t) (left+(i*right)/MAX_PLOT_DATA_LEN), 82 | (uint16_t) (bottom-((plot->data[i] - plot->min)*(bottom-top))/plot->range) }, 83 | plot->color); 84 | } 85 | } 86 | 87 | void GraphDisplay::shiftPlots( void ) { 88 | for (int i=0; i<_numPlots; i++) { 89 | _plots[i].shift( 0 ); 90 | } 91 | } 92 | 93 | void GraphDisplay::clearPlots( void ) { 94 | _numPlots = 0; 95 | } 96 | 97 | void GraphDisplay::drawPlots( void ) { 98 | for (int i=0; i<_numPlots; i++) { 99 | drawPlot(&_plots[i]); 100 | } 101 | } 102 | 103 | void GraphDisplay::addData( std::string& plotName, int newData ) { 104 | int pi = getPlotIndex( plotName ); 105 | if ( pi == -1 ) 106 | pi = createPlot( plotName, true ); 107 | _plots[pi].shift( newData ); 108 | } 109 | 110 | int GraphDisplay::createPlot( std::string& plotName, bool overWrite ) { 111 | int index = getPlotIndex( plotName ); 112 | if (index > -1) { 113 | if ( overWrite ) { 114 | // will overwrite plot that has the same name with empty plot 115 | _plots[index].init( plotName ); 116 | } 117 | return index; 118 | } 119 | else { 120 | if ( _numPlots < MAX_PLOTS ) { 121 | index = _numPlots++; 122 | _plots[index].init( plotName ); 123 | return index; 124 | } 125 | else if ( overWrite ) { 126 | index = 0; 127 | _plots[index].init( plotName ); 128 | return index; 129 | } 130 | } 131 | return -1; 132 | } 133 | 134 | void GraphDisplay::removePlot( std::string& plotName ) { 135 | int index = getPlotIndex( plotName ); 136 | removePlot( index ); 137 | } 138 | 139 | void GraphDisplay::removePlot( int index ) { 140 | if (index > -1) { 141 | for (int i=index; i<_numPlots; i++) 142 | _plots[i] = _plots[i+1]; 143 | _numPlots--; 144 | } 145 | } 146 | 147 | GraphDisplay::Plot* GraphDisplay::getPlot( std::string& plotName ) { 148 | int index = getPlotIndex( plotName ); 149 | if (index > -1) 150 | return &_plots[index]; 151 | else 152 | return nullptr; 153 | } 154 | 155 | int GraphDisplay::getPlotIndex( std::string& plotName ) { 156 | for (int i=0; i<_numPlots; i++) { 157 | if (_plots[i].name == plotName ) 158 | return i; 159 | } 160 | return -1; 161 | } 162 | 163 | bool GraphDisplay::hasPlot( std::string& plotName ) { 164 | return getPlotIndex( plotName ) > -1; 165 | } 166 | 167 | // TextDisplay 168 | 169 | void TextDisplay::init( void ) { 170 | clearLogs(); 171 | } 172 | 173 | void TextDisplay::clearLogs( void ) { 174 | _logs = std::deque(); 175 | for (int i=0; i 0) { 337 | // have data, parse here 338 | std::stringstream ss(newData); 339 | std::string line; 340 | while (std::getline(ss, line, '\n')) { 341 | size_t pos = 0; 342 | // parse for commands 343 | if ( (pos = line.find(commandDelim)) != std::string::npos) { 344 | std::string command; 345 | std::string plotName; 346 | command = line.substr(pos + commandDelim.length(), line.length()); 347 | if (command == clearLogsCommand) { 348 | debugDisplay.clearLogs(); 349 | // make sure we transition to the next state 350 | hasNewTextData = true; 351 | } 352 | else if (command == clearPlotsCommand) { 353 | graphDisplay.clearPlots(); 354 | // make sure we transition to the next state 355 | hasNewPlotData = true; 356 | } 357 | else if ( (pos = line.find(removePlotCommand)) != std::string::npos) { 358 | plotName = line.substr(pos + removePlotCommand.length(), line.length()); 359 | graphDisplay.removePlot( plotName ); 360 | // make sure we transition to the next state 361 | hasNewPlotData = true; 362 | } 363 | } 364 | else { 365 | // parse for data 366 | if ( (pos = line.find(dataDelim)) != std::string::npos) { 367 | // found "::" so we have a plot data 368 | std::string plotName; 369 | std::string value; 370 | int iValue; 371 | plotName = line.substr(0, pos); 372 | pos = pos + dataDelim.length(); 373 | if ( pos < line.length() ) { 374 | value = line.substr(pos, line.length()); 375 | iValue = std::stoi(value); 376 | // make sure we transition to the next state 377 | graphDisplay.addData( plotName, iValue ); 378 | hasNewPlotData = true; 379 | } 380 | else { 381 | // couldn't find that, so we just have text data 382 | debugDisplay.addLog( line ); 383 | // make sure we transition to the next state 384 | hasNewTextData = true; 385 | } 386 | } 387 | else { 388 | // couldn't find that, so we just have text data 389 | debugDisplay.addLog( line ); 390 | // make sure we transition to the next state 391 | hasNewTextData = true; 392 | } 393 | } 394 | } 395 | } 396 | } 397 | } 398 | 399 | void state_Wait_For_Data_setState( void ) { 400 | stateLevel_0 = state_Wait_For_Data; 401 | } 402 | 403 | void state_Wait_For_Data_transition( void ) { 404 | if (__change_state__) 405 | return; 406 | else if ( hasNewTextData ) { 407 | __change_state__ = true; 408 | // run the current state's finalization function 409 | state_Wait_For_Data_finalization(); 410 | // set the current state to the state we are transitioning to 411 | state_Update_Text_setState(); 412 | // start state timer (@ next states period) 413 | __state_delay__ = 100; 414 | // execute the transition function 415 | hasNewTextData = false; 416 | debugDisplay.clear(); 417 | 418 | } 419 | else if ( hasNewPlotData ) { 420 | __change_state__ = true; 421 | // run the current state's finalization function 422 | state_Wait_For_Data_finalization(); 423 | // set the current state to the state we are transitioning to 424 | state_Update_Graph_setState(); 425 | // start state timer (@ next states period) 426 | __state_delay__ = 100; 427 | // execute the transition function 428 | hasNewPlotData = false; 429 | graphDisplay.clear(); 430 | 431 | } 432 | } 433 | 434 | void state_Wait_For_Data_finalization( void ) { 435 | 436 | } 437 | 438 | 439 | }; 440 | -------------------------------------------------------------------------------- /src/components/DisplayTask/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/components/DisplayTask/include/DisplayTask.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __DisplayTask__INCLUDE_GUARD 2 | #define __DisplayTask__INCLUDE_GUARD 3 | 4 | #include 5 | 6 | // Task Includes 7 | #define _GLIBCXX_USE_C99 1 // needed for std::stoi 8 | 9 | #include "Display.hpp" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | extern "C" { 18 | #include "freertos/FreeRTOS.h" 19 | #include "freertos/task.h" 20 | #include "freertos/event_groups.h" 21 | #include "freertos/semphr.h" 22 | } 23 | 24 | // Generated state functions and members for the task 25 | namespace DisplayTask { 26 | 27 | // Task Forward Declarations 28 | extern bool updateDone; 29 | extern bool hasNewPlotData; 30 | extern bool hasNewTextData; 31 | // for interacting sending data to the display 32 | extern std::queue qData; 33 | extern SemaphoreHandle_t qDataMutex; 34 | 35 | void pushData ( std::string data ); 36 | std::string popData ( void ); 37 | 38 | class Window { 39 | public: 40 | Window( int l, int r, int t, int b ) : left(l), right(r), top(t), bottom(b) {} 41 | 42 | int width ( void ) { return (right - left + 1); } 43 | int height ( void ) { return (bottom - top + 1); } 44 | 45 | void clear ( void ) { clear_vram( left, top, width(), height() ); } 46 | 47 | protected: 48 | 49 | int left = 0; 50 | int right = DISPLAY_WIDTH; 51 | int top = 0; 52 | int bottom = DISPLAY_HEIGHT; 53 | }; 54 | 55 | class GraphDisplay : public Window { 56 | public: 57 | GraphDisplay( int l, int r, int t, int b ) : Window(l, r, t, b) {} 58 | 59 | #define MAX_PLOT_NAME_LEN 100 60 | #define MIN_X_SPACING 12 61 | #define MAX_PLOT_DATA_LEN (DISPLAY_WIDTH / MIN_X_SPACING) 62 | #define MAX_PLOTS 10 63 | 64 | struct Plot { 65 | std::string name; 66 | char color; 67 | int range; 68 | int min; 69 | int max; 70 | int data [ MAX_PLOT_DATA_LEN ]; 71 | 72 | void init ( const std::string& newName = "" ); 73 | void update ( void ); 74 | void shift ( int newData ); 75 | void shift ( void ); 76 | }; 77 | 78 | void shiftPlots ( void ); // left shifts each plot by 1 element 79 | void clearPlots ( void ); 80 | void drawPlots ( void ); 81 | void drawPlot ( Plot* plot ); 82 | void addData ( std::string& plotName, int newData ); 83 | int createPlot ( std::string& plotName, bool overWrite = false ); 84 | void removePlot ( std::string& plotName ); 85 | void removePlot ( int index ); 86 | 87 | protected: 88 | int getPlotIndex ( std::string& plotName ); 89 | Plot* getPlot ( std::string& plotName ); 90 | bool hasPlot ( std::string& plotName ); 91 | 92 | private: 93 | Plot _plots[ MAX_PLOTS ]; 94 | int _numPlots = 0; 95 | }; 96 | 97 | class TextDisplay : public Window { 98 | public: 99 | TextDisplay( int l, int r, int t, int b ) : Window(l, r, t, b) {} 100 | 101 | static const int maxLogs = 7; 102 | static const int logHeight = 12; 103 | 104 | void init ( void ); 105 | void clearLogs( void ); 106 | void addLog ( const std::string& newLog ); 107 | void drawLogs ( void ); 108 | 109 | private: 110 | std::deque _logs; 111 | int _numLogs = 0; 112 | }; 113 | 114 | extern GraphDisplay graphDisplay; 115 | extern TextDisplay debugDisplay; 116 | 117 | 118 | // Generated task function 119 | void taskFunction ( void *pvParameter ); 120 | 121 | // Generated state functions 122 | void state_Update_Text_execute ( void ); 123 | void state_Update_Text_setState ( void ); 124 | void state_Update_Text_transition ( void ); 125 | void state_Update_Text_finalization ( void ); 126 | void state_Update_Graph_execute ( void ); 127 | void state_Update_Graph_setState ( void ); 128 | void state_Update_Graph_transition ( void ); 129 | void state_Update_Graph_finalization ( void ); 130 | void state_Wait_For_Data_execute ( void ); 131 | void state_Wait_For_Data_setState ( void ); 132 | void state_Wait_For_Data_transition ( void ); 133 | void state_Wait_For_Data_finalization ( void ); 134 | 135 | }; 136 | 137 | #endif // __DisplayTask__INCLUDE_GUARD 138 | -------------------------------------------------------------------------------- /src/components/Fonts/Fonts.cpp: -------------------------------------------------------------------------------- 1 | #include "Fonts.hpp" 2 | const char data_0[5] = {0x81, 0x6E, 0x76, 0x7A, 0x81}; 3 | const char data_1[5] = {0xFF, 0x7D, 0x00, 0x7F, 0xFF}; 4 | const char data_2[5] = {0x3D, 0x5E, 0x6E, 0x76, 0x79}; 5 | const char data_3[5] = {0xBE, 0x7E, 0x7A, 0x74, 0x8E}; 6 | const char data_4[5] = {0xE7, 0xEB, 0xED, 0x00, 0xEF}; 7 | const char data_5[5] = {0xB0, 0x76, 0x76, 0x76, 0x8E}; 8 | const char data_6[5] = {0x83, 0x6D, 0x6E, 0x6E, 0x9F}; 9 | const char data_7[5] = {0xFE, 0x1E, 0xEE, 0xF6, 0xF0}; 10 | const char data_8[5] = {0x89, 0x76, 0x76, 0x76, 0x89}; 11 | const char data_9[5] = {0xF9, 0x76, 0x76, 0xB6, 0xC1}; 12 | const char data_A[5] = {0x01, 0xEE, 0xEE, 0xEE, 0x01}; 13 | const char data_B[5] = {0x00, 0x76, 0x76, 0x76, 0x89}; 14 | const char data_C[5] = {0x81, 0x7E, 0x7E, 0x7E, 0xBD}; 15 | const char data_D[5] = {0x00, 0x7E, 0x7E, 0xBD, 0xC3}; 16 | const char data_E[5] = {0x00, 0x76, 0x76, 0x76, 0x7E}; 17 | const char data_F[5] = {0x00, 0xF6, 0xF6, 0xF6, 0xFE}; 18 | const char data_G[5] = {0x81, 0x7E, 0x6E, 0x6E, 0x0D}; 19 | const char data_H[5] = {0x00, 0xF7, 0xF7, 0xF7, 0x00}; 20 | const char data_I[5] = {0xFF, 0x7E, 0x00, 0x7E, 0xFF}; 21 | const char data_J[5] = {0xBF, 0x7F, 0x7E, 0x80, 0xFE}; 22 | const char data_K[5] = {0x00, 0xEF, 0xD7, 0xBB, 0x7D}; 23 | const char data_L[5] = {0x00, 0x7F, 0x7F, 0x7F, 0x7F}; 24 | const char data_M[5] = {0x00, 0xFD, 0xFB, 0xFD, 0x00}; 25 | const char data_N[5] = {0x00, 0xFB, 0xF7, 0xEF, 0x00}; 26 | const char data_O[5] = {0x81, 0x7E, 0x7E, 0x7E, 0x81}; 27 | const char data_P[5] = {0x00, 0xEE, 0xEE, 0xEE, 0xF1}; 28 | const char data_Q[5] = {0x81, 0x7E, 0x5E, 0xBE, 0x41}; 29 | const char data_R[5] = {0x00, 0xE6, 0xD6, 0xB6, 0x79}; 30 | const char data_S[5] = {0x79, 0x76, 0x76, 0x76, 0x8E}; 31 | const char data_T[5] = {0xFE, 0xFE, 0x00, 0xFE, 0xFE}; 32 | const char data_U[5] = {0x80, 0x7F, 0x7F, 0x7F, 0x80}; 33 | const char data_V[5] = {0xC0, 0xBF, 0x7F, 0xBF, 0xC0}; 34 | const char data_W[5] = {0x80, 0x7F, 0x8F, 0x7F, 0x80}; 35 | const char data_X[5] = {0x1C, 0xEB, 0xF7, 0xEB, 0x1C}; 36 | const char data_Y[5] = {0xF0, 0xEF, 0x1F, 0xEF, 0xF0}; 37 | const char data_Z[5] = {0x3E, 0x5E, 0x6E, 0x76, 0x78}; 38 | const char data_a[5] = {0xBF, 0x57, 0x57, 0x57, 0x0F}; 39 | const char data_b[5] = {0x00, 0x6F, 0x77, 0x77, 0x8F}; 40 | const char data_c[5] = {0x8F, 0x77, 0x77, 0x77, 0xBF}; 41 | const char data_d[5] = {0x8F, 0x77, 0x77, 0x6F, 0x00}; 42 | const char data_e[5] = {0x8F, 0x57, 0x57, 0x57, 0xCF}; 43 | const char data_f[5] = {0xEF, 0x01, 0xEE, 0xFE, 0xFD}; 44 | const char data_g[5] = {0xE7, 0x5B, 0x5B, 0x5B, 0x83}; 45 | const char data_h[5] = {0x00, 0xEF, 0xF7, 0xF7, 0x0F}; 46 | const char data_i[5] = {0xFF, 0x77, 0x05, 0x7F, 0xFF}; 47 | const char data_j[5] = {0xBF, 0x7F, 0x77, 0x85, 0xFF}; 48 | const char data_k[5] = {0x00, 0xDF, 0xAF, 0x77, 0xFF}; 49 | const char data_l[5] = {0xFF, 0x7E, 0x00, 0x7F, 0xFF}; 50 | const char data_m[5] = {0x07, 0xF7, 0x8F, 0xF7, 0x0F}; 51 | const char data_n[5] = {0x07, 0xEF, 0xF7, 0xF7, 0x0F}; 52 | const char data_o[5] = {0x8F, 0x77, 0x77, 0x77, 0x8F}; 53 | const char data_p[5] = {0x03, 0xDB, 0xDB, 0xDB, 0xE7}; 54 | const char data_q[5] = {0xE7, 0xDB, 0xDB, 0xD7, 0x03}; 55 | const char data_r[5] = {0x07, 0xEF, 0xF7, 0xF7, 0xEF}; 56 | const char data_s[5] = {0x6F, 0x57, 0x57, 0x57, 0xBF}; 57 | const char data_t[5] = {0xF7, 0x80, 0x77, 0x7F, 0xBF}; 58 | const char data_u[5] = {0x87, 0x7F, 0x7F, 0xBF, 0x07}; 59 | const char data_v[5] = {0xC7, 0xBF, 0x7F, 0xBF, 0xC7}; 60 | const char data_w[5] = {0x87, 0x7F, 0x9F, 0x7F, 0x87}; 61 | const char data_x[5] = {0x77, 0xAF, 0xDF, 0xAF, 0x77}; 62 | const char data_y[5] = {0xE7, 0x5F, 0x5F, 0x5F, 0x87}; 63 | const char data_z[5] = {0x77, 0x37, 0x57, 0x67, 0x77}; 64 | const char data_SPACE[5] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; 65 | const char data_minus[5] = {0xEF, 0xEF, 0xEF, 0xEF, 0xEF}; 66 | const char data_comma[5] = {0xFF, 0x5F, 0x9F, 0xFF, 0xFF}; 67 | const char data_equal[5] = {0xD7, 0xD7, 0xD7, 0xD7, 0xD7}; 68 | const char data_leftbrace[5] = {0xFF, 0xEF, 0x81, 0x7E, 0xFF}; 69 | const char data_rightbrace[5] = {0xFF, 0x7E, 0x81, 0xEF, 0xFF}; 70 | 71 | const char _8x12_d0[12] = { 0,0,0,0,0,0,0,0,0,0,0,0}; 72 | const char _8x12_d1[12] = { 0,126,129,165,129,129,189,153,129,126,0,0}; 73 | const char _8x12_d2[12] = { 0,126,255,219,255,255,195,231,255,126,0,0}; 74 | const char _8x12_d3[12] = { 0,0,108,238,254,254,254,124,56,16,0,0}; 75 | const char _8x12_d4[12] = { 0,0,16,56,124,254,124,56,16,0,0,0}; 76 | const char _8x12_d5[12] = { 0,0,16,56,16,108,238,108,16,56,0,0}; 77 | const char _8x12_d6[12] = { 0,16,56,124,124,254,254,108,16,56,0,0}; 78 | const char _8x12_d7[12] = { 0,0,0,0,24,60,60,24,0,0,0,0}; 79 | const char _8x12_d8[12] = { 255,255,255,255,231,195,195,231,255,255,255,255}; 80 | const char _8x12_d9[12] = { 0,0,0,24,60,102,102,60,24,0,0,0}; 81 | const char _8x12_d10[12] = { 255,255,255,231,195,153,153,195,231,255,255,255}; 82 | const char _8x12_d11[12] = { 0,30,14,30,54,120,204,204,204,120,0,0}; 83 | const char _8x12_d12[12] = { 0,60,102,102,102,60,24,126,24,24,0,0}; 84 | const char _8x12_d13[12] = { 0,30,26,30,24,24,24,120,248,112,0,0}; 85 | const char _8x12_d14[12] = { 62,54,62,54,54,118,246,102,14,30,12,0}; 86 | const char _8x12_d15[12] = { 24,219,126,60,102,102,60,126,219,24,0,0}; 87 | const char _8x12_d16[12] = { 0,128,224,240,252,254,252,240,224,128,0,0}; 88 | const char _8x12_d17[12] = { 0,2,14,62,126,254,126,62,14,2,0,0}; 89 | const char _8x12_d18[12] = { 0,24,60,126,24,24,24,126,60,24,0,0}; 90 | const char _8x12_d19[12] = { 0,102,102,102,102,102,102,0,102,102,0,0}; 91 | const char _8x12_d20[12] = { 0,127,219,219,219,123,27,27,27,27,0,0}; 92 | const char _8x12_d21[12] = { 124,198,198,96,124,246,222,124,12,198,198,124}; 93 | const char _8x12_d22[12] = { 0,0,0,0,0,0,0,254,254,254,0,0}; 94 | const char _8x12_d23[12] = { 0,24,60,126,24,24,126,60,24,126,0,0}; 95 | const char _8x12_d24[12] = { 0,24,60,126,24,24,24,24,24,24,0,0}; 96 | const char _8x12_d25[12] = { 0,24,24,24,24,24,24,126,60,24,0,0}; 97 | const char _8x12_d26[12] = { 0,0,0,12,14,255,14,12,0,0,0,0}; 98 | const char _8x12_d27[12] = { 0,0,0,48,112,254,112,48,0,0,0,0}; 99 | const char _8x12_d28[12] = { 0,0,0,0,192,192,192,254,0,0,0,0}; 100 | const char _8x12_d29[12] = { 0,0,0,36,102,255,102,36,0,0,0,0}; 101 | const char _8x12_d30[12] = { 0,16,56,56,56,124,124,254,254,0,0,0}; 102 | const char _8x12_d31[12] = { 0,254,254,124,124,124,56,56,16,0,0,0}; 103 | const char _8x12_space[12] = { 0,0,0,0,0,0,0,0,0,0,0,0}; 104 | const char _8x12_d33[12] = { 0,24,60,60,60,24,24,0,24,24,0,0}; 105 | const char _8x12_d34[12] = { 54,54,54,20,0,0,0,0,0,0,0,0}; 106 | const char _8x12_d35[12] = { 0,108,108,108,254,108,108,254,108,108,0,0}; 107 | const char _8x12_d36[12] = { 24,24,124,198,192,120,60,6,198,124,24,24}; 108 | const char _8x12_d37[12] = { 0,0,0,98,102,12,24,48,102,198,0,0}; 109 | const char _8x12_d38[12] = { 0,56,108,56,56,118,246,206,204,118,0,0}; 110 | const char _8x12_d39[12] = { 12,12,12,24,0,0,0,0,0,0,0,0}; 111 | const char _8x12_d40[12] = { 0,12,24,48,48,48,48,48,24,12,0,0}; 112 | const char _8x12_d41[12] = { 0,48,24,12,12,12,12,12,24,48,0,0}; 113 | const char _8x12_d42[12] = { 0,0,0,108,56,254,56,108,0,0,0,0}; 114 | const char _8x12_d43[12] = { 0,0,0,24,24,126,24,24,0,0,0,0}; 115 | const char _8x12_d44[12] = { 0,0,0,0,0,0,0,12,12,12,24,0}; 116 | const char _8x12_d45[12] = { 0,0,0,0,0,254,0,0,0,0,0,0}; 117 | const char _8x12_d46[12] = { 0,0,0,0,0,0,0,0,24,24,0,0}; 118 | const char _8x12_d47[12] = { 0,0,2,6,12,24,48,96,192,128,0,0}; 119 | const char _8x12_0[12] = { 0,124,198,206,222,246,230,198,198,124,0,0}; 120 | const char _8x12_1[12] = { 0,24,120,24,24,24,24,24,24,126,0,0}; 121 | const char _8x12_2[12] = { 0,124,198,198,12,24,48,96,198,254,0,0}; 122 | const char _8x12_3[12] = { 0,124,198,6,6,60,6,6,198,124,0,0}; 123 | const char _8x12_4[12] = { 0,12,28,60,108,204,254,12,12,12,0,0}; 124 | const char _8x12_5[12] = { 0,254,192,192,192,252,6,6,198,124,0,0}; 125 | const char _8x12_6[12] = { 0,124,198,192,192,252,198,198,198,124,0,0}; 126 | const char _8x12_7[12] = { 0,254,198,12,24,48,48,48,48,48,0,0}; 127 | const char _8x12_8[12] = { 0,124,198,198,198,124,198,198,198,124,0,0}; 128 | const char _8x12_9[12] = { 0,124,198,198,198,126,6,6,198,124,0,0}; 129 | const char _8x12_d58[12] = { 0,0,0,12,12,0,0,12,12,0,0,0}; 130 | const char _8x12_d59[12] = { 0,0,0,12,12,0,0,12,12,12,24,0}; 131 | const char _8x12_d60[12] = { 0,12,24,48,96,192,96,48,24,12,0,0}; 132 | const char _8x12_d61[12] = { 0,0,0,0,254,0,254,0,0,0,0,0}; 133 | const char _8x12_d62[12] = { 0,96,48,24,12,6,12,24,48,96,0,0}; 134 | const char _8x12_d63[12] = { 0,124,198,198,12,24,24,0,24,24,0,0}; 135 | const char _8x12_d64[12] = { 0,124,198,198,222,222,222,220,192,126,0,0}; 136 | const char _8x12_A[12] = { 0,56,108,198,198,198,254,198,198,198,0,0}; 137 | const char _8x12_B[12] = { 0,252,102,102,102,124,102,102,102,252,0,0}; 138 | const char _8x12_C[12] = { 0,60,102,192,192,192,192,192,102,60,0,0}; 139 | const char _8x12_D[12] = { 0,248,108,102,102,102,102,102,108,248,0,0}; 140 | const char _8x12_E[12] = { 0,254,102,96,96,124,96,96,102,254,0,0}; 141 | const char _8x12_F[12] = { 0,254,102,96,96,124,96,96,96,240,0,0}; 142 | const char _8x12_G[12] = { 0,124,198,198,192,192,206,198,198,124,0,0}; 143 | const char _8x12_H[12] = { 0,198,198,198,198,254,198,198,198,198,0,0}; 144 | const char _8x12_I[12] = { 0,60,24,24,24,24,24,24,24,60,0,0}; 145 | const char _8x12_J[12] = { 0,60,24,24,24,24,24,216,216,112,0,0}; 146 | const char _8x12_K[12] = { 0,198,204,216,240,240,216,204,198,198,0,0}; 147 | const char _8x12_L[12] = { 0,240,96,96,96,96,96,98,102,254,0,0}; 148 | const char _8x12_M[12] = { 0,198,198,238,254,214,214,214,198,198,0,0}; 149 | const char _8x12_N[12] = { 0,198,198,230,230,246,222,206,206,198,0,0}; 150 | const char _8x12_O[12] = { 0,124,198,198,198,198,198,198,198,124,0,0}; 151 | const char _8x12_P[12] = { 0,252,102,102,102,124,96,96,96,240,0,0}; 152 | const char _8x12_Q[12] = { 0,124,198,198,198,198,198,198,214,124,6,0}; 153 | const char _8x12_R[12] = { 0,252,102,102,102,124,120,108,102,230,0,0}; 154 | const char _8x12_S[12] = { 0,124,198,192,96,56,12,6,198,124,0,0}; 155 | const char _8x12_T[12] = { 0,126,90,24,24,24,24,24,24,60,0,0}; 156 | const char _8x12_U[12] = { 0,198,198,198,198,198,198,198,198,124,0,0}; 157 | const char _8x12_V[12] = { 0,198,198,198,198,198,198,108,56,16,0,0}; 158 | const char _8x12_W[12] = { 0,198,198,214,214,214,254,238,198,198,0,0}; 159 | const char _8x12_X[12] = { 0,198,198,108,56,56,56,108,198,198,0,0}; 160 | const char _8x12_Y[12] = { 0,102,102,102,102,60,24,24,24,60,0,0}; 161 | const char _8x12_Z[12] = { 0,254,198,140,24,48,96,194,198,254,0,0}; 162 | const char _8x12_d91[12] = { 0,124,96,96,96,96,96,96,96,124,0,0}; 163 | const char _8x12_d92[12] = { 0,0,128,192,96,48,24,12,6,2,0,0}; 164 | const char _8x12_d93[12] = { 0,124,12,12,12,12,12,12,12,124,0,0}; 165 | const char _8x12_d94[12] = { 16,56,108,198,0,0,0,0,0,0,0,0}; 166 | const char _8x12_d95[12] = { 0,0,0,0,0,0,0,0,0,0,0,255}; 167 | const char _8x12_d96[12] = { 24,24,24,12,0,0,0,0,0,0,0,0}; 168 | const char _8x12_a[12] = { 0,0,0,0,120,12,124,204,220,118,0,0}; 169 | const char _8x12_b[12] = { 0,224,96,96,124,102,102,102,102,252,0,0}; 170 | const char _8x12_c[12] = { 0,0,0,0,124,198,192,192,198,124,0,0}; 171 | const char _8x12_d[12] = { 0,28,12,12,124,204,204,204,204,126,0,0}; 172 | const char _8x12_e[12] = { 0,0,0,0,124,198,254,192,198,124,0,0}; 173 | const char _8x12_f[12] = { 0,28,54,48,48,252,48,48,48,120,0,0}; 174 | const char _8x12_g[12] = { 0,0,0,0,118,206,198,198,126,6,198,124}; 175 | const char _8x12_h[12] = { 0,224,96,96,108,118,102,102,102,230,0,0}; 176 | const char _8x12_i[12] = { 0,24,24,0,56,24,24,24,24,60,0,0}; 177 | const char _8x12_j[12] = { 0,12,12,0,28,12,12,12,12,204,204,120}; 178 | const char _8x12_k[12] = { 0,224,96,96,102,108,120,108,102,230,0,0}; 179 | const char _8x12_l[12] = { 0,56,24,24,24,24,24,24,24,60,0,0}; 180 | const char _8x12_m[12] = { 0,0,0,0,108,254,214,214,198,198,0,0}; 181 | const char _8x12_n[12] = { 0,0,0,0,220,102,102,102,102,102,0,0}; 182 | const char _8x12_o[12] = { 0,0,0,0,124,198,198,198,198,124,0,0}; 183 | const char _8x12_p[12] = { 0,0,0,0,220,102,102,102,124,96,96,240}; 184 | const char _8x12_q[12] = { 0,0,0,0,118,204,204,204,124,12,12,30}; 185 | const char _8x12_r[12] = { 0,0,0,0,220,102,96,96,96,240,0,0}; 186 | const char _8x12_s[12] = { 0,0,0,0,124,198,112,28,198,124,0,0}; 187 | const char _8x12_t[12] = { 0,48,48,48,252,48,48,48,54,28,0,0}; 188 | const char _8x12_u[12] = { 0,0,0,0,204,204,204,204,204,118,0,0}; 189 | const char _8x12_v[12] = { 0,0,0,0,198,198,198,108,56,16,0,0}; 190 | const char _8x12_w[12] = { 0,0,0,0,198,198,214,214,254,108,0,0}; 191 | const char _8x12_x[12] = { 0,0,0,0,198,108,56,56,108,198,0,0}; 192 | const char _8x12_y[12] = { 0,0,0,0,198,198,198,206,118,6,198,124}; 193 | const char _8x12_z[12] = { 0,0,0,0,254,140,24,48,98,254,0,0}; 194 | const char _8x12_d123[12] = { 0,14,24,24,24,112,24,24,24,14,0,0}; 195 | const char _8x12_d124[12] = { 0,24,24,24,24,0,24,24,24,24,0,0}; 196 | const char _8x12_d125[12] = { 0,112,24,24,24,14,24,24,24,112,0,0}; 197 | const char _8x12_d126[12] = { 0,118,220,0,0,0,0,0,0,0,0,0}; 198 | const char _8x12_d127[12] = { 0,0,0,16,56,56,108,108,254,0,0,0}; 199 | const char _8x12_d128[12] = { 0,60,102,192,192,192,198,102,60,24,204,56}; 200 | const char _8x12_d129[12] = { 0,198,198,0,198,198,198,198,206,118,0,0}; 201 | const char _8x12_d130[12] = { 12,24,48,0,124,198,254,192,198,124,0,0}; 202 | const char _8x12_d131[12] = { 48,120,204,0,120,12,124,204,220,118,0,0}; 203 | const char _8x12_d132[12] = { 0,204,204,0,120,12,124,204,220,118,0,0}; 204 | const char _8x12_d133[12] = { 96,48,24,0,120,12,124,204,220,118,0,0}; 205 | const char _8x12_d134[12] = { 56,108,56,0,120,12,124,204,220,118,0,0}; 206 | const char _8x12_d135[12] = { 0,0,0,124,198,192,192,198,124,24,108,56}; 207 | const char _8x12_d136[12] = { 48,120,204,0,124,198,254,192,198,124,0,0}; 208 | const char _8x12_d137[12] = { 0,204,204,0,124,198,254,192,198,124,0,0}; 209 | const char _8x12_d138[12] = { 48,24,12,0,124,198,254,192,198,124,0,0}; 210 | const char _8x12_d139[12] = { 0,102,102,0,56,24,24,24,24,60,0,0}; 211 | const char _8x12_d140[12] = { 24,60,102,0,56,24,24,24,24,60,0,0}; 212 | const char _8x12_d141[12] = { 96,48,24,0,56,24,24,24,24,60,0,0}; 213 | const char _8x12_d142[12] = { 198,198,0,56,108,198,254,198,198,198,0,0}; 214 | const char _8x12_d143[12] = { 56,108,56,0,56,108,198,198,254,198,198,0}; 215 | const char _8x12_d144[12] = { 12,24,48,0,254,96,96,124,96,96,254,0}; 216 | const char _8x12_d145[12] = { 0,0,0,102,219,27,127,216,223,118,0,0}; 217 | const char _8x12_d146[12] = { 126,216,216,216,216,254,216,216,216,222,0,0}; 218 | const char _8x12_d147[12] = { 48,120,204,0,124,198,198,198,198,124,0,0}; 219 | const char _8x12_d148[12] = { 0,198,198,0,124,198,198,198,198,124,0,0}; 220 | const char _8x12_d149[12] = { 48,24,12,0,124,198,198,198,198,124,0,0}; 221 | const char _8x12_d150[12] = { 48,120,204,0,198,198,198,198,206,118,0,0}; 222 | const char _8x12_d151[12] = { 96,48,24,0,198,198,198,198,206,118,0,0}; 223 | const char _8x12_d152[12] = { 0,198,198,0,198,198,198,206,118,6,198,124}; 224 | const char _8x12_d153[12] = { 198,198,0,124,198,198,198,198,198,124,0,0}; 225 | const char _8x12_d154[12] = { 198,198,0,198,198,198,198,198,198,124,0,0}; 226 | const char _8x12_d155[12] = { 24,24,60,102,96,96,102,60,24,24,0,0}; 227 | const char _8x12_d156[12] = { 0,56,108,96,96,240,96,102,246,108,0,0}; 228 | const char _8x12_d157[12] = { 0,102,102,60,24,126,24,60,24,24,0,0}; 229 | const char _8x12_d158[12] = { 252,198,252,192,204,222,204,204,204,198,0,0}; 230 | const char _8x12_d159[12] = { 14,27,24,24,24,126,24,24,24,24,216,112}; 231 | const char _8x12_d160[12] = { 12,24,48,0,120,12,124,204,220,118,0,0}; 232 | const char _8x12_d161[12] = { 12,24,48,0,56,24,24,24,24,60,0,0}; 233 | const char _8x12_d162[12] = { 12,24,48,0,124,198,198,198,198,124,0,0}; 234 | const char _8x12_d163[12] = { 24,48,96,0,204,204,204,204,220,118,0,0}; 235 | const char _8x12_d164[12] = { 0,118,220,0,188,102,102,102,102,230,0,0}; 236 | const char _8x12_d165[12] = { 118,220,0,198,198,230,246,222,206,198,0,0}; 237 | const char _8x12_d166[12] = { 60,108,108,62,0,126,0,0,0,0,0,0}; 238 | const char _8x12_d167[12] = { 56,108,108,56,0,124,0,0,0,0,0,0}; 239 | const char _8x12_d168[12] = { 0,48,48,0,48,48,96,198,198,124,0,0}; 240 | const char _8x12_d169[12] = { 0,0,0,0,0,126,96,96,96,0,0,0}; 241 | const char _8x12_d170[12] = { 0,0,0,0,0,126,6,6,6,0,0,0}; 242 | const char _8x12_d171[12] = { 96,98,102,108,24,48,96,220,54,12,24,62}; 243 | const char _8x12_d172[12] = { 96,98,102,108,24,54,110,222,54,126,6,6}; 244 | const char _8x12_d173[12] = { 0,24,24,0,24,24,60,60,60,24,0,0}; 245 | const char _8x12_d174[12] = { 0,0,0,54,108,216,108,54,0,0,0,0}; 246 | const char _8x12_d175[12] = { 0,0,0,216,108,54,108,216,0,0,0,0}; 247 | const char _8x12_d176[12] = { 17,68,17,68,17,68,17,68,17,68,17,68}; 248 | const char _8x12_d177[12] = { 85,170,85,170,85,170,85,170,85,170,85,170}; 249 | const char _8x12_d178[12] = { 221,119,221,119,221,119,221,119,221,119,221,119}; 250 | const char _8x12_d179[12] = { 24,24,24,24,24,24,24,24,24,24,24,24}; 251 | const char _8x12_d180[12] = { 24,24,24,24,24,24,248,24,24,24,24,24}; 252 | const char _8x12_d181[12] = { 24,24,24,24,248,24,248,24,24,24,24,24}; 253 | const char _8x12_d182[12] = { 54,54,54,54,54,54,246,54,54,54,54,54}; 254 | const char _8x12_d183[12] = { 0,0,0,0,0,0,254,54,54,54,54,54}; 255 | const char _8x12_d184[12] = { 0,0,0,0,248,24,248,24,24,24,24,24}; 256 | const char _8x12_d185[12] = { 54,54,54,54,246,6,246,54,54,54,54,54}; 257 | const char _8x12_d186[12] = { 54,54,54,54,54,54,54,54,54,54,54,54}; 258 | const char _8x12_d187[12] = { 0,0,0,0,254,6,246,54,54,54,54,54}; 259 | const char _8x12_d188[12] = { 54,54,54,54,246,6,254,0,0,0,0,0}; 260 | const char _8x12_d189[12] = { 54,54,54,54,54,54,254,0,0,0,0,0}; 261 | const char _8x12_d190[12] = { 24,24,24,24,248,24,248,0,0,0,0,0}; 262 | const char _8x12_d191[12] = { 0,0,0,0,0,0,248,24,24,24,24,24}; 263 | const char _8x12_d192[12] = { 24,24,24,24,24,24,31,0,0,0,0,0}; 264 | const char _8x12_d193[12] = { 24,24,24,24,24,24,255,0,0,0,0,0}; 265 | const char _8x12_d194[12] = { 0,0,0,0,0,0,255,24,24,24,24,24}; 266 | const char _8x12_d195[12] = { 24,24,24,24,24,24,31,24,24,24,24,24}; 267 | const char _8x12_d196[12] = { 0,0,0,0,0,0,255,0,0,0,0,0}; 268 | const char _8x12_d197[12] = { 24,24,24,24,24,24,255,24,24,24,24,24}; 269 | const char _8x12_d198[12] = { 24,24,24,24,31,24,31,24,24,24,24,24}; 270 | const char _8x12_d199[12] = { 54,54,54,54,54,54,55,54,54,54,54,54}; 271 | const char _8x12_d200[12] = { 54,54,54,54,55,48,63,0,0,0,0,0}; 272 | const char _8x12_d201[12] = { 0,0,0,0,63,48,55,54,54,54,54,54}; 273 | const char _8x12_d202[12] = { 54,54,54,54,247,0,255,0,0,0,0,0}; 274 | const char _8x12_d203[12] = { 0,0,0,0,255,0,247,54,54,54,54,54}; 275 | const char _8x12_d204[12] = { 54,54,54,54,55,48,55,54,54,54,54,54}; 276 | const char _8x12_d205[12] = { 0,0,0,0,255,0,255,0,0,0,0,0}; 277 | const char _8x12_d206[12] = { 54,54,54,54,247,0,247,54,54,54,54,54}; 278 | const char _8x12_d207[12] = { 24,24,24,24,255,0,255,0,0,0,0,0}; 279 | const char _8x12_d208[12] = { 54,54,54,54,54,54,255,0,0,0,0,0}; 280 | const char _8x12_d209[12] = { 0,0,0,0,255,0,255,24,24,24,24,24}; 281 | const char _8x12_d210[12] = { 0,0,0,0,0,0,255,54,54,54,54,54}; 282 | const char _8x12_d211[12] = { 54,54,54,54,54,54,63,0,0,0,0,0}; 283 | const char _8x12_d212[12] = { 24,24,24,24,31,24,31,0,0,0,0,0}; 284 | const char _8x12_d213[12] = { 0,0,0,0,31,24,31,24,24,24,24,24}; 285 | const char _8x12_d214[12] = { 0,0,0,0,0,0,63,54,54,54,54,54}; 286 | const char _8x12_d215[12] = { 54,54,54,54,54,54,255,54,54,54,54,54}; 287 | const char _8x12_d216[12] = { 24,24,24,24,255,24,255,24,24,24,24,24}; 288 | const char _8x12_d217[12] = { 24,24,24,24,24,24,248,0,0,0,0,0}; 289 | const char _8x12_d218[12] = { 0,0,0,0,0,0,31,24,24,24,24,24}; 290 | const char _8x12_d219[12] = { 255,255,255,255,255,255,255,255,255,255,255,255}; 291 | const char _8x12_d220[12] = { 0,0,0,0,0,0,255,255,255,255,255,255}; 292 | const char _8x12_d221[12] = { 240,240,240,240,240,240,240,240,240,240,240,240}; 293 | const char _8x12_d222[12] = { 15,15,15,15,15,15,15,15,15,15,15,15}; 294 | const char _8x12_d223[12] = { 255,255,255,255,255,255,0,0,0,0,0,0}; 295 | const char _8x12_d224[12] = { 0,0,0,118,220,216,216,216,220,118,0,0}; 296 | const char _8x12_d225[12] = { 0,0,0,120,204,216,252,198,230,220,192,192}; 297 | const char _8x12_d226[12] = { 0,254,102,98,96,96,96,96,96,96,0,0}; 298 | const char _8x12_d227[12] = { 0,0,0,0,254,108,108,108,108,108,0,0}; 299 | const char _8x12_d228[12] = { 0,254,198,98,48,24,48,98,198,254,0,0}; 300 | const char _8x12_d229[12] = { 0,0,0,0,126,216,204,204,204,120,0,0}; 301 | const char _8x12_d230[12] = { 0,0,0,102,102,102,102,124,96,192,128,0}; 302 | const char _8x12_d231[12] = { 0,0,0,0,118,220,24,24,24,24,0,0}; 303 | const char _8x12_d232[12] = { 0,254,56,108,198,198,198,108,56,254,0,0}; 304 | const char _8x12_d233[12] = { 0,56,108,198,198,254,198,198,108,56,0,0}; 305 | const char _8x12_d234[12] = { 0,56,108,198,198,198,108,108,108,238,0,0}; 306 | const char _8x12_d235[12] = { 0,62,96,48,60,102,198,198,204,120,0,0}; 307 | const char _8x12_d236[12] = { 0,0,0,0,126,219,219,126,0,0,0,0}; 308 | const char _8x12_d237[12] = { 0,6,12,124,222,246,230,124,96,192,0,0}; 309 | const char _8x12_d238[12] = { 0,28,48,96,96,124,96,96,48,28,0,0}; 310 | const char _8x12_d239[12] = { 0,124,198,198,198,198,198,198,198,198,0,0}; 311 | const char _8x12_d240[12] = { 0,0,0,0,254,0,254,0,254,0,0,0}; 312 | const char _8x12_d241[12] = { 0,0,0,24,24,126,24,24,0,126,0,0}; 313 | const char _8x12_d242[12] = { 0,48,24,12,6,12,24,48,0,126,0,0}; 314 | const char _8x12_d243[12] = { 0,12,24,48,96,48,24,12,0,126,0,0}; 315 | const char _8x12_d244[12] = { 0,0,12,30,26,24,24,24,24,24,24,24}; 316 | const char _8x12_d245[12] = { 24,24,24,24,24,24,24,24,88,120,48,0}; 317 | const char _8x12_d246[12] = { 0,0,24,24,0,126,0,24,24,0,0,0}; 318 | const char _8x12_d247[12] = { 0,0,0,0,118,220,0,118,220,0,0,0}; 319 | const char _8x12_d248[12] = { 0,120,204,204,120,0,0,0,0,0,0,0}; 320 | const char _8x12_d249[12] = { 0,0,0,0,0,24,24,0,0,0,0,0}; 321 | const char _8x12_d250[12] = { 0,0,0,0,0,0,24,0,0,0,0,0}; 322 | const char _8x12_d251[12] = { 0,0,31,24,24,24,24,216,120,56,24,0}; 323 | const char _8x12_d252[12] = { 216,108,108,108,108,0,0,0,0,0,0,0}; 324 | const char _8x12_d253[12] = { 112,216,48,96,248,0,0,0,0,0,0,0}; 325 | const char _8x12_d254[12] = { 0,0,0,126,126,126,126,126,126,0,0,0}; 326 | const char _8x12_d255[12] = { 0,0,0,0,0,0,0,0,0,0,0,0}; 327 | 328 | 329 | 330 | const char *char5x8_matrix[127] = {_8x12_d0, 331 | _8x12_d1, 332 | _8x12_d2, 333 | _8x12_d3, 334 | _8x12_d4, 335 | _8x12_d5, 336 | _8x12_d6, 337 | _8x12_d7, 338 | _8x12_d8, 339 | _8x12_d9, 340 | _8x12_d10, 341 | _8x12_d11, 342 | _8x12_d12, 343 | _8x12_d13, 344 | _8x12_d14, 345 | _8x12_d15, 346 | _8x12_d16, 347 | _8x12_d17, 348 | _8x12_d18, 349 | _8x12_d19, 350 | _8x12_d20, 351 | _8x12_d21, 352 | _8x12_d22, 353 | _8x12_d23, 354 | _8x12_d24, 355 | _8x12_d25, 356 | _8x12_d26, 357 | _8x12_d27, 358 | _8x12_d28, 359 | _8x12_d29, 360 | _8x12_d30, 361 | _8x12_d31, 362 | data_SPACE, 363 | _8x12_d33, 364 | _8x12_d34, 365 | _8x12_d35, 366 | _8x12_d36, 367 | _8x12_d37, 368 | _8x12_d38, 369 | _8x12_d39, 370 | _8x12_d40, 371 | _8x12_d41, 372 | _8x12_d42, 373 | _8x12_d43, 374 | data_comma, 375 | data_minus, 376 | _8x12_d46, 377 | _8x12_d47, 378 | data_0, 379 | data_1, 380 | data_2, 381 | data_3, 382 | data_4, 383 | data_5, 384 | data_6, 385 | data_7, 386 | data_8, 387 | data_9, 388 | _8x12_d58, 389 | _8x12_d59, 390 | _8x12_d60, 391 | data_equal, 392 | _8x12_d62, 393 | _8x12_d63, 394 | _8x12_d64, 395 | data_A, 396 | data_B, 397 | data_C, 398 | data_D, 399 | data_E, 400 | data_F, 401 | data_G, 402 | data_H, 403 | data_I, 404 | data_J, 405 | data_K, 406 | data_L, 407 | data_M, 408 | data_N, 409 | data_O, 410 | data_P, 411 | data_Q, 412 | data_R, 413 | data_S, 414 | data_T, 415 | data_U, 416 | data_V, 417 | data_W, 418 | data_X, 419 | data_Y, 420 | data_Z, 421 | _8x12_d91,_8x12_d92,_8x12_d93,_8x12_d94,_8x12_d95,_8x12_d96, 422 | data_a, 423 | data_b, 424 | data_c, 425 | data_d, 426 | data_e, 427 | data_f, 428 | data_g, 429 | data_h, 430 | data_i, 431 | data_j, 432 | data_k, 433 | data_l, 434 | data_m, 435 | data_n, 436 | data_o, 437 | data_p, 438 | data_q, 439 | data_r, 440 | data_s, 441 | data_t, 442 | data_u, 443 | data_v, 444 | data_w, 445 | data_x, 446 | data_y,data_z,data_leftbrace,_8x12_d124,data_rightbrace}; 447 | 448 | 449 | const char *char8x12_matrix[256]= {_8x12_d0, 450 | _8x12_d1, 451 | _8x12_d2, 452 | _8x12_d3, 453 | _8x12_d4, 454 | _8x12_d5, 455 | _8x12_d6, 456 | _8x12_d7, 457 | _8x12_d8, 458 | _8x12_d9, 459 | _8x12_d10, 460 | _8x12_d11, 461 | _8x12_d12, 462 | _8x12_d13, 463 | _8x12_d14, 464 | _8x12_d15, 465 | _8x12_d16, 466 | _8x12_d17, 467 | _8x12_d18, 468 | _8x12_d19, 469 | _8x12_d20, 470 | _8x12_d21, 471 | _8x12_d22, 472 | _8x12_d23, 473 | _8x12_d24, 474 | _8x12_d25, 475 | _8x12_d26, 476 | _8x12_d27, 477 | _8x12_d28, 478 | _8x12_d29, 479 | _8x12_d30, 480 | _8x12_d31, 481 | _8x12_space, 482 | _8x12_d33, 483 | _8x12_d34, 484 | _8x12_d35, 485 | _8x12_d36, 486 | _8x12_d37, 487 | _8x12_d38, 488 | _8x12_d39, 489 | _8x12_d40, 490 | _8x12_d41, 491 | _8x12_d42, 492 | _8x12_d43, 493 | _8x12_d44, 494 | _8x12_d45, 495 | _8x12_d46, 496 | _8x12_d47, 497 | _8x12_0,_8x12_1,_8x12_2,_8x12_3,_8x12_4,_8x12_5,_8x12_6,_8x12_7,_8x12_8,_8x12_9, 498 | _8x12_d58, 499 | _8x12_d59, 500 | _8x12_d60, 501 | _8x12_d61, 502 | _8x12_d62, 503 | _8x12_d63, 504 | _8x12_d64, 505 | _8x12_A, 506 | _8x12_B, 507 | _8x12_C, 508 | _8x12_D, 509 | _8x12_E, 510 | _8x12_F, 511 | _8x12_G, 512 | _8x12_H, 513 | _8x12_I, 514 | _8x12_J, 515 | _8x12_K, 516 | _8x12_L, 517 | _8x12_M, 518 | _8x12_N, 519 | _8x12_O, 520 | _8x12_P, 521 | _8x12_Q, 522 | _8x12_R, 523 | _8x12_S, 524 | _8x12_T, 525 | _8x12_U, 526 | _8x12_V, 527 | _8x12_W, 528 | _8x12_X, 529 | _8x12_Y, 530 | _8x12_Z, 531 | _8x12_d91,_8x12_d92,_8x12_d93,_8x12_d94,_8x12_d95,_8x12_d96,_8x12_a,_8x12_b,_8x12_c,_8x12_d,_8x12_e,_8x12_f,_8x12_g,_8x12_h,_8x12_i,_8x12_j,_8x12_k,_8x12_l,_8x12_m,_8x12_n,_8x12_o,_8x12_p,_8x12_q,_8x12_r,_8x12_s,_8x12_t,_8x12_u,_8x12_v,_8x12_w,_8x12_x,_8x12_y,_8x12_z,_8x12_d123, 532 | _8x12_d124, 533 | _8x12_d125, 534 | _8x12_d126, 535 | _8x12_d127, 536 | _8x12_d128, 537 | _8x12_d129, 538 | _8x12_d130, 539 | _8x12_d131, 540 | _8x12_d132, 541 | _8x12_d133, 542 | _8x12_d134, 543 | _8x12_d135, 544 | _8x12_d136, 545 | _8x12_d137, 546 | _8x12_d138, 547 | _8x12_d139, 548 | _8x12_d140, 549 | _8x12_d141, 550 | _8x12_d142, 551 | _8x12_d143, 552 | _8x12_d144, 553 | _8x12_d145, 554 | _8x12_d146, 555 | _8x12_d147, 556 | _8x12_d148, 557 | _8x12_d149, 558 | _8x12_d150, 559 | _8x12_d151, 560 | _8x12_d152, 561 | _8x12_d153, 562 | _8x12_d154, 563 | _8x12_d155, 564 | _8x12_d156, 565 | _8x12_d157, 566 | _8x12_d158, 567 | _8x12_d159, 568 | _8x12_d160, 569 | _8x12_d161, 570 | _8x12_d162, 571 | _8x12_d163, 572 | _8x12_d164, 573 | _8x12_d165, 574 | _8x12_d166, 575 | _8x12_d167, 576 | _8x12_d168, 577 | _8x12_d169, 578 | _8x12_d170, 579 | _8x12_d171, 580 | _8x12_d172, 581 | _8x12_d173, 582 | _8x12_d174, 583 | _8x12_d175, 584 | _8x12_d176, 585 | _8x12_d177, 586 | _8x12_d178, 587 | _8x12_d179, 588 | _8x12_d180, 589 | _8x12_d181, 590 | _8x12_d182, 591 | _8x12_d183, 592 | _8x12_d184, 593 | _8x12_d185, 594 | _8x12_d186, 595 | _8x12_d187, 596 | _8x12_d188, 597 | _8x12_d189, 598 | _8x12_d190, 599 | _8x12_d191, 600 | _8x12_d192, 601 | _8x12_d193, 602 | _8x12_d194, 603 | _8x12_d195, 604 | _8x12_d196, 605 | _8x12_d197, 606 | _8x12_d198, 607 | _8x12_d199, 608 | _8x12_d200, 609 | _8x12_d201, 610 | _8x12_d202, 611 | _8x12_d203, 612 | _8x12_d204, 613 | _8x12_d205, 614 | _8x12_d206, 615 | _8x12_d207, 616 | _8x12_d208, 617 | _8x12_d209, 618 | _8x12_d210, 619 | _8x12_d211, 620 | _8x12_d212, 621 | _8x12_d213, 622 | _8x12_d214, 623 | _8x12_d215, 624 | _8x12_d216, 625 | _8x12_d217, 626 | _8x12_d218, 627 | _8x12_d219, 628 | _8x12_d220, 629 | _8x12_d221, 630 | _8x12_d222, 631 | _8x12_d223, 632 | _8x12_d224, 633 | _8x12_d225, 634 | _8x12_d226, 635 | _8x12_d227, 636 | _8x12_d228, 637 | _8x12_d229, 638 | _8x12_d230, 639 | _8x12_d231, 640 | _8x12_d232, 641 | _8x12_d233, 642 | _8x12_d234, 643 | _8x12_d235, 644 | _8x12_d236, 645 | _8x12_d237, 646 | _8x12_d238, 647 | _8x12_d239, 648 | _8x12_d240, 649 | _8x12_d241, 650 | _8x12_d242, 651 | _8x12_d243,_8x12_d244,_8x12_d245,_8x12_d246,_8x12_d247,_8x12_d248,_8x12_d249,_8x12_d250,_8x12_d251,_8x12_d252,_8x12_d253,_8x12_d254,_8x12_d255}; -------------------------------------------------------------------------------- /src/components/Fonts/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/components/Fonts/include/Fonts.hpp: -------------------------------------------------------------------------------- 1 | #ifndef FONTS_INCLUDE_GUARD_ 2 | #define FONTS_INCLUDE_GUARD_ 3 | extern const char data_0[5]; 4 | extern const char data_1[5]; 5 | extern const char data_2[5]; 6 | extern const char data_3[5]; 7 | extern const char data_4[5]; 8 | extern const char data_5[5]; 9 | extern const char data_6[5]; 10 | extern const char data_7[5]; 11 | extern const char data_8[5]; 12 | extern const char data_9[5]; 13 | extern const char data_A[5]; 14 | extern const char data_B[5]; 15 | extern const char data_C[5]; 16 | extern const char data_D[5]; 17 | extern const char data_E[5]; 18 | extern const char data_F[5]; 19 | extern const char data_G[5]; 20 | extern const char data_H[5]; 21 | extern const char data_I[5]; 22 | extern const char data_J[5]; 23 | extern const char data_K[5]; 24 | extern const char data_L[5]; 25 | extern const char data_M[5]; 26 | extern const char data_N[5]; 27 | extern const char data_O[5]; 28 | extern const char data_P[5]; 29 | extern const char data_Q[5]; 30 | extern const char data_R[5]; 31 | extern const char data_S[5]; 32 | extern const char data_T[5]; 33 | extern const char data_U[5]; 34 | extern const char data_V[5]; 35 | extern const char data_W[5]; 36 | extern const char data_X[5]; 37 | extern const char data_Y[5]; 38 | extern const char data_Z[5]; 39 | extern const char data_a[5]; 40 | extern const char data_b[5]; 41 | extern const char data_c[5]; 42 | extern const char data_d[5]; 43 | extern const char data_e[5]; 44 | extern const char data_f[5]; 45 | extern const char data_g[5]; 46 | extern const char data_h[5]; 47 | extern const char data_i[5]; 48 | extern const char data_j[5]; 49 | extern const char data_k[5]; 50 | extern const char data_l[5]; 51 | extern const char data_m[5]; 52 | extern const char data_n[5]; 53 | extern const char data_o[5]; 54 | extern const char data_p[5]; 55 | extern const char data_q[5]; 56 | extern const char data_r[5]; 57 | extern const char data_s[5]; 58 | extern const char data_t[5]; 59 | extern const char data_u[5]; 60 | extern const char data_v[5]; 61 | extern const char data_w[5]; 62 | extern const char data_x[5]; 63 | extern const char data_y[5]; 64 | extern const char data_z[5]; 65 | extern const char data_SPACE[5]; 66 | extern const char data_minus[5]; 67 | extern const char data_comma[5]; 68 | extern const char data_equal[5]; 69 | extern const char data_leftbrace[5]; 70 | extern const char data_rightbrace[5]; 71 | 72 | extern const char _8x12_d0[12]; 73 | extern const char _8x12_d1[12]; 74 | extern const char _8x12_d2[12]; 75 | extern const char _8x12_d3[12]; 76 | extern const char _8x12_d4[12]; 77 | extern const char _8x12_d5[12]; 78 | extern const char _8x12_d6[12]; 79 | extern const char _8x12_d7[12]; 80 | extern const char _8x12_d8[12]; 81 | extern const char _8x12_d9[12]; 82 | extern const char _8x12_d10[12]; 83 | extern const char _8x12_d11[12]; 84 | extern const char _8x12_d12[12]; 85 | extern const char _8x12_d13[12]; 86 | extern const char _8x12_d14[12]; 87 | extern const char _8x12_d15[12]; 88 | extern const char _8x12_d16[12]; 89 | extern const char _8x12_d17[12]; 90 | extern const char _8x12_d18[12]; 91 | extern const char _8x12_d19[12]; 92 | extern const char _8x12_d20[12]; 93 | extern const char _8x12_d21[12]; 94 | extern const char _8x12_d22[12]; 95 | extern const char _8x12_d23[12]; 96 | extern const char _8x12_d24[12]; 97 | extern const char _8x12_d25[12]; 98 | extern const char _8x12_d26[12]; 99 | extern const char _8x12_d27[12]; 100 | extern const char _8x12_d28[12]; 101 | extern const char _8x12_d29[12]; 102 | extern const char _8x12_d30[12]; 103 | extern const char _8x12_d31[12]; 104 | extern const char _8x12_space[12]; 105 | extern const char _8x12_d33[12]; 106 | extern const char _8x12_d34[12]; 107 | extern const char _8x12_d35[12]; 108 | extern const char _8x12_d36[12]; 109 | extern const char _8x12_d37[12]; 110 | extern const char _8x12_d38[12]; 111 | extern const char _8x12_d39[12]; 112 | extern const char _8x12_d40[12]; 113 | extern const char _8x12_d41[12]; 114 | extern const char _8x12_d42[12]; 115 | extern const char _8x12_d43[12]; 116 | extern const char _8x12_d44[12]; 117 | extern const char _8x12_d45[12]; 118 | extern const char _8x12_d46[12]; 119 | extern const char _8x12_d47[12]; 120 | extern const char _8x12_0[12]; 121 | extern const char _8x12_1[12]; 122 | extern const char _8x12_2[12]; 123 | extern const char _8x12_3[12]; 124 | extern const char _8x12_4[12]; 125 | extern const char _8x12_5[12]; 126 | extern const char _8x12_6[12]; 127 | extern const char _8x12_7[12]; 128 | extern const char _8x12_8[12]; 129 | extern const char _8x12_9[12]; 130 | extern const char _8x12_d58[12]; 131 | extern const char _8x12_d59[12]; 132 | extern const char _8x12_d60[12]; 133 | extern const char _8x12_d61[12]; 134 | extern const char _8x12_d62[12]; 135 | extern const char _8x12_d63[12]; 136 | extern const char _8x12_d64[12]; 137 | extern const char _8x12_A[12]; 138 | extern const char _8x12_B[12]; 139 | extern const char _8x12_C[12]; 140 | extern const char _8x12_D[12]; 141 | extern const char _8x12_E[12]; 142 | extern const char _8x12_F[12]; 143 | extern const char _8x12_G[12]; 144 | extern const char _8x12_H[12]; 145 | extern const char _8x12_I[12]; 146 | extern const char _8x12_J[12]; 147 | extern const char _8x12_K[12]; 148 | extern const char _8x12_L[12]; 149 | extern const char _8x12_M[12]; 150 | extern const char _8x12_N[12]; 151 | extern const char _8x12_O[12]; 152 | extern const char _8x12_P[12]; 153 | extern const char _8x12_Q[12]; 154 | extern const char _8x12_R[12]; 155 | extern const char _8x12_S[12]; 156 | extern const char _8x12_T[12]; 157 | extern const char _8x12_U[12]; 158 | extern const char _8x12_V[12]; 159 | extern const char _8x12_W[12]; 160 | extern const char _8x12_X[12]; 161 | extern const char _8x12_Y[12]; 162 | extern const char _8x12_Z[12]; 163 | extern const char _8x12_d91[12]; 164 | extern const char _8x12_d92[12]; 165 | extern const char _8x12_d93[12]; 166 | extern const char _8x12_d94[12]; 167 | extern const char _8x12_d95[12]; 168 | extern const char _8x12_d96[12]; 169 | extern const char _8x12_a[12]; 170 | extern const char _8x12_b[12]; 171 | extern const char _8x12_c[12]; 172 | extern const char _8x12_d[12]; 173 | extern const char _8x12_e[12]; 174 | extern const char _8x12_f[12]; 175 | extern const char _8x12_g[12]; 176 | extern const char _8x12_h[12]; 177 | extern const char _8x12_i[12]; 178 | extern const char _8x12_j[12]; 179 | extern const char _8x12_k[12]; 180 | extern const char _8x12_l[12]; 181 | extern const char _8x12_m[12]; 182 | extern const char _8x12_n[12]; 183 | extern const char _8x12_o[12]; 184 | extern const char _8x12_p[12]; 185 | extern const char _8x12_q[12]; 186 | extern const char _8x12_r[12]; 187 | extern const char _8x12_s[12]; 188 | extern const char _8x12_t[12]; 189 | extern const char _8x12_u[12]; 190 | extern const char _8x12_v[12]; 191 | extern const char _8x12_w[12]; 192 | extern const char _8x12_x[12]; 193 | extern const char _8x12_y[12]; 194 | extern const char _8x12_z[12]; 195 | extern const char _8x12_d123[12]; 196 | extern const char _8x12_d124[12]; 197 | extern const char _8x12_d125[12]; 198 | extern const char _8x12_d126[12]; 199 | extern const char _8x12_d127[12]; 200 | extern const char _8x12_d128[12]; 201 | extern const char _8x12_d129[12]; 202 | extern const char _8x12_d130[12]; 203 | extern const char _8x12_d131[12]; 204 | extern const char _8x12_d132[12]; 205 | extern const char _8x12_d133[12]; 206 | extern const char _8x12_d134[12]; 207 | extern const char _8x12_d135[12]; 208 | extern const char _8x12_d136[12]; 209 | extern const char _8x12_d137[12]; 210 | extern const char _8x12_d138[12]; 211 | extern const char _8x12_d139[12]; 212 | extern const char _8x12_d140[12]; 213 | extern const char _8x12_d141[12]; 214 | extern const char _8x12_d142[12]; 215 | extern const char _8x12_d143[12]; 216 | extern const char _8x12_d144[12]; 217 | extern const char _8x12_d145[12]; 218 | extern const char _8x12_d146[12]; 219 | extern const char _8x12_d147[12]; 220 | extern const char _8x12_d148[12]; 221 | extern const char _8x12_d149[12]; 222 | extern const char _8x12_d150[12]; 223 | extern const char _8x12_d151[12]; 224 | extern const char _8x12_d152[12]; 225 | extern const char _8x12_d153[12]; 226 | extern const char _8x12_d154[12]; 227 | extern const char _8x12_d155[12]; 228 | extern const char _8x12_d156[12]; 229 | extern const char _8x12_d157[12]; 230 | extern const char _8x12_d158[12]; 231 | extern const char _8x12_d159[12]; 232 | extern const char _8x12_d160[12]; 233 | extern const char _8x12_d161[12]; 234 | extern const char _8x12_d162[12]; 235 | extern const char _8x12_d163[12]; 236 | extern const char _8x12_d164[12]; 237 | extern const char _8x12_d165[12]; 238 | extern const char _8x12_d166[12]; 239 | extern const char _8x12_d167[12]; 240 | extern const char _8x12_d168[12]; 241 | extern const char _8x12_d169[12]; 242 | extern const char _8x12_d170[12]; 243 | extern const char _8x12_d171[12]; 244 | extern const char _8x12_d172[12]; 245 | extern const char _8x12_d173[12]; 246 | extern const char _8x12_d174[12]; 247 | extern const char _8x12_d175[12]; 248 | extern const char _8x12_d176[12]; 249 | extern const char _8x12_d177[12]; 250 | extern const char _8x12_d178[12]; 251 | extern const char _8x12_d179[12]; 252 | extern const char _8x12_d180[12]; 253 | extern const char _8x12_d181[12]; 254 | extern const char _8x12_d182[12]; 255 | extern const char _8x12_d183[12]; 256 | extern const char _8x12_d184[12]; 257 | extern const char _8x12_d185[12]; 258 | extern const char _8x12_d186[12]; 259 | extern const char _8x12_d187[12]; 260 | extern const char _8x12_d188[12]; 261 | extern const char _8x12_d189[12]; 262 | extern const char _8x12_d190[12]; 263 | extern const char _8x12_d191[12]; 264 | extern const char _8x12_d192[12]; 265 | extern const char _8x12_d193[12]; 266 | extern const char _8x12_d194[12]; 267 | extern const char _8x12_d195[12]; 268 | extern const char _8x12_d196[12]; 269 | extern const char _8x12_d197[12]; 270 | extern const char _8x12_d198[12]; 271 | extern const char _8x12_d199[12]; 272 | extern const char _8x12_d200[12]; 273 | extern const char _8x12_d201[12]; 274 | extern const char _8x12_d202[12]; 275 | extern const char _8x12_d203[12]; 276 | extern const char _8x12_d204[12]; 277 | extern const char _8x12_d205[12]; 278 | extern const char _8x12_d206[12]; 279 | extern const char _8x12_d207[12]; 280 | extern const char _8x12_d208[12]; 281 | extern const char _8x12_d209[12]; 282 | extern const char _8x12_d210[12]; 283 | extern const char _8x12_d211[12]; 284 | extern const char _8x12_d212[12]; 285 | extern const char _8x12_d213[12]; 286 | extern const char _8x12_d214[12]; 287 | extern const char _8x12_d215[12]; 288 | extern const char _8x12_d216[12]; 289 | extern const char _8x12_d217[12]; 290 | extern const char _8x12_d218[12]; 291 | extern const char _8x12_d219[12]; 292 | extern const char _8x12_d220[12]; 293 | extern const char _8x12_d221[12]; 294 | extern const char _8x12_d222[12]; 295 | extern const char _8x12_d223[12]; 296 | extern const char _8x12_d224[12]; 297 | extern const char _8x12_d225[12]; 298 | extern const char _8x12_d226[12]; 299 | extern const char _8x12_d227[12]; 300 | extern const char _8x12_d228[12]; 301 | extern const char _8x12_d229[12]; 302 | extern const char _8x12_d230[12]; 303 | extern const char _8x12_d231[12]; 304 | extern const char _8x12_d232[12]; 305 | extern const char _8x12_d233[12]; 306 | extern const char _8x12_d234[12]; 307 | extern const char _8x12_d235[12]; 308 | extern const char _8x12_d236[12]; 309 | extern const char _8x12_d237[12]; 310 | extern const char _8x12_d238[12]; 311 | extern const char _8x12_d239[12]; 312 | extern const char _8x12_d240[12]; 313 | extern const char _8x12_d241[12]; 314 | extern const char _8x12_d242[12]; 315 | extern const char _8x12_d243[12]; 316 | extern const char _8x12_d244[12]; 317 | extern const char _8x12_d245[12]; 318 | extern const char _8x12_d246[12]; 319 | extern const char _8x12_d247[12]; 320 | extern const char _8x12_d248[12]; 321 | extern const char _8x12_d249[12]; 322 | extern const char _8x12_d250[12]; 323 | extern const char _8x12_d251[12]; 324 | extern const char _8x12_d252[12]; 325 | extern const char _8x12_d253[12]; 326 | extern const char _8x12_d254[12]; 327 | extern const char _8x12_d255[12]; 328 | 329 | extern const char *char5x8_matrix[127]; 330 | 331 | extern const char *char8x12_matrix[256]; 332 | #endif //FONTS_INCLUDE_GUARD_ -------------------------------------------------------------------------------- /src/components/SerialTask/SerialTask.cpp: -------------------------------------------------------------------------------- 1 | #include "SerialTask.hpp" 2 | #include "sdkconfig.h" 3 | #include "freertos/FreeRTOS.h" 4 | #include "freertos/task.h" 5 | 6 | #define MS_TO_TICKS( xTimeInMs ) (uint32_t)( ( ( TickType_t ) xTimeInMs * configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) 7 | 8 | namespace SerialTask { 9 | 10 | // User definitions for the task 11 | bool changeState = false; 12 | 13 | // Everything below here is not exported by the header 14 | 15 | #define EX_UART_NUM UART_NUM_0 16 | #define BUF_SIZE (1024) 17 | 18 | void printInfo( void ) { 19 | printf("ESP Wireless Display\n"); 20 | printf("--------------------\n"); 21 | printf("Send numeric data to be plotted\n"); 22 | printf("Numeric data should have the form:\n"); 23 | printf(" < data name / id >::< data value >\n"); 24 | printf("\n"); 25 | printf("Send text data to be displayed\n"); 26 | printf("Any data that is not parsed as numeric data is text data\n"); 27 | } 28 | 29 | static const char *TAG = "uart_events"; 30 | 31 | static QueueHandle_t uart0_queue; 32 | 33 | static void uart_event_task(void *pvParameters) 34 | { 35 | uart_event_t event; 36 | size_t buffered_size; 37 | uint8_t* dtmp = (uint8_t*) malloc(BUF_SIZE); 38 | for(;;) { 39 | //Waiting for UART event. 40 | if(xQueueReceive(uart0_queue, (void * )&event, (portTickType)portMAX_DELAY)) { 41 | ESP_LOGI(TAG, "uart[%d] event:", EX_UART_NUM); 42 | switch(event.type) { 43 | //Event of UART receving data 44 | /*We'd better handler data event fast, there would be much more data events than 45 | other types of events. If we take too much time on data event, the queue might 46 | be full. 47 | in this example, we don't process data in event, but read data outside.*/ 48 | case UART_DATA: 49 | uart_get_buffered_data_len(EX_UART_NUM, &buffered_size); 50 | ESP_LOGI(TAG, "data, len: %d; buffered len: %d", event.size, buffered_size); 51 | break; 52 | //Event of HW FIFO overflow detected 53 | case UART_FIFO_OVF: 54 | ESP_LOGI(TAG, "hw fifo overflow\n"); 55 | //If fifo overflow happened, you should consider adding flow control for your application. 56 | //We can read data out out the buffer, or directly flush the rx buffer. 57 | uart_flush(EX_UART_NUM); 58 | break; 59 | //Event of UART ring buffer full 60 | case UART_BUFFER_FULL: 61 | ESP_LOGI(TAG, "ring buffer full\n"); 62 | //If buffer full happened, you should consider encreasing your buffer size 63 | //We can read data out out the buffer, or directly flush the rx buffer. 64 | uart_flush(EX_UART_NUM); 65 | break; 66 | //Event of UART RX break detected 67 | case UART_BREAK: 68 | ESP_LOGI(TAG, "uart rx break\n"); 69 | break; 70 | //Event of UART parity check error 71 | case UART_PARITY_ERR: 72 | ESP_LOGI(TAG, "uart parity error\n"); 73 | break; 74 | //Event of UART frame error 75 | case UART_FRAME_ERR: 76 | ESP_LOGI(TAG, "uart frame error\n"); 77 | break; 78 | //UART_PATTERN_DET 79 | case UART_PATTERN_DET: 80 | ESP_LOGI(TAG, "uart pattern detected\n"); 81 | break; 82 | //Others 83 | default: 84 | ESP_LOGI(TAG, "uart event type: %d\n", event.type); 85 | break; 86 | } 87 | } 88 | } 89 | free(dtmp); 90 | dtmp = NULL; 91 | vTaskDelete(NULL); 92 | } 93 | 94 | // Generated state variables 95 | bool __change_state__ = false; 96 | uint32_t __state_delay__ = 0; 97 | uint8_t stateLevel_0; 98 | 99 | // Generated task function 100 | void taskFunction ( void *pvParameter ) { 101 | // initialize here 102 | __change_state__ = false; 103 | __state_delay__ = 100; 104 | state_State_1_setState(); 105 | // execute the init transition for the initial state and task 106 | uart_config_t uart_config = { 107 | .baud_rate = 115200, 108 | .data_bits = UART_DATA_8_BITS, 109 | .parity = UART_PARITY_DISABLE, 110 | .stop_bits = UART_STOP_BITS_1, 111 | .flow_ctrl = UART_HW_FLOWCTRL_DISABLE, 112 | .rx_flow_ctrl_thresh = 122, 113 | }; 114 | //Set UART parameters 115 | uart_param_config(EX_UART_NUM, &uart_config); 116 | //Set UART log level 117 | esp_log_level_set(TAG, ESP_LOG_INFO); 118 | //Install UART driver, and get the queue. 119 | uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 10, &uart0_queue, 0); 120 | 121 | //Set UART pins (using UART0 default pins ie no changes.) 122 | uart_set_pin(EX_UART_NUM, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE); 123 | 124 | //Set uart pattern detect function. 125 | uart_enable_pattern_det_intr(EX_UART_NUM, '+', 3, 10000, 10, 10); 126 | //Create a task to handler UART event from ISR 127 | xTaskCreate(uart_event_task, "uart_event_task", 2048, NULL, 12, NULL); 128 | 129 | // now loop running the state code 130 | while (true) { 131 | // reset __change_state__ to false 132 | __change_state__ = false; 133 | // run the proper state function 134 | state_State_1_execute(); 135 | // now wait if we haven't changed state 136 | if (!__change_state__) { 137 | vTaskDelay( MS_TO_TICKS(__state_delay__) ); 138 | } 139 | else { 140 | vTaskDelay( MS_TO_TICKS(1) ); 141 | } 142 | } 143 | } 144 | 145 | // Generated state functions 146 | const uint8_t state_State_1 = 0; 147 | 148 | void state_State_1_execute( void ) { 149 | if (__change_state__ || stateLevel_0 != state_State_1) 150 | return; 151 | 152 | state_State_1_transition(); 153 | 154 | // execute all substates 155 | 156 | if (!__change_state__) { 157 | static uint8_t startupCounter = 0; 158 | static const uint8_t waitCounter = 10; 159 | 160 | uint8_t data[BUF_SIZE]; 161 | 162 | if (startupCounter == waitCounter) { 163 | printInfo(); 164 | startupCounter++; 165 | } 166 | else if (startupCounter < waitCounter) 167 | startupCounter++; 168 | 169 | memset(data, 0, BUF_SIZE); 170 | int len = uart_read_bytes(EX_UART_NUM, data, BUF_SIZE, 0);//100 / portTICK_RATE_MS); 171 | if (len > 0) { 172 | std::string newData( (const char *)data ); 173 | DisplayTask::pushData(newData); 174 | } 175 | } 176 | } 177 | 178 | void state_State_1_setState( void ) { 179 | stateLevel_0 = state_State_1; 180 | } 181 | 182 | void state_State_1_transition( void ) { 183 | if (__change_state__) 184 | return; 185 | } 186 | 187 | void state_State_1_finalization( void ) { 188 | 189 | } 190 | 191 | 192 | }; 193 | -------------------------------------------------------------------------------- /src/components/SerialTask/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/components/SerialTask/include/SerialTask.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __SerialTask__INCLUDE_GUARD 2 | #define __SerialTask__INCLUDE_GUARD 3 | 4 | #include 5 | 6 | // Task Includes 7 | #include "driver/gpio.h" // needed for printf 8 | #include "driver/uart.h" 9 | #include "freertos/queue.h" 10 | #include "esp_log.h" 11 | #include "soc/uart_struct.h" 12 | 13 | #include "DisplayTask.hpp" 14 | 15 | // Generated state functions and members for the task 16 | namespace SerialTask { 17 | 18 | // Task Forward Declarations 19 | extern bool changeState; 20 | 21 | // Generated task function 22 | void taskFunction ( void *pvParameter ); 23 | 24 | // Generated state functions 25 | void state_State_1_execute ( void ); 26 | void state_State_1_setState ( void ); 27 | void state_State_1_transition ( void ); 28 | void state_State_1_finalization ( void ); 29 | 30 | }; 31 | 32 | #endif // __SerialTask__INCLUDE_GUARD 33 | -------------------------------------------------------------------------------- /src/components/UDPServer/UDPServer.c: -------------------------------------------------------------------------------- 1 | #include "UDPServer.h" 2 | /* udp_perf Example 3 | This example code is in the Public Domain (or CC0 licensed, at your option.) 4 | Unless required by applicable law or agreed to in writing, this 5 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 6 | CONDITIONS OF ANY KIND, either express or implied. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | /* FreeRTOS event group to signal when we are connected to WiFi and ready to start UDP test*/ 13 | EventGroupHandle_t udp_event_group; 14 | 15 | static int mysocket; 16 | 17 | static struct sockaddr_in remote_addr; 18 | static unsigned int socklen; 19 | 20 | int total_data = 0; 21 | int success_pack = 0; 22 | 23 | static esp_err_t event_handler(void *ctx, system_event_t *event) 24 | { 25 | switch(event->event_id) { 26 | case SYSTEM_EVENT_STA_START: 27 | esp_wifi_connect(); 28 | break; 29 | case SYSTEM_EVENT_STA_DISCONNECTED: 30 | esp_wifi_connect(); 31 | xEventGroupClearBits(udp_event_group, WIFI_CONNECTED_BIT); 32 | break; 33 | case SYSTEM_EVENT_STA_CONNECTED: 34 | break; 35 | case SYSTEM_EVENT_STA_GOT_IP: 36 | ESP_LOGI(TAG, "event_handler:SYSTEM_EVENT_STA_GOT_IP!"); 37 | ESP_LOGI(TAG, "got ip:%s\n", 38 | ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip)); 39 | xEventGroupSetBits(udp_event_group, WIFI_CONNECTED_BIT); 40 | break; 41 | case SYSTEM_EVENT_AP_STACONNECTED: 42 | ESP_LOGI(TAG, "station:"MACSTR" join,AID=%d\n", 43 | MAC2STR(event->event_info.sta_connected.mac), 44 | event->event_info.sta_connected.aid); 45 | xEventGroupSetBits(udp_event_group, WIFI_CONNECTED_BIT); 46 | break; 47 | case SYSTEM_EVENT_AP_STADISCONNECTED: 48 | ESP_LOGI(TAG, "station:"MACSTR"leave,AID=%d\n", 49 | MAC2STR(event->event_info.sta_disconnected.mac), 50 | event->event_info.sta_disconnected.aid); 51 | xEventGroupClearBits(udp_event_group, WIFI_CONNECTED_BIT); 52 | break; 53 | default: 54 | break; 55 | } 56 | return ESP_OK; 57 | } 58 | 59 | 60 | //wifi_init_sta 61 | void wifi_init_sta() 62 | { 63 | udp_event_group = xEventGroupCreate(); 64 | 65 | tcpip_adapter_init(); 66 | ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL) ); 67 | 68 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); 69 | ESP_ERROR_CHECK(esp_wifi_init(&cfg)); 70 | wifi_config_t wifi_config = { 71 | .sta = { 72 | .ssid = EXAMPLE_DEFAULT_SSID, 73 | .password = EXAMPLE_DEFAULT_PWD 74 | }, 75 | }; 76 | 77 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); 78 | ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); 79 | ESP_ERROR_CHECK(esp_wifi_start() ); 80 | 81 | ESP_LOGI(TAG, "wifi_init_sta finished."); 82 | ESP_LOGI(TAG, "connect to ap SSID:%s password:%s \n", 83 | EXAMPLE_DEFAULT_SSID,EXAMPLE_DEFAULT_PWD); 84 | } 85 | //wifi_init_softap 86 | void wifi_init_softap() 87 | { 88 | udp_event_group = xEventGroupCreate(); 89 | 90 | tcpip_adapter_init(); 91 | ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL)); 92 | 93 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); 94 | ESP_ERROR_CHECK(esp_wifi_init(&cfg)); 95 | wifi_config_t wifi_config = { 96 | .ap = { 97 | .ssid = EXAMPLE_DEFAULT_SSID, 98 | .ssid_len=0, 99 | .max_connection=EXAMPLE_MAX_STA_CONN, 100 | .password = EXAMPLE_DEFAULT_PWD, 101 | .authmode=WIFI_AUTH_WPA_WPA2_PSK 102 | }, 103 | }; 104 | if (strlen(EXAMPLE_DEFAULT_PWD) ==0) { 105 | wifi_config.ap.authmode = WIFI_AUTH_OPEN; 106 | } 107 | 108 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP)); 109 | ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &wifi_config)); 110 | ESP_ERROR_CHECK(esp_wifi_start()); 111 | 112 | ESP_LOGI(TAG, "wifi_init_softap finished.SSID:%s password:%s \n", 113 | EXAMPLE_DEFAULT_SSID, EXAMPLE_DEFAULT_PWD); 114 | } 115 | 116 | //create a udp server socket. return ESP_OK:success ESP_FAIL:error 117 | esp_err_t create_udp_server() 118 | { 119 | ESP_LOGI(TAG, "create_udp_server() port:%d", EXAMPLE_DEFAULT_PORT); 120 | mysocket = socket(AF_INET, SOCK_DGRAM, 0); 121 | if (mysocket < 0) { 122 | show_socket_error_reason(mysocket); 123 | return ESP_FAIL; 124 | } 125 | struct sockaddr_in server_addr; 126 | server_addr.sin_family = AF_INET; 127 | server_addr.sin_port = htons(EXAMPLE_DEFAULT_PORT); 128 | server_addr.sin_addr.s_addr = htonl(INADDR_ANY); 129 | if (bind(mysocket, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) { 130 | show_socket_error_reason(mysocket); 131 | close(mysocket); 132 | return ESP_FAIL; 133 | } 134 | return ESP_OK; 135 | } 136 | 137 | //create a udp client socket. return ESP_OK:success ESP_FAIL:error 138 | esp_err_t create_udp_client() 139 | { 140 | ESP_LOGI(TAG, "create_udp_client()"); 141 | ESP_LOGI(TAG, "connecting to %s:%d", 142 | EXAMPLE_DEFAULT_SERVER_IP, EXAMPLE_DEFAULT_PORT); 143 | mysocket = socket(AF_INET, SOCK_DGRAM, 0); 144 | if (mysocket < 0) { 145 | show_socket_error_reason(mysocket); 146 | return ESP_FAIL; 147 | } 148 | /*for client remote_addr is also server_addr*/ 149 | remote_addr.sin_family = AF_INET; 150 | remote_addr.sin_port = htons(EXAMPLE_DEFAULT_PORT); 151 | remote_addr.sin_addr.s_addr = inet_addr(EXAMPLE_DEFAULT_SERVER_IP); 152 | 153 | return ESP_OK; 154 | } 155 | 156 | 157 | //send or recv data task 158 | void send_recv_data(void *pvParameters) 159 | { 160 | ESP_LOGI(TAG, "task send_recv_data start!\n"); 161 | 162 | int len; 163 | char databuff[EXAMPLE_DEFAULT_PKTSIZE]; 164 | 165 | /*send&receive first packet*/ 166 | socklen = sizeof(remote_addr); 167 | 168 | ESP_LOGI(TAG, "first recvfrom:"); 169 | len = recvfrom(mysocket, databuff, EXAMPLE_DEFAULT_PKTSIZE, 0, (struct sockaddr *)&remote_addr, &socklen); 170 | 171 | if (len > 0) { 172 | ESP_LOGI(TAG, "transfer data with %s:%u\n", 173 | inet_ntoa(remote_addr.sin_addr), ntohs(remote_addr.sin_port)); 174 | xEventGroupSetBits(udp_event_group, UDP_CONNCETED_SUCCESS); 175 | } else { 176 | show_socket_error_reason(mysocket); 177 | close(mysocket); 178 | vTaskDelete(NULL); 179 | } /*if (len > 0)*/ 180 | 181 | ESP_LOGI(TAG, "start count!\n"); 182 | while(1) { 183 | memset( databuff, 0, EXAMPLE_DEFAULT_PKTSIZE ); 184 | len = recvfrom(mysocket, databuff, EXAMPLE_DEFAULT_PKTSIZE, 0, (struct sockaddr *)&remote_addr, &socklen); 185 | if (len > 0) { 186 | ESP_LOGI(TAG, "transfer data with %s:%u\n", 187 | inet_ntoa(remote_addr.sin_addr), ntohs(remote_addr.sin_port)); 188 | ESP_LOGI(TAG, " received: %s", databuff); 189 | total_data += len; 190 | success_pack++; 191 | } else { 192 | if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { 193 | show_socket_error_reason(mysocket); 194 | } 195 | } /*if (len > 0)*/ 196 | } /*while(1)*/ 197 | } 198 | 199 | 200 | int get_socket_error_code(int socket) 201 | { 202 | int result; 203 | u32_t optlen = sizeof(int); 204 | if(getsockopt(socket, SOL_SOCKET, SO_ERROR, &result, &optlen) == -1) { 205 | ESP_LOGE(TAG, "getsockopt failed"); 206 | return -1; 207 | } 208 | return result; 209 | } 210 | 211 | int show_socket_error_reason(int socket) 212 | { 213 | int err = get_socket_error_code(socket); 214 | ESP_LOGW(TAG, "socket error %d %s", err, strerror(err)); 215 | return err; 216 | } 217 | 218 | int check_connected_socket() 219 | { 220 | int ret; 221 | ESP_LOGD(TAG, "check connect_socket"); 222 | ret = get_socket_error_code(mysocket); 223 | if(ret != 0) { 224 | ESP_LOGW(TAG, "socket error %d %s", ret, strerror(ret)); 225 | } 226 | return ret; 227 | } 228 | 229 | void close_socket() 230 | { 231 | close(mysocket); 232 | } -------------------------------------------------------------------------------- /src/components/UDPServer/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/components/UDPServer/include/UDPServer.h: -------------------------------------------------------------------------------- 1 | #ifndef UDPSERVER_INCLUDE_GUARD_ 2 | #define UDPSERVER_INCLUDE_GUARD_ 3 | /* udp_perf Example 4 | 5 | This example code is in the Public Domain (or CC0 licensed, at your option.) 6 | 7 | Unless required by applicable law or agreed to in writing, this 8 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 9 | CONDITIONS OF ANY KIND, either express or implied. 10 | */ 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | #include "freertos/FreeRTOS.h" 17 | #include "freertos/task.h" 18 | #include "freertos/event_groups.h" 19 | #include "esp_wifi.h" 20 | #include "esp_event_loop.h" 21 | #include "esp_log.h" 22 | 23 | /*test options*/ 24 | #define EXAMPLE_ESP_WIFI_MODE_AP 1 //TRUE:AP FALSE:STA 25 | #define EXAMPLE_ESP_UDP_MODE_SERVER 1 //TRUE:server FALSE:client 26 | #define EXAMPLE_ESP_UDP_PERF_TX 0 //TRUE:send FALSE:receive 27 | 28 | /*AP info and tcp_server info*/ 29 | #define EXAMPLE_DEFAULT_SSID ("Max Mobility 2.4 GHz") 30 | #define EXAMPLE_DEFAULT_PWD ("1qaz2wsx3edc4rfv") 31 | #define EXAMPLE_DEFAULT_PORT 5555 32 | #define EXAMPLE_DEFAULT_PKTSIZE 100 33 | #define EXAMPLE_MAX_STA_CONN 1 //how many sta can be connected(AP mode) 34 | 35 | #ifdef CONFIG_UDP_PERF_SERVER_IP 36 | #define EXAMPLE_DEFAULT_SERVER_IP CONFIG_UDP_PERF_SERVER_IP 37 | #else 38 | #define EXAMPLE_DEFAULT_SERVER_IP "192.168.4.1" 39 | #endif /*CONFIG_UDP_PERF_SERVER_IP*/ 40 | 41 | #define TAG "udp_perf:" 42 | 43 | /* FreeRTOS event group to signal when we are connected to WiFi and ready to start UDP test*/ 44 | extern EventGroupHandle_t udp_event_group; 45 | #define WIFI_CONNECTED_BIT BIT0 46 | #define UDP_CONNCETED_SUCCESS BIT1 47 | 48 | extern int total_data; 49 | extern int success_pack; 50 | 51 | //using esp as station 52 | void wifi_init_sta(); 53 | //using esp as softap 54 | void wifi_init_softap(); 55 | 56 | //create a udp server socket. return ESP_OK:success ESP_FAIL:error 57 | esp_err_t create_udp_server(); 58 | //create a udp client socket. return ESP_OK:success ESP_FAIL:error 59 | esp_err_t create_udp_client(); 60 | 61 | //send or recv data task 62 | void send_recv_data(void *pvParameters); 63 | 64 | //get socket error code. return: error code 65 | int get_socket_error_code(int socket); 66 | 67 | //show socket error code. return: error code 68 | int show_socket_error_reason(int socket); 69 | 70 | //check connected socket. return: error code 71 | int check_connected_socket(); 72 | 73 | //close all socket 74 | void close_socket(); 75 | 76 | #ifdef __cplusplus 77 | } 78 | #endif 79 | 80 | #endif //UDPSERVER_INCLUDE_GUARD_ -------------------------------------------------------------------------------- /src/components/WirelessTask/WirelessTask.cpp: -------------------------------------------------------------------------------- 1 | #include "WirelessTask.hpp" 2 | #include "sdkconfig.h" 3 | #include "freertos/FreeRTOS.h" 4 | #include "freertos/task.h" 5 | 6 | #define MS_TO_TICKS( xTimeInMs ) (uint32_t)( ( ( TickType_t ) xTimeInMs * configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) 7 | 8 | namespace WirelessTask { 9 | 10 | // User definitions for the task 11 | extern "C" { 12 | #include 13 | #include 14 | } 15 | 16 | static int mysocket; 17 | 18 | static struct sockaddr_in remote_addr; 19 | static unsigned int socklen; 20 | 21 | static esp_err_t event_handler(void *ctx, system_event_t *event) 22 | { 23 | std::string ipStr; 24 | switch(event->event_id) { 25 | case SYSTEM_EVENT_STA_START: 26 | esp_wifi_connect(); 27 | break; 28 | case SYSTEM_EVENT_STA_DISCONNECTED: 29 | esp_wifi_connect(); 30 | xEventGroupClearBits(udp_event_group, WIFI_CONNECTED_BIT); 31 | break; 32 | case SYSTEM_EVENT_STA_CONNECTED: 33 | break; 34 | case SYSTEM_EVENT_STA_GOT_IP: 35 | ESP_LOGI(TAG, "event_handler:SYSTEM_EVENT_STA_GOT_IP!"); 36 | ESP_LOGI(TAG, "got ip:%s\n", 37 | ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip)); 38 | ipStr = std::string("IP: ") + ip4addr_ntoa(&event->event_info.got_ip.ip_info.ip); 39 | ipStr += ":" + std::to_string(EXAMPLE_DEFAULT_PORT); 40 | DisplayTask::pushData( ipStr ); 41 | xEventGroupSetBits(udp_event_group, WIFI_CONNECTED_BIT); 42 | break; 43 | case SYSTEM_EVENT_AP_STACONNECTED: 44 | ESP_LOGI(TAG, "station:"MACSTR" join,AID=%d\n", 45 | MAC2STR(event->event_info.sta_connected.mac), 46 | event->event_info.sta_connected.aid); 47 | xEventGroupSetBits(udp_event_group, WIFI_CONNECTED_BIT); 48 | break; 49 | case SYSTEM_EVENT_AP_STADISCONNECTED: 50 | ESP_LOGI(TAG, "station:"MACSTR"leave,AID=%d\n", 51 | MAC2STR(event->event_info.sta_disconnected.mac), 52 | event->event_info.sta_disconnected.aid); 53 | xEventGroupClearBits(udp_event_group, WIFI_CONNECTED_BIT); 54 | break; 55 | default: 56 | break; 57 | } 58 | return ESP_OK; 59 | } 60 | 61 | // Generated state variables 62 | bool __change_state__ = false; 63 | uint32_t __state_delay__ = 0; 64 | uint8_t stateLevel_0; 65 | 66 | // Generated task function 67 | void taskFunction ( void *pvParameter ) { 68 | // initialize here 69 | __change_state__ = false; 70 | __state_delay__ = 10; 71 | state_State_1_setState(); 72 | // execute the init transition for the initial state and task 73 | #if 1 74 | udp_event_group = xEventGroupCreate(); 75 | 76 | tcpip_adapter_init(); 77 | ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) ); 78 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); 79 | ESP_ERROR_CHECK( esp_wifi_init(&cfg) ); 80 | ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); 81 | ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); 82 | wifi_config_t sta_config = { 83 | { 84 | "Max Mobility 2.4 GHz", 85 | "1qaz2wsx3edc4rfv", 86 | false 87 | } 88 | }; 89 | ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) ); 90 | ESP_ERROR_CHECK( esp_wifi_start() ); 91 | ESP_ERROR_CHECK( esp_wifi_connect() ); 92 | 93 | ESP_LOGI(TAG, "task udp_conn start."); 94 | /*wating for connecting to AP*/ 95 | xEventGroupWaitBits(udp_event_group, WIFI_CONNECTED_BIT,false, true, portMAX_DELAY); 96 | ESP_LOGI(TAG, "sta has connected to ap."); 97 | 98 | #else 99 | wifi_init_softap(); 100 | #endif 101 | 102 | /*create udp socket*/ 103 | int socket_ret; 104 | 105 | ESP_LOGI(TAG, "create udp server after 3s..."); 106 | vTaskDelay(3000 / portTICK_RATE_MS); 107 | ESP_LOGI(TAG, "create_udp_server."); 108 | socket_ret=create_udp_server(); 109 | 110 | if(socket_ret == ESP_FAIL) { 111 | ESP_LOGI(TAG, "create udp socket error,stop."); 112 | vTaskDelete(NULL); 113 | } 114 | 115 | /*create a task to tx/rx data*/ 116 | //TaskHandle_t tx_rx_task; 117 | //xTaskCreate(&send_recv_data, "send_recv_data", 4096, NULL, 4, &tx_rx_task); 118 | 119 | /*waiting udp connected success*/ 120 | //xEventGroupWaitBits(udp_event_group, UDP_CONNCETED_SUCCESS,false, true, portMAX_DELAY); 121 | //ESP_LOGI(TAG, "udp connected"); 122 | 123 | int len; 124 | char databuff[EXAMPLE_DEFAULT_PKTSIZE]; 125 | 126 | /*send&receive first packet*/ 127 | socklen = sizeof(remote_addr); 128 | 129 | ESP_LOGI(TAG, "first recvfrom:"); 130 | len = recvfrom(mysocket, databuff, EXAMPLE_DEFAULT_PKTSIZE, 0, (struct sockaddr *)&remote_addr, &socklen); 131 | 132 | if (len > 0) { 133 | ESP_LOGI(TAG, "transfer data with %s:%u\n", 134 | inet_ntoa(remote_addr.sin_addr), ntohs(remote_addr.sin_port)); 135 | xEventGroupSetBits(udp_event_group, UDP_CONNCETED_SUCCESS); 136 | } else { 137 | show_socket_error_reason(mysocket); 138 | close(mysocket); 139 | vTaskDelete(NULL); 140 | } /*if (len > 0)*/ 141 | 142 | // now loop running the state code 143 | while (true) { 144 | // reset __change_state__ to false 145 | __change_state__ = false; 146 | // run the proper state function 147 | state_State_1_execute(); 148 | // now wait if we haven't changed state 149 | if (!__change_state__) { 150 | vTaskDelay( MS_TO_TICKS(__state_delay__) ); 151 | } 152 | else { 153 | vTaskDelay( MS_TO_TICKS(1) ); 154 | } 155 | } 156 | } 157 | 158 | // Generated state functions 159 | const uint8_t state_State_1 = 0; 160 | 161 | void state_State_1_execute( void ) { 162 | if (__change_state__ || stateLevel_0 != state_State_1) 163 | return; 164 | 165 | state_State_1_transition(); 166 | 167 | // execute all substates 168 | 169 | if (!__change_state__) { 170 | int len; 171 | char databuff[EXAMPLE_DEFAULT_PKTSIZE]; 172 | memset( databuff, 0, EXAMPLE_DEFAULT_PKTSIZE ); 173 | len = recvfrom(mysocket, databuff, EXAMPLE_DEFAULT_PKTSIZE, 0, (struct sockaddr *)&remote_addr, &socklen); 174 | if (len > 0) { 175 | ESP_LOGI(TAG, "transfer data with %s:%u\n", 176 | inet_ntoa(remote_addr.sin_addr), ntohs(remote_addr.sin_port)); 177 | ESP_LOGI(TAG, " received: %s", databuff); 178 | std::string newData( (const char *)databuff ); 179 | DisplayTask::pushData( newData ); 180 | } else { 181 | if (LOG_LOCAL_LEVEL >= ESP_LOG_DEBUG) { 182 | show_socket_error_reason(mysocket); 183 | } 184 | } /*if (len > 0)*/ 185 | } 186 | } 187 | 188 | void state_State_1_setState( void ) { 189 | stateLevel_0 = state_State_1; 190 | } 191 | 192 | void state_State_1_transition( void ) { 193 | if (__change_state__) 194 | return; 195 | } 196 | 197 | void state_State_1_finalization( void ) { 198 | 199 | } 200 | 201 | 202 | }; 203 | -------------------------------------------------------------------------------- /src/components/WirelessTask/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/components/WirelessTask/include/WirelessTask.hpp: -------------------------------------------------------------------------------- 1 | #ifndef __WirelessTask__INCLUDE_GUARD 2 | #define __WirelessTask__INCLUDE_GUARD 3 | 4 | #include 5 | 6 | // Task Includes 7 | #include "DisplayTask.hpp" 8 | 9 | extern "C" { 10 | #include "UDPServer.h" 11 | } 12 | 13 | // Generated state functions and members for the task 14 | namespace WirelessTask { 15 | 16 | // Task Forward Declarations 17 | 18 | 19 | // Generated task function 20 | void taskFunction ( void *pvParameter ); 21 | 22 | // Generated state functions 23 | void state_State_1_execute ( void ); 24 | void state_State_1_setState ( void ); 25 | void state_State_1_transition ( void ); 26 | void state_State_1_finalization ( void ); 27 | 28 | }; 29 | 30 | #endif // __WirelessTask__INCLUDE_GUARD 31 | -------------------------------------------------------------------------------- /src/main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | -------------------------------------------------------------------------------- /src/main/main.cpp: -------------------------------------------------------------------------------- 1 | #include "sdkconfig.h" 2 | #include "freertos/FreeRTOS.h" 3 | #include "freertos/task.h" 4 | #include "freertos/timers.h" 5 | #include "esp_system.h" 6 | 7 | #define MS_TO_TICKS( xTimeInMs ) (uint32_t)( ( ( TickType_t ) xTimeInMs * configTICK_RATE_HZ ) / ( TickType_t ) 1000 ) 8 | 9 | // include the task components 10 | #include "WirelessTask.hpp" 11 | #include "SerialTask.hpp" 12 | #include "DisplayTask.hpp" 13 | // include the timer components 14 | 15 | // now start the tasks that have been defined 16 | extern "C" void app_main(void) 17 | { 18 | // create the tasks 19 | xTaskCreate(&WirelessTask::taskFunction, // function the task runs 20 | "taskFunction_0", // name of the task (should be short) 21 | 2048, // stack size for the task 22 | NULL, // parameters to task 23 | 0, // priority of the task (higher -> higher priority) 24 | NULL // returned task object (don't care about storing it) 25 | ); 26 | xTaskCreate(&SerialTask::taskFunction, // function the task runs 27 | "taskFunction_1", // name of the task (should be short) 28 | 2048, // stack size for the task 29 | NULL, // parameters to task 30 | 0, // priority of the task (higher -> higher priority) 31 | NULL // returned task object (don't care about storing it) 32 | ); 33 | xTaskCreate(&DisplayTask::taskFunction, // function the task runs 34 | "taskFunction_2", // name of the task (should be short) 35 | 2048, // stack size for the task 36 | NULL, // parameters to task 37 | 0, // priority of the task (higher -> higher priority) 38 | NULL // returned task object (don't care about storing it) 39 | ); 40 | } 41 | 42 | -------------------------------------------------------------------------------- /src/sdkconfig: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Espressif IoT Development Framework Configuration 4 | # 5 | 6 | # 7 | # SDK tool configuration 8 | # 9 | CONFIG_TOOLPREFIX="xtensa-esp32-elf-" 10 | CONFIG_PYTHON="python" 11 | 12 | # 13 | # Bootloader config 14 | # 15 | # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set 16 | # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set 17 | CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y 18 | # CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set 19 | # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set 20 | # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set 21 | CONFIG_LOG_BOOTLOADER_LEVEL=2 22 | 23 | # 24 | # Security features 25 | # 26 | # CONFIG_SECURE_BOOT_ENABLED is not set 27 | # CONFIG_FLASH_ENCRYPTION_ENABLED is not set 28 | 29 | # 30 | # Serial flasher config 31 | # 32 | CONFIG_ESPTOOLPY_PORT="/dev/ttyUSB1" 33 | CONFIG_ESPTOOLPY_BAUD_115200B=y 34 | # CONFIG_ESPTOOLPY_BAUD_230400B is not set 35 | # CONFIG_ESPTOOLPY_BAUD_921600B is not set 36 | # CONFIG_ESPTOOLPY_BAUD_2MB is not set 37 | # CONFIG_ESPTOOLPY_BAUD_OTHER is not set 38 | CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 39 | CONFIG_ESPTOOLPY_BAUD=115200 40 | # CONFIG_ESPTOOLPY_COMPRESSED is not set 41 | # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set 42 | # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set 43 | CONFIG_ESPTOOLPY_FLASHMODE_DIO=y 44 | # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set 45 | CONFIG_ESPTOOLPY_FLASHMODE="dio" 46 | # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set 47 | CONFIG_ESPTOOLPY_FLASHFREQ_40M=y 48 | # CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set 49 | # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set 50 | CONFIG_ESPTOOLPY_FLASHFREQ="40m" 51 | # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set 52 | CONFIG_ESPTOOLPY_FLASHSIZE_2MB=y 53 | # CONFIG_ESPTOOLPY_FLASHSIZE_4MB is not set 54 | # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set 55 | # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set 56 | CONFIG_ESPTOOLPY_FLASHSIZE="2MB" 57 | CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y 58 | # CONFIG_ESPTOOLPY_BEFORE_RESET is not set 59 | # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set 60 | CONFIG_ESPTOOLPY_BEFORE_ESP32R0=y 61 | CONFIG_ESPTOOLPY_BEFORE="esp32r0" 62 | CONFIG_ESPTOOLPY_AFTER_RESET=y 63 | # CONFIG_ESPTOOLPY_AFTER_NORESET is not set 64 | CONFIG_ESPTOOLPY_AFTER="hard_reset" 65 | # CONFIG_MONITOR_BAUD_9600B is not set 66 | # CONFIG_MONITOR_BAUD_57600B is not set 67 | CONFIG_MONITOR_BAUD_115200B=y 68 | # CONFIG_MONITOR_BAUD_230400B is not set 69 | # CONFIG_MONITOR_BAUD_921600B is not set 70 | # CONFIG_MONITOR_BAUD_2MB is not set 71 | # CONFIG_MONITOR_BAUD_OTHER is not set 72 | CONFIG_MONITOR_BAUD_OTHER_VAL=115200 73 | CONFIG_MONITOR_BAUD=115200 74 | 75 | # 76 | # Partition Table 77 | # 78 | CONFIG_PARTITION_TABLE_SINGLE_APP=y 79 | # CONFIG_PARTITION_TABLE_TWO_OTA is not set 80 | # CONFIG_PARTITION_TABLE_CUSTOM is not set 81 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" 82 | CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000 83 | CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" 84 | CONFIG_APP_OFFSET=0x10000 85 | CONFIG_PHY_DATA_OFFSET=0xf000 86 | CONFIG_OPTIMIZATION_LEVEL_DEBUG=y 87 | # CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set 88 | 89 | # 90 | # Component config 91 | # 92 | CONFIG_BT_ENABLED=y 93 | CONFIG_BTC_TASK_STACK_SIZE=3072 94 | # CONFIG_BLUEDROID_MEM_DEBUG is not set 95 | # CONFIG_BT_DRAM_RELEASE is not set 96 | CONFIG_BT_RESERVE_DRAM=0x10000 97 | 98 | # 99 | # ESP32-specific 100 | # 101 | # CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set 102 | # CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set 103 | CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y 104 | CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 105 | CONFIG_MEMMAP_SMP=y 106 | # CONFIG_MEMMAP_TRACEMEM is not set 107 | CONFIG_TRACEMEM_RESERVE_DRAM=0x0 108 | # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set 109 | # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set 110 | CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y 111 | # CONFIG_ESP32_ENABLE_COREDUMP is not set 112 | # CONFIG_TWO_MAC_ADDRESS_FROM_EFUSE is not set 113 | CONFIG_FOUR_MAC_ADDRESS_FROM_EFUSE=y 114 | CONFIG_NUMBER_OF_MAC_ADDRESS_GENERATED_FROM_EFUSE=4 115 | CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 116 | CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2048 117 | CONFIG_MAIN_TASK_STACK_SIZE=4096 118 | CONFIG_NEWLIB_STDOUT_ADDCR=y 119 | # CONFIG_NEWLIB_NANO_FORMAT is not set 120 | CONFIG_CONSOLE_UART_DEFAULT=y 121 | # CONFIG_CONSOLE_UART_CUSTOM is not set 122 | # CONFIG_CONSOLE_UART_NONE is not set 123 | CONFIG_CONSOLE_UART_NUM=0 124 | CONFIG_CONSOLE_UART_BAUDRATE=115200 125 | # CONFIG_ULP_COPROC_ENABLED is not set 126 | CONFIG_ULP_COPROC_RESERVE_MEM=0 127 | # CONFIG_ESP32_PANIC_PRINT_HALT is not set 128 | CONFIG_ESP32_PANIC_PRINT_REBOOT=y 129 | # CONFIG_ESP32_PANIC_SILENT_REBOOT is not set 130 | # CONFIG_ESP32_PANIC_GDBSTUB is not set 131 | CONFIG_ESP32_DEBUG_OCDAWARE=y 132 | CONFIG_INT_WDT=y 133 | CONFIG_INT_WDT_TIMEOUT_MS=300 134 | CONFIG_TASK_WDT=y 135 | # CONFIG_TASK_WDT_PANIC is not set 136 | CONFIG_TASK_WDT_TIMEOUT_S=5 137 | CONFIG_TASK_WDT_CHECK_IDLE_TASK=y 138 | # CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set 139 | CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y 140 | # CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set 141 | # CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set 142 | CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y 143 | CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=0 144 | CONFIG_WIFI_ENABLED=y 145 | # CONFIG_SW_COEXIST_ENABLE is not set 146 | CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10 147 | CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=0 148 | CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32 149 | CONFIG_ESP32_WIFI_AMPDU_ENABLED=y 150 | CONFIG_ESP32_WIFI_NVS_ENABLED=y 151 | CONFIG_PHY_ENABLED=y 152 | 153 | # 154 | # PHY 155 | # 156 | CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y 157 | # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set 158 | CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 159 | CONFIG_ESP32_PHY_MAX_TX_POWER=20 160 | # CONFIG_ETHERNET is not set 161 | 162 | # 163 | # FreeRTOS 164 | # 165 | CONFIG_FREERTOS_UNICORE=y 166 | CONFIG_FREERTOS_CORETIMER_0=y 167 | # CONFIG_FREERTOS_CORETIMER_1 is not set 168 | CONFIG_FREERTOS_HZ=1000 169 | CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y 170 | # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set 171 | CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL=y 172 | # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY is not set 173 | CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=3 174 | CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y 175 | # CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set 176 | # CONFIG_FREERTOS_ASSERT_DISABLE is not set 177 | CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG=y 178 | # CONFIG_ENABLE_MEMORY_DEBUG is not set 179 | CONFIG_FREERTOS_ISR_STACKSIZE=1536 180 | # CONFIG_FREERTOS_LEGACY_HOOKS is not set 181 | # CONFIG_FREERTOS_DEBUG_INTERNALS is not set 182 | 183 | # 184 | # Log output 185 | # 186 | # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set 187 | # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set 188 | # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set 189 | CONFIG_LOG_DEFAULT_LEVEL_INFO=y 190 | # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set 191 | # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set 192 | CONFIG_LOG_DEFAULT_LEVEL=3 193 | CONFIG_LOG_COLORS=y 194 | 195 | # 196 | # LWIP 197 | # 198 | # CONFIG_L2_TO_L3_COPY is not set 199 | CONFIG_LWIP_MAX_SOCKETS=4 200 | CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0 201 | # CONFIG_LWIP_SO_REUSE is not set 202 | # CONFIG_LWIP_SO_RCVBUF is not set 203 | CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 204 | # CONFIG_LWIP_IP_FRAG is not set 205 | # CONFIG_LWIP_IP_REASSEMBLY is not set 206 | CONFIG_TCP_MAXRTX=12 207 | CONFIG_TCP_SYNMAXRTX=6 208 | CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y 209 | 210 | # 211 | # mbedTLS 212 | # 213 | CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN=16384 214 | # CONFIG_MBEDTLS_DEBUG is not set 215 | CONFIG_MBEDTLS_HARDWARE_AES=y 216 | CONFIG_MBEDTLS_HARDWARE_MPI=y 217 | CONFIG_MBEDTLS_MPI_USE_INTERRUPT=y 218 | CONFIG_MBEDTLS_HARDWARE_SHA=y 219 | CONFIG_MBEDTLS_HAVE_TIME=y 220 | # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set 221 | 222 | # 223 | # OpenSSL 224 | # 225 | # CONFIG_OPENSSL_DEBUG is not set 226 | CONFIG_OPENSSL_ASSERT_DO_NOTHING=y 227 | # CONFIG_OPENSSL_ASSERT_EXIT is not set 228 | 229 | # 230 | # SPI Flash driver 231 | # 232 | # CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set 233 | --------------------------------------------------------------------------------