diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/LedDisplay.exe b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/LedDisplay.exe new file mode 100644 index 0000000..f0aa6bf Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/LedDisplay.exe differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtCore4.dll b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtCore4.dll new file mode 100644 index 0000000..111e324 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtCore4.dll differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtGui4.dll b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtGui4.dll new file mode 100644 index 0000000..554301f Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/QtGui4.dll differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/libgcc_s_dw2-1.dll b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..9e32dc2 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/libgcc_s_dw2-1.dll differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/mingwm10.dll b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/mingwm10.dll new file mode 100644 index 0000000..572f888 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/PC Dot Matrix Control Application/mingwm10.dll differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/main.hex b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/main.hex new file mode 100644 index 0000000..a8cf1e7 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/GREEN/main.hex @@ -0,0 +1,485 @@ +:100000000C94700A0C948B0A0C948B0A0C948B0A37 +:100010000C948B0A0C948B0A0C948B0A0C948B0A0C +:100020000C948B0A0C948B0A0C948B0A0C948B0AFC +:100030000C948B0A0C948B0A0C948B0A0C948B0AEC +:100040000C948B0A0C948B0A0C948B0A0C948B0ADC +:100050000C948B0A0C948B0A0C948B0A0C948B0ACC +:100060000C948B0A0C948B0A0C948B0A0C948B0ABC +:100070000C948B0A0C948B0A0C948B0A0C948B0AAC +:100080000C948B0A0C948B0A0C948B0A0C948B0A9C +:100090000C948B0A0C948B0A31313131313131316E +:1000A00000313131313131313100313131313131A2 +:1000B0003131003131313131313131003131313192 +:1000C0003131313100313131313131313100313182 +:1000D0003131313131310031313131313131310072 +:1000E0003131313130313131003131313030303135 +:1000F0003100313131303030313100313131303057 +:100100003031310031313131303131310031313143 +:100110003131313131003131313130313131003132 +:1001200031313131313131003131303031313030F4 +:100130000031313030313130300031313030313117 +:100140003030003131303031313030003131313107 +:1001500031313131003131313131313131003131F1 +:1001600031313131313100313131313131313100E1 +:1001700031313130313130310031313130313130A4 +:1001800031003131303030303030003131313031C8 +:1001900031303100313130303030303000313131B8 +:1001A00030313130310031313130313130310031A5 +:1001B0003131313131313100313131313031313161 +:1001C0000031313030303030310031303131303188 +:1001D0003131003131303030303031003131313176 +:1001E0003031313000313130303030303100313168 +:1001F0003131303131310031313131313131310052 +:100200003131303131313130003130313031313014 +:100210003100313130313130313100313131313033 +:100220003131310031313130313130310031313023 +:100230003131303130003130313131313031003114 +:1002400031313131313131003131313030313131D1 +:1002500000313130313130313100313130313031F4 +:1002600031310031313130313131310031313031E2 +:1002700030313130003131303131303031003131D5 +:1002800031303030313000313131313131313100C4 +:100290003131313131313030003131313131303083 +:1002A00031003131313130303131003131313030A4 +:1002B0003131310031313030313131310031313192 +:1002C0003131313131003131313131313131003180 +:1002D0003131313131313100313131303031313141 +:1002E0000031313031313131310031303131313162 +:1002F0003131003130313131313131003130313152 +:100300003131313100313130313131313100313140 +:100310003130303131310031313131313131310031 +:1003200031313131303031310031313131313130F1 +:100330003100313131313131313000313131313110 +:100340003131300031313131313131300031313101 +:1003500031313130310031313131303031310031F2 +:1003600031313131313131003130313131313130B0 +:1003700000313130313131303100313131303130D3 +:1003800031310031303030303030300031313130C7 +:1003900031303131003131303131313031003130B3 +:1003A00031313131313000313131313131313100A0 +:1003B0003131313130313131003131313130313160 +:1003C0003100313131313031313100313030303084 +:1003D0003030300031313131303131310031313173 +:1003E0003130313131003131313130313131003161 +:1003F000313131313131310031313131313131311E +:10040000003131313131313131003131313131313E +:100410003131003131313030313131003131303032 +:100420003031313100313130303031313100313122 +:10043000303131313131003131313131313131000F +:1004400031313131313131310031313131313131CD +:1004500031003131313131313131003131303030F1 +:1004600030303000313130303030303000313131E7 +:1004700031313131310031313131313131310031CE +:10048000313131313131310031313131313131318D +:1004900000313131313131313100313131313131AE +:1004A00031310031313130303031310031313030A3 +:1004B0003030303100313130303030303100313196 +:1004C0003130303031310031313131313131310081 +:1004D000313131313131313000313131313131303F +:1004E0003000313131313130303100313131313062 +:1004F0003031310031313130303131310031313052 +:10050000303131313100313130313131313100313F +:1005100031313131313131003131313030303131FF +:100520000031313031313130310031303131313021 +:100530003130003130313130313130003130313013 +:100540003131313000313130313131303100313100 +:1005500031303030313100313131313131313100F0 +:1005600031313131303131310031313130303131AF +:1005700031003131303130313131003131313130D0 +:1005800031313100313131313031313100313131BE +:1005900031303131310031313030303030310031B3 +:1005A000313131313131310031313130303031316F +:1005B000003131303131313031003131313131318F +:1005C000303100313131313130313100313131317F +:1005D000303131310031313130313131310031316F +:1005E0003030303030300031313131313131310063 +:1005F0003131303030303031003130313131313122 +:10060000300031313131313131300031313131303F +:100610003030310031313131313131300031303130 +:100620003131313130003131303030303031003122 +:1006300031313131313131003131313130303131DD +:100640000031313130313031310031313031313000 +:1006500031310031303030303030300031313131F3 +:1006600031303131003131313131303131003131DE +:1006700031303030303100313131313131313100D0 +:100680003130303030303030003130313131313193 +:1006900031003130313030303031003130303131B3 +:1006A000313130003131313131313130003130319F +:1006B0003131313130003131303030303031003192 +:1006C000313131313131310031313130303030314F +:1006D000003131303131313130003130313131316F +:1006E0003131003130313030303031003130303163 +:1006F000313131300031303131313131300031314F +:100700003030303030310031313131313131310040 +:100710003130303030303030003130313131313102 +:10072000300031313131313130310031313131311D +:10073000303131003131313130313131003131310D +:1007400031303131310031313131303131310031FD +:1007500031313131313131003131303030303031BF +:1007600000313031313131313000313031313131DE +:1007700031300031313030303030310031303131D2 +:1007800031313130003130313131313130003131BE +:1007900030303030303100313131313131313100B0 +:1007A0003131303030303031003130313131313170 +:1007B0003000313031313131313000313130303091 +:1007C0003030300031313131313131300031303180 +:1007D0003131313031003131303030303131003170 +:1007E000313131313131310031313130303031312D +:1007F0000031313030303030310031313130303053 +:10080000313100313131313131313100313131303B +:100810003030313100313130303030303100313131 +:10082000313030303131003131313131313131001D +:1008300031313130303031310031313130303031DF +:1008400031003131313030303131003131313131FD +:1008500031313100313131303030313100313131ED +:1008600030303031310031313130313131310031DE +:10087000313131313131310031313131303031319B +:1008800000313131303031313100313130303131BE +:1008900031310031303031313131310031313030AE +:1008A000313131310031313130303131310031319C +:1008B000313130303131003131313131313131008C +:1008C000313131313131313100313030303030304F +:1008D0003000313030303030303000313131313172 +:1008E0003131310031303030303030300031303063 +:1008F000303030303000313131313131313100314F +:10090000313131313131310031313130303131310A +:10091000003131313130303131003131313131302C +:10092000303100313131313131303000313131311C +:10093000313030310031313131303031310031310D +:1009400031303031313100313131313131313100FB +:1009500031313030303030310031303131313131BE +:1009600030003131313131303031003131313130DD +:1009700031313100313131313031313100313131CA +:1009800031313131310031313131303131310031BA +:10099000313131313131310031313130303030317C +:1009A000003131303131313130003130313130309E +:1009B0003130003130313031303130003130313090 +:1009C000303030310031303131313131310031317D +:1009D000303030303031003131313131313131006E +:1009E000313131313030313100313131303131302C +:1009F000310031313031313131300031313030304E +:100A0000303030003131303131313130003131303E +:100A1000313131313000313130313131313000312B +:100A200031313131313131003131303030303031EC +:100A3000003131303131313130003131303131310B +:100A400031300031313030303030310031313031FF +:100A500031313130003131303131313130003131EB +:100A600030303030303100313131313131313100DD +:100A7000313131303030303100313130313131319C +:100A800030003131303131313131003131303131BB +:100A900031313100313130313131313100313130AA +:100AA000313131313000313131303030303100319D +:100AB000313131313131310031313030303030315C +:100AC000003131303131313130003131303131317B +:100AD000313000313130313131313000313130316C +:100AE000313131300031313031313131300031315B +:100AF000303030303031003131313131313131004D +:100B0000313130303030303000313130313131310D +:100B1000310031313031313131310031313030302B +:100B2000303131003131303131313131003131301A +:100B3000313131313100313130303030303000310D +:100B400031313131313131003131303030303030CC +:100B500000313130313131313100313130313131E9 +:100B600031310031313030303031310031313031DC +:100B700031313131003131303131313131003131C8 +:100B800030313131313100313131313131313100B8 +:100B9000313131303030303100313130313131317B +:100BA000300031313031313131310031313031319A +:100BB000303030003131303131313130003131308D +:100BC000313131313000313131303030303000317D +:100BD0003131313131313100313130313131313038 +:100BE000003131303131313130003131303131315A +:100BF000313000313130303030303000313130314F +:100C00003131313000313130313131313000313139 +:100C10003031313131300031313131313131310028 +:100C200031313030303030300031313131303031ED +:100C30003100313131313030313100313131313009 +:100C400030313100313131313030313100313131F9 +:100C500031303031310031313030303030300031EE +:100C600031313131313131003131303030303030AB +:100C700000313131313131313000313131313131C7 +:100C800031300031313131313131300031313031B9 +:100C900031313130003131303131313130003131A9 +:100CA000313030303031003131313131313131009A +:100CB0003131303131313130003131303131313059 +:100CC000310031313031313031310031313030307B +:100CD0003131310031313031313031310031313069 +:100CE0003131313031003131303131313130003159 +:100CF0003131313131313100313130313131313116 +:100D00000031313031313131310031313031313137 +:100D10003131003131303131313131003131303127 +:100D20003131313100313130313131313100313116 +:100D3000303030303030003131313131313131000B +:100D400031313031313131300031313030313130C9 +:100D500030003131303130303130003131303131EB +:100D600031313000313130313131313000313130D9 +:100D700031313131300031313031313131300031C8 +:100D80003131313131313100313130313131313086 +:100D900000313130303131313000313130303031AB +:100DA000313000313130313030313000313130319B +:100DB000313030300031313031313130300031318B +:100DC0003031313131300031313131313131310077 +:100DD000313130303030303100313031313131313A +:100DE0003000313031313131313000313031313159 +:100DF0003131300031303131313131300031303149 +:100E0000313131313000313130303030303100313A +:100E100031313131313131003131303030303031F8 +:100E20000031313031313131300031313031313117 +:100E3000313000313130303030303100313130310B +:100E400031313131003131303131313131003131F5 +:100E500030313131313100313131313131313100E5 +:100E600031313130303030310031313031313131A8 +:100E700030003131303131313130003131303131C8 +:100E800031313000313130313130313000313130B9 +:100E900031313130300031313130303030300031AB +:100EA0003131313131313100313130303030303168 +:100EB0000031313031313131300031313031313187 +:100EC000313000313130303030303100313130317B +:100ED0003130313100313130313131303100313167 +:100EE0003031313131300031313131313131310056 +:100EF0003131313030303031003131303131313118 +:100F00003000313130313131313100313131303037 +:100F10003030310031313131313131300031313027 +:100F20003131313130003131313030303031003118 +:100F300031313131313131003131303030303030D8 +:100F400000313131313030313100313131313030F7 +:100F500031310031313131303031310031313131E5 +:100F600030303131003131313130303131003131D7 +:100F700031313030313100313131313131313100C5 +:100F80003131303131313130003131303131313185 +:100F900030003131303131313130003131303131A7 +:100FA0003131300031313031313131300031313097 +:100FB0003131313130003131313030303031003188 +:100FC0003131313131313100313031313131313044 +:100FD0000031303131313131300031313031313166 +:100FE0003031003131303131313031003131313057 +:100FF0003130313100313131303130313100313146 +:101000003131303131310031313131313131310033 +:1010100031303131313131300031303131313131F4 +:101020003000313031313131313000313031313017 +:101030003131300031303130313031300031303009 +:1010400031313130300031303131313131300031F6 +:1010500031313131313131003130313131313130B3 +:1010600000313130313131303100313131303130D6 +:1010700031310031313131303131310031313130C4 +:1010800031303131003131303131313031003130B6 +:1010900031313131313000313131313131313100A3 +:1010A0003130313131313130003131303131313065 +:1010B0003100313131303130313100313131313085 +:1010C0003131310031313131303131310031313173 +:1010D0003130313131003131313130313131003164 +:1010E0003131313131313100313030303030303028 +:1010F0000031313131313130310031313131313044 +:101100003131003131313130313131003131313033 +:101110003131313100313130313131313100313023 +:101120003030303030300031313131313131310017 +:101130009800A100AA00B300BC00C500CE00D700F3 +:10114000E000E900F200FB0004010D0116011F019F +:10115000280131013A0143014C0155015E0167014B +:101160007001790182018B0194019D01A601AF01FB +:10117000B801C101CA01D301DC01E501EE01F701AB +:101180000002090212021B0224022D0236023F0253 +:10119000480251025A0263026C0275027E02870203 +:1011A00090029902A202AB02B402BD02C602CF02B3 +:1011B000D802E102EA02F302FC0205030E03170360 +:1011C0002003290332033B0344034D0356035F030B +:1011D000680371037A0383038C0395039E03A703BB +:1011E000B003B903C203CB03D403DD03E603EF036B +:1011F000F80301040A0413041C0425042E04370414 +:101200004004490452045B0464046D0476047F04C2 +:10121000880491049A04A304AC04B504BE04C70472 +:10122000D004D904E204EB04F404FD0406050F0520 +:10123000180521052A0533053C0545054E055705CA +:101240006005690572057B0584058D0596059F057A +:10125000A805B105BA05C305CC05D505DE05E7052A +:10126000F005F90502060B0614061D0626062F06D4 +:10127000380641064A0653065C0665066E06770682 +:101280008006890692069B06A406AD06B606BF0632 +:10129000C806D106DA06E306EC06F506FE060707E1 +:1012A0001007190722072B0734073D0746074F078A +:1012B000580761076A0773077C0785078E0797073A +:1012C000A007A907B207BB07C407CD07D607DF07EA +:1012D000E807F107FA0703080C0815081E08270895 +:1012E0003008390842084B0854085D0866086F0842 +:1012F000780881088A0893089C08A508AE08B708F2 +:10130000C008C908D208DB08E408ED08F608FF08A1 +:10131000080911091A0923092C0935093E09470949 +:101320005009590962096B0974097D0986098F09F9 +:101330009809A109AA09B309BC09C509CE09D709A9 +:10134000E009E909F209FB09040A0D0A160A1F0A55 +:10135000280A310A3A0A430A4C0A550A5E0A670A01 +:10136000700A790A820A8B0A940A9D0AA60AAF0AB1 +:10137000B80AC10ACA0AD30ADC0AE50AEE0AF70A61 +:10138000000B090B120B1B0B240B2D0B360B3F0B09 +:10139000480B510B5A0B630B6C0B750B7E0B870BB9 +:1013A000900B990BA20BAB0BB40BBD0BC60BCF0B69 +:1013B000D80BE10BEA0BF30BFC0B050C0E0C170C16 +:1013C000200C290C320C3B0C440C4D0C560C5F0CC1 +:1013D000680C710C7A0C830C8C0C950C9E0CA70C71 +:1013E000B00CB90CC20CCB0CD40CDD0CE60CEF0C21 +:1013F000F80C010D0A0D130D1C0D250D2E0D370DCA +:10140000400D490D520D5B0D640D6D0D760D7F0D78 +:10141000880D910D9A0DA30DAC0DB50DBE0DC70D28 +:10142000D00DD90DE20DEB0DF40DFD0D060E0F0ED6 +:10143000180E210E2A0E330E3C0E450E4E0E570E80 +:10144000600E690E720E7B0E840E8D0E960E9F0E30 +:10145000A80EB10EBA0EC30ECC0ED50EDE0EE70EE0 +:10146000F00EF90E020F0B0F140F1D0F260F2F0F8A +:10147000380F410F4A0F530F5C0F650F6E0F770F38 +:10148000800F890F920F9B0FA40FAD0FB60FBF0FE8 +:10149000C80FD10FDA0FE30FEC0FF50FFE0F071097 +:1014A0001010191022102B1034103D1046104F1040 +:1014B000581061106A1073107C1085108E109710F0 +:1014C000A010A910B210BB10C410CD10D610DF10A0 +:1014D000E810F110FA1003110C1115111E1127114B +:1014E00011241FBECFEFD0E1DEBFCDBF11E0A0E0E1 +:1014F000B1E0E2EBFDE102C005900D92A237B10729 +:10150000D9F713E0A2E7B1E001C01D92AA3AB107F2 +:10151000E1F7FDD24CC40C940000382F803250F01B +:10152000683010F480E001C082E0432F42954F7094 +:101530004D5F09C0683010F480E001C082E0432FA5 +:1015400042954F704F5F480F262F237088E090E040 +:1015500002C0959587952A95E2F7982F6770669552 +:1015600066953F70330F630F262F30E050E04150F7 +:101570005040F90163E0EE0FFF1F6A95E1F7E40FB9 +:10158000F51FEE58FE4F80818923F901B09688231C +:1015900091F023E0EE0FFF1F2A95E1F7E40FF51F0E +:1015A000EE58FE4F8081982319F421E030E014C0FA +:1015B00023E030E011C083E0EE0FFF1F8A95E1F7D2 +:1015C000E40FF51FEE58FE4F8081982319F420E0B8 +:1015D00030E002C022E030E0C901089520E030E0B0 +:1015E0000AC01192019688309105D9F72F5F3F4FBD +:1015F0002830310559F0F901A3E0EE0FFF1FAA953D +:10160000E1F7E659FC4F80E090E0EBCF0895FC0154 +:1016100020E43FE10CC08091C800319685FD02C0F6 +:1016200081E008959093CE00C9010197F1F7908170 +:10163000992389F780E008950F931F93DF93CF9349 +:10164000CDB7DEB761970FB6F894DEBF0FBECDBF42 +:10165000AC01162F072FFE0131969E012E5E3F4FE3 +:101660008091C80087FFFCCF8091CE008823C1F312 +:101670008193E217F307A1F720E030E0BE016F5F2E +:101680007F4FFA01E20FF31FDB01A20FB31F8C9112 +:1016900080832F5F3F4F2830310599F7FA0110867C +:1016A000FE013996812F902F9C01D9019E012F5E5A +:1016B0003F4F81918D93E217F307D9F7CA01A7DF56 +:1016C000812F902FA4DF80E091E0A1DF80E0619680 +:1016D0000FB6F894DEBF0FBECDBFCF91DF911F9143 +:1016E0000F91089511B88FEC84B98FEF87B988E016 +:1016F0008AB987E08DB910BA08951F93182FCB01CE +:1017000062E071E044D3009759F425B181E090E0A4 +:1017100002C0880F991F1A95E2F7282B25B90BC034 +:1017200025B181E090E002C0880F991F1A95E2F779 +:101730008095822385B91F91089581E062E071E070 +:10174000DCDF81E067E071E0D8CF0F931F93082FB3 +:10175000162F18C082E090E067E071E0CEDF812FA5 +:10176000802329F080E090E062E071E004C080E036 +:1017700090E067E071E0C1DF82E090E062E071E05C +:10178000BCDF1695112331F71F910F9108951F9318 +:10179000CF93DF93EC0197FF0BC083E090E067E00D +:1017A00071E0ABDF10E0C9DF1F5F1830E1F72BC03D +:1017B000009759F483E090E062E071E09EDF10E072 +:1017C000BCDF1F5F1830E1F71EC083E090E062E0ED +:1017D00071E093DF10E0B1DF1F5F1830E1F783E0C5 +:1017E00090E067E071E089DFA8DF83E090E062E0ED +:1017F00071E083DF11E002C0A0DF1F5F812F90E066 +:101800008C179D07CCF3DF91CF911F9108951F9303 +:10181000162F90E0BCDF84E064E097DF812F60E862 +:1018200094DF80E061E091DF80E090E0B0DF1F9125 +:1018300008951F93CF93DF93C1E0D0E0CE01A7DFDF +:1018400085E090E064E070E080DF80E090E060E4BC +:1018500070E07BDF10E080E090E060E870E075DF32 +:101860001F5F1032C1F780E090E091DFFE01EE587B +:10187000FE4F80E010828F5F38968034D9F7219632 +:10188000C930D105D9F6DF91CF911F9108950F93FB +:101890001F93162F042F90E07ADF85E090E064E03C +:1018A00070E053DF812F90E060E470E04EDF802F26 +:1018B00090E068E070E049DF80E090E068DF1F9131 +:1018C0000F910895DF92EF92FF920F931F93382F9D +:1018D000803408F0D8C0603108F0D5C0443008F03A +:1018E000D2C0803260F0683010F480E001C082E045 +:1018F000D32ED294FFE0DF2293E0D90E0AC06830E5 +:1019000010F480E001C082E0D32ED294EFE0DE221A +:10191000D394D80E77E0E72EE622E694E694832F60 +:101920008F70880FE80E262F237088E090E002C0A9 +:10193000959587952A95E2F7F82E4130A1F141302F +:1019400038F0423009F45BC0433009F09CC070C0ED +:10195000832FE3DD892B09F496C0EE2DF0E00D2DE9 +:1019600010E001501040F09453E0EE0FFF1F5A9525 +:10197000E1F7E00FF11FEE58FE4F40814F21408309 +:101980008D2D6E2D84DF6E2D605EE62FF0E043E03E +:10199000EE0FFF1F4A95E1F7E00FF11FEE58FE4FE3 +:1019A00040814F216DC0832FB8DD019709F46BC0D2 +:1019B000EE2DF0E00D2D10E00150104033E0EE0F61 +:1019C000FF1F3A95E1F7E00FF11FEE58FE4F4081FF +:1019D0004F2940838D2D6E2D5ADF6E2D605EE62FD0 +:1019E000F0E023E0EE0FFF1F2A95E1F7E00FF11F73 +:1019F000EE58FE4F4F2D40958081482341C0832FE4 +:101A00008CDD029709F43FC0EE2DF0E00D2D10E0C3 +:101A10000150104093E0EE0FFF1F9A95E1F7E00FA1 +:101A2000F11FEE58FE4F4F2D40958081482315C081 +:101A3000832F73DD039739F1EE2DF0E00D2D10E0CB +:101A40000150104083E0EE0FFF1F8A95E1F7E00F91 +:101A5000F11FEE58FE4F40814F2940838D2D6E2D92 +:101A600016DF6E2D605EE62FF0E0B3E0EE0FFF1F95 +:101A7000BA95E1F7E00FF11FEE58FE4F40814F2974 +:101A800040838D2D04DF1F910F91FF90EF90DF9029 +:101A90000895BF92CF92DF92EF92FF920F931F9320 +:101AA000CF93DF93B82EB6E3EB2EB1E0FB2EA0E38D +:101AB000CA2EA1E1DA2E1CC0F70180818B1589F4B2 +:101AC000CAE6D3E08601F80165917491CE0148E041 +:101AD00050E054D10E5F1F4F2896F3E0CA3ADF075B +:101AE00091F70894E11CF11C80E190E0C80ED91E2A +:101AF00091E7E91691E0F906F9F6DF91CF911F9190 +:101B00000F91FF90EF90DF90CF90BF9008957F925C +:101B10008F929F92AF92BF92CF92DF92EF92FF92FD +:101B20000F931F93DF93CF93CDB7DEB7C655D04049 +:101B30000FB6F894DEBF0FBECDBFDE011196EBE10C +:101B4000F1E089E001900D928150E1F7DE011A96F3 +:101B5000E4E2F1E089E001900D928150E1F7C2DD0D +:101B600018B885B1806C85B985B18F7385B980E867 +:101B700085B9479A83E090E062E071E0BEDD01E064 +:101B8000802F60E044DE802F60E241DE802F68E13C +:101B90003EDE802F61E03BDE802F63E038DE0F5FAA +:101BA000093071F746DE469A1092CD008CE08093A2 +:101BB000CC0082E08093C80088E18093C90086E071 +:101BC0008093CA00459A8E010B5D1F4FC8016BE0E0 +:101BD00071E0E6D0449AC8011ADD80ED97E028EC68 +:101BE00030E0F9013197F1F70197D9F718B8CE0134 +:101BF00001966BE171E0D4D0CE010A9664E271E007 +:101C0000CFD05E010894A11CB11C9924E7DCCC2440 +:101C1000DD24792C7A9423C0F50180813ADFF70125 +:101C2000808180FD05C0872D800F682D41E004C0B4 +:101C3000872D800F682D40E045DE88B1809588B9FA +:101C40000F5F1F4F0894E11CF11C0830110521F7AC +:101C50000894C11CD11CF8E0CF16D10471F08C2C73 +:101C6000760143E0EE0CFF1C4A95E1F78AE693E02B +:101C7000E80EF91E00E010E0CFCF98E0990E08942E +:101C8000A11CB11CE0E49E1609F0C0CF3AE0A32EDF +:101C9000B12CAC0EBD1E8824A1DCCC24DD2428E0B0 +:101CA000922E782C7A9423C0F5018081F2DEF70120 +:101CB000808180FD05C0872D800F692D41E004C023 +:101CC000872D800F692D40E0FDDD88B1809588B9B2 +:101CD0000F5F1F4F0894E11CF11C0830110521F71C +:101CE0000894C11CD11C9394F0E19F1669F0760111 +:101CF00093E0EE0CFF1C9A95E1F78AE693E0E80E7C +:101D0000F91E00E010E0D0CF98E0890E0894A11CE5 +:101D1000B11CE0E48E1609F0BFCF18B883E1882E1D +:101D2000912C8C0E9D1E7E010894E11CF11C0CE18F +:101D3000A02EB12CAC0EBD1E1AE0C12ED12CCC0EA3 +:101D4000DD1EC401B7012CD0C501B60129D0C701E1 +:101D5000B60172DCC7016DE271E019D0009709F499 +:101D6000FECEC701B40113D08C01C601B5010FD05E +:101D7000012B09F046CF009721F343CFFB01DC0193 +:101D800002C005900D9241505040D8F70895FB01D4 +:101D9000DC018D91019080190110D9F3990B089500 +:101DA000FB01DC0101900D920020E1F70895F89409 +:021DB000FFCF63 +:101DB2000A0048494748004C4F5700496E69746908 +:101DC200616C697A65642E2E2E0A0059415920549D +:101DD20048495300574F524B53212121005245533A +:101DE20045545245530020217123242526272829B2 +:101DF2002A2B2C2D2E2F30313233343536373839C9 +:101E02003A3B3C3D3E3F40414243444546474849B8 +:101E12004A4B4C4D4E4F50515253545556575859A8 +:021E22005A0064 +:00000001FF diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/main.hex b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/main.hex new file mode 100644 index 0000000..a72b89d --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Binaries/Wunderboard/RED/main.hex @@ -0,0 +1,485 @@ +:100000000C94700A0C948B0A0C948B0A0C948B0A37 +:100010000C948B0A0C948B0A0C948B0A0C948B0A0C +:100020000C948B0A0C948B0A0C948B0A0C948B0AFC +:100030000C948B0A0C948B0A0C948B0A0C948B0AEC +:100040000C948B0A0C948B0A0C948B0A0C948B0ADC +:100050000C948B0A0C948B0A0C948B0A0C948B0ACC +:100060000C948B0A0C948B0A0C948B0A0C948B0ABC +:100070000C948B0A0C948B0A0C948B0A0C948B0AAC +:100080000C948B0A0C948B0A0C948B0A0C948B0A9C +:100090000C948B0A0C948B0A31313131313131316E +:1000A00000313131313131313100313131313131A2 +:1000B0003131003131313131313131003131313192 +:1000C0003131313100313131313131313100313182 +:1000D0003131313131310031313131313131310072 +:1000E0003131313130313131003131313030303135 +:1000F0003100313131303030313100313131303057 +:100100003031310031313131303131310031313143 +:100110003131313131003131313130313131003132 +:1001200031313131313131003131303031313030F4 +:100130000031313030313130300031313030313117 +:100140003030003131303031313030003131313107 +:1001500031313131003131313131313131003131F1 +:1001600031313131313100313131313131313100E1 +:1001700031313130313130310031313130313130A4 +:1001800031003131303030303030003131313031C8 +:1001900031303100313130303030303000313131B8 +:1001A00030313130310031313130313130310031A5 +:1001B0003131313131313100313131313031313161 +:1001C0000031313030303030310031303131303188 +:1001D0003131003131303030303031003131313176 +:1001E0003031313000313130303030303100313168 +:1001F0003131303131310031313131313131310052 +:100200003131303131313130003130313031313014 +:100210003100313130313130313100313131313033 +:100220003131310031313130313130310031313023 +:100230003131303130003130313131313031003114 +:1002400031313131313131003131313030313131D1 +:1002500000313130313130313100313130313031F4 +:1002600031310031313130313131310031313031E2 +:1002700030313130003131303131303031003131D5 +:1002800031303030313000313131313131313100C4 +:100290003131313131313030003131313131303083 +:1002A00031003131313130303131003131313030A4 +:1002B0003131310031313030313131310031313192 +:1002C0003131313131003131313131313131003180 +:1002D0003131313131313100313131303031313141 +:1002E0000031313031313131310031303131313162 +:1002F0003131003130313131313131003130313152 +:100300003131313100313130313131313100313140 +:100310003130303131310031313131313131310031 +:1003200031313131303031310031313131313130F1 +:100330003100313131313131313000313131313110 +:100340003131300031313131313131300031313101 +:1003500031313130310031313131303031310031F2 +:1003600031313131313131003130313131313130B0 +:1003700000313130313131303100313131303130D3 +:1003800031310031303030303030300031313130C7 +:1003900031303131003131303131313031003130B3 +:1003A00031313131313000313131313131313100A0 +:1003B0003131313130313131003131313130313160 +:1003C0003100313131313031313100313030303084 +:1003D0003030300031313131303131310031313173 +:1003E0003130313131003131313130313131003161 +:1003F000313131313131310031313131313131311E +:10040000003131313131313131003131313131313E +:100410003131003131313030313131003131303032 +:100420003031313100313130303031313100313122 +:10043000303131313131003131313131313131000F +:1004400031313131313131310031313131313131CD +:1004500031003131313131313131003131303030F1 +:1004600030303000313130303030303000313131E7 +:1004700031313131310031313131313131310031CE +:10048000313131313131310031313131313131318D +:1004900000313131313131313100313131313131AE +:1004A00031310031313130303031310031313030A3 +:1004B0003030303100313130303030303100313196 +:1004C0003130303031310031313131313131310081 +:1004D000313131313131313000313131313131303F +:1004E0003000313131313130303100313131313062 +:1004F0003031310031313130303131310031313052 +:10050000303131313100313130313131313100313F +:1005100031313131313131003131313030303131FF +:100520000031313031313130310031303131313021 +:100530003130003130313130313130003130313013 +:100540003131313000313130313131303100313100 +:1005500031303030313100313131313131313100F0 +:1005600031313131303131310031313130303131AF +:1005700031003131303130313131003131313130D0 +:1005800031313100313131313031313100313131BE +:1005900031303131310031313030303030310031B3 +:1005A000313131313131310031313130303031316F +:1005B000003131303131313031003131313131318F +:1005C000303100313131313130313100313131317F +:1005D000303131310031313130313131310031316F +:1005E0003030303030300031313131313131310063 +:1005F0003131303030303031003130313131313122 +:10060000300031313131313131300031313131303F +:100610003030310031313131313131300031303130 +:100620003131313130003131303030303031003122 +:1006300031313131313131003131313130303131DD +:100640000031313130313031310031313031313000 +:1006500031310031303030303030300031313131F3 +:1006600031303131003131313131303131003131DE +:1006700031303030303100313131313131313100D0 +:100680003130303030303030003130313131313193 +:1006900031003130313030303031003130303131B3 +:1006A000313130003131313131313130003130319F +:1006B0003131313130003131303030303031003192 +:1006C000313131313131310031313130303030314F +:1006D000003131303131313130003130313131316F +:1006E0003131003130313030303031003130303163 +:1006F000313131300031303131313131300031314F +:100700003030303030310031313131313131310040 +:100710003130303030303030003130313131313102 +:10072000300031313131313130310031313131311D +:10073000303131003131313130313131003131310D +:1007400031303131310031313131303131310031FD +:1007500031313131313131003131303030303031BF +:1007600000313031313131313000313031313131DE +:1007700031300031313030303030310031303131D2 +:1007800031313130003130313131313130003131BE +:1007900030303030303100313131313131313100B0 +:1007A0003131303030303031003130313131313170 +:1007B0003000313031313131313000313130303091 +:1007C0003030300031313131313131300031303180 +:1007D0003131313031003131303030303131003170 +:1007E000313131313131310031313130303031312D +:1007F0000031313030303030310031313130303053 +:10080000313100313131313131313100313131303B +:100810003030313100313130303030303100313131 +:10082000313030303131003131313131313131001D +:1008300031313130303031310031313130303031DF +:1008400031003131313030303131003131313131FD +:1008500031313100313131303030313100313131ED +:1008600030303031310031313130313131310031DE +:10087000313131313131310031313131303031319B +:1008800000313131303031313100313130303131BE +:1008900031310031303031313131310031313030AE +:1008A000313131310031313130303131310031319C +:1008B000313130303131003131313131313131008C +:1008C000313131313131313100313030303030304F +:1008D0003000313030303030303000313131313172 +:1008E0003131310031303030303030300031303063 +:1008F000303030303000313131313131313100314F +:10090000313131313131310031313130303131310A +:10091000003131313130303131003131313131302C +:10092000303100313131313131303000313131311C +:10093000313030310031313131303031310031310D +:1009400031303031313100313131313131313100FB +:1009500031313030303030310031303131313131BE +:1009600030003131313131303031003131313130DD +:1009700031313100313131313031313100313131CA +:1009800031313131310031313131303131310031BA +:10099000313131313131310031313130303030317C +:1009A000003131303131313130003130313130309E +:1009B0003130003130313031303130003130313090 +:1009C000303030310031303131313131310031317D +:1009D000303030303031003131313131313131006E +:1009E000313131313030313100313131303131302C +:1009F000310031313031313131300031313030304E +:100A0000303030003131303131313130003131303E +:100A1000313131313000313130313131313000312B +:100A200031313131313131003131303030303031EC +:100A3000003131303131313130003131303131310B +:100A400031300031313030303030310031313031FF +:100A500031313130003131303131313130003131EB +:100A600030303030303100313131313131313100DD +:100A7000313131303030303100313130313131319C +:100A800030003131303131313131003131303131BB +:100A900031313100313130313131313100313130AA +:100AA000313131313000313131303030303100319D +:100AB000313131313131310031313030303030315C +:100AC000003131303131313130003131303131317B +:100AD000313000313130313131313000313130316C +:100AE000313131300031313031313131300031315B +:100AF000303030303031003131313131313131004D +:100B0000313130303030303000313130313131310D +:100B1000310031313031313131310031313030302B +:100B2000303131003131303131313131003131301A +:100B3000313131313100313130303030303000310D +:100B400031313131313131003131303030303030CC +:100B500000313130313131313100313130313131E9 +:100B600031310031313030303031310031313031DC +:100B700031313131003131303131313131003131C8 +:100B800030313131313100313131313131313100B8 +:100B9000313131303030303100313130313131317B +:100BA000300031313031313131310031313031319A +:100BB000303030003131303131313130003131308D +:100BC000313131313000313131303030303000317D +:100BD0003131313131313100313130313131313038 +:100BE000003131303131313130003131303131315A +:100BF000313000313130303030303000313130314F +:100C00003131313000313130313131313000313139 +:100C10003031313131300031313131313131310028 +:100C200031313030303030300031313131303031ED +:100C30003100313131313030313100313131313009 +:100C400030313100313131313030313100313131F9 +:100C500031303031310031313030303030300031EE +:100C600031313131313131003131303030303030AB +:100C700000313131313131313000313131313131C7 +:100C800031300031313131313131300031313031B9 +:100C900031313130003131303131313130003131A9 +:100CA000313030303031003131313131313131009A +:100CB0003131303131313130003131303131313059 +:100CC000310031313031313031310031313030307B +:100CD0003131310031313031313031310031313069 +:100CE0003131313031003131303131313130003159 +:100CF0003131313131313100313130313131313116 +:100D00000031313031313131310031313031313137 +:100D10003131003131303131313131003131303127 +:100D20003131313100313130313131313100313116 +:100D3000303030303030003131313131313131000B +:100D400031313031313131300031313030313130C9 +:100D500030003131303130303130003131303131EB +:100D600031313000313130313131313000313130D9 +:100D700031313131300031313031313131300031C8 +:100D80003131313131313100313130313131313086 +:100D900000313130303131313000313130303031AB +:100DA000313000313130313030313000313130319B +:100DB000313030300031313031313130300031318B +:100DC0003031313131300031313131313131310077 +:100DD000313130303030303100313031313131313A +:100DE0003000313031313131313000313031313159 +:100DF0003131300031303131313131300031303149 +:100E0000313131313000313130303030303100313A +:100E100031313131313131003131303030303031F8 +:100E20000031313031313131300031313031313117 +:100E3000313000313130303030303100313130310B +:100E400031313131003131303131313131003131F5 +:100E500030313131313100313131313131313100E5 +:100E600031313130303030310031313031313131A8 +:100E700030003131303131313130003131303131C8 +:100E800031313000313130313130313000313130B9 +:100E900031313130300031313130303030300031AB +:100EA0003131313131313100313130303030303168 +:100EB0000031313031313131300031313031313187 +:100EC000313000313130303030303100313130317B +:100ED0003130313100313130313131303100313167 +:100EE0003031313131300031313131313131310056 +:100EF0003131313030303031003131303131313118 +:100F00003000313130313131313100313131303037 +:100F10003030310031313131313131300031313027 +:100F20003131313130003131313030303031003118 +:100F300031313131313131003131303030303030D8 +:100F400000313131313030313100313131313030F7 +:100F500031310031313131303031310031313131E5 +:100F600030303131003131313130303131003131D7 +:100F700031313030313100313131313131313100C5 +:100F80003131303131313130003131303131313185 +:100F900030003131303131313130003131303131A7 +:100FA0003131300031313031313131300031313097 +:100FB0003131313130003131313030303031003188 +:100FC0003131313131313100313031313131313044 +:100FD0000031303131313131300031313031313166 +:100FE0003031003131303131313031003131313057 +:100FF0003130313100313131303130313100313146 +:101000003131303131310031313131313131310033 +:1010100031303131313131300031303131313131F4 +:101020003000313031313131313000313031313017 +:101030003131300031303130313031300031303009 +:1010400031313130300031303131313131300031F6 +:1010500031313131313131003130313131313130B3 +:1010600000313130313131303100313131303130D6 +:1010700031310031313131303131310031313130C4 +:1010800031303131003131303131313031003130B6 +:1010900031313131313000313131313131313100A3 +:1010A0003130313131313130003131303131313065 +:1010B0003100313131303130313100313131313085 +:1010C0003131310031313131303131310031313173 +:1010D0003130313131003131313130313131003164 +:1010E0003131313131313100313030303030303028 +:1010F0000031313131313130310031313131313044 +:101100003131003131313130313131003131313033 +:101110003131313100313130313131313100313023 +:101120003030303030300031313131313131310017 +:101130009800A100AA00B300BC00C500CE00D700F3 +:10114000E000E900F200FB0004010D0116011F019F +:10115000280131013A0143014C0155015E0167014B +:101160007001790182018B0194019D01A601AF01FB +:10117000B801C101CA01D301DC01E501EE01F701AB +:101180000002090212021B0224022D0236023F0253 +:10119000480251025A0263026C0275027E02870203 +:1011A00090029902A202AB02B402BD02C602CF02B3 +:1011B000D802E102EA02F302FC0205030E03170360 +:1011C0002003290332033B0344034D0356035F030B +:1011D000680371037A0383038C0395039E03A703BB +:1011E000B003B903C203CB03D403DD03E603EF036B +:1011F000F80301040A0413041C0425042E04370414 +:101200004004490452045B0464046D0476047F04C2 +:10121000880491049A04A304AC04B504BE04C70472 +:10122000D004D904E204EB04F404FD0406050F0520 +:10123000180521052A0533053C0545054E055705CA +:101240006005690572057B0584058D0596059F057A +:10125000A805B105BA05C305CC05D505DE05E7052A +:10126000F005F90502060B0614061D0626062F06D4 +:10127000380641064A0653065C0665066E06770682 +:101280008006890692069B06A406AD06B606BF0632 +:10129000C806D106DA06E306EC06F506FE060707E1 +:1012A0001007190722072B0734073D0746074F078A +:1012B000580761076A0773077C0785078E0797073A +:1012C000A007A907B207BB07C407CD07D607DF07EA +:1012D000E807F107FA0703080C0815081E08270895 +:1012E0003008390842084B0854085D0866086F0842 +:1012F000780881088A0893089C08A508AE08B708F2 +:10130000C008C908D208DB08E408ED08F608FF08A1 +:10131000080911091A0923092C0935093E09470949 +:101320005009590962096B0974097D0986098F09F9 +:101330009809A109AA09B309BC09C509CE09D709A9 +:10134000E009E909F209FB09040A0D0A160A1F0A55 +:10135000280A310A3A0A430A4C0A550A5E0A670A01 +:10136000700A790A820A8B0A940A9D0AA60AAF0AB1 +:10137000B80AC10ACA0AD30ADC0AE50AEE0AF70A61 +:10138000000B090B120B1B0B240B2D0B360B3F0B09 +:10139000480B510B5A0B630B6C0B750B7E0B870BB9 +:1013A000900B990BA20BAB0BB40BBD0BC60BCF0B69 +:1013B000D80BE10BEA0BF30BFC0B050C0E0C170C16 +:1013C000200C290C320C3B0C440C4D0C560C5F0CC1 +:1013D000680C710C7A0C830C8C0C950C9E0CA70C71 +:1013E000B00CB90CC20CCB0CD40CDD0CE60CEF0C21 +:1013F000F80C010D0A0D130D1C0D250D2E0D370DCA +:10140000400D490D520D5B0D640D6D0D760D7F0D78 +:10141000880D910D9A0DA30DAC0DB50DBE0DC70D28 +:10142000D00DD90DE20DEB0DF40DFD0D060E0F0ED6 +:10143000180E210E2A0E330E3C0E450E4E0E570E80 +:10144000600E690E720E7B0E840E8D0E960E9F0E30 +:10145000A80EB10EBA0EC30ECC0ED50EDE0EE70EE0 +:10146000F00EF90E020F0B0F140F1D0F260F2F0F8A +:10147000380F410F4A0F530F5C0F650F6E0F770F38 +:10148000800F890F920F9B0FA40FAD0FB60FBF0FE8 +:10149000C80FD10FDA0FE30FEC0FF50FFE0F071097 +:1014A0001010191022102B1034103D1046104F1040 +:1014B000581061106A1073107C1085108E109710F0 +:1014C000A010A910B210BB10C410CD10D610DF10A0 +:1014D000E810F110FA1003110C1115111E1127114B +:1014E00011241FBECFEFD0E1DEBFCDBF11E0A0E0E1 +:1014F000B1E0E2EBFDE102C005900D92A237B10729 +:10150000D9F713E0A2E7B1E001C01D92AA3AB107F2 +:10151000E1F7FDD24CC40C940000382F803250F01B +:10152000683010F480E001C082E0432F42954F7094 +:101530004D5F09C0683010F480E001C082E0432FA5 +:1015400042954F704F5F480F262F237088E090E040 +:1015500002C0959587952A95E2F7982F6770669552 +:1015600066953F70330F630F262F30E050E04150F7 +:101570005040F90163E0EE0FFF1F6A95E1F7E40FB9 +:10158000F51FEE58FE4F80818923F901B09688231C +:1015900091F023E0EE0FFF1F2A95E1F7E40FF51F0E +:1015A000EE58FE4F8081982319F421E030E014C0FA +:1015B00023E030E011C083E0EE0FFF1F8A95E1F7D2 +:1015C000E40FF51FEE58FE4F8081982319F420E0B8 +:1015D00030E002C022E030E0C901089520E030E0B0 +:1015E0000AC01192019688309105D9F72F5F3F4FBD +:1015F0002830310559F0F901A3E0EE0FFF1FAA953D +:10160000E1F7E659FC4F80E090E0EBCF0895FC0154 +:1016100020E43FE10CC08091C800319685FD02C0F6 +:1016200081E008959093CE00C9010197F1F7908170 +:10163000992389F780E008950F931F93DF93CF9349 +:10164000CDB7DEB761970FB6F894DEBF0FBECDBF42 +:10165000AC01162F072FFE0131969E012E5E3F4FE3 +:101660008091C80087FFFCCF8091CE008823C1F312 +:101670008193E217F307A1F720E030E0BE016F5F2E +:101680007F4FFA01E20FF31FDB01A20FB31F8C9112 +:1016900080832F5F3F4F2830310599F7FA0110867C +:1016A000FE013996812F902F9C01D9019E012F5E5A +:1016B0003F4F81918D93E217F307D9F7CA01A7DF56 +:1016C000812F902FA4DF80E091E0A1DF80E0619680 +:1016D0000FB6F894DEBF0FBECDBFCF91DF911F9143 +:1016E0000F91089511B88FEC84B98FEF87B988E016 +:1016F0008AB987E08DB910BA08951F93182FCB01CE +:1017000062E071E044D3009759F425B181E090E0A4 +:1017100002C0880F991F1A95E2F7282B25B90BC034 +:1017200025B181E090E002C0880F991F1A95E2F779 +:101730008095822385B91F91089581E062E071E070 +:10174000DCDF81E067E071E0D8CF0F931F93082FB3 +:10175000162F18C082E090E067E071E0CEDF812FA5 +:10176000802329F080E090E062E071E004C080E036 +:1017700090E067E071E0C1DF82E090E062E071E05C +:10178000BCDF1695112331F71F910F9108951F9318 +:10179000CF93DF93EC0197FF0BC083E090E067E00D +:1017A00071E0ABDF10E0C9DF1F5F1830E1F72BC03D +:1017B000009759F483E090E062E071E09EDF10E072 +:1017C000BCDF1F5F1830E1F71EC083E090E062E0ED +:1017D00071E093DF10E0B1DF1F5F1830E1F783E0C5 +:1017E00090E067E071E089DFA8DF83E090E062E0ED +:1017F00071E083DF11E002C0A0DF1F5F812F90E066 +:101800008C179D07CCF3DF91CF911F9108951F9303 +:10181000162F90E0BCDF84E064E097DF812F60E862 +:1018200094DF80E061E091DF80E090E0B0DF1F9125 +:1018300008951F93CF93DF93C1E0D0E0CE01A7DFDF +:1018400085E090E064E070E080DF80E090E060E4BC +:1018500070E07BDF10E080E090E060E870E075DF32 +:101860001F5F1032C1F780E090E091DFFE01EE587B +:10187000FE4F80E010828F5F38968034D9F7219632 +:10188000C930D105D9F6DF91CF911F9108950F93FB +:101890001F93162F042F90E07ADF85E090E064E03C +:1018A00070E053DF812F90E060E470E04EDF802F26 +:1018B00090E068E070E049DF80E090E068DF1F9131 +:1018C0000F910895DF92EF92FF920F931F93382F9D +:1018D000803408F0D8C0603108F0D5C0443008F03A +:1018E000D2C0803260F0683010F480E001C082E045 +:1018F000D32ED294FFE0DF2293E0D90E0AC06830E5 +:1019000010F480E001C082E0D32ED294EFE0DE221A +:10191000D394D80E77E0E72EE622E694E694832F60 +:101920008F70880FE80E262F237088E090E002C0A9 +:10193000959587952A95E2F7F82E4130A1F141302F +:1019400038F0423009F45BC0433009F09CC070C0ED +:10195000832FE3DD892B09F496C0EE2DF0E00D2DE9 +:1019600010E001501040F09453E0EE0FFF1F5A9525 +:10197000E1F7E00FF11FEE58FE4F40814F21408309 +:101980008D2D6E2D84DF6E2D605EE62FF0E043E03E +:10199000EE0FFF1F4A95E1F7E00FF11FEE58FE4FE3 +:1019A00040814F216DC0832FB8DD019709F46BC0D2 +:1019B000EE2DF0E00D2D10E00150104033E0EE0F61 +:1019C000FF1F3A95E1F7E00FF11FEE58FE4F4081FF +:1019D0004F2940838D2D6E2D5ADF6E2D605EE62FD0 +:1019E000F0E023E0EE0FFF1F2A95E1F7E00FF11F73 +:1019F000EE58FE4F4F2D40958081482341C0832FE4 +:101A00008CDD029709F43FC0EE2DF0E00D2D10E0C3 +:101A10000150104093E0EE0FFF1F9A95E1F7E00FA1 +:101A2000F11FEE58FE4F4F2D40958081482315C081 +:101A3000832F73DD039739F1EE2DF0E00D2D10E0CB +:101A40000150104083E0EE0FFF1F8A95E1F7E00F91 +:101A5000F11FEE58FE4F40814F2940838D2D6E2D92 +:101A600016DF6E2D605EE62FF0E0B3E0EE0FFF1F95 +:101A7000BA95E1F7E00FF11FEE58FE4F40814F2974 +:101A800040838D2D04DF1F910F91FF90EF90DF9029 +:101A90000895BF92CF92DF92EF92FF920F931F9320 +:101AA000CF93DF93B82EB6E3EB2EB1E0FB2EA0E38D +:101AB000CA2EA1E1DA2E1CC0F70180818B1589F4B2 +:101AC000CAE6D3E08601F80165917491CE0148E041 +:101AD00050E054D10E5F1F4F2896F3E0CA3ADF075B +:101AE00091F70894E11CF11C80E190E0C80ED91E2A +:101AF00091E7E91691E0F906F9F6DF91CF911F9190 +:101B00000F91FF90EF90DF90CF90BF9008957F925C +:101B10008F929F92AF92BF92CF92DF92EF92FF92FD +:101B20000F931F93DF93CF93CDB7DEB7C655D04049 +:101B30000FB6F894DEBF0FBECDBFDE011196EBE10C +:101B4000F1E089E001900D928150E1F7DE011A96F3 +:101B5000E4E2F1E089E001900D928150E1F7C2DD0D +:101B600018B885B1806C85B985B18F7385B980E867 +:101B700085B9479A83E090E062E071E0BEDD01E064 +:101B8000802F60E044DE802F60E241DE802F68E13C +:101B90003EDE802F61E03BDE802F63E038DE0F5FAA +:101BA000093071F746DE469A1092CD008CE08093A2 +:101BB000CC0082E08093C80088E18093C90086E071 +:101BC0008093CA00459A8E010B5D1F4FC8016BE0E0 +:101BD00071E0E6D0449AC8011ADD80ED97E028EC68 +:101BE00030E0F9013197F1F70197D9F718B8CE0134 +:101BF00001966BE171E0D4D0CE010A9664E271E007 +:101C0000CFD05E010894A11CB11C9924E7DCCC2440 +:101C1000DD24792C7A9423C0F50180813ADFF70125 +:101C2000808180FD05C0872D800F682D42E004C0B3 +:101C3000872D800F682D40E045DE88B1809588B9FA +:101C40000F5F1F4F0894E11CF11C0830110521F7AC +:101C50000894C11CD11CF8E0CF16D10471F08C2C73 +:101C6000760143E0EE0CFF1C4A95E1F78AE693E02B +:101C7000E80EF91E00E010E0CFCF98E0990E08942E +:101C8000A11CB11CE0E49E1609F0C0CF3AE0A32EDF +:101C9000B12CAC0EBD1E8824A1DCCC24DD2428E0B0 +:101CA000922E782C7A9423C0F5018081F2DEF70120 +:101CB000808180FD05C0872D800F692D42E004C022 +:101CC000872D800F692D40E0FDDD88B1809588B9B2 +:101CD0000F5F1F4F0894E11CF11C0830110521F71C +:101CE0000894C11CD11C9394F0E19F1669F0760111 +:101CF00093E0EE0CFF1C9A95E1F78AE693E0E80E7C +:101D0000F91E00E010E0D0CF98E0890E0894A11CE5 +:101D1000B11CE0E48E1609F0BFCF18B883E1882E1D +:101D2000912C8C0E9D1E7E010894E11CF11C0CE18F +:101D3000A02EB12CAC0EBD1E1AE0C12ED12CCC0EA3 +:101D4000DD1EC401B7012CD0C501B60129D0C701E1 +:101D5000B60172DCC7016DE271E019D0009709F499 +:101D6000FECEC701B40113D08C01C601B5010FD05E +:101D7000012B09F046CF009721F343CFFB01DC0193 +:101D800002C005900D9241505040D8F70895FB01D4 +:101D9000DC018D91019080190110D9F3990B089500 +:101DA000FB01DC0101900D920020E1F70895F89409 +:021DB000FFCF63 +:101DB2000A0048494748004C4F5700496E69746908 +:101DC200616C697A65642E2E2E0A0059415920549D +:101DD20048495300574F524B53212121005245533A +:101DE20045545245530020217123242526272829B2 +:101DF2002A2B2C2D2E2F30313233343536373839C9 +:101E02003A3B3C3D3E3F40414243444546474849B8 +:101E12004A4B4C4D4E4F50515253545556575859A8 +:021E22005A0064 +:00000001FF diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/Program Icon.png b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/Program Icon.png new file mode 100644 index 0000000..ca42e18 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/Program Icon.png differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/Icons/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro new file mode 100644 index 0000000..a4ab749 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro @@ -0,0 +1,31 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2012-06-09T17:31:59 +# +#------------------------------------------------- + +QT += core gui + +TARGET = LedDisplay +TEMPLATE = app + +DEPENDPATH += . qextserial +INCLUDEPATH += . qextserial + +include(qextserial/src/qextserialport.pri) + +SOURCES += main.cpp\ + leddisplay.cpp \ + varclass.cpp + +HEADERS += leddisplay.h \ + varclass.h + +FORMS += leddisplay.ui + +LIBS += -lboost_system \ + -lws2_32 \ + -D _WIN32_WINNT=0x0501 + +RESOURCES += \ + LedResources.qrc diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user new file mode 100644 index 0000000..5ee9029 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user @@ -0,0 +1,248 @@ + + + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + true + 1 + true + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop2 + Desktop2 + {fdba3f73-b7ad-4a15-b6c6-c49cceae8ff9} + 1 + 0 + 0 + + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.1 for Desktop - MinGW (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.1 for Desktop - MinGW (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 2 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + No deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + LedDisplay + + Qt4ProjectManager.Qt4RunConfiguration:/mnt/500GBINT/Google Drive/Projects/Final LED Project/LedDisplayFinished/Code/PC/LedDisplay/LedDisplay.pro + + LedDisplay.pro + false + false + + 3768 + true + false + false + false + false + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.EnvironmentId + {6b79483e-0c1b-4ded-b774-5ac48e9bb025} + + + ProjectExplorer.Project.Updater.FileVersion + 15 + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user.fdc7432.2.5pre1 b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user.fdc7432.2.5pre1 new file mode 100644 index 0000000..abb4bb8 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedDisplay.pro.user.fdc7432.2.5pre1 @@ -0,0 +1,365 @@ + + + + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + System + false + 4 + true + 1 + true + 0 + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop + Desktop + Qt4ProjectManager.Target.DesktopTarget + 1 + 0 + 0 + + ProjectExplorer.ToolChain.Mingw:C:/QtSDK/mingw/bin/mingw32-g++.exe.x86-windows-msys-pe-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.1 for Desktop - MinGW (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Debug + 2 + true + + + ProjectExplorer.ToolChain.Mingw:C:/QtSDK/mingw/bin/mingw32-g++.exe.x86-windows-msys-pe-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.1 for Desktop - MinGW (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_1_for_Desktop_-_MinGW__Qt_SDK__Release + 2 + true + + + ProjectExplorer.ToolChain.Mingw:C:/QtSDK/mingw/bin/mingw32-g++.exe.x86-windows-msys-pe-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.0 for Desktop - MinGW (Qt SDK) Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Debug + 1 + true + + + ProjectExplorer.ToolChain.Mingw:C:/QtSDK/mingw/bin/mingw32-g++.exe.x86-windows-msys-pe-32bit.C:/QtSDK/pythongdb/python_2.7based/gdb-i686-pc-mingw32.exe + + + qmake + + QtProjectManager.QMakeBuildStep + false + true + + false + + + Make + + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + + ProjectExplorer.BuildSteps.Build + + + + Make + + Qt4ProjectManager.MakeStep + true + clean + + + 1 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Qt 4.8.0 for Desktop - MinGW (Qt SDK) Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + C:/Drives/WrocinStorage3/Google Drive/Projects/Final LED Project/UI App/LedDisplay-build-desktop-Qt_4_8_0_for_Desktop_-_MinGW__Qt_SDK__Release + 1 + true + + 4 + + + 0 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + No deployment + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + true + true + + + false + false + false + false + false + false + false + false + true + true + 0.01 + 0.01 + 10 + 10 + true + true + 25 + 25 + + + true + true + valgrind + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + LedDisplay + + Qt4ProjectManager.Qt4RunConfiguration + 2 + + LedDisplay.pro + false + false + + + 3768 + true + false + false + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.EnvironmentId + {fdc74324-017b-438d-a314-97811330dbac} + + + ProjectExplorer.Project.Updater.FileVersion + 10 + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedResources.qrc b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedResources.qrc new file mode 100644 index 0000000..76c1ee5 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/LedResources.qrc @@ -0,0 +1,5 @@ + + + Icons/Program Icon.png + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.cpp new file mode 100644 index 0000000..225f058 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.cpp @@ -0,0 +1,256 @@ +#include "leddisplay.h" +#include "ui_leddisplay.h" +#include +#include + +leddisplay::leddisplay(QWidget *parent) : + QMainWindow(parent), + ui(new Ui::leddisplay) +{ + ui->setupUi(this); + foo = new varclass; + above = new QextSerialPort(); + below = new QextSerialPort(); + foo->setTopCOM("COM1"); + foo->setBottomCOM("COM1"); + foo->setCustomSend(" ", 1); + foo->setCustomSend(" ", 2); + + connect(above, SIGNAL(readyRead()), this, SLOT(aboveReadReady())); + connect(below, SIGNAL(readyRead()), this, SLOT(belowReadReady())); +} + +leddisplay::~leddisplay() +{ + delete ui; +} + +void leddisplay::on_pushButton_Connect_Wund_clicked() +{ + if(!foo->getSerialStatus(1)){ + above->setPortName(foo->getTopCOM()); + above->setBaudRate(BAUD9600); + above->setFlowControl(FLOW_OFF); + above->setParity(PAR_NONE); + above->setDataBits(DATA_8); + above->setStopBits(STOP_1); + + if(above->open(QIODevice::ReadWrite)){ + foo->toggleSerialStatus(1); + ui->label_Top_COM_Status->setText("Connected"); + ui->label_Manual_Send_Top_Title->setText("Port: "+foo->getTopCOM()); + }else{ + QMessageBox::information(this,"Serial Debug", "Port \""+foo->getTopCOM()+"\" could not be opened."); + } + }else{ + QMessageBox::information(this,"Serial Debug", "The top serial port is already open."); + } + + if(!foo->getSerialStatus(2)){ + below->setPortName(foo->getBottomCOM()); + below->setBaudRate(BAUD9600); + below->setFlowControl(FLOW_OFF); + below->setParity(PAR_NONE); + below->setDataBits(DATA_8); + below->setStopBits(STOP_1); + + if(below->open(QIODevice::ReadWrite)){ + foo->toggleSerialStatus(2); + ui->label_Bottom_COM_Status->setText("Connected"); + ui->label_Manual_Send_Bottom_Title->setText("Port: "+foo->getBottomCOM()); + }else{ + QMessageBox::information(this,"Serial Debug", "Port \""+foo->getBottomCOM()+"\" could not be opened."); + } + }else{ + QMessageBox::information(this,"Serial Debug", "The bottom serial port is already open."); + } +} + +void leddisplay::on_pushButton_Disconnect_Wund_clicked() +{ + above->close(); + below->close(); + foo->toggleSerialStatus(1); + ui->label_Top_COM_Status->setText("Disconnected"); + ui->label_Manual_Send_Top_Title->setText("Uninitialized"); + ui->textEdit_Manual_Send_Top->clear(); + foo->toggleSerialStatus(2); + ui->label_Bottom_COM_Status->setText("Disconnected"); + ui->label_Manual_Send_Bottom_Title->setText("Uninitialized"); + ui->textEdit_Manual_Send_Bottom->clear(); +} + +void leddisplay::on_pushButton_Reset_Wund_clicked() +{ + above->write("RESETRESETRESETR!"); + below->write("RESETRESETRESETR!"); +} + +void leddisplay::on_pushButton_Send1_clicked() +{ + ui->label_String_Sent_Top->setText("HELLO WORLD!!!!!"); + ui->label_String_Sent_Bottom->setText("HOLA EL MUNDO!!!"); + above->write("HELLO WORLD!!!!!!"); + below->write("HOLA EL MUNDO!!!!"); +} + +void leddisplay::on_pushButton_Send2_clicked() +{ + ui->label_String_Sent_Top->setText("ISN'T ECE 152 SO"); + ui->label_String_Sent_Bottom->setText("MUCH FUN?!?!?!?!"); + above->write("ISN'T ECE 152 SO "); + below->write("MUCH FUN?!?!?!?!?"); +} + +void leddisplay::on_pushButton_Send3_clicked() +{ + ui->label_String_Sent_Top->setText("DON HEER IS THE "); + ui->label_String_Sent_Bottom->setText("BEST ECETEACHER!"); + above->write("DON HEER IS THE !"); + below->write("BEST ECETEACHER!!"); +} + +void leddisplay::on_pushButton_Send4_clicked() +{ + ui->label_String_Sent_Top->setText("IT'S A-ME, MARIO!"); + ui->label_String_Sent_Bottom->setText("LUIGI TOO, WAHOO!"); + above->write("IT'S A-ME, MARIO!"); + below->write("LUIGI TOO, WAHOO!"); +} + +void leddisplay::on_pushButton_Send5_clicked() +{ + ui->label_String_Sent_Top->setText(" OREGON STATE "); + ui->label_String_Sent_Bottom->setText(" UNI IS #1 "); + above->write(" OREGON STATE !"); + below->write(" UNI IS #1 !"); +} + +void leddisplay::on_pushButton_Send6_clicked() +{ + ui->label_String_Sent_Top->setText(" OUR FIRST "); + ui->label_String_Sent_Bottom->setText(" YEAR IS OVER!"); + above->write(" OUR FIRST !"); + below->write(" YEAR IS OVER!!"); +} + +void leddisplay::on_pushButton_Send7_clicked() +{ + ui->label_String_Sent_Top->setText("MADE BY: CORWIN "); + ui->label_String_Sent_Bottom->setText(" AND WILL "); + above->write("MADE BY: CORWIN !"); + below->write(" AND WILL !"); +} + +void leddisplay::on_pushButton_Send8_clicked() +{ + QTime mytime = QTime::currentTime(); + QString send = (mytime.toString("hh:mm:ss ap")+" !"); + + ui->label_String_Sent_Top->setText("CURRENT TIME IS:"); + ui->label_String_Sent_Bottom->setText(send.left(16).toUpper()); + above->write("CURRENT TIME IS:!"); + below->write(send.toUpper().toAscii()); +} + +void leddisplay::on_lineEdit_Custom_Send_Top_textChanged(const QString &arg1) +{ + foo->setCustomSend(arg1+" ", 1); +} + +void leddisplay::on_pushButton_Custom_Send_Top_clicked() +{ + ui->label_String_Sent_Top->setText(foo->getCustomSend(1).left(16).toUpper()); + above->write((foo->getCustomSend(1).left(16)+"!").toUpper().toAscii()); +} + +void leddisplay::on_lineEdit_Custom_Send_Bottom_textChanged(const QString &arg1) +{ + foo->setCustomSend(arg1+" ", 2); +} + +void leddisplay::on_pushButton_Custom_Send_Bottom_clicked() +{ + ui->label_String_Sent_Bottom->setText(foo->getCustomSend(2).left(16).toUpper()); + below->write((foo->getCustomSend(2).left(16)+"!").toUpper().toAscii()); +} + +void leddisplay::on_pushButton_Send_Custom_All_clicked() +{ + ui->label_String_Sent_Top->setText(foo->getCustomSend(1).left(16).toUpper()); + ui->label_String_Sent_Bottom->setText(foo->getCustomSend(2).left(16).toUpper()); + above->write((foo->getCustomSend(1).left(16)+"!").toUpper().toAscii()); + below->write((foo->getCustomSend(2).left(16)+"!").toUpper().toAscii()); +} +void leddisplay::on_comboBox_Top_COM_currentIndexChanged(const QString &arg1) +{ + foo->setTopCOM(arg1); +} + +void leddisplay::on_comboBox_Bottom_COM_currentIndexChanged(const QString &arg1) +{ + foo->setBottomCOM(arg1); +} + +void leddisplay::aboveReadReady(){ + ui->textEdit_Manual_Send_Top->insertPlainText(above->readAll()); +} + +void leddisplay::belowReadReady(){ + ui->textEdit_Manual_Send_Bottom->insertPlainText(below->readAll()); +} + +void leddisplay::on_lineEdit_Manual_Send_Top_textChanged(const QString &arg1) +{ + foo->setManualSend(arg1, 1); +} + +void leddisplay::on_lineEdit_Manual_Send_Bottom_textChanged(const QString &arg1) +{ + foo->setManualSend(arg1, 2); +} + +void leddisplay::on_pushButton_Manual_Send_Top_clicked() +{ + above->write(foo->getManualSend(1).toAscii()); + ui->textEdit_Manual_Send_Top->insertPlainText(foo->getManualSend(1)+"\n"); +} + +void leddisplay::on_pushButton_Manual_Send_Bottom_clicked() +{ + below->write(foo->getManualSend(2).toAscii()); + ui->textEdit_Manual_Send_Bottom->insertPlainText(foo->getManualSend(2)+"\n"); +} + +void leddisplay::on_pushButton_Manual_Send_Clear_Screen_Top_clicked() +{ + ui->textEdit_Manual_Send_Top->clear(); +} + +void leddisplay::on_pushButton_Manual_Send_Clear_Screen_Bottom_clicked() +{ + ui->textEdit_Manual_Send_Bottom->clear(); +} + +void leddisplay::on_pushButton_Reset_Top_clicked() +{ + above->write("RESETRESETRESETR!"); + ui->textEdit_Manual_Send_Top->clear(); +} + +void leddisplay::on_pushButton_Reset_Bottom_clicked() +{ + below->write("RESETRESETRESETR!"); + ui->textEdit_Manual_Send_Bottom->clear(); +} + +void leddisplay::on_comboBox_Top_COM_editTextChanged(const QString &arg1) +{ + foo->setTopCOM(arg1); + +} + +void leddisplay::on_comboBox_Bottom_COM_editTextChanged(const QString &arg1) +{ + foo->setBottomCOM(arg1); +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.h new file mode 100644 index 0000000..f7d5d28 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.h @@ -0,0 +1,89 @@ +#ifndef LEDDISPLAY_H +#define LEDDISPLAY_H + +#include +#include +#include "qextserialport.h" + +namespace Ui { +class leddisplay; +} + +class leddisplay : public QMainWindow +{ + Q_OBJECT + +public: + explicit leddisplay(QWidget *parent = 0); + ~leddisplay(); + +private slots: + + void on_pushButton_Connect_Wund_clicked(); + + void on_pushButton_Disconnect_Wund_clicked(); + + void on_pushButton_Reset_Wund_clicked(); + + void on_pushButton_Send1_clicked(); + + void on_pushButton_Send2_clicked(); + + void on_pushButton_Send3_clicked(); + + void on_pushButton_Send4_clicked(); + + void on_pushButton_Send5_clicked(); + + void on_pushButton_Send6_clicked(); + + void on_pushButton_Send7_clicked(); + + void on_pushButton_Send8_clicked(); + + void on_lineEdit_Custom_Send_Top_textChanged(const QString &arg1); + + void on_pushButton_Custom_Send_Top_clicked(); + + void on_lineEdit_Custom_Send_Bottom_textChanged(const QString &arg1); + + void on_pushButton_Custom_Send_Bottom_clicked(); + + void on_pushButton_Send_Custom_All_clicked(); + + void on_comboBox_Top_COM_currentIndexChanged(const QString &arg1); + + void on_comboBox_Bottom_COM_currentIndexChanged(const QString &arg1); + + void aboveReadReady(); + + void belowReadReady(); + + void on_lineEdit_Manual_Send_Top_textChanged(const QString &arg1); + + void on_lineEdit_Manual_Send_Bottom_textChanged(const QString &arg1); + + void on_pushButton_Manual_Send_Top_clicked(); + + void on_pushButton_Manual_Send_Bottom_clicked(); + + void on_pushButton_Manual_Send_Clear_Screen_Top_clicked(); + + void on_pushButton_Manual_Send_Clear_Screen_Bottom_clicked(); + + void on_pushButton_Reset_Top_clicked(); + + void on_pushButton_Reset_Bottom_clicked(); + + void on_comboBox_Top_COM_editTextChanged(const QString &arg1); + + void on_comboBox_Bottom_COM_editTextChanged(const QString &arg1); + +private: + Ui::leddisplay *ui; + varclass *foo; + QextSerialPort *above; + QextSerialPort *below; +}; + +#endif // LEDDISPLAY_H diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.ui b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.ui new file mode 100644 index 0000000..2975851 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/leddisplay.ui @@ -0,0 +1,928 @@ + + + leddisplay + + + + 0 + 0 + 916 + 403 + + + + leddisplay + + + + :/Icons/Main Icon:/Icons/Main Icon + + + + + + + 0 + + + + Setup + + + + + + + + + + Top COM Port: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Bottom COM Port: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + + COM1 + + + + + COM2 + + + + + COM3 + + + + + COM4 + + + + + COM5 + + + + + COM6 + + + + + COM7 + + + + + COM8 + + + + + COM9 + + + + + COM10 + + + + + COM11 + + + + + COM12 + + + + + COM13 + + + + + COM14 + + + + + COM15 + + + + + COM16 + + + + + COM17 + + + + + COM18 + + + + + COM19 + + + + + COM20 + + + + + + + + true + + + + COM1 + + + + + COM2 + + + + + COM3 + + + + + COM4 + + + + + COM5 + + + + + COM6 + + + + + COM7 + + + + + COM8 + + + + + COM9 + + + + + COM10 + + + + + COM11 + + + + + COM12 + + + + + COM13 + + + + + COM14 + + + + + COM15 + + + + + COM16 + + + + + COM17 + + + + + COM18 + + + + + COM19 + + + + + COM20 + + + + + + + + + + Connect Wunderboards + + + + + + + Disconnect Wunderboards + + + + + + + Reset Wunderboards + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 0 + + + + + + + + Top Status: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 0 + + + + + + + + Bottom Status: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 0 + + + + + + + + Disconnected + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 0 + + + + + + + + Disconnected + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + Send Messages + + + + + + QLayout::SetDefaultConstraint + + + + + + + + 75 + true + + + + Pre-Made Messages + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 13 + + + + + + + + + + Hello World!!! + + + + + + + Isn't ECE 152 so much fun!? + + + + + + + Don Heer is the best! + + + + + + + It's a me, Mario! + + + + + + + OSU is #1 + + + + + + + First year is over! + + + + + + + Made by: Corwin and Will + + + + + + + Current Time + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 75 + true + + + + Send Custom Message + + + Qt::AlignCenter + + + + + + + + true + + + + **Will be Truncated to 16 Characters Each** + + + Qt::AlignCenter + + + + + + + + + + + + Send + + + + + + + + + + + + + + Send + + + + + + + + + Send All + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + + + + + + + + + String Sent to Bottom: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + String Sent to Top: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + Console + + + + + + + + + 75 + true + + + + Uninitialized + + + Qt::AlignCenter + + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + + Send + + + + + + + Clear Screen + + + + + + + Reset + + + + + + + + + + + + + + + + 75 + true + true + + + + Uninitialized + + + Qt::AlignCenter + + + + + + + Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + + + + + + + + Send + + + + + + + Clear Screen + + + + + + + Reset + + + + + + + + + + + + + + + + + + + + + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/main.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/main.cpp new file mode 100644 index 0000000..8568300 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/main.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include "qextserialport.h" +#include "varclass.h" +#include "leddisplay.h" + + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + leddisplay w; + w.show(); + + return a.exec(); +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival (gdocs).txt b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival (gdocs).txt new file mode 100644 index 0000000..0f1ebe2 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival (gdocs).txt @@ -0,0 +1,5 @@ +repo: 92f8433be97cc804b4017320248ddc04f184b6ee +node: 68be05e82d65bae389e32f01235c5828201e8f1c +branch: default +latesttag: 1.2-beta1 +latesttagdistance: 1 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival.txt b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival.txt new file mode 100644 index 0000000..0f1ebe2 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hg_archival.txt @@ -0,0 +1,5 @@ +repo: 92f8433be97cc804b4017320248ddc04f184b6ee +node: 68be05e82d65bae389e32f01235c5828201e8f1c +branch: default +latesttag: 1.2-beta1 +latesttagdistance: 1 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgignore b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgignore new file mode 100644 index 0000000..6d92fc0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgignore @@ -0,0 +1,41 @@ +syntax: glob +*.pro.user* +*.app +*.moc +Makefile* +doc/html/ +debug/ +release/ +qtc-gdbmacros/ +*.rej +*.orig +*.obj +*.swp +*.dll +*.exp +*.ilk +*.pdb +*.lib +moc_*.cpp +qrc_*.cpp +*.o +*.so.* +*.so +*.pdb +ui_*.h +*~ +.qmake.cache +lib/* +*.orig +*.exe +*.vcproj +*.vcproj.*.user +*.sln +*.idb +*.ncb +*.suo +examples/enumerator/enumerator +examples/event/event +examples/qespta/qespta +examples/uartassistant/uartassistant +object_script.* diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags new file mode 100644 index 0000000..7367552 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags @@ -0,0 +1,4 @@ +96e3a424c22cda7bd430736ffe8ec94c02e9d462 REL_0_9 +ecdbd5f836603c25941f6ea7659b271767088cb8 REL_1_1 +f5c8064caf35b35778bd191a2d8aed9e7b1260f4 REL_0_8 +4a0173d282232b56c55962e17aa254917c52c4c0 1.2-beta1 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags (gdocs) b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags (gdocs) new file mode 100644 index 0000000..7367552 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/.hgtags (gdocs) @@ -0,0 +1,4 @@ +96e3a424c22cda7bd430736ffe8ec94c02e9d462 REL_0_9 +ecdbd5f836603c25941f6ea7659b271767088cb8 REL_1_1 +f5c8064caf35b35778bd191a2d8aed9e7b1260f4 REL_0_8 +4a0173d282232b56c55962e17aa254917c52c4c0 1.2-beta1 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/ChangeLog b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/ChangeLog new file mode 100644 index 0000000..3720762 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/ChangeLog @@ -0,0 +1,251 @@ +Change history for QextSerialPort (formerly QwSerialPort): +(Lines beginning with + represent new functionality, * represent changed or +fixed functionality, - represent removed or deprecated functionality) + +Version 1.2 beta1 (2012 Debao Zhang) + * D-pointer and Q_PRIVATE_SLOT are used to moving private members from QextSerialPort to QextSerialPortPrivate + * qdoc3 instead of doxygen is used for generating documents + * MIT license header add to all sources files + + add a helper class QextWinEventNotifier for windows user, when user's SDK doesnot contain Qt's private files, this class will be auto selected. + + Support platform custom baudrate. Macros such as B230400 / B460800 can be used directly if you OS support it. + +Version 1.2win-alpha (2007 Michal Policht) + + Added QextSerialEnumerator pre-alpha. Works under W2k and later versions of Windows. + + Event driven mechanism (alternative to polling) is now available on Windows. + - Removed default (=0) parameter from open() functions. + * Fixed bug #1714917 in Win_QextSerialPort::close() method (by Kurt). + * Fixed problem with lack of proper blocking in readData() on win32 (by Brandon Fosdick). + * Removed QT_THREAD_SUPPORT option. Now QextSerialPort must be always compiled with threads support. + * Mutexes are not static. + * setTimeout() now accepts only one parameter. + * bytesAvailable() on POSIX now shows 0 bytes instead of -1 when no bytes are available. + * bytesAvailable() is const. + * native POSIX file descriptors instead of QFile->handle() calls + + POSIX: Save and restore original termios when opening and closing the device + * POSIX: Only disable special characters on systems that support it + * POSIX: Use cfmakeraw(3) to get a non-canonical termios + + POSIX: Call close(2) in close() to actually close the device + +Version 1.1 (official release) + +Version 1.0.1 + * Minor changes (mostly in test application) + +Version 1.0.0e (by Micha? Policht) + * Fixed bytesAvailable(). Includes buffered bytes to the result. + + Added isSequential() method. + + Provided test application + +Version 1.0.0d ( changes by Micha? Policht ) + - Removed isOpen() overriden declaration/implementation from qextserialport's classes. isOpen() relies on QIODevice now. + - Removed bool portOpen variable. Replaced by internal QIODevice.openMode. + - Removed getChar(), putChar() overriden declaration/implementation. QIODevice can handle this. + * Calling open() with specified OpenMode invokes QIODevice::open() which result in proper openMode setting. + * readData(), writeData() are protected as in QIODevice declaration. + * QIODevice:: read() and write() function are working now (use them instead of readData() writeData()). + * readData(), writeData() don't check if port is open any more (read() and write() assures that). The same behaviour can be found in QFile for example. + * Fixed readLine(). + + * Fixed randomly crash on deletion bug on Windows ( by Stuart Nixon ) + http://lists.trolltech.com/qt-interest/2007-02/thread00340-0.html#msg00351 + +Version 0.9 (March 3, 2005) Stefan Sander : + + Added a new precompiler constant, _TTY_FREEBSD_ + to support FreeBSD port names. + + Added _TTY_WIN_ constant in qextserialport.pro win32:DEFINES + to have Windows port names as default when compiling on it. + - Removed construct() call from QextSerialBase constructors, + it is called indirectly through Win_QextSerialPort::construct() + and Posix_QextSerialPort::construct(). + + Added construct() call to Win_QextSerialPort constructors. + + Added setTimeout(0, 500) call to Win_QextSerialPort::construct(). + - Removed setTimeout(0, 500) call from Win_QextSerialPort(const char* name). + * Fixed Posix_QextSerialPort::open(int) control flow, now the port settings + are only applied if the associated file could be opened. + * Fixed masking CR to NL, in Posix_CommConfig.c_iflag + +Version 0.8 (, 2003) (Alpha release): + * Added code to set the port timeouts in Win_QextSerialPort's default + constructor. + * Fixed Posix_QextSerialPort::construct() to set up the port correctly. + * Fixed syntax errors in 2 ioctl() calls in posix_QextSerialPort. + * lastError is now initialized to E_NO_ERROR in the QextSerialBase + constructor. + * The select() call in posix_QextSerialPort::bytesWaiting() is now + properly coded. Previously it would always time out. + * Fixed runtime errors in the ioctl() calls for + Posix_QextSerialPort::setDtr() and Posix_QextSerialPort::setRts(). + Thanks to Marc Pignat. + +Version 0.7 (June 15, 2002) : + (0.61 - unofficial release) + * Fixed a small bug in the initializations of the static members when + QT_THREAD_SUPPORT was defined. + * Fixed a bug that caused Borland's compiler to choke on Windows platforms + (which perversely actually stemmed from a shortcoming of Visual C++ that + Borland doesn't have). + + (0.62 - unofficial release) + * Fixed a bug that gave Q_LONG the wrong typedef for QT versions prior to + 3.0. + + (0.63 - unofficial release) + * Fixed 2 incorrect references to Posix_Comm_Config. + * Fixed scoping of Posix_QextSerialPort::operator=(). + * Posix_QextSerialPort::construct should now be coded correctly. + * Fixed return type for Posix_QextSerialPort::size(). + + (0.64 - unofficial release) + * Fixed all the port settings functions to work properly when opening the + port for the first time - previously none of the settings were being + applied when the port was opened. + * Fixed an oversight in Win_QextSerialPort::open() that caused the setting + of port parameters to fail on NT and 2000 systems. + + (0.7 - official release) + * Fixed some calls to QextSerialBase constructors that no longer exist on + the POSIX side. + * Fixed the bad memcpy()'s in the POSIX copy constructor. + * Fixed the Offset scoping problem under gcc 2.95. + * The CBAUD flag has been deprecated on some POSIX systems. Fixed + Posix_QextSerialPort::setBaudRate() to reflect this. + * Added construct() calls to all of the Posix_QextSerialPort constructors. + * Fixed double (and conflicting) typedefs of Offset when using QT versions + prior to 3.0 + * Changed the call to CreateFile() to CreateFileA() in + Win_QextSerialPort.cpp. This should get rid of problems for those using + Unicode or other multibyte character sets for their string literals. + * A few tweaks to the documentation. + + - Removed the protected Posix_Handle variable from Posix_QextSerialPort. + +Version 0.6 (March 11, 2002) : + + Added a new precompiler constant, QTVER_PRE_30. QT3 changed the return + types of some QIODevice functions. Therefore, if compiling on versions + of QT prior to 3.0, you should always define QTVER_PRE_30 in your project. + Also had to add some preprocessor blocks to support both 3.0 and earlier + versions of QT. + + Added implementations of 2 of the new constructors added in 0.5 to both + Win_QextSerialPort and Posix_QextSerialPort. + + * The scoping of the enums used in the PortSettings struct has been fixed. + * QObject inheritance has been removed. This should not affect the + functionality of the classes. + * Replaced a few stray references to mutex->unlock() with UNLOCK_MUTEX() in + the Windows code. + * Fixed several runtime errors caused by calling nonexistent members of + QextSerialBase. + * Fixed a whole bunch of little things that were causing MSVC to choke when + compiling for Windows. + +Version 0.5 (February 15, 2002): + + There are 4 new macros (LOCK_MUTEX, UNLOCK_MUTEX, TTY_WARNING, and + TTY_PORTABILITY_WARNING) that replace most of those ugly #ifdef blocks in + the code. + + In place of the old namingConvention stuff, there is a new function, + setName(). It is used to set the name of the device to be associated with + the object. The new name() function can be used to retrieve the device + name, which is stored in the new member variable portName. + + There is a new version of open() that takes a const char* as a parameter. + It can be used to specify the name of the device when it is opened rather + than at construction time. + + * 3 constructors have been removed and 3 more added. There is now a copy + constructor (and operator=()) as well as a constructor that takes a + PortSettings structure as a parameter, and another that takes both a + device name and a PortSettings structure. As a result of these changes + the PortSettings structure declaration is no longer local to the + QextSerialBase class. All of the removed constructors had to do with + the setNamingConvention() system. + * The static mutex member should now be reference-counted and only deleted + when it is no longer referenced. + * Most of the object construction duties have been pushed back into + QextSerialBase + * Fixed a couple resource leaks, mostly to do with unlocking the mutex + properly + + - Removed the setNamingConvention() nonsense. + - Removed all QStrings and calls to sprintf() for thread compatibility. + - Removed setNumber() functions as well as the portNumber member variable, + as they were only necessary under the setNamingConvention() system. + + I am grateful to Jorg Preiss (Preisz? Sorry, American keyboards don't have + an ess-tset character ;)) for his invaluable input on most of the changes + that went into this version. + +Version 0.4 (March 20, 2001): + + All of the classes now derive from QObject as well as QIODevice. This + is pretty much useless at the moment - signals and slots may be used + to implement asynchronous communications in a future version + + Added configurable timeouts via the setTimeout() function. The default + timeout for read and write operations is now 500 milliseconds + + There is now a functional .pro file for the library (thanks to + Gunnstein Lye) + + The prefixes for all of the classes have changed from Qw to Qext, in + compliance with the qt-addons project standard + + * Fixed a bug that caused port settings to be restored incorrectly when + switching ports with setNumber() + * Minor changes to QextSerialBase::setNumber(). Functionality should now + reflect the documentation, which has also been updated to reflect the + changes that went in on version 0.3. + * Some fixes to the documentation. The Posix_QextSerialPort and + Win_QextSerialPort classes should no longer have any unnecessary + references to inapplicable platforms, and the documentation for open() has + been updated. + * Should now compile without QT_THREAD_SUPPORT defined (ie, in single- + threaded environments), although it will require slight changes to the + makefile (tmake "CONFIG-=thread" should work) + * Fixed a few compilation issues, especially on the POSIX side (should + compile under Linux now :)) + * POSIX code is a little cleaner and more efficient + * Various small fixes to the documentation + * Constants now follow a consistent naming convention, with underscores at + the beginning and end of each. For example TTY_POSIX has become + _TTY_POSIX_ + +Version 0.3 (Feb. 14, 2001): + + Added a warning that appears when QwSerialPort is compiled on a POSIX + platform that does not implement 76800 baud operation. In this situation + QwSerialPort will also switch to 57600 baud. + + Major code reorganization - there are now 4 classes instead of 1. This + should remove a lot of the #ifdef...#else...#endif constructs and + hopefully make the code easier to read. Including the class in your + project is still done by including QwSerialPort.h and instantiating a + QwSerialPort object. + + * The serial port associated with a QwSerialPort object is no longer + opened on construction, or upon calling the setNumber() function. You + must now explicitly call open() to open the port. + +Version 0.2 (Jan. 3, 2001): + + Added lastError() function with rudimentary error codes + + Better documentation + + Added ability to examine the empty/not empty state of a port's input + buffer with atEnd() + + Added ability to retrieve the number of bytes in a port's input buffer + with size() (thanks to Olivier Tubach) + + Added ability to turn off portability warnings by defining + TTY_NOWARN_PORT in your project + + Added ability to turn off all warning messages by defining TTY_NOWARN + in your project + + Added ability to select POSIX serial functions in Windows NT/2000 by + defining TTY_POSIX in your project (untested) + + Added control over RTS and DTR lines with setRts() and setDtr() + respectively + + Added ability to query line status using lineStatus(). + + Added readLine() functionality (thanks to Olivier Tubach) + + Added bytesWaiting(), a non-const/thread-safe version of size() + + The class should now be thread-safe through the use of a recursive + QMutex (untested) + + * Fixed a bug that could cause hardware flow control not to work on some + POSIX systems + * Put in a few missing fileno() calls in the POSIX code + * Fixed a few syntax errors that caused compilation to fail on POSIX systems + + - BAUD0 is no longer a valid baud rate setting - to drop the DTR line, + call setDtr(FALSE) + +Version 0.1 (Dec. 11, 2000): + Initial public release. diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/LICENSE b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/LICENSE new file mode 100644 index 0000000..a59acc6 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/LICENSE @@ -0,0 +1,88 @@ +From QextSerialPort 1.2-beta on, we use MIT license for QextSerialPort project. + +== License == + + Copyright (c) 2000-2003 Wayne Roth + Copyright (c) 2004-2007 Stefan Sander + Copyright (c) 2007 Michal Policht + Copyright (c) 2008 Brandon Fosdick + Copyright (c) 2009-2010 Liam Staskawicz + Copyright (c) 2011 Debao Zhang + + Web: http://code.google.com/p/qextserialport/ + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +== Why license needed? == + + Many users complains that, without a proper licence they can not use this library. + + * http://groups.google.com/group/qextserialport/browse_thread/thread/0e8756920b01da82 + + Hi, + we are considering using a modified version of QExtSerialPort in one of our + projects (Qt Creator, http://qt.gitorious.org/qt-creator). + Would it be possible to add license header information or a license file to the + QExtSerialPort code base? - This would make re-use of the code base easier. + If that is not possible, could we redistribute the source code with BSD- + license headers manually added? + +And + + I am also considering packaging the software for Debian, but I + couldn't do it yet just because of the license. + + * http://code.google.com/p/qextserialport/issues/detail?id=8 + + Questions: + Can I use qextserialport in a commercial product? + If yes, how? + Compile it in? I guess no. + If I can use it as a library, how should the README be formulated? + Is the "MIT license" from 2008 appropriate? + +== Why can we use MIT? == + +Form the history of [http://lists.trolltech.com/qt-interest/2004-12/msg01022.html qt-interest mail list] + + * Wayne Roth, the original author of the project, had said that: + + the code is in the public domain. Do whatever you like with it. Right + now I have too many other things to do to put any serious time into + fixing it. Trolltech should be aware of this already; they asked + about a license when they offered to host the tarball. + + * Stefan Sander, the maintainer of qextserialport on sourceforge, said that + + Hello, + My project registration at !SourceForge have been approved. + http://www.sf.net/projects/qextserialport + I thought an initial licence of Public Domain would be best solution. + Someone wrote: - Because its public domain, some could fork it under different licenses - + +And from [http://groups.google.com/group/qextserialport/browse_thread/thread/fbcddbfb4a0b5a51?pli=1 this thread] on qesp mail list, we can see that, current maintainers and users agree with a MIT licence. + + * Brandon Fosdick, + + I would vote for BSD or MIT :) + + * Liam Staskawicz, + + That works for me - let's call it MIT and go for it :) diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/README b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/README new file mode 100644 index 0000000..f5012af --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/README @@ -0,0 +1,77 @@ + += About QextSerialPort = + +QextSerialPort provides an interface to old fashioned serial ports for Qt-based applications. It currently supports Mac OS X, Windows, Linux, FreeBSD. + +http://code.google.com/p/qextserialport/ + +== How to use (1) == + + * Download the source code. Note: [http://mercurial.selenic.com/downloads/ Mercurial] is needed . + + hg clone https://code.google.com/r/dbzhang800-qextserialport/ + + + * Put the source code in any directory you like. For example, 3rdparty: + + |-- project.pro + |-- .... + |-- 3rdparty\ + | |-- qextserialport\ + | | + + * Add following line to your qmake project file: + + include(3rdparty/qextserialport/src/qextserialport.pri) + + * Using QextSerialPort in your code. Enjoy it! + + #include "qextserialport.h" + .... + QextSerialPort * port = new QextSerialPort(); + .... + +== How to use (2) == + +It's very easy to compile QextSerialPort directly into your application(see above section), however, we would prefer to use it as a static or shared library. + + * Download the source code, and put it in any location you like. + + |-- yourpath\ + | |-- qextserialport\ + | | + + * Create a config.pri file, and put into qextserialport's directory. + + |-- yourpath\ + | |-- qextserialport\ + | | |-- config.pri + + * Contents of config_example.pri + + # uncomment the following line if you want to use qextserialport as library + # QEXTSERIALPORT_LIBRARY = yes + + # uncomment the following line too if you want to use it as static library + # QEXTSERIALPORT_STATIC = yes + + * Goto qextserialport/buildlib, and run following command to generate library. + + qmake + make (or nmake) + + * Add following line to your qmake project file. Enjoy it! + + include(pathToQextserialport/src/qextserialport.pri) + +== Build (optional) == + + * Run qmake from the toplevel directory.(If your has create a config.pri file properly, this will generate the library, and then all examples will use the library. Otherwise, qextserialport will be directly compiled into the examples) + + qmake (or qmake -r) + make (or nmake) + + * Run qdoc3 from the doc directory. + + qdoc3 qextserialport.qdocconf + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/buildlib.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/buildlib.pro new file mode 100644 index 0000000..b955ac1 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/buildlib.pro @@ -0,0 +1,17 @@ +TEMPLATE=lib +CONFIG += qt qextserialport-buildlib +# Include .pri file before using "qextserialport-static" +# and after CONFIG += "qextserialport-buildlib" +include(../src/qextserialport.pri) +qextserialport-static:CONFIG += static +else:CONFIG += dll +mac:CONFIG += absolute_library_soname +win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release build_all +TARGET = $$QEXTSERIALPORT_LIBNAME +DESTDIR = $$QEXTSERIALPORT_LIBDIR +win32:!qextserialport-static{ + DLLDESTDIR = $$[QT_INSTALL_BINS] + QMAKE_DISTCLEAN += $$[QT_INSTALL_BINS]\\$${QEXTSERIALPORT_LIBNAME}.dll +} +target.path = $$DESTDIR +INSTALLS += target diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/buildlib/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/common.pri b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/common.pri new file mode 100644 index 0000000..7e3bb43 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/common.pri @@ -0,0 +1,12 @@ +infile(config.pri, QEXTSERIALPORT_LIBRARY, yes): CONFIG += qextserialport-library +qextserialport-library{ +infile(config.pri, QEXTSERIALPORT_STATIC, yes): CONFIG += qextserialport-static +} +# Though maybe you have been fimiliar with "TEMPLATE += fakelib" and "TEMPLATE -= fakelib", +# but it don't work when you using "qmake -tp XXX". So I use another variable Here. +SAVE_TEMPLATE = $$TEMPLATE +TEMPLATE = fakelib +QEXTSERIALPORT_LIBNAME = $$qtLibraryTarget(qextserialport-1.2) +TEMPLATE = $$SAVE_TEMPLATE +QEXTSERIALPORT_LIBDIR = $$PWD/lib +unix:qextserialport-library:!qextserialport-buildlib:QMAKE_RPATHDIR += $$QEXTSERIALPORT_LIBDIR diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/config_example.pri b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/config_example.pri new file mode 100644 index 0000000..bb1de53 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/config_example.pri @@ -0,0 +1,11 @@ +# This is an example config.pri for building and using qextserialport. +# +# When using the qextserialport, all you need is to add following line +# in your .pro file: +# include(pathToQextserialport/src/qextserialport.pri) +# +# uncomment the following line if you want to use qextserialport as library +# QEXTSERIALPORT_LIBRARY = yes + +# uncomment the following line too if you want to use it as static library +# QEXTSERIALPORT_STATIC = yes diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/doc.pri b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/doc.pri new file mode 100644 index 0000000..8b269ce --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/doc.pri @@ -0,0 +1,12 @@ +OTHER_FILES += $$PWD/qextserialport.qdocconf + +#name of qdoc3 has been changed to qdoc under Qt5 +QESP_QDOC = qdoc +lessThan(QT_MAJOR_VERSION, 5):QESP_QDOC = qdoc3 + +docs_target.target = docs +docs_target.commands = $$QESP_QDOC $$PWD/qextserialport.qdocconf + +QMAKE_EXTRA_TARGETS = docs_target +QMAKE_CLEAN += "-r $$PWD/html" + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/enumerator.qdoc b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/enumerator.qdoc new file mode 100644 index 0000000..acae24d --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/enumerator.qdoc @@ -0,0 +1,9 @@ +/*! + \example examples/enumerator + \title enumerator Demo + + The example demonstrates how to use QextSerialEnumerator. + + \snippet examples/enumerator/main.cpp 0 +*/ + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/uartassistant.png b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/uartassistant.png new file mode 100644 index 0000000..1b500b8 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/images/uartassistant.png differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/qespta.qdoc b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/qespta.qdoc new file mode 100644 index 0000000..82ba2f0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/qespta.qdoc @@ -0,0 +1,7 @@ +/*! + \example examples/qespta + \title qespta Demo + + The example demonstrates how to use QextSerialPort. +*/ + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/uartassistant.qdoc b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/uartassistant.qdoc new file mode 100644 index 0000000..b3e3dc0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/examples/uartassistant.qdoc @@ -0,0 +1,9 @@ +/*! + \example examples/uartassistant + \title UartAssistant Demo + + The example demonstrates how to use QextSerialPort. + + \image uartassistant.png +*/ + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/all-examples.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/all-examples.html new file mode 100644 index 0000000..424bd52 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/all-examples.html @@ -0,0 +1,24 @@ + + + + + + + qesp : + + + + +
Home · All Classes · All Functions ·
  • + + +
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/classes.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/classes.html new file mode 100644 index 0000000..c155480 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/classes.html @@ -0,0 +1,30 @@ + + + + + + + qesp : + + + + +
    Home · All Classes · All Functions ·
  • + + +
    + + + + + +

    PortSettings

    Contain port settings

    QextPortInfo

    Containing port information

    QextSerialEnumerator

    List of ports available in the system

    QextSerialPort

    Encapsulates a serial port on both POSIX and Windows systems

    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/demos-manifest.xml b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/demos-manifest.xml new file mode 100644 index 0000000..e69de29 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-enumerator-pro.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-enumerator-pro.html new file mode 100644 index 0000000..0915727 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-enumerator-pro.html @@ -0,0 +1,28 @@ + + + + + + qesp : enumerator.pro Example File (examples/enumerator/enumerator.pro) + + + + +
    Home · All Classes · All Functions ·

    enumerator.pro Example File

    +examples/enumerator/enumerator.pro + +
    +
        TEMPLATE = app
    +    DEPENDPATH += .
    +    CONFIG += console
    +    include(../../src/qextserialport.pri)
    +    SOURCES += main.cpp
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-main-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-main-cpp.html new file mode 100644 index 0000000..fe3485d --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator-main-cpp.html @@ -0,0 +1,47 @@ + + + + + + qesp : main.cpp Example File (examples/enumerator/main.cpp) + + + + +
    Home · All Classes · All Functions ·

    main.cpp Example File

    +examples/enumerator/main.cpp + +
    +
        /**
    +     * @file main.cpp
    +     * @brief Main file.
    +     * @author Micha? Policht
    +     */
    +
    +    #include "qextserialenumerator.h"
    +    #include <QtCore/QList>
    +    #include <QtCore/QDebug>
    +    int main()
    +    {
    +        QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    +        qDebug() << "List of ports:";
    +        for (int i = 0; i < ports.size(); i++) {
    +            qDebug() << "port name:" << ports.at(i).portName;
    +            qDebug() << "friendly name:" << ports.at(i).friendName;
    +            qDebug() << "physical name:" << ports.at(i).physName;
    +            qDebug() << "enumerator name:" << ports.at(i).enumName;
    +            qDebug() << "vendor ID:" << QString::number(ports.at(i).vendorID, 16);
    +            qDebug() << "product ID:" << QString::number(ports.at(i).productID, 16);
    +            qDebug() << "===================================";
    +        }
    +        return 0;
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator.html new file mode 100644 index 0000000..5fd0851 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-enumerator.html @@ -0,0 +1,47 @@ + + + + + + + qesp : enumerator Demo + + + + +
    Home · All Classes · All Functions ·
  • Examples
  • +
  • enumerator Demo
  • +

    enumerator Demo

    + + +
    +

    Files:

    + +

    The example demonstrates how to use QextSerialEnumerator.

    +
        int main()
    +    {
    +        QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    +        qDebug() << "List of ports:";
    +        for (int i = 0; i < ports.size(); i++) {
    +            qDebug() << "port name:" << ports.at(i).portName;
    +            qDebug() << "friendly name:" << ports.at(i).friendName;
    +            qDebug() << "physical name:" << ports.at(i).physName;
    +            qDebug() << "enumerator name:" << ports.at(i).enumName;
    +            qDebug() << "vendor ID:" << QString::number(ports.at(i).vendorID, 16);
    +            qDebug() << "product ID:" << QString::number(ports.at(i).productID, 16);
    +            qDebug() << "===================================";
    +        }
    +        return 0;
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-manifest.xml b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-manifest.xml new file mode 100644 index 0000000..88a97b4 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-manifest.xml @@ -0,0 +1,10 @@ + + + + + + uartassistant,demo + examples/uartassistant/main.cpp + + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-main-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-main-cpp.html new file mode 100644 index 0000000..9070c53 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-main-cpp.html @@ -0,0 +1,46 @@ + + + + + + qesp : main.cpp Example File (examples/qespta/main.cpp) + + + + +
    Home · All Classes · All Functions ·

    main.cpp Example File

    +examples/qespta/main.cpp + +
    +
        /**
    +     * @file main.cpp
    +     * @brief Main file.
    +     * @author Micha? Policht
    +     */
    +
    +    #include <QApplication>
    +    #include "MainWindow.h"
    +    #include "MessageWindow.h"
    +
    +    int main(int argc, char *argv[])
    +    {
    +            int exec;
    +
    +            QApplication app(argc, argv);
    +        //redirect debug messages to the MessageWindow dialog
    +            qInstallMsgHandler(MessageWindow::AppendMsgWrapper);
    +
    +            MainWindow mainWindow(QLatin1String("QextSerialPort Test Application"));
    +            mainWindow.show();
    +            exec = app.exec();
    +            return exec;
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-cpp.html new file mode 100644 index 0000000..9058445 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-cpp.html @@ -0,0 +1,81 @@ + + + + + + qesp : MainWindow.cpp Example File (examples/qespta/MainWindow.cpp) + + + + +
    Home · All Classes · All Functions ·

    MainWindow.cpp Example File

    +examples/qespta/MainWindow.cpp + +
    +
        /**
    +     * @file MainWindow.cpp
    +     * @brief MainWindow Implementation.
    +     * @see MainWindow.h
    +     * @author Micha? Policht
    +     */
    +
    +    #include <QMessageBox>
    +    #include <QMenuBar>
    +    #include "MainWindow.h"
    +    #include "MessageWindow.h"
    +    #include "QespTest.h"
    +
    +    MainWindow::MainWindow(const QString &title)
    +    {
    +            setWindowTitle(title);
    +        //central widget
    +            QespTest* qespTest = new QespTest();
    +        setCentralWidget(qespTest);
    +            //bottom dock widget
    +            MessageWindow* msgWindow = new MessageWindow();
    +            addDockWidget(Qt::BottomDockWidgetArea, msgWindow);
    +
    +            createActions();
    +            createMenus();
    +    }
    +
    +    void MainWindow::about()
    +    {
    +        QMessageBox::about(this, tr("About "),
    +                tr("<B>""</B><BR>"
    +                                    "author: Michal Policht<br>"
    +                    "<a href='mailto:xpolik@users.sourceforge.net'>xpolik@users.sourceforge.net</a>"));
    +    }
    +
    +    void MainWindow::createActions()
    +    {
    +            //File actions
    +            exitAct = new QAction(tr("E&xit"), this);
    +            exitAct->setShortcut(tr("CTRL+D"));
    +            exitAct->setStatusTip(tr("Exit the application"));
    +            connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
    +
    +            //Help actions
    +            aboutAct = new QAction(tr("&About"), this);
    +            aboutAct->setShortcut(tr("CTRL+A"));
    +            aboutAct->setStatusTip(tr("About application"));
    +            connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
    +    }
    +
    +    void MainWindow::createMenus()
    +    {
    +            fileMenu = menuBar()->addMenu(tr("&File"));
    +            fileMenu->addAction(exitAct);
    +
    +            helpMenu = menuBar()->addMenu(tr("&Help"));
    +            helpMenu->addAction(aboutAct);
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-h.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-h.html new file mode 100644 index 0000000..a05b5fb --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-mainwindow-h.html @@ -0,0 +1,62 @@ + + + + + + qesp : MainWindow.h Example File (examples/qespta/MainWindow.h) + + + + +
    Home · All Classes · All Functions ·

    MainWindow.h Example File

    +examples/qespta/MainWindow.h + +
    +
        /**
    +     * @file MainWindow.h
    +     * @brief Application's Main Window.
    +     * @see MainWindow
    +     * @author Micha? Policht
    +     */
    +
    +    #ifndef MAINWINDOW_H_
    +    #define MAINWINDOW_H_
    +
    +    #include <QMainWindow>
    +
    +    class QMenu;
    +    class QAction;
    +
    +    class MainWindow : public QMainWindow
    +    {
    +            Q_OBJECT
    +
    +        //@{
    +            QMenu *fileMenu;
    +        QAction *exitAct;
    +            QMenu *helpMenu;
    +        QAction *aboutAct;
    +        //@}
    +
    +    private:
    +        void createMenus();
    +        void createActions();
    +
    +    private slots:
    +        void about();
    +
    +    public:
    +        MainWindow(const QString &title);
    +
    +    };
    +
    +    #endif /*MAINWINDOW_H_*/
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-cpp.html new file mode 100644 index 0000000..030f982 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-cpp.html @@ -0,0 +1,118 @@ + + + + + + qesp : MessageWindow.cpp Example File (examples/qespta/MessageWindow.cpp) + + + + +
    Home · All Classes · All Functions ·

    MessageWindow.cpp Example File

    +examples/qespta/MessageWindow.cpp + +
    +
        /**
    +     * @file MessageWindow.cpp
    +     * @brief MessageWindow Implementation.
    +     * @see MessageWindow.h
    +     * @author Micha? Policht
    +     */
    +
    +    #include <stdio.h>
    +    #include "MessageWindow.h"
    +    #include <QMessageBox>
    +    #include <QCoreApplication>
    +    #include <QMutexLocker>
    +
    +    const char* MessageWindow::WINDOW_TITLE = "Message Window";
    +    MessageWindow* MessageWindow::MsgHandler = NULL;
    +
    +    MessageWindow::MessageWindow(QWidget* parent, Qt::WFlags flags)
    +            : QDockWidget(parent, flags),
    +                    msgTextEdit(this)
    +    {
    +            setWindowTitle(tr(WINDOW_TITLE));
    +            msgTextEdit.setReadOnly(true);
    +            setWidget(&msgTextEdit);
    +
    +            MessageWindow::MsgHandler = this;
    +    }
    +
    +    //static
    +    QString MessageWindow::QtMsgToQString(QtMsgType type, const char *msg)
    +    {
    +            switch (type) {
    +                    case QtDebugMsg:
    +                            return QLatin1String("Debug: ")+QLatin1String(msg);
    +                    case QtWarningMsg:
    +                            return QLatin1String("Warning: ")+QLatin1String(msg);
    +                    case QtCriticalMsg:
    +                            return QLatin1String("Critical: ")+QLatin1String(msg);
    +                    case QtFatalMsg:
    +                            return QLatin1String("Fatal: ")+QLatin1String(msg);
    +                    default:
    +                            return QLatin1String("Unrecognized message type: ")+QLatin1String(msg);
    +            }
    +    }
    +
    +    //static
    +    void MessageWindow::AppendMsgWrapper(QtMsgType type, const char* msg)
    +    {
    +            static QMutex mutex;
    +            QMutexLocker locker(&mutex);
    +
    +            if (MessageWindow::MsgHandler != NULL)
    +                    return MessageWindow::MsgHandler->postMsgEvent(type, msg);
    +            else
    +            fprintf(stderr, "%s", MessageWindow::QtMsgToQString(type, msg).toLatin1().data());
    +    }
    +
    +    void MessageWindow::customEvent(QEvent* event)
    +    {
    +            if (static_cast<MessageWindow::EventType>(event->type()) == MessageWindow::MessageEventType)
    +                    msgTextEdit.append(dynamic_cast<MessageEvent* >(event)->msg);
    +    }
    +
    +    void MessageWindow::postMsgEvent(QtMsgType type, const char* msg)
    +    {
    +            QString qmsg = MessageWindow::QtMsgToQString(type, msg);
    +            switch (type) {
    +                    case QtDebugMsg:
    +                            break;
    +                    case QtWarningMsg:
    +                            qmsg.prepend(QLatin1String("<FONT color=\"#FF0000\">"));
    +                            qmsg.append(QLatin1String("</FONT>"));
    +                            break;
    +                    case QtCriticalMsg:
    +                            if (QMessageBox::critical(this, QLatin1String("Critical Error"), qmsg,
    +                                            QMessageBox::Ignore,
    +                                            QMessageBox::Abort,
    +                                            QMessageBox::NoButton) == QMessageBox::Abort)
    +                                    abort(); // core dump
    +                            qmsg.prepend(QLatin1String("<B><FONT color=\"#FF0000\">"));
    +                            qmsg.append(QLatin1String("</FONT></B>"));
    +                            break;
    +                    case QtFatalMsg:
    +                            QMessageBox::critical(this, QLatin1String("Fatal Error"), qmsg, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton);
    +                            abort(); // deliberately core dump
    +            }
    +            //it's impossible to change GUI directly from thread other than the main thread
    +            //so post message encapsulated by MessageEvent to the main thread's event queue
    +            QCoreApplication::postEvent(this, new MessageEvent(qmsg));
    +    }
    +
    +    MessageEvent::MessageEvent(QString & msg):
    +            QEvent(static_cast<QEvent::Type>(MessageWindow::MessageEventType))
    +    {
    +            this->msg = msg;
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-h.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-h.html new file mode 100644 index 0000000..238a850 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-messagewindow-h.html @@ -0,0 +1,104 @@ + + + + + + qesp : MessageWindow.h Example File (examples/qespta/MessageWindow.h) + + + + +
    Home · All Classes · All Functions ·

    MessageWindow.h Example File

    +examples/qespta/MessageWindow.h + +
    +
        /**
    +     * @file MessageWindow.h
    +     * @brief Message Window.
    +     * @see MessageWindow
    +     * @author Micha? Policht
    +     */
    +
    +    #ifndef MESSAGEWINDOW_H_
    +    #define MESSAGEWINDOW_H_
    +
    +    #include <QDockWidget>
    +    #include <QTextEdit>
    +    #include <QEvent>
    +
    +    /**
    +     * Message Window. Handling errors and other messages.
    +     */
    +    class MessageWindow: public QDockWidget
    +    {
    +            Q_OBJECT
    +
    +            QTextEdit msgTextEdit;                          ///< Main widget.
    +            static MessageWindow* MsgHandler;       ///< Set in constructor.
    +            static const char* WINDOW_TITLE;        ///< Window title.
    +
    +            private:
    +                    static QString QtMsgToQString(QtMsgType type, const char *msg);
    +
    +            protected:
    +                    /**
    +                     * Handle custom events. MessageWindow hadles custom events listed in
    +                     * EventType enum.
    +                     */
    +                    virtual void customEvent(QEvent* event);
    +
    +            public:
    +            enum EventType {MessageEventType = QEvent::User};       ///< Custom event types.
    +
    +                    /**
    +                     * Default constructor.
    +                     *      @param parent parent widget.
    +                     *      @param flags widget flags.
    +                     */
    +                    MessageWindow(QWidget* parent = 0, Qt::WFlags flags = 0);
    +
    +                    /**
    +                     * Append message wrapper. Since ISO forbids casting member functions
    +                     * to C functions, wrapper is needed to use this class as QtMsgHandler.
    +                     * This method is thread-safe but not reentrant.
    +                     *      @param type message type.
    +                     *      @param msg message string.
    +                     */
    +                    static void AppendMsgWrapper(QtMsgType type, const char *msg);
    +
    +                    /**
    +                     * Post message event to the main event loop. This function encapsulates
    +                     * message into MessageEvent object and passes it to the main event loop.
    +                     *      @param type message type.
    +                     *      @param msg message string.
    +                     */
    +                    void postMsgEvent(QtMsgType type, const char *msg);
    +
    +    };
    +
    +    /**
    +     * Message Event. Custom event used by @ref MessageWindow to provide multi-threaded
    +     * access. Encapsulates message inside @a msg variable.
    +     */
    +    class MessageEvent: public QEvent
    +    {
    +        public:
    +            QString msg;    ///< Message string.
    +
    +            /**
    +             * Contructor.
    +             *      @param msg message to post.
    +             */
    +            MessageEvent(QString & msg);
    +    };
    +
    +    #endif /*MESSAGEWINDOW_H_*/
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qespta-pro.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qespta-pro.html new file mode 100644 index 0000000..006c617 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qespta-pro.html @@ -0,0 +1,37 @@ + + + + + + qesp : qespta.pro Example File (examples/qespta/qespta.pro) + + + + +
    Home · All Classes · All Functions ·

    qespta.pro Example File

    +examples/qespta/qespta.pro + +
    +
        TEMPLATE = app
    +    DEPENDPATH += .
    +    QT += core gui
    +    contains(QT_VERSION, ^5\\..*\\..*): QT += widgets
    +    HEADERS += MainWindow.h \
    +                    MessageWindow.h \
    +            QespTest.h
    +
    +    SOURCES += main.cpp \
    +                    MainWindow.cpp \
    +                    MessageWindow.cpp \
    +                    QespTest.cpp
    +
    +    include(../../src/qextserialport.pri)
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-cpp.html new file mode 100644 index 0000000..cc00266 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-cpp.html @@ -0,0 +1,149 @@ + + + + + + qesp : QespTest.cpp Example File (examples/qespta/QespTest.cpp) + + + + +
    Home · All Classes · All Functions ·

    QespTest.cpp Example File

    +examples/qespta/QespTest.cpp + +
    +
        /* QespTest.cpp
    +    **************************************/
    +    #include "QespTest.h"
    +    #include "qextserialport.h"
    +    #include <QLayout>
    +    #include <QLineEdit>
    +    #include <QTextEdit>
    +    #include <QPushButton>
    +    #include <QSpinBox>
    +
    +    QespTest::QespTest(QWidget* parent)
    +            : QWidget(parent)
    +
    +    {
    +            //modify the port settings on your own
    +        #ifdef Q_OS_UNIX
    +                    port = new QextSerialPort(QLatin1String("/dev/ttyS0"), QextSerialPort::Polling);
    +            #else
    +                    port = new QextSerialPort(QLatin1String("COM1"), QextSerialPort::Polling);
    +        #endif /*Q_OS_UNIX*/
    +            port->setBaudRate(BAUD19200);
    +            port->setFlowControl(FLOW_OFF);
    +            port->setParity(PAR_NONE);
    +            port->setDataBits(DATA_8);
    +            port->setStopBits(STOP_2);
    +            //set timeouts to 500 ms
    +            port->setTimeout(500);
    +
    +            message = new QLineEdit(this);
    +
    +            // transmit receive
    +            QPushButton *transmitButton = new QPushButton(tr("Transmit"));
    +            connect(transmitButton, SIGNAL(clicked()), SLOT(transmitMsg()));
    +            QPushButton *receiveButton = new QPushButton(tr("Receive"));
    +            connect(receiveButton, SIGNAL(clicked()), SLOT(receiveMsg()));
    +            QHBoxLayout* trLayout = new QHBoxLayout;
    +            trLayout->addWidget(transmitButton);
    +            trLayout->addWidget(receiveButton);
    +
    +            //CR LF
    +            QPushButton *CRButton = new QPushButton(tr("CR"));
    +            connect(CRButton, SIGNAL(clicked()), SLOT(appendCR()));
    +            QPushButton *LFButton = new QPushButton(tr("LF"));
    +            connect(LFButton, SIGNAL(clicked()), SLOT(appendLF()));
    +            QHBoxLayout *crlfLayout = new QHBoxLayout;
    +            crlfLayout->addWidget(CRButton);
    +            crlfLayout->addWidget(LFButton);
    +
    +            //open close
    +            QPushButton *openButton = new QPushButton(tr("Open"));
    +            connect(openButton, SIGNAL(clicked()), SLOT(openPort()));
    +            QPushButton *closeButton = new QPushButton(tr("Close"));
    +            connect(closeButton, SIGNAL(clicked()), SLOT(closePort()));
    +            QHBoxLayout *ocLayout = new QHBoxLayout;
    +            ocLayout->addWidget(openButton);
    +            ocLayout->addWidget(closeButton);
    +
    +            received_msg = new QTextEdit();
    +
    +            QVBoxLayout *myVBox = new QVBoxLayout;
    +            myVBox->addWidget(message);
    +            myVBox->addLayout(crlfLayout);
    +            myVBox->addLayout(trLayout);
    +            myVBox->addLayout(ocLayout);
    +            myVBox->addWidget(received_msg);
    +            setLayout(myVBox);
    +
    +            qDebug("isOpen : %d", port->isOpen());
    +    }
    +
    +    QespTest::~QespTest()
    +    {
    +        delete port;
    +        port = NULL;
    +    }
    +
    +    void QespTest::transmitMsg()
    +    {
    +      int i = port->write((message->text()).toAscii(),
    +                           (message->text()).length());
    +      qDebug("trasmitted : %d", i);
    +    }
    +
    +    void QespTest::receiveMsg()
    +    {
    +            char buff[1024];
    +            int numBytes;
    +
    +            numBytes = port->bytesAvailable();
    +        if(numBytes > 1024)
    +            numBytes = 1024;
    +
    +        int i = port->read(buff, numBytes);
    +        if (i != -1)
    +                    buff[i] = '\0';
    +            else
    +                    buff[0] = '\0';
    +            QString msg = QLatin1String(buff);
    +
    +            received_msg->append(msg);
    +            received_msg->ensureCursorVisible();
    +            qDebug("bytes available: %d", numBytes);
    +            qDebug("received: %d", i);
    +    }
    +
    +    void QespTest::appendCR()
    +    {
    +            message->insert(QLatin1String("\x0D"));
    +    }
    +
    +    void QespTest::appendLF()
    +    {
    +            message->insert(QLatin1String("\x0A"));
    +    }
    +
    +    void QespTest::closePort()
    +    {
    +            port->close();
    +            qDebug("is open: %d", port->isOpen());
    +    }
    +
    +    void QespTest::openPort()
    +    {
    +            port->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
    +            qDebug("is open: %d", port->isOpen());
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-h.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-h.html new file mode 100644 index 0000000..37693fe --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta-qesptest-h.html @@ -0,0 +1,59 @@ + + + + + + qesp : QespTest.h Example File (examples/qespta/QespTest.h) + + + + +
    Home · All Classes · All Functions ·

    QespTest.h Example File

    +examples/qespta/QespTest.h + +
    +
        /* qesptest.h
    +    **************************************/
    +    #ifndef _QESPTEST_H_
    +    #define _QESPTEST_H_
    +
    +    #include <QWidget>
    +
    +    class QLineEdit;
    +    class QTextEdit;
    +    class QextSerialPort;
    +    class QSpinBox;
    +
    +    class QespTest :  public QWidget
    +    {
    +      Q_OBJECT
    +    public:
    +      QespTest(QWidget *parent=0);
    +
    +      virtual ~QespTest();
    +
    +    private:
    +      QLineEdit *message;
    +      QSpinBox* delaySpinBox;
    +      QTextEdit *received_msg;
    +      QextSerialPort *port;
    +
    +    private slots:
    +      void transmitMsg();
    +      void receiveMsg();
    +      void appendCR();
    +      void appendLF();
    +      void closePort();
    +      void openPort();
    +    };
    +
    +    #endif
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta.html new file mode 100644 index 0000000..8e3a974 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-qespta.html @@ -0,0 +1,38 @@ + + + + + + + qesp : qespta Demo + + + + +
    Home · All Classes · All Functions ·
  • Examples
  • +
  • qespta Demo
  • +

    qespta Demo

    + + + + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-cpp.html new file mode 100644 index 0000000..7ad6804 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-cpp.html @@ -0,0 +1,185 @@ + + + + + + qesp : dialog.cpp Example File (examples/uartassistant/dialog.cpp) + + + + +
    Home · All Classes · All Functions ·

    dialog.cpp Example File

    +examples/uartassistant/dialog.cpp + +
    +
        #include "dialog.h"
    +    #include "ui_dialog.h"
    +    #include <QtCore/QStringList>
    +    #include <QtCore/QTimer>
    +    #include <QtCore/QVariant>
    +    #include "qextserialport.h"
    +
    +    Dialog::Dialog(QWidget *parent) :
    +        QDialog(parent),
    +        ui(new Ui::Dialog)
    +    {
    +        ui->setupUi(this);
    +
    +    #ifdef Q_OS_WIN
    +        ui->portBox->addItems(QStringList()<<QLatin1String("COM1")<<QLatin1String("COM2")<<QLatin1String("COM3")<<QLatin1String("COM4"));
    +    #else
    +        ui->portBox->addItems(QStringList()<<QLatin1String("/dev/ttyS0")<<QLatin1String("/dev/ttyS1")<<QLatin1String("/dev/ttyUSB0")<<QLatin1String("/dev/ttyUSB1"));
    +    #endif
    +        //make sure user can input their own port name!
    +        ui->portBox->setEditable(true);
    +
    +        ui->baudRateBox->addItem(QLatin1String("1200"), BAUD1200);
    +        ui->baudRateBox->addItem(QLatin1String("2400"), BAUD2400);
    +        ui->baudRateBox->addItem(QLatin1String("4800"), BAUD4800);
    +        ui->baudRateBox->addItem(QLatin1String("9600"), BAUD9600);
    +        ui->baudRateBox->addItem(QLatin1String("19200"), BAUD19200);
    +        ui->baudRateBox->setCurrentIndex(3);
    +
    +        ui->parityBox->addItem(QLatin1String("NONE"), PAR_NONE);
    +        ui->parityBox->addItem(QLatin1String("ODD"), PAR_ODD);
    +        ui->parityBox->addItem(QLatin1String("EVEN"), PAR_EVEN);
    +
    +        ui->dataBitsBox->addItem(QLatin1String("5"), DATA_5);
    +        ui->dataBitsBox->addItem(QLatin1String("6"), DATA_6);
    +        ui->dataBitsBox->addItem(QLatin1String("7"), DATA_7);
    +        ui->dataBitsBox->addItem(QLatin1String("8"), DATA_8);
    +        ui->dataBitsBox->setCurrentIndex(3);
    +
    +        ui->stopBitsBox->addItem(QLatin1String("1"), STOP_1);
    +        ui->stopBitsBox->addItem(QLatin1String("2"), STOP_2);
    +
    +        ui->queryModeBox->addItem(QLatin1String("Polling"), QextSerialPort::Polling);
    +        ui->queryModeBox->addItem(QLatin1String("EventDriven"), QextSerialPort::EventDriven);
    +
    +        ui->led->turnOff();
    +
    +        timer = new QTimer(this);
    +        timer->setInterval(40);
    +        PortSettings settings = {BAUD9600, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10};
    +        port = new QextSerialPort(ui->portBox->currentText(), settings, QextSerialPort::Polling);
    +
    +        connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)), SLOT(onBaudRateChanged(int)));
    +        connect(ui->parityBox, SIGNAL(currentIndexChanged(int)), SLOT(onParityChanged(int)));
    +        connect(ui->dataBitsBox, SIGNAL(currentIndexChanged(int)), SLOT(onDataBitsChanged(int)));
    +        connect(ui->stopBitsBox, SIGNAL(currentIndexChanged(int)), SLOT(onStopBitsChanged(int)));
    +        connect(ui->queryModeBox, SIGNAL(currentIndexChanged(int)), SLOT(onQueryModeChanged(int)));
    +        connect(ui->timeoutBox, SIGNAL(valueChanged(int)), SLOT(onTimeoutChanged(int)));
    +        connect(ui->portBox, SIGNAL(editTextChanged(QString)), SLOT(onPortNameChanged(QString)));
    +        connect(ui->openCloseButton, SIGNAL(clicked()), SLOT(onOpenCloseButtonClicked()));
    +        connect(ui->sendButton, SIGNAL(clicked()), SLOT(onSendButtonClicked()));
    +        connect(timer, SIGNAL(timeout()), SLOT(onReadyRead()));
    +        connect(port, SIGNAL(readyRead()), SLOT(onReadyRead()));
    +
    +        setWindowTitle(QLatin1String("QextSerialPort Demo"));
    +    }
    +
    +    Dialog::~Dialog()
    +    {
    +        delete ui;
    +        delete port;
    +    }
    +
    +    void Dialog::changeEvent(QEvent *e)
    +    {
    +        QDialog::changeEvent(e);
    +        switch (e->type()) {
    +        case QEvent::LanguageChange:
    +            ui->retranslateUi(this);
    +            break;
    +        default:
    +            break;
    +        }
    +    }
    +
    +    void Dialog::onPortNameChanged(const QString & /*name*/)
    +    {
    +        if (port->isOpen()) {
    +            port->close();
    +            ui->led->turnOff();
    +        }
    +    }
    +
    +    void Dialog::onBaudRateChanged(int idx)
    +    {
    +        port->setBaudRate((BaudRateType)ui->baudRateBox->itemData(idx).toInt());
    +    }
    +
    +    void Dialog::onParityChanged(int idx)
    +    {
    +        port->setParity((ParityType)ui->parityBox->itemData(idx).toInt());
    +    }
    +
    +    void Dialog::onDataBitsChanged(int idx)
    +    {
    +        port->setDataBits((DataBitsType)ui->dataBitsBox->itemData(idx).toInt());
    +    }
    +
    +    void Dialog::onStopBitsChanged(int idx)
    +    {
    +        port->setStopBits((StopBitsType)ui->stopBitsBox->itemData(idx).toInt());
    +    }
    +
    +    void Dialog::onQueryModeChanged(int idx)
    +    {
    +        port->setQueryMode((QextSerialPort::QueryMode)ui->queryModeBox->itemData(idx).toInt());
    +    }
    +
    +    void Dialog::onTimeoutChanged(int val)
    +    {
    +        port->setTimeout(val);
    +    }
    +
    +    void Dialog::onOpenCloseButtonClicked()
    +    {
    +        if (!port->isOpen()) {
    +            port->setPortName(ui->portBox->currentText());
    +            port->open(QIODevice::ReadWrite);
    +        }
    +        else {
    +            port->close();
    +        }
    +
    +        if (port->isOpen()) {
    +            if (port->queryMode() == QextSerialPort::Polling)
    +                timer->start();
    +            ui->led->turnOn();
    +        }
    +        else {
    +            timer->stop();
    +            ui->led->turnOff();
    +        }
    +    }
    +
    +    void Dialog::onSendButtonClicked()
    +    {
    +        if (port->isOpen() && !ui->sendEdit->toPlainText().isEmpty())
    +            port->write(ui->sendEdit->toPlainText().toLatin1());
    +    }
    +
    +    void Dialog::onReadyRead()
    +    {
    +        //EventDriven test.
    +        if (qApp->arguments().contains(QLatin1String("--debug")) && port->queryMode()==QextSerialPort::EventDriven){
    +            ui->recvEdit->appendPlainText(QString::number(port->bytesAvailable()));
    +            return;
    +        }
    +
    +        if (port->bytesAvailable()) {
    +            ui->recvEdit->moveCursor(QTextCursor::End);
    +            ui->recvEdit->insertPlainText(QString::fromLatin1(port->readAll()));
    +        }
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-h.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-h.html new file mode 100644 index 0000000..ac43524 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-h.html @@ -0,0 +1,64 @@ + + + + + + qesp : dialog.h Example File (examples/uartassistant/dialog.h) + + + + +
    Home · All Classes · All Functions ·

    dialog.h Example File

    +examples/uartassistant/dialog.h + +
    +
        #ifndef DIALOG_H
    +    #define DIALOG_H
    +
    +    #include <QDialog>
    +
    +    namespace Ui {
    +        class Dialog;
    +    }
    +    class QTimer;
    +    class QextSerialPort;
    +
    +    class Dialog : public QDialog
    +    {
    +        Q_OBJECT
    +
    +    public:
    +        explicit Dialog(QWidget *parent = 0);
    +        ~Dialog();
    +
    +    protected:
    +        void changeEvent(QEvent *e);
    +
    +    private Q_SLOTS:
    +        void onPortNameChanged(const QString &name);
    +        void onBaudRateChanged(int idx);
    +        void onParityChanged(int idx);
    +        void onDataBitsChanged(int idx);
    +        void onStopBitsChanged(int idx);
    +        void onQueryModeChanged(int idx);
    +        void onTimeoutChanged(int val);
    +        void onOpenCloseButtonClicked();
    +        void onSendButtonClicked();
    +        void onReadyRead();
    +
    +    private:
    +        Ui::Dialog *ui;
    +        QTimer *timer;
    +        QextSerialPort *port;
    +    };
    +
    +    #endif // DIALOG_H
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-ui.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-ui.html new file mode 100644 index 0000000..c22365f --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-dialog-ui.html @@ -0,0 +1,214 @@ + + + + + + qesp : dialog.ui Example File (examples/uartassistant/dialog.ui) + + + + +
    Home · All Classes · All Functions ·

    dialog.ui Example File

    +examples/uartassistant/dialog.ui + +
    +
        <?xml version="1.0" encoding="UTF-8"?>
    +    <ui version="4.0">
    +     <class>Dialog</class>
    +     <widget class="QDialog" name="Dialog">
    +      <property name="geometry">
    +       <rect>
    +        <x>0</x>
    +        <y>0</y>
    +        <width>604</width>
    +        <height>485</height>
    +       </rect>
    +      </property>
    +      <property name="windowTitle">
    +       <string>Dialog</string>
    +      </property>
    +      <layout class="QHBoxLayout" name="horizontalLayout_2">
    +       <item>
    +        <layout class="QVBoxLayout" name="verticalLayout" stretch="3,1">
    +         <item>
    +          <widget class="QPlainTextEdit" name="recvEdit">
    +           <property name="maximumBlockCount">
    +            <number>800</number>
    +           </property>
    +          </widget>
    +         </item>
    +         <item>
    +          <widget class="QPlainTextEdit" name="sendEdit"/>
    +         </item>
    +        </layout>
    +       </item>
    +       <item>
    +        <layout class="QVBoxLayout" name="verticalLayout_2">
    +         <item>
    +          <layout class="QFormLayout" name="formLayout">
    +           <item row="0" column="0">
    +            <widget class="QLabel" name="label">
    +             <property name="text">
    +              <string>Port:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="0" column="1">
    +            <widget class="QComboBox" name="portBox"/>
    +           </item>
    +           <item row="1" column="0">
    +            <widget class="QLabel" name="label_2">
    +             <property name="text">
    +              <string>BaudRate:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="1" column="1">
    +            <widget class="QComboBox" name="baudRateBox"/>
    +           </item>
    +           <item row="2" column="0">
    +            <widget class="QLabel" name="label_3">
    +             <property name="text">
    +              <string>DataBits:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="2" column="1">
    +            <widget class="QComboBox" name="dataBitsBox"/>
    +           </item>
    +           <item row="3" column="0">
    +            <widget class="QLabel" name="label_4">
    +             <property name="text">
    +              <string>Parity:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="3" column="1">
    +            <widget class="QComboBox" name="parityBox"/>
    +           </item>
    +           <item row="4" column="0">
    +            <widget class="QLabel" name="label_5">
    +             <property name="text">
    +              <string>StopBits:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="4" column="1">
    +            <widget class="QComboBox" name="stopBitsBox"/>
    +           </item>
    +           <item row="6" column="0">
    +            <widget class="QLabel" name="label_6">
    +             <property name="text">
    +              <string>QueryMode:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="6" column="1">
    +            <widget class="QComboBox" name="queryModeBox"/>
    +           </item>
    +           <item row="5" column="0">
    +            <widget class="QLabel" name="label_7">
    +             <property name="text">
    +              <string>Timeout:</string>
    +             </property>
    +            </widget>
    +           </item>
    +           <item row="5" column="1">
    +            <widget class="QSpinBox" name="timeoutBox">
    +             <property name="suffix">
    +              <string> ms</string>
    +             </property>
    +             <property name="minimum">
    +              <number>-1</number>
    +             </property>
    +             <property name="maximum">
    +              <number>10000</number>
    +             </property>
    +             <property name="singleStep">
    +              <number>10</number>
    +             </property>
    +             <property name="value">
    +              <number>10</number>
    +             </property>
    +            </widget>
    +           </item>
    +          </layout>
    +         </item>
    +         <item>
    +          <layout class="QHBoxLayout" name="horizontalLayout">
    +           <item>
    +            <widget class="HLed" name="led" native="true">
    +             <property name="sizePolicy">
    +              <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
    +               <horstretch>0</horstretch>
    +               <verstretch>0</verstretch>
    +              </sizepolicy>
    +             </property>
    +             <property name="minimumSize">
    +              <size>
    +               <width>20</width>
    +               <height>20</height>
    +              </size>
    +             </property>
    +             <property name="maximumSize">
    +              <size>
    +               <width>25</width>
    +               <height>25</height>
    +              </size>
    +             </property>
    +            </widget>
    +           </item>
    +           <item>
    +            <widget class="QPushButton" name="openCloseButton">
    +             <property name="text">
    +              <string>Open/Close</string>
    +             </property>
    +            </widget>
    +           </item>
    +          </layout>
    +         </item>
    +         <item>
    +          <spacer name="verticalSpacer">
    +           <property name="orientation">
    +            <enum>Qt::Vertical</enum>
    +           </property>
    +           <property name="sizeHint" stdset="0">
    +            <size>
    +             <width>20</width>
    +             <height>40</height>
    +            </size>
    +           </property>
    +          </spacer>
    +         </item>
    +         <item>
    +          <widget class="QPushButton" name="sendButton">
    +           <property name="text">
    +            <string>Send</string>
    +           </property>
    +          </widget>
    +         </item>
    +        </layout>
    +       </item>
    +      </layout>
    +     </widget>
    +     <layoutdefault spacing="6" margin="11"/>
    +     <customwidgets>
    +      <customwidget>
    +       <class>HLed</class>
    +       <extends>QWidget</extends>
    +       <header>hled.h</header>
    +       <container>1</container>
    +      </customwidget>
    +     </customwidgets>
    +     <resources/>
    +     <connections/>
    +    </ui>
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-cpp.html new file mode 100644 index 0000000..6bc699b --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-cpp.html @@ -0,0 +1,292 @@ + + + + + + qesp : hled.cpp Example File (examples/uartassistant/hled.cpp) + + + + +
    Home · All Classes · All Functions ·

    hled.cpp Example File

    +examples/uartassistant/hled.cpp + +
    +
        #include <QtCore/QTimer>
    +
    +    #include <QtGui/QColor>
    +    #include <QtGui/QImage>
    +    #include <QtGui/QPainter>
    +    #include <QtGui/QPixmap>
    +
    +    #include "hled.h"
    +
    +    class HLed::Private
    +    {
    +    public:
    +        Private()
    +            : darkerFactor(300), color(Qt::green),
    +            isOn(true), offPixmap(0), onPixmap(0)
    +        {
    +            offColor = color.darker(darkerFactor);
    +            timer = new QTimer;
    +            timer->setInterval(250);
    +        }
    +
    +        ~Private()
    +        {
    +            delete offPixmap;
    +            delete onPixmap;
    +            delete timer;
    +        }
    +
    +        int darkerFactor;
    +        QColor color;
    +        bool isOn;
    +
    +        QColor offColor;
    +        QPixmap *offPixmap;
    +        QPixmap *onPixmap;
    +
    +        HLed::State state;
    +        QTimer * timer;
    +    };
    +
    +    HLed::HLed(QWidget *parent)
    +        :QWidget(parent), m_d(new Private)
    +    {
    +        setColor(Qt::red);
    +        setState(Blink);
    +        connect(m_d->timer, SIGNAL(timeout()), this, SLOT(blinkToggle()));
    +    }
    +
    +    HLed::~HLed()
    +    {
    +        delete m_d;
    +    }
    +
    +    QColor HLed::color() const
    +    {
    +        return m_d->color;
    +    }
    +
    +    HLed::State HLed::state() const
    +    {
    +        return m_d->state;
    +    }
    +
    +    int HLed::darkerFactor() const
    +    {
    +        return m_d->darkerFactor;
    +    }
    +
    +    void HLed::setColor(const QColor &color)
    +    {
    +        if (m_d->color == color)
    +            return;
    +
    +        if (m_d->onPixmap) {
    +            delete m_d->onPixmap;
    +            m_d->onPixmap = 0;
    +        }
    +
    +        if (m_d->offPixmap) {
    +            delete m_d->offPixmap;
    +            m_d->offPixmap = 0;
    +        }
    +
    +        m_d->color = color;
    +        m_d->offColor = color.darker(m_d->darkerFactor);
    +
    +        update();
    +    }
    +
    +    void HLed::setState(State state)
    +    {
    +        if (m_d->state == state)
    +            return;
    +
    +        if (Blink == state) {
    +            m_d->timer->start();
    +        }
    +        else {
    +            m_d->timer->stop();
    +            m_d->isOn = (state==On) ? true : false;
    +        }
    +        m_d->state = state;
    +        update();
    +    }
    +
    +    void HLed::setDarkerFactor(int darkerFactor)
    +    {
    +        if (m_d->darkerFactor == darkerFactor)
    +            return;
    +
    +        m_d->darkerFactor = darkerFactor;
    +        m_d->offColor = m_d->color.darker(darkerFactor);
    +
    +        update();
    +    }
    +
    +    QSize HLed::sizeHint() const
    +    {
    +        return QSize(20, 20);
    +    }
    +
    +    QSize HLed::minimumSizeHint() const
    +    {
    +        return QSize(16, 16);
    +    }
    +
    +    void HLed::toggle()
    +    {
    +        if (m_d->state == Blink) {
    +            return;
    +        }
    +
    +        setState(m_d->state == On ? Off : On);
    +        update();
    +    }
    +
    +    void HLed::turnOn(bool on)
    +    {
    +        setState(on ? On : Off);
    +    }
    +
    +    void HLed::turnOff(bool off)
    +    {
    +        turnOn(!off);
    +    }
    +
    +    void HLed::blink()
    +    {
    +        setState(Blink);
    +    }
    +
    +    void HLed::blinkToggle()
    +    {
    +        m_d->isOn = !m_d->isOn;
    +        update();
    +    }
    +
    +    void HLed::paintEvent(QPaintEvent* /* event*/)
    +    {
    +        if (paintCachedPixmap())
    +        {
    +            return;
    +        }
    +
    +        int width = ledWidth();
    +        const int scale = 3;
    +        QPixmap *tmpPixmap = 0;
    +
    +        width *= scale;
    +        tmpPixmap = new QPixmap(width + scale*2, width + scale*2);
    +        tmpPixmap->fill(palette().color(backgroundRole()));
    +        tmpPixmap->fill(QColor(Qt::transparent));
    +
    +        QPainter paint;
    +        paint.begin(tmpPixmap);
    +        paint.setRenderHint(QPainter::Antialiasing);
    +
    +        QColor color = m_d->isOn ? m_d->color : m_d->offColor;
    +
    +        QBrush brush;
    +        brush.setStyle(Qt::SolidPattern);
    +        brush.setColor(color);
    +
    +        paint.setBrush(brush);
    +        // draw plain
    +        paint.drawEllipse(scale, scale, width-scale*2, width-scale*2);
    +
    +        QPen pen;
    +        pen.setWidth(2 * scale);
    +
    +        int pos = width / 5 + 1;
    +        int lightWidth = width * 2 / 3;
    +        int lightQuote = 130 * 2 / (lightWidth ? lightWidth : 1) + 100;
    +
    +        // draw bright spot
    +        while (lightWidth) {
    +            color = color.lighter(lightQuote);
    +            pen.setColor(color);
    +            paint.setPen(pen);
    +            paint.drawEllipse(pos, pos, lightWidth, lightWidth);
    +            lightWidth--;
    +
    +            if (!lightWidth) {
    +                break;
    +            }
    +
    +            paint.drawEllipse(pos, pos, lightWidth, lightWidth);
    +            lightWidth--;
    +
    +            if (!lightWidth) {
    +                break;
    +            }
    +
    +            paint.drawEllipse(pos, pos, lightWidth, lightWidth);
    +            pos++;
    +            lightWidth--;
    +        }
    +
    +        pen.setWidth(2*scale + 1);
    +        brush.setStyle(Qt::NoBrush);
    +        paint.setBrush(brush);
    +
    +        int angle = -720;
    +        color = palette().color(QPalette::Light);
    +
    +        for (int arc=120; arc<2880; arc+=240) {
    +            pen.setColor(color);
    +            paint.setPen(pen);
    +            int w = width - pen.width()/2 - scale + 1;
    +            paint.drawArc(pen.width()/2, pen.width()/2, w, w, angle+arc, 240);
    +            paint.drawArc(pen.width()/2, pen.width()/2, w, w, angle-arc, 240);
    +            color = color.darker(110);
    +        }
    +
    +        paint.end();
    +
    +        QPixmap *&dest = (m_d->isOn ? m_d->onPixmap : m_d->offPixmap);
    +        QImage i = tmpPixmap->toImage();
    +        width /= scale;
    +        i = i.scaled(width, width, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
    +        delete tmpPixmap;
    +
    +        dest = new QPixmap(QPixmap::fromImage(i));
    +        paint.begin(this);
    +        paint.drawPixmap(0, 0, *dest);
    +        paint.end();
    +    }
    +
    +    bool HLed::paintCachedPixmap()
    +    {
    +        if (m_d->isOn && m_d->onPixmap) {
    +            QPainter paint(this);
    +            paint.drawPixmap(0, 0, *m_d->onPixmap);
    +            return true;
    +        }
    +        if (!m_d->isOn && m_d->offPixmap) {
    +            QPainter paint(this);
    +            paint.drawPixmap(0, 0, *m_d->offPixmap);
    +            return true;
    +        }
    +        return false;
    +    }
    +
    +    int HLed::ledWidth() const
    +    {
    +        int width = qMin(this->width(), this->height());
    +        width -= 2;
    +        return width > 0 ? width : 0;
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-h.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-h.html new file mode 100644 index 0000000..f7f72ac --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-hled-h.html @@ -0,0 +1,71 @@ + + + + + + qesp : hled.h Example File (examples/uartassistant/hled.h) + + + + +
    Home · All Classes · All Functions ·

    hled.h Example File

    +examples/uartassistant/hled.h + +
    +
        #ifndef HLED_H
    +    #define HLED_H
    +
    +    #include <QWidget>
    +
    +    class QColor;
    +    class QTimer;
    +
    +    class HLed : public QWidget
    +    {
    +        Q_OBJECT
    +    public:
    +        enum State {Off, On, Blink};
    +        HLed(QWidget *parent = 0);
    +        ~HLed();
    +
    +        QColor color() const;
    +        State state() const;
    +        int darkerFactor() const;
    +
    +        void setColor(const QColor & color);
    +        void setState(State state);
    +        void setDarkerFactor(int darkerFactor);
    +
    +        QSize sizeHint() const;
    +        QSize minimumSizeHint() const;
    +
    +    public slots:
    +        void toggle();
    +        void turnOn(bool on=true);
    +        void turnOff(bool off=true);
    +        void blink();
    +
    +    private slots:
    +        void blinkToggle();
    +
    +    protected:
    +        void paintEvent(QPaintEvent*);
    +        bool paintCachedPixmap();
    +        int ledWidth() const;
    +        void paintSunken();
    +
    +    private:
    +        class Private;
    +        Private * const m_d;
    +    };
    +
    +    #endif // HLED_H
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-main-cpp.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-main-cpp.html new file mode 100644 index 0000000..c849e5f --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-main-cpp.html @@ -0,0 +1,34 @@ + + + + + + qesp : main.cpp Example File (examples/uartassistant/main.cpp) + + + + +
    Home · All Classes · All Functions ·

    main.cpp Example File

    +examples/uartassistant/main.cpp + +
    +
        #include <QApplication>
    +    #include "dialog.h"
    +
    +    int main(int argc, char *argv[])
    +    {
    +        QApplication a(argc, argv);
    +        Dialog w;
    +        w.show();
    +
    +        return a.exec();
    +    }
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-uartassistant-pro.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-uartassistant-pro.html new file mode 100644 index 0000000..38c3e0f --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant-uartassistant-pro.html @@ -0,0 +1,45 @@ + + + + + + qesp : uartassistant.pro Example File (examples/uartassistant/uartassistant.pro) + + + + +
    Home · All Classes · All Functions ·

    uartassistant.pro Example File

    +examples/uartassistant/uartassistant.pro + +
    +
        #-------------------------------------------------
    +    #
    +    # Project created by QtCreator 2011-11-06T21:37:41
    +    #
    +    #-------------------------------------------------
    +
    +    QT       += core gui
    +    contains(QT_VERSION, ^5\\..*\\..*): QT += widgets
    +
    +    TARGET = uartassistant
    +    TEMPLATE = app
    +
    +    include(../../src/qextserialport.pri)
    +
    +    SOURCES += main.cpp\
    +            dialog.cpp\
    +            hled.cpp
    +
    +    HEADERS  += dialog.h \
    +                hled.h
    +
    +    FORMS    += dialog.ui
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant.html new file mode 100644 index 0000000..4d61337 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/examples-uartassistant.html @@ -0,0 +1,37 @@ + + + + + + + qesp : UartAssistant Demo + + + + +
    Home · All Classes · All Functions ·
  • Examples
  • +
  • UartAssistant Demo
  • +

    UartAssistant Demo

    + + + + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/functions.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/functions.html new file mode 100644 index 0000000..f44b4fd --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/functions.html @@ -0,0 +1,407 @@ + + + + + + + qesp : + + + + +
    Home · All Classes · All Functions ·
  • + + +
    +

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 

    + +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/uartassistant.png b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/uartassistant.png new file mode 100644 index 0000000..1b500b8 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/uartassistant.png differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/used-in-examples/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/used-in-examples/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/images/used-in-examples/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/index.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/index.html new file mode 100644 index 0000000..14b5f51 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/index.html @@ -0,0 +1,99 @@ + + + + + + + qesp : QextSerialPort Manual + + + + +
    Home · All Classes · All Functions ·
  • QextSerialPort Manual
  • +

    QextSerialPort Manual

    + + +
    + +

    Description

    +

    QextSerialPort provides an interface to old fashioned serial ports for Qt-based applications. It currently supports Mac OS X, Windows, Linux, FreeBSD.

    +

    From QextSerialPort 1.2-beta on, license of the project has been changed to MIT.

    +
      +
    • Revision 0.9.x is Qt 2 & 3 compatible.
    • +
    • Revision 1.x.x is Qt 4 compatible.
    • +
    + +

    Classes

    + + +

    Usage

    +

    The package contains a qextserialport.pri file that allows you to integrate the component into programs that use qmake for the build step.

    +

    All you need is adding following line to your qmake project file:

    +
        include(pathToPri/qextserialport.pri)
    + +

    Using QexSerialPort library

    +

    Although QextSerialPort can be directly compiled into your application, You may prefer to use QextSerailPort as an library, which is very easy too.

    +

    1. Write a config.pri file.(read config_example.pri for reference):

    +
      +
    • shared library
    • +
    • static library
    • +
    +

    2. Changed to subdirectory 'buildlib', run

    +
        qmake
    +    make
    +

    shared or static library will be generated.

    +

    3. Add following line to your qmake project file:

    +
        include(pathToPri/qextserialport.pri)
    + +

    Build documents

    +

    Run qdoc3 from the doc directory.

    +
          qdoc3 qextserialport.qdocconf
    +

    Note: qdoc3 has been renamed to qdoc under Qt5.

    + +

    Examples

    + + +

    Resources

    + +

    Nokia(Trolltech)

    + + +

    MSDN

    + + +

    TLDP

    + + +

    Other

    + +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings-members.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings-members.html new file mode 100644 index 0000000..d476cdc --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings-members.html @@ -0,0 +1,30 @@ + + + + + + + qesp : List of All Members for PortSettings + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • PortSettings
  • +

    List of All Members for PortSettings

    +

    This is the complete list of members for PortSettings, including inherited members.

    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings.html new file mode 100644 index 0000000..cbc45b3 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/portsettings.html @@ -0,0 +1,47 @@ + + + + + + + qesp : PortSettings Class Reference + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • PortSettings
  • + +

    PortSettings Class Reference

    + +

    The PortSettings class contain port settings More...

    + +
        #include <PortSettings>
    + + +
    +

    Detailed Description

    +

    The PortSettings class contain port settings

    +

    Structure to contain port settings.

    +
        BaudRateType BaudRate;
    +    DataBitsType DataBits;
    +    ParityType Parity;
    +    StopBitsType StopBits;
    +    FlowType FlowControl;
    +    long Timeout_Millisec;
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.index b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.index new file mode 100644 index 0000000..5c6285b --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.index @@ -0,0 +1,225 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qch b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qch new file mode 100644 index 0000000..ad23965 Binary files /dev/null and b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qch differ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qhp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qhp new file mode 100644 index 0000000..e11fb41 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qesp.qhp @@ -0,0 +1,155 @@ + + + com.google.code.qextserialport.120 + qdoc + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + examples-uartassistant-hled-h.html + examples-uartassistant-dialog-ui.html + examples-uartassistant-dialog-cpp.html + examples-qespta-qesptest-cpp.html + examples-uartassistant-main-cpp.html + examples-enumerator.html + examples-qespta-main-cpp.html + index.html + examples-qespta-qespta-pro.html + examples-qespta-qesptest-h.html + examples-uartassistant-hled-cpp.html + qextserialenumerator.html + examples-qespta-mainwindow-cpp.html + examples-enumerator-main-cpp.html + qextserialport.html + portsettings.html + examples-qespta.html + examples-uartassistant-dialog-h.html + images/uartassistant.png + examples-uartassistant-uartassistant-pro.html + examples-qespta-mainwindow-h.html + examples-enumerator-enumerator-pro.html + examples-uartassistant.html + qextportinfo.html + examples-qespta-messagewindow-h.html + examples-qespta-messagewindow-cpp.html + style/style.css + images/uartassistant.png + + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo-members.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo-members.html new file mode 100644 index 0000000..9ae94dd --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo-members.html @@ -0,0 +1,30 @@ + + + + + + + qesp : List of All Members for QextPortInfo + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextPortInfo
  • +

    List of All Members for QextPortInfo

    +

    This is the complete list of members for QextPortInfo, including inherited members.

    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo.html new file mode 100644 index 0000000..8769486 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextportinfo.html @@ -0,0 +1,47 @@ + + + + + + + qesp : QextPortInfo Class Reference + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextPortInfo
  • + +

    QextPortInfo Class Reference

    + +

    The QextPortInfo class containing port information. More...

    + +
        #include <QextPortInfo>
    + + +
    +

    Detailed Description

    +

    The QextPortInfo class containing port information.

    +

    Structure containing port information.

    +
        QString portName;   ///< Port name.
    +    QString physName;   ///< Physical name.
    +    QString friendName; ///< Friendly name.
    +    QString enumName;   ///< Enumerator name.
    +    int vendorID;       ///< Vendor ID.
    +    int productID;      ///< Product ID
    +
    + +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator-members.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator-members.html new file mode 100644 index 0000000..9736a56 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator-members.html @@ -0,0 +1,82 @@ + + + + + + + qesp : List of All Members for QextSerialEnumerator + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextSerialEnumerator
  • +

    List of All Members for QextSerialEnumerator

    +

    This is the complete list of members for QextSerialEnumerator, including inherited members.

    + + +
    +
    +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator.html new file mode 100644 index 0000000..4830fb0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialenumerator.html @@ -0,0 +1,133 @@ + + + + + + + qesp : QextSerialEnumerator Class Reference + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextSerialEnumerator
  • + +

    QextSerialEnumerator Class Reference

    + +

    The QextSerialEnumerator class provides list of ports available in the system. More...

    + +
        #include <QextSerialEnumerator>

    Inherits: QObject.

    + + +

    Public Functions

    + + + + +
    QextSerialEnumerator ( QObject * parent = 0 )
    ~QextSerialEnumerator ()
    void setUpNotifications ()
    +
      +
    • 29 public functions inherited from QObject
    • +
    + +

    Signals

    + + + +
    void deviceDiscovered ( const QextPortInfo & info )
    void deviceRemoved ( const QextPortInfo & info )
    +
      +
    • 1 signal inherited from QObject
    • +
    + +

    Static Public Members

    + + +
    QList<QextPortInfo> getPorts ()
    +
      +
    • 6 static public members inherited from QObject
    • +
    +

    Additional Inherited Members

    +
      +
    • 1 property inherited from QObject
    • +
    • 1 public slot inherited from QObject
    • +
    • 1 public variable inherited from QObject
    • +
    • 8 protected functions inherited from QObject
    • +
    • 2 protected variables inherited from QObject
    • +
    + + +
    +

    Detailed Description

    +

    The QextSerialEnumerator class provides list of ports available in the system.

    + +

    Usage

    +

    To poll the system for a list of connected devices, simply use getPorts(). Each QextPortInfo structure will populated with information about the corresponding device.

    +

    Example

    +
        QList<QextPortInfo> ports = QextSerialEnumerator::getPorts();
    +    foreach( QextPortInfo port, ports ) {
    +        // inspect port...
    +    }
    +

    To enable event-driven notification of device connection events, first call setUpNotifications() and then connect to the deviceDiscovered() and deviceRemoved() signals. Event-driven behavior is currently available only on Windows and OS X.

    +

    Example

    +
        QextSerialEnumerator* enumerator = new QextSerialEnumerator();
    +    connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)),
    +               myClass, SLOT(onDeviceDiscovered(const QextPortInfo &)));
    +    connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)),
    +               myClass, SLOT(onDeviceRemoved(const QextPortInfo &)));
    + +

    Credits

    +

    Windows implementation is based on Zach Gorman's work from The Code Project (http://www.codeproject.com/system/setupdi.asp).

    +

    OS X implementation, see http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html

    +

    author Michal Policht, Liam Staskawicz

    +
    + +
    +

    Member Function Documentation

    + +

    QextSerialEnumerator::QextSerialEnumerator ( QObject * parent = 0 )

    +

    Constructs a QextSerialEnumerator object with the given parent.

    + + +

    QextSerialEnumerator::~QextSerialEnumerator ()

    +

    Destructs the QextSerialEnumerator object.

    + + +

    void QextSerialEnumerator::deviceDiscovered ( const QextPortInfo & info ) [signal]

    +

    A new device has been connected to the system.

    +

    setUpNotifications() must be called first to enable event-driven device notifications. Currently only implemented on Windows and OS X.

    +

    info The device that has been discovered.

    + + +

    void QextSerialEnumerator::deviceRemoved ( const QextPortInfo & info ) [signal]

    +

    A device has been disconnected from the system.

    +

    setUpNotifications() must be called first to enable event-driven device notifications. Currently only implemented on Windows and OS X.

    +

    info The device that was disconnected.

    + + +

    QList<QextPortInfo> QextSerialEnumerator::getPorts () [static]

    +

    Get list of ports.

    +

    return list of ports currently available in the system.

    + + +

    void QextSerialEnumerator::setUpNotifications ()

    +

    Enable event-driven notifications of board discovery/removal.

    + +
    +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport-members.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport-members.html new file mode 100644 index 0000000..16d6681 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport-members.html @@ -0,0 +1,147 @@ + + + + + + + qesp : List of All Members for QextSerialPort + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextSerialPort
  • +

    List of All Members for QextSerialPort

    +

    This is the complete list of members for QextSerialPort, including inherited members.

    + + +
    +
    +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport.html b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport.html new file mode 100644 index 0000000..a52ebb7 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/qextserialport.html @@ -0,0 +1,425 @@ + + + + + + + qesp : QextSerialPort Class Reference + + + + +
    Home · All Classes · All Functions ·
  • Modules
  • +
  • QextSerialPort
  • + +

    QextSerialPort Class Reference

    + +

    The QextSerialPort class encapsulates a serial port on both POSIX and Windows systems. More...

    + +
        #include <QextSerialPort>

    Inherits: QIODevice.

    + + +

    Public Types

    + + +
    enum QueryMode { Polling, EventDriven }
    + +

    Public Functions

    + + + + + + + + + + + + + + + + + + + +
    QextSerialPort ( QueryMode mode = EventDriven, QObject * parent = 0 )
    QextSerialPort ( const QString & name, QueryMode mode = EventDriven, QObject * parent = 0 )
    QextSerialPort ( const PortSettings & settings, QueryMode mode = EventDriven, QObject * parent = 0 )
    QextSerialPort ( const QString & name, const PortSettings & settings, QueryMode mode = EventDriven, QObject * parent = 0 )
    ~QextSerialPort ()
    BaudRateType baudRate () const
    DataBitsType dataBits () const
    QString errorString ()
    FlowType flowControl () const
    void flush ()
    ulong lastError () const
    ulong lineStatus ()
    bool open ( OpenMode mode )
    ParityType parity () const
    QString portName () const
    QueryMode queryMode () const
    QByteArray readAll ()
    StopBitsType stopBits () const
    + +

    Reimplemented Public Functions

    + + + + +
    virtual qint64 bytesAvailable () const
    virtual void close ()
    virtual bool isSequential () const
    +
      +
    • 33 public functions inherited from QIODevice
    • +
    • 29 public functions inherited from QObject
    • +
    + +

    Public Slots

    + + + + + + + + + + + +
    void setBaudRate ( BaudRateType baudRate )
    void setDataBits ( DataBitsType dataBits )
    void setDtr ( bool set = true )
    void setFlowControl ( FlowType flow )
    void setParity ( ParityType parity )
    void setPortName ( const QString & name )
    void setQueryMode ( QueryMode mode )
    void setRts ( bool set = true )
    void setStopBits ( StopBitsType stopBits )
    void setTimeout ( long millisec )
    +
      +
    • 1 public slot inherited from QObject
    • +
    + +

    Signals

    + + +
    void dsrChanged ( bool status )
    + + +

    Reimplemented Protected Functions

    + + + +
    virtual qint64 readData ( char * data, qint64 maxSize )
    virtual qint64 writeData ( const char * data, qint64 maxSize )
    +
      +
    • 5 protected functions inherited from QIODevice
    • +
    • 8 protected functions inherited from QObject
    • +
    +

    Additional Inherited Members

    +
      +
    • 1 property inherited from QObject
    • +
    • 1 public variable inherited from QObject
    • +
    • 6 static public members inherited from QObject
    • +
    • 5 protected functions inherited from QIODevice
    • +
    • 8 protected functions inherited from QObject
    • +
    • 2 protected variables inherited from QObject
    • +
    + + +
    +

    Detailed Description

    +

    The QextSerialPort class encapsulates a serial port on both POSIX and Windows systems.

    + +

    Usage

    +

    QextSerialPort offers both a polling and event driven API. Event driven is typically easier to use, since you never have to worry about checking for new data.

    +

    Example

    +
        QextSerialPort* port = new QextSerialPort("COM1");
    +    connect(port, SIGNAL(readyRead()), myClass, SLOT(onDataAvailable()));
    +    port->open();
    +
    +    void MyClass::onDataAvailable() {
    +        int avail = port->bytesAvailable();
    +        if( avail > 0 ) {
    +            QByteArray usbdata;
    +            usbdata.resize(avail);
    +            int read = port->read(usbdata.data(), usbdata.size());
    +            if( read > 0 ) {
    +                processNewData(usbdata);
    +            }
    +        }
    +    }
    + +

    Compatibility

    +

    The user will be notified of errors and possible portability conflicts at run-time by default.

    +

    For example, if a application has used BAUD1800, when it is runing under unix, you will get following message.

    +
        QextSerialPort Portability Warning: Windows does not support baudRate:1800
    +

    This behavior can be turned off by defining macro QESP_NO_WARN (to turn off all warnings) or QESP_NO_PORTABILITY_WARN (to turn off portability warnings) in the project.

    +

    Author: Stefan Sander, Michal Policht, Brandon Fosdick, Liam Staskawicz, Debao Zhang

    +
    + +
    +

    Member Type Documentation

    + +

    enum QextSerialPort::QueryMode

    +

    This enum type specifies query mode used in a serial port:

    + + + +
    ConstantValueDescription
    QextSerialPort::Polling0asynchronously read and write
    QextSerialPort::EventDriven1synchronously read and write
    + +
    +
    +

    Member Function Documentation

    + +

    QextSerialPort::QextSerialPort ( QueryMode mode = EventDriven, QObject * parent = 0 )

    +

    Default constructor. Note that the name of the device used by a QextSerialPort is dependent on your OS. Possible naming conventions and their associated OS are:

    +
        OS Constant       Used By         Naming Convention
    +    -------------     -------------   ------------------------
    +    Q_OS_WIN          Windows         COM1, COM2
    +    Q_OS_IRIX         SGI/IRIX        /dev/ttyf1, /dev/ttyf2
    +    Q_OS_HPUX         HP-UX           /dev/tty1p0, /dev/tty2p0
    +    Q_OS_SOLARIS      SunOS/Slaris    /dev/ttya, /dev/ttyb
    +    Q_OS_OSF          Digital UNIX    /dev/tty01, /dev/tty02
    +    Q_OS_FREEBSD      FreeBSD         /dev/ttyd0, /dev/ttyd1
    +    Q_OS_OPENBSD      OpenBSD         /dev/tty00, /dev/tty01
    +    Q_OS_LINUX        Linux           /dev/ttyS0, /dev/ttyS1
    +    <none>                            /dev/ttyS0, /dev/ttyS1
    +

    This constructor assigns the device name to the name of the first port on the specified system. See the other constructors if you need to open a different port. Default mode is EventDriven. As a subclass of QObject, parent can be specified.

    + + +

    QextSerialPort::QextSerialPort ( const QString & name, QueryMode mode = EventDriven, QObject * parent = 0 )

    +

    Constructs a serial port attached to the port specified by name. name is the name of the device, which is windowsystem-specific, e.g."COM1" or "/dev/ttyS0". mode

    + + +

    QextSerialPort::QextSerialPort ( const PortSettings & settings, QueryMode mode = EventDriven, QObject * parent = 0 )

    +

    Constructs a port with default name and specified settings.

    + + +

    QextSerialPort::QextSerialPort ( const QString & name, const PortSettings & settings, QueryMode mode = EventDriven, QObject * parent = 0 )

    +

    Constructs a port with specified name , mode and settings.

    + + +

    QextSerialPort::~QextSerialPort ()

    +

    Destructs the QextSerialPort object.

    + + +

    BaudRateType QextSerialPort::baudRate () const

    +

    Returns the baud rate of the serial port. For a list of possible return values see the definition of the enum BaudRateType.

    +

    See also setBaudRate().

    + + +

    qint64 QextSerialPort::bytesAvailable () const [virtual]

    +

    Reimplemented from QIODevice::bytesAvailable().

    +

    Returns the number of bytes waiting in the port's receive queue. This function will return 0 if the port is not currently open, or -1 on error.

    + + +

    void QextSerialPort::close () [virtual]

    +

    Reimplemented from QIODevice::close().

    +

    Closes a serial port. This function has no effect if the serial port associated with the class is not currently open.

    + + +

    DataBitsType QextSerialPort::dataBits () const

    +

    Returns the number of data bits used by the port. For a list of possible values returned by this function, see the definition of the enum DataBitsType.

    +

    See also setDataBits().

    + + +

    void QextSerialPort::dsrChanged ( bool status ) [signal]

    +

    This signal is emitted whenever dsr line has changed its state. You may use this signal to check if device is connected.

    +

    status true when DSR signal is on, false otherwise.

    + + +

    QString QextSerialPort::errorString ()

    +

    Returns a human-readable description of the last device error that occurred.

    + + +

    FlowType QextSerialPort::flowControl () const

    +

    Returns the type of flow control used by the port. For a list of possible values returned by this function, see the definition of the enum FlowType.

    +

    See also setFlowControl().

    + + +

    void QextSerialPort::flush ()

    +

    Flushes all pending I/O to the serial port. This function has no effect if the serial port associated with the class is not currently open.

    + + +

    bool QextSerialPort::isSequential () const [virtual]

    +

    Reimplemented from QIODevice::isSequential().

    +

    Returns true if device is sequential, otherwise returns false. Serial port is sequential device so this function always returns true. Check QIODevice::isSequential() documentation for more information.

    + + +

    ulong QextSerialPort::lastError () const

    +

    Return the error number, or 0 if no error occurred.

    + + +

    ulong QextSerialPort::lineStatus ()

    +

    Returns the line status as stored by the port function. This function will retrieve the states of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned long with specific bits indicating which lines are high. The following constants should be used to examine the states of individual lines:

    +
        Mask        Line
    +    ------      ----
    +    LS_CTS      CTS
    +    LS_DSR      DSR
    +    LS_DCD      DCD
    +    LS_RI       RI
    +    LS_RTS      RTS (POSIX only)
    +    LS_DTR      DTR (POSIX only)
    +    LS_ST       Secondary TXD (POSIX only)
    +    LS_SR       Secondary RXD (POSIX only)
    +

    This function will return 0 if the port associated with the class is not currently open.

    + + +

    bool QextSerialPort::open ( OpenMode mode )

    +

    Opens a serial port and sets its OpenMode to mode. Note that this function does not specify which device to open. Returns true if successful; otherwise returns false.This function has no effect if the port associated with the class is already open. The port is also configured to the current settings, as stored in the Settings structure.

    + + +

    ParityType QextSerialPort::parity () const

    +

    Returns the type of parity used by the port. For a list of possible values returned by this function, see the definition of the enum ParityType.

    +

    See also setParity().

    + + +

    QString QextSerialPort::portName () const

    +

    Returns the name set by setPortName().

    +

    See also setPortName().

    + + +

    QueryMode QextSerialPort::queryMode () const

    +

    Get query mode.

    +

    See also setQueryMode().

    + + +

    QByteArray QextSerialPort::readAll ()

    +

    Reads all available data from the device, and returns it as a QByteArray. This function has no way of reporting errors; returning an empty QByteArray() can mean either that no data was currently available for reading, or that an error occurred.

    + + +

    qint64 QextSerialPort::readData ( char * data, qint64 maxSize ) [virtual protected]

    +

    Reimplemented from QIODevice::readData().

    +

    Reads a block of data from the serial port. This function will read at most maxlen bytes from the serial port and place them in the buffer pointed to by data. Return value is the number of bytes actually read, or -1 on error.

    +

    Warning: before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

    + + +

    void QextSerialPort::setBaudRate ( BaudRateType baudRate ) [slot]

    +

    Sets the baud rate of the serial port to baudRate. Note that not all rates are applicable on all platforms. The following table shows translations of the various baud rate constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * are speeds that are usable on both Windows and POSIX.

    +
        RATE          Windows Speed   POSIX Speed
    +    -----------   -------------   -----------
    +     BAUD50                   X          50
    +     BAUD75                   X          75
    +    *BAUD110                110         110
    +     BAUD134                  X         134.5
    +     BAUD150                  X         150
    +     BAUD200                  X         200
    +    *BAUD300                300         300
    +    *BAUD600                600         600
    +    *BAUD1200              1200        1200
    +     BAUD1800                 X        1800
    +    *BAUD2400              2400        2400
    +    *BAUD4800              4800        4800
    +    *BAUD9600              9600        9600
    +     BAUD14400            14400           X
    +    *BAUD19200            19200       19200
    +    *BAUD38400            38400       38400
    +     BAUD56000            56000           X
    +    *BAUD57600            57600       57600
    +     BAUD76800                X       76800
    +    *BAUD115200          115200      115200
    +     BAUD128000          128000           X
    +     BAUD230400               X      230400
    +     BAUD256000          256000           X
    +     BAUD460800               X      460800
    +     BAUD500000               X      500000
    +     BAUD576000               X      576000
    +     BAUD921600               X      921600
    +     BAUD1000000              X     1000000
    +     BAUD1152000              X     1152000
    +     BAUD1500000              X     1500000
    +     BAUD2000000              X     2000000
    +     BAUD2500000              X     2500000
    +     BAUD3000000              X     3000000
    +     BAUD3500000              X     3500000
    +     BAUD4000000              X     4000000
    +

    See also baudRate().

    + + +

    void QextSerialPort::setDataBits ( DataBitsType dataBits ) [slot]

    +

    Sets the number of data bits used by the serial port to dataBits. Possible values of dataBits are:

    +
        DATA_5      5 data bits
    +    DATA_6      6 data bits
    +    DATA_7      7 data bits
    +    DATA_8      8 data bits
    +

    note: This function is subject to the following restrictions:

    +
      +
    • 5 data bits cannot be used with 2 stop bits.
    • +
    • 1.5 stop bits can only be used with 5 data bits.
    • +
    • 8 data bits cannot be used with space parity on POSIX systems.
    • +
    +

    See also dataBits().

    + + +

    void QextSerialPort::setDtr ( bool set = true ) [slot]

    +

    Sets DTR line to the requested state (set default to high). This function will have no effect if the port associated with the class is not currently open.

    + + +

    void QextSerialPort::setFlowControl ( FlowType flow ) [slot]

    +

    Sets the flow control used by the port to flow. Possible values of flow are:

    +
        FLOW_OFF            No flow control
    +    FLOW_HARDWARE       Hardware (RTS/CTS) flow control
    +    FLOW_XONXOFF        Software (XON/XOFF) flow control
    +

    See also flowControl().

    + + +

    void QextSerialPort::setParity ( ParityType parity ) [slot]

    +

    Sets the parity associated with the serial port to parity. The possible values of parity are:

    +
        PAR_SPACE       Space Parity
    +    PAR_MARK        Mark Parity
    +    PAR_NONE        No Parity
    +    PAR_EVEN        Even Parity
    +    PAR_ODD         Odd Parity
    +

    See also parity().

    + + +

    void QextSerialPort::setPortName ( const QString & name ) [slot]

    +

    Sets the name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0".

    +

    See also portName().

    + + +

    void QextSerialPort::setQueryMode ( QueryMode mode ) [slot]

    +

    Set desired serial communication handling style. You may choose from polling or event driven approach. This function does nothing when port is open; to apply changes port must be reopened.

    +

    In event driven approach read() and write() functions are acting asynchronously. They return immediately and the operation is performed in the background, so they doesn't freeze the calling thread. To determine when operation is finished, QextSerialPort runs separate thread and monitors serial port events. Whenever the event occurs, adequate signal is emitted.

    +

    When polling is set, read() and write() are acting synchronously. Signals are not working in this mode and some functions may not be available. The advantage of polling is that it generates less overhead due to lack of signals emissions and it doesn't start separate thread to monitor events.

    +

    Generally event driven approach is more capable and friendly, although some applications may need as low overhead as possible and then polling comes.

    +

    mode query mode.

    +

    See also queryMode().

    + + +

    void QextSerialPort::setRts ( bool set = true ) [slot]

    +

    Sets RTS line to the requested state set (high by default). This function will have no effect if the port associated with the class is not currently open.

    + + +

    void QextSerialPort::setStopBits ( StopBitsType stopBits ) [slot]

    +

    Sets the number of stop bits used by the serial port to stopBits. Possible values of stopBits are:

    +
        STOP_1      1 stop bit
    +    STOP_1_5    1.5 stop bits
    +    STOP_2      2 stop bits
    +

    note: This function is subject to the following restrictions:

    +
      +
    • 2 stop bits cannot be used with 5 data bits.
    • +
    • 1.5 stop bits cannot be used with 6 or more data bits.
    • +
    • POSIX does not support 1.5 stop bits.
    • +
    +

    See also stopBits().

    + + +

    void QextSerialPort::setTimeout ( long millisec ) [slot]

    +

    For Unix:

    +

    Sets the read and write timeouts for the port to millisec milliseconds. Note that this is a per-character timeout, i.e. the port will wait this long for each individual character, not for the whole read operation. This timeout also applies to the bytesWaiting() function.

    +

    note: POSIX does not support millisecond-level control for I/O timeout values. Any timeout set using this function will be set to the next lowest tenth of a second for the purposes of detecting read or write timeouts. For example a timeout of 550 milliseconds will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and writing the port. However millisecond-level control is allowed by the select() system call, so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for the purpose of detecting available bytes in the read buffer.

    +

    For Windows:

    +

    Sets the read and write timeouts for the port to millisec milliseconds. Setting 0 indicates that timeouts are not used for read nor write operations; however read() and write() functions will still block. Set -1 to provide non-blocking behaviour (read() and write() will return immediately).

    +

    note: this function does nothing in event driven mode.

    + + +

    StopBitsType QextSerialPort::stopBits () const

    +

    Returns the number of stop bits used by the port. For a list of possible return values, see the definition of the enum StopBitsType.

    +

    See also setStopBits().

    + + +

    qint64 QextSerialPort::writeData ( const char * data, qint64 maxSize ) [virtual protected]

    +

    Reimplemented from QIODevice::writeData().

    +

    Writes a block of data to the serial port. This function will write len bytes from the buffer pointed to by data to the serial port. Return value is the number of bytes actually written, or -1 on error.

    +

    Warning: before calling this function ensure that serial port associated with this class is currently open (use isOpen() function to check if port is open).

    + +
    +


    + + + + +
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/scripts/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/scripts/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/scripts/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/style.css b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/style.css new file mode 100644 index 0000000..df84049 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/html/style/style.css @@ -0,0 +1,137 @@ +a:link, a:visited { + color: #00732F; + text-decoration: none; + font-weight: bold; +} + +body { + font: normal 400 14px/1.2 Arial; + margin-top: 85px; +} + +h1 { + margin: 0; +} + +h2 { + font: 500 20px/1.2 Arial; +} + +h3.fn, span.fn { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + word-spacing: 3px; + padding: 3px 5px; +} + +table, pre { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + font-size: 12px; + line-height: 1.2; + margin-bottom: 25px; + margin-left: 15px; +} + +table td { + padding: 3px 15px 3px 20px; +} + +table tr.even { + background-color: white; + color: #66666E; +} + +table tr.odd { + background-color: #F6F6F6; + color: #66666E; +} + +li { + margin-bottom: 10px; + padding-left: 12px; +} + +.cpp { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.footer { + margin-top: 50px; +} + +.memItemLeft { + padding-right: 3px; +} + +.memItemRight { + padding: 3px 15px 3px 0; +} + +.qml { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.qmldefault { + padding-left: 5px; + float: right; + color: red; +} + +.qmlreadonly { + padding-left: 5px; + float: right; + color: #254117; +} + +.rightAlign { + padding: 3px 5px 3px 10px; + text-align: right; +} + +.title { + background-color: white; + color: #44A51C; + font-family: Verdana; + font-size: 35px; + font-weight: normal; + left: 0; + padding-bottom: 5px; + padding-left: 16px; + padding-top: 20px; + position: absolute; + right: 0; + top: 0; +} + +.toc { + float: right; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #DDD; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; + height: auto; + width: 200px; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/index.qdoc b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/index.qdoc new file mode 100644 index 0000000..32ca7a0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/index.qdoc @@ -0,0 +1,109 @@ +/*! + \page index.html + \title QextSerialPort Manual + + \section1 Description + QextSerialPort provides an interface to old fashioned serial ports for + Qt-based applications. It currently supports Mac OS X, Windows, Linux, FreeBSD. + + From QextSerialPort 1.2-beta on, license of the project has been changed to MIT. + + \list + \o Revision 0.9.x is Qt 2 & 3 compatible. + \o Revision 1.x.x is Qt 4 compatible. + \endlist + + + \section1 Classes + \list + \o \l QextSerialPort encapsulates a serial port on both POSIX and Windows systems. + \o \l QextSerialEnumerator enumerates ports currently available in the system. + \endlist + + \section1 Usage + The package contains a qextserialport.pri file that allows you to integrate the + component into programs that use qmake for the build step. + + All you need is adding following line to your qmake project file: + \code + include(pathToPri/qextserialport.pri) + \endcode + + \section2 Using QexSerialPort library + Although QextSerialPort can be directly compiled into your application, You may prefer + to use QextSerailPort as an library, which is very easy too. + + 1. Write a config.pri file.(read config_example.pri for reference): + + \list + \o shared library + \o static library + \endlist + + 2. Changed to subdirectory 'buildlib', run + \code + qmake + make + \endcode + shared or static library will be generated. + + 3. Add following line to your qmake project file: + \code + include(pathToPri/qextserialport.pri) + \endcode + + \section2 Build documents + Run qdoc3 from the doc directory. + \code + qdoc3 qextserialport.qdocconf + \endcode + Note: qdoc3 has been renamed to qdoc under Qt5. + + \section1 Examples + \list + \o \l examples/enumerator + \o \l examples/qespta + \o \l examples/uartassistant + \endlist + + \section1 Resources + \section2 Nokia(Trolltech) + \list + \o \l {http://doc.trolltech.com/qq/qq12-iodevice.html} {Writing a Custom I/O Device} + \o \l {http://doc.trolltech.com/3.3/qiodevice.html} {Qt 3.3: QIODevice Class Reference} + \o \l {http://doc.trolltech.com/4.7/qiodevice.html} {Qt 4.7: QIODevice Class Reference} + \endlist + \section2 MSDN + \list + \o \l {http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/communications_resources.asp} {Communications Resources} + \o \l {http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/about_communications_resources.asp} {About Communications Resources} + \o \l {http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/using_communications_resources.asp}{Using Communications Resources} + \o \l {http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/communications_functions.asp} {Communications Functions} + \o \l {http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/communications_structures.asp} {Communications Structures} + \endlist + \section2 TLDP + \list + \o \l {http://www.tldp.org/HOWTO/Serial-HOWTO.html}{Serial HOWTO} + \o \l {http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/}{Serial Programming HOWTO} + \endlist + \section2 Other + \list + \o \l {http://www.easysw.com/~mike/serial/serial.html} {Serial Programming Guide for POSIX Operating Systems} + \endlist + +*/ + +/*! + \page classes.html + \generatelist annotatedclasses + */ + +/*! + \page functions.html + \generatelist functionindex +*/ + +/*! + \page all-examples.html +*/ + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/qextserialport.qdocconf b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/qextserialport.qdocconf new file mode 100644 index 0000000..4fdff53 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/qextserialport.qdocconf @@ -0,0 +1,54 @@ +# Run qdoc3 from the directory that contains this file. +project = qesp +description = QextSerialPort Reference Documentation +url = http://code.google.com/p/qextserialport + +outputencoding = UTF-8 +language = Cpp + +#Paths are relative to the location of this file +headerdirs = . ../src +sourcedirs = . ../src +exampledirs = ../examples .. +imagedirs = ./examples/images images + +Cpp.ignoretokens = QEXTSERIALPORT_EXPORT + +indexes = $QTDIR/doc/html/qt.index + +qhp.projects = qesp +qhp.qesp.file = qesp.qhp +qhp.qesp.namespace = com.google.code.qextserialport.120 +qhp.qesp.virtualFolder = qdoc +qhp.qesp.indexTitle = QextSerialPort Reference Documentation +qhp.qesp.indexRoot = +qhp.qesp.extraFiles = style/style.css + + +#------------------------------------------------------------------ +outputdir = html +outputformats = HTML + +headers.fileextensions = "*.h" +sources.fileextensions = "*.cpp *.qdoc" + +HTML.templatedir = . +HTML.stylesheets = style/style.css + +HTML.headerstyles = " \n" +HTML.endheader = "\n" + +HTML.postheader = "\n" \ + "\n" \ + "
    " \ + "Home ·" \ + " All Classes ·" \ + " All Functions ·" \ + "
    " + +HTML.footer = "


    \n" \ + "\n" \ + "\n" \ + "\n" \ + "\n" \ + "
    Copyright © 2000-2012QextSerialPort Project
    QextSerialPort Manual
    " diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/readme.txt b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/readme.txt new file mode 100644 index 0000000..fe7ee32 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/readme.txt @@ -0,0 +1,35 @@ +Note: + + If you are using qextserialport-XXX.tar.gz, the qesp.qch and + html files have been provided. + + Open the file "html/index.html" using your web browser. + Or integrated the "html/qesp.qch" into your QtCreator. + + +== How to generate help files? == + +Simply run following commands at toplevel directory. + qmake + make docs + +Or run the following command at this directory + qdoc3 qextserialport.qdocconf + +Then a folder called "html" will be generated. +Open the file "html/index.html" using your web browser. + +== How to integrated into Qt Creator or Qt Assistant? == + +Once the html files are generated. run following commands + cd doc/html + qhelpgenerator qesp.qhp + +A file called "qesp.qch" will be generated. + +For Qt Assistant: + Edit ==> Preferences ==> Documentations ==> Add... + +For Qt Creator + Tools ==> Options ==> Help ==> Documentations ==> Add... + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/style.css b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/style.css new file mode 100644 index 0000000..df84049 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/doc/style/style.css @@ -0,0 +1,137 @@ +a:link, a:visited { + color: #00732F; + text-decoration: none; + font-weight: bold; +} + +body { + font: normal 400 14px/1.2 Arial; + margin-top: 85px; +} + +h1 { + margin: 0; +} + +h2 { + font: 500 20px/1.2 Arial; +} + +h3.fn, span.fn { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border-width: 1px; + border-style: solid; + border-color: #E6E6E6; + word-spacing: 3px; + padding: 3px 5px; +} + +table, pre { + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #E6E6E6; + border-collapse: separate; + font-size: 12px; + line-height: 1.2; + margin-bottom: 25px; + margin-left: 15px; +} + +table td { + padding: 3px 15px 3px 20px; +} + +table tr.even { + background-color: white; + color: #66666E; +} + +table tr.odd { + background-color: #F6F6F6; + color: #66666E; +} + +li { + margin-bottom: 10px; + padding-left: 12px; +} + +.cpp { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.footer { + margin-top: 50px; +} + +.memItemLeft { + padding-right: 3px; +} + +.memItemRight { + padding: 3px 15px 3px 0; +} + +.qml { + display: block; + margin: 10; + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + padding: 20px 0 20px 0; +} + +.qmldefault { + padding-left: 5px; + float: right; + color: red; +} + +.qmlreadonly { + padding-left: 5px; + float: right; + color: #254117; +} + +.rightAlign { + padding: 3px 5px 3px 10px; + text-align: right; +} + +.title { + background-color: white; + color: #44A51C; + font-family: Verdana; + font-size: 35px; + font-weight: normal; + left: 0; + padding-bottom: 5px; + padding-left: 16px; + padding-top: 20px; + position: absolute; + right: 0; + top: 0; +} + +.toc { + float: right; + -moz-border-radius: 7px 7px 7px 7px; + -webkit-border-radius: 7px 7px 7px 7px; + border-radius: 7px 7px 7px 7px; + background-color: #F6F6F6; + border: 1px solid #DDD; + margin: 0 20px 10px 10px; + padding: 20px 15px 20px 20px; + height: auto; + width: 200px; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/enumerator.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/enumerator.pro new file mode 100644 index 0000000..7eed925 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/enumerator.pro @@ -0,0 +1,6 @@ +TEMPLATE = app +DEPENDPATH += . +CONFIG += console +include(../../src/qextserialport.pri) +SOURCES += main.cpp + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/main.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/main.cpp new file mode 100644 index 0000000..96b011f --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/enumerator/main.cpp @@ -0,0 +1,26 @@ +/** + * @file main.cpp + * @brief Main file. + * @author Micha? Policht + */ + +#include "qextserialenumerator.h" +#include +#include +//! [0] +int main() +{ + QList ports = QextSerialEnumerator::getPorts(); + qDebug() << "List of ports:"; + for (int i = 0; i < ports.size(); i++) { + qDebug() << "port name:" << ports.at(i).portName; + qDebug() << "friendly name:" << ports.at(i).friendName; + qDebug() << "physical name:" << ports.at(i).physName; + qDebug() << "enumerator name:" << ports.at(i).enumName; + qDebug() << "vendor ID:" << QString::number(ports.at(i).vendorID, 16); + qDebug() << "product ID:" << QString::number(ports.at(i).productID, 16); + qDebug() << "==================================="; + } + return 0; +} +//! [0] diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.cpp new file mode 100644 index 0000000..d281441 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.cpp @@ -0,0 +1,43 @@ + +#include "PortListener.h" +#include + +PortListener::PortListener(const QString & portName) +{ + qDebug() << "hi there"; + this->port = new QextSerialPort(portName, QextSerialPort::EventDriven); + port->setBaudRate(BAUD9600); + port->setFlowControl(FLOW_OFF); + port->setParity(PAR_NONE); + port->setDataBits(DATA_8); + port->setStopBits(STOP_2); + + if (port->open(QIODevice::ReadWrite) == true) { + connect(port, SIGNAL(readyRead()), this, SLOT(onReadyRead())); + connect(port, SIGNAL(dsrChanged(bool)), this, SLOT(onDsrChanged(bool))); + if (!(port->lineStatus() & LS_DSR)) + qDebug() << "warning: device is not turned on"; + qDebug() << "listening for data on" << port->portName(); + } + else { + qDebug() << "device failed to open:" << port->errorString(); + } +} + +void PortListener::onReadyRead() +{ + QByteArray bytes; + int a = port->bytesAvailable(); + bytes.resize(a); + port->read(bytes.data(), bytes.size()); + qDebug() << "bytes read:" << bytes.size(); + qDebug() << "bytes:" << bytes; +} + +void PortListener::onDsrChanged(bool status) +{ + if (status) + qDebug() << "device was turned on"; + else + qDebug() << "device was turned off"; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.h new file mode 100644 index 0000000..a15635c --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/PortListener.h @@ -0,0 +1,26 @@ + + + +#ifndef PORTLISTENER_H_ +#define PORTLISTENER_H_ + +#include +#include "qextserialport.h" + +class PortListener : public QObject +{ +Q_OBJECT +public: + PortListener(const QString & portName); + +private: + QextSerialPort *port; + +private slots: + void onReadyRead(); + void onDsrChanged(bool status); + +}; + + +#endif /*PORTLISTENER_H_*/ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/event.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/event.pro new file mode 100644 index 0000000..585bbb9 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/event.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +DEPENDPATH += . +CONFIG += console +include(../../src/qextserialport.pri) + +SOURCES += main.cpp PortListener.cpp +HEADERS += PortListener.h diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/main.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/main.cpp new file mode 100644 index 0000000..976040b --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/event/main.cpp @@ -0,0 +1,19 @@ +/** + * @file main.cpp + * @brief Main file. + * @author Michal Policht + */ + +#include +#include "PortListener.h" + +int main(int argc, char *argv[]) +{ + QCoreApplication app(argc, argv); + + QString portName = QLatin1String("COM1"); // update this to use your port of choice + PortListener listener(portName); // signals get hooked up internally + + // start the event loop and wait for signals + return app.exec(); +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/examples.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/examples.pro new file mode 100644 index 0000000..ec8df64 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/examples.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +SUBDIRS = qespta enumerator \ + uartassistant +win32:SUBDIRS += event + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.cpp new file mode 100644 index 0000000..a223f09 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.cpp @@ -0,0 +1,60 @@ +/** + * @file MainWindow.cpp + * @brief MainWindow Implementation. + * @see MainWindow.h + * @author Micha? Policht + */ + + +#include +#include +#include "MainWindow.h" +#include "MessageWindow.h" +#include "QespTest.h" + +MainWindow::MainWindow(const QString &title) +{ + setWindowTitle(title); + //central widget + QespTest* qespTest = new QespTest(); + setCentralWidget(qespTest); + //bottom dock widget + MessageWindow* msgWindow = new MessageWindow(); + addDockWidget(Qt::BottomDockWidgetArea, msgWindow); + + createActions(); + createMenus(); +} + +void MainWindow::about() +{ + QMessageBox::about(this, tr("About "), + tr("""
    " + "author: Michal Policht
    " + "xpolik@users.sourceforge.net")); +} + +void MainWindow::createActions() +{ + //File actions + exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcut(tr("CTRL+D")); + exitAct->setStatusTip(tr("Exit the application")); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + + //Help actions + aboutAct = new QAction(tr("&About"), this); + aboutAct->setShortcut(tr("CTRL+A")); + aboutAct->setStatusTip(tr("About application")); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); +} + +void MainWindow::createMenus() +{ + fileMenu = menuBar()->addMenu(tr("&File")); + fileMenu->addAction(exitAct); + + helpMenu = menuBar()->addMenu(tr("&Help")); + helpMenu->addAction(aboutAct); +} + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.h new file mode 100644 index 0000000..d8c4e44 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MainWindow.h @@ -0,0 +1,40 @@ +/** + * @file MainWindow.h + * @brief Application's Main Window. + * @see MainWindow + * @author Micha? Policht + */ + +#ifndef MAINWINDOW_H_ +#define MAINWINDOW_H_ + +#include + +class QMenu; +class QAction; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + + //@{ + QMenu *fileMenu; + QAction *exitAct; + QMenu *helpMenu; + QAction *aboutAct; + //@} + +private: + void createMenus(); + void createActions(); + +private slots: + void about(); + +public: + MainWindow(const QString &title); + +}; + +#endif /*MAINWINDOW_H_*/ + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.cpp new file mode 100644 index 0000000..76b6bd5 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.cpp @@ -0,0 +1,95 @@ +/** + * @file MessageWindow.cpp + * @brief MessageWindow Implementation. + * @see MessageWindow.h + * @author Micha? Policht + */ + +#include +#include "MessageWindow.h" +#include +#include +#include + +const char* MessageWindow::WINDOW_TITLE = "Message Window"; +MessageWindow* MessageWindow::MsgHandler = NULL; + +MessageWindow::MessageWindow(QWidget* parent, Qt::WFlags flags) + : QDockWidget(parent, flags), + msgTextEdit(this) +{ + setWindowTitle(tr(WINDOW_TITLE)); + msgTextEdit.setReadOnly(true); + setWidget(&msgTextEdit); + + MessageWindow::MsgHandler = this; +} + +//static +QString MessageWindow::QtMsgToQString(QtMsgType type, const char *msg) +{ + switch (type) { + case QtDebugMsg: + return QLatin1String("Debug: ")+QLatin1String(msg); + case QtWarningMsg: + return QLatin1String("Warning: ")+QLatin1String(msg); + case QtCriticalMsg: + return QLatin1String("Critical: ")+QLatin1String(msg); + case QtFatalMsg: + return QLatin1String("Fatal: ")+QLatin1String(msg); + default: + return QLatin1String("Unrecognized message type: ")+QLatin1String(msg); + } +} + +//static +void MessageWindow::AppendMsgWrapper(QtMsgType type, const char* msg) +{ + static QMutex mutex; + QMutexLocker locker(&mutex); + + if (MessageWindow::MsgHandler != NULL) + return MessageWindow::MsgHandler->postMsgEvent(type, msg); + else + fprintf(stderr, "%s", MessageWindow::QtMsgToQString(type, msg).toLatin1().data()); +} + +void MessageWindow::customEvent(QEvent* event) +{ + if (static_cast(event->type()) == MessageWindow::MessageEventType) + msgTextEdit.append(dynamic_cast(event)->msg); +} + +void MessageWindow::postMsgEvent(QtMsgType type, const char* msg) +{ + QString qmsg = MessageWindow::QtMsgToQString(type, msg); + switch (type) { + case QtDebugMsg: + break; + case QtWarningMsg: + qmsg.prepend(QLatin1String("")); + qmsg.append(QLatin1String("")); + break; + case QtCriticalMsg: + if (QMessageBox::critical(this, QLatin1String("Critical Error"), qmsg, + QMessageBox::Ignore, + QMessageBox::Abort, + QMessageBox::NoButton) == QMessageBox::Abort) + abort(); // core dump + qmsg.prepend(QLatin1String("")); + qmsg.append(QLatin1String("")); + break; + case QtFatalMsg: + QMessageBox::critical(this, QLatin1String("Fatal Error"), qmsg, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton); + abort(); // deliberately core dump + } + //it's impossible to change GUI directly from thread other than the main thread + //so post message encapsulated by MessageEvent to the main thread's event queue + QCoreApplication::postEvent(this, new MessageEvent(qmsg)); +} + +MessageEvent::MessageEvent(QString & msg): + QEvent(static_cast(MessageWindow::MessageEventType)) +{ + this->msg = msg; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.h new file mode 100644 index 0000000..8363f2e --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/MessageWindow.h @@ -0,0 +1,83 @@ +/** + * @file MessageWindow.h + * @brief Message Window. + * @see MessageWindow + * @author Micha? Policht + */ + +#ifndef MESSAGEWINDOW_H_ +#define MESSAGEWINDOW_H_ + + +#include +#include +#include + +/** + * Message Window. Handling errors and other messages. + */ +class MessageWindow: public QDockWidget +{ + Q_OBJECT + + QTextEdit msgTextEdit; ///< Main widget. + static MessageWindow* MsgHandler; ///< Set in constructor. + static const char* WINDOW_TITLE; ///< Window title. + + private: + static QString QtMsgToQString(QtMsgType type, const char *msg); + + protected: + /** + * Handle custom events. MessageWindow hadles custom events listed in + * EventType enum. + */ + virtual void customEvent(QEvent* event); + + public: + enum EventType {MessageEventType = QEvent::User}; ///< Custom event types. + + /** + * Default constructor. + * @param parent parent widget. + * @param flags widget flags. + */ + MessageWindow(QWidget* parent = 0, Qt::WFlags flags = 0); + + /** + * Append message wrapper. Since ISO forbids casting member functions + * to C functions, wrapper is needed to use this class as QtMsgHandler. + * This method is thread-safe but not reentrant. + * @param type message type. + * @param msg message string. + */ + static void AppendMsgWrapper(QtMsgType type, const char *msg); + + /** + * Post message event to the main event loop. This function encapsulates + * message into MessageEvent object and passes it to the main event loop. + * @param type message type. + * @param msg message string. + */ + void postMsgEvent(QtMsgType type, const char *msg); + +}; + + +/** + * Message Event. Custom event used by @ref MessageWindow to provide multi-threaded + * access. Encapsulates message inside @a msg variable. + */ +class MessageEvent: public QEvent +{ + public: + QString msg; ///< Message string. + + /** + * Contructor. + * @param msg message to post. + */ + MessageEvent(QString & msg); +}; + +#endif /*MESSAGEWINDOW_H_*/ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.cpp new file mode 100644 index 0000000..734543e --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.cpp @@ -0,0 +1,129 @@ +/* QespTest.cpp +**************************************/ +#include "QespTest.h" +#include "qextserialport.h" +#include +#include +#include +#include +#include + + +QespTest::QespTest(QWidget* parent) + : QWidget(parent) + +{ + //modify the port settings on your own + #ifdef Q_OS_UNIX + port = new QextSerialPort(QLatin1String("/dev/ttyS0"), QextSerialPort::Polling); + #else + port = new QextSerialPort(QLatin1String("COM1"), QextSerialPort::Polling); + #endif /*Q_OS_UNIX*/ + port->setBaudRate(BAUD19200); + port->setFlowControl(FLOW_OFF); + port->setParity(PAR_NONE); + port->setDataBits(DATA_8); + port->setStopBits(STOP_2); + //set timeouts to 500 ms + port->setTimeout(500); + + message = new QLineEdit(this); + + // transmit receive + QPushButton *transmitButton = new QPushButton(tr("Transmit")); + connect(transmitButton, SIGNAL(clicked()), SLOT(transmitMsg())); + QPushButton *receiveButton = new QPushButton(tr("Receive")); + connect(receiveButton, SIGNAL(clicked()), SLOT(receiveMsg())); + QHBoxLayout* trLayout = new QHBoxLayout; + trLayout->addWidget(transmitButton); + trLayout->addWidget(receiveButton); + + //CR LF + QPushButton *CRButton = new QPushButton(tr("CR")); + connect(CRButton, SIGNAL(clicked()), SLOT(appendCR())); + QPushButton *LFButton = new QPushButton(tr("LF")); + connect(LFButton, SIGNAL(clicked()), SLOT(appendLF())); + QHBoxLayout *crlfLayout = new QHBoxLayout; + crlfLayout->addWidget(CRButton); + crlfLayout->addWidget(LFButton); + + //open close + QPushButton *openButton = new QPushButton(tr("Open")); + connect(openButton, SIGNAL(clicked()), SLOT(openPort())); + QPushButton *closeButton = new QPushButton(tr("Close")); + connect(closeButton, SIGNAL(clicked()), SLOT(closePort())); + QHBoxLayout *ocLayout = new QHBoxLayout; + ocLayout->addWidget(openButton); + ocLayout->addWidget(closeButton); + + received_msg = new QTextEdit(); + + QVBoxLayout *myVBox = new QVBoxLayout; + myVBox->addWidget(message); + myVBox->addLayout(crlfLayout); + myVBox->addLayout(trLayout); + myVBox->addLayout(ocLayout); + myVBox->addWidget(received_msg); + setLayout(myVBox); + + qDebug("isOpen : %d", port->isOpen()); +} + +QespTest::~QespTest() +{ + delete port; + port = NULL; +} + +void QespTest::transmitMsg() +{ + int i = port->write((message->text()).toAscii(), + (message->text()).length()); + qDebug("trasmitted : %d", i); +} + +void QespTest::receiveMsg() +{ + char buff[1024]; + int numBytes; + + numBytes = port->bytesAvailable(); + if(numBytes > 1024) + numBytes = 1024; + + int i = port->read(buff, numBytes); + if (i != -1) + buff[i] = '\0'; + else + buff[0] = '\0'; + QString msg = QLatin1String(buff); + + received_msg->append(msg); + received_msg->ensureCursorVisible(); + qDebug("bytes available: %d", numBytes); + qDebug("received: %d", i); +} + + +void QespTest::appendCR() +{ + message->insert(QLatin1String("\x0D")); +} + +void QespTest::appendLF() +{ + message->insert(QLatin1String("\x0A")); +} + +void QespTest::closePort() +{ + port->close(); + qDebug("is open: %d", port->isOpen()); +} + +void QespTest::openPort() +{ + port->open(QIODevice::ReadWrite | QIODevice::Unbuffered); + qDebug("is open: %d", port->isOpen()); +} + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.h new file mode 100644 index 0000000..f757a1d --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/QespTest.h @@ -0,0 +1,36 @@ +/* qesptest.h +**************************************/ +#ifndef _QESPTEST_H_ +#define _QESPTEST_H_ + +#include + +class QLineEdit; +class QTextEdit; +class QextSerialPort; +class QSpinBox; + +class QespTest : public QWidget +{ + Q_OBJECT +public: + QespTest(QWidget *parent=0); + + virtual ~QespTest(); + +private: + QLineEdit *message; + QSpinBox* delaySpinBox; + QTextEdit *received_msg; + QextSerialPort *port; + +private slots: + void transmitMsg(); + void receiveMsg(); + void appendCR(); + void appendLF(); + void closePort(); + void openPort(); +}; + +#endif diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/README b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/README new file mode 100644 index 0000000..643f6cd --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/README @@ -0,0 +1,4 @@ +This is simple application using QextSerialPort library. + +Port settings are in QespTest constructor (QespTest.cpp) + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/main.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/main.cpp new file mode 100644 index 0000000..6780cd8 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/main.cpp @@ -0,0 +1,28 @@ +/** + * @file main.cpp + * @brief Main file. + * @author Micha? Policht + */ + +#include +#include "MainWindow.h" +#include "MessageWindow.h" + + +int main(int argc, char *argv[]) +{ + int exec; + + QApplication app(argc, argv); + //! [0] + //redirect debug messages to the MessageWindow dialog + qInstallMsgHandler(MessageWindow::AppendMsgWrapper); + //! [0] + + MainWindow mainWindow(QLatin1String("QextSerialPort Test Application")); + mainWindow.show(); + exec = app.exec(); + return exec; +} + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/qespta.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/qespta.pro new file mode 100644 index 0000000..3052182 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/qespta/qespta.pro @@ -0,0 +1,14 @@ +TEMPLATE = app +DEPENDPATH += . +QT += core gui +contains(QT_VERSION, ^5\\..*\\..*): QT += widgets +HEADERS += MainWindow.h \ + MessageWindow.h \ + QespTest.h + +SOURCES += main.cpp \ + MainWindow.cpp \ + MessageWindow.cpp \ + QespTest.cpp + +include(../../src/qextserialport.pri) diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.cpp new file mode 100644 index 0000000..64d4944 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.cpp @@ -0,0 +1,162 @@ +#include "dialog.h" +#include "ui_dialog.h" +#include +#include +#include +#include "qextserialport.h" + +Dialog::Dialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::Dialog) +{ + ui->setupUi(this); + +#ifdef Q_OS_WIN + ui->portBox->addItems(QStringList()<portBox->addItems(QStringList()<portBox->setEditable(true); + + ui->baudRateBox->addItem(QLatin1String("1200"), BAUD1200); + ui->baudRateBox->addItem(QLatin1String("2400"), BAUD2400); + ui->baudRateBox->addItem(QLatin1String("4800"), BAUD4800); + ui->baudRateBox->addItem(QLatin1String("9600"), BAUD9600); + ui->baudRateBox->addItem(QLatin1String("19200"), BAUD19200); + ui->baudRateBox->setCurrentIndex(3); + + ui->parityBox->addItem(QLatin1String("NONE"), PAR_NONE); + ui->parityBox->addItem(QLatin1String("ODD"), PAR_ODD); + ui->parityBox->addItem(QLatin1String("EVEN"), PAR_EVEN); + + ui->dataBitsBox->addItem(QLatin1String("5"), DATA_5); + ui->dataBitsBox->addItem(QLatin1String("6"), DATA_6); + ui->dataBitsBox->addItem(QLatin1String("7"), DATA_7); + ui->dataBitsBox->addItem(QLatin1String("8"), DATA_8); + ui->dataBitsBox->setCurrentIndex(3); + + ui->stopBitsBox->addItem(QLatin1String("1"), STOP_1); + ui->stopBitsBox->addItem(QLatin1String("2"), STOP_2); + + ui->queryModeBox->addItem(QLatin1String("Polling"), QextSerialPort::Polling); + ui->queryModeBox->addItem(QLatin1String("EventDriven"), QextSerialPort::EventDriven); + + ui->led->turnOff(); + + timer = new QTimer(this); + timer->setInterval(40); + PortSettings settings = {BAUD9600, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10}; + port = new QextSerialPort(ui->portBox->currentText(), settings, QextSerialPort::Polling); + + connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)), SLOT(onBaudRateChanged(int))); + connect(ui->parityBox, SIGNAL(currentIndexChanged(int)), SLOT(onParityChanged(int))); + connect(ui->dataBitsBox, SIGNAL(currentIndexChanged(int)), SLOT(onDataBitsChanged(int))); + connect(ui->stopBitsBox, SIGNAL(currentIndexChanged(int)), SLOT(onStopBitsChanged(int))); + connect(ui->queryModeBox, SIGNAL(currentIndexChanged(int)), SLOT(onQueryModeChanged(int))); + connect(ui->timeoutBox, SIGNAL(valueChanged(int)), SLOT(onTimeoutChanged(int))); + connect(ui->portBox, SIGNAL(editTextChanged(QString)), SLOT(onPortNameChanged(QString))); + connect(ui->openCloseButton, SIGNAL(clicked()), SLOT(onOpenCloseButtonClicked())); + connect(ui->sendButton, SIGNAL(clicked()), SLOT(onSendButtonClicked())); + connect(timer, SIGNAL(timeout()), SLOT(onReadyRead())); + connect(port, SIGNAL(readyRead()), SLOT(onReadyRead())); + + setWindowTitle(QLatin1String("QextSerialPort Demo")); +} + +Dialog::~Dialog() +{ + delete ui; + delete port; +} + +void Dialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void Dialog::onPortNameChanged(const QString & /*name*/) +{ + if (port->isOpen()) { + port->close(); + ui->led->turnOff(); + } +} + +void Dialog::onBaudRateChanged(int idx) +{ + port->setBaudRate((BaudRateType)ui->baudRateBox->itemData(idx).toInt()); +} + +void Dialog::onParityChanged(int idx) +{ + port->setParity((ParityType)ui->parityBox->itemData(idx).toInt()); +} + +void Dialog::onDataBitsChanged(int idx) +{ + port->setDataBits((DataBitsType)ui->dataBitsBox->itemData(idx).toInt()); +} + +void Dialog::onStopBitsChanged(int idx) +{ + port->setStopBits((StopBitsType)ui->stopBitsBox->itemData(idx).toInt()); +} + +void Dialog::onQueryModeChanged(int idx) +{ + port->setQueryMode((QextSerialPort::QueryMode)ui->queryModeBox->itemData(idx).toInt()); +} + +void Dialog::onTimeoutChanged(int val) +{ + port->setTimeout(val); +} + +void Dialog::onOpenCloseButtonClicked() +{ + if (!port->isOpen()) { + port->setPortName(ui->portBox->currentText()); + port->open(QIODevice::ReadWrite); + } + else { + port->close(); + } + + if (port->isOpen()) { + if (port->queryMode() == QextSerialPort::Polling) + timer->start(); + ui->led->turnOn(); + } + else { + timer->stop(); + ui->led->turnOff(); + } +} + +void Dialog::onSendButtonClicked() +{ + if (port->isOpen() && !ui->sendEdit->toPlainText().isEmpty()) + port->write(ui->sendEdit->toPlainText().toLatin1()); +} + +void Dialog::onReadyRead() +{ + //EventDriven test. + if (qApp->arguments().contains(QLatin1String("--debug")) && port->queryMode()==QextSerialPort::EventDriven){ + ui->recvEdit->appendPlainText(QString::number(port->bytesAvailable())); + return; + } + + if (port->bytesAvailable()) { + ui->recvEdit->moveCursor(QTextCursor::End); + ui->recvEdit->insertPlainText(QString::fromLatin1(port->readAll())); + } +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.h new file mode 100644 index 0000000..900199b --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.h @@ -0,0 +1,41 @@ +#ifndef DIALOG_H +#define DIALOG_H + +#include + +namespace Ui { + class Dialog; +} +class QTimer; +class QextSerialPort; + +class Dialog : public QDialog +{ + Q_OBJECT + +public: + explicit Dialog(QWidget *parent = 0); + ~Dialog(); + +protected: + void changeEvent(QEvent *e); + +private Q_SLOTS: + void onPortNameChanged(const QString &name); + void onBaudRateChanged(int idx); + void onParityChanged(int idx); + void onDataBitsChanged(int idx); + void onStopBitsChanged(int idx); + void onQueryModeChanged(int idx); + void onTimeoutChanged(int val); + void onOpenCloseButtonClicked(); + void onSendButtonClicked(); + void onReadyRead(); + +private: + Ui::Dialog *ui; + QTimer *timer; + QextSerialPort *port; +}; + +#endif // DIALOG_H diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.ui b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.ui new file mode 100644 index 0000000..0e68d34 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/dialog.ui @@ -0,0 +1,191 @@ + + + Dialog + + + + 0 + 0 + 604 + 485 + + + + Dialog + + + + + + + + 800 + + + + + + + + + + + + + + + + Port: + + + + + + + + + + BaudRate: + + + + + + + + + + DataBits: + + + + + + + + + + Parity: + + + + + + + + + + StopBits: + + + + + + + + + + QueryMode: + + + + + + + + + + Timeout: + + + + + + + ms + + + -1 + + + 10000 + + + 10 + + + 10 + + + + + + + + + + + + 0 + 0 + + + + + 20 + 20 + + + + + 25 + 25 + + + + + + + + Open/Close + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Send + + + + + + + + + + + HLed + QWidget +
    hled.h
    + 1 +
    +
    + + +
    diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.cpp new file mode 100644 index 0000000..b701fbf --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.cpp @@ -0,0 +1,271 @@ +#include + +#include +#include +#include +#include + +#include "hled.h" + +class HLed::Private +{ +public: + Private() + : darkerFactor(300), color(Qt::green), + isOn(true), offPixmap(0), onPixmap(0) + { + offColor = color.darker(darkerFactor); + timer = new QTimer; + timer->setInterval(250); + } + + ~Private() + { + delete offPixmap; + delete onPixmap; + delete timer; + } + + int darkerFactor; + QColor color; + bool isOn; + + QColor offColor; + QPixmap *offPixmap; + QPixmap *onPixmap; + + HLed::State state; + QTimer * timer; +}; + +HLed::HLed(QWidget *parent) + :QWidget(parent), m_d(new Private) +{ + setColor(Qt::red); + setState(Blink); + connect(m_d->timer, SIGNAL(timeout()), this, SLOT(blinkToggle())); +} + +HLed::~HLed() +{ + delete m_d; +} + +QColor HLed::color() const +{ + return m_d->color; +} + +HLed::State HLed::state() const +{ + return m_d->state; +} + +int HLed::darkerFactor() const +{ + return m_d->darkerFactor; +} + +void HLed::setColor(const QColor &color) +{ + if (m_d->color == color) + return; + + if (m_d->onPixmap) { + delete m_d->onPixmap; + m_d->onPixmap = 0; + } + + if (m_d->offPixmap) { + delete m_d->offPixmap; + m_d->offPixmap = 0; + } + + m_d->color = color; + m_d->offColor = color.darker(m_d->darkerFactor); + + update(); +} + +void HLed::setState(State state) +{ + if (m_d->state == state) + return; + + if (Blink == state) { + m_d->timer->start(); + } + else { + m_d->timer->stop(); + m_d->isOn = (state==On) ? true : false; + } + m_d->state = state; + update(); +} + +void HLed::setDarkerFactor(int darkerFactor) +{ + if (m_d->darkerFactor == darkerFactor) + return; + + m_d->darkerFactor = darkerFactor; + m_d->offColor = m_d->color.darker(darkerFactor); + + update(); +} + +QSize HLed::sizeHint() const +{ + return QSize(20, 20); +} + +QSize HLed::minimumSizeHint() const +{ + return QSize(16, 16); +} + +void HLed::toggle() +{ + if (m_d->state == Blink) { + return; + } + + setState(m_d->state == On ? Off : On); + update(); +} + +void HLed::turnOn(bool on) +{ + setState(on ? On : Off); +} + +void HLed::turnOff(bool off) +{ + turnOn(!off); +} + +void HLed::blink() +{ + setState(Blink); +} + +void HLed::blinkToggle() +{ + m_d->isOn = !m_d->isOn; + update(); +} + +void HLed::paintEvent(QPaintEvent* /* event*/) +{ + if (paintCachedPixmap()) + { + return; + } + + int width = ledWidth(); + const int scale = 3; + QPixmap *tmpPixmap = 0; + + width *= scale; + tmpPixmap = new QPixmap(width + scale*2, width + scale*2); + tmpPixmap->fill(palette().color(backgroundRole())); + tmpPixmap->fill(QColor(Qt::transparent)); + + QPainter paint; + paint.begin(tmpPixmap); + paint.setRenderHint(QPainter::Antialiasing); + + QColor color = m_d->isOn ? m_d->color : m_d->offColor; + + QBrush brush; + brush.setStyle(Qt::SolidPattern); + brush.setColor(color); + + paint.setBrush(brush); + // draw plain + paint.drawEllipse(scale, scale, width-scale*2, width-scale*2); + + QPen pen; + pen.setWidth(2 * scale); + + int pos = width / 5 + 1; + int lightWidth = width * 2 / 3; + int lightQuote = 130 * 2 / (lightWidth ? lightWidth : 1) + 100; + + // draw bright spot + while (lightWidth) { + color = color.lighter(lightQuote); + pen.setColor(color); + paint.setPen(pen); + paint.drawEllipse(pos, pos, lightWidth, lightWidth); + lightWidth--; + + if (!lightWidth) { + break; + } + + paint.drawEllipse(pos, pos, lightWidth, lightWidth); + lightWidth--; + + if (!lightWidth) { + break; + } + + paint.drawEllipse(pos, pos, lightWidth, lightWidth); + pos++; + lightWidth--; + } + + + pen.setWidth(2*scale + 1); + brush.setStyle(Qt::NoBrush); + paint.setBrush(brush); + + int angle = -720; + color = palette().color(QPalette::Light); + + for (int arc=120; arc<2880; arc+=240) { + pen.setColor(color); + paint.setPen(pen); + int w = width - pen.width()/2 - scale + 1; + paint.drawArc(pen.width()/2, pen.width()/2, w, w, angle+arc, 240); + paint.drawArc(pen.width()/2, pen.width()/2, w, w, angle-arc, 240); + color = color.darker(110); + } + + paint.end(); + + QPixmap *&dest = (m_d->isOn ? m_d->onPixmap : m_d->offPixmap); + QImage i = tmpPixmap->toImage(); + width /= scale; + i = i.scaled(width, width, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + delete tmpPixmap; + + dest = new QPixmap(QPixmap::fromImage(i)); + paint.begin(this); + paint.drawPixmap(0, 0, *dest); + paint.end(); +} + +bool HLed::paintCachedPixmap() +{ + if (m_d->isOn && m_d->onPixmap) { + QPainter paint(this); + paint.drawPixmap(0, 0, *m_d->onPixmap); + return true; + } + if (!m_d->isOn && m_d->offPixmap) { + QPainter paint(this); + paint.drawPixmap(0, 0, *m_d->offPixmap); + return true; + } + return false; +} + +int HLed::ledWidth() const +{ + int width = qMin(this->width(), this->height()); + width -= 2; + return width > 0 ? width : 0; +} + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.h new file mode 100644 index 0000000..acdc494 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/hled.h @@ -0,0 +1,48 @@ +#ifndef HLED_H +#define HLED_H + +#include + +class QColor; +class QTimer; + +class HLed : public QWidget +{ + Q_OBJECT +public: + enum State {Off, On, Blink}; + HLed(QWidget *parent = 0); + ~HLed(); + + QColor color() const; + State state() const; + int darkerFactor() const; + + void setColor(const QColor & color); + void setState(State state); + void setDarkerFactor(int darkerFactor); + + QSize sizeHint() const; + QSize minimumSizeHint() const; + +public slots: + void toggle(); + void turnOn(bool on=true); + void turnOff(bool off=true); + void blink(); + +private slots: + void blinkToggle(); + +protected: + void paintEvent(QPaintEvent*); + bool paintCachedPixmap(); + int ledWidth() const; + void paintSunken(); + +private: + class Private; + Private * const m_d; +}; + +#endif // HLED_H diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/main.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/main.cpp new file mode 100644 index 0000000..6bf4fa0 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/main.cpp @@ -0,0 +1,11 @@ +#include +#include "dialog.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Dialog w; + w.show(); + + return a.exec(); +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/uartassistant.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/uartassistant.pro new file mode 100644 index 0000000..ddca2f8 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/examples/uartassistant/uartassistant.pro @@ -0,0 +1,22 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2011-11-06T21:37:41 +# +#------------------------------------------------- + +QT += core gui +contains(QT_VERSION, ^5\\..*\\..*): QT += widgets + +TARGET = uartassistant +TEMPLATE = app + +include(../../src/qextserialport.pri) + +SOURCES += main.cpp\ + dialog.cpp\ + hled.cpp + +HEADERS += dialog.h \ + hled.h + +FORMS += dialog.ui diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/qextserialport.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/qextserialport.pro new file mode 100644 index 0000000..5336113 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/qextserialport.pro @@ -0,0 +1,7 @@ +TEMPLATE=subdirs +CONFIG += ordered +include(common.pri) +qextserialport-library:SUBDIRS=buildlib +SUBDIRS+=examples + +include(doc/doc.pri) diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.cpp new file mode 100644 index 0000000..5a06e8c --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.cpp @@ -0,0 +1,167 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialenumerator.h" +#include "qextserialenumerator_p.h" + +#include +#include +#include + +QextSerialEnumeratorPrivate::QextSerialEnumeratorPrivate(QextSerialEnumerator *enumrator) + :q_ptr(enumrator) +{ + platformSpecificInit(); +} + +QextSerialEnumeratorPrivate::~QextSerialEnumeratorPrivate() +{ + platformSpecificDestruct(); +} + +/*! + \class QextPortInfo + + \brief The QextPortInfo class containing port information. + + Structure containing port information. + + \code + QString portName; ///< Port name. + QString physName; ///< Physical name. + QString friendName; ///< Friendly name. + QString enumName; ///< Enumerator name. + int vendorID; ///< Vendor ID. + int productID; ///< Product ID + \endcode + */ + +/*! \class QextSerialEnumerator + + \brief The QextSerialEnumerator class provides list of ports available in the system. + + \section1 Usage + To poll the system for a list of connected devices, simply use getPorts(). Each + QextPortInfo structure will populated with information about the corresponding device. + + \bold Example + \code + QList ports = QextSerialEnumerator::getPorts(); + foreach( QextPortInfo port, ports ) { + // inspect port... + } + \endcode + + To enable event-driven notification of device connection events, first call + setUpNotifications() and then connect to the deviceDiscovered() and deviceRemoved() + signals. Event-driven behavior is currently available only on Windows and OS X. + + \bold Example + \code + QextSerialEnumerator* enumerator = new QextSerialEnumerator(); + connect(enumerator, SIGNAL(deviceDiscovered(const QextPortInfo &)), + myClass, SLOT(onDeviceDiscovered(const QextPortInfo &))); + connect(enumerator, SIGNAL(deviceRemoved(const QextPortInfo &)), + myClass, SLOT(onDeviceRemoved(const QextPortInfo &))); + \endcode + + \section1 Credits + Windows implementation is based on Zach Gorman's work from + \l {http://www.codeproject.com}{The Code Project} (\l http://www.codeproject.com/system/setupdi.asp). + + OS X implementation, see \l http://developer.apple.com/documentation/DeviceDrivers/Conceptual/AccessingHardware/AH_Finding_Devices/chapter_4_section_2.html + + \bold author Michal Policht, Liam Staskawicz +*/ + +/*! + \fn void QextSerialEnumerator::deviceDiscovered( const QextPortInfo & info ) + A new device has been connected to the system. + + setUpNotifications() must be called first to enable event-driven device notifications. + Currently only implemented on Windows and OS X. + + \a info The device that has been discovered. +*/ + +/*! + \fn void QextSerialEnumerator::deviceRemoved( const QextPortInfo & info ); + A device has been disconnected from the system. + + setUpNotifications() must be called first to enable event-driven device notifications. + Currently only implemented on Windows and OS X. + + \a info The device that was disconnected. +*/ + +/*! + Constructs a QextSerialEnumerator object with the given \a parent. +*/ +QextSerialEnumerator::QextSerialEnumerator(QObject *parent) + :QObject(parent), d_ptr(new QextSerialEnumeratorPrivate(this)) +{ + if( !QMetaType::isRegistered( QMetaType::type("QextPortInfo") ) ) + qRegisterMetaType("QextPortInfo"); +} + +/*! + Destructs the QextSerialEnumerator object. +*/ +QextSerialEnumerator::~QextSerialEnumerator( ) +{ + delete d_ptr; +} + +/*! + Get list of ports. + + return list of ports currently available in the system. +*/ +QList QextSerialEnumerator::getPorts() +{ +#if defined(Q_OS_UNIX) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC) + qCritical("Enumeration for POSIX systems (except Linux) is not implemented yet."); +#endif + return QextSerialEnumeratorPrivate::getPorts_sys(); +} + +/*! + Enable event-driven notifications of board discovery/removal. +*/ +void QextSerialEnumerator::setUpNotifications() +{ +#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) + qCritical("Notifications for *Nix/FreeBSD are not implemented yet"); +#endif + Q_D(QextSerialEnumerator); + if (!d->setUpNotifications_sys(true)) + QESP_WARNING("Setup Notification Failed..."); +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.h new file mode 100644 index 0000000..f9b4708 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#ifndef _QEXTSERIALENUMERATOR_H_ +#define _QEXTSERIALENUMERATOR_H_ + +#include +#include +#include "qextserialport_global.h" + +struct QextPortInfo { + QString portName; ///< Port name. + QString physName; ///< Physical name. + QString friendName; ///< Friendly name. + QString enumName; ///< Enumerator name. + int vendorID; ///< Vendor ID. + int productID; ///< Product ID +}; + +class QextSerialEnumeratorPrivate; +class QEXTSERIALPORT_EXPORT QextSerialEnumerator : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QextSerialEnumerator) +public: + QextSerialEnumerator(QObject * parent=0); + ~QextSerialEnumerator(); + + static QList getPorts(); + void setUpNotifications(); + +Q_SIGNALS: + void deviceDiscovered(const QextPortInfo & info); + void deviceRemoved(const QextPortInfo & info); + +private: + Q_DISABLE_COPY(QextSerialEnumerator) + QextSerialEnumeratorPrivate *d_ptr; +}; + +#endif /*_QEXTSERIALENUMERATOR_H_*/ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_osx.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_osx.cpp new file mode 100644 index 0000000..60fac20 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_osx.cpp @@ -0,0 +1,313 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialenumerator.h" +#include "qextserialenumerator_p.h" +#include +#include +#include +#include + +void QextSerialEnumeratorPrivate::platformSpecificInit() +{ +} + +void QextSerialEnumeratorPrivate::platformSpecificDestruct() +{ + IONotificationPortDestroy( notificationPortRef ); +} + +// static +QList QextSerialEnumeratorPrivate::getPorts_sys() +{ + QList infoList; + io_iterator_t serialPortIterator = 0; + kern_return_t kernResult = KERN_FAILURE; + CFMutableDictionaryRef matchingDictionary; + + // first try to get any serialbsd devices, then try any USBCDC devices + if( !(matchingDictionary = IOServiceMatching(kIOSerialBSDServiceValue) ) ) { + QESP_WARNING("IOServiceMatching returned a NULL dictionary."); + return infoList; + } + CFDictionaryAddValue(matchingDictionary, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes)); + + // then create the iterator with all the matching devices + if( IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS ) { + qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult; + return infoList; + } + iterateServicesOSX(serialPortIterator, infoList); + IOObjectRelease(serialPortIterator); + serialPortIterator = 0; + + if( !(matchingDictionary = IOServiceNameMatching("AppleUSBCDC")) ) { + QESP_WARNING("IOServiceNameMatching returned a NULL dictionary."); + return infoList; + } + + if( IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &serialPortIterator) != KERN_SUCCESS ) { + qCritical() << "IOServiceGetMatchingServices failed, returned" << kernResult; + return infoList; + } + iterateServicesOSX(serialPortIterator, infoList); + IOObjectRelease(serialPortIterator); + + return infoList; +} + +void QextSerialEnumeratorPrivate::iterateServicesOSX(io_object_t service, QList & infoList) +{ + // Iterate through all modems found. + io_object_t usbService; + while( ( usbService = IOIteratorNext(service) ) ) + { + QextPortInfo info; + info.vendorID = 0; + info.productID = 0; + getServiceDetailsOSX( usbService, &info ); + infoList.append(info); + } +} + +bool QextSerialEnumeratorPrivate::getServiceDetailsOSX( io_object_t service, QextPortInfo* portInfo ) +{ + bool retval = true; + CFTypeRef bsdPathAsCFString = NULL; + CFTypeRef productNameAsCFString = NULL; + CFTypeRef vendorIdAsCFNumber = NULL; + CFTypeRef productIdAsCFNumber = NULL; + // check the name of the modem's callout device + bsdPathAsCFString = IORegistryEntryCreateCFProperty(service, CFSTR(kIOCalloutDeviceKey), + kCFAllocatorDefault, 0); + + // wander up the hierarchy until we find the level that can give us the + // vendor/product IDs and the product name, if available + io_registry_entry_t parent; + kern_return_t kernResult = IORegistryEntryGetParentEntry(service, kIOServicePlane, &parent); + while( kernResult == KERN_SUCCESS && !vendorIdAsCFNumber && !productIdAsCFNumber ) + { + if(!productNameAsCFString) + productNameAsCFString = IORegistryEntrySearchCFProperty(parent, + kIOServicePlane, + CFSTR("Product Name"), + kCFAllocatorDefault, 0); + vendorIdAsCFNumber = IORegistryEntrySearchCFProperty(parent, + kIOServicePlane, + CFSTR(kUSBVendorID), + kCFAllocatorDefault, 0); + productIdAsCFNumber = IORegistryEntrySearchCFProperty(parent, + kIOServicePlane, + CFSTR(kUSBProductID), + kCFAllocatorDefault, 0); + io_registry_entry_t oldparent = parent; + kernResult = IORegistryEntryGetParentEntry(parent, kIOServicePlane, &parent); + IOObjectRelease(oldparent); + } + + io_string_t ioPathName; + IORegistryEntryGetPath( service, kIOServicePlane, ioPathName ); + portInfo->physName = ioPathName; + + if( bsdPathAsCFString ) + { + char path[MAXPATHLEN]; + if( CFStringGetCString((CFStringRef)bsdPathAsCFString, path, + PATH_MAX, kCFStringEncodingUTF8) ) + portInfo->portName = path; + CFRelease(bsdPathAsCFString); + } + + if(productNameAsCFString) + { + char productName[MAXPATHLEN]; + if( CFStringGetCString((CFStringRef)productNameAsCFString, productName, + PATH_MAX, kCFStringEncodingUTF8) ) + portInfo->friendName = productName; + CFRelease(productNameAsCFString); + } + + if(vendorIdAsCFNumber) + { + SInt32 vID; + if(CFNumberGetValue((CFNumberRef)vendorIdAsCFNumber, kCFNumberSInt32Type, &vID)) + portInfo->vendorID = vID; + CFRelease(vendorIdAsCFNumber); + } + + if(productIdAsCFNumber) + { + SInt32 pID; + if(CFNumberGetValue((CFNumberRef)productIdAsCFNumber, kCFNumberSInt32Type, &pID)) + portInfo->productID = pID; + CFRelease(productIdAsCFNumber); + } + IOObjectRelease(service); + return retval; +} + +// IOKit callbacks registered via setupNotifications() +void deviceDiscoveredCallbackOSX( void *ctxt, io_iterator_t serialPortIterator ) +{ + QextSerialEnumeratorPrivate* d = (QextSerialEnumeratorPrivate*)ctxt; + io_object_t serialService; + while ((serialService = IOIteratorNext(serialPortIterator))) + d->onDeviceDiscoveredOSX(serialService); +} + +void deviceTerminatedCallbackOSX( void *ctxt, io_iterator_t serialPortIterator ) +{ + QextSerialEnumeratorPrivate* d = (QextSerialEnumeratorPrivate*)ctxt; + io_object_t serialService; + while ((serialService = IOIteratorNext(serialPortIterator))) + d->onDeviceTerminatedOSX(serialService); +} + +/* + A device has been discovered via IOKit. + Create a QextPortInfo if possible, and emit the signal indicating that we've found it. +*/ +void QextSerialEnumeratorPrivate::onDeviceDiscoveredOSX( io_object_t service ) +{ + Q_Q(QextSerialEnumerator); + QextPortInfo info; + info.vendorID = 0; + info.productID = 0; + if( getServiceDetailsOSX( service, &info ) ) + Q_EMIT q->deviceDiscovered( info ); +} + +/* + Notification via IOKit that a device has been removed. + Create a QextPortInfo if possible, and emit the signal indicating that it's gone. +*/ +void QextSerialEnumeratorPrivate::onDeviceTerminatedOSX( io_object_t service ) +{ + Q_Q(QextSerialEnumerator); + QextPortInfo info; + info.vendorID = 0; + info.productID = 0; + if( getServiceDetailsOSX( service, &info ) ) + Q_EMIT q->deviceRemoved( info ); +} + +/* + Create matching dictionaries for the devices we want to get notifications for, + and add them to the current run loop. Invoke the callbacks that will be responding + to these notifications once to arm them, and discover any devices that + are currently connected at the time notifications are setup. +*/ +bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup) +{ + kern_return_t kernResult; + mach_port_t masterPort; + CFRunLoopSourceRef notificationRunLoopSource; + CFMutableDictionaryRef classesToMatch; + CFMutableDictionaryRef cdcClassesToMatch; + io_iterator_t portIterator; + + kernResult = IOMasterPort(MACH_PORT_NULL, &masterPort); + if (KERN_SUCCESS != kernResult) { + qDebug() << "IOMasterPort returned:" << kernResult; + return false; + } + + classesToMatch = IOServiceMatching(kIOSerialBSDServiceValue); + if (classesToMatch == NULL) + qDebug("IOServiceMatching returned a NULL dictionary."); + else + CFDictionarySetValue(classesToMatch, CFSTR(kIOSerialBSDTypeKey), CFSTR(kIOSerialBSDAllTypes)); + + if( !(cdcClassesToMatch = IOServiceNameMatching("AppleUSBCDC") ) ) { + QESP_WARNING("couldn't create cdc matching dict"); + return false; + } + + // Retain an additional reference since each call to IOServiceAddMatchingNotification consumes one. + classesToMatch = (CFMutableDictionaryRef) CFRetain(classesToMatch); + cdcClassesToMatch = (CFMutableDictionaryRef) CFRetain(cdcClassesToMatch); + + notificationPortRef = IONotificationPortCreate(masterPort); + if(notificationPortRef == NULL) { + qDebug("IONotificationPortCreate return a NULL IONotificationPortRef."); + return false; + } + + notificationRunLoopSource = IONotificationPortGetRunLoopSource(notificationPortRef); + if (notificationRunLoopSource == NULL) { + qDebug("IONotificationPortGetRunLoopSource returned NULL CFRunLoopSourceRef."); + return false; + } + + CFRunLoopAddSource(CFRunLoopGetCurrent(), notificationRunLoopSource, kCFRunLoopDefaultMode); + + kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, classesToMatch, + deviceDiscoveredCallbackOSX, this, &portIterator); + if (kernResult != KERN_SUCCESS) { + qDebug() << "IOServiceAddMatchingNotification return:" << kernResult; + return false; + } + + // arm the callback, and grab any devices that are already connected + deviceDiscoveredCallbackOSX( this, portIterator ); + + kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOMatchedNotification, cdcClassesToMatch, + deviceDiscoveredCallbackOSX, this, &portIterator); + if (kernResult != KERN_SUCCESS) { + qDebug() << "IOServiceAddMatchingNotification return:" << kernResult; + return false; + } + + // arm the callback, and grab any devices that are already connected + deviceDiscoveredCallbackOSX( this, portIterator ); + + kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, classesToMatch, + deviceTerminatedCallbackOSX, this, &portIterator); + if (kernResult != KERN_SUCCESS) { + qDebug() << "IOServiceAddMatchingNotification return:" << kernResult; + return false; + } + + // arm the callback, and clear any devices that are terminated + deviceTerminatedCallbackOSX( this, portIterator ); + + kernResult = IOServiceAddMatchingNotification(notificationPortRef, kIOTerminatedNotification, cdcClassesToMatch, + deviceTerminatedCallbackOSX, this, &portIterator); + if (kernResult != KERN_SUCCESS) { + qDebug() << "IOServiceAddMatchingNotification return:" << kernResult; + return false; + } + + // arm the callback, and clear any devices that are terminated + deviceTerminatedCallbackOSX( this, portIterator ); + return true; +} + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_p.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_p.h new file mode 100644 index 0000000..e7ab7c6 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_p.h @@ -0,0 +1,107 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ +#ifndef _QEXTSERIALENUMERATOR_P_H_ +#define _QEXTSERIALENUMERATOR_P_H_ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QESP API. It exists for the convenience +// of other QESP classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qextserialenumerator.h" + +#ifdef Q_OS_WIN +// needed for mingw to pull in appropriate dbt business... +// probably a better way to do this +// http://mingw-users.1079350.n2.nabble.com/DEV-BROADCAST-DEVICEINTERFACE-was-not-declared-in-this-scope-td3552762.html +# ifdef __MINGW32__ +# define _WIN32_WINNT 0x0500 +# define _WIN32_WINDOWS 0x0500 +# define WINVER 0x0500 +# endif +# include +#endif /*Q_OS_WIN*/ + +#ifdef Q_OS_MAC +# include +#endif /*Q_OS_MAC*/ + +#if (defined(QT_GUI_LIB) && QT_VERSION < QT_VERSION_CHECK(5, 0, 0)) || defined(QT_WIDGETS_LIB) +# define HAS_QWIDGET +#endif + +class QextSerialRegistrationWidget; +class QextSerialEnumeratorPrivate +{ + Q_DECLARE_PUBLIC(QextSerialEnumerator) +public: + QextSerialEnumeratorPrivate(QextSerialEnumerator * enumrator); + ~QextSerialEnumeratorPrivate(); + void platformSpecificInit(); + void platformSpecificDestruct(); + + static QList getPorts_sys(); + bool setUpNotifications_sys(bool setup); + +#ifdef Q_OS_WIN + LRESULT onDeviceChanged( WPARAM wParam, LPARAM lParam ); + bool matchAndDispatchChangedDevice(const QString & deviceID, const GUID & guid, WPARAM wParam); +# ifdef HAS_QWIDGET + QextSerialRegistrationWidget* notificationWidget; +# endif +#endif /*Q_OS_WIN*/ + +#ifdef Q_OS_MAC + /*! + * Search for serial ports using IOKit. + * \param infoList list with result. + */ + static void iterateServicesOSX(io_object_t service, QList & infoList); + static bool getServiceDetailsOSX( io_object_t service, QextPortInfo* portInfo ); + void onDeviceDiscoveredOSX( io_object_t service ); + void onDeviceTerminatedOSX( io_object_t service ); + friend void deviceDiscoveredCallbackOSX( void *ctxt, io_iterator_t serialPortIterator ); + friend void deviceTerminatedCallbackOSX( void *ctxt, io_iterator_t serialPortIterator ); + + IONotificationPortRef notificationPortRef; +#endif // Q_OS_MAC + +private: + QextSerialEnumerator * q_ptr; +}; + +#endif //_QEXTSERIALENUMERATOR_P_H_ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_unix.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_unix.cpp new file mode 100644 index 0000000..3a48aa4 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_unix.cpp @@ -0,0 +1,100 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialenumerator.h" +#include "qextserialenumerator_p.h" +#include +#include +#include + +void QextSerialEnumeratorPrivate::platformSpecificInit() +{ +} + +void QextSerialEnumeratorPrivate::platformSpecificDestruct() +{ +} + +QList QextSerialEnumeratorPrivate::getPorts_sys() +{ + QList infoList; +#ifdef Q_OS_LINUX + QStringList portNamePrefixes, portNameList; + portNamePrefixes << QLatin1String("ttyS*"); // list normal serial ports first + + QDir dir(QLatin1String("/dev")); + portNameList = dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name); + + // remove the values which are not serial ports for e.g. /dev/ttysa + for (int i = 0; i < portNameList.size(); i++) { + bool ok; + QString current = portNameList.at(i); + // remove the ttyS part, and check, if the other part is a number + current.remove(0,4).toInt(&ok, 10); + if (!ok) { + portNameList.removeAt(i); + i--; + } + } + + // get the non standard serial ports names + // (USB-serial, bluetooth-serial, 18F PICs, and so on) + // if you know an other name prefix for serial ports please let us know + portNamePrefixes.clear(); + portNamePrefixes << QLatin1String("ttyACM*") << QLatin1String("ttyUSB*") << QLatin1String("rfcomm*"); + portNameList += dir.entryList(portNamePrefixes, (QDir::System | QDir::Files), QDir::Name); + + foreach (QString str , portNameList) { + QextPortInfo inf; + inf.physName = QLatin1String("/dev/")+str; + inf.portName = str; + + if (str.contains(QLatin1String("ttyS"))) { + inf.friendName = QLatin1String("Serial port ")+str.remove(0, 4); + } + else if (str.contains(QLatin1String("ttyUSB"))) { + inf.friendName = QLatin1String("USB-serial adapter ")+str.remove(0, 6); + } + else if (str.contains(QLatin1String("rfcomm"))) { + inf.friendName = QLatin1String("Bluetooth-serial adapter ")+str.remove(0, 6); + } + inf.enumName = QLatin1String("/dev"); // is there a more helpful name for this? + infoList.append(inf); + } +#endif + return infoList; +} + +bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup) +{ + Q_UNUSED(setup) + return false; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_win.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_win.cpp new file mode 100644 index 0000000..42345be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialenumerator_win.cpp @@ -0,0 +1,291 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialenumerator.h" +#include "qextserialenumerator_p.h" +#include +#include +#include +#include +#include +#include +#include +#include "qextserialport.h" + +#ifdef HAS_QWIDGET +#include +class QextSerialRegistrationWidget : public QWidget +{ +public: + QextSerialRegistrationWidget(QextSerialEnumeratorPrivate* qese) { + this->qese = qese; + } + ~QextSerialRegistrationWidget() {} + +protected: + bool winEvent( MSG* message, long* result ) { + if ( message->message == WM_DEVICECHANGE ) { + qese->onDeviceChanged(message->wParam, message->lParam ); + *result = 1; + return true; + } + return false; + } +private: + QextSerialEnumeratorPrivate* qese; +}; + +#endif // HAS_QWIDGET + +void QextSerialEnumeratorPrivate::platformSpecificInit() +{ +#ifdef HAS_QWIDGET + notificationWidget = 0; +#endif // HAS_QWIDGET +} + +/*! + default +*/ +void QextSerialEnumeratorPrivate::platformSpecificDestruct() +{ +#ifdef HAS_QWIDGET + if( notificationWidget ) + delete notificationWidget; +#endif +} + +// ### This url has broken, anyone can fix it? +// see http://msdn.microsoft.com/en-us/library/ms791134.aspx for list of GUID classes +#ifndef GUID_DEVCLASS_PORTS + DEFINE_GUID(GUID_DEVCLASS_PORTS, 0x4D36E978, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 ); +#endif + +/* Gordon Schumacher's macros for TCHAR -> QString conversions and vice versa */ +#ifdef UNICODE + #define QStringToTCHAR(x) (wchar_t*) x.utf16() + #define PQStringToTCHAR(x) (wchar_t*) x->utf16() + #define TCHARToQString(x) QString::fromUtf16((ushort*)(x)) + #define TCHARToQStringN(x,y) QString::fromUtf16((ushort*)(x),(y)) +#else + #define QStringToTCHAR(x) x.local8Bit().constData() + #define PQStringToTCHAR(x) x->local8Bit().constData() + #define TCHARToQString(x) QString::fromLocal8Bit((char*)(x)) + #define TCHARToQStringN(x,y) QString::fromLocal8Bit((char*)(x),(y)) +#endif /*UNICODE*/ + +/*! + \internal + Get value of specified property from the registry. + \a key handle to an open key. + \a property property name. + + return property value. +*/ +static QString getRegKeyValue(HKEY key, LPCTSTR property) +{ + DWORD size = 0; + DWORD type; + ::RegQueryValueEx(key, property, NULL, NULL, NULL, & size); + BYTE* buff = new BYTE[size]; + QString result; + if(::RegQueryValueEx(key, property, NULL, &type, buff, & size) == ERROR_SUCCESS ) + result = TCHARToQString(buff); + ::RegCloseKey(key); + delete [] buff; + return result; +} + +/*! + \internal + Get specific property from registry. + \a devInfo pointer to the device information set that contains the interface + and its underlying device. Returned by SetupDiGetClassDevs() function. + \a devData pointer to an SP_DEVINFO_DATA structure that defines the device instance. + this is returned by SetupDiGetDeviceInterfaceDetail() function. + \a property registry property. One of defined SPDRP_* constants. + + return property string. + */ +static QString getDeviceProperty(HDEVINFO devInfo, PSP_DEVINFO_DATA devData, DWORD property) +{ + DWORD buffSize = 0; + ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, NULL, 0, & buffSize); + BYTE* buff = new BYTE[buffSize]; + ::SetupDiGetDeviceRegistryProperty(devInfo, devData, property, NULL, buff, buffSize, NULL); + QString result = TCHARToQString(buff); + delete [] buff; + return result; +} + +/*! + \internal +*/ +static bool getDeviceDetailsWin( QextPortInfo* portInfo, HDEVINFO devInfo, PSP_DEVINFO_DATA devData + , WPARAM wParam = DBT_DEVICEARRIVAL) +{ + portInfo->friendName = getDeviceProperty(devInfo, devData, SPDRP_FRIENDLYNAME); + if( wParam == DBT_DEVICEARRIVAL) + portInfo->physName = getDeviceProperty(devInfo, devData, SPDRP_PHYSICAL_DEVICE_OBJECT_NAME); + portInfo->enumName = getDeviceProperty(devInfo, devData, SPDRP_ENUMERATOR_NAME); + QString hardwareIDs = getDeviceProperty(devInfo, devData, SPDRP_HARDWAREID); + HKEY devKey = ::SetupDiOpenDevRegKey(devInfo, devData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_QUERY_VALUE); + portInfo->portName = getRegKeyValue(devKey, TEXT("PortName")); + QRegExp idRx(QLatin1String("VID_(\\w+)&PID_(\\w+)")); + if(hardwareIDs.toUpper().contains(idRx)) { + bool dummy; + portInfo->vendorID = idRx.cap(1).toInt(&dummy, 16); + portInfo->productID = idRx.cap(2).toInt(&dummy, 16); + //qDebug() << "got vid:" << vid << "pid:" << pid; + } + return true; +} + +/*! + \internal +*/ +static void enumerateDevicesWin( const GUID & guid, QList* infoList ) +{ + HDEVINFO devInfo; + if( (devInfo = ::SetupDiGetClassDevs(&guid, NULL, NULL, DIGCF_PRESENT)) != INVALID_HANDLE_VALUE) { + SP_DEVINFO_DATA devInfoData; + devInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + for(int i = 0; ::SetupDiEnumDeviceInfo(devInfo, i, &devInfoData); i++) { + QextPortInfo info; + info.productID = info.vendorID = 0; + getDeviceDetailsWin( &info, devInfo, &devInfoData ); + infoList->append(info); + } + ::SetupDiDestroyDeviceInfoList(devInfo); + } +} + + +static bool lessThan(const QextPortInfo &s1, const QextPortInfo &s2) +{ + if (s1.portName.startsWith(QLatin1String("COM")) + && s2.portName.startsWith(QLatin1String("COM"))) { + return s1.portName.mid(3).toInt() QextSerialEnumeratorPrivate::getPorts_sys() +{ + QList ports; + enumerateDevicesWin(GUID_DEVCLASS_PORTS, &ports); + qSort(ports.begin(), ports.end(), lessThan); + return ports; +} + + +/* + Enable event-driven notifications of board discovery/removal. +*/ +bool QextSerialEnumeratorPrivate::setUpNotifications_sys(bool setup) +{ +#ifndef HAS_QWIDGET + Q_UNUSED(setup) + QESP_WARNING("QextSerialEnumerator: GUI not enabled - can't register for device notifications."); + return false; +#else + Q_Q(QextSerialEnumerator); + if(setup && notificationWidget) //already setup + return true; + notificationWidget = new QextSerialRegistrationWidget(this); + + DEV_BROADCAST_DEVICEINTERFACE dbh; + ::ZeroMemory(&dbh, sizeof(dbh)); + dbh.dbcc_size = sizeof(dbh); + dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE; + ::CopyMemory(&dbh.dbcc_classguid, &GUID_DEVCLASS_PORTS, sizeof(GUID)); + if(::RegisterDeviceNotification((HWND)notificationWidget->winId(), &dbh, DEVICE_NOTIFY_WINDOW_HANDLE ) == NULL) { + QESP_WARNING() << "RegisterDeviceNotification failed:" << GetLastError(); + return false; + } + // setting up notifications doesn't tell us about devices already connected + // so get those manually + foreach(QextPortInfo port, getPorts_sys()) + Q_EMIT q->deviceDiscovered(port); + return true; +#endif +} + +LRESULT QextSerialEnumeratorPrivate::onDeviceChanged( WPARAM wParam, LPARAM lParam ) +{ + if (DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam ) { + PDEV_BROADCAST_HDR pHdr = (PDEV_BROADCAST_HDR)lParam; + if(pHdr->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE ) { + PDEV_BROADCAST_DEVICEINTERFACE pDevInf = (PDEV_BROADCAST_DEVICEINTERFACE)pHdr; + // delimiters are different across APIs...change to backslash. ugh. + QString deviceID = TCHARToQString(pDevInf->dbcc_name).toUpper().replace(QLatin1String("#"), QLatin1String("\\")); + + matchAndDispatchChangedDevice(deviceID, GUID_DEVCLASS_PORTS, wParam); + } + } + return 0; +} + +bool QextSerialEnumeratorPrivate::matchAndDispatchChangedDevice(const QString & deviceID, const GUID & guid, WPARAM wParam) +{ + Q_Q(QextSerialEnumerator); + bool rv = false; + DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : DIGCF_ALLCLASSES; + HDEVINFO devInfo; + if( (devInfo = SetupDiGetClassDevs(&guid,NULL,NULL,dwFlag)) != INVALID_HANDLE_VALUE ) { + SP_DEVINFO_DATA spDevInfoData; + spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); + for(int i=0; SetupDiEnumDeviceInfo(devInfo, i, &spDevInfoData); i++) { + DWORD nSize=0 ; + TCHAR buf[MAX_PATH]; + if ( SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize) && + deviceID.contains(TCHARToQString(buf))) { // we found a match + rv = true; + QextPortInfo info; + info.productID = info.vendorID = 0; + getDeviceDetailsWin( &info, devInfo, &spDevInfoData, wParam ); + if( wParam == DBT_DEVICEARRIVAL ) + Q_EMIT q->deviceDiscovered(info); + else if( wParam == DBT_DEVICEREMOVECOMPLETE ) + Q_EMIT q->deviceRemoved(info); + break; + } + } + SetupDiDestroyDeviceInfoList(devInfo); + } + return rv; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.cpp new file mode 100644 index 0000000..49d86aa --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.cpp @@ -0,0 +1,1028 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialport.h" +#include "qextserialport_p.h" +#include +#include +#include +#include + +/*! + \enum BaudRateType + + baud rate values support. +*/ + +/*! + \enum DataBitsType +*/ + +/*! + \enum ParityType +*/ + +/*! + \enum StopBitsType + + \value STOP_1 + \value STOP_1_5 + \value STOP_2 +*/ + +/*! + \enum FlowType +*/ + +/*! + \class PortSettings + + \brief The PortSettings class contain port settings + + Structure to contain port settings. + + \code + BaudRateType BaudRate; + DataBitsType DataBits; + ParityType Parity; + StopBitsType StopBits; + FlowType FlowControl; + long Timeout_Millisec; + \endcode +*/ + +QextSerialPortPrivate::QextSerialPortPrivate(QextSerialPort *q) + :lock(QReadWriteLock::Recursive), q_ptr(q) +{ + lastErr = E_NO_ERROR; + Settings.BaudRate = BAUD9600; + Settings.Parity = PAR_NONE; + Settings.FlowControl = FLOW_OFF; + Settings.DataBits = DATA_8; + Settings.StopBits = STOP_1; + Settings.Timeout_Millisec = 10; + settingsDirtyFlags = DFE_ALL; + + platformSpecificInit(); +} + +QextSerialPortPrivate::~QextSerialPortPrivate() +{ + platformSpecificDestruct(); +} + +void QextSerialPortPrivate::setBaudRate(BaudRateType baudRate, bool update) +{ + switch (baudRate) { +#ifdef Q_OS_WIN + //Windows Special + case BAUD14400: + case BAUD56000: + case BAUD128000: + case BAUD256000: + QESP_PORTABILITY_WARNING()<<"QextSerialPort Portability Warning: POSIX does not support baudRate:"<isOpen()) + updatePortSettings(); + break; + default: + QESP_WARNING()<<"QextSerialPort does not support baudRate:"<isOpen()) + updatePortSettings(); +} + +void QextSerialPortPrivate::setDataBits(DataBitsType dataBits, bool update) +{ + switch(dataBits) { + + case DATA_5: + if (Settings.StopBits==STOP_2) { + QESP_WARNING("QextSerialPort: 5 Data bits cannot be used with 2 stop bits."); + } + else { + Settings.DataBits=dataBits; + settingsDirtyFlags |= DFE_DataBits; + } + break; + + case DATA_6: +#ifdef Q_OS_WIN + if (Settings.StopBits==STOP_1_5) { + QESP_WARNING("QextSerialPort: 6 Data bits cannot be used with 1.5 stop bits."); + } + else +#endif + { + Settings.DataBits=dataBits; + settingsDirtyFlags |= DFE_DataBits; + } + break; + + case DATA_7: +#ifdef Q_OS_WIN + if (Settings.StopBits==STOP_1_5) { + QESP_WARNING("QextSerialPort: 7 Data bits cannot be used with 1.5 stop bits."); + } + else +#endif + { + Settings.DataBits=dataBits; + settingsDirtyFlags |= DFE_DataBits; + } + break; + + case DATA_8: +#ifdef Q_OS_WIN + if (Settings.StopBits==STOP_1_5) { + QESP_WARNING("QextSerialPort: 8 Data bits cannot be used with 1.5 stop bits."); + } + else +#endif + { + Settings.DataBits=dataBits; + settingsDirtyFlags |= DFE_DataBits; + } + break; + default: + QESP_WARNING()<<"QextSerialPort does not support Data bits:"<isOpen()) + updatePortSettings(); +} + +void QextSerialPortPrivate::setStopBits(StopBitsType stopBits, bool update) +{ + switch (stopBits) { + + /*one stop bit*/ + case STOP_1: + Settings.StopBits = stopBits; + settingsDirtyFlags |= DFE_StopBits; + break; + +#ifdef Q_OS_WIN + /*1.5 stop bits*/ + case STOP_1_5: + QESP_PORTABILITY_WARNING("QextSerialPort Portability Warning: 1.5 stop bit operation is not supported by POSIX."); + if (Settings.DataBits!=DATA_5) { + QESP_WARNING("QextSerialPort: 1.5 stop bits can only be used with 5 data bits"); + } + else { + Settings.StopBits = stopBits; + settingsDirtyFlags |= DFE_StopBits; + } + break; +#endif + + /*two stop bits*/ + case STOP_2: + if (Settings.DataBits==DATA_5) { + QESP_WARNING("QextSerialPort: 2 stop bits cannot be used with 5 data bits"); + } + else { + Settings.StopBits = stopBits; + settingsDirtyFlags |= DFE_StopBits; + } + break; + default: + QESP_WARNING()<<"QextSerialPort does not support stop bits: "<isOpen()) + updatePortSettings(); +} + +void QextSerialPortPrivate::setFlowControl(FlowType flow, bool update) +{ + Settings.FlowControl=flow; + settingsDirtyFlags |= DFE_Flow; + if (update && q_func()->isOpen()) + updatePortSettings(); +} + +void QextSerialPortPrivate::setTimeout(long millisec, bool update) +{ + Settings.Timeout_Millisec = millisec; + settingsDirtyFlags |= DFE_TimeOut; + if (update && q_func()->isOpen()) + updatePortSettings(); +} + +void QextSerialPortPrivate::setPortSettings(const PortSettings &settings, bool update) +{ + setBaudRate(settings.BaudRate, false); + setDataBits(settings.DataBits, false); + setStopBits(settings.StopBits, false); + setParity(settings.Parity, false); + setFlowControl(settings.FlowControl, false); + setTimeout(settings.Timeout_Millisec, false); + settingsDirtyFlags = DFE_ALL; + if (update && q_func()->isOpen()) + updatePortSettings(); +} + + +void QextSerialPortPrivate::_q_canRead() +{ + qint64 maxSize = bytesAvailable_sys(); + if (maxSize > 0) { + char * writePtr = readBuffer.reserve(size_t(maxSize)); + qint64 bytesRead = readData_sys(writePtr, maxSize); + if (bytesRead < maxSize) + readBuffer.chop(maxSize - bytesRead); + Q_Q(QextSerialPort); + Q_EMIT q->readyRead(); + } +} + +/*! \class QextSerialPort + + \brief The QextSerialPort class encapsulates a serial port on both POSIX and Windows systems. + + \section1 Usage + QextSerialPort offers both a polling and event driven API. Event driven + is typically easier to use, since you never have to worry about checking + for new data. + + \bold Example + \code + QextSerialPort* port = new QextSerialPort("COM1"); + connect(port, SIGNAL(readyRead()), myClass, SLOT(onDataAvailable())); + port->open(); + + void MyClass::onDataAvailable() { + int avail = port->bytesAvailable(); + if( avail > 0 ) { + QByteArray usbdata; + usbdata.resize(avail); + int read = port->read(usbdata.data(), usbdata.size()); + if( read > 0 ) { + processNewData(usbdata); + } + } + } + \endcode + + \section1 Compatibility + The user will be notified of errors and possible portability conflicts at run-time + by default. + + For example, if a application has used BAUD1800, when it is runing under unix, you + will get following message. + + \code + QextSerialPort Portability Warning: Windows does not support baudRate:1800 + \endcode + + This behavior can be turned off by defining macro QESP_NO_WARN (to turn off all warnings) + or QESP_NO_PORTABILITY_WARN (to turn off portability warnings) in the project. + + + \bold Author: Stefan Sander, Michal Policht, Brandon Fosdick, Liam Staskawicz, Debao Zhang +*/ + +/*! + \enum QextSerialPort::QueryMode + + This enum type specifies query mode used in a serial port: + + \value Polling + asynchronously read and write + \value EventDriven + synchronously read and write +*/ + +/*! + \fn void QextSerialPort::dsrChanged(bool status) + This signal is emitted whenever dsr line has changed its state. You may + use this signal to check if device is connected. + + \a status true when DSR signal is on, false otherwise. + */ + + +/*! + \fn QueryMode QextSerialPort::queryMode() const + Get query mode. + */ + +/*! + Default constructor. Note that the name of the device used by a QextSerialPort is dependent on + your OS. Possible naming conventions and their associated OS are: + + \code + + OS Constant Used By Naming Convention + ------------- ------------- ------------------------ + Q_OS_WIN Windows COM1, COM2 + Q_OS_IRIX SGI/IRIX /dev/ttyf1, /dev/ttyf2 + Q_OS_HPUX HP-UX /dev/tty1p0, /dev/tty2p0 + Q_OS_SOLARIS SunOS/Slaris /dev/ttya, /dev/ttyb + Q_OS_OSF Digital UNIX /dev/tty01, /dev/tty02 + Q_OS_FREEBSD FreeBSD /dev/ttyd0, /dev/ttyd1 + Q_OS_OPENBSD OpenBSD /dev/tty00, /dev/tty01 + Q_OS_LINUX Linux /dev/ttyS0, /dev/ttyS1 + /dev/ttyS0, /dev/ttyS1 + \endcode + + This constructor assigns the device name to the name of the first port on the specified system. + See the other constructors if you need to open a different port. Default \a mode is EventDriven. + As a subclass of QObject, \a parent can be specified. +*/ + +QextSerialPort::QextSerialPort(QextSerialPort::QueryMode mode, QObject *parent) + : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this)) +{ +#ifdef Q_OS_WIN + setPortName(QLatin1String("COM1")); + +#elif defined(Q_OS_IRIX) + setPortName(QLatin1String("/dev/ttyf1")); + +#elif defined(Q_OS_HPUX) + setPortName(QLatin1String("/dev/tty1p0")); + +#elif defined(Q_OS_SOLARIS) + setPortName(QLatin1String("/dev/ttya")); + +#elif defined(Q_OS_OSF) //formally DIGITAL UNIX + setPortName(QLatin1String("/dev/tty01")); + +#elif defined(Q_OS_FREEBSD) + setPortName(QLatin1String("/dev/ttyd1")); + +#elif defined(Q_OS_OPENBSD) + setPortName(QLatin1String("/dev/tty00")); + +#else + setPortName(QLatin1String("/dev/ttyS0")); +#endif + setQueryMode(mode); +} + +/*! + Constructs a serial port attached to the port specified by name. + \a name is the name of the device, which is windowsystem-specific, + e.g."COM1" or "/dev/ttyS0". \a mode +*/ +QextSerialPort::QextSerialPort(const QString & name, QextSerialPort::QueryMode mode, QObject *parent) + : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this)) +{ + setQueryMode(mode); + setPortName(name); +} + +/*! + Constructs a port with default name and specified \a settings. +*/ +QextSerialPort::QextSerialPort(const PortSettings& settings, QextSerialPort::QueryMode mode, QObject *parent) + : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this)) +{ + Q_D(QextSerialPort); + setQueryMode(mode); + d->setPortSettings(settings); +} + +/*! + Constructs a port with specified \a name , \a mode and \a settings. +*/ +QextSerialPort::QextSerialPort(const QString & name, const PortSettings& settings, QextSerialPort::QueryMode mode, QObject *parent) + : QIODevice(parent), d_ptr(new QextSerialPortPrivate(this)) +{ + Q_D(QextSerialPort); + setPortName(name); + setQueryMode(mode); + d->setPortSettings(settings); +} + +/*! + Opens a serial port and sets its OpenMode to \a mode. + Note that this function does not specify which device to open. + Returns true if successful; otherwise returns false.This function has no effect + if the port associated with the class is already open. The port is also + configured to the current settings, as stored in the Settings structure. +*/ +bool QextSerialPort::open(OpenMode mode) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (mode != QIODevice::NotOpen && !isOpen()) + d->open_sys(mode); + + return isOpen(); +} + + +/*! \reimp + Closes a serial port. This function has no effect if the serial port associated with the class + is not currently open. +*/ +void QextSerialPort::close() +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (isOpen()) { + // Be a good QIODevice and call QIODevice::close() before really close() + // so the aboutToClose() signal is emitted at the proper time + QIODevice::close(); // mark ourselves as closed + d->close_sys(); + d->readBuffer.clear(); + } +} + +/*! + Flushes all pending I/O to the serial port. This function has no effect if the serial port + associated with the class is not currently open. +*/ +void QextSerialPort::flush() +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (isOpen()) + d->flush_sys(); +} + +/*! \reimp + Returns the number of bytes waiting in the port's receive queue. This function will return 0 if + the port is not currently open, or -1 on error. +*/ +qint64 QextSerialPort::bytesAvailable() const +{ + QWriteLocker locker(&d_func()->lock); + if (isOpen()) { + qint64 bytes = d_func()->bytesAvailable_sys(); + if (bytes != -1) { + return bytes + d_func()->readBuffer.size() + + QIODevice::bytesAvailable(); + } else { + return -1; + } + } + return 0; +} + +/*! + * Set desired serial communication handling style. You may choose from polling + * or event driven approach. This function does nothing when port is open; to + * apply changes port must be reopened. + * + * In event driven approach read() and write() functions are acting + * asynchronously. They return immediately and the operation is performed in + * the background, so they doesn't freeze the calling thread. + * To determine when operation is finished, QextSerialPort runs separate thread + * and monitors serial port events. Whenever the event occurs, adequate signal + * is emitted. + * + * When polling is set, read() and write() are acting synchronously. Signals are + * not working in this mode and some functions may not be available. The advantage + * of polling is that it generates less overhead due to lack of signals emissions + * and it doesn't start separate thread to monitor events. + * + * Generally event driven approach is more capable and friendly, although some + * applications may need as low overhead as possible and then polling comes. + * + * \a mode query mode. + */ +void QextSerialPort::setQueryMode(QueryMode mode) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (mode != d->_queryMode) { + d->_queryMode = mode; + } +} + +/*! + Sets the \a name of the device associated with the object, e.g. "COM1", or "/dev/ttyS0". +*/ +void QextSerialPort::setPortName(const QString & name) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + d->port = name; +} + +/*! + Returns the name set by setPortName(). +*/ +QString QextSerialPort::portName() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->port; +} + +QextSerialPort::QueryMode QextSerialPort::queryMode() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->_queryMode; +} + +/*! + Reads all available data from the device, and returns it as a QByteArray. + This function has no way of reporting errors; returning an empty QByteArray() + can mean either that no data was currently available for reading, or that an error occurred. +*/ +QByteArray QextSerialPort::readAll() +{ + int avail = this->bytesAvailable(); + return (avail > 0) ? this->read(avail) : QByteArray(); +} + +/*! + Returns the baud rate of the serial port. For a list of possible return values see + the definition of the enum BaudRateType. +*/ +BaudRateType QextSerialPort::baudRate() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->Settings.BaudRate; +} + +/*! + Returns the number of data bits used by the port. For a list of possible values returned by + this function, see the definition of the enum DataBitsType. +*/ +DataBitsType QextSerialPort::dataBits() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->Settings.DataBits; +} + +/*! + Returns the type of parity used by the port. For a list of possible values returned by + this function, see the definition of the enum ParityType. +*/ +ParityType QextSerialPort::parity() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->Settings.Parity; +} + +/*! + Returns the number of stop bits used by the port. For a list of possible return values, see + the definition of the enum StopBitsType. +*/ +StopBitsType QextSerialPort::stopBits() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->Settings.StopBits; +} + +/*! + Returns the type of flow control used by the port. For a list of possible values returned + by this function, see the definition of the enum FlowType. +*/ +FlowType QextSerialPort::flowControl() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->Settings.FlowControl; +} + +/*! + Returns true if device is sequential, otherwise returns false. Serial port is sequential device + so this function always returns true. Check QIODevice::isSequential() documentation for more + information. +*/ +bool QextSerialPort::isSequential() const +{ + return true; +} + +/*! + Return the error number, or 0 if no error occurred. +*/ +ulong QextSerialPort::lastError() const +{ + QReadLocker locker(&d_func()->lock); + return d_func()->lastErr; +} + +/*! + Returns the line status as stored by the port function. This function will retrieve the states + of the following lines: DCD, CTS, DSR, and RI. On POSIX systems, the following additional lines + can be monitored: DTR, RTS, Secondary TXD, and Secondary RXD. The value returned is an unsigned + long with specific bits indicating which lines are high. The following constants should be used + to examine the states of individual lines: + + \code + Mask Line + ------ ---- + LS_CTS CTS + LS_DSR DSR + LS_DCD DCD + LS_RI RI + LS_RTS RTS (POSIX only) + LS_DTR DTR (POSIX only) + LS_ST Secondary TXD (POSIX only) + LS_SR Secondary RXD (POSIX only) + \endcode + + This function will return 0 if the port associated with the class is not currently open. +*/ +unsigned long QextSerialPort::lineStatus() +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (isOpen()) + return d->lineStatus_sys(); + return 0; +} + +/*! + Returns a human-readable description of the last device error that occurred. +*/ +QString QextSerialPort::errorString() +{ + Q_D(QextSerialPort); + QReadLocker locker(&d->lock); + switch(d->lastErr) { + case E_NO_ERROR: + return tr("No Error has occurred"); + case E_INVALID_FD: + return tr("Invalid file descriptor (port was not opened correctly)"); + case E_NO_MEMORY: + return tr("Unable to allocate memory tables (POSIX)"); + case E_CAUGHT_NON_BLOCKED_SIGNAL: + return tr("Caught a non-blocked signal (POSIX)"); + case E_PORT_TIMEOUT: + return tr("Operation timed out (POSIX)"); + case E_INVALID_DEVICE: + return tr("The file opened by the port is not a valid device"); + case E_BREAK_CONDITION: + return tr("The port detected a break condition"); + case E_FRAMING_ERROR: + return tr("The port detected a framing error (usually caused by incorrect baud rate settings)"); + case E_IO_ERROR: + return tr("There was an I/O error while communicating with the port"); + case E_BUFFER_OVERRUN: + return tr("Character buffer overrun"); + case E_RECEIVE_OVERFLOW: + return tr("Receive buffer overflow"); + case E_RECEIVE_PARITY_ERROR: + return tr("The port detected a parity error in the received data"); + case E_TRANSMIT_OVERFLOW: + return tr("Transmit buffer overflow"); + case E_READ_FAILED: + return tr("General read operation failure"); + case E_WRITE_FAILED: + return tr("General write operation failure"); + case E_FILE_NOT_FOUND: + return tr("The %1 file doesn't exists").arg(this->portName()); + case E_PERMISSION_DENIED: + return tr("Permission denied"); + case E_AGAIN: + return tr("Device is already locked"); + default: + return tr("Unknown error: %1").arg(d->lastErr); + } +} + +/*! + Destructs the QextSerialPort object. +*/ +QextSerialPort::~QextSerialPort() +{ + if (isOpen()) { + close(); + } + delete d_ptr; +} + +/*! + Sets the flow control used by the port to \a flow. Possible values of flow are: + \code + FLOW_OFF No flow control + FLOW_HARDWARE Hardware (RTS/CTS) flow control + FLOW_XONXOFF Software (XON/XOFF) flow control + \endcode +*/ +void QextSerialPort::setFlowControl(FlowType flow) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.FlowControl != flow) + d->setFlowControl(flow, true); +} + +/*! + Sets the parity associated with the serial port to \a parity. The possible values of parity are: + \code + PAR_SPACE Space Parity + PAR_MARK Mark Parity + PAR_NONE No Parity + PAR_EVEN Even Parity + PAR_ODD Odd Parity + \endcode +*/ +void QextSerialPort::setParity(ParityType parity) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.Parity != parity) + d->setParity(parity, true); +} + +/*! + Sets the number of data bits used by the serial port to \a dataBits. Possible values of dataBits are: + \code + DATA_5 5 data bits + DATA_6 6 data bits + DATA_7 7 data bits + DATA_8 8 data bits + \endcode + + \bold note: + This function is subject to the following restrictions: + \list + \o 5 data bits cannot be used with 2 stop bits. + \o 1.5 stop bits can only be used with 5 data bits. + \o 8 data bits cannot be used with space parity on POSIX systems. + \endlist + */ +void QextSerialPort::setDataBits(DataBitsType dataBits) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.DataBits != dataBits) + d->setDataBits(dataBits, true); +} + +/*! + Sets the number of stop bits used by the serial port to \a stopBits. Possible values of stopBits are: + \code + STOP_1 1 stop bit + STOP_1_5 1.5 stop bits + STOP_2 2 stop bits + \endcode + + \bold note: + This function is subject to the following restrictions: + \list + \o 2 stop bits cannot be used with 5 data bits. + \o 1.5 stop bits cannot be used with 6 or more data bits. + \o POSIX does not support 1.5 stop bits. + \endlist +*/ +void QextSerialPort::setStopBits(StopBitsType stopBits) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.StopBits != stopBits) + d->setStopBits(stopBits, true); +} + +/*! + Sets the baud rate of the serial port to \a baudRate. Note that not all rates are applicable on + all platforms. The following table shows translations of the various baud rate + constants on Windows(including NT/2000) and POSIX platforms. Speeds marked with an * + are speeds that are usable on both Windows and POSIX. + \code + + RATE Windows Speed POSIX Speed + ----------- ------------- ----------- + BAUD50 X 50 + BAUD75 X 75 + *BAUD110 110 110 + BAUD134 X 134.5 + BAUD150 X 150 + BAUD200 X 200 + *BAUD300 300 300 + *BAUD600 600 600 + *BAUD1200 1200 1200 + BAUD1800 X 1800 + *BAUD2400 2400 2400 + *BAUD4800 4800 4800 + *BAUD9600 9600 9600 + BAUD14400 14400 X + *BAUD19200 19200 19200 + *BAUD38400 38400 38400 + BAUD56000 56000 X + *BAUD57600 57600 57600 + BAUD76800 X 76800 + *BAUD115200 115200 115200 + BAUD128000 128000 X + BAUD230400 X 230400 + BAUD256000 256000 X + BAUD460800 X 460800 + BAUD500000 X 500000 + BAUD576000 X 576000 + BAUD921600 X 921600 + BAUD1000000 X 1000000 + BAUD1152000 X 1152000 + BAUD1500000 X 1500000 + BAUD2000000 X 2000000 + BAUD2500000 X 2500000 + BAUD3000000 X 3000000 + BAUD3500000 X 3500000 + BAUD4000000 X 4000000 + \endcode +*/ + +void QextSerialPort::setBaudRate(BaudRateType baudRate) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.BaudRate != baudRate) + d->setBaudRate(baudRate, true); +} + +/*! + For Unix: + + Sets the read and write timeouts for the port to \a millisec milliseconds. + Note that this is a per-character timeout, i.e. the port will wait this long for each + individual character, not for the whole read operation. This timeout also applies to the + bytesWaiting() function. + + \bold note: + POSIX does not support millisecond-level control for I/O timeout values. Any + timeout set using this function will be set to the next lowest tenth of a second for + the purposes of detecting read or write timeouts. For example a timeout of 550 milliseconds + will be seen by the class as a timeout of 500 milliseconds for the purposes of reading and + writing the port. However millisecond-level control is allowed by the select() system call, + so for example a 550-millisecond timeout will be seen as 550 milliseconds on POSIX systems for + the purpose of detecting available bytes in the read buffer. + + For Windows: + + Sets the read and write timeouts for the port to \a millisec milliseconds. + Setting 0 indicates that timeouts are not used for read nor write operations; + however read() and write() functions will still block. Set -1 to provide + non-blocking behaviour (read() and write() will return immediately). + + \bold note: this function does nothing in event driven mode. +*/ +void QextSerialPort::setTimeout(long millisec) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (d->Settings.Timeout_Millisec != millisec) + d->setTimeout(millisec, true); +} + +/*! + Sets DTR line to the requested state (\a set default to high). This function will have no effect if + the port associated with the class is not currently open. +*/ +void QextSerialPort::setDtr(bool set) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (isOpen()) + d->setDtr_sys(set); +} + +/*! + Sets RTS line to the requested state \a set (high by default). + This function will have no effect if + the port associated with the class is not currently open. +*/ +void QextSerialPort::setRts(bool set) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + if (isOpen()) + d->setRts_sys(set); +} + +/*! \reimp + Reads a block of data from the serial port. This function will read at most maxlen bytes from + the serial port and place them in the buffer pointed to by data. Return value is the number of + bytes actually read, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPort::readData(char *data, qint64 maxSize) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + qint64 bytesFromBuffer = 0; + if (!d->readBuffer.isEmpty()) { + bytesFromBuffer = d->readBuffer.read(data, maxSize); + if (bytesFromBuffer == maxSize) + return bytesFromBuffer; + } + qint64 bytesFromDevice = d->readData_sys(data+bytesFromBuffer, maxSize-bytesFromBuffer); + if (bytesFromDevice < 0) { + return -1; + } + return bytesFromBuffer + bytesFromDevice; +} + +/*! \reimp + Writes a block of data to the serial port. This function will write len bytes + from the buffer pointed to by data to the serial port. Return value is the number + of bytes actually written, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPort::writeData(const char *data, qint64 maxSize) +{ + Q_D(QextSerialPort); + QWriteLocker locker(&d->lock); + return d->writeData_sys(data, maxSize); +} + +#include "moc_qextserialport.cpp" diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.h new file mode 100644 index 0000000..c68857b --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.h @@ -0,0 +1,239 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#ifndef _QEXTSERIALPORT_H_ +#define _QEXTSERIALPORT_H_ + +#include +#include "qextserialport_global.h" +#ifdef Q_OS_UNIX +#include +#endif +/*line status constants*/ +// ### QESP2.0 move to enum +#define LS_CTS 0x01 +#define LS_DSR 0x02 +#define LS_DCD 0x04 +#define LS_RI 0x08 +#define LS_RTS 0x10 +#define LS_DTR 0x20 +#define LS_ST 0x40 +#define LS_SR 0x80 + +/*error constants*/ +// ### QESP2.0 move to enum +#define E_NO_ERROR 0 +#define E_INVALID_FD 1 +#define E_NO_MEMORY 2 +#define E_CAUGHT_NON_BLOCKED_SIGNAL 3 +#define E_PORT_TIMEOUT 4 +#define E_INVALID_DEVICE 5 +#define E_BREAK_CONDITION 6 +#define E_FRAMING_ERROR 7 +#define E_IO_ERROR 8 +#define E_BUFFER_OVERRUN 9 +#define E_RECEIVE_OVERFLOW 10 +#define E_RECEIVE_PARITY_ERROR 11 +#define E_TRANSMIT_OVERFLOW 12 +#define E_READ_FAILED 13 +#define E_WRITE_FAILED 14 +#define E_FILE_NOT_FOUND 15 +#define E_PERMISSION_DENIED 16 +#define E_AGAIN 17 + +enum BaudRateType +{ +#if defined(Q_OS_UNIX) || defined(qdoc) + BAUD50 = 50, //POSIX ONLY + BAUD75 = 75, //POSIX ONLY + BAUD134 = 134, //POSIX ONLY + BAUD150 = 150, //POSIX ONLY + BAUD200 = 200, //POSIX ONLY + BAUD1800 = 1800, //POSIX ONLY +# if defined(B76800) || defined(qdoc) + BAUD76800 = 76800, //POSIX ONLY +# endif +# if (defined(B230400) && defined(B4000000)) || defined(qdoc) + BAUD230400 = 230400, //POSIX ONLY + BAUD460800 = 460800, //POSIX ONLY + BAUD500000 = 500000, //POSIX ONLY + BAUD576000 = 576000, //POSIX ONLY + BAUD921600 = 921600, //POSIX ONLY + BAUD1000000 = 1000000, //POSIX ONLY + BAUD1152000 = 1152000, //POSIX ONLY + BAUD1500000 = 1500000, //POSIX ONLY + BAUD2000000 = 2000000, //POSIX ONLY + BAUD2500000 = 2500000, //POSIX ONLY + BAUD3000000 = 3000000, //POSIX ONLY + BAUD3500000 = 3500000, //POSIX ONLY + BAUD4000000 = 4000000, //POSIX ONLY +# endif +#endif //Q_OS_UNIX +#if defined(Q_OS_WIN) || defined(qdoc) + BAUD14400 = 14400, //WINDOWS ONLY + BAUD56000 = 56000, //WINDOWS ONLY + BAUD128000 = 128000, //WINDOWS ONLY + BAUD256000 = 256000, //WINDOWS ONLY +#endif //Q_OS_WIN + BAUD110 = 110, + BAUD300 = 300, + BAUD600 = 600, + BAUD1200 = 1200, + BAUD2400 = 2400, + BAUD4800 = 4800, + BAUD9600 = 9600, + BAUD19200 = 19200, + BAUD38400 = 38400, + BAUD57600 = 57600, + BAUD115200 = 115200 +}; + +enum DataBitsType +{ + DATA_5 = 5, + DATA_6 = 6, + DATA_7 = 7, + DATA_8 = 8 +}; + +enum ParityType +{ + PAR_NONE, + PAR_ODD, + PAR_EVEN, +#if defined(Q_OS_WIN) || defined(qdoc) + PAR_MARK, //WINDOWS ONLY +#endif + PAR_SPACE +}; + +enum StopBitsType +{ + STOP_1, +#if defined(Q_OS_WIN) || defined(qdoc) + STOP_1_5, //WINDOWS ONLY +#endif + STOP_2 +}; + +enum FlowType +{ + FLOW_OFF, + FLOW_HARDWARE, + FLOW_XONXOFF +}; + +/** + * structure to contain port settings + */ +struct PortSettings +{ + BaudRateType BaudRate; + DataBitsType DataBits; + ParityType Parity; + StopBitsType StopBits; + FlowType FlowControl; + long Timeout_Millisec; +}; + +class QextSerialPortPrivate; +class QEXTSERIALPORT_EXPORT QextSerialPort: public QIODevice +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QextSerialPort) + Q_ENUMS(QueryMode) + Q_PROPERTY(QString portName READ portName WRITE setPortName) + Q_PROPERTY(QueryMode queryMode READ queryMode WRITE setQueryMode) +public: + enum QueryMode { + Polling, + EventDriven + }; + + explicit QextSerialPort(QueryMode mode = EventDriven, QObject* parent = 0); + explicit QextSerialPort(const QString & name, QueryMode mode = EventDriven, QObject * parent = 0); + explicit QextSerialPort(const PortSettings & s, QueryMode mode = EventDriven, QObject * parent = 0); + QextSerialPort(const QString & name, const PortSettings& s, QueryMode mode = EventDriven, QObject *parent=0); + + ~QextSerialPort(); + + QString portName() const; + QueryMode queryMode() const; + BaudRateType baudRate() const; + DataBitsType dataBits() const; + ParityType parity() const; + StopBitsType stopBits() const; + FlowType flowControl() const; + + bool open(OpenMode mode); + bool isSequential() const; + void close(); + void flush(); + qint64 bytesAvailable() const; + QByteArray readAll(); + + ulong lastError() const; + + ulong lineStatus(); + QString errorString(); + +public Q_SLOTS: + void setPortName(const QString & name); + void setQueryMode(QueryMode mode); + void setBaudRate(BaudRateType); + void setDataBits(DataBitsType); + void setParity(ParityType); + void setStopBits(StopBitsType); + void setFlowControl(FlowType); + void setTimeout(long); + + void setDtr(bool set=true); + void setRts(bool set=true); + +Q_SIGNALS: + void dsrChanged(bool status); + +protected: + qint64 readData(char * data, qint64 maxSize); + qint64 writeData(const char * data, qint64 maxSize); + +private: + Q_DISABLE_COPY(QextSerialPort) + +#ifdef Q_OS_WIN + Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE)) +#endif + Q_PRIVATE_SLOT(d_func(), void _q_canRead()) + + QextSerialPortPrivate * const d_ptr; +}; + +#endif diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.pri b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.pri new file mode 100644 index 0000000..8bca43f --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport.pri @@ -0,0 +1,45 @@ +exists(../common.pri) { + #For case: + # someone want to copy all file in the src/ directory + # to their project src/ directory and they does not like + # the common.pri file. + #In this case: + # they can just include this file (qextserialport.pri) too. + include(../common.pri) +} +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +qextserialport-library:!qextserialport-buildlib { + # Using QextSerialPort as shared or static library. + LIBS += -L$$QEXTSERIALPORT_LIBDIR -l$$QEXTSERIALPORT_LIBNAME + !qextserialport-static: DEFINES += QEXTSERIALPORT_USING_SHARED +} else { + # Building library(shared or static) + # or including source files + HEADERS += $$PWD/qextserialport.h \ + $$PWD/qextserialport_p.h \ + $$PWD/qextserialenumerator.h \ + $$PWD/qextserialenumerator_p.h \ + $$PWD/qextserialport_global.h + SOURCES += $$PWD/qextserialport.cpp \ + $$PWD/qextserialenumerator.cpp + unix:SOURCES += $$PWD/qextserialport_unix.cpp + unix:!macx:SOURCES += $$PWD/qextserialenumerator_unix.cpp + macx:SOURCES += $$PWD/qextserialenumerator_osx.cpp + win32:SOURCES += $$PWD/qextserialport_win.cpp \ + $$PWD/qextserialenumerator_win.cpp + + # For Windows user who doesn't have Qt4's Private files + win32:contains(QT_VERSION, ^4\\..*\\..*):!exists($$[QT_INSTALL_HEADERS]/QtCore/private/qwineventnotifier_p.h){ + DEFINES += QESP_NO_QT4_PRIVATE + HEADERS += $$PWD/qextwineventnotifier_p.h + SOURCES += $$PWD/qextwineventnotifier_p.cpp + } + + # For building shared library only + contains(TEMPLATE, .*lib):contains(CONFIG, shared): DEFINES += QEXTSERIALPORT_BUILD_SHARED +} + +macx:LIBS += -framework IOKit -framework CoreFoundation +win32:LIBS += -lsetupapi -ladvapi32 -luser32 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_global.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_global.h new file mode 100644 index 0000000..a00d5e1 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_global.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#ifndef QEXTSERIALPORT_GLOBAL_H +#define QEXTSERIALPORT_GLOBAL_H + +#include + +#ifdef QEXTSERIALPORT_BUILD_SHARED +# define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT +#elif defined(QEXTSERIALPORT_USING_SHARED) +# define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT +#else +# define QEXTSERIALPORT_EXPORT +#endif + +// ### for compatible with old version. should be removed in QESP 2.0 +#ifdef _TTY_NOWARN_ +# define QESP_NO_WARN +#endif +#ifdef _TTY_NOWARN_PORT_ +# define QESP_NO_PORTABILITY_WARN +#endif + +/*if all warning messages are turned off, flag portability warnings to be turned off as well*/ +#ifdef QESP_NO_WARN +# define QESP_NO_PORTABILITY_WARN +#endif + +/*macros for warning and debug messages*/ +#ifdef QESP_NO_PORTABILITY_WARN +# define QESP_PORTABILITY_WARNING while(false)qWarning +#else +# define QESP_PORTABILITY_WARNING qWarning +#endif /*QESP_NOWARN_PORT*/ + +#ifdef QESP_NO_WARN +# define QESP_WARNING while(false)qWarning +#else +# define QESP_WARNING qWarning +#endif /*QESP_NOWARN*/ + +#endif // QEXTSERIALPORT_GLOBAL_H + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_p.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_p.h new file mode 100644 index 0000000..15dd7c2 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_p.h @@ -0,0 +1,242 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#ifndef _QEXTSERIALPORT_P_H_ +#define _QEXTSERIALPORT_P_H_ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QESP API. It exists for the convenience +// of other QESP classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qextserialport.h" +#include +#ifdef Q_OS_UNIX +# include +#elif (defined Q_OS_WIN) +# include +#endif +#include + +// This is QextSerialPort's read buffer, needed by posix system. +// ref: QRingBuffer & QIODevicePrivateLinearBuffer +class QextReadBuffer +{ +public: + inline QextReadBuffer(size_t growth=4096) + : len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) { + } + + ~QextReadBuffer() { + delete [] buf; + } + + inline void clear() { + first = buf; + len = 0; + } + + inline int size() const { + return len; + } + + inline bool isEmpty() const { + return len == 0; + } + + inline int read(char* target, int size) { + int r = qMin(size, len); + if (r == 1) { + *target = *first; + --len; + ++first; + } else { + memcpy(target, first, r); + len -= r; + first += r; + } + return r; + } + + inline char* reserve(size_t size) { + if ((first - buf) + len + size > capacity) { + size_t newCapacity = qMax(capacity, basicBlockSize); + while (newCapacity < size) + newCapacity *= 2; + if (newCapacity > capacity) { + // allocate more space + char* newBuf = new char[newCapacity]; + memmove(newBuf, first, len); + delete [] buf; + buf = newBuf; + capacity = newCapacity; + } else { + // shift any existing data to make space + memmove(buf, first, len); + } + first = buf; + } + char* writePtr = first + len; + len += (int)size; + return writePtr; + } + + inline void chop(int size) { + if (size >= len) { + clear(); + } else { + len -= size; + } + } + + inline void squeeze() { + if (first != buf) { + memmove(buf, first, len); + first = buf; + } + size_t newCapacity = basicBlockSize; + while (newCapacity < size_t(len)) + newCapacity *= 2; + if (newCapacity < capacity) { + char * tmp = static_cast(realloc(buf, newCapacity)); + if (tmp) { + buf = tmp; + capacity = newCapacity; + } + } + } + + inline QByteArray readAll() { + char* f = first; + int l = len; + clear(); + return QByteArray(f, l); + } + +private: + int len; + char* first; + char* buf; + size_t capacity; + size_t basicBlockSize; +}; + +class QextWinEventNotifier; +class QWinEventNotifier; +class QReadWriteLock; +class QSocketNotifier; + +class QextSerialPortPrivate +{ + Q_DECLARE_PUBLIC(QextSerialPort) +public: + QextSerialPortPrivate(QextSerialPort * q); + ~QextSerialPortPrivate(); + enum DirtyFlagEnum + { + DFE_BaudRate = 0x0001, + DFE_Parity = 0x0002, + DFE_StopBits = 0x0004, + DFE_DataBits = 0x0008, + DFE_Flow = 0x0010, + DFE_TimeOut = 0x0100, + DFE_ALL = 0x0fff, + DFE_Settings_Mask = 0x00ff //without TimeOut + }; + mutable QReadWriteLock lock; + QString port; + PortSettings Settings; + QextReadBuffer readBuffer; + int settingsDirtyFlags; + ulong lastErr; + QextSerialPort::QueryMode _queryMode; + + // platform specific members +#ifdef Q_OS_UNIX + int fd; + QSocketNotifier *readNotifier; + struct termios Posix_CommConfig; + struct termios old_termios; +#elif (defined Q_OS_WIN) + HANDLE Win_Handle; + OVERLAPPED overlap; + COMMCONFIG Win_CommConfig; + COMMTIMEOUTS Win_CommTimeouts; +# ifndef QESP_NO_QT4_PRIVATE + QWinEventNotifier *winEventNotifier; +# else + QextWinEventNotifier *winEventNotifier; +# endif + DWORD eventMask; + QList pendingWrites; + QReadWriteLock* bytesToWriteLock; + qint64 _bytesToWrite; +#endif + + /*fill PortSettings*/ + void setBaudRate(BaudRateType baudRate, bool update=true); + void setDataBits(DataBitsType dataBits, bool update=true); + void setParity(ParityType parity, bool update=true); + void setStopBits(StopBitsType stopbits, bool update=true); + void setFlowControl(FlowType flow, bool update=true); + void setTimeout(long millisec, bool update=true); + void setPortSettings(const PortSettings& settings, bool update=true); + + void platformSpecificDestruct(); + void platformSpecificInit(); + void translateError(ulong error); + void updatePortSettings(); + + qint64 readData_sys(char * data, qint64 maxSize); + qint64 writeData_sys(const char * data, qint64 maxSize); + void setDtr_sys(bool set=true); + void setRts_sys(bool set=true); + bool open_sys(QIODevice::OpenMode mode); + bool close_sys(); + bool flush_sys(); + ulong lineStatus_sys(); + qint64 bytesAvailable_sys() const; + +#ifdef Q_OS_WIN + void _q_onWinEvent(HANDLE h); +#endif + void _q_canRead(); + + QextSerialPort * q_ptr; +}; + +#endif //_QEXTSERIALPORT_P_H_ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_unix.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_unix.cpp new file mode 100644 index 0000000..4b5b3f1 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_unix.cpp @@ -0,0 +1,448 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialport.h" +#include "qextserialport_p.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void QextSerialPortPrivate::platformSpecificInit() +{ + fd = 0; + readNotifier = 0; +} + +/*! + Standard destructor. +*/ +void QextSerialPortPrivate::platformSpecificDestruct() +{ +} + +bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode) +{ + Q_Q(QextSerialPort); + //note: linux 2.6.21 seems to ignore O_NDELAY flag + if ((fd = ::open(port.toAscii() ,O_RDWR | O_NOCTTY | O_NDELAY)) != -1) { + + /*In the Private class, We can not call QIODevice::open()*/ + q->setOpenMode(mode); // Flag the port as opened + ::tcgetattr(fd, &old_termios); // Save the old termios + Posix_CommConfig = old_termios; // Make a working copy + ::cfmakeraw(&Posix_CommConfig); // Enable raw access + + /*set up other port settings*/ + Posix_CommConfig.c_cflag |= CREAD|CLOCAL; + Posix_CommConfig.c_lflag &= (~(ICANON|ECHO|ECHOE|ECHOK|ECHONL|ISIG)); + Posix_CommConfig.c_iflag &= (~(INPCK|IGNPAR|PARMRK|ISTRIP|ICRNL|IXANY)); + Posix_CommConfig.c_oflag &= (~OPOST); + Posix_CommConfig.c_cc[VMIN] = 0; +#ifdef _POSIX_VDISABLE // Is a disable character available on this system? + // Some systems allow for per-device disable-characters, so get the + // proper value for the configured device + const long vdisable = ::fpathconf(fd, _PC_VDISABLE); + Posix_CommConfig.c_cc[VINTR] = vdisable; + Posix_CommConfig.c_cc[VQUIT] = vdisable; + Posix_CommConfig.c_cc[VSTART] = vdisable; + Posix_CommConfig.c_cc[VSTOP] = vdisable; + Posix_CommConfig.c_cc[VSUSP] = vdisable; +#endif //_POSIX_VDISABLE + settingsDirtyFlags = DFE_ALL; + updatePortSettings(); + + if (_queryMode == QextSerialPort::EventDriven) { + readNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, q); + q->connect(readNotifier, SIGNAL(activated(int)), q, SLOT(_q_canRead())); + } + return true; + } else { + translateError(errno); + return false; + } +} + +bool QextSerialPortPrivate::close_sys() +{ + // Force a flush and then restore the original termios + flush_sys(); + // Using both TCSAFLUSH and TCSANOW here discards any pending input + ::tcsetattr(fd, TCSAFLUSH | TCSANOW, &old_termios); // Restore termios + ::close(fd); + if(readNotifier) { + delete readNotifier; + readNotifier = 0; + } + return true; +} + +bool QextSerialPortPrivate::flush_sys() +{ + ::tcdrain(fd); + return true; +} + +qint64 QextSerialPortPrivate::bytesAvailable_sys() const +{ + int bytesQueued; + if (::ioctl(fd, FIONREAD, &bytesQueued) == -1) { + return (qint64)-1; + } + return bytesQueued; +} + +/*! + Translates a system-specific error code to a QextSerialPort error code. Used internally. +*/ +void QextSerialPortPrivate::translateError(ulong error) +{ + switch (error) { + case EBADF: + case ENOTTY: + lastErr = E_INVALID_FD; + break; + case EINTR: + lastErr = E_CAUGHT_NON_BLOCKED_SIGNAL; + break; + case ENOMEM: + lastErr = E_NO_MEMORY; + break; + case EACCES: + lastErr = E_PERMISSION_DENIED; + break; + case EAGAIN: + lastErr = E_AGAIN; + break; + } +} + +void QextSerialPortPrivate::setDtr_sys(bool set) +{ + int status; + ::ioctl(fd, TIOCMGET, &status); + if (set) + status |= TIOCM_DTR; + else + status &= ~TIOCM_DTR; + ::ioctl(fd, TIOCMSET, &status); +} + +void QextSerialPortPrivate::setRts_sys(bool set) +{ + int status; + ::ioctl(fd, TIOCMGET, &status); + if (set) + status |= TIOCM_RTS; + else + status &= ~TIOCM_RTS; + ::ioctl(fd, TIOCMSET, &status); +} + +unsigned long QextSerialPortPrivate::lineStatus_sys() +{ + unsigned long Status=0, Temp=0; + ::ioctl(fd, TIOCMGET, &Temp); + if (Temp & TIOCM_CTS) Status |= LS_CTS; + if (Temp & TIOCM_DSR) Status |= LS_DSR; + if (Temp & TIOCM_RI ) Status |= LS_RI; + if (Temp & TIOCM_CD ) Status |= LS_DCD; + if (Temp & TIOCM_DTR) Status |= LS_DTR; + if (Temp & TIOCM_RTS) Status |= LS_RTS; + if (Temp & TIOCM_ST ) Status |= LS_ST; + if (Temp & TIOCM_SR ) Status |= LS_SR; + return Status; +} + +/*! + Reads a block of data from the serial port. This function will read at most maxSize bytes from + the serial port and place them in the buffer pointed to by data. Return value is the number of + bytes actually read, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPortPrivate::readData_sys(char * data, qint64 maxSize) +{ + int retVal = ::read(fd, data, maxSize); + if (retVal == -1) + lastErr = E_READ_FAILED; + + return retVal; +} + +/*! + Writes a block of data to the serial port. This function will write maxSize bytes + from the buffer pointed to by data to the serial port. Return value is the number + of bytes actually written, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPortPrivate::writeData_sys(const char * data, qint64 maxSize) +{ + int retVal = ::write(fd, data, maxSize); + if (retVal == -1) + lastErr = E_WRITE_FAILED; + + return (qint64)retVal; +} + +static void setBaudRate2Termios(termios *config, int baudRate) +{ +#ifdef CBAUD + config->c_cflag &= (~CBAUD); + config->c_cflag |= baudRate; +#else + ::cfsetispeed(config, baudRate); + ::cfsetospeed(config, baudRate); +#endif +} + +/* + All the platform settings was performed in this function. +*/ +void QextSerialPortPrivate::updatePortSettings() +{ + if (!q_func()->isOpen() || !settingsDirtyFlags) + return; + + if (settingsDirtyFlags & DFE_BaudRate) { + switch (Settings.BaudRate) { + case BAUD50: + setBaudRate2Termios(&Posix_CommConfig, B50); + break; + case BAUD75: + setBaudRate2Termios(&Posix_CommConfig, B75); + break; + case BAUD110: + setBaudRate2Termios(&Posix_CommConfig, B110); + break; + case BAUD134: + setBaudRate2Termios(&Posix_CommConfig, B134); + break; + case BAUD150: + setBaudRate2Termios(&Posix_CommConfig, B150); + break; + case BAUD200: + setBaudRate2Termios(&Posix_CommConfig, B200); + break; + case BAUD300: + setBaudRate2Termios(&Posix_CommConfig, B300); + break; + case BAUD600: + setBaudRate2Termios(&Posix_CommConfig, B600); + break; + case BAUD1200: + setBaudRate2Termios(&Posix_CommConfig, B1200); + break; + case BAUD1800: + setBaudRate2Termios(&Posix_CommConfig, B1800); + break; + case BAUD2400: + setBaudRate2Termios(&Posix_CommConfig, B2400); + break; + case BAUD4800: + setBaudRate2Termios(&Posix_CommConfig, B4800); + break; + case BAUD9600: + setBaudRate2Termios(&Posix_CommConfig, B9600); + break; + case BAUD19200: + setBaudRate2Termios(&Posix_CommConfig, B19200); + break; + case BAUD38400: + setBaudRate2Termios(&Posix_CommConfig, B38400); + break; + case BAUD57600: + setBaudRate2Termios(&Posix_CommConfig, B57600); + break; +#ifdef B76800 + case BAUD76800: + setBaudRate2Termios(&Posix_CommConfig, B76800); + break; +#endif + case BAUD115200: + setBaudRate2Termios(&Posix_CommConfig, B115200); + break; +#if defined(B230400) && defined(B4000000) + case BAUD230400: + setBaudRate2Termios(&Posix_CommConfig, B230400); + break; + case BAUD460800: + setBaudRate2Termios(&Posix_CommConfig, B460800); + break; + case BAUD500000: + setBaudRate2Termios(&Posix_CommConfig, B500000); + break; + case BAUD576000: + setBaudRate2Termios(&Posix_CommConfig, B576000); + break; + case BAUD921600: + setBaudRate2Termios(&Posix_CommConfig, B921600); + break; + case BAUD1000000: + setBaudRate2Termios(&Posix_CommConfig, B1000000); + break; + case BAUD1152000: + setBaudRate2Termios(&Posix_CommConfig, B1152000); + break; + case BAUD1500000: + setBaudRate2Termios(&Posix_CommConfig, B1500000); + break; + case BAUD2000000: + setBaudRate2Termios(&Posix_CommConfig, B2000000); + break; + case BAUD2500000: + setBaudRate2Termios(&Posix_CommConfig, B2500000); + break; + case BAUD3000000: + setBaudRate2Termios(&Posix_CommConfig, B3000000); + break; + case BAUD3500000: + setBaudRate2Termios(&Posix_CommConfig, B3500000); + break; + case BAUD4000000: + setBaudRate2Termios(&Posix_CommConfig, B4000000); + break; +#endif + } + } + if (settingsDirtyFlags & DFE_Parity) { + switch (Settings.Parity) { + case PAR_SPACE: + /*space parity not directly supported - add an extra data bit to simulate it*/ + settingsDirtyFlags |= DFE_DataBits; + break; + case PAR_NONE: + Posix_CommConfig.c_cflag &= (~PARENB); + break; + case PAR_EVEN: + Posix_CommConfig.c_cflag &= (~PARODD); + Posix_CommConfig.c_cflag |= PARENB; + break; + case PAR_ODD: + Posix_CommConfig.c_cflag |= (PARENB|PARODD); + break; + } + } + /*must after Parity settings*/ + if (settingsDirtyFlags & DFE_DataBits) { + if (Settings.Parity != PAR_SPACE) { + Posix_CommConfig.c_cflag &= (~CSIZE); + switch(Settings.DataBits) { + case DATA_5: + Posix_CommConfig.c_cflag |= CS5; + break; + case DATA_6: + Posix_CommConfig.c_cflag |= CS6; + break; + case DATA_7: + Posix_CommConfig.c_cflag |= CS7; + break; + case DATA_8: + Posix_CommConfig.c_cflag |= CS8; + break; + } + } else { + /*space parity not directly supported - add an extra data bit to simulate it*/ + Posix_CommConfig.c_cflag &= ~(PARENB|CSIZE); + switch(Settings.DataBits) { + case DATA_5: + Posix_CommConfig.c_cflag |= CS6; + break; + case DATA_6: + Posix_CommConfig.c_cflag |= CS7; + break; + case DATA_7: + Posix_CommConfig.c_cflag |= CS8; + break; + case DATA_8: + /*this will never happen, put here to Suppress an warning*/ + break; + } + } + } + if (settingsDirtyFlags & DFE_StopBits) { + switch (Settings.StopBits) { + case STOP_1: + Posix_CommConfig.c_cflag &= (~CSTOPB); + break; + case STOP_2: + Posix_CommConfig.c_cflag |= CSTOPB; + break; + } + } + if (settingsDirtyFlags & DFE_Flow) { + switch(Settings.FlowControl) { + case FLOW_OFF: + Posix_CommConfig.c_cflag &= (~CRTSCTS); + Posix_CommConfig.c_iflag &= (~(IXON|IXOFF|IXANY)); + break; + case FLOW_XONXOFF: + /*software (XON/XOFF) flow control*/ + Posix_CommConfig.c_cflag &= (~CRTSCTS); + Posix_CommConfig.c_iflag |= (IXON|IXOFF|IXANY); + break; + case FLOW_HARDWARE: + Posix_CommConfig.c_cflag |= CRTSCTS; + Posix_CommConfig.c_iflag &= (~(IXON|IXOFF|IXANY)); + break; + } + } + + /*if any thing in Posix_CommConfig changed, flush*/ + if (settingsDirtyFlags & DFE_Settings_Mask) + ::tcsetattr(fd, TCSAFLUSH, &Posix_CommConfig); + + if (settingsDirtyFlags & DFE_TimeOut) { + int millisec = Settings.Timeout_Millisec; + if (millisec == -1) { + ::fcntl(fd, F_SETFL, O_NDELAY); + } + else { + //O_SYNC should enable blocking ::write() + //however this seems not working on Linux 2.6.21 (works on OpenBSD 4.2) + ::fcntl(fd, F_SETFL, O_SYNC); + } + ::tcgetattr(fd, & Posix_CommConfig); + Posix_CommConfig.c_cc[VTIME] = millisec/100; + ::tcsetattr(fd, TCSAFLUSH, & Posix_CommConfig); + } + + settingsDirtyFlags = 0; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_win.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_win.cpp new file mode 100644 index 0000000..ac43207 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextserialport_win.cpp @@ -0,0 +1,425 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextserialport.h" +#include "qextserialport_p.h" +#include +#include +#include +#include +#include +#include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +# define WinEventNotifier QWinEventNotifier +#elif !defined(QESP_NO_QT4_PRIVATE) +# include +# define WinEventNotifier QWinEventNotifier +#else +# include "qextwineventnotifier_p.h" +# define WinEventNotifier QextWinEventNotifier +#endif +void QextSerialPortPrivate::platformSpecificInit() +{ + Win_Handle=INVALID_HANDLE_VALUE; + ZeroMemory(&overlap, sizeof(OVERLAPPED)); + overlap.hEvent = CreateEvent(NULL, true, false, NULL); + winEventNotifier = 0; + bytesToWriteLock = new QReadWriteLock; + _bytesToWrite = 0; +} + +void QextSerialPortPrivate::platformSpecificDestruct() { + CloseHandle(overlap.hEvent); + delete bytesToWriteLock; +} + + +/*! + \internal + COM ports greater than 9 need \\.\ prepended + + This is only need when open the port. +*/ +static QString fullPortNameWin(const QString & name) +{ + QRegExp rx(QLatin1String("^COM(\\d+)")); + QString fullName(name); + if(fullName.contains(rx)) + fullName.prepend(QLatin1String("\\\\.\\")); + return fullName; +} + +bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode) +{ + Q_Q(QextSerialPort); + DWORD confSize = sizeof(COMMCONFIG); + Win_CommConfig.dwSize = confSize; + DWORD dwFlagsAndAttributes = 0; + if (_queryMode == QextSerialPort::EventDriven) + dwFlagsAndAttributes += FILE_FLAG_OVERLAPPED; + + /*open the port*/ + Win_Handle=CreateFileW((wchar_t*)fullPortNameWin(port).utf16(), GENERIC_READ|GENERIC_WRITE, + 0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL); + if (Win_Handle!=INVALID_HANDLE_VALUE) { + q->setOpenMode(mode); + /*configure port settings*/ + GetCommConfig(Win_Handle, &Win_CommConfig, &confSize); + GetCommState(Win_Handle, &(Win_CommConfig.dcb)); + + /*set up parameters*/ + Win_CommConfig.dcb.fBinary=TRUE; + Win_CommConfig.dcb.fInX=FALSE; + Win_CommConfig.dcb.fOutX=FALSE; + Win_CommConfig.dcb.fAbortOnError=FALSE; + Win_CommConfig.dcb.fNull=FALSE; + /*flush all settings*/ + settingsDirtyFlags = DFE_ALL; + updatePortSettings(); + + //init event driven approach + if (_queryMode == QextSerialPort::EventDriven) { + if (!SetCommMask( Win_Handle, EV_TXEMPTY | EV_RXCHAR | EV_DSR)) { + QESP_WARNING()<<"failed to set Comm Mask. Error code:"<("HANDLE"); + q->connect(winEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onWinEvent(HANDLE)), Qt::DirectConnection); + WaitCommEvent(Win_Handle, &eventMask, &overlap); + } + return true; + } + return false; +} + +bool QextSerialPortPrivate::close_sys() +{ + flush_sys(); + CancelIo(Win_Handle); + if (CloseHandle(Win_Handle)) + Win_Handle = INVALID_HANDLE_VALUE; + if (winEventNotifier){ + winEventNotifier->setEnabled(false); + winEventNotifier->deleteLater(); + winEventNotifier = 0; + } + _bytesToWrite = 0; + + foreach(OVERLAPPED* o, pendingWrites) { + CloseHandle(o->hEvent); + delete o; + } + pendingWrites.clear(); + return true; +} + +bool QextSerialPortPrivate::flush_sys() +{ + FlushFileBuffers(Win_Handle); + return true; +} + +qint64 QextSerialPortPrivate::bytesAvailable_sys() const +{ + DWORD Errors; + COMSTAT Status; + if (ClearCommError(Win_Handle, &Errors, &Status)) { + return Status.cbInQue; + } + return (qint64)-1; +} + +/* + Translates a system-specific error code to a QextSerialPort error code. Used internally. +*/ +void QextSerialPortPrivate::translateError(ulong error) +{ + if (error&CE_BREAK) { + lastErr=E_BREAK_CONDITION; + } + else if (error&CE_FRAME) { + lastErr=E_FRAMING_ERROR; + } + else if (error&CE_IOE) { + lastErr=E_IO_ERROR; + } + else if (error&CE_MODE) { + lastErr=E_INVALID_FD; + } + else if (error&CE_OVERRUN) { + lastErr=E_BUFFER_OVERRUN; + } + else if (error&CE_RXPARITY) { + lastErr=E_RECEIVE_PARITY_ERROR; + } + else if (error&CE_RXOVER) { + lastErr=E_RECEIVE_OVERFLOW; + } + else if (error&CE_TXFULL) { + lastErr=E_TRANSMIT_OVERFLOW; + } +} + +/* + Reads a block of data from the serial port. This function will read at most maxlen bytes from + the serial port and place them in the buffer pointed to by data. Return value is the number of + bytes actually read, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize) +{ + DWORD bytesRead = 0; + bool failed = false; + if (_queryMode == QextSerialPort::EventDriven) { + OVERLAPPED overlapRead; + ZeroMemory(&overlapRead, sizeof(OVERLAPPED)); + if (!ReadFile(Win_Handle, (void*)data, (DWORD)maxSize, & bytesRead, & overlapRead)) { + if (GetLastError() == ERROR_IO_PENDING) + GetOverlappedResult(Win_Handle, & overlapRead, & bytesRead, true); + else + failed = true; + } + } else if (!ReadFile(Win_Handle, (void*)data, (DWORD)maxSize, & bytesRead, NULL)) { + failed = true; + } + if (!failed) + return (qint64)bytesRead; + + lastErr = E_READ_FAILED; + return -1; +} + +/* + Writes a block of data to the serial port. This function will write len bytes + from the buffer pointed to by data to the serial port. Return value is the number + of bytes actually written, or -1 on error. + + \warning before calling this function ensure that serial port associated with this class + is currently open (use isOpen() function to check if port is open). +*/ +qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize) +{ + DWORD bytesWritten = 0; + bool failed = false; + if (_queryMode == QextSerialPort::EventDriven) { + OVERLAPPED* newOverlapWrite = new OVERLAPPED; + ZeroMemory(newOverlapWrite, sizeof(OVERLAPPED)); + newOverlapWrite->hEvent = CreateEvent(NULL, true, false, NULL); + if (WriteFile(Win_Handle, (void*)data, (DWORD)maxSize, & bytesWritten, newOverlapWrite)) { + CloseHandle(newOverlapWrite->hEvent); + delete newOverlapWrite; + } + else if (GetLastError() == ERROR_IO_PENDING) { + // writing asynchronously...not an error + QWriteLocker writelocker(bytesToWriteLock); + _bytesToWrite += maxSize; + pendingWrites.append(newOverlapWrite); + } + else { + QESP_WARNING()<<"QextSerialPort write error:"<hEvent)) + QESP_WARNING("QextSerialPort: couldn't cancel IO"); + if(!CloseHandle(newOverlapWrite->hEvent)) + QESP_WARNING("QextSerialPort: couldn't close OVERLAPPED handle"); + delete newOverlapWrite; + } + } else if (!WriteFile(Win_Handle, (void*)data, (DWORD)maxSize, & bytesWritten, NULL)) { + failed = true; + } + + if (!failed) + return (qint64)bytesWritten; + + lastErr = E_WRITE_FAILED; + return -1; +} + +void QextSerialPortPrivate::setDtr_sys(bool set) { + EscapeCommFunction(Win_Handle, set ? SETDTR : CLRDTR); +} + +void QextSerialPortPrivate::setRts_sys(bool set) { + EscapeCommFunction(Win_Handle, set ? SETRTS : CLRRTS); +} + +ulong QextSerialPortPrivate::lineStatus_sys(void) { + unsigned long Status=0, Temp=0; + GetCommModemStatus(Win_Handle, &Temp); + if (Temp & MS_CTS_ON) Status|=LS_CTS; + if (Temp & MS_DSR_ON) Status|=LS_DSR; + if (Temp & MS_RING_ON) Status|=LS_RI; + if (Temp & MS_RLSD_ON) Status|=LS_DCD; + return Status; +} + +/* + Triggered when there's activity on our HANDLE. +*/ +void QextSerialPortPrivate::_q_onWinEvent(HANDLE h) +{ + Q_Q(QextSerialPort); + if(h == overlap.hEvent) { + if (eventMask & EV_RXCHAR) { + if (q->sender() != q && bytesAvailable_sys() > 0) + _q_canRead(); + } + if (eventMask & EV_TXEMPTY) { + /* + A write completed. Run through the list of OVERLAPPED writes, and if + they completed successfully, take them off the list and delete them. + Otherwise, leave them on there so they can finish. + */ + qint64 totalBytesWritten = 0; + QList overlapsToDelete; + foreach(OVERLAPPED* o, pendingWrites) { + DWORD numBytes = 0; + if (GetOverlappedResult(Win_Handle, o, & numBytes, false)) { + overlapsToDelete.append(o); + totalBytesWritten += numBytes; + } else if( GetLastError() != ERROR_IO_INCOMPLETE ) { + overlapsToDelete.append(o); + QESP_WARNING()<<"CommEvent overlapped write error:" << GetLastError(); + } + } + + if (q->sender() != q && totalBytesWritten > 0) { + QWriteLocker writelocker(bytesToWriteLock); + Q_EMIT q->bytesWritten(totalBytesWritten); + _bytesToWrite = 0; + } + + foreach(OVERLAPPED* o, overlapsToDelete) { + OVERLAPPED *toDelete = pendingWrites.takeAt(pendingWrites.indexOf(o)); + CloseHandle(toDelete->hEvent); + delete toDelete; + } + } + if (eventMask & EV_DSR) { + if (lineStatus_sys() & LS_DSR) + Q_EMIT q->dsrChanged(true); + else + Q_EMIT q->dsrChanged(false); + } + } + WaitCommEvent(Win_Handle, &eventMask, &overlap); +} + +void QextSerialPortPrivate::updatePortSettings() +{ + if (!q_ptr->isOpen() || !settingsDirtyFlags) + return; + + //fill struct : COMMCONFIG + if (settingsDirtyFlags & DFE_BaudRate) { + Win_CommConfig.dcb.BaudRate = Settings.BaudRate; + } + if (settingsDirtyFlags & DFE_Parity) { + Win_CommConfig.dcb.Parity = (BYTE)Settings.Parity; + Win_CommConfig.dcb.fParity = (Settings.Parity == PAR_NONE) ? FALSE : TRUE; + } + if (settingsDirtyFlags & DFE_DataBits) { + Win_CommConfig.dcb.ByteSize = (BYTE)Settings.DataBits; + } + if (settingsDirtyFlags & DFE_StopBits) { + switch (Settings.StopBits) { + case STOP_1: + Win_CommConfig.dcb.StopBits = ONESTOPBIT; + break; + case STOP_1_5: + Win_CommConfig.dcb.StopBits = ONE5STOPBITS; + break; + case STOP_2: + Win_CommConfig.dcb.StopBits = TWOSTOPBITS; + break; + } + } + if (settingsDirtyFlags & DFE_Flow) { + switch(Settings.FlowControl) { + /*no flow control*/ + case FLOW_OFF: + Win_CommConfig.dcb.fOutxCtsFlow=FALSE; + Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_DISABLE; + Win_CommConfig.dcb.fInX=FALSE; + Win_CommConfig.dcb.fOutX=FALSE; + break; + /*software (XON/XOFF) flow control*/ + case FLOW_XONXOFF: + Win_CommConfig.dcb.fOutxCtsFlow=FALSE; + Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_DISABLE; + Win_CommConfig.dcb.fInX=TRUE; + Win_CommConfig.dcb.fOutX=TRUE; + break; + /*hardware flow control*/ + case FLOW_HARDWARE: + Win_CommConfig.dcb.fOutxCtsFlow=TRUE; + Win_CommConfig.dcb.fRtsControl=RTS_CONTROL_HANDSHAKE; + Win_CommConfig.dcb.fInX=FALSE; + Win_CommConfig.dcb.fOutX=FALSE; + break; + } + } + + //fill struct : COMMTIMEOUTS + if (settingsDirtyFlags & DFE_TimeOut) { + if (_queryMode != QextSerialPort::EventDriven) { + int millisec = Settings.Timeout_Millisec; + if (millisec == -1) { + Win_CommTimeouts.ReadIntervalTimeout = MAXDWORD; + Win_CommTimeouts.ReadTotalTimeoutConstant = 0; + } else { + Win_CommTimeouts.ReadIntervalTimeout = millisec; + Win_CommTimeouts.ReadTotalTimeoutConstant = millisec; + } + Win_CommTimeouts.ReadTotalTimeoutMultiplier = 0; + Win_CommTimeouts.WriteTotalTimeoutMultiplier = millisec; + Win_CommTimeouts.WriteTotalTimeoutConstant = 0; + } + else { + Win_CommTimeouts.ReadIntervalTimeout = MAXDWORD; + Win_CommTimeouts.ReadTotalTimeoutMultiplier = 0; + Win_CommTimeouts.ReadTotalTimeoutConstant = 0; + Win_CommTimeouts.WriteTotalTimeoutMultiplier = 0; + Win_CommTimeouts.WriteTotalTimeoutConstant = 0; + } + } + + + if (settingsDirtyFlags & DFE_Settings_Mask) + SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG)); + if ((settingsDirtyFlags & DFE_TimeOut)) + SetCommTimeouts(Win_Handle, &Win_CommTimeouts); + settingsDirtyFlags = 0; +} diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.cpp new file mode 100644 index 0000000..3756cd3 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.cpp @@ -0,0 +1,247 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#include "qextwineventnotifier_p.h" +#include +#include +#include +#include +#include +#include +#include + +class QextWinEventNotifierPrivate +{ + Q_DECLARE_PUBLIC(QextWinEventNotifier) +public: + QextWinEventNotifierPrivate(HANDLE hEvent, QextWinEventNotifier * q) + :handleToEvent(hEvent), enabled(false), q_ptr(q) + {} + + HANDLE handleToEvent; + bool enabled; +private: + QextWinEventNotifier * q_ptr; +}; + +/* + \internal + + \class QextWinEventNotifierThread + + This class works more or less like an EventDispatcher. + + The api function WaitForMultipleObjects() is used in the new thread + to wait for the registered handle. +*/ +class QextWinEventNotifierThread:public QThread +{ +public: + explicit QextWinEventNotifierThread(QObject * parent=0); + ~QextWinEventNotifierThread(); + void stop(); + bool registerEventNotifier(QextWinEventNotifier * notifier); + void unregisterEventNotifier(QextWinEventNotifier * notifier); +protected: + void run(); +private: + HANDLE hStopEvent; //stop thread when this event signaled. + HANDLE hUpdateEvent; //make sure eventlist updated. + QMutex mutex; + QList winEventNotifierList; +}; + +Q_GLOBAL_STATIC(QextWinEventNotifierThread, notifierThread) + +QextWinEventNotifierThread::QextWinEventNotifierThread(QObject * parent) + :QThread(parent) +{ + hStopEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + hUpdateEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + start(); +} + +QextWinEventNotifierThread::~QextWinEventNotifierThread() +{ + if (isRunning()) + stop(); + CloseHandle(hStopEvent); + CloseHandle(hUpdateEvent); +} + +void QextWinEventNotifierThread::stop() +{ + { + QMutexLocker locker(&mutex); + SetEvent(hStopEvent); + } + wait(); /// Is this an good idea? +} + +bool QextWinEventNotifierThread::registerEventNotifier(QextWinEventNotifier *notifier) +{ + QMutexLocker locker(&mutex); + if (!notifier) { + QESP_WARNING("QextWinEventNotifier: Internal error"); + return false; + } + if (winEventNotifierList.contains(notifier)) + return true; + if (winEventNotifierList.count() >= MAXIMUM_WAIT_OBJECTS - 3) { + QESP_WARNING("QextWinEventNotifier: Cannot have more than %d enabled at one time", MAXIMUM_WAIT_OBJECTS - 3); + return false; + } + winEventNotifierList.append(notifier); + SetEvent(hUpdateEvent); + return true; +} + +void QextWinEventNotifierThread::unregisterEventNotifier(QextWinEventNotifier *notifier) +{ + QMutexLocker locker(&mutex); + if (!notifier) { + QESP_WARNING("QextWinEventNotifier: Internal error"); + return; + } + + int idx = winEventNotifierList.indexOf(notifier); + if (idx != -1) { + winEventNotifierList.takeAt(idx); + SetEvent(hUpdateEvent); + } +} + +void QextWinEventNotifierThread::run() +{ + forever{ + HANDLE pHandles[MAXIMUM_WAIT_OBJECTS - 1]; + DWORD nCount = 0; + { + QMutexLocker locker(&mutex); + nCount = winEventNotifierList.count(); + for (int i=0; i<(int)nCount; ++i) + pHandles[i] = winEventNotifierList.at(i)->handle(); + pHandles[nCount] = hUpdateEvent; + pHandles[nCount+1] = hStopEvent; + } + DWORD ret = WaitForMultipleObjects(nCount+2, pHandles, FALSE, INFINITE); + if (ret >= WAIT_OBJECT_0 && ret < WAIT_OBJECT_0 + nCount) { + QEvent *evt = new QEvent(QEvent::User); + QMutexLocker locker(&mutex); + ResetEvent(pHandles[ret-WAIT_OBJECT_0]); + QObject * notifier = winEventNotifierList[ret - WAIT_OBJECT_0]; + QCoreApplication::postEvent(notifier, evt); + } + else if (ret == WAIT_OBJECT_0 + nCount) { + //ResetEvent(hUpdateEvent); + } + else if (ret == WAIT_OBJECT_0 + nCount + 1) { + //qDebug()<<"quit..."; + return; + } + } +} + +/*! + \internal + \class QextWinEventNotifier + \brief The QextWinEventNotifier class provides support for the Windows Wait functions. + + The QextWinEventNotifier class makes it possible to use the wait + functions on windows in a asynchronous manner. With this class + you can register a HANDLE to an event and get notification when + that event becomes signalled. + + \bold Note: If it is a manual reset event ,it will be reset before + the notification. This is different from QWinEventNotifier. + + \bold Note: All the registered handles will be waited under a new thread. + This is different from QWinEventNotifier whose event handle will be waited + in its affinal thread. +*/ + +QextWinEventNotifier::QextWinEventNotifier(QObject *parent) + : QObject(parent), d_ptr(new QextWinEventNotifierPrivate(0, this)) +{} + +QextWinEventNotifier::QextWinEventNotifier(HANDLE hEvent, QObject *parent) + : QObject(parent), d_ptr(new QextWinEventNotifierPrivate(hEvent, this)) +{ + setEnabled(true); +} + +QextWinEventNotifier::~QextWinEventNotifier() +{ + setEnabled(false); +} + +void QextWinEventNotifier::setHandle(HANDLE hEvent) +{ + setEnabled(false); + Q_D(QextWinEventNotifier); + d->handleToEvent = hEvent; +} + +HANDLE QextWinEventNotifier::handle() const +{ + return d_func()->handleToEvent; +} + +bool QextWinEventNotifier::isEnabled() const +{ + return d_func()->enabled; +} + +void QextWinEventNotifier::setEnabled(bool enable) +{ + Q_D(QextWinEventNotifier); + + if (d->enabled == enable) + return; + d->enabled = enable; + + if (d->enabled) + notifierThread()->registerEventNotifier(this); + else + notifierThread()->unregisterEventNotifier(this); +} + +bool QextWinEventNotifier::event(QEvent * e) +{ + Q_D(QextWinEventNotifier); + QObject::event(e); + if (e->type() == QEvent::User) { + emit activated(d->handleToEvent); + return true; + } + return false; +} + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.h new file mode 100644 index 0000000..4aeec32 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/src/qextwineventnotifier_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** Copyright (c) 2000-2003 Wayne Roth +** Copyright (c) 2004-2007 Stefan Sander +** Copyright (c) 2007 Michal Policht +** Copyright (c) 2008 Brandon Fosdick +** Copyright (c) 2009-2010 Liam Staskawicz +** Copyright (c) 2011 Debao Zhang +** All right reserved. +** Web: http://code.google.com/p/qextserialport/ +** +** Permission is hereby granted, free of charge, to any person obtaining +** a copy of this software and associated documentation files (the +** "Software"), to deal in the Software without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Software, and to +** permit persons to whom the Software is furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be +** included in all copies or substantial portions of the Software. +** +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +** +****************************************************************************/ + +#ifndef QEXTWINEVENTNOTIFIER_P_H_ +#define QEXTWINEVENTNOTIFIER_P_H_ + +// +// W A R N I N G +// ------------- +// +// This file is not part of the QESP API. It exists for the convenience +// of other QESP classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include "qextserialport_global.h" + +class QextWinEventNotifierPrivate; +class QEXTSERIALPORT_EXPORT QextWinEventNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QextWinEventNotifier) + +public: + explicit QextWinEventNotifier(QObject *parent = 0); + explicit QextWinEventNotifier(HANDLE hEvent, QObject *parent = 0); + ~QextWinEventNotifier(); + + void setHandle(HANDLE hEvent); + HANDLE handle() const; + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enable); + +Q_SIGNALS: + void activated(HANDLE hEvent); + +protected: + bool event(QEvent * e); + +private: + Q_DISABLE_COPY(QextWinEventNotifier) + QextWinEventNotifierPrivate * d_ptr; +}; + +#endif // QEXTWINEVENTNOTIFIER_P_H_ diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/qextwineventnotifier.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/qextwineventnotifier.pro new file mode 100644 index 0000000..15f0b15 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/qextwineventnotifier.pro @@ -0,0 +1,7 @@ +TARGET = tst_qextwineventnotifier +INCLUDEPATH += ../../src +DEPENDPATH += ../../src +HEADERS += qextwineventnotifier_p.h +SOURCES += qextwineventnotifier_p.cpp \ + tst_qextwineventnotifier.cpp +QT = core testlib diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/tst_qextwineventnotifier.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/tst_qextwineventnotifier.cpp new file mode 100644 index 0000000..5d249af --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/qextwineventnotifier/tst_qextwineventnotifier.cpp @@ -0,0 +1,77 @@ +#include "qextwineventnotifier_p.h" +#include +#include + +class tst_QextWinEventNotifier : public QObject +{ + Q_OBJECT + +public: + tst_QextWinEventNotifier(){} + ~tst_QextWinEventNotifier(){} + + void initTestCase(){} + void cleanupTestCase(){} + void init(){} + void cleanup(){} + +protected slots: + void simple_activated(); + void simple_timerSet(); + +private slots: + void empty(); + void simple(); + +private: + HANDLE simpleHEvent; + int simpleActivated; +}; + +void tst_QextWinEventNotifier::simple_activated() +{ + ++simpleActivated; + ResetEvent((HANDLE)simpleHEvent); + QTestEventLoop::instance().exitLoop(); +} + +void tst_QextWinEventNotifier::simple_timerSet() +{ + SetEvent((HANDLE)simpleHEvent); +} + +void tst_QextWinEventNotifier::empty() +{ + QextWinEventNotifier n1, n2, n3; + n1.setEnabled(true); + n2.setEnabled(true); + n3.setEnabled(true); + n1.setEnabled(false); +} + +void tst_QextWinEventNotifier::simple() +{ + simpleHEvent = CreateEvent(0, TRUE, FALSE, 0); + QVERIFY(simpleHEvent); + + QextWinEventNotifier n(simpleHEvent); + QObject::connect(&n, SIGNAL(activated(HANDLE)), this, SLOT(simple_activated())); + + simpleActivated = 0; + SetEvent((HANDLE)simpleHEvent); + QTestEventLoop::instance().enterLoop(30); + if (QTestEventLoop::instance().timeout()) + QFAIL("Timed out"); + QVERIFY(simpleActivated == 1); + + simpleActivated = 0; + QTimer::singleShot(3000, this, SLOT(simple_timerSet())); + QTestEventLoop::instance().enterLoop(30); + if (QTestEventLoop::instance().timeout()) + QFAIL("Timed out"); + QVERIFY(simpleActivated == 1); +} + +QTEST_MAIN(tst_QextWinEventNotifier) + +#include "tst_qextwineventnotifier.moc" diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/tests.pro b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/tests.pro new file mode 100644 index 0000000..e68b4b4 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/qextserial/tests/tests.pro @@ -0,0 +1,2 @@ +TEMPLATE=subdirs +win32:SUBDIRS += qextwineventnotifier diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.cpp b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.cpp new file mode 100644 index 0000000..6ddd5db --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.cpp @@ -0,0 +1,95 @@ +#include "varclass.h" + +varclass::varclass() +{ + serial1open = false; + serial2open = false; +} + +void varclass::setTopCOM(QString set){ + topCOM = set; +} + +void varclass::setBottomCOM(QString set){ + bottomCOM = set; +} + +void varclass::setCustomSend(QString set, int whichvar){ + switch(whichvar){ + case(1): + customTopSend = set; + break; + case(2): + customBottomSend = set; + break; + } +} + +void varclass::setManualSend(QString set, int whichport){ + switch(whichport){ + case(1): + manualSendTop = set; + break; + case(2): + manualSendBottom = set; + break; + } +} + +QString varclass::getTopCOM(){ + return topCOM; +} + +QString varclass::getBottomCOM(){ + return bottomCOM; +} + +QString varclass::getCustomSend(int whichvar){ + switch(whichvar){ + case(1): + return customTopSend; + break; + case(2): + return customBottomSend; + break; + } + return "Broken"; +} + +QString varclass::getManualSend(int whichport){ + switch(whichport){ + case(1): + return manualSendTop; + break; + case(2): + return manualSendBottom; + break; + } + return "Error"; +} + + int varclass::getSerialStatus(int whichport){ + switch(whichport){ + case(1): + return serial1open; + break; + case(2): + return serial2open; + break; + } + + return -1; + } + + void varclass::toggleSerialStatus(int whichport){ + switch(whichport){ + case(1): + serial1open = !serial1open; + break; + case(2): + serial2open = !serial2open; + break; + } + } + + diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.h new file mode 100644 index 0000000..cab8ce9 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/LedDisplay/varclass.h @@ -0,0 +1,31 @@ +#ifndef VARCLASS_H +#define VARCLASS_H + +#include +class varclass +{ +public: + varclass(); + void setTopCOM(QString); + void setBottomCOM(QString); + void setCustomSend(QString, int); + void setManualSend(QString, int); + void toggleSerialStatus(int); + QString getTopCOM(); + QString getBottomCOM(); + QString getCustomSend(int); + QString getManualSend(int); + int getSerialStatus(int); + +private: + QString topCOM; + QString bottomCOM; + QString customTopSend; + QString customBottomSend; + QString manualSendTop; + QString manualSendBottom; + bool serial1open; + bool serial2open; +}; + +#endif // VARCLASS_H diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/PC Dot Matrix Control Application/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/Makefile b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/Makefile new file mode 100644 index 0000000..6c38e27 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/Makefile @@ -0,0 +1,335 @@ +#---------------------------------------------------------------------------- +# Wunderboard Makefile Template written by Dan Albert +#---------------------------------------------------------------------------- +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# Target file name. +TARGET = main + +# List C source files here. +SRC = $(TARGET).c \ + +# MCU name, you MUST set this to match the board you are using +# type "make clean" after changing this, so all files will be rebuilt +MCU = at90usb646 + +# Detect platform +UNAME = $(shell uname) + +ifeq ($(UNAME),Linux) +ENV=unix +endif + +ifeq ($(UNAME),Darwin) +ENV=unix +endif + +ifndef ENV +ENV=windows +endif + +ifeq ($(ENV),unix) +PROGRAM = dfu-programmer +PROGRAMFLAGS = $(MCU) +ERASE = erase +FLASH = flash "$(TARGET).hex" +START = start +else +PROGRAM = "C:/Program Files (x86)/Atmel/Flip 3.4.1/bin/batchisp.exe" +PROGRAMFLAGS = -device at90usb646 -hardware USB +ERASE = -operation erase F +FLASH = -operation loadbuffer "$(TARGET).hex" program verify +START = -operation start noreset 0 +endif + +# Processor frequency. +# Normally the first thing your program should do is set the clock prescaler, +# so your program will run at the correct speed. You should also set this +# variable to same clock speed. The _delay_ms() macro uses this, and many +# examples use this variable to calculate timings. Do not add a "UL" here. +F_CPU = 8000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = obj + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -Wall +CFLAGS += -Wstrict-prototypes +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + +MATH_LIB = -lm + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + +#============================================================================ + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym +#build: lib + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +# Display compiler version information. +gccversion : + @$(CC) --version + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + +## Program +.PHONY: program +program: all + $(PROGRAM) $(PROGRAMFLAGS) $(ERASE) + $(PROGRAM) $(PROGRAMFLAGS) $(FLASH) + $(PROGRAM) $(PROGRAMFLAGS) $(START) + +doxygen: + doxygen + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVEDIR) .dep + $(REMOVEDIR) $(OBJDIR) + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym \ +clean clean_list diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/desktop.ini b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/desktop.ini new file mode 100644 index 0000000..17b20be --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/desktop.ini @@ -0,0 +1,2 @@ +[.ShellClassInfo] +IconResource=C:\Users\corwinperren\AppData\Roaming\Insync\App\res\shared-folder-vista-7.ico,0 diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/font1.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/font1.h new file mode 100644 index 0000000..35eeb7c --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/font1.h @@ -0,0 +1,601 @@ +//Start the letter definition and put it in the FLASH memory + +//Spc 20 +char CH200[] PROGMEM = "11111111"; +char CH201[] PROGMEM = "11111111"; +char CH202[] PROGMEM = "11111111"; +char CH203[] PROGMEM = "11111111"; +char CH204[] PROGMEM = "11111111"; +char CH205[] PROGMEM = "11111111"; +char CH206[] PROGMEM = "11111111"; +char CH207[] PROGMEM = "11111111"; +//! 21 +char CH210[] PROGMEM = "11110111"; +char CH211[] PROGMEM = "11100011"; +char CH212[] PROGMEM = "11100011"; +char CH213[] PROGMEM = "11100011"; +char CH214[] PROGMEM = "11110111"; +char CH215[] PROGMEM = "11111111"; +char CH216[] PROGMEM = "11110111"; +char CH217[] PROGMEM = "11111111"; +//qt 22 +char CH220[] PROGMEM = "11001100"; +char CH221[] PROGMEM = "11001100"; +char CH222[] PROGMEM = "11001100"; +char CH223[] PROGMEM = "11001100"; +char CH224[] PROGMEM = "11111111"; +char CH225[] PROGMEM = "11111111"; +char CH226[] PROGMEM = "11111111"; +char CH227[] PROGMEM = "11111111"; +//# 23 +char CH230[] PROGMEM = "11101101"; +char CH231[] PROGMEM = "11101101"; +char CH232[] PROGMEM = "11000000"; +char CH233[] PROGMEM = "11101101"; +char CH234[] PROGMEM = "11000000"; +char CH235[] PROGMEM = "11101101"; +char CH236[] PROGMEM = "11101101"; +char CH237[] PROGMEM = "11111111"; +//$ 24 +char CH240[] PROGMEM = "11110111"; +char CH241[] PROGMEM = "11000001"; +char CH242[] PROGMEM = "10110111"; +char CH243[] PROGMEM = "11000001"; +char CH244[] PROGMEM = "11110110"; +char CH245[] PROGMEM = "11000001"; +char CH246[] PROGMEM = "11110111"; +char CH247[] PROGMEM = "11111111"; +//% 25 +char CH250[] PROGMEM = "11011110"; +char CH251[] PROGMEM = "10101101"; +char CH252[] PROGMEM = "11011011"; +char CH253[] PROGMEM = "11110111"; +char CH254[] PROGMEM = "11101101"; +char CH255[] PROGMEM = "11011010"; +char CH256[] PROGMEM = "10111101"; +char CH257[] PROGMEM = "11111111"; +//& 26 +char CH260[] PROGMEM = "11100111"; +char CH261[] PROGMEM = "11011011"; +char CH262[] PROGMEM = "11010111"; +char CH263[] PROGMEM = "11101111"; +char CH264[] PROGMEM = "11010110"; +char CH265[] PROGMEM = "11011001"; +char CH266[] PROGMEM = "11100010"; +char CH267[] PROGMEM = "11111111"; +//' 27 +char CH270[] PROGMEM = "11111100"; +char CH271[] PROGMEM = "11111001"; +char CH272[] PROGMEM = "11110011"; +char CH273[] PROGMEM = "11100111"; +char CH274[] PROGMEM = "11001111"; +char CH275[] PROGMEM = "11111111"; +char CH276[] PROGMEM = "11111111"; +char CH277[] PROGMEM = "11111111"; +//( 28 +char CH280[] PROGMEM = "11100111"; +char CH281[] PROGMEM = "11011111"; +char CH282[] PROGMEM = "10111111"; +char CH283[] PROGMEM = "10111111"; +char CH284[] PROGMEM = "10111111"; +char CH285[] PROGMEM = "11011111"; +char CH286[] PROGMEM = "11100111"; +char CH287[] PROGMEM = "11111111"; +//) 29 +char CH290[] PROGMEM = "11110011"; +char CH291[] PROGMEM = "11111101"; +char CH292[] PROGMEM = "11111110"; +char CH293[] PROGMEM = "11111110"; +char CH294[] PROGMEM = "11111110"; +char CH295[] PROGMEM = "11111101"; +char CH296[] PROGMEM = "11110011"; +char CH297[] PROGMEM = "11111111"; +//* 2A +char CH2A0[] PROGMEM = "10111110"; +char CH2A1[] PROGMEM = "11011101"; +char CH2A2[] PROGMEM = "11101011"; +char CH2A3[] PROGMEM = "10000000"; +char CH2A4[] PROGMEM = "11101011"; +char CH2A5[] PROGMEM = "11011101"; +char CH2A6[] PROGMEM = "10111110"; +char CH2A7[] PROGMEM = "11111111"; +//+ 2B +char CH2B0[] PROGMEM = "11110111"; +char CH2B1[] PROGMEM = "11110111"; +char CH2B2[] PROGMEM = "11110111"; +char CH2B3[] PROGMEM = "10000000"; +char CH2B4[] PROGMEM = "11110111"; +char CH2B5[] PROGMEM = "11110111"; +char CH2B6[] PROGMEM = "11110111"; +char CH2B7[] PROGMEM = "11111111"; +//, 2C +char CH2C0[] PROGMEM = "11111111"; +char CH2C1[] PROGMEM = "11111111"; +char CH2C2[] PROGMEM = "11111111"; +char CH2C3[] PROGMEM = "11100111"; +char CH2C4[] PROGMEM = "11000111"; +char CH2C5[] PROGMEM = "11000111"; +char CH2C6[] PROGMEM = "11011111"; +char CH2C7[] PROGMEM = "11111111"; +// 2D +char CH2D0[] PROGMEM = "11111111"; +char CH2D1[] PROGMEM = "11111111"; +char CH2D2[] PROGMEM = "11111111"; +char CH2D3[] PROGMEM = "11000000"; +char CH2D4[] PROGMEM = "11000000"; +char CH2D5[] PROGMEM = "11111111"; +char CH2D6[] PROGMEM = "11111111"; +char CH2D7[] PROGMEM = "11111111"; +//. 2E +char CH2E0[] PROGMEM = "11111111"; +char CH2E1[] PROGMEM = "11111111"; +char CH2E2[] PROGMEM = "11111111"; +char CH2E3[] PROGMEM = "11100011"; +char CH2E4[] PROGMEM = "11000001"; +char CH2E5[] PROGMEM = "11000001"; +char CH2E6[] PROGMEM = "11100011"; +char CH2E7[] PROGMEM = "11111111"; +/// 2F +char CH2F0[] PROGMEM = "11111110"; +char CH2F1[] PROGMEM = "11111100"; +char CH2F2[] PROGMEM = "11111001"; +char CH2F3[] PROGMEM = "11110011"; +char CH2F4[] PROGMEM = "11100111"; +char CH2F5[] PROGMEM = "11001111"; +char CH2F6[] PROGMEM = "11011111"; +char CH2F7[] PROGMEM = "11111111"; +//0 30 +char CH300[] PROGMEM = "11100011"; +char CH301[] PROGMEM = "11011101"; +char CH302[] PROGMEM = "10111010"; +char CH303[] PROGMEM = "10110110"; +char CH304[] PROGMEM = "10101110"; +char CH305[] PROGMEM = "11011101"; +char CH306[] PROGMEM = "11100011"; +char CH307[] PROGMEM = "11111111"; +//1 31 +char CH310[] PROGMEM = "11110111"; +char CH311[] PROGMEM = "11100111"; +char CH312[] PROGMEM = "11010111"; +char CH313[] PROGMEM = "11110111"; +char CH314[] PROGMEM = "11110111"; +char CH315[] PROGMEM = "11110111"; +char CH316[] PROGMEM = "11000001"; +char CH317[] PROGMEM = "11111111"; +//2 32 +char CH320[] PROGMEM = "11100011"; +char CH321[] PROGMEM = "11011101"; +char CH322[] PROGMEM = "11111101"; +char CH323[] PROGMEM = "11111011"; +char CH324[] PROGMEM = "11110111"; +char CH325[] PROGMEM = "11101111"; +char CH326[] PROGMEM = "11000000"; +char CH327[] PROGMEM = "11111111"; +//3 33 +char CH330[] PROGMEM = "11000001"; +char CH331[] PROGMEM = "10111110"; +char CH332[] PROGMEM = "11111110"; +char CH333[] PROGMEM = "11110001"; +char CH334[] PROGMEM = "11111110"; +char CH335[] PROGMEM = "10111110"; +char CH336[] PROGMEM = "11000001"; +char CH337[] PROGMEM = "11111111"; +//4 34 +char CH340[] PROGMEM = "11110011"; +char CH341[] PROGMEM = "11101011"; +char CH342[] PROGMEM = "11011011"; +char CH343[] PROGMEM = "10000000"; +char CH344[] PROGMEM = "11111011"; +char CH345[] PROGMEM = "11111011"; +char CH346[] PROGMEM = "11100001"; +char CH347[] PROGMEM = "11111111"; +//5 35 +char CH350[] PROGMEM = "10000000"; +char CH351[] PROGMEM = "10111111"; +char CH352[] PROGMEM = "10100001"; +char CH353[] PROGMEM = "10011110"; +char CH354[] PROGMEM = "11111110"; +char CH355[] PROGMEM = "10111110"; +char CH356[] PROGMEM = "11000001"; +char CH357[] PROGMEM = "11111111"; +//6 36 +char CH360[] PROGMEM = "11100001"; +char CH361[] PROGMEM = "11011110"; +char CH362[] PROGMEM = "10111111"; +char CH363[] PROGMEM = "10100001"; +char CH364[] PROGMEM = "10011110"; +char CH365[] PROGMEM = "10111110"; +char CH366[] PROGMEM = "11000001"; +char CH367[] PROGMEM = "11111111"; +//7 37 +char CH370[] PROGMEM = "10000000"; +char CH371[] PROGMEM = "10111110"; +char CH372[] PROGMEM = "11111101"; +char CH373[] PROGMEM = "11111011"; +char CH374[] PROGMEM = "11110111"; +char CH375[] PROGMEM = "11110111"; +char CH376[] PROGMEM = "11110111"; +char CH377[] PROGMEM = "11111111"; +//8 38 +char CH380[] PROGMEM = "11000001"; +char CH381[] PROGMEM = "10111110"; +char CH382[] PROGMEM = "10111110"; +char CH383[] PROGMEM = "11000001"; +char CH384[] PROGMEM = "10111110"; +char CH385[] PROGMEM = "10111110"; +char CH386[] PROGMEM = "11000001"; +char CH387[] PROGMEM = "11111111"; +//9 39 +char CH390[] PROGMEM = "11000001"; +char CH391[] PROGMEM = "10111110"; +char CH392[] PROGMEM = "10111110"; +char CH393[] PROGMEM = "11000000"; +char CH394[] PROGMEM = "11111110"; +char CH395[] PROGMEM = "10111101"; +char CH396[] PROGMEM = "11000011"; +char CH397[] PROGMEM = "11111111"; +//: 3A +char CH3A0[] PROGMEM = "11100011"; +char CH3A1[] PROGMEM = "11000001"; +char CH3A2[] PROGMEM = "11100011"; +char CH3A3[] PROGMEM = "11111111"; +char CH3A4[] PROGMEM = "11100011"; +char CH3A5[] PROGMEM = "11000001"; +char CH3A6[] PROGMEM = "11100011"; +char CH3A7[] PROGMEM = "11111111"; +//; 3B +char CH3B0[] PROGMEM = "11100011"; +char CH3B1[] PROGMEM = "11100011"; +char CH3B2[] PROGMEM = "11100011"; +char CH3B3[] PROGMEM = "11111111"; +char CH3B4[] PROGMEM = "11100011"; +char CH3B5[] PROGMEM = "11100011"; +char CH3B6[] PROGMEM = "11101111"; +char CH3B7[] PROGMEM = "11111111"; +//< 3C +char CH3C0[] PROGMEM = "11110011"; +char CH3C1[] PROGMEM = "11100111"; +char CH3C2[] PROGMEM = "11001111"; +char CH3C3[] PROGMEM = "10011111"; +char CH3C4[] PROGMEM = "11001111"; +char CH3C5[] PROGMEM = "11100111"; +char CH3C6[] PROGMEM = "11110011"; +char CH3C7[] PROGMEM = "11111111"; +//= 3D +char CH3D0[] PROGMEM = "11111111"; +char CH3D1[] PROGMEM = "10000000"; +char CH3D2[] PROGMEM = "10000000"; +char CH3D3[] PROGMEM = "11111111"; +char CH3D4[] PROGMEM = "10000000"; +char CH3D5[] PROGMEM = "10000000"; +char CH3D6[] PROGMEM = "11111111"; +char CH3D7[] PROGMEM = "11111111"; +//> 3E +char CH3E0[] PROGMEM = "11100111"; +char CH3E1[] PROGMEM = "11110011"; +char CH3E2[] PROGMEM = "11111001"; +char CH3E3[] PROGMEM = "11111100"; +char CH3E4[] PROGMEM = "11111001"; +char CH3E5[] PROGMEM = "11110011"; +char CH3E6[] PROGMEM = "11100111"; +char CH3E7[] PROGMEM = "11111111"; +//? 3F +char CH3F0[] PROGMEM = "11000001"; +char CH3F1[] PROGMEM = "10111110"; +char CH3F2[] PROGMEM = "11111001"; +char CH3F3[] PROGMEM = "11110111"; +char CH3F4[] PROGMEM = "11110111"; +char CH3F5[] PROGMEM = "11111111"; +char CH3F6[] PROGMEM = "11110111"; +char CH3F7[] PROGMEM = "11111111"; +//@ 40 +char CH400[] PROGMEM = "11100001"; +char CH401[] PROGMEM = "11011110"; +char CH402[] PROGMEM = "10110010"; +char CH403[] PROGMEM = "10101010"; +char CH404[] PROGMEM = "10100001"; +char CH405[] PROGMEM = "10111111"; +char CH406[] PROGMEM = "11000001"; +char CH407[] PROGMEM = "11111111"; +//A 07 +char CH070[] PROGMEM = "11110011"; +char CH071[] PROGMEM = "11101101"; +char CH072[] PROGMEM = "11011110"; +char CH073[] PROGMEM = "11000000"; +char CH074[] PROGMEM = "11011110"; +char CH075[] PROGMEM = "11011110"; +char CH076[] PROGMEM = "11011110"; +char CH077[] PROGMEM = "11111111"; +//B 815 +char CH8150[] PROGMEM = "11000001"; +char CH8151[] PROGMEM = "11011110"; +char CH8152[] PROGMEM = "11011110"; +char CH8153[] PROGMEM = "11000001"; +char CH8154[] PROGMEM = "11011110"; +char CH8155[] PROGMEM = "11011110"; +char CH8156[] PROGMEM = "11000001"; +char CH8157[] PROGMEM = "11111111"; +//C 1623 +char CH16230[] PROGMEM = "11100001"; +char CH16231[] PROGMEM = "11011110"; +char CH16232[] PROGMEM = "11011111"; +char CH16233[] PROGMEM = "11011111"; +char CH16234[] PROGMEM = "11011111"; +char CH16235[] PROGMEM = "11011110"; +char CH16236[] PROGMEM = "11100001"; +char CH16237[] PROGMEM = "11111111"; +//D 2431 +char CH24310[] PROGMEM = "11000001"; +char CH24311[] PROGMEM = "11011110"; +char CH24312[] PROGMEM = "11011110"; +char CH24313[] PROGMEM = "11011110"; +char CH24314[] PROGMEM = "11011110"; +char CH24315[] PROGMEM = "11011110"; +char CH24316[] PROGMEM = "11000001"; +char CH24317[] PROGMEM = "11111111"; +//E 3138 +char CH31380[] PROGMEM = "11000000"; +char CH31381[] PROGMEM = "11011111"; +char CH31382[] PROGMEM = "11011111"; +char CH31383[] PROGMEM = "11000011"; +char CH31384[] PROGMEM = "11011111"; +char CH31385[] PROGMEM = "11011111"; +char CH31386[] PROGMEM = "11000000"; +char CH31387[] PROGMEM = "11111111"; +//F 3946 +char CH39460[] PROGMEM = "11000000"; +char CH39461[] PROGMEM = "11011111"; +char CH39462[] PROGMEM = "11011111"; +char CH39463[] PROGMEM = "11000011"; +char CH39464[] PROGMEM = "11011111"; +char CH39465[] PROGMEM = "11011111"; +char CH39466[] PROGMEM = "11011111"; +char CH39467[] PROGMEM = "11111111"; +//G 4754 +char CH47540[] PROGMEM = "11100001"; +char CH47541[] PROGMEM = "11011110"; +char CH47542[] PROGMEM = "11011111"; +char CH47543[] PROGMEM = "11011000"; +char CH47544[] PROGMEM = "11011110"; +char CH47545[] PROGMEM = "11011110"; +char CH47546[] PROGMEM = "11100000"; +char CH47547[] PROGMEM = "11111111"; +//H 5562 +char CH55620[] PROGMEM = "11011110"; +char CH55621[] PROGMEM = "11011110"; +char CH55622[] PROGMEM = "11011110"; +char CH55623[] PROGMEM = "11000000"; +char CH55624[] PROGMEM = "11011110"; +char CH55625[] PROGMEM = "11011110"; +char CH55626[] PROGMEM = "11011110"; +char CH55627[] PROGMEM = "11111111"; +//I 5663 +char CH0[] PROGMEM = "11000000"; +char CH1[] PROGMEM = "11110011"; +char CH2[] PROGMEM = "11110011"; +char CH3[] PROGMEM = "11110011"; +char CH4[] PROGMEM = "11110011"; +char CH5[] PROGMEM = "11110011"; +char CH6[] PROGMEM = "11000000"; +char CH7[] PROGMEM = "11111111"; +//J 6471 +char CH64710[] PROGMEM = "11000000"; +char CH64711[] PROGMEM = "11111110"; +char CH64712[] PROGMEM = "11111110"; +char CH64713[] PROGMEM = "11111110"; +char CH64714[] PROGMEM = "11011110"; +char CH64715[] PROGMEM = "11011110"; +char CH64716[] PROGMEM = "11100001"; +char CH64717[] PROGMEM = "11111111"; +//K 7279 +char CH72790[] PROGMEM = "11011110"; +char CH72791[] PROGMEM = "11011101"; +char CH72792[] PROGMEM = "11011011"; +char CH72793[] PROGMEM = "11000111"; +char CH72794[] PROGMEM = "11011011"; +char CH72795[] PROGMEM = "11011101"; +char CH72796[] PROGMEM = "11011110"; +char CH72797[] PROGMEM = "11111111"; +//L 8087 +char CH80870[] PROGMEM = "11011111"; +char CH80871[] PROGMEM = "11011111"; +char CH80872[] PROGMEM = "11011111"; +char CH80873[] PROGMEM = "11011111"; +char CH80874[] PROGMEM = "11011111"; +char CH80875[] PROGMEM = "11011111"; +char CH80876[] PROGMEM = "11000000"; +char CH80877[] PROGMEM = "11111111"; +//M 8895 +char CH88950[] PROGMEM = "11011110"; +char CH88951[] PROGMEM = "11001100"; +char CH88952[] PROGMEM = "11010010"; +char CH88953[] PROGMEM = "11011110"; +char CH88954[] PROGMEM = "11011110"; +char CH88955[] PROGMEM = "11011110"; +char CH88956[] PROGMEM = "11011110"; +char CH88957[] PROGMEM = "11111111"; +//N 96103 +char CH961030[] PROGMEM = "11011110"; +char CH961031[] PROGMEM = "11001110"; +char CH961032[] PROGMEM = "11000110"; +char CH961033[] PROGMEM = "11010010"; +char CH961034[] PROGMEM = "11011000"; +char CH961035[] PROGMEM = "11011100"; +char CH961036[] PROGMEM = "11011110"; +char CH961037[] PROGMEM = "11111111"; +//O 104111 +char CH1041110[] PROGMEM = "11000001"; +char CH1041111[] PROGMEM = "10111110"; +char CH1041112[] PROGMEM = "10111110"; +char CH1041113[] PROGMEM = "10111110"; +char CH1041114[] PROGMEM = "10111110"; +char CH1041115[] PROGMEM = "10111110"; +char CH1041116[] PROGMEM = "11000001"; +char CH1041117[] PROGMEM = "11111111"; +//P 112119 +char CH1121190[] PROGMEM = "11000001"; +char CH1121191[] PROGMEM = "11011110"; +char CH1121192[] PROGMEM = "11011110"; +char CH1121193[] PROGMEM = "11000001"; +char CH1121194[] PROGMEM = "11011111"; +char CH1121195[] PROGMEM = "11011111"; +char CH1121196[] PROGMEM = "11011111"; +char CH1121197[] PROGMEM = "11111111"; +//Q 120127 +char CH1201270[] PROGMEM = "11100001"; +char CH1201271[] PROGMEM = "11011110"; +char CH1201272[] PROGMEM = "11011110"; +char CH1201273[] PROGMEM = "11011110"; +char CH1201274[] PROGMEM = "11011010"; +char CH1201275[] PROGMEM = "11011100"; +char CH1201276[] PROGMEM = "11100000"; +char CH1201277[] PROGMEM = "11111111"; +//R 128135 +char CH1281350[] PROGMEM = "11000001"; +char CH1281351[] PROGMEM = "11011110"; +char CH1281352[] PROGMEM = "11011110"; +char CH1281353[] PROGMEM = "11000001"; +char CH1281354[] PROGMEM = "11011011"; +char CH1281355[] PROGMEM = "11011101"; +char CH1281356[] PROGMEM = "11011110"; +char CH1281357[] PROGMEM = "11111111"; +//S 136143 +char CH1361430[] PROGMEM = "11100001"; +char CH1361431[] PROGMEM = "11011110"; +char CH1361432[] PROGMEM = "11011111"; +char CH1361433[] PROGMEM = "11100001"; +char CH1361434[] PROGMEM = "11111110"; +char CH1361435[] PROGMEM = "11011110"; +char CH1361436[] PROGMEM = "11100001"; +char CH1361437[] PROGMEM = "11111111"; +//T 144151 +char CH1441510[] PROGMEM = "11000000"; +char CH1441511[] PROGMEM = "11110011"; +char CH1441512[] PROGMEM = "11110011"; +char CH1441513[] PROGMEM = "11110011"; +char CH1441514[] PROGMEM = "11110011"; +char CH1441515[] PROGMEM = "11110011"; +char CH1441516[] PROGMEM = "11110011"; +char CH1441517[] PROGMEM = "11111111"; +//U 152159 +char CH1521590[] PROGMEM = "11011110"; +char CH1521591[] PROGMEM = "11011110"; +char CH1521592[] PROGMEM = "11011110"; +char CH1521593[] PROGMEM = "11011110"; +char CH1521594[] PROGMEM = "11011110"; +char CH1521595[] PROGMEM = "11011110"; +char CH1521596[] PROGMEM = "11100001"; +char CH1521597[] PROGMEM = "11111111"; +//V 160167 +char CH1601670[] PROGMEM = "10111110"; +char CH1601671[] PROGMEM = "10111110"; +char CH1601672[] PROGMEM = "11011101"; +char CH1601673[] PROGMEM = "11011101"; +char CH1601674[] PROGMEM = "11101011"; +char CH1601675[] PROGMEM = "11101011"; +char CH1601676[] PROGMEM = "11110111"; +char CH1601677[] PROGMEM = "11111111"; +//W 168175 +char CH1681750[] PROGMEM = "10111110"; +char CH1681751[] PROGMEM = "10111110"; +char CH1681752[] PROGMEM = "10111110"; +char CH1681753[] PROGMEM = "10110110"; +char CH1681754[] PROGMEM = "10101010"; +char CH1681755[] PROGMEM = "10011100"; +char CH1681756[] PROGMEM = "10111110"; +char CH1681757[] PROGMEM = "11111111"; +//X 176183 +char CH1761830[] PROGMEM = "10111110"; +char CH1761831[] PROGMEM = "11011101"; +char CH1761832[] PROGMEM = "11101011"; +char CH1761833[] PROGMEM = "11110111"; +char CH1761834[] PROGMEM = "11101011"; +char CH1761835[] PROGMEM = "11011101"; +char CH1761836[] PROGMEM = "10111110"; +char CH1761837[] PROGMEM = "11111111"; +//Y 184191 +char CH1841910[] PROGMEM = "10111110"; +char CH1841911[] PROGMEM = "11011101"; +char CH1841912[] PROGMEM = "11101011"; +char CH1841913[] PROGMEM = "11110111"; +char CH1841914[] PROGMEM = "11110111"; +char CH1841915[] PROGMEM = "11110111"; +char CH1841916[] PROGMEM = "11110111"; +char CH1841917[] PROGMEM = "11111111"; +//Z 192199 +char CH1921990[] PROGMEM = "10000000"; +char CH1921991[] PROGMEM = "11111101"; +char CH1921992[] PROGMEM = "11111011"; +char CH1921993[] PROGMEM = "11110111"; +char CH1921994[] PROGMEM = "11101111"; +char CH1921995[] PROGMEM = "11011111"; +char CH1921996[] PROGMEM = "10000000"; +char CH1921997[] PROGMEM = "11111111"; + + +char chl[ ] = {' ','!','q','#','$','%','&','\'','(',')','*','+',',','-', '.','/', + '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?','@', + 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; + +PGM_P CHL[] PROGMEM= { +CH200,CH201,CH202,CH203,CH204,CH205,CH206,CH207, +CH210,CH211,CH212,CH213,CH214,CH215,CH216,CH217, +CH220,CH221,CH222,CH223,CH224,CH225,CH226,CH227, +CH230,CH231,CH232,CH233,CH234,CH235,CH236,CH237, +CH240,CH241,CH242,CH243,CH244,CH245,CH246,CH247, +CH250,CH251,CH252,CH253,CH254,CH255,CH256,CH257, +CH260,CH261,CH262,CH263,CH264,CH265,CH266,CH267, +CH270,CH271,CH272,CH273,CH274,CH275,CH276,CH277, +CH280,CH281,CH282,CH283,CH284,CH285,CH286,CH287, +CH290,CH291,CH292,CH293,CH294,CH295,CH296,CH297, +CH2A0,CH2A1,CH2A2,CH2A3,CH2A4,CH2A5,CH2A6,CH2A7, +CH2B0,CH2B1,CH2B2,CH2B3,CH2B4,CH2B5,CH2B6,CH2B7, +CH2C0,CH2C1,CH2C2,CH2C3,CH2C4,CH2C5,CH2C6,CH2C7, +CH2D0,CH2D1,CH2D2,CH2D3,CH2D4,CH2D5,CH2D6,CH2D7, +CH2E0,CH2E1,CH2E2,CH2E3,CH2E4,CH2E5,CH2E6,CH2E7, +CH2F0,CH2F1,CH2F2,CH2F3,CH2F4,CH2F5,CH2F6,CH2F7, +CH300,CH301,CH302,CH303,CH304,CH305,CH306,CH307, +CH310,CH311,CH312,CH313,CH314,CH315,CH316,CH317, +CH320,CH321,CH322,CH323,CH324,CH325,CH326,CH327, +CH330,CH331,CH332,CH333,CH334,CH335,CH336,CH337, +CH340,CH341,CH342,CH343,CH344,CH345,CH346,CH347, +CH350,CH351,CH352,CH353,CH354,CH355,CH356,CH357, +CH360,CH361,CH362,CH363,CH364,CH365,CH366,CH367, +CH370,CH371,CH372,CH373,CH374,CH375,CH376,CH377, +CH380,CH381,CH382,CH383,CH384,CH385,CH386,CH387, +CH390,CH391,CH392,CH393,CH394,CH395,CH396,CH397, +CH3A0,CH3A1,CH3A2,CH3A3,CH3A4,CH3A5,CH3A6,CH3A7, +CH3B0,CH3B1,CH3B2,CH3B3,CH3B4,CH3B5,CH3B6,CH3B7, +CH3C0,CH3C1,CH3C2,CH3C3,CH3C4,CH3C5,CH3C6,CH3C7, +CH3D0,CH3D1,CH3D2,CH3D3,CH3D4,CH3D5,CH3D6,CH3D7, +CH3E0,CH3E1,CH3E2,CH3E3,CH3E4,CH3E5,CH3E6,CH3E7, +CH3F0,CH3F1,CH3F2,CH3F3,CH3F4,CH3F5,CH3F6,CH3F7, +CH400,CH401,CH402,CH403,CH404,CH405,CH406,CH407, +CH070,CH071,CH072,CH073,CH074,CH075,CH076,CH077, +CH8150,CH8151,CH8152,CH8153,CH8154,CH8155,CH8156,CH8157, +CH16230,CH16231,CH16232,CH16233,CH16234,CH16235,CH16236,CH16237, +CH24310,CH24311,CH24312,CH24313,CH24314,CH24315,CH24316,CH24317, +CH31380,CH31381,CH31382,CH31383,CH31384,CH31385,CH31386,CH31387, +CH39460,CH39461,CH39462,CH39463,CH39464,CH39465,CH39466,CH39467, +CH47540,CH47541,CH47542,CH47543,CH47544,CH47545,CH47546,CH47547, +CH55620,CH55621,CH55622,CH55623,CH55624,CH55625,CH55626,CH55627, +CH0,CH1,CH2,CH3,CH4,CH5,CH6,CH7, +CH64710,CH64711,CH64712,CH64713,CH64714,CH64715,CH64716,CH64717, +CH72790,CH72791,CH72792,CH72793,CH72794,CH72795,CH72796,CH72797, +CH80870,CH80871,CH80872,CH80873,CH80874,CH80875,CH80876,CH80877, +CH88950,CH88951,CH88952,CH88953,CH88954,CH88955,CH88956,CH88957, +CH961030,CH961031,CH961032,CH961033,CH961034,CH961035,CH961036,CH961037, +CH1041110,CH1041111,CH1041112,CH1041113,CH1041114,CH1041115,CH1041116,CH1041117, +CH1121190,CH1121191,CH1121192,CH1121193,CH1121194,CH1121195,CH1121196,CH1121197, +CH1201270,CH1201271,CH1201272,CH1201273,CH1201274,CH1201275,CH1201276,CH1201277, +CH1281350,CH1281351,CH1281352,CH1281353,CH1281354,CH1281355,CH1281356,CH1281357, +CH1361430,CH1361431,CH1361432,CH1361433,CH1361434,CH1361435,CH1361436,CH1361437, +CH1441510,CH1441511,CH1441512,CH1441513,CH1441514,CH1441515,CH1441516,CH1441517, +CH1521590,CH1521591,CH1521592,CH1521593,CH1521594,CH1521595,CH1521596,CH1521597, +CH1601670,CH1601671,CH1601672,CH1601673,CH1601674,CH1601675,CH1601676,CH1601677, +CH1681750,CH1681751,CH1681752,CH1681753,CH1681754,CH1681755,CH1681756,CH1681757, +CH1761830,CH1761831,CH1761832,CH1761833,CH1761834,CH1761835,CH1761836,CH1761837, +CH1841910,CH1841911,CH1841912,CH1841913,CH1841914,CH1841915,CH1841916,CH1841917, +CH1921990,CH1921991,CH1921992,CH1921993,CH1921994,CH1921995,CH1921996,CH1921997}; + +//END letter def \ No newline at end of file diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/ht1632c.h b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/ht1632c.h new file mode 100644 index 0000000..af737c3 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/ht1632c.h @@ -0,0 +1,261 @@ +/* Number of Boards */ +#define NUM_BOARDS 2 + +/* Number of HT1632C Chips */ +#define CHIP_MAX (NUM_BOARDS*4) +#define Y_MAX 15 +#define X_MAX ((32*NUM_BOARDS)-1) + +/* Pin Assignments for PORTC from 0 to 7 */ +#define DATA_PIN 0 +#define CLK_PIN 1 +#define WR_PIN 2 +#define CS_PIN 3 + +unsigned char ht1632_shadowram[63][CHIP_MAX]; +unsigned char buffer[8][8]; + +#define HT1632_ID_CMD 4 /* ID = 100 - Commands */ +#define HT1632_ID_RD 6 /* ID = 110 - Read RAM */ +#define HT1632_ID_WR 5 /* ID = 101 - Write RAM */ + +/* HT1632C Control Commands */ +// #define HT_MASTER 0b100000110000 //Sets chip as master and clock reference +// #define EXT_CLK_HT_MASTER 0b100000111000 +// #define HT_SLAVE 0b100000100000 //Set chips as slave and looks for master clock reference +// #define SYS_EN 0b100000000010 //Turns on the boards oscillator +// #define LED_ON 0b100000000110 //Turns on the LED Duty cycle generator (for pwm brightness control) +// #define COM_OPTION 0b100001000000 //N-MOS Open Drain Option and 8 Common Option (Figure out what this means) +// #define PWM_10 0b100101010010 //Used to set a 10/16 PWM Brightness +#define HT1632_CMD_SYSDIS 0x00 /* CMD= 0000-0000-x Turn off oscil */ +#define HT1632_CMD_SYSON 0x01 /* CMD= 0000-0001-x Enable system oscil */ +#define HT1632_CMD_LEDOFF 0x02 /* CMD= 0000-0010-x LED duty cycle gen off */ +#define HT1632_CMD_LEDON 0x03 /* CMD= 0000-0011-x LEDs ON */ +#define HT1632_CMD_BLOFF 0x08 /* CMD= 0000-1000-x Blink ON */ +#define HT1632_CMD_BLON 0x09 /* CMD= 0000-1001-x Blink Off */ +#define HT1632_CMD_SLVMD 0x10 /* CMD= 0001-0xxx-x Slave Mode */ +#define HT1632_CMD_MSTMD 0x18 /* CMD= 0001-10xx-x Use on-chip clock */ +#define HT1632_CMD_EXTCLK 0x1C /* CMD= 0001-11xx-x Use external clock */ +#define HT1632_CMD_COMS00 0x20 /* CMD= 0010-ABxx-x commons options */ +#define HT1632_CMD_COMS01 0x24 /* CMD= 0010-ABxx-x commons options */ +#define HT1632_CMD_COMS10 0x28 /* CMD= 0010-ABxx-x commons options */ +#define HT1632_CMD_COMS11 0x2C /* CMD= 0010-ABxx-x commons options */ +#define HT1632_CMD_PWM 0b100101010010//0xA0 /* CMD= 101x-PPPP-x PWM duty cycle */ + +// possible values for a pixel; +#define BLACK 0 +#define GREEN 1 +#define RED 2 +#define ORANGE 3 + +#define ASSERT(condition) //nothing +#define calcBit(y) (8>>(y&3)) + +unsigned char xyToIndex(unsigned char x, unsigned char y){ + unsigned char nChip, addr; + + if (x>=32) { + nChip = 3 + x/16 + (y>7?2:0); + } else { + nChip = 1 + x/16 + (y>7?2:0); + } + + x = x % 16; + y = y % 8; + addr = (x<<1) + (y>>2); + + return addr; +} + +static void ht1632_senddata (unsigned char chipNo, unsigned char address, unsigned char data){ + ht1632_chipselect(chipNo); + ht1632_writebits(HT1632_ID_WR, 1<<2); // send ID: WRITE to RAM + ht1632_writebits(address, 1<<6); // Send address + ht1632_writebits(data, 1<<3); // send 4 bits of data + ht1632_chipselect(0); +} + +int get_pixel(unsigned char x, unsigned char y) { + unsigned char addr, bitval, nChip; + + if (x>=32) { + nChip = 3 + x/16 + (y>7?2:0); + } else { + nChip = 1 + x/16 + (y>7?2:0); + } + + addr = xyToIndex(x,y); + bitval = calcBit(y); + + if ((ht1632_shadowram[addr][nChip-1] & bitval) && (ht1632_shadowram[addr+32][nChip-1] & bitval)) { + return ORANGE; + } else if (ht1632_shadowram[addr][nChip-1] & bitval) { + return GREEN; + } else if (ht1632_shadowram[addr+32][nChip-1] & bitval) { + return RED; + } else { + return 0; + } +} + +unsigned char decToBcd(unsigned char val){ + return ( (val/10*16) + (val%10) ); +} +unsigned char bcdToDec(unsigned char val){ + return ( (val/16*10) + (val%16) ); +} +void ht1632_plot (unsigned char x, unsigned char y, unsigned char color){ + unsigned char nChip, addr, bitval; + + if (x<0 || x>X_MAX || y<0 || y>Y_MAX) + return; + + if (color != BLACK && color != GREEN && color != RED && color != ORANGE) + return; + + if (x>=32) { + nChip = 3 + x/16 + (y>7?2:0); + } else { + nChip = 1 + x/16 + (y>7?2:0); + } + + addr = xyToIndex(x,y); + bitval = calcBit(y); + + switch (color) + { + case BLACK: + if (get_pixel(x,y) != BLACK) { // compare with memory to only set if pixel is other color + // clear the bit in both planes; + ht1632_shadowram[addr][nChip-1] &= ~bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + addr = addr + 32; + ht1632_shadowram[addr][nChip-1] &= ~bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + } + break; + case GREEN: + if (get_pixel(x,y) != GREEN) { // compare with memory to only set if pixel is other color + // set the bit in the green plane and clear the bit in the red plane; + ht1632_shadowram[addr][nChip-1] |= bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + addr = addr + 32; + ht1632_shadowram[addr][nChip-1] &= ~bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + } + break; + case RED: + if (get_pixel(x,y) != RED) { // compare with memory to only set if pixel is other color + // clear the bit in green plane and set the bit in the red plane; + ht1632_shadowram[addr][nChip-1] &= ~bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + addr = addr + 32; + ht1632_shadowram[addr][nChip-1] |= bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + } + break; + case ORANGE: + if (get_pixel(x,y) != ORANGE) { // compare with memory to only set if pixel is other color + // set the bit in both the green and red planes; + ht1632_shadowram[addr][nChip-1] |= bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + addr = addr + 32; + ht1632_shadowram[addr][nChip-1] |= bitval; + ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]); + } + break; + } +} + +void null_buffer(){ + for(int i=0;i<8;i++) + for(int j=0; j<8;j++) + buffer[i][j] = 0; +} + +void set_buffer(unsigned char chr){ + for(int i=0; i>= 1; + } +} + +static void ht1632_sendcmd (unsigned char chipNo, unsigned char command){ + ht1632_chipselect(chipNo); + ht1632_writebits(HT1632_ID_CMD, 1<<2); // send 3 bits of id: COMMMAND + ht1632_writebits(command, 1<<7); // send the actual command + ht1632_writebits(0, 1); /* one extra dont-care bit in commands. */ + ht1632_chipselect(0); +} + +static void ht1632_initialize(){ + setBPin(CS_PIN, "HIGH"); + for (int i=1; i<=CHIP_MAX; i++) { + ht1632_sendcmd(i, HT1632_CMD_SYSDIS); // Disable system + ht1632_sendcmd(i, HT1632_CMD_COMS00); // 16*32, PMOS drivers + ht1632_sendcmd(i, HT1632_CMD_MSTMD); // MASTER MODE + ht1632_sendcmd(i, HT1632_CMD_SYSON); // System on + ht1632_sendcmd(i, HT1632_CMD_LEDON); // LEDs on + } + ht1632_clear(); // Clear the display +} \ No newline at end of file diff --git a/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/main.c b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/main.c new file mode 100644 index 0000000..097e2c9 --- /dev/null +++ b/OSU Coursework/LED Dot Matrix Display (ECE 152)/Source/Wunderboard (ATMEGA644p)/main.c @@ -0,0 +1,150 @@ +#include +#include +#include +#include +#include "font1.h" +#include "ht1632c.h" +#include "uart.h" + + +/* Global Definitions */ +#define F_CPU 1000000UL + +/* Protypes */ +void initialize(void); +void clearArray(void); +void setBPin(unsigned char pin, unsigned char *mode); +void clockPulse(void); + +/* Main Function */ +int main(void){ + + enum states{ + setup, + drawing, + readusart, + } currentstate = setup; + + unsigned char STRING1[]="YAY THIS"; + unsigned char STRING2[]="WORKS!!!"; + unsigned char STR1CMP[9]; + unsigned char STR2CMP[9]; + unsigned char x, i, j; + unsigned char send[50]; + + while(1){ + + switch(currentstate){ + case setup: + initialize(); + clearArray(); + PORTB = 0b10000000; + PORTC |= 0b10000000; + ht1632_initialize(); + PORTC |= 0b01000000; + InitializeUART(); + PORTC |= 0b00100000; + + sprintf(send, "Initialized...\n"); + PORTC |= 0b00010000; + SendStringUART(send); + _delay_ms(200); + PORTC = 0; + strcpy(STRING1, "YAY THIS"); + strcpy(STRING2, "WORKS!!!"); + currentstate = drawing; + break; + case drawing: + for(x=1;x> 8); + UBRR1L = baud; + /* Set the U2X1 bit */ + UCSR1A = (1 << U2X1); + /* Enable transmitter */ + UCSR1B = (1 << TXEN1 | 1 << RXEN1); + /* Set frame format: 8data, 1stop bit */ + UCSR1C = (3 << UCSZ10); + + return 0; + } + +/** This function needs to write a single byte to the UART. It must check that the UART is ready for a new byte +and return a 1 if the byte was not sent. +@param [in] data This is the data byte to be sent. +@return The function returns a 1 or error and 0 on successful completion.*/ + +unsigned char SendByteUART (unsigned char data){ + + /* + ** Checks the buffer empty bit so that data can either be placed in the buffer + ** or else reuturn a 1 + */ + if((UCSR1A & (1 << UDRE1)) == (1 << UDRE1)){ + UDR1 = data; + _delay_ms(SENDSPEED); //Places data into the UDR1 8-bit data buffer + }else { + return 1; + } + + return 0; +} + +/** This function needs to writes a string to the UART. It must check that the UART is ready for a new byte and +return a 1 if the string was not sent. +@param [in] data This is a pointer to the data to be sent. +@return The function returns a 1 or error and 0 on successful completion.*/ + +unsigned char SendStringUART (unsigned char *data){ + + for (int loop = 0 ; data[loop] != '\0'; loop++){ + unsigned char bytereturn; //Storage for return value of SendByteUART + + /* Sends the current byte based on the loop umber to SendByte */ + bytereturn = SendByteUART(data[loop]); + + /* Stops sending if SendByteUART had an error */ + if(bytereturn == 1){ + return 1; + } + } + return 0; +} + +unsigned char GetByteUART(){ + while(!(UCSR1A & (1 << RXC1))); + return(UDR1); +} + +unsigned char NewScreen(unsigned char STRING1[], unsigned char STRING2[]){ + unsigned char UARTREAD[17]; + unsigned char loop = 0; + + for(; loop < 17 ; loop++){ + while(!(UARTREAD[loop] = GetByteUART())); + } + for(loop = 0 ; loop < 8 ; loop ++){ + STRING1[loop] = UARTREAD[loop]; + } + STRING1[8] = '\0'; + + for(; loop < 16 ; loop++){ + STRING2[(loop-8)] = UARTREAD[loop]; + } + + SendStringUART(STRING1); + SendStringUART(STRING2); + SendStringUART("\n"); + return 0; +} \ No newline at end of file