Compare commits
1461 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 938313f027 | |||
| 10049de852 | |||
| 24ee0f03e9 | |||
| bc8cfe5a04 | |||
| b66577deb5 | |||
| aff9a411b9 | |||
| fd042add99 | |||
| 7d452e798b | |||
| f79e2aba4f | |||
| 46ae2e434a | |||
| 4c01fa5ccd | |||
| 8270bdabdb | |||
| 7ec7428da8 | |||
| 9016e8dc79 | |||
| 2ec67683ec | |||
| a6c9883383 | |||
| 1c695a05d7 | |||
| f4d3759e8a | |||
| cbe3a02fb9 | |||
| ab37f82825 | |||
| 5701c029db | |||
| 01033837da | |||
| 29b941539b | |||
| 63407597c5 | |||
| c246dc27ce | |||
| 62326a67ce | |||
| b58dcc9824 | |||
| 4b014c163b | |||
| f4bdc3888e | |||
| 86a7429f51 | |||
| fc1349fb75 | |||
| d0c4ddd064 | |||
| 6e14b9ee63 | |||
| a861ab1dfd | |||
| dc36a83cf5 | |||
| 855c3b6a6c | |||
| 4215d5b55d | |||
| cec998133f | |||
| 718d055cbc | |||
| e589f91d45 | |||
| bb3751bb9a | |||
| d5f19c0da7 | |||
| c84501fbd1 | |||
| 784bab30b1 | |||
| b2247dc943 | |||
| d3704b1c1f | |||
| 46d157f0a4 | |||
| 46b46b7c52 | |||
| b2824994aa | |||
| 0ac385eed0 | |||
| cf578bbaa0 | |||
| 6427b8a8bb | |||
| ffe29e6f1a | |||
| dd7e9ae2b4 | |||
| 6dc8eb75a2 | |||
| a8f99b1b61 | |||
| c9171c6d79 | |||
| 7e7b1914ff | |||
| cf3da300b5 | |||
| f7c207547f | |||
| 61b8f4b4e4 | |||
| 3a8220a4bb | |||
| ad653ecd0f | |||
| b593317360 | |||
| 40b42a4171 | |||
| 1ee7247576 | |||
| 98456f9489 | |||
| 3492b5d0a6 | |||
| 1aff10dc35 | |||
| 33fff62c0c | |||
| 1042f3ea2e | |||
| 6a3b539a22 | |||
| edb07e2c56 | |||
| 14bb497195 | |||
| 3e14bedf20 | |||
| 3846677431 | |||
| d9480578fb | |||
| 782ab91599 | |||
| 212b02dfc6 | |||
| c36d366ef1 | |||
| 6efaf223ba | |||
| a1601aa6a2 | |||
| d043701944 | |||
| 2c5c3de04a | |||
| 7251f7bafa | |||
| 6b886cf5d7 | |||
| 2ff6e1f644 | |||
| 6b412ed264 | |||
| b0e49b8aaf | |||
| 53e061ab6a | |||
| 53f111ccbf | |||
| 937183e629 | |||
| bc2a9e1fd5 | |||
| 59fdea8ee5 | |||
| a2aa7c62c2 | |||
| 8d4c57bf8d | |||
| f31edc88ea | |||
| e25e903896 | |||
| 68a4d94e59 | |||
| 2815ddd4b7 | |||
| 149079e8ae | |||
| ec5b3039b8 | |||
| e41ae1fadc | |||
| c107643d69 | |||
| 20af91b9e1 | |||
| 0e9b213845 | |||
| 64a2a74a52 | |||
| 10cb8b72db | |||
| ce4804d94c | |||
| 05569ef15a | |||
| c762e1bf65 | |||
| 0a719d9ec7 | |||
| bea62a03ff | |||
| d386b65343 | |||
| a7ebbe8c94 | |||
| 6f1291ca21 | |||
| 7b46be2118 | |||
| ded8f237e0 | |||
| 182d97ed18 | |||
| 6753e0f92b | |||
| ae82c5f7a0 | |||
| 878c7b081c | |||
| 367ca4dfa7 | |||
| c4d6bfbff8 | |||
| a41dc24a2e | |||
| 80b0f0ee52 | |||
| 79aa9f6648 | |||
| 6df7a23d0a | |||
| e933f62096 | |||
| f664c2a763 | |||
| db805b35df | |||
| 1e500d56bf | |||
| 931294081c | |||
| 984e179c0e | |||
| db93fb0f14 | |||
| 90be0bae10 | |||
| a4cfa395a8 | |||
| 14828737ee | |||
| 406d17ff35 | |||
| ed268ff085 | |||
| 59b26ad36c | |||
| 698e977833 | |||
| 2d58fa3f55 | |||
| 67120bb5e7 | |||
| 97402aa919 | |||
| e57be1ac6e | |||
| 6ee4c7c269 | |||
| 70b11d037d | |||
| 9184adb2ab | |||
| 37aa54f1a1 | |||
| ab8e72e89c | |||
| 96371bd27d | |||
| cf2c83ff10 | |||
| e4e211a7a9 | |||
| 156a05bee3 | |||
| 57703965ae | |||
| 60f7d97194 | |||
| 8079b7c053 | |||
| 3be0515cf2 | |||
| 4dfa4d7249 | |||
| 47881b80da | |||
| 6217e1331a | |||
| 4b7c16fc9f | |||
| 21a85244b0 | |||
| 53cbfd5d8f | |||
| ea1a07dbfa | |||
| 8f3122ab74 | |||
| dfb99c80e5 | |||
| 1f97f644e9 | |||
| 20a9369f2f | |||
| 86baf80ac2 | |||
| 481c18d6ff | |||
| 233342e0e5 | |||
| 81f8bd4570 | |||
| c7c907e7ce | |||
| 37880ee9ec | |||
| f82680b53c | |||
| a5ed5599ce | |||
| 914ca9d865 | |||
| eb7488f670 | |||
| ec2445e0c8 | |||
| b9b36220da | |||
| 68c28187a8 | |||
| 240c6223fe | |||
| 0e824f8e8a | |||
| f565f3c893 | |||
| f0259d499d | |||
| 22a6669b1e | |||
| 71518e8e8c | |||
| 6f4a8ccb74 | |||
| 1ce2e2c3d4 | |||
| 5c06fdba92 | |||
| 67a683e6c4 | |||
| 38afc96e2c | |||
| f915a7c82e | |||
| 19d4bfe50a | |||
| 1ecea6b4af | |||
| a23a7204cf | |||
| 2f3f2157fb | |||
| 11c1dba91e | |||
| e7a0c793bb | |||
| 295f42007d | |||
| 71711b1008 | |||
| b05f6476f6 | |||
| 335f1dffc3 | |||
| 0576edc6a6 | |||
| 36d300b248 | |||
| ae1be246b6 | |||
| 9cb026ec58 | |||
| fd39a178bb | |||
| a7655c30ff | |||
| 471511c24c | |||
| 37cc13c140 | |||
| 5118eccf4d | |||
| aa9ae51e21 | |||
| 452ac21f89 | |||
| 1ec8c74911 | |||
| ebbfb7336e | |||
| 464755e302 | |||
| 064c8d8a5c | |||
| f14a874bf5 | |||
| de34cb7ef2 | |||
| 72a3098f26 | |||
| 358a57945f | |||
| e9abf59ee4 | |||
| 5ff4335b50 | |||
| 4d797f5e83 | |||
| 2a8fe6d110 | |||
| ea7acfa5a6 | |||
| 2de5a8dcb6 | |||
| e064edc69b | |||
| 4d03134e9e | |||
| 541c5aa000 | |||
| ad82ce9c1b | |||
| 7c4bb27ebd | |||
| e484668033 | |||
| 5f9a24cddd | |||
| 5154ba238a | |||
| c4a8e121d3 | |||
| 6c068076e4 | |||
| 8b5165c271 | |||
| 61f430cb43 | |||
| 144f47b6cf | |||
| a493e022a7 | |||
| 517c5521be | |||
| aedb5211ab | |||
| 8833a3e451 | |||
| 79c0754af9 | |||
| 49cb4f97d6 | |||
| a5bf114f2b | |||
| 022caee996 | |||
| ca4d00ca4b | |||
| a1a18aae57 | |||
| bc078d5e3f | |||
| 8bab0aee9a | |||
| 900bc139b5 | |||
| 48c913a96a | |||
| 9092f52999 | |||
| 68f6d68138 | |||
| e2df5ef0ed | |||
| 3001a754c1 | |||
| 56c4db624a | |||
| 5126de7ed8 | |||
| 1a7bb8e966 | |||
| 9701ac54e8 | |||
| 311c05b256 | |||
| 1ddfb6b81e | |||
| 91abaa4f61 | |||
| e3327ce2c1 | |||
| 4b4c9728be | |||
| 3a93ae3558 | |||
| dc2c4efde5 | |||
| d2aaac6819 | |||
| 7d5543f5a7 | |||
| 0a49777e6d | |||
| 8f0a996c0a | |||
| 0b665f145a | |||
| c1a8026406 | |||
| 07dc3459a2 | |||
| 8132f530d9 | |||
| 6686c75206 | |||
| 692f8b1ef4 | |||
| 237fa71133 | |||
| c7491a8dee | |||
| 4d7f2c8579 | |||
| b4e2086506 | |||
| c0a509e3fa | |||
| 8b7ed2bdec | |||
| bf43703666 | |||
| 5845bb8d4a | |||
| 874281a081 | |||
| d3c967c6cd | |||
| e9531e3990 | |||
| 34b56368dd | |||
| 2df2c5a011 | |||
| 17cdf85d15 | |||
| aef84e0063 | |||
| 9358ed084e | |||
| 4a1f897ad5 | |||
| 39b1492f19 | |||
| 93ccb3da05 | |||
| 564c1469a3 | |||
| 1c1ca9b890 | |||
| deb5954055 | |||
| 3b16e017d4 | |||
| e102a9d57d | |||
| fc363d408e | |||
| b46278b791 | |||
| 4858993cd8 | |||
| c5fbd3dd73 | |||
| 7513dfaf1d | |||
| a2076c8717 | |||
| aa92d59ada | |||
| 3d3c3833dd | |||
| 1e2edee88c | |||
| b9b4214d8f | |||
| 86b5e0de04 | |||
| aca37b43f3 | |||
| 6d653cf2db | |||
| 80b85fcc87 | |||
| 63461069b8 | |||
| 38ea2afa9c | |||
| 2ab712f40b | |||
| 21c518e5f3 | |||
| c41185f690 | |||
| cf54528a9e | |||
| c6d6c7f66d | |||
| 781b3c6188 | |||
| 8760bae8a6 | |||
| cffdacbe94 | |||
| 8f7959a201 | |||
| 1284ed2051 | |||
| 1e7f517aa5 | |||
| 0dc7060c92 | |||
| 6d2a731acc | |||
| 7973386f9a | |||
| 63f2fcd507 | |||
| 3326b69169 | |||
| 0cdfa9b6e5 | |||
| 873847e42e | |||
| 998f904c41 | |||
| 403f14c0ea | |||
| 7f15566d5c | |||
| 3eea221b24 | |||
| a8dd74bd89 | |||
| dfdca2dcfc | |||
| 566291bc17 | |||
| 0ddf92ce0e | |||
| 12f866cfb6 | |||
| 431a9ecc0e | |||
| 39bc1700be | |||
| 6e6b0c4b5f | |||
| 4fb205def7 | |||
| 989593f5f6 | |||
| b0ae67e2e5 | |||
| 2a41cec5ae | |||
| c00620b891 | |||
| 0026262520 | |||
| 49f0da06fa | |||
| d1d3d7ff95 | |||
| 8fa5bc405f | |||
| f44607aff0 | |||
| d92a379249 | |||
| d558e33647 | |||
| d360c0e820 | |||
| 617b256bb8 | |||
| 3291f21309 | |||
| 95aa8f2ec8 | |||
| fa268017c8 | |||
| 4dd2daedcd | |||
| 283b75dfd7 | |||
| cee86dd968 | |||
| 36e6751f73 | |||
| caaf6db7ad | |||
| d92f6d4978 | |||
| f9b9a5497c | |||
| ded307c494 | |||
| 1d5e1881eb | |||
| 49762250d6 | |||
| 392a10c98d | |||
| ea148dfcda | |||
| 28bd8e4f07 | |||
| 2abaa19c01 | |||
| e9cb986bdf | |||
| 770376e4ad | |||
| 1cd24d218b | |||
| 0994312782 | |||
| 1f44987aff | |||
| 92106aedd8 | |||
| 3a662afe73 | |||
| 5bdd8f8994 | |||
| d6543f6c55 | |||
| a81d77b364 | |||
| 2d1f3e3441 | |||
| 21de55e550 | |||
| e419708561 | |||
| ff609188cb | |||
| 958dee594f | |||
| d8467af191 | |||
| 6e553663ee | |||
| c41ac65fd2 | |||
| de1cac6e5d | |||
| 5d507af66d | |||
| 10dce7dee4 | |||
| 67689c8f71 | |||
| 52c283602d | |||
| 1ad5aa4785 | |||
| 7b5cca58c0 | |||
| 53315d0132 | |||
| 204014c8c2 | |||
| fac0e5df5e | |||
| 41431161b3 | |||
| 4b09e1ed23 | |||
| ea6820a046 | |||
| bb83933c8c | |||
| a19cf2d7ef | |||
| c66fab2e6d | |||
| 9f2b486152 | |||
| 214bc9c4d4 | |||
| 82783013fd | |||
| 792412f5fe | |||
| 6fbbac60dc | |||
| 8bb4681578 | |||
| 62d80d8145 | |||
| b74f8ee61d | |||
| 48a7090e6e | |||
| 6fc8ba804c | |||
| fbd1488b62 | |||
| 42b41e8f03 | |||
| 98aa332fb3 | |||
| 5c8d5dbd95 | |||
| 78c713d7a5 | |||
| 18385ceebd | |||
| 944c66dca4 | |||
| 56eec662a3 | |||
| 74eb65117d | |||
| dcfbd424dd | |||
| e35cf751de | |||
| d1b862a4f3 | |||
| 38bcc1f29f | |||
| 98100708d6 | |||
| 83dedd83bc | |||
| 5def4849fe | |||
| 87105c1268 | |||
| 74a6b54071 | |||
| f7441620cb | |||
| 1b8e0f12b9 | |||
| eb2b7623c1 | |||
| 0358976a4a | |||
| 3984a68671 | |||
| f3a02f0f4e | |||
| f69a77098f | |||
| 3af21718cb | |||
| 4814a529da | |||
| 3e91b3f46d | |||
| d9d52762ae | |||
| bb0489725b | |||
| 69bf79f0bc | |||
| 86807ea1f4 | |||
| 85e6ac893b | |||
| 2a9160fcab | |||
| b7a37c4e8a | |||
| 21a5238ca9 | |||
| 3824939030 | |||
| 1e3c1d8ce2 | |||
| 8cfde7854b | |||
| e4296225a8 | |||
| 229cfe45f3 | |||
| 390b7f12cf | |||
| a0a9d13694 | |||
| aef70fc850 | |||
| 7a3499b6a4 | |||
| 2b12eabcb9 | |||
| 28b62a0f80 | |||
| 4a1ae0eaa4 | |||
| 2633af9fef | |||
| 3c064d2275 | |||
| f5cd611683 | |||
| 69731d7904 | |||
| 35fc938b1e | |||
| abb604bf6d | |||
| 8eaefce7b5 | |||
| 63e2ae60a5 | |||
| 9fb1eb665f | |||
| 9d8bfea60a | |||
| 71b311cb26 | |||
| c184efeb31 | |||
| c724779b4d | |||
| a0aca08c3d | |||
| a830c0c95c | |||
| d64a71f5ab | |||
| 5cda44ac0b | |||
| e53ce519ff | |||
| 3b756bcede | |||
| 2ee478d310 | |||
| c36fe15174 | |||
| 93ca2436b1 | |||
| e616c4674d | |||
| d7bb012f16 | |||
| 983a7d8c28 | |||
| 18cbde2e41 | |||
| 2a39ece5af | |||
| fa91162539 | |||
| 0d9544d914 | |||
| d72c58ef92 | |||
| 8e6c1074e5 | |||
| 1568e3475f | |||
| 309d340daf | |||
| ac2fd120dc | |||
| a90f09c4dd | |||
| 0b5f85ab90 | |||
| c087ed17ef | |||
| a323af62c0 | |||
| db21488060 | |||
| 992006217e | |||
| 82ee36571e | |||
| 0a4604615c | |||
| 8f485462eb | |||
| 2eed4e35a2 | |||
| 46da62bf05 | |||
| 9187b52f81 | |||
| c4b3f94a31 | |||
| 6cc2f8c889 | |||
| 2b29a65bb1 | |||
| 2ed85780f8 | |||
| 26dfee2b7f | |||
| eb161ff3e8 | |||
| 20db18316d | |||
| 554aeeae76 | |||
| 21b888be5d | |||
| 29025d98bb | |||
| afc058ad7b | |||
| 04fb2bdc2b | |||
| 3a1d0b1fd9 | |||
| 3829212bef | |||
| 8886906c0f | |||
| cf54d94f08 | |||
| 2163c7a1fe | |||
| 992e0f7ea4 | |||
| b1881ead99 | |||
| e247194fac | |||
| 313a74bc7c | |||
| cdc4470d1e | |||
| 66beb47e2d | |||
| 9c5f5c12b6 | |||
| 6e80e39443 | |||
| 02d9800ba1 | |||
| c8abcc85ef | |||
| 857442f147 | |||
| 4c6b4dd061 | |||
| 0b1bdc540e | |||
| 302de76fff | |||
| 303f79f0bd | |||
| d859c9acd6 | |||
| afe88258d5 | |||
| 6dacb0fd7c | |||
| b94f54822f | |||
| a095fab84c | |||
| bd2e522bcf | |||
| 7c40eefe84 | |||
| 791d9cf66e | |||
| 1ae35b5148 | |||
| 469346178a | |||
| a157f0e22a | |||
| 90405ad9ed | |||
| a599e6da11 | |||
| a626ea2ceb | |||
| 12ca975280 | |||
| cd90b935f3 | |||
| 2087078d83 | |||
| 73386b309d | |||
| 2a6692b37a | |||
| b07308ab80 | |||
| 9290ccc988 | |||
| 72351d5f5d | |||
| f0b2b56990 | |||
| dbc0a16134 | |||
| 5a11cf03cb | |||
| 0287369be2 | |||
| 19aaeb8a27 | |||
| aa21524183 | |||
| 200edbf857 | |||
| b3e7e25849 | |||
| dccb20d127 | |||
| 3a852e9be1 | |||
| 9537c3f940 | |||
| e41aa9fbd6 | |||
| 2e747a1663 | |||
| 29e669cc03 | |||
| c3eb1254bc | |||
| 3f724dc6ab | |||
| c1c4631b73 | |||
| 3b7cebe09a | |||
| 52b7208335 | |||
| 4cb48022a2 | |||
| af344a3687 | |||
| c60210f799 | |||
| 0d38bd3323 | |||
| dfca0bd85a | |||
| ec3d660258 | |||
| a9a561aa4c | |||
| 9d52bdd6bd | |||
| 51a665cec7 | |||
| b3d26bc21f | |||
| 7f9092a90e | |||
| ca617d8094 | |||
| a4ea524748 | |||
| 2f0cc91aaf | |||
| 13957219b9 | |||
| 45458792bc | |||
| 5a5c9828d5 | |||
| d82e8a9359 | |||
| 20900734b8 | |||
| 29deb4c4d4 | |||
| 3236481bd6 | |||
| b1625e7980 | |||
| ab501696ed | |||
| 73e807062a | |||
| d271f3422e | |||
| b431f2e5bf | |||
| 8abf660e2b | |||
| 78ed555f6e | |||
| c434217b08 | |||
| d8ab94d07c | |||
| cfb1550ff5 | |||
| c07e0a7f2f | |||
| 4c24e881c4 | |||
| 9812daa0aa | |||
| 7189fa0b54 | |||
| b746528ac8 | |||
| edd838d866 | |||
| 599bacd673 | |||
| dfee4b4f36 | |||
| 5cb5ee0111 | |||
| 8123713372 | |||
| 6ab940a334 | |||
| 6cd0b4832f | |||
| f686e5325d | |||
| df1a2ac19a | |||
| d3fd34a765 | |||
| 97595efa83 | |||
| 5e940e56f4 | |||
| 5c60440d36 | |||
| 6ff0448d67 | |||
| 3cc65aa771 | |||
| 3f21e6c1a4 | |||
| 148d8a726f | |||
| 796c1adfbc | |||
| d657619430 | |||
| 59696d639d | |||
| f420cc7d56 | |||
| f8bff1640e | |||
| 24ce936d2b | |||
| 0a976e1f3e | |||
| 78efc5f0f0 | |||
| 6c4193f158 | |||
| 4953141252 | |||
| 6b3836e9a2 | |||
| 8f5aaad3d6 | |||
| a8f3e77e22 | |||
| ee7b9f2001 | |||
| 356906c1eb | |||
| 216e172dcf | |||
| 9c7c55e4cd | |||
| 532848849c | |||
| e406021828 | |||
| e13b957b17 | |||
| c84314862e | |||
| 4b87e1a859 | |||
| 5d88b83491 | |||
| 0c0d8ba47e | |||
| 4e522fce6c | |||
| 13c15bd6ef | |||
| 485d5bbdea | |||
| 56e01f4fb5 | |||
| 3d92371570 | |||
| 7eae709938 | |||
| aeb727bcbf | |||
| 13f8bb018b | |||
| 759027cea4 | |||
| 326f85dcd7 | |||
| fd002d68cd | |||
| b7de04020d | |||
| 155f27c217 | |||
| 94b710ceaa | |||
| e410336348 | |||
| 3f3cdadb30 | |||
| 5e29fa0737 | |||
| 808809650d | |||
| cb92decfe3 | |||
| a999009c24 | |||
| 310a9e03e2 | |||
| 4cb7f6497e | |||
| 40c353524d | |||
| f5addfa8ca | |||
| 618d7f924f | |||
| e534c2c7ea | |||
| fd6f0ec952 | |||
| 5954d213a6 | |||
| 57bf12dbdb | |||
| b1bc43aa1d | |||
| 4996756e21 | |||
| a87c74bf31 | |||
| a78c5d348e | |||
| cea3ee724e | |||
| 3d6d7e6a20 | |||
| f00ed18da8 | |||
| 8c3c429a20 | |||
| e15654edad | |||
| 5f19f78509 | |||
| fada51f5b3 | |||
| 0c6dbbba4c | |||
| 648d2c3beb | |||
| 689fea2f90 | |||
| 139c700025 | |||
| bc52f7077f | |||
| 7329d8b728 | |||
| 2f311dddfd | |||
| 16d4601043 | |||
| 5a2d6cb250 | |||
| 2037f0d8b0 | |||
| fb7525e42d | |||
| 7e75360ef3 | |||
| 46000a15ba | |||
| 8a98283cb0 | |||
| f6caf5eae3 | |||
| 13370a6abf | |||
| 05649d7123 | |||
| 488fbfd29d | |||
| 7591e6411e | |||
| 37457e8151 | |||
| b80a6dccaa | |||
| 209c685f11 | |||
| 7303e99bab | |||
| ce7adabfbe | |||
| 968d1307fc | |||
| 6b77921948 | |||
| 3256be6f3a | |||
| 72fd306015 | |||
| a2309abc88 | |||
| 2248750812 | |||
| 7b84ba8c6d | |||
| cdaa063188 | |||
| c89d4b05c7 | |||
| 206f3bd334 | |||
| 7c192910d1 | |||
| 1d6c8627c0 | |||
| 53a4bfaac5 | |||
| 424daa752c | |||
| 5e78ec7edd | |||
| 18174446bc | |||
| c5a8e15f21 | |||
| 897a698e4b | |||
| 814452ee35 | |||
| ab1fcd9997 | |||
| 0a6cbe92b6 | |||
| b16971b644 | |||
| 7173fc3d2b | |||
| 9f8045c362 | |||
| 10fa05c3ce | |||
| ad8eb930da | |||
| 031bf5e3a1 | |||
| 6e558b41f0 | |||
| 7ce5df53a9 | |||
| 92e20f2427 | |||
| 8220f84616 | |||
| 03751a1c75 | |||
| 31c2d69303 | |||
| 9d4f38f127 | |||
| 1c3a8a9803 | |||
| 613ebe97d4 | |||
| 99aa5eead5 | |||
| 60616c1619 | |||
| b6debf27ec | |||
| 47fc05c25e | |||
| 28b736f1e8 | |||
| 84e91d8c27 | |||
| f99f7bcd55 | |||
| d489482dfc | |||
| 98992ce1b0 | |||
| efe8c2ec8c | |||
| 92a7363abc | |||
| 40ba5925fc | |||
| 6f2452afd0 | |||
| 680f838b1d | |||
| 923a03f775 | |||
| 97b261abe2 | |||
| 6014b6fdbf | |||
| d707709b94 | |||
| aec4c783eb | |||
| 554521746b | |||
| bef5ee525d | |||
| 6150cac0f5 | |||
| b3b670b55f | |||
| bad137b615 | |||
| 4339896e4b | |||
| e924c8fa64 | |||
| 395d0d6b39 | |||
| 4c22ea18fd | |||
| 7a6d3fea3f | |||
| 3f787ffe24 | |||
| 339e250b76 | |||
| aceb935066 | |||
| 1801cc5b53 | |||
| a29c9c724e | |||
| b135645132 | |||
| 7f4fe24c68 | |||
| 03936ee234 | |||
| e25c54e83e | |||
| 50a6b2645a | |||
| 3a9dac665b | |||
| d3aba9688c | |||
| 71c0b7b1d9 | |||
| b627237b1d | |||
| 2d12a7dc44 | |||
| 6a08bd830a | |||
| f222600612 | |||
| fa7de3dbd8 | |||
| bff713d8d8 | |||
| 434c071bda | |||
| 340043a73e | |||
| 087f4e3276 | |||
| 327b8f78dd | |||
| 0a411ea12f | |||
| 0a029ab3ff | |||
| 8e3d389e99 | |||
| 8845ae57f3 | |||
| e3d8ea1117 | |||
| dfa697d47c | |||
| 839bad199e | |||
| cedb966958 | |||
| 7d63dbf226 | |||
| fa28b67db6 | |||
| 63e6edc5af | |||
| 91747475c8 | |||
| ba65591076 | |||
| eb4bfffc33 | |||
| 0d6b19e350 | |||
| 6cffbed503 | |||
| 172820b4ae | |||
| 10416db062 | |||
| 0126797857 | |||
| 5113a3f5d3 | |||
| 0d591c748f | |||
| fdc0ff334d | |||
| 55b242c96b | |||
| 1080514bd9 | |||
| abcc80b266 | |||
| 81aedf9ecd | |||
| 18317070f2 | |||
| 1a7449b227 | |||
| 2e96ba10b1 | |||
| c4aca143a0 | |||
| 631079ff1b | |||
| 495c67406c | |||
| 37387f91fd | |||
| d02ef1b603 | |||
| c71ee46e5f | |||
| 21f3e4395a | |||
| c130f48f2d | |||
| 6305fd84d2 | |||
| 42650540ca | |||
| 721e64c993 | |||
| b8a040606b | |||
| dc5bf21171 | |||
| 00390a6fd4 | |||
| 4ae4850820 | |||
| 8144b42a6d | |||
| 3875bf981d | |||
| a5ba6ff463 | |||
| 09a7cc5e03 | |||
| bc3539d777 | |||
| c8b51eb063 | |||
| 0a531d258f | |||
| 0b01665112 | |||
| bf8bddb147 | |||
| 90dd3e45cd | |||
| 3516845bef | |||
| 1515062bcf | |||
| bfd95c0345 | |||
| fbd4c1b204 | |||
| fe81dd7f54 | |||
| 36d937e5b3 | |||
| 76f7813329 | |||
| e144f12cd7 | |||
| 30ce636008 | |||
| 795b48e7c5 | |||
| 87532ac457 | |||
| 20894baf69 | |||
| 6a35d36c0a | |||
| f9e64eb2ab | |||
| 9e9a273081 | |||
| 13c867e122 | |||
| 8e772f18b0 | |||
| 527517207e | |||
| c704e7ad12 | |||
| a946c0206d | |||
| 14d58c8d8b | |||
| 8d775abd8b | |||
| 2565f22cf8 | |||
| e4f45398df | |||
| 93eafc667a | |||
| 99283c6ed6 | |||
| f497c4f9d2 | |||
| b5d110b8ce | |||
| f0d3d9e5dc | |||
| 2f4bc4990f | |||
| 7526f4f5b4 | |||
| e52ef22269 | |||
| a57dbf9411 | |||
| 7663968e44 | |||
| bca4660742 | |||
| cd995aa975 | |||
| 08c7b2898f | |||
| 993948a521 | |||
| 2ce7ac1b2a | |||
| 63890d63bd | |||
| e02dd7a751 | |||
| acb7822712 | |||
| d737e314ea | |||
| d7e3c1251e | |||
| 01e2bcbf3b | |||
| 50616680fa | |||
| 1085b8b7b2 | |||
| e919ffdc6a | |||
| fc3dcda4d4 | |||
| 7dfcdecb1f | |||
| 2e59961319 | |||
| b4b00ecddc | |||
| 2b78b499f4 | |||
| 6ecf3375c2 | |||
| 6f395c2563 | |||
| 28e6e0bd95 | |||
| 580a3c88f5 | |||
| 48b350a8c2 | |||
| b5a030c9df | |||
| 2efdcf51f0 | |||
| 5d20400f86 | |||
| fa97e9366d | |||
| b4a9d62b22 | |||
| 3179dd1d41 | |||
| f2154feda1 | |||
| 36bd3a5caf | |||
| f8cfa99547 | |||
| f5d794e4ca | |||
| 81c6bb1ba7 | |||
| 194c9b7978 | |||
| 190c47e1f4 | |||
| 0ca5c21e6b | |||
| 8fac78d446 | |||
| 002447dbb5 | |||
| 18f06e8395 | |||
| ba9831f52e | |||
| 32b5f47992 | |||
| 5e402bb5a5 | |||
| 702b956a2d | |||
| 733682a51a | |||
| 81d37a96dd | |||
| deabf40080 | |||
| c40191d3bc | |||
| 121c41719d | |||
| d8be36e2f4 | |||
| ad4f4e7e09 | |||
| f66f016c0d | |||
| dc53114edf | |||
| 0986ecd66d | |||
| fd31fc1dd5 | |||
| 9327d5d2c0 | |||
| fa10615077 | |||
| b19386d8a7 | |||
| b2818b6b22 | |||
| 6d3bec464a | |||
| a046a8723e | |||
| 5522b7ca78 | |||
| c5903d2689 | |||
| b332e0d287 | |||
| 1d71b15914 | |||
| 9cc2ee171c | |||
| 51491381ce | |||
| 22ee458db5 | |||
| fd546d3370 | |||
| 0d4c3d761b | |||
| bfa043a175 | |||
| b3f2197371 | |||
| 77c87e5da3 | |||
| 2fa4a6bb3f | |||
| 3a9c375908 | |||
| 9a7976cf6e | |||
| 3cfed9b80c | |||
| 77bfa1dc2a | |||
| 324a0c4b77 | |||
| 03ff032ec7 | |||
| 622bc9bef0 | |||
| 3c095ad5e9 | |||
| 7c3a4d3863 | |||
| b2e29e911f | |||
| 92d45358e3 | |||
| a2b404090a | |||
| 3245de0446 | |||
| 548953623b | |||
| 0b70b3c052 | |||
| 6cdb3b7b2c | |||
| dd87ac6514 | |||
| bed2f6eb5e | |||
| 0a1fa6bd7d | |||
| 89cf4016b7 | |||
| 1e69cfa94a | |||
| 956d034fdc | |||
| 4283acac4f | |||
| 2e0a7a293e | |||
| 46a0fe8533 | |||
| fcf6f436b0 | |||
| 91fbcb94d7 | |||
| aedc89fccd | |||
| 65cb5ec9e6 | |||
| f72926fb74 | |||
| 993eba0af5 | |||
| 2b27f24260 | |||
| 9144776fba | |||
| 95bb18a311 | |||
| 60eecd928d | |||
| 7f401d9155 | |||
| 3b319d1aa5 | |||
| e9fe881c17 | |||
| 18f1c6e620 | |||
| 60936211ae | |||
| 03a1517531 | |||
| fdb2b937f1 | |||
| 772b8318ec | |||
| 1185443850 | |||
| f22f207242 | |||
| 3ab2e20a5e | |||
| a24a8736b1 | |||
| 6e3152633b | |||
| ad54506f86 | |||
| d7226f5e61 | |||
| 485a96745d | |||
| c0577e77df | |||
| e42fb6da31 | |||
| 7a6e800c8a | |||
| efe50710c4 | |||
| bd341d1590 | |||
| 5f8ddf88e4 | |||
| 9fc5401ff2 | |||
| bd2def4d4d | |||
| fddbe300a1 | |||
| 9ee908957b | |||
| eac6950994 | |||
| 05a55c728b | |||
| c7228194df | |||
| 0df8509289 | |||
| 9da2ce3ac4 | |||
| acfb88ac7b | |||
| 88b5b8f82c | |||
| d9cb411c12 | |||
| 9dc1a1fa53 | |||
| f4c52723d7 | |||
| 1bd590195f | |||
| 5ddc88d8a4 | |||
| 5712b03bca | |||
| fee65d8ae5 | |||
| 57f4a5ff97 | |||
| 97f3d832ac | |||
| 02c6edacbe | |||
| 461ed960ce | |||
| d6b3416f7b | |||
| c4149407e3 | |||
| 8be25ddbc7 | |||
| a5602535aa | |||
| 64d5bba3d7 | |||
| 665830cf82 | |||
| 3223b890ad | |||
| 60c3d2f3ae | |||
| e54ba36d4c | |||
| 50360ee6a7 | |||
| eeb150f377 | |||
| 6b660b4af7 | |||
| 4407071146 | |||
| db3bd97935 | |||
| ce34047e12 | |||
| 6606ed07d1 | |||
| 401ec8d370 | |||
| 0c43ff8882 | |||
| 839ee83a6b | |||
| fbc95a04da | |||
| 642b3bf2a9 | |||
| 323329eeca | |||
| 0dac1386ec | |||
| c08302ecb5 | |||
| b8449a42db | |||
| 43542c9d9f | |||
| f1abf9a8c8 | |||
| dd230b7e5a | |||
| d8ba7a577b | |||
| f47692a258 | |||
| 2fac92a843 | |||
| 6c323f6f0c | |||
| c3ef8e7d44 | |||
| 295bd75b96 | |||
| 7aff9f1077 | |||
| 1a34b150e8 | |||
| 6e857556f5 | |||
| 606619910f | |||
| 2fcc6a36ef | |||
| ef65a16850 | |||
| 6cd1d6283b | |||
| 6829a94516 | |||
| c14da4fdbe | |||
| 77571bd9cd | |||
| 9960e84d2d | |||
| d5bf3a6b82 | |||
| 2f7f0806dc | |||
| 2bd7cfae95 | |||
| 0c20942573 | |||
| 403c36e35e | |||
| 2bb2654e05 | |||
| 007f15b1ee | |||
| 9a73530bb7 | |||
| dd09df994c | |||
| bdf5ef4e0d | |||
| e193963c93 | |||
| 51b297b46f | |||
| 04b90dd9d2 | |||
| 894f78427e | |||
| c16af175aa | |||
| 328e322edf | |||
| d4685c9e4e | |||
| 3b4c9412a1 | |||
| 55dc92a6f2 | |||
| 65591dda63 | |||
| 00bb1e70e4 | |||
| 84513c8c0e | |||
| 12cb97b88c | |||
| 0727523472 | |||
| bd56fcab06 | |||
| 80b63a9d37 | |||
| d6690cbb01 | |||
| bf2055e1ad | |||
| 223c0645e8 | |||
| 76ea24e62c | |||
| 0e7c08ba15 | |||
| 196de34b27 | |||
| ae5d7c8952 | |||
| 511f5b8338 | |||
| c2563ca816 | |||
| f9a2cec8b1 | |||
| a4238e0b11 | |||
| 96a2f9a32a | |||
| 346f4b4c20 | |||
| 2fcad17aaa | |||
| 2f423f73a0 | |||
| 01fcc62e64 | |||
| 5b26647c30 | |||
| de7a8c800b | |||
| 14598e9d59 | |||
| a4e7ecca55 | |||
| 6bba0a5311 | |||
| de18436cda | |||
| 08c24d0ffb | |||
| 7f630f4781 | |||
| f824c6c83c | |||
| cae265b05c | |||
| fd2ad2121f | |||
| bec173556d | |||
| 640a4c21dc | |||
| 7d520e08af | |||
| a46a2c8756 | |||
| 83fe77fa8e | |||
| 36c981d55f | |||
| dc091c121f | |||
| 0faa35ab97 | |||
| debbff51e0 | |||
| 78823788b4 | |||
| eda268518b | |||
| 8c8b40f5a8 | |||
| ea112520ea | |||
| 24c36f3184 | |||
| 8f103ecee3 | |||
| b94b11d466 | |||
| ec1df22130 | |||
| ddfc9f9e17 | |||
| 9186bfa3af | |||
| 961fa24faa | |||
| 8c5dd2b0d9 | |||
| 0f5e855849 | |||
| 0eee68144d | |||
| 5697f4aa72 | |||
| 3fd77ab737 | |||
| e84ece8055 | |||
| 9574eadd44 | |||
| 86c127b5f4 | |||
| bcec714aa0 | |||
| ab1a87ecbf | |||
| 50234fde13 | |||
| 9510721ef4 | |||
| 0796cda8c9 | |||
| 9f0f9f93a2 | |||
| 1cfffd8d45 | |||
| 07ddcd1758 | |||
| bedce98a14 | |||
| 3d6a1dd621 | |||
| a62cfe7016 | |||
| abd3917bc8 | |||
| 386be4c44b | |||
| 36c1e9cb1d | |||
| 0674958659 | |||
| 2a73d29b4b | |||
| 45a570fb86 | |||
| 174a7b29d9 | |||
| d2fabe2b2e | |||
| c515db3610 | |||
| a2f5158c79 | |||
| 2f033ff455 | |||
| 66ea773f5f | |||
| 71f71357c2 | |||
| 6ed367834b | |||
| 55e0b5d241 | |||
| 3c8c213ce3 | |||
| 9c20efb6ef | |||
| 92071b9643 | |||
| d27ae57b4a | |||
| bfdc66635d | |||
| 7111fcfb82 | |||
| e5ddc1c430 | |||
| a5112d2463 | |||
| effdd542ca | |||
| 08eb59147c | |||
| a10f725a0a | |||
| 7c2fb0e460 | |||
| 10265a90ca | |||
| 176cd898a0 | |||
| 16ea2616bd | |||
| 78bae1357d | |||
| 533fd05414 | |||
| 201d7d095e | |||
| 1675bfc42a | |||
| 3718efd9d8 | |||
| 391f211015 | |||
| 9dd2b9b1b1 | |||
| 4a8f0979fd | |||
| 6cc287b4eb | |||
| f881418fe4 | |||
| 9e8ef373b0 | |||
| ee0521981b | |||
| 688660228a | |||
| 3d737e3eb1 | |||
| 50d21a4c72 | |||
| e8b41de152 | |||
| 06b2a1f0e4 | |||
| cda34966fe | |||
| 64886eec04 | |||
| e5169e1ef5 | |||
| bdf409ea5c | |||
| 314bda18cb | |||
| 1c0a1cf777 | |||
| ffee72c649 | |||
| 1953eb4cfe | |||
| 25e980e231 | |||
| be7338fa11 | |||
| 326dc07834 | |||
| 73e1dd761a | |||
| 23add71329 | |||
| b1123dfbfe | |||
| 974860ffef | |||
| b86c0b4aaa | |||
| 7ca6a733c8 | |||
| 17945fc24f | |||
| b9a74b0f89 | |||
| 0ac6582225 | |||
| 228d934b88 | |||
| b4f61dea80 | |||
| 09c1ad284b | |||
| 866ed66a9e | |||
| 5d659c359c | |||
| 955767669e | |||
| 95170b5930 | |||
| d1425e77a9 | |||
| da2d1fd8a0 | |||
| 0beaadc2e5 | |||
| 7fd2f1d571 | |||
| 9a83ed8017 | |||
| 978aef3279 | |||
| 846d0a6114 | |||
| 82fbc66388 | |||
| 45fa6eadd0 | |||
| fa4e1e4fc0 | |||
| dba6841815 | |||
| c95ff048d8 | |||
| 89dd6aaf47 | |||
| dece55d558 | |||
| c6b2a1f815 | |||
| 4ffd5115d3 | |||
| 6585294321 | |||
| 536f032a15 | |||
| f10b2f7b14 | |||
| d2c1706825 | |||
| 34e412d4b2 | |||
| 0e5c1b9498 | |||
| 356933f0bf | |||
| 177d3739d4 | |||
| 2fc645486d | |||
| 9573976c7a | |||
| 4b7cc132b1 | |||
| a3c768e899 | |||
| 23db0a9587 | |||
| cb073fa549 | |||
| e94db55b27 | |||
| 3cb83df6cd | |||
| a761db40a2 | |||
| 602ff6ca46 | |||
| 8989ce4e6c | |||
| b78533f86c | |||
| 4b3fad5266 | |||
| 095b38a076 | |||
| 6b9ee4ec76 | |||
| d762b150b0 | |||
| ed89675f78 | |||
| 91e2c8222b | |||
| 79fd273755 | |||
| 6a09f6fdb7 | |||
| 67b774cc47 | |||
| d08c172860 | |||
| 6636bf90c8 | |||
| 190aafa1ef | |||
| 9c4b9d7f1b | |||
| 2e29aaa96b | |||
| d5eff9481d | |||
| b0e13cde89 | |||
| 85f7a85f98 | |||
| da024aad74 | |||
| 236c3539d1 | |||
| 68dce1bc92 | |||
| a125a3866a | |||
| 1c7f8c2457 | |||
| c0ccef70c8 | |||
| fcf93ad789 | |||
| 4505d886f6 | |||
| c6f7ba0b55 | |||
| 51dc2fbc1b | |||
| 34697da8d2 | |||
| b541cb5c3a | |||
| 2d99899bce | |||
| 133a52473d | |||
| 5831148201 | |||
| 86195a1841 | |||
| e95af52d98 | |||
| 221826f457 | |||
| 30378b111a | |||
| 250281884b | |||
| eb61944c0a | |||
| 0da5214a11 | |||
| 6b6c945f59 | |||
| 48e3a2ebf4 | |||
| d44a0a126e | |||
| 7b000b376d | |||
| 5eb81c5853 | |||
| 99a6b32421 | |||
| 3ca8834d44 | |||
| 03e89f382e | |||
| d69af0cafc | |||
| 8f2e3732a2 | |||
| 8a34c2d51e | |||
| d46c65c8fd | |||
| 7911dd927f | |||
| 0ab16b6734 | |||
| 5dd7c105b6 | |||
| 61bbfd6e7c | |||
| 6c28032e9b | |||
| f6a8ff9f2a | |||
| dcde118437 | |||
| 9b25e154e5 | |||
| fa667dbc78 | |||
| ef141403bc | |||
| 5158ed5dc4 | |||
| 971a44feeb | |||
| c9a8934e06 | |||
| fb493b5415 | |||
| 476eb4c2d5 | |||
| 777f48121b | |||
| 0d1496dbcd | |||
| f9edbd453d | |||
| 831541bd61 | |||
| cb24c1e46e | |||
| d8f6b5b643 | |||
| 6314541f66 | |||
| 471f294f07 | |||
| 342b643661 | |||
| 963b07439b | |||
| f935757503 | |||
| f3d040af69 | |||
| 33e2588f00 | |||
| 6eca03264a | |||
| 3a5c07703e | |||
| a5600847e2 | |||
| c715aa2557 | |||
| 06b5a2903d | |||
| 8dee4218f7 | |||
| 65167cf315 | |||
| 38d5ca9236 | |||
| a45b03ded3 | |||
| f0c9202e6d | |||
| eb648e4cb5 | |||
| 75acac5f4c | |||
| 640b5fe668 | |||
| f2dcecc059 | |||
| 17409f04ed | |||
| 88cd8e4027 | |||
| 1570814b45 | |||
| 1d430c1296 | |||
| b0f0bac3e2 | |||
| 94742f38b8 | |||
| c6886c63eb | |||
| 71e1283508 | |||
| 82fe7c61b1 | |||
| 214332fbb9 | |||
| ef1c7db957 | |||
| d6927be07b | |||
| 25fa42b0f0 | |||
| ae372abeaa | |||
| 99766e97a8 | |||
| 57fb4d41f3 | |||
| a834931c4d | |||
| 4711ca4c91 | |||
| ef5441df09 | |||
| e80339aadd | |||
| 3d02551e6a | |||
| 2221cce51a | |||
| 54cf0a40f9 | |||
| ed8379c44b | |||
| 68d8fa7794 | |||
| 46634e1ff3 | |||
| 33daf76a9b | |||
| 948f3a78c1 | |||
| 571b877a8d | |||
| 15ed275cf4 | |||
| 249e6f2e63 | |||
| a462949bc2 | |||
| c61f643332 | |||
| dde599fdd6 | |||
| 2fb32eb9cc | |||
| 4d3c4e4ecf | |||
| 7fe4fc8491 | |||
| 1784409df0 | |||
| 3e9bb483dc | |||
| 34d7db24b2 | |||
| 77f518874e | |||
| 6eec97aa23 | |||
| 235c578a9c | |||
| 251ce1d69c | |||
| 181ced12fc | |||
| 9ef47a1e63 | |||
| d3b14ea3e2 | |||
| 3dd8338028 | |||
| d810537125 | |||
| cc91c5e399 | |||
| 6a0114d612 | |||
| c1e61fdd38 | |||
| 29f91b4024 | |||
| 1ab87150d8 | |||
| 0e44200b9c | |||
| 9941bc12a7 |
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,222 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file CoOS.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief API header file of CooCox CoOS.
|
||||
* @details This file including all API functions's declare of CooCox CoOS.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _CCRTOS_H
|
||||
#define _CCRTOS_H
|
||||
#include "OsConfig.h"
|
||||
/*---------------------------- Type Define ----------------------------------*/
|
||||
typedef signed char S8;
|
||||
typedef unsigned char U8;
|
||||
typedef short S16;
|
||||
typedef unsigned short U16;
|
||||
typedef int S32;
|
||||
typedef unsigned int U32;
|
||||
typedef long long S64;
|
||||
typedef unsigned long long U64;
|
||||
typedef unsigned char BIT;
|
||||
typedef unsigned char BOOL;
|
||||
typedef unsigned int OS_STK;
|
||||
typedef U8 OS_TID;
|
||||
typedef U8 OS_TCID;
|
||||
typedef U8 OS_MutexID;
|
||||
typedef U8 OS_EventID;
|
||||
typedef U8 OS_FlagID;
|
||||
typedef U8 OS_MMID;
|
||||
typedef U8 StatusType;
|
||||
typedef U16 OS_VER;
|
||||
typedef void (*FUNCPtr)(void*);
|
||||
typedef void (*vFUNCPtr)(void);
|
||||
|
||||
|
||||
/*---------------------------- Constant Define -------------------------------*/
|
||||
#ifndef Co_NULL
|
||||
#define Co_NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#ifndef Co_FALSE
|
||||
#define Co_FALSE (0)
|
||||
#endif
|
||||
|
||||
#ifndef Co_TRUE
|
||||
#define Co_TRUE (1)
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------- Error Codes ---------------------------------*/
|
||||
#define E_CREATE_FAIL (StatusType)-1
|
||||
#define E_OK (StatusType)0
|
||||
#define E_INVALID_ID (StatusType)1
|
||||
#define E_INVALID_PARAMETER (StatusType)2
|
||||
#define E_CALL (StatusType)3
|
||||
#define E_TASK_WAITING (StatusType)4
|
||||
#define E_TIMEOUT (StatusType)5
|
||||
#define E_SEM_FULL (StatusType)6
|
||||
#define E_MBOX_FULL (StatusType)7
|
||||
#define E_QUEUE_FULL (StatusType)8
|
||||
#define E_SEM_EMPTY (StatusType)9
|
||||
#define E_MBOX_EMPTY (StatusType)10
|
||||
#define E_QUEUE_EMPTY (StatusType)11
|
||||
#define E_FLAG_NOT_READY (StatusType)12
|
||||
#define E_ALREADY_IN_WAITING (StatusType)13
|
||||
#define E_TASK_NOT_WAITING (StatusType)14
|
||||
#define E_TASK_WAIT_OTHER (StatusType)15
|
||||
#define E_EXCEED_MAX_NUM (StatusType)16
|
||||
#define E_NOT_IN_DELAY_LIST (StatusType)17
|
||||
#define E_SEV_REQ_FULL (StatusType)18
|
||||
#define E_NOT_FREE_ALL (StatusType)19
|
||||
#define E_PROTECTED_TASK (StatusType)20
|
||||
#define E_OS_IN_LOCK (StatusType)21
|
||||
|
||||
|
||||
/*---------------------------- Wait Opreation type --------------------------*/
|
||||
#define OPT_WAIT_ALL 0 /*!< Wait for all flags. */
|
||||
#define OPT_WAIT_ANY 1 /*!< Wait for any one of flags. */
|
||||
#define OPT_WAIT_ONE 2 /*!< Waot for one flag. */
|
||||
|
||||
|
||||
/*---------------------------- Delete Opreation type ------------------------*/
|
||||
#define OPT_DEL_NO_PEND 0 /*!< Delete when no task waitting for */
|
||||
#define OPT_DEL_ANYWAY 1 /*!< Delete always. */
|
||||
|
||||
|
||||
/*---------------------------- Timer Types ----------------------------------*/
|
||||
#if CFG_TMR_EN >0
|
||||
#define TMR_TYPE_ONE_SHOT 0 /*!< Timer counter type: One-shot */
|
||||
#define TMR_TYPE_PERIODIC 1 /*!< Timer counter type: Periodic */
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------- Event Control ---------------------------------*/
|
||||
#if CFG_EVENT_EN >0
|
||||
#define EVENT_SORT_TYPE_FIFO (U8)0x01 /*!< Insert a event by FIFO */
|
||||
#define EVENT_SORT_TYPE_PRIO (U8)0x02 /*!< Insert a event by prio */
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------------- Function declare-------------------------------*/
|
||||
|
||||
/* Implement in file "core.c" */
|
||||
extern void CoInitOS(void); /*!< Initialize OS */
|
||||
extern void CoStartOS(void); /*!< Start multitask */
|
||||
extern void CoEnterISR(void); /*!< Enter a ISR */
|
||||
extern void CoExitISR(void); /*!< Exit a ISR */
|
||||
extern void CoSchedLock(void);
|
||||
extern void CoSchedUnlock(void);
|
||||
extern OS_VER CoGetOSVersion(void); /*!< Get OS version value */
|
||||
|
||||
|
||||
/* Implement in file "task.c" */
|
||||
#define CoCreateTask(task,argv,prio,stk,stkSz) \
|
||||
CreateTask(task,argv,(prio)|(((stkSz)<<8) &0x000FFF00 ),stk)
|
||||
|
||||
|
||||
#define CoCreateTaskEx(task,argv,prio,stk,stkSz,timeSlice,isWaitting) \
|
||||
CreateTask(task,argv,(prio)|(((stkSz)<<8)&0x000FFF00)|(((timeSlice)<<20)&0x7FF00000)|((isWaitting<<31)&0x80000000),stk)
|
||||
|
||||
extern void CoExitTask(void);
|
||||
extern OS_TID CoGetCurTaskID(void);
|
||||
extern StatusType CoDelTask(OS_TID taskID);
|
||||
extern StatusType CoActivateTask(OS_TID taskID,void *argv);
|
||||
extern StatusType CoAwakeTask(OS_TID taskID);
|
||||
extern StatusType CoSuspendTask(OS_TID taskID);
|
||||
extern StatusType CoSetPriority(OS_TID taskID,U8 priority);
|
||||
extern OS_TID CreateTask(FUNCPtr task,void *argv,U32 parameter,OS_STK *stk);
|
||||
|
||||
/* Implement in file "time.c" */
|
||||
extern U64 CoGetOSTime(void);
|
||||
extern StatusType CoTickDelay(U32 ticks);
|
||||
extern StatusType CoResetTaskDelayTick(OS_TID taskID,U32 ticks);
|
||||
extern StatusType CoTimeDelay(U8 hour,U8 minute,U8 sec,U16 millsec);
|
||||
|
||||
|
||||
/* Implement in file "timer.c" */
|
||||
extern StatusType CoDelTmr(OS_TCID tmrID);
|
||||
extern StatusType CoStopTmr(OS_TCID tmrID);
|
||||
extern StatusType CoStartTmr(OS_TCID tmrID);
|
||||
extern U32 CoGetCurTmrCnt(OS_TCID tmrID,StatusType* perr);
|
||||
extern StatusType CoSetTmrCnt(OS_TCID tmrID,U32 tmrCnt,U32 tmrReload);
|
||||
extern OS_TCID CoCreateTmr(U8 tmrType, U32 tmrCnt, U32 tmrReload, vFUNCPtr func);
|
||||
|
||||
|
||||
/* Implement in file "kernelHeap.c"*/
|
||||
extern void* CoKmalloc(U32 size);
|
||||
extern void CoKfree(void* memBuf);
|
||||
|
||||
|
||||
/* Implement in file "mm.c" */
|
||||
extern void* CoGetMemoryBuffer(OS_MMID mmID);
|
||||
extern StatusType CoDelMemoryPartition(OS_MMID mmID);
|
||||
extern StatusType CoFreeMemoryBuffer(OS_MMID mmID,void* buf);
|
||||
extern U32 CoGetFreeBlockNum(OS_MMID mmID,StatusType* perr);
|
||||
extern OS_MMID CoCreateMemPartition(U8* memBuf,U32 blockSize,U32 blockNum);
|
||||
|
||||
/* Implement in file "mutex.c" */
|
||||
extern OS_MutexID CoCreateMutex(void);
|
||||
extern StatusType CoEnterMutexSection(OS_MutexID mutexID);
|
||||
extern StatusType CoLeaveMutexSection(OS_MutexID mutexID);
|
||||
|
||||
|
||||
/* Implement in file "sem.c" */
|
||||
extern StatusType CoPostSem(OS_EventID id);
|
||||
extern StatusType CoAcceptSem(OS_EventID id);
|
||||
extern StatusType isr_PostSem(OS_EventID id);
|
||||
extern StatusType CoDelSem(OS_EventID id,U8 opt);
|
||||
extern StatusType CoPendSem(OS_EventID id,U32 timeout);
|
||||
extern OS_EventID CoCreateSem(U16 initCnt,U16 maxCnt,U8 sortType);
|
||||
|
||||
|
||||
/* Implement in file "mbox.c" */
|
||||
extern OS_EventID CoCreateMbox(U8 sortType);
|
||||
extern StatusType CoDelMbox(OS_EventID id,U8 opt);
|
||||
extern StatusType CoPostMail(OS_EventID id,void* pmail);
|
||||
extern StatusType isr_PostMail(OS_EventID id,void* pmail);
|
||||
extern void* CoAcceptMail(OS_EventID id,StatusType* perr);
|
||||
extern void* CoPendMail(OS_EventID id,U32 timeout,StatusType* perr);
|
||||
|
||||
|
||||
/* Implement in file "queue.c" */
|
||||
extern StatusType CoDelQueue(OS_EventID id,U8 opt);
|
||||
extern StatusType CoPostQueueMail(OS_EventID id,void* pmail);
|
||||
extern StatusType isr_PostQueueMail(OS_EventID id,void* pmail);
|
||||
extern void* CoAcceptQueueMail(OS_EventID id,StatusType* perr);
|
||||
extern OS_EventID CoCreateQueue(void **qStart, U16 size ,U8 sortType);
|
||||
extern void* CoPendQueueMail(OS_EventID id,U32 timeout,StatusType* perr);
|
||||
|
||||
|
||||
|
||||
/* Implement in file "flag.c" */
|
||||
extern StatusType CoSetFlag (OS_FlagID id);
|
||||
extern StatusType CoClearFlag (OS_FlagID id);
|
||||
extern StatusType isr_SetFlag (OS_FlagID id);
|
||||
extern StatusType CoDelFlag (OS_FlagID id,U8 opt);
|
||||
extern StatusType CoAcceptSingleFlag (OS_FlagID id);
|
||||
extern StatusType CoWaitForSingleFlag (OS_FlagID id,U32 timeout);
|
||||
extern OS_FlagID CoCreateFlag (BOOL bAutoReset,BOOL bInitialState);
|
||||
extern U32 CoAcceptMultipleFlags (U32 flags,U8 waitType,StatusType *perr);
|
||||
extern U32 CoWaitForMultipleFlags (U32 flags,U8 waitType,U32 timeout,StatusType *perr);
|
||||
|
||||
|
||||
/* Implement in file "utility.c" */
|
||||
extern StatusType CoTimeToTick(U8 hour,U8 minute,U8 sec,U16 millsec,U32* ticks);
|
||||
extern void CoTickToTime(U32 ticks,U8* hour,U8* minute,U8* sec,U16* millsec);
|
||||
|
||||
|
||||
/* Implement in file "hook.c" */
|
||||
extern void CoIdleTask(void* pdata);
|
||||
extern void CoStkOverflowHook(OS_TID taskID);
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,280 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsConfig.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief This file use by user to configuration CooCox CoOS.
|
||||
* @note Ensure you have knew every item before modify this file.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CONFIG_H
|
||||
#define _CONFIG_H
|
||||
|
||||
|
||||
/*!<
|
||||
Defines chip type,cortex-m3(1),cortex-m0(2)
|
||||
*/
|
||||
#define CFG_CHIP_TYPE (1)
|
||||
|
||||
/*!<
|
||||
Defines the lowest priority that be assigned.
|
||||
*/
|
||||
#define CFG_LOWEST_PRIO (64)
|
||||
|
||||
/*!<
|
||||
Max number of tasks that can be running.
|
||||
*/
|
||||
#define CFG_MAX_USER_TASKS (5)
|
||||
|
||||
/*!<
|
||||
Idle task stack size(word).
|
||||
*/
|
||||
#define CFG_IDLE_STACK_SIZE (25)
|
||||
|
||||
/*!<
|
||||
System frequency (Hz).
|
||||
*/
|
||||
#if defined(PCBTARANIS)
|
||||
#define CFG_CPU_FREQ (60000000)
|
||||
#else
|
||||
#define CFG_CPU_FREQ (36000000) // TODO check if really correct for sky9x?
|
||||
#endif
|
||||
|
||||
/*!<
|
||||
systick frequency (Hz).
|
||||
*/
|
||||
#define CFG_SYSTICK_FREQ (500)
|
||||
|
||||
/*!<
|
||||
max systerm api call num in ISR.
|
||||
*/
|
||||
#define CFG_MAX_SERVICE_REQUEST (5)
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) order list schedule.
|
||||
If disable(0),CoOS use Binary-Scheduling Algorithm.
|
||||
*/
|
||||
#if (CFG_MAX_USER_TASKS) <15
|
||||
#define CFG_ORDER_LIST_SCHEDULE_EN (1)
|
||||
#else
|
||||
#define CFG_ORDER_LIST_SCHEDULE_EN (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) Round-Robin Task switching.
|
||||
*/
|
||||
#define CFG_ROBIN_EN (1)
|
||||
|
||||
/*!<
|
||||
Default slice of task.
|
||||
*/
|
||||
#if CFG_ROBIN_EN > 0
|
||||
#define CFG_TIME_SLICE (10)
|
||||
#endif
|
||||
|
||||
|
||||
/*----------------------- Schedule model Config -----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) all waiting function.
|
||||
Include sem,mailbox,queue,flag,mutex,delay modules.
|
||||
If CFG_TASK_WAITTING_EN=0,all these modules are disable.
|
||||
*/
|
||||
#define CFG_TASK_WAITTING_EN (1)
|
||||
|
||||
/*!<
|
||||
Dynamic task scheduling(1) or Static Task Scheduling(0) model.
|
||||
If in Static Task Scheduling model(0),cannot creat task and change task priority
|
||||
after coocox os start running. In Dynamic Task Scheduling model(1), all these can.
|
||||
When task terminated, if in Static Task Scheduling model(0),
|
||||
CoOS do not recovered task resources, and you can activate it again.
|
||||
But in Dynamic Task Scheduling model(1),task resources will be recovered.
|
||||
If in Static Task Scheduling model(0),mutex module can not be used, as this model don't
|
||||
support to change task priority while CoOS running.
|
||||
*/
|
||||
#define CFG_TASK_SCHEDULE_EN (1)
|
||||
|
||||
|
||||
/*---------------------- Task Management Config -----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) CoSetPriority() API.
|
||||
*/
|
||||
#if CFG_TASK_SCHEDULE_EN >0
|
||||
#define CFG_PRIORITY_SET_EN (1)
|
||||
#endif
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) CoAwakeTask() and CoSuspendTask() API.
|
||||
*/
|
||||
#define CFG_TASK_SUSPEND_EN (0)
|
||||
|
||||
|
||||
/*---------------------- Debug Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) parameter checkout .
|
||||
*/
|
||||
#define CFG_PAR_CHECKOUT_EN (0)
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) stack overflow checkout .
|
||||
*/
|
||||
#define CFG_STK_CHECKOUT_EN (0)
|
||||
|
||||
|
||||
|
||||
/*---------------------- Memory Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) memory management.
|
||||
*/
|
||||
#define CFG_MM_EN (0)
|
||||
|
||||
/*!<
|
||||
Max number of memory.(must be less than 32).
|
||||
*/
|
||||
#if CFG_MM_EN >0
|
||||
#define CFG_MAX_MM (2)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*-------------------- Kernel heap Management Config -------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) kernel heap management.
|
||||
*/
|
||||
#define CFG_KHEAP_EN (0)
|
||||
|
||||
/*!<
|
||||
Kernel heap size(word).
|
||||
*/
|
||||
#if CFG_KHEAP_EN >0
|
||||
#define KHEAP_SIZE (50)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*---------------------- Time Management Config -----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) TimeDelay() API.
|
||||
*/
|
||||
#if CFG_TASK_WAITTING_EN >0
|
||||
#define CFG_TIME_DELAY_EN (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- Timer Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) timer management.
|
||||
*/
|
||||
#define CFG_TMR_EN (1)
|
||||
|
||||
/*!<
|
||||
Specify max number timer.(must be less than 32)
|
||||
*/
|
||||
#if CFG_TMR_EN >0
|
||||
#define CFG_MAX_TMR (2)
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- Event Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) events management,
|
||||
events including semaphore,mailbox,queue.
|
||||
*/
|
||||
#if CFG_TASK_WAITTING_EN > 0
|
||||
#define CFG_EVENT_EN (1)
|
||||
#endif
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
/*!<
|
||||
Event sort type.(1)FIFO (2)PRI (3)FIFO+PRI
|
||||
*/
|
||||
#define CFG_EVENT_SORT (3)
|
||||
|
||||
/*!<
|
||||
Max number of event.(must be less than 255)
|
||||
Event = semaphore + mailbox + queue;
|
||||
*/
|
||||
#define CFG_MAX_EVENT (10)
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) semaphore management.
|
||||
*/
|
||||
#define CFG_SEM_EN (0)
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) mailbox management.
|
||||
*/
|
||||
#define CFG_MAILBOX_EN (0)
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) queue management.
|
||||
*/
|
||||
#define CFG_QUEUE_EN (0)
|
||||
|
||||
/*!<
|
||||
Max number of queue.(less than CFG_MAX_EVENT).
|
||||
*/
|
||||
#if CFG_QUEUE_EN >0
|
||||
#define CFG_MAX_QUEUE (2)
|
||||
#endif // CFG_QUEUE_EN
|
||||
|
||||
#endif // CFG_EVENT_EN
|
||||
|
||||
|
||||
|
||||
/*----------------------- Flag Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) flag management.
|
||||
Max number of flag is 32.
|
||||
*/
|
||||
#if CFG_TASK_WAITTING_EN > 0
|
||||
#define CFG_FLAG_EN (1)
|
||||
#endif
|
||||
|
||||
|
||||
/*---------------------- Mutex Management Config ----------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) mutex management.
|
||||
*/
|
||||
#if CFG_TASK_WAITTING_EN > 0
|
||||
#if CFG_TASK_SCHEDULE_EN > 0
|
||||
#define CFG_MUTEX_EN (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*!<
|
||||
Max number of mutex.(must be less than 255).
|
||||
*/
|
||||
#if CFG_MUTEX_EN >0
|
||||
#define CFG_MAX_MUTEX (10)
|
||||
#endif
|
||||
|
||||
/*---------------------- Utility Management Config --------------------------*/
|
||||
/*!<
|
||||
Enable(1) or disable(0) utility management.
|
||||
*/
|
||||
#define CFG_UTILITY_EN (0)
|
||||
|
||||
#if CFG_UTILITY_EN >0
|
||||
|
||||
/*!<
|
||||
Enable(1) or disable(0) TickToTime() utility
|
||||
*/
|
||||
#define CFG_TICK_TO_TIME_EN (1)
|
||||
/*!<
|
||||
Enable(1) or disable(0) TimeToTick() utility
|
||||
*/
|
||||
#define CFG_TIME_TO_TICK_EN (1)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // _CONFIG_H
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsCore.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to kernel
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CORE_H
|
||||
#define _CORE_H
|
||||
|
||||
#include <CoOS.h>
|
||||
|
||||
|
||||
#define OsSchedLock() OSSchedLock++; /*!< Lock schedule */
|
||||
extern void OsSchedUnlock(void);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsError.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief rror dispose header file
|
||||
* @details This file use to dispose error which from error configure for OS.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _ERROR_H
|
||||
#define _ERROR_H
|
||||
|
||||
#if (CFG_SYSTICK_FREQ > 1000) ||(CFG_SYSTICK_FREQ < 1)
|
||||
#error " OsConfig.h System Tick time must between 1ms and 1s!"
|
||||
#endif
|
||||
|
||||
#if CFG_MAX_USER_TASKS > 253
|
||||
#error " OsConfig.h, CFG_MAX_USER_TASKS must be <= 253! "
|
||||
#endif
|
||||
|
||||
#if CFG_LOWEST_PRIO > 254
|
||||
#error " OsConfig.h, CFG_LOWEST_PRIO must be <= 254! "
|
||||
#endif
|
||||
|
||||
#if CFG_IDLE_STACK_SIZE <25
|
||||
#error " OsConfig.h, CFG_IDLE_STACK_SIZE must be >= 25! "
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_ROBIN_EN > 0
|
||||
#if CFG_TIME_SLICE > 4095
|
||||
#error " OsConfig.h, CFG_TIME_SLICE must be <= 4095! "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CFG_TMR_EN > 0
|
||||
#if CFG_MAX_TMR > 32
|
||||
#error " OsConfig.h, CFG_MAX_TMR must be <= 32! "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_MM_EN > 0
|
||||
#if CFG_MAX_MM > 32
|
||||
#error " config.h, CFG_MAX_MM must be <= 32! "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_KHEAP_EN > 0
|
||||
#if KHEAP_SIZE < 0x20
|
||||
#error " config.h, CFG_MAX_MM must be >= 0x20! "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if CFG_MUTEX_EN > 0
|
||||
#if CFG_MAX_MUTEX > 254
|
||||
#error " config.h, CFG_MAX_MUTEX must be <= 254! "
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
#if (CFG_MAX_EVENT > 254 || CFG_MAX_EVENT <= 0)
|
||||
#error " config.h, CFG_MAX_EVENT must be <= 254 && > 0! "
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_QUEUE_EN > 0
|
||||
#if CFG_MAX_QUEUE > CFG_MAX_EVENT
|
||||
#error " config.h, CFG_MAX_QUEUE must be <= CFG_MAX_EVENT! "
|
||||
#endif
|
||||
#endif
|
||||
#endif /* CFG_EVENT_EN */
|
||||
|
||||
#endif /* _ERROR_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsEvent.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Event management header file
|
||||
* @details This file including some defines and declares related to event
|
||||
* (semaphore,mailbox,queque) management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _EVENT_H
|
||||
#define _EVENT_H
|
||||
|
||||
#define EVENT_TYPE_SEM (U8)0x01 /*!< Event type:Semaphore. */
|
||||
#define EVENT_TYPE_MBOX (U8)0x02 /*!< Event type:Mailbox. */
|
||||
#define EVENT_TYPE_QUEUE (U8)0x03 /*!< Event type:Queue. */
|
||||
#define EVENT_TYPE_INVALID (U8)0x04 /*!< Invalid event type. */
|
||||
|
||||
|
||||
/**
|
||||
* @struct EventCtrBlk event.h
|
||||
* @brief Event control block
|
||||
* @details This struct is use to manage event,
|
||||
* e.g. semaphore,mailbox,queue.
|
||||
*/
|
||||
typedef struct EventCtrBlk
|
||||
{
|
||||
void* eventPtr; /*!< Point to mailbox or queue struct */
|
||||
U8 id; /*!< ECB id */
|
||||
U8 eventType:4; /*!< Type of event */
|
||||
U8 eventSortType:4; /*!< 0:FIFO 1: Preemptive by prio */
|
||||
U16 eventCounter; /*!< Counter of semaphore. */
|
||||
U16 initialEventCounter; /*!< Initial counter of semaphore. */
|
||||
P_OSTCB eventTCBList; /*!< Task waitting list. */
|
||||
}ECB,*P_ECB;
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
extern ECB EventTbl[CFG_MAX_EVENT]; /*!< Table use to save TCB. */
|
||||
|
||||
/*---------------------------- Function declare ------------------------------*/
|
||||
/*!< Create a event */
|
||||
extern P_ECB CreatEvent(U8 eventType,U8 eventSortType,void* eventPtr);
|
||||
|
||||
/*!< Remove a task from wait list */
|
||||
extern void EventTaskToWait(P_ECB pecb,P_OSTCB ptcb);
|
||||
extern StatusType DeleteEvent(P_ECB pecb,U8 opt); /*!< Delete a event. */
|
||||
extern void EventTaskToRdy(P_ECB pecb); /*!< Insert a task to ready list*/
|
||||
extern void CreateEventList(void); /*!< Create a event list. */
|
||||
extern void RemoveEventWaittingList(P_OSTCB ptcb);
|
||||
#endif
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsFlag.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Evnet flag management header file
|
||||
* @details This file including some defines and declares about flag management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _FLAG_H
|
||||
#define _FLAG_H
|
||||
|
||||
/**
|
||||
* @struct FlagNode flag.h
|
||||
* @brief Flag node struct
|
||||
* @details
|
||||
*/
|
||||
typedef struct FlagNode
|
||||
{
|
||||
struct FlagNode* nextNode; /*!< A pointer to next flag node */
|
||||
struct FlagNode* prevNode; /*!< A pointer to prev flag node */
|
||||
U32 waitFlags; /*!< Flag value */
|
||||
P_OSTCB waitTask; /*!< A pointer to task waitting flag */
|
||||
U8 waitType; /*!< Wait type */
|
||||
}FLAG_NODE,*P_FLAG_NODE;
|
||||
|
||||
|
||||
/**
|
||||
* @struct Flag flag.h
|
||||
* @brief Flag control block
|
||||
* @details This struct use to mange event flag.
|
||||
*/
|
||||
typedef struct Flag
|
||||
{
|
||||
U32 flagRdy; /*!< Ready flag */
|
||||
U32 resetOpt; /*!< Reset option */
|
||||
U32 flagActive; /*!< Active flag */
|
||||
P_FLAG_NODE headNode; /*!< Head node */
|
||||
P_FLAG_NODE tailNode; /*!< Tail node */
|
||||
}FCB,*P_FCB;
|
||||
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
extern FCB FlagCrl;
|
||||
|
||||
/*---------------------------- Function declare ------------------------------*/
|
||||
extern void RemoveLinkNode(P_FLAG_NODE pnode);
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsKernelHeap.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to memory management
|
||||
* @details This file including some defines and function declare related to
|
||||
* kernel heap management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _KERNELHEAP_H
|
||||
#define _KERNELHEAP_H
|
||||
|
||||
|
||||
typedef struct KennelHeap
|
||||
{
|
||||
U32 startAddr;
|
||||
U32 endAddr;
|
||||
}KHeap,*P_KHeap;
|
||||
|
||||
|
||||
typedef struct UsedMemBlk
|
||||
{
|
||||
void* nextMB;
|
||||
void* preMB;
|
||||
}UMB,*P_UMB;
|
||||
|
||||
|
||||
typedef struct FreeMemBlk
|
||||
{
|
||||
struct FreeMemBlk* nextFMB;
|
||||
struct UsedMemBlk* nextUMB;
|
||||
struct UsedMemBlk* preUMB;
|
||||
}FMB,*P_FMB;
|
||||
|
||||
/*---------------------------- Function Declare ------------------------------*/
|
||||
extern void CoCreateKheap(void);
|
||||
|
||||
#endif /* _KERNELHEAP_H */
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsMm.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to memory management
|
||||
* @details This file including some defines and function declare related to
|
||||
* memory management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MM_H
|
||||
#define _MM_H
|
||||
|
||||
|
||||
typedef struct Memory
|
||||
{
|
||||
U8* memAddr;
|
||||
U8* freeBlock;
|
||||
U32 blockSize;
|
||||
U32 blockNum;
|
||||
}MM,*P_MM;
|
||||
|
||||
|
||||
typedef struct MemoryBlock
|
||||
{
|
||||
struct MemoryBlock* nextBlock;
|
||||
}MemBlk,*P_MemBlk;
|
||||
|
||||
|
||||
extern U32 MemoryIDVessel;
|
||||
|
||||
#endif /* _MM_H */
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsMutex.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Mutex management header file
|
||||
* @details This file including some defines and declare related to mutex
|
||||
* management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _MUTEX_H
|
||||
#define _MUTEX_H
|
||||
|
||||
#include <coocox.h>
|
||||
|
||||
#if CFG_MUTEX_EN > 0
|
||||
|
||||
/*---------------------------- Resource status -------------------------------*/
|
||||
#define MUTEX_FREE 0 /*!< Mutex is free */
|
||||
#define MUTEX_OCCUPY 1 /*!< Mutex is occupy */
|
||||
#define WAITING_MUTEX 0x80
|
||||
|
||||
/**
|
||||
* @struct Mutex mutex.h
|
||||
* @brief Mutex control block
|
||||
* @details This struct is use to mutex management.
|
||||
*/
|
||||
typedef struct Mutex
|
||||
{
|
||||
U8 originalPrio; /*!< Mutex priority. */
|
||||
U8 mutexFlag; /*!< Mutex flag. */
|
||||
OS_TID taskID; /*!< Task ID. */
|
||||
OS_TID hipriTaskID; /*!< Mutex ID. */
|
||||
P_OSTCB waittingList; /*!< waitting the Mutex. */
|
||||
}MUTEX,*P_MUTEX;
|
||||
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
/*!< Table use to save mutex control block. */
|
||||
extern MUTEX MutexTbl[CFG_MAX_MUTEX];
|
||||
extern OS_MutexID MutexFreeID; /*!< A pointer to next vliad resource ID. */
|
||||
|
||||
|
||||
/*---------------------------- Function declare ------------------------------*/
|
||||
extern void RemoveMutexList(P_OSTCB ptcb);
|
||||
|
||||
#endif /* CFG_MUTEX_EN */
|
||||
|
||||
#endif /* _MUTEX_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsQueue.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Queue management header file
|
||||
* @details This file including some defines and declares about queue management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _QUEUE_H
|
||||
#define _QUEUE_H
|
||||
|
||||
|
||||
/**
|
||||
* @struct Queue queue.h
|
||||
* @brief Queue struct
|
||||
* @details This struct use to manage queue.
|
||||
*
|
||||
*/
|
||||
typedef struct Queue
|
||||
{
|
||||
void **qStart; /*!< */
|
||||
U8 id; /*!< */
|
||||
U16 head; /*!< The header of queue */
|
||||
U16 tail; /*!< The end of queue */
|
||||
U16 qMaxSize; /*!< The max size of queue */
|
||||
U16 qSize; /*!< Current size of queue */
|
||||
}QCB,*P_QCB;
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsServiceReq.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to service request
|
||||
* @details This file including some defines and function declare related to
|
||||
* service request.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _SERVICEREQ_H
|
||||
#define _SERVICEREQ_H
|
||||
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
#define SEM_REQ (U8)0x1
|
||||
#define MBOX_REQ (U8)0x2
|
||||
#define FLAG_REQ (U8)0x3
|
||||
#define QUEUE_REQ (U8)0x4
|
||||
|
||||
|
||||
typedef struct ServiceReqCell
|
||||
{
|
||||
U8 type;
|
||||
U8 id;
|
||||
void* arg;
|
||||
}SQC,*P_SQC;
|
||||
|
||||
typedef struct ServiceReqQueue
|
||||
{
|
||||
U8 cnt;
|
||||
U8 head;
|
||||
SQC cell[CFG_MAX_SERVICE_REQUEST];
|
||||
}SRQ,*P_SRQ;
|
||||
|
||||
|
||||
extern SRQ ServiceReq;
|
||||
extern BOOL InsertInSRQ(U8 type,U8 id,void* arg);
|
||||
#endif
|
||||
|
||||
extern void RespondSRQ(void);
|
||||
extern BOOL TimeReq;
|
||||
extern BOOL TimerReq;
|
||||
extern BOOL IsrReq;
|
||||
#endif
|
||||
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsTask.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to task.
|
||||
* @details This file including some defines and function declare related to task.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _TASK_H
|
||||
#define _TASK_H
|
||||
|
||||
#define SYS_TASK_NUM (1) /*!< System task number. */
|
||||
|
||||
/*---------------------------- Task Status -----------------------------------*/
|
||||
#define TASK_READY 0 /*!< Ready status of task. */
|
||||
#define TASK_RUNNING 1 /*!< Running status of task. */
|
||||
#define TASK_WAITING 2 /*!< Waitting status of task. */
|
||||
#define TASK_DORMANT 3 /*!< Dormant status of task. */
|
||||
|
||||
|
||||
#define INVALID_ID (U8)0xff
|
||||
#define INVALID_VALUE (U32)0xffffffff
|
||||
#define MAGIC_WORD (U32)0x5a5aa5a5
|
||||
|
||||
|
||||
/**
|
||||
* @struct TCB task.h
|
||||
* @brief Task control blcok.
|
||||
* @details This struct use to manage task.
|
||||
*/
|
||||
typedef struct TCB
|
||||
{
|
||||
OS_STK *stkPtr; /*!< The current point of task. */
|
||||
U8 prio; /*!< Task priority. */
|
||||
U8 state; /*!< TaSk status. */
|
||||
OS_TID taskID; /*!< Task ID. */
|
||||
|
||||
#if CFG_MUTEX_EN > 0
|
||||
OS_MutexID mutexID; /*!< Mutex ID. */
|
||||
#endif
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
OS_EventID eventID; /*!< Event ID. */
|
||||
#endif
|
||||
|
||||
#if CFG_ROBIN_EN >0
|
||||
U16 timeSlice; /*!< Task time slice */
|
||||
#endif
|
||||
|
||||
#if CFG_STK_CHECKOUT_EN >0
|
||||
OS_STK *stack; /*!< The top point of task. */
|
||||
#endif
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
void* pmail; /*!< Mail to task. */
|
||||
struct TCB *waitNext; /*!< Point to next TCB in the Event waitting list.*/
|
||||
struct TCB *waitPrev; /*!< Point to prev TCB in the Event waitting list.*/
|
||||
#endif
|
||||
|
||||
#if CFG_TASK_SCHEDULE_EN == 0
|
||||
FUNCPtr taskFuc;
|
||||
OS_STK *taskStk;
|
||||
#endif
|
||||
|
||||
|
||||
#if CFG_FLAG_EN > 0
|
||||
void* pnode; /*!< Pointer to node of event flag. */
|
||||
#endif
|
||||
|
||||
#if CFG_TASK_WAITTING_EN >0
|
||||
U32 delayTick; /*!< The number of ticks which delay. */
|
||||
#endif
|
||||
struct TCB *TCBnext; /*!< The pointer to next TCB. */
|
||||
struct TCB *TCBprev; /*!< The pointer to prev TCB. */
|
||||
|
||||
}OSTCB,*P_OSTCB;
|
||||
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
// save tcb ptr that created
|
||||
extern P_OSTCB FreeTCB; /*!< A pointer to free TCB. */
|
||||
extern OSTCB TCBTbl[CFG_MAX_USER_TASKS+SYS_TASK_NUM];
|
||||
extern P_OSTCB TCBRdy; /*!< A pointer to TCB that is ready status */
|
||||
extern P_OSTCB TCBNext; /*!< A pointer to TCB next be scheduled. */
|
||||
extern P_OSTCB TCBRunning; /*!< A pointer to TCB that is running. */
|
||||
|
||||
extern U64 OSCheckTime;
|
||||
extern volatile U8 OSIntNesting; /*!< Use to indicate interrupt nesting level.*/
|
||||
extern volatile U8 OSSchedLock; /*!< Schedule is lock(LOCK) or unlock(UN_LOCK).*/
|
||||
extern volatile BOOL TaskSchedReq;
|
||||
extern OS_STK idle_stk[CFG_IDLE_STACK_SIZE];
|
||||
|
||||
|
||||
void Schedule(void); /*!< Schedule function */
|
||||
void IdleTask(void* pdata); /*!< IDLE task code */
|
||||
void InsertToTCBRdyList (P_OSTCB tcbInser);
|
||||
void RemoveFromTCBRdyList(P_OSTCB ptcb);
|
||||
void CreateTCBList(void);
|
||||
#if CFG_ORDER_LIST_SCHEDULE_EN ==0
|
||||
void ActiveTaskPri(U8 pri);
|
||||
void DeleteTaskPri(U8 pri);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsTime.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Header file related to time management
|
||||
* @details Thie file including some data declare related to time managment.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _TIME_H
|
||||
#define _TIME_H
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
extern P_OSTCB DlyList; /*!< A pointer to ther delay list. */
|
||||
|
||||
/*---------------------------- Function declare ------------------------------*/
|
||||
extern void TimeDispose(void); /*!< Time dispose function. */
|
||||
extern void isr_TimeDispose(void);
|
||||
extern void RemoveDelayList(P_OSTCB ptcb);
|
||||
extern void InsertDelayList(P_OSTCB ptcb,U32 ticks);
|
||||
#endif
|
||||
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsTimer.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Timer manage header file
|
||||
* @details This file including some declares and defines related to timer
|
||||
* management.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _TIMER_H
|
||||
#define _TIMER_H
|
||||
|
||||
#define TMR_STATE_RUNNING 0 /*!< Timer State: Running */
|
||||
#define TMR_STATE_STOPPED 1 /*!< Timer State: Stopped */
|
||||
|
||||
/**
|
||||
* @struct tmrCtrl timer.h
|
||||
* @brief Timer control block
|
||||
* @details This struct is use to manage user timer.
|
||||
*
|
||||
*/
|
||||
typedef struct tmrCtrl /* Timer Control Block Define. */
|
||||
{
|
||||
OS_TCID tmrID; /*!< Timer ID. */
|
||||
U8 tmrType; /*!< Timer Type. */
|
||||
U8 tmrState; /*!< Timer State. */
|
||||
U32 tmrCnt; /*!< Timer Counter. */
|
||||
U32 tmrReload; /*!< Timer Reload Counter Value. */
|
||||
vFUNCPtr tmrCallBack; /*!< Call-back Function When Timer overrun. */
|
||||
struct tmrCtrl* tmrNext; /*!< Point to Next Timer Control Block. */
|
||||
struct tmrCtrl* tmrPrev; /*!< Point to Previous Timer Control Block*/
|
||||
|
||||
}TmrCtrl,*P_TmrCtrl;
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
extern P_TmrCtrl TmrList; /*!< A pointer to the timer list. */
|
||||
extern U32 TmrIDVessel;
|
||||
/*---------------------------- Function declare ------------------------------*/
|
||||
extern void TmrDispose(void); /*!< Timer counter function. */
|
||||
extern void isr_TmrDispose(void);
|
||||
#endif
|
||||
@@ -0,0 +1,60 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file coocox.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Gather for all header file of CooCox CoOS.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _COOCOX_H
|
||||
#define _COOCOX_H
|
||||
|
||||
#define OS_VERSION (U16)0x0113 /*!< OS version.(format: Vx.xx),
|
||||
e.g. value 0x0113 is version V1.13*/
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include "CoOS.h"
|
||||
#include "OsArch.h"
|
||||
#include "OsCore.h"
|
||||
#include "OsTask.h"
|
||||
#include "OsServiceReq.h"
|
||||
#include "OsError.h"
|
||||
#include "OsTime.h"
|
||||
|
||||
|
||||
#if CFG_TMR_EN > 0
|
||||
#include "OsTimer.h"
|
||||
#endif
|
||||
|
||||
#if CFG_KHEAP_EN > 0
|
||||
#include "OsKernelHeap.h"
|
||||
#endif
|
||||
|
||||
#if CFG_MM_EN >0
|
||||
#include "OsMM.h"
|
||||
#endif
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
#include "OsEvent.h"
|
||||
#endif
|
||||
|
||||
#if CFG_MUTEX_EN > 0
|
||||
#include "OsMutex.h"
|
||||
#endif
|
||||
|
||||
#if CFG_QUEUE_EN > 0
|
||||
#include "OsQueue.h"
|
||||
#endif
|
||||
|
||||
#if CFG_FLAG_EN > 0
|
||||
#include "OsFlag.h"
|
||||
#endif
|
||||
|
||||
#endif /* _COOCOX_H */
|
||||
@@ -0,0 +1,238 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file core.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Core implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
volatile U8 OSIntNesting = 0; /*!< Use to indicate interrupt nesting level*/
|
||||
volatile U8 OSSchedLock = 0; /*!< Task Switch lock. */
|
||||
volatile BOOL TaskSchedReq = Co_FALSE;
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Enter a ISR.
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to notify OS when enter to an ISR.
|
||||
*
|
||||
* @note When you call API in ISR,you must call CoEnterISR() before your
|
||||
* interrupt handler code,and call CoExitISR() after your handler
|
||||
* code and before exiting from ISR.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoEnterISR(void)
|
||||
{
|
||||
Inc8(&OSIntNesting); /* OSIntNesting increment */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Exit a ISR.
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called when exit from a ISR.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoExitISR(void)
|
||||
{
|
||||
Dec8(&OSIntNesting); /* OSIntNesting decrease */
|
||||
if( OSIntNesting == 0) /* Is OSIntNesting == 0? */
|
||||
{
|
||||
if(TaskSchedReq == Co_TRUE)
|
||||
{
|
||||
OSSchedLock++;
|
||||
Schedule(); /* Call task schedule */
|
||||
OSSchedLock--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Unlock schedule
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to unlock schedule(i.e.enable schedule again)
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void OsSchedUnlock(void)
|
||||
{
|
||||
if(OSSchedLock == 1) /* Is OSSchedLock == 0? */
|
||||
{
|
||||
#if CFG_TASK_WAITTING_EN > 0
|
||||
if(IsrReq == Co_TRUE)
|
||||
{
|
||||
RespondSRQ(); /* Respond service request */
|
||||
}
|
||||
#endif
|
||||
/* Judge task state change or higher PRI task coming in */
|
||||
if(TaskSchedReq == Co_TRUE)
|
||||
{
|
||||
Schedule(); /* Call task schedule */
|
||||
}
|
||||
OSSchedLock = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
OSSchedLock--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Lock schedule
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in application code to lock schedule.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoSchedLock(void)
|
||||
{
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Unlock schedule
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in APP to unlock schedule.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoSchedUnlock(void)
|
||||
{
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Initialize OS
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to initialize OS.
|
||||
*
|
||||
* @note You must call this function first,before any other OS API function
|
||||
*
|
||||
* @code There is a example for useage of this function,as follows:
|
||||
* e.g.
|
||||
* ... // Your target initial code.
|
||||
*
|
||||
* OsInit(); // Initial OS.
|
||||
* CreateTask(...); // Create tasks.
|
||||
* ...
|
||||
* OsStart(); // Start multitask.
|
||||
* @endcode
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoInitOS(void)
|
||||
{
|
||||
InitSysTick(); /* Initialize system tick. */
|
||||
InitInt(); /* Initialize PendSV,SVC,SysTick interrupt */
|
||||
CreateTCBList(); /* Create TCB list. */
|
||||
#if CFG_EVENT_EN > 0
|
||||
CreateEventList(); /* Create event control list. */
|
||||
#endif
|
||||
#if CFG_KHEAP_EN > 0
|
||||
CoCreateKheap(); /* Create kernel heap within user define */
|
||||
#endif
|
||||
OsSchedLock(); /* Lock Schedule */
|
||||
/* Create first task -- IDLE task. */
|
||||
CoCreateTask( CoIdleTask,
|
||||
Co_NULL,
|
||||
CFG_LOWEST_PRIO,
|
||||
&idle_stk[CFG_IDLE_STACK_SIZE-1],
|
||||
CFG_IDLE_STACK_SIZE
|
||||
);
|
||||
/* Set PSP for CoIdleTask coming in */
|
||||
SetEnvironment(&idle_stk[CFG_IDLE_STACK_SIZE-1]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Start multitask
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to start multitask.After it is called,
|
||||
* OS start schedule task by priority or/and time slice.
|
||||
* @note This function must be called to start OS when you use CoOS,and must
|
||||
* call after CoOsInit().
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoStartOS(void)
|
||||
{
|
||||
TCBRunning = &TCBTbl[0]; /* Get running task */
|
||||
TCBNext = TCBRunning; /* Set next scheduled task as running task */
|
||||
TCBRunning->state = TASK_RUNNING; /* Set running task status to RUNNING */
|
||||
RemoveFromTCBRdyList(TCBRunning); /* Remove running task from READY list */
|
||||
OsSchedUnlock(); /* Enable Schedule,call task schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get OS version
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval The value is version of OS mutipled by 100.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is used to return the version number of CooCox OS.
|
||||
* the return value corresponds to CooCox's version number multiplied
|
||||
* by 100. In other words, version 1.02 would be returned as 102.
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_VER CoGetOSVersion(void)
|
||||
{
|
||||
return OS_VERSION; /* Get CooCox CoOS version */
|
||||
}
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file event.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief event management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
#if CFG_EVENT_EN > 0
|
||||
|
||||
ECB EventTbl[CFG_MAX_EVENT]= {{0}};/*!< Table which save event control block.*/
|
||||
P_ECB FreeEventList = Co_NULL; /*!< Pointer to free event control block. */
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a empty list of event control block
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called by OSInit() API to create a ECB list,supply
|
||||
* a pointer to next event control block that not used.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CreateEventList(void)
|
||||
{
|
||||
U8 i;
|
||||
P_ECB pecb1;
|
||||
#if CFG_MAX_EVENT > 1
|
||||
P_ECB pecb2;
|
||||
#endif
|
||||
i=0;
|
||||
pecb1 = &EventTbl[0]; /* Get first item */
|
||||
#if CFG_MAX_EVENT == 1 /* Build event list for only one item */
|
||||
pecb1->eventPtr = Co_NULL;
|
||||
pecb1->id = i; /* Assign ID. */
|
||||
pecb1->eventType = EVENT_TYPE_INVALID; /* Sign that not to use. */
|
||||
#endif
|
||||
|
||||
#if CFG_MAX_EVENT > 1 /* Build event list for more than one item */
|
||||
pecb2 = &EventTbl[1];
|
||||
for(;i< (CFG_MAX_EVENT-1);i++ )
|
||||
{
|
||||
pecb1->eventPtr = (void*)pecb2; /* Set link for list */
|
||||
pecb1->id = i; /* Assign ID. */
|
||||
pecb1->eventType = EVENT_TYPE_INVALID;/* Sign that not to use. */
|
||||
pecb1++; /* Get next item */
|
||||
pecb2++;
|
||||
}
|
||||
pecb1->eventType = EVENT_TYPE_INVALID; /* Sign that not to use. */
|
||||
pecb1->eventPtr = Co_NULL; /* Set link for last item */
|
||||
pecb1->id = i;
|
||||
#endif
|
||||
|
||||
FreeEventList = &EventTbl[0]; /* Set free event item */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Release a ECB
|
||||
* @param[in] pecb A pointer to event control block which be released.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to release a event control block when a
|
||||
* event be deleted.
|
||||
*******************************************************************************
|
||||
*/
|
||||
static void ReleaseECB(P_ECB pecb)
|
||||
{
|
||||
pecb->eventType = EVENT_TYPE_INVALID; /* Sign that not to use. */
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
pecb->eventPtr = FreeEventList; /* Release ECB that event hold */
|
||||
FreeEventList = pecb; /* Reset free event item */
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a event
|
||||
* @param[in] eventType The type of event which being created.
|
||||
* @param[in] eventSortType Event sort type.
|
||||
* @param[in] eventCounter Event counter,ONLY for EVENT_TYPE_SEM.
|
||||
* @param[in] eventPtr Event struct pointer,ONLY for Queue.Co_NULL for other
|
||||
* event type.
|
||||
* @param[out] None
|
||||
* @retval Co_NULL Invalid pointer,create event fail.
|
||||
* @retval others Pointer to event control block which had assigned right now.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called by CreateSem(),...
|
||||
* to get a event control block and initial the event content.
|
||||
*
|
||||
* @note This is a internal function of CooCox CoOS,User can't call.
|
||||
*******************************************************************************
|
||||
*/
|
||||
P_ECB CreatEvent(U8 eventType,U8 eventSortType,void* eventPtr)
|
||||
{
|
||||
P_ECB pecb;
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
if(FreeEventList == Co_NULL) /* Is there no free evnet item */
|
||||
{
|
||||
OsSchedUnlock(); /* Yes,unlock schedule */
|
||||
return Co_NULL; /* Return error */
|
||||
}
|
||||
pecb = FreeEventList;/* Assign the free event item to this event */
|
||||
FreeEventList = FreeEventList->eventPtr; /* Reset free event item */
|
||||
OsSchedUnlock(); /* Unlock schedul */
|
||||
|
||||
pecb->eventType = eventType; /* Initialize event item as user set */
|
||||
pecb->eventSortType = eventSortType;
|
||||
pecb->eventPtr = eventPtr;
|
||||
pecb->eventTCBList = Co_NULL;
|
||||
return pecb; /* Return event item pointer */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a event
|
||||
* @param[in] pecb Pointer to event control block which will be deleted.
|
||||
* @param[in] opt Delete option.
|
||||
* @arg == OPT_DEL_ANYWAY Delete event always
|
||||
* @arg == OPT_DEL_NO_PEND Delete event only when no task pending on.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_PARAMETER Parameter passed is invalid,deleted fail.
|
||||
* @retval E_TASK_WAITTING These are one more tasks waitting event.
|
||||
* @retval E_OK Delete event control block successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a event from the event wait list
|
||||
* use specify option.
|
||||
*
|
||||
* @note This is a internal function of Coocox CoOS,user can't call.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType DeleteEvent(P_ECB pecb,U8 opt)
|
||||
{
|
||||
P_OSTCB ptcb;
|
||||
if(opt == OPT_DEL_NO_PEND) /* Do delete event when no task pend? */
|
||||
{
|
||||
if(pecb->eventTCBList != Co_NULL) /* Yes,is there task pend this event? */
|
||||
{
|
||||
return E_TASK_WAITING; /* Yes,error return */
|
||||
}
|
||||
else
|
||||
{
|
||||
ReleaseECB(pecb); /* No,release resource that event hold*/
|
||||
}
|
||||
}
|
||||
else if(opt == OPT_DEL_ANYWAY) /* Do delete event anyway? */
|
||||
{
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
while(pecb->eventTCBList != Co_NULL) /* Is there task pend this event? */
|
||||
{ /* Yes,remove it */
|
||||
ptcb = pecb->eventTCBList;/* Get first task in event waiting list */
|
||||
if(ptcb->delayTick != INVALID_VALUE) /* Is task in delay list? */
|
||||
{
|
||||
RemoveDelayList(ptcb); /* Yes,remove task from delay list */
|
||||
}
|
||||
|
||||
/* Set next item as event waiting list head */
|
||||
pecb->eventTCBList = ptcb->waitNext;
|
||||
ptcb->waitNext = Co_NULL; /* Clear link for event waiting list */
|
||||
ptcb->eventID = INVALID_ID; /* Sign that not to use. */
|
||||
|
||||
InsertToTCBRdyList(ptcb); /* Insert task into ready list */
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
ReleaseECB(pecb); /* Release resource that event hold */
|
||||
}
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Insert a task to event wait list
|
||||
* @param[in] pecb Pointer to event control block corresponding to the event.
|
||||
* @param[in] ptcb Pointer to task that will be insert to event wait list.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to insert a task by fllowing manner:
|
||||
* opt == EVENT_SORT_TYPE_FIFO By FIFO.
|
||||
* opt == EVENT_SORT_TYPE_PRIO By priority order,hghest priority
|
||||
* as head,lowest priority as end.
|
||||
* (Highest-->...-->Lowest-->Co_NULL)
|
||||
*******************************************************************************
|
||||
*/
|
||||
void EventTaskToWait(P_ECB pecb,P_OSTCB ptcb)
|
||||
{
|
||||
P_OSTCB ptcb1;
|
||||
#if (CFG_EVENT_SORT == 2) || (CFG_EVENT_SORT == 3)
|
||||
P_OSTCB ptcb2;
|
||||
#endif
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
ptcb1 = pecb->eventTCBList; /* Get first task in event waiting list */
|
||||
ptcb->eventID = pecb->id; /* Set event ID for task */
|
||||
|
||||
#if CFG_EVENT_SORT == 3 /* Does event waiting list sort as FIFO? */
|
||||
|
||||
if(pecb->eventSortType == EVENT_SORT_TYPE_FIFO)
|
||||
#endif
|
||||
|
||||
#if (CFG_EVENT_SORT == 1) || (CFG_EVENT_SORT == 3)
|
||||
{
|
||||
if(ptcb1 == Co_NULL) /* Is no item in event waiting list?*/
|
||||
{
|
||||
pecb->eventTCBList = ptcb; /* Yes,set task as first item */
|
||||
}
|
||||
else
|
||||
{
|
||||
while(ptcb1->waitNext != Co_NULL)/* No,insert task in last */
|
||||
{
|
||||
ptcb1 = ptcb1->waitNext;
|
||||
}
|
||||
ptcb1->waitNext = ptcb; /* Set link for list */
|
||||
ptcb->waitPrev = ptcb1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_EVENT_SORT ==3 /* Does event waiting list sort as preemptive priority?*/
|
||||
else if(pecb->eventSortType == EVENT_SORT_TYPE_PRIO)
|
||||
#endif
|
||||
#if (CFG_EVENT_SORT == 2) || (CFG_EVENT_SORT == 3)
|
||||
{
|
||||
if(ptcb1 == Co_NULL) /* Is no item in event waiting list? */
|
||||
{
|
||||
pecb->eventTCBList = ptcb; /* Yes,set task as first item */
|
||||
}
|
||||
/* Is PRI of task higher than list first item? */
|
||||
else if(ptcb1->prio > ptcb->prio)
|
||||
{
|
||||
pecb->eventTCBList = ptcb; /* Reset task as first item */
|
||||
ptcb->waitNext = ptcb1; /* Set link for list */
|
||||
ptcb1->waitPrev = ptcb;
|
||||
}
|
||||
else /* No,find correct place to insert */
|
||||
{
|
||||
ptcb2 = ptcb1->waitNext;
|
||||
while(ptcb2 != Co_NULL) /* Is last item? */
|
||||
{
|
||||
if(ptcb2->prio > ptcb->prio) /* No,is correct place? */
|
||||
{
|
||||
break; /* Yes,break Circulation */
|
||||
}
|
||||
ptcb1 = ptcb2; /* Save current item */
|
||||
ptcb2 = ptcb2->waitNext; /* Get next item */
|
||||
}
|
||||
ptcb1->waitNext = ptcb; /* Set link for list */
|
||||
ptcb->waitPrev = ptcb1;
|
||||
ptcb->waitNext = ptcb2;
|
||||
if(ptcb2 != Co_NULL)
|
||||
{
|
||||
ptcb2->waitPrev = ptcb;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ptcb->state = TASK_WAITING; /* Set task status to TASK_WAITING state */
|
||||
TaskSchedReq = Co_TRUE;
|
||||
OsSchedUnlock(); /* Unlock schedule,and call task schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Move a task from event WAITING list to the DELAY list
|
||||
* @param[in] pecb Pointer to event control block corresponding to the event.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove a task from event wait list,and
|
||||
* then insert it into the READY list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void EventTaskToRdy(P_ECB pecb)
|
||||
{
|
||||
P_OSTCB ptcb;
|
||||
#if CFG_QUEUE_EN >0
|
||||
P_QCB pqcb;
|
||||
#endif
|
||||
ptcb = pecb->eventTCBList;
|
||||
if(ptcb == Co_NULL)
|
||||
return;
|
||||
|
||||
pecb->eventTCBList = ptcb->waitNext;/* Get first task in event waiting list*/
|
||||
if(pecb->eventTCBList != Co_NULL) /* Is no item in event waiting list? */
|
||||
{
|
||||
pecb->eventTCBList->waitPrev = Co_NULL; /* No,clear link for first item */
|
||||
}
|
||||
|
||||
ptcb->waitNext = Co_NULL; /* Clear event waiting link for task*/
|
||||
ptcb->eventID = INVALID_ID; /* Sign that not to use. */
|
||||
|
||||
if(ptcb->delayTick != INVALID_VALUE) /* Is task in delay list? */
|
||||
{
|
||||
RemoveDelayList(ptcb); /* Yes,remove task from DELAY list */
|
||||
}
|
||||
if(pecb->eventType == EVENT_TYPE_MBOX)/* Is it a mailbox event? */
|
||||
{
|
||||
ptcb->pmail = pecb->eventPtr; /* Yes,send mail to task */
|
||||
pecb->eventPtr = Co_NULL; /* Clear event sign */
|
||||
pecb->eventCounter--;
|
||||
}
|
||||
#if CFG_QUEUE_EN >0
|
||||
else if(pecb->eventType == EVENT_TYPE_QUEUE) /* Is it a queue event? */
|
||||
{
|
||||
pqcb = (P_QCB)pecb->eventPtr; /* Yes,get queue pointer */
|
||||
ptcb->pmail = *(pqcb->qStart + pqcb->head); /* Send mail to task */
|
||||
pqcb->head++; /* Clear event sign */
|
||||
pqcb->qSize--;
|
||||
if(pqcb->head == pqcb->qMaxSize)
|
||||
{
|
||||
pqcb->head = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_MAILBOX_EN >0
|
||||
else if(pecb->eventType == EVENT_TYPE_SEM)/* Is it a semaphore event? */
|
||||
{
|
||||
pecb->eventCounter--; /* Yes,clear event sign */
|
||||
ptcb->pmail = (void*)0xffffffff; /* Indicate task woke by event */
|
||||
}
|
||||
#endif
|
||||
if(ptcb == TCBRunning)
|
||||
{
|
||||
ptcb->state = TASK_RUNNING;
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertToTCBRdyList(ptcb); /* Insert task into ready list */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Move a task from event wait list to the ready list
|
||||
* @param[in] pecb Pointer to event control block corresponding to the event.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove a task from event wait list,and
|
||||
* then insert it to the ready list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void RemoveEventWaittingList(P_OSTCB ptcb)
|
||||
{
|
||||
P_ECB pecb;
|
||||
pecb = &EventTbl[ptcb->eventID]; /* Get event control block */
|
||||
|
||||
/* Is there only one item in event waiting list? */
|
||||
if((ptcb->waitNext == Co_NULL) && (ptcb->waitPrev == Co_NULL))
|
||||
{
|
||||
pecb->eventTCBList = Co_NULL; /* Yes,set event waiting list as Co_NULL */
|
||||
}
|
||||
else if(ptcb->waitPrev == Co_NULL)/* Is the first item in event waiting list?*/
|
||||
{
|
||||
/* Yes,remove task from list,and reset event waiting list */
|
||||
ptcb->waitNext->waitPrev = Co_NULL;
|
||||
pecb->eventTCBList = ptcb->waitNext;
|
||||
ptcb->waitNext = Co_NULL;
|
||||
}
|
||||
else if(ptcb->waitNext == Co_NULL)/* Is the last item in event waiting list? */
|
||||
{
|
||||
ptcb->waitPrev->waitNext = Co_NULL; /* Yes,remove task form list */
|
||||
ptcb->waitPrev = Co_NULL;
|
||||
}
|
||||
else /* No, remove task from list */
|
||||
{
|
||||
ptcb->waitPrev->waitNext = ptcb->waitNext;
|
||||
ptcb->waitNext->waitPrev = ptcb->waitPrev;
|
||||
ptcb->waitPrev = Co_NULL;
|
||||
ptcb->waitNext = Co_NULL;
|
||||
}
|
||||
ptcb->eventID = INVALID_ID; /* Sign that not to use. */
|
||||
}
|
||||
|
||||
#endif //CFG_EVENT_EN
|
||||
|
||||
@@ -0,0 +1,712 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file flag.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Flag management implementation code of coocox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
#if CFG_FLAG_EN > 0
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
#define FLAG_MAX_NUM 32 /*!< Define max flag number. */
|
||||
FCB FlagCrl = {0}; /*!< Flags list struct */
|
||||
|
||||
|
||||
/*---------------------------- Function Declare ------------------------------*/
|
||||
static void FlagBlock(P_FLAG_NODE pnode,U32 flags,U8 waitType);
|
||||
static P_FLAG_NODE RemoveFromLink(P_FLAG_NODE pnode);
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a flag
|
||||
* @param[in] bAutoReset Reset mode,Co_TRUE(Auto Reset) FLASE(Manual Reset).
|
||||
* @param[in] bInitialState Initial state.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create flag fail.
|
||||
* @retval others Create flag successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function use to create a event flag.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_FlagID CoCreateFlag(BOOL bAutoReset,BOOL bInitialState)
|
||||
{
|
||||
U8 i;
|
||||
OsSchedLock();
|
||||
|
||||
for(i=0;i<FLAG_MAX_NUM;i++)
|
||||
{
|
||||
/* Assign a free flag control block */
|
||||
if((FlagCrl.flagActive&(1<<i)) == 0 )
|
||||
{
|
||||
FlagCrl.flagActive |= (1<<i); /* Initialize active flag */
|
||||
FlagCrl.flagRdy |= (bInitialState<<i);/* Initialize ready flag */
|
||||
FlagCrl.resetOpt |= (bAutoReset<<i);/* Initialize reset option */
|
||||
OsSchedUnlock();
|
||||
return i ; /* Return Flag ID */
|
||||
}
|
||||
}
|
||||
OsSchedUnlock();
|
||||
|
||||
return E_CREATE_FAIL; /* There is no free flag control block*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a flag
|
||||
* @param[in] id Flag ID.
|
||||
* @param[in] opt Delete option.
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_TASK_WAITTING Tasks waitting for the event,delete fail.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a event flag.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelFlag(OS_FlagID id,U8 opt)
|
||||
{
|
||||
P_FLAG_NODE pnode;
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
if(OSIntNesting > 0) /* If be called from ISR */
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if((pfcb->flagActive&(1<<id)) == 0) /* Flag is valid or not */
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock();
|
||||
pnode = pfcb->headNode;
|
||||
|
||||
while(pnode != Co_NULL) /* Ready all tasks waiting for flags */
|
||||
{
|
||||
if((pnode->waitFlags&(1<<id)) != 0) /* If no task is waiting on flags */
|
||||
{
|
||||
if(opt == OPT_DEL_NO_PEND) /* Delete flag if no task waiting */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
return E_TASK_WAITING;
|
||||
}
|
||||
else if (opt == OPT_DEL_ANYWAY) /* Always delete the flag */
|
||||
{
|
||||
if(pnode->waitType == OPT_WAIT_ALL)
|
||||
{
|
||||
/* If the flag is only required by NODE */
|
||||
if( pnode->waitFlags == (1<<id) )
|
||||
{
|
||||
/* Remove the NODE from waiting list */
|
||||
pnode = RemoveFromLink(pnode);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
pnode->waitFlags &= ~(1<<id); /* Update waitflags */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pnode = RemoveFromLink(pnode);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
pnode = pnode->nextNode;
|
||||
}
|
||||
|
||||
/* Remove the flag from the flags list */
|
||||
pfcb->flagActive &= ~(1<<id);
|
||||
pfcb->flagRdy &= ~(1<<id);
|
||||
pfcb->resetOpt &= ~(1<<id);
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief AcceptSingleFlag
|
||||
* @param[in] id Flag ID.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_FLAG_NOT_READY Flag is not in ready state.
|
||||
* @retval E_OK The call was successful and your task owns the Flag.
|
||||
*
|
||||
* @par Description
|
||||
* @details This fucntion is called to accept single flag
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoAcceptSingleFlag(OS_FlagID id)
|
||||
{
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= FLAG_MAX_NUM)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid 'id',return error */
|
||||
}
|
||||
if((pfcb->flagActive&(1<<id)) == 0)
|
||||
{
|
||||
return E_INVALID_ID; /* Flag is deactive,return error */
|
||||
}
|
||||
#endif
|
||||
if((pfcb->flagRdy&(1<<id)) != 0) /* If the required flag is set */
|
||||
{
|
||||
OsSchedLock()
|
||||
pfcb->flagRdy &= ~((FlagCrl.resetOpt)&(1<<id)); /* Clear the flag */
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
else /* If the required flag is not set */
|
||||
{
|
||||
return E_FLAG_NOT_READY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief AcceptMultipleFlags
|
||||
* @param[in] flags Flags that waiting to active task.
|
||||
* @param[in] waitType Flags wait type.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval 0
|
||||
* @retval springFlag
|
||||
*
|
||||
* @par Description
|
||||
* @details This fucntion is called to accept multiple flags.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
U32 CoAcceptMultipleFlags(U32 flags,U8 waitType,StatusType *perr)
|
||||
{
|
||||
U32 springFlag;
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if((flags&pfcb->flagActive) != flags ) /* Judge flag is active or not? */
|
||||
{
|
||||
*perr = E_INVALID_PARAMETER; /* Invalid flags */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
springFlag = flags & pfcb->flagRdy;
|
||||
|
||||
OsSchedLock();
|
||||
/* If any required flags are set */
|
||||
if( (springFlag != 0) && (waitType == OPT_WAIT_ANY) )
|
||||
{
|
||||
|
||||
pfcb->flagRdy &= ~(springFlag & pfcb->resetOpt); /* Clear the flags */
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
|
||||
/* If all required flags are set */
|
||||
if((springFlag == flags) && (waitType == OPT_WAIT_ALL))
|
||||
{
|
||||
pfcb->flagRdy &= ~(springFlag&pfcb->resetOpt); /* Clear the flags */
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
OsSchedUnlock();
|
||||
*perr = E_FLAG_NOT_READY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief WaitForSingleFlag
|
||||
* @param[in] id Flag ID.
|
||||
* @param[in] timeout The longest time for writting flag.
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_TIMEOUT Flag wasn't received within 'timeout' time.
|
||||
* @retval E_OK The call was successful and your task owns the Flag,
|
||||
* or the event you are waiting for occurred.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to wait for only one flag,
|
||||
* (1) if parameter "timeout" == 0,waiting until flag be set;
|
||||
* (2) when "timeout" != 0,if flag was set or wasn't set but timeout
|
||||
* occured,the task will exit the waiting list,convert to READY
|
||||
* or RUNNING state.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoWaitForSingleFlag(OS_FlagID id,U32 timeout)
|
||||
{
|
||||
FLAG_NODE flagNode;
|
||||
P_FCB pfcb;
|
||||
P_OSTCB curTCB;
|
||||
|
||||
if(OSIntNesting > 0) /* See if the caller is ISR */
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
if(OSSchedLock != 0) /* Schedule is lock? */
|
||||
{
|
||||
return E_OS_IN_LOCK; /* Yes,error return */
|
||||
}
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= FLAG_MAX_NUM) /* Judge id is valid or not? */
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid 'id' */
|
||||
}
|
||||
if((FlagCrl.flagActive&(1<<id)) == 0 )/* Judge flag is active or not? */
|
||||
{
|
||||
return E_INVALID_ID; /* Flag is deactive ,return error */
|
||||
}
|
||||
#endif
|
||||
|
||||
OsSchedLock();
|
||||
pfcb = &FlagCrl;
|
||||
/* See if the required flag is set */
|
||||
if((pfcb->flagRdy&(1<<id)) != 0) /* If the required flag is set */
|
||||
{
|
||||
pfcb->flagRdy &= ~((pfcb->resetOpt&(1<<id))); /* Clear the flag */
|
||||
OsSchedUnlock();
|
||||
}
|
||||
else /* If the required flag is not set */
|
||||
{
|
||||
curTCB = TCBRunning;
|
||||
if(timeout == 0) /* If time-out is not configured */
|
||||
{
|
||||
/* Block task until the required flag is set */
|
||||
FlagBlock (&flagNode,(1<<id),OPT_WAIT_ONE);
|
||||
curTCB->state = TASK_WAITING;
|
||||
TaskSchedReq = Co_TRUE;
|
||||
OsSchedUnlock();
|
||||
|
||||
/* The required flag is set and the task is in running state */
|
||||
curTCB->pnode = Co_NULL;
|
||||
OsSchedLock();
|
||||
|
||||
/* Clear the required flag or not */
|
||||
pfcb->flagRdy &= ~((1<<id)&(pfcb->resetOpt));
|
||||
OsSchedUnlock();
|
||||
}
|
||||
else /* If time-out is configured */
|
||||
{
|
||||
/* Block task until the required flag is set or time-out occurs */
|
||||
FlagBlock(&flagNode,(1<<id),OPT_WAIT_ONE);
|
||||
InsertDelayList(curTCB,timeout);
|
||||
|
||||
OsSchedUnlock();
|
||||
if(curTCB->pnode == Co_NULL) /* If time-out occurred */
|
||||
{
|
||||
return E_TIMEOUT;
|
||||
}
|
||||
else /* If flag is set */
|
||||
{
|
||||
curTCB->pnode = Co_NULL;
|
||||
OsSchedLock();
|
||||
|
||||
/* Clear the required flag or not */
|
||||
pfcb->flagRdy &= ~((1<<id)&(pfcb->resetOpt));
|
||||
OsSchedUnlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief WaitForMultipleFlags
|
||||
* @param[in] flags Flags that waiting to active task.
|
||||
* @param[in] waitType Flags wait type.
|
||||
* @param[in] timeout The longest time for writting flag.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval 0
|
||||
* @retval springFlag
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to pend a task for waitting multiple flag.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
U32 CoWaitForMultipleFlags(U32 flags,U8 waitType,U32 timeout,StatusType *perr)
|
||||
{
|
||||
U32 springFlag;
|
||||
P_FCB pfcb;
|
||||
FLAG_NODE flagNode;
|
||||
P_OSTCB curTCB;
|
||||
|
||||
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
*perr = E_CALL;
|
||||
return 0;
|
||||
}
|
||||
if(OSSchedLock != 0) /* Schedule is lock? */
|
||||
{
|
||||
*perr = E_OS_IN_LOCK;
|
||||
return 0; /* Yes,error return */
|
||||
}
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if( (flags&FlagCrl.flagActive) != flags )
|
||||
{
|
||||
*perr = E_INVALID_PARAMETER; /* Invalid 'flags' */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock();
|
||||
pfcb = &FlagCrl;
|
||||
springFlag = flags & pfcb->flagRdy;
|
||||
|
||||
/* If any required flags are set */
|
||||
if((springFlag != 0) && (waitType == OPT_WAIT_ANY))
|
||||
{
|
||||
pfcb->flagRdy &= ~(springFlag & pfcb->resetOpt); /* Clear the flag */
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
|
||||
/* If all required flags are set */
|
||||
if( (springFlag == flags) && (waitType == OPT_WAIT_ALL) )
|
||||
{
|
||||
pfcb->flagRdy &= ~(springFlag & pfcb->resetOpt); /* Clear the flags */
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
|
||||
curTCB = TCBRunning;
|
||||
if(timeout == 0) /* If time-out is not configured */
|
||||
{
|
||||
/* Block task until the required flag are set */
|
||||
FlagBlock(&flagNode,flags,waitType);
|
||||
curTCB->state = TASK_WAITING;
|
||||
TaskSchedReq = Co_TRUE;
|
||||
OsSchedUnlock();
|
||||
|
||||
curTCB->pnode = Co_NULL;
|
||||
OsSchedLock();
|
||||
springFlag = flags & pfcb->flagRdy;
|
||||
pfcb->flagRdy &= ~(springFlag & pfcb->resetOpt);/* Clear the flags */
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
else /* If time-out is configured */
|
||||
{
|
||||
/* Block task until the required flag are set or time-out occurred */
|
||||
FlagBlock(&flagNode,flags,waitType);
|
||||
InsertDelayList(curTCB,timeout);
|
||||
|
||||
OsSchedUnlock();
|
||||
if(curTCB->pnode == Co_NULL) /* If time-out occurred */
|
||||
{
|
||||
*perr = E_TIMEOUT;
|
||||
return 0;
|
||||
}
|
||||
else /* If the required flags are set */
|
||||
{
|
||||
curTCB->pnode = Co_NULL;
|
||||
OsSchedLock();
|
||||
springFlag = flags & FlagCrl.flagRdy;
|
||||
|
||||
/* Clear the required ready flags or not */
|
||||
pfcb->flagRdy &= ~(springFlag & pfcb->resetOpt);
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return springFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Clear a Flag
|
||||
* @param[in] id Flag ID.
|
||||
* @param[out] None
|
||||
* @retval E_OK Event deleted successful.
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to clear a flag.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoClearFlag(OS_FlagID id)
|
||||
{
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= FLAG_MAX_NUM)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid id */
|
||||
}
|
||||
if((pfcb->flagActive&(1<<id)) == 0)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid flag */
|
||||
}
|
||||
#endif
|
||||
|
||||
pfcb->flagRdy &= ~(1<<id); /* Clear the flag */
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Set a flag
|
||||
* @param[in] id Flag ID.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to set a flag.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoSetFlag(OS_FlagID id)
|
||||
{
|
||||
P_FLAG_NODE pnode;
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= FLAG_MAX_NUM) /* Flag is valid or not */
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid flag id */
|
||||
}
|
||||
if((pfcb->flagActive&(1<<id)) == 0)
|
||||
{
|
||||
return E_INVALID_ID; /* Flag is not exist */
|
||||
}
|
||||
#endif
|
||||
|
||||
if((pfcb->flagRdy&(1<<id)) != 0) /* Flag had already been set */
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
pfcb->flagRdy |= (1<<id); /* Update the flags ready list */
|
||||
|
||||
OsSchedLock();
|
||||
pnode = pfcb->headNode;
|
||||
while(pnode != Co_NULL)
|
||||
{
|
||||
if(pnode->waitType == OPT_WAIT_ALL) /* Extract all the bits we want */
|
||||
{
|
||||
if((pnode->waitFlags&pfcb->flagRdy) == pnode->waitFlags)
|
||||
{
|
||||
/* Remove the flag node from the wait list */
|
||||
pnode = RemoveFromLink(pnode);
|
||||
if((pfcb->resetOpt&(1<<id)) != 0)/* If the flags is auto-reset*/
|
||||
{
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else /* Extract only the bits we want */
|
||||
{
|
||||
if( (pnode->waitFlags & pfcb->flagRdy) != 0)
|
||||
{
|
||||
/* Remove the flag node from the wait list */
|
||||
pnode = RemoveFromLink(pnode);
|
||||
if((pfcb->resetOpt&(1<<id)) != 0)
|
||||
{
|
||||
break; /* The flags is auto-reset */
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
pnode = pnode->nextNode;
|
||||
}
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Set a flag in ISR
|
||||
* @param[in] id Flag ID.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in ISR to set a flag.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
StatusType isr_SetFlag(OS_FlagID id)
|
||||
{
|
||||
if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */
|
||||
{
|
||||
/* Insert the request into service request queue */
|
||||
if(InsertInSRQ(FLAG_REQ,id,Co_NULL) == Co_FALSE)
|
||||
{
|
||||
return E_SEV_REQ_FULL; /* The service requst queue is full */
|
||||
}
|
||||
else
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return(CoSetFlag(id)); /* The caller is not ISR, set the flag*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Block a task to wait a flag event
|
||||
* @param[in] pnode A node that will link into flag waiting list.
|
||||
* @param[in] flags Flag(s) that the node waiting for.
|
||||
* @param[in] waitType Waiting type of the node.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to block a task to wait a flag event.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
static void FlagBlock(P_FLAG_NODE pnode,U32 flags,U8 waitType)
|
||||
{
|
||||
P_FCB pfcb;
|
||||
pfcb = &FlagCrl;
|
||||
|
||||
TCBRunning->pnode = pnode;
|
||||
pnode->waitTask = TCBRunning;
|
||||
pnode->waitFlags = flags; /* Save the flags that we need to wait for*/
|
||||
pnode->waitType = waitType; /* Save the type of wait */
|
||||
|
||||
if(pfcb->tailNode == Co_NULL) /* If this is the first NODE to insert? */
|
||||
{
|
||||
pnode->nextNode = Co_NULL;
|
||||
pnode->prevNode = Co_NULL;
|
||||
pfcb->headNode = pnode; /* Insert the NODE to the head */
|
||||
}
|
||||
else /* If it is not the first NODE to insert? */
|
||||
{
|
||||
pfcb->tailNode->nextNode = pnode; /* Insert the NODE to the tail */
|
||||
pnode->prevNode = pfcb->tailNode;
|
||||
pnode->nextNode = Co_NULL;
|
||||
}
|
||||
pfcb->tailNode = pnode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Remove a flag node from list
|
||||
* @param[in] pnode A node that will remove from flag waiting list.
|
||||
* @param[out] None
|
||||
* @retval pnode Next node of the node that have removed out.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove a flag node from the wait list.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
static P_FLAG_NODE RemoveFromLink(P_FLAG_NODE pnode)
|
||||
{
|
||||
P_OSTCB ptcb;
|
||||
|
||||
RemoveLinkNode(pnode); /* Remove the flag node from wait list. */
|
||||
ptcb = pnode->waitTask;
|
||||
|
||||
/* The task in the delay list */
|
||||
if(ptcb->delayTick != INVALID_VALUE)/* If the task is in tick delay list */
|
||||
{
|
||||
RemoveDelayList(ptcb); /* Remove the task from tick delay list */
|
||||
}
|
||||
|
||||
ptcb->pnode = (void*)0xffffffff;
|
||||
|
||||
if(ptcb == TCBRunning)
|
||||
{
|
||||
ptcb->state = TASK_RUNNING;
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertToTCBRdyList(ptcb); /* Insert the task to ready list */
|
||||
}
|
||||
return (pnode->nextNode);
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Remove a flag node from list
|
||||
* @param[in] pnode A node that will remove from flag waiting list.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove a flag node from the wait list.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void RemoveLinkNode(P_FLAG_NODE pnode)
|
||||
{
|
||||
/* If only one NODE in the list*/
|
||||
if((pnode->nextNode == Co_NULL) && (pnode->prevNode == Co_NULL))
|
||||
{
|
||||
FlagCrl.headNode = Co_NULL;
|
||||
FlagCrl.tailNode = Co_NULL;
|
||||
}
|
||||
else if(pnode->nextNode == Co_NULL) /* If the NODE is tail */
|
||||
{
|
||||
FlagCrl.tailNode = pnode->prevNode;
|
||||
pnode->prevNode->nextNode = Co_NULL;
|
||||
}
|
||||
else if(pnode->prevNode == Co_NULL) /* If the NODE is head */
|
||||
{
|
||||
FlagCrl.headNode = pnode->nextNode;
|
||||
pnode->nextNode->prevNode = Co_NULL;
|
||||
}
|
||||
else /* The NODE is in the middle */
|
||||
{
|
||||
pnode->nextNode->prevNode = pnode->prevNode;
|
||||
pnode->prevNode->nextNode = pnode->nextNode;
|
||||
}
|
||||
pnode->waitTask->pnode = Co_NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,65 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file hook.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief hook management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Inlcude --------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief IDLE task of OS
|
||||
* @param[in] pdata The parameter passed to IDLE task.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is system IDLE task code.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoIdleTask(void* pdata)
|
||||
{
|
||||
/* Add your codes here */
|
||||
for(; ;)
|
||||
{
|
||||
/* Add your codes here */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Hook for stack overflow
|
||||
* @param[in] taskID Piont to the task which lead to stack overflow.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is a hook for stack overflow.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoStkOverflowHook(OS_TID taskID)
|
||||
{
|
||||
/* Process stack overflow here */
|
||||
for(; ;)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,409 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file kernelHeap.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief kernel heap management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
#if CFG_KHEAP_EN >0
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
U32 KernelHeap[KHEAP_SIZE] = {0}; /*!< Kernel heap */
|
||||
P_FMB FMBlist = Co_NULL; /*!< Free memory block list */
|
||||
KHeap Kheap = {0}; /*!< Kernel heap control */
|
||||
|
||||
|
||||
/*---------------------------- Function Declare ------------------------------*/
|
||||
static P_FMB GetPreFMB(P_UMB usedMB);
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create kernel heap
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create kernel heap.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoCreateKheap(void)
|
||||
{
|
||||
Kheap.startAddr = (U32)(KernelHeap); /* Initialize kernel heap control */
|
||||
Kheap.endAddr = (U32)(KernelHeap) + KHEAP_SIZE*4;
|
||||
FMBlist = (P_FMB)KernelHeap; /* Initialize free memory block list*/
|
||||
FMBlist->nextFMB = Co_NULL;
|
||||
FMBlist->nextUMB = Co_NULL;
|
||||
FMBlist->preUMB = Co_NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Allocation size bytes of memory block from kernel heap.
|
||||
* @param[in] size Length of menory block.
|
||||
* @param[out] None
|
||||
* @retval Co_NULL Allocate fail.
|
||||
* @retval others Pointer to memory block.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to allocation size bytes of memory block.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoKmalloc(U32 size)
|
||||
{
|
||||
P_FMB freeMB,newFMB,preFMB;
|
||||
P_UMB usedMB,tmpUMB;
|
||||
U8* memAddr;
|
||||
U32 freeSize;
|
||||
U32 kheapAddr;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if( size == 0 )
|
||||
{
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Word alignment,and add used memory head size */
|
||||
size = (((size+3)>>2)<<2) + 8;
|
||||
kheapAddr = Kheap.endAddr; /* Get the end address of kernel heap */
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
freeMB = FMBlist; /* Get first item of free memory list */
|
||||
preFMB = Co_NULL;
|
||||
while(freeMB != Co_NULL ) /* Is out of free memory list? */
|
||||
{ /* No */
|
||||
if(freeMB->nextUMB == Co_NULL) /* Is last item of free memory list? */
|
||||
{ /* Yes,get size for this free item */
|
||||
freeSize = kheapAddr - (U32)(freeMB);
|
||||
}
|
||||
else /* No,get size for this free item */
|
||||
{
|
||||
freeSize = (U32)(freeMB->nextUMB) -1 - (U32)(freeMB);
|
||||
}
|
||||
if(freeSize >= size) /* If the size equal or greater than need */
|
||||
{ /* Yes,assign in this free memory */
|
||||
usedMB=(P_UMB)freeMB;/* Get the address for used memory block head*/
|
||||
|
||||
/* Get the address for used memory block */
|
||||
memAddr = (U8*)((U32)(usedMB) + 8);
|
||||
|
||||
/* Is left size of free memory smaller than 12? */
|
||||
if((freeSize-size) < 12)
|
||||
{
|
||||
/* Yes,malloc together(12 is the size of the header information
|
||||
of free memory block ). */
|
||||
if(preFMB != Co_NULL)/* Is first item of free memory block list? */
|
||||
{ /* No,set the link for list */
|
||||
preFMB->nextFMB = freeMB->nextFMB;
|
||||
}
|
||||
else /* Yes,reset the first item */
|
||||
{
|
||||
FMBlist = freeMB->nextFMB;
|
||||
}
|
||||
|
||||
if(freeMB->nextUMB != Co_NULL) /* Is last item? */
|
||||
{ /* No,set the link for list */
|
||||
tmpUMB = (P_UMB)((U32)(freeMB->nextUMB)-1);
|
||||
tmpUMB->preMB = (void*)((U32)usedMB|0x1);
|
||||
}
|
||||
|
||||
usedMB->nextMB = freeMB->nextUMB;/* Set used memory block link*/
|
||||
usedMB->preMB = freeMB->preUMB;
|
||||
}
|
||||
else /* No,the left size more than 12 */
|
||||
{
|
||||
/* Get new free memory block address */
|
||||
newFMB = (P_FMB)((U32)(freeMB) + size);
|
||||
|
||||
if(preFMB != Co_NULL)/* Is first item of free memory block list? */
|
||||
{
|
||||
preFMB->nextFMB = newFMB; /* No,set the link for list */
|
||||
}
|
||||
else
|
||||
{
|
||||
FMBlist = newFMB; /* Yes,reset the first item */
|
||||
}
|
||||
|
||||
/* Set link for new free memory block */
|
||||
newFMB->preUMB = (P_UMB)((U32)usedMB|0x1);
|
||||
newFMB->nextUMB = freeMB->nextUMB;
|
||||
newFMB->nextFMB = freeMB->nextFMB;
|
||||
|
||||
if(freeMB->nextUMB != Co_NULL) /* Is last item? */
|
||||
{ /* No,set the link for list */
|
||||
tmpUMB = (P_UMB)((U32)(freeMB->nextUMB)-1);
|
||||
tmpUMB->preMB = newFMB;
|
||||
}
|
||||
|
||||
usedMB->nextMB = newFMB; /* Set used memory block link */
|
||||
usedMB->preMB = freeMB->preUMB;
|
||||
}
|
||||
|
||||
if(freeMB->preUMB != Co_NULL) /* Is first item? */
|
||||
{ /* No,set the link for list */
|
||||
tmpUMB = (P_UMB)((U32)(freeMB->preUMB)-1);
|
||||
tmpUMB->nextMB = (void*)((U32)usedMB|0x1);
|
||||
}
|
||||
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return memAddr; /* Return used memory block address */
|
||||
}
|
||||
preFMB = freeMB; /* Save current free memory block as previous */
|
||||
freeMB = freeMB->nextFMB; /* Get the next item as current item*/
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return Co_NULL; /* Error return */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Release memory block to kernel heap.
|
||||
* @param[in] memBuf Pointer to memory block.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to release memory block.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void CoKfree(void* memBuf)
|
||||
{
|
||||
P_FMB curFMB,nextFMB,preFMB;
|
||||
P_UMB usedMB,nextUMB,preUMB;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(memBuf == Co_NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
usedMB = (P_UMB)((U32)(memBuf)-8);
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if((U32)(memBuf) < Kheap.startAddr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if((U32)(memBuf) > Kheap.endAddr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check UMB in list */
|
||||
if((U32)(usedMB) < (U32)(FMBlist))
|
||||
{
|
||||
preUMB = (P_UMB)((U32)(FMBlist->preUMB)-1);
|
||||
while(preUMB != usedMB)
|
||||
{
|
||||
if(preUMB == Co_NULL)
|
||||
{
|
||||
OsSchedUnlock();
|
||||
return;
|
||||
}
|
||||
preUMB = (P_UMB)((U32)(preUMB->preMB)-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(FMBlist == Co_NULL)
|
||||
{
|
||||
nextUMB = (P_UMB)(Kheap.startAddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(FMBlist->nextUMB != Co_NULL)
|
||||
{
|
||||
nextUMB = (P_UMB)((U32)(FMBlist->nextUMB)-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextUMB = Co_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
while(nextUMB != usedMB)
|
||||
{
|
||||
if(nextUMB == Co_NULL)
|
||||
{
|
||||
OsSchedUnlock();
|
||||
return;
|
||||
}
|
||||
if(((U32)(nextUMB->nextMB)&0x1) == 0)
|
||||
{
|
||||
nextFMB = (P_FMB)(nextUMB->nextMB);
|
||||
nextUMB = (P_UMB)((U32)(nextFMB->nextUMB)-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
nextUMB = (P_UMB)((U32)(nextUMB->nextMB)-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Is between two free memory block? */
|
||||
if( (((U32)(usedMB->nextMB)&0x1) == 0) && (((U32)(usedMB->preMB)&0x1)==0) )
|
||||
{ /* Yes,is the only one item in kernel heap? */
|
||||
if((usedMB->nextMB == Co_NULL) && (usedMB->preMB == Co_NULL))
|
||||
{
|
||||
curFMB = (P_FMB)usedMB; /* Yes,release this item */
|
||||
curFMB->nextFMB = Co_NULL;
|
||||
curFMB->nextUMB = Co_NULL;
|
||||
curFMB->preUMB = Co_NULL;
|
||||
FMBlist = curFMB;
|
||||
}
|
||||
else if(usedMB->preMB == Co_NULL) /* Is the first item in kernel heap */
|
||||
{
|
||||
/* Yes,release this item,and set link for list */
|
||||
curFMB = (P_FMB)usedMB;
|
||||
nextFMB = (P_FMB)usedMB->nextMB;
|
||||
|
||||
curFMB->nextFMB = nextFMB->nextFMB;
|
||||
curFMB->nextUMB = nextFMB->nextUMB;
|
||||
curFMB->preUMB = Co_NULL;
|
||||
FMBlist = curFMB;
|
||||
}
|
||||
else if(usedMB->nextMB == Co_NULL) /* Is the last item in kernel heap */
|
||||
{ /* Yes,release this item,and set link for list */
|
||||
curFMB = (P_FMB)(usedMB->preMB);
|
||||
curFMB->nextFMB = Co_NULL;
|
||||
curFMB->nextUMB = Co_NULL;
|
||||
}
|
||||
else /* All no,show this item between two normal FMB */
|
||||
{
|
||||
/* release this item,and set link for list */
|
||||
nextFMB = (P_FMB)usedMB->nextMB;
|
||||
curFMB = (P_FMB)(usedMB->preMB);
|
||||
|
||||
curFMB->nextFMB = nextFMB->nextFMB;
|
||||
curFMB->nextUMB = nextFMB->nextUMB;
|
||||
}
|
||||
}
|
||||
else if(((U32)(usedMB->preMB)&0x1) == 0) /* Is between FMB and UMB? */
|
||||
{
|
||||
if(usedMB->preMB == Co_NULL) /* Yes,is the first item in kernel heap? */
|
||||
{
|
||||
/* Yes,release this item,and set link for list */
|
||||
curFMB = (P_FMB)usedMB;
|
||||
nextUMB = (P_UMB)usedMB->nextMB;
|
||||
curFMB->nextUMB = nextUMB;
|
||||
curFMB->preUMB = Co_NULL;
|
||||
curFMB->nextFMB = FMBlist;
|
||||
FMBlist = curFMB;
|
||||
}
|
||||
else /* No,release this item,and set link for list */
|
||||
{
|
||||
curFMB = (P_FMB)usedMB->preMB;
|
||||
nextUMB = (P_UMB)usedMB->nextMB;
|
||||
curFMB->nextUMB = nextUMB;
|
||||
}
|
||||
|
||||
}
|
||||
else if(((U32)(usedMB->nextMB)&0x1) == 0) /* Is between UMB and FMB? */
|
||||
{ /* Yes */
|
||||
preUMB = (P_UMB)(usedMB->preMB); /* Get previous UMB */
|
||||
curFMB = (P_FMB)(usedMB); /* new FMB */
|
||||
preFMB = GetPreFMB(usedMB); /* Get previous FMB */
|
||||
if(preFMB == Co_NULL) /* Is previous FMB==Co_NULL? */
|
||||
{
|
||||
nextFMB = FMBlist; /* Yes,get next FMB */
|
||||
FMBlist = curFMB; /* Reset new FMB as the first item of FMB list*/
|
||||
}
|
||||
else
|
||||
{
|
||||
nextFMB = preFMB->nextFMB; /* No,get next FMB */
|
||||
preFMB->nextFMB = curFMB; /* Set link for FMB list */
|
||||
}
|
||||
|
||||
if(nextFMB == Co_NULL) /* Is new FMB as last item of FMB list? */
|
||||
{
|
||||
curFMB->preUMB = preUMB; /* Yes,set link for list */
|
||||
curFMB->nextUMB = Co_NULL;
|
||||
curFMB->nextFMB = Co_NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
curFMB->preUMB = preUMB; /* No,set link for list */
|
||||
curFMB->nextUMB = nextFMB->nextUMB;
|
||||
curFMB->nextFMB = nextFMB->nextFMB;
|
||||
}
|
||||
}
|
||||
else /* All no,show UMB between two UMB*/
|
||||
{
|
||||
curFMB = (P_FMB)(usedMB); /* new FMB */
|
||||
preFMB = GetPreFMB(usedMB); /* Get previous FMB */
|
||||
preUMB = (P_UMB)(usedMB->preMB); /* Get previous UMB */
|
||||
nextUMB = (P_UMB)(usedMB->nextMB); /* Get next UMB */
|
||||
|
||||
if(preFMB == Co_NULL ) /* Is previous FMB==Co_NULL? */
|
||||
{
|
||||
nextFMB = FMBlist; /* Yes,get next FMB */
|
||||
FMBlist = curFMB; /* Reset new FMB as the first item of FMB list */
|
||||
}
|
||||
else
|
||||
{
|
||||
nextFMB = preFMB->nextFMB; /* No,get next FMB */
|
||||
preFMB->nextFMB = curFMB; /* Set link for FMB list */
|
||||
}
|
||||
|
||||
curFMB->preUMB = preUMB; /* Set current FMB link for list */
|
||||
curFMB->nextUMB = nextUMB;
|
||||
curFMB->nextFMB = nextFMB;
|
||||
}
|
||||
|
||||
if(curFMB->preUMB != Co_NULL)/* Is current FMB as first item in kernel heap? */
|
||||
{ /* No,set link for list */
|
||||
preUMB = (P_UMB)((U32)(curFMB->preUMB)-1);
|
||||
preUMB->nextMB = (void*)curFMB;
|
||||
}
|
||||
if(curFMB->nextUMB != Co_NULL)/* Is current FMB as last item in kernel heap? */
|
||||
{ /* No,set link for list */
|
||||
nextUMB = (P_UMB)((U32)(curFMB->nextUMB)-1);
|
||||
nextUMB->preMB = (void*)curFMB;
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get previous free memory block pointer.
|
||||
* @param[in] usedMB Current used memory block.
|
||||
* @param[out] None
|
||||
* @retval Previous free memory block pointer.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to get previous free memory block pointer.
|
||||
*******************************************************************************
|
||||
*/
|
||||
static P_FMB GetPreFMB(P_UMB usedMB)
|
||||
{
|
||||
P_UMB preUMB;
|
||||
preUMB = usedMB;
|
||||
while(((U32)(preUMB->preMB)&0x1)) /* Is previous MB as FMB? */
|
||||
{ /* No,get previous MB */
|
||||
preUMB = (P_UMB)((U32)(preUMB->preMB)-1);
|
||||
}
|
||||
return (P_FMB)(preUMB->preMB); /* Yes,return previous MB */
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,325 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file mbox.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Mailbox management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
#if CFG_MAILBOX_EN > 0
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a mailbox
|
||||
* @param[in] sortType Mail box waiting list sort type.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create mailbox fail.
|
||||
* @retval others Create mailbox successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a mailbox.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_EventID CoCreateMbox(U8 sortType)
|
||||
{
|
||||
P_ECB pecb;
|
||||
|
||||
/* Create a mailbox type event control block */
|
||||
pecb = CreatEvent(EVENT_TYPE_MBOX,sortType,Co_NULL);
|
||||
if(pecb == Co_NULL) /* If failed to create event block */
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
pecb->eventCounter = 0;
|
||||
return (pecb->id); /* Create a mailbox successfully, return event ID */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a mailbox
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] opt Delete option.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_INVALID_PARAMETER Invalid parameter.
|
||||
* @retval E_TASK_WAITTING Tasks waitting for the event,delete fail.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a mailbox.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelMbox(OS_EventID id,U8 opt)
|
||||
{
|
||||
P_ECB pecb;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT) /* Judge id is valid or not? */
|
||||
{
|
||||
return E_INVALID_ID; /* Id is invalid ,return error */
|
||||
}
|
||||
#endif
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_MBOX)/* Validate event control block type*/
|
||||
{
|
||||
return E_INVALID_ID; /* The event is not mailbox */
|
||||
}
|
||||
#endif
|
||||
return (DeleteEvent(pecb,opt)); /* Delete the mailbox event control block */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Accept a mailbox
|
||||
* @param[in] id Event ID.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval Co_NULL
|
||||
* @retval A pointer to mailbox accepted.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to accept a mailbox.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoAcceptMail(OS_EventID id,StatusType* perr)
|
||||
{
|
||||
P_ECB pecb;
|
||||
void* pmail;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid 'id' */
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
pecb = &EventTbl[id];
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_MBOX)/* Invalid event control block type */
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock();
|
||||
if(pecb->eventCounter == 1) /* If there is already a message */
|
||||
{
|
||||
*perr = E_OK;
|
||||
pmail = pecb->eventPtr; /* Get the message */
|
||||
pecb->eventPtr = Co_NULL; /* Clear the mailbox */
|
||||
pecb->eventCounter = 0;
|
||||
OsSchedUnlock();
|
||||
return pmail; /* Return the message received */
|
||||
}
|
||||
else /* If the mailbox is empty */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
*perr = E_MBOX_EMPTY; /* Mailbox is empty,return Co_NULL */
|
||||
return Co_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Wait for a mailbox
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] timeout The longest time for writting mail.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval Co_NULL
|
||||
* @retval A pointer to mailbox accept.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to wait a mailbox.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoPendMail(OS_EventID id,U32 timeout,StatusType* perr)
|
||||
{
|
||||
P_ECB pecb;
|
||||
void* pmail;
|
||||
P_OSTCB curTCB;
|
||||
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
*perr = E_CALL;
|
||||
return Co_NULL;
|
||||
}
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid 'id',retrun error */
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_MBOX)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid event type,not EVENT_TYPE_MBOX */
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(OSSchedLock != 0) /* Judge schedule is locked or not? */
|
||||
{
|
||||
*perr = E_OS_IN_LOCK; /* Schedule is locked */
|
||||
return Co_NULL; /* return Co_NULL */
|
||||
}
|
||||
OsSchedLock();
|
||||
if( pecb->eventCounter == 1) /* If there is already a message */
|
||||
{
|
||||
*perr = E_OK;
|
||||
pmail = pecb->eventPtr; /* Get the message */
|
||||
pecb->eventPtr = Co_NULL; /* Clear the mailbox */
|
||||
pecb->eventCounter = 0;
|
||||
OsSchedUnlock();
|
||||
return pmail; /* Return the message received */
|
||||
}
|
||||
else /* If message is not available, task will pend */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
curTCB = TCBRunning;
|
||||
if(timeout == 0) /* If time-out is not configured */
|
||||
{
|
||||
EventTaskToWait(pecb,curTCB); /* Block task until event occurs */
|
||||
*perr = E_OK;
|
||||
|
||||
/* Have recived a message or the mailbox have been deleted */
|
||||
pmail = curTCB->pmail;
|
||||
curTCB->pmail = Co_NULL;
|
||||
return pmail; /* Return received message or Co_NULL */
|
||||
}
|
||||
else /* If time-out is configured */
|
||||
{
|
||||
OsSchedLock();
|
||||
|
||||
/* Block task until event or timeout occurs */
|
||||
EventTaskToWait(pecb,curTCB);
|
||||
InsertDelayList(curTCB,timeout);
|
||||
OsSchedUnlock();
|
||||
if( curTCB->pmail == Co_NULL) /* Time-out occurred */
|
||||
{
|
||||
*perr = E_TIMEOUT;
|
||||
return Co_NULL;
|
||||
}
|
||||
else /* Have recived a message or the mailbox have been deleted*/
|
||||
{
|
||||
*perr = E_OK;
|
||||
pmail = curTCB->pmail;
|
||||
curTCB->pmail = Co_NULL;
|
||||
return pmail; /* Return received message or Co_NULL */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a mailbox
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] pmail Pointer to mail that want to send.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID
|
||||
* @retval E_OK
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to post a mail.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoPostMail(OS_EventID id,void* pmail)
|
||||
{
|
||||
P_ECB pecb;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid id,return error */
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_MBOX)/* Validate event control block type*/
|
||||
{
|
||||
return E_INVALID_ID; /* Event is not mailbox,return error*/
|
||||
}
|
||||
#endif
|
||||
|
||||
if(pecb->eventCounter == 0) /* If mailbox doesn't already have a message*/
|
||||
{
|
||||
OsSchedLock();
|
||||
pecb->eventPtr = pmail; /* Place message in mailbox */
|
||||
pecb->eventCounter = 1;
|
||||
EventTaskToRdy(pecb); /* Check waiting list */
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
else /* If there is already a message in mailbox */
|
||||
{
|
||||
return E_MBOX_FULL; /* Mailbox is full,and return "E_MBOX_FULL" */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a mailbox in ISR
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] pmail Pointer to mail that want to send.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID
|
||||
* @retval E_OK
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to post a mail in ISR.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
StatusType isr_PostMail(OS_EventID id,void* pmail)
|
||||
{
|
||||
if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */
|
||||
{
|
||||
/* Insert the request into service request queue */
|
||||
if(InsertInSRQ(MBOX_REQ,id,pmail) == Co_FALSE)
|
||||
{
|
||||
return E_SEV_REQ_FULL; /* If service request queue is full */
|
||||
}
|
||||
else /* Operate successfully */
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return(CoPostMail(id,pmail)); /* Sends the message to the mailbox */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file mm.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief memory management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
#if CFG_MM_EN > 0
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
MM MemoryTbl[CFG_MAX_MM] = {{0}};/*!< Table which save memory control block. */
|
||||
U32 MemoryIDVessel = 0; /*!< Memory ID container. */
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a memory partition
|
||||
* @param[in] memBuf Specify memory partition head address.
|
||||
* @param[in] blockSize Specify memory block size.
|
||||
* @param[in] blockNum Specify memory block number.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create memory partition fail.
|
||||
* @retval others Create memory partition successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a memory partition.
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_MMID CoCreateMemPartition(U8* memBuf,U32 blockSize,U32 blockNum)
|
||||
{
|
||||
U8 i,j;
|
||||
U8 *memory;
|
||||
P_MemBlk memBlk;
|
||||
memory = memBuf;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(memBuf == Co_NULL)
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
if(blockSize == 0)
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
if((blockSize&0x3) != 0)
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
if(blockNum<=1)
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
for(i = 0; i < CFG_MAX_MM; i++)
|
||||
{
|
||||
if((MemoryIDVessel & (1 << i)) == 0) /* Is free memory ID? */
|
||||
{
|
||||
MemoryIDVessel |= (1<<i); /* Yes,assign ID to this memory block */
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
MemoryTbl[i].memAddr = memory;/* Initialize memory control block*/
|
||||
MemoryTbl[i].freeBlock = memory;
|
||||
MemoryTbl[i].blockSize = blockSize;
|
||||
MemoryTbl[i].blockNum = blockNum;
|
||||
memBlk = (P_MemBlk)memory; /* Bulid list in this memory block*/
|
||||
for(j=0;j<blockNum-1;j++)
|
||||
{
|
||||
memory = memory+blockSize;
|
||||
memBlk->nextBlock = (P_MemBlk)memory;
|
||||
memBlk = memBlk->nextBlock;
|
||||
}
|
||||
memBlk->nextBlock = Co_NULL;
|
||||
return i; /* Return memory block ID */
|
||||
}
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return E_CREATE_FAIL; /* Error return */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a memory partition
|
||||
* @param[in] mmID Specify memory partition that want to delete.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The memory partition id passed was invalid,delete fail.
|
||||
* @retval E_OK Delete successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Delete a memory partition.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelMemoryPartition(OS_MMID mmID)
|
||||
{
|
||||
P_MM memCtl;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(mmID >= CFG_MAX_MM)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if( ((1<<mmID)&MemoryIDVessel) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
memCtl = &MemoryTbl[mmID]; /* Release memory control block */
|
||||
MemoryIDVessel &= ~(1<<mmID);
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
|
||||
memCtl->memAddr = Co_NULL;
|
||||
memCtl->freeBlock = Co_NULL;
|
||||
memCtl->blockSize = 0;
|
||||
memCtl->blockNum = 0;
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get free block number in a memory partition
|
||||
* @param[in] mmID Specify memory partition.
|
||||
*
|
||||
* @param[out] E_INVALID_ID Invalid ID was passed and get counter failure.
|
||||
* @param[out] E_OK Get current counter successful.
|
||||
* @retval fbNum The number of free block.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to get free block number in a memory
|
||||
* partition.
|
||||
*******************************************************************************
|
||||
*/
|
||||
U32 CoGetFreeBlockNum(OS_MMID mmID,StatusType* perr)
|
||||
{
|
||||
U32 fbNum;
|
||||
P_MM memCtl;
|
||||
P_MemBlk memBlk;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(mmID >= CFG_MAX_MM)
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return 0;
|
||||
}
|
||||
if( ((1<<mmID)&MemoryIDVessel) == 0)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid memory id,return 0 */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
memCtl = &MemoryTbl[mmID];
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
memBlk = (P_MemBlk)(memCtl->freeBlock);/* Get the free item in memory list*/
|
||||
fbNum = 0;
|
||||
while(memBlk != Co_NULL) /* Get counter of free item */
|
||||
{
|
||||
fbNum++;
|
||||
memBlk = memBlk->nextBlock; /* Get next free iterm */
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedul */
|
||||
*perr = E_OK;
|
||||
return fbNum; /* Return the counter of free item */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get a memory buffer from memory partition
|
||||
* @param[in] mmID Specify memory partition that want to assign buffer.
|
||||
* @param[out] None
|
||||
* @retval Co_NULL Assign buffer fail.
|
||||
* @retval others Assign buffer successful,and return the buffer pointer.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Delete a memory partition.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoGetMemoryBuffer(OS_MMID mmID)
|
||||
{
|
||||
P_MM memCtl;
|
||||
P_MemBlk memBlk;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(mmID >= CFG_MAX_MM)
|
||||
{
|
||||
return Co_NULL;
|
||||
}
|
||||
if( ((1<<mmID)&MemoryIDVessel) == 0)
|
||||
{
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
memCtl = &MemoryTbl[mmID];
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
if(memCtl->freeBlock == Co_NULL ) /* Is there no free item in memory list */
|
||||
{
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return Co_NULL; /* Yes,error return */
|
||||
}
|
||||
memBlk = (P_MemBlk)memCtl->freeBlock; /* Get free memory block */
|
||||
memCtl->freeBlock = (U8*)memBlk->nextBlock; /* Reset the first free item */
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return memBlk; /* Return free memory block address */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Free a memory buffer to memory partition
|
||||
* @param[in] mmID Specify memory partition.
|
||||
* @param[in] buf Specify memory buffer that want to free.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The memory partition id passed was invalid.
|
||||
* @retval E_INVALID_PARAMETER The parameter passed was invalid.
|
||||
* @retval E_OK Free successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Delete a memory partition.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoFreeMemoryBuffer(OS_MMID mmID,void* buf)
|
||||
{
|
||||
P_MM memCtl;
|
||||
P_MemBlk memBlk;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(mmID >= CFG_MAX_MM)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if( ((1<<mmID)&MemoryIDVessel) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if(buf == Co_NULL)
|
||||
{
|
||||
return E_INVALID_PARAMETER;
|
||||
}
|
||||
#endif
|
||||
|
||||
memCtl = &MemoryTbl[mmID];
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if((U32)buf < (U32)(memCtl->memAddr))
|
||||
{
|
||||
return E_INVALID_PARAMETER;
|
||||
}
|
||||
if((U32)buf > (U32)(memCtl->memAddr + memCtl->blockSize*memCtl->blockNum))
|
||||
{
|
||||
return E_INVALID_PARAMETER;
|
||||
}
|
||||
if(((U32)buf - (U32)(memCtl->memAddr))%(memCtl->blockSize) != 0)
|
||||
{
|
||||
return E_INVALID_PARAMETER;
|
||||
}
|
||||
#endif
|
||||
memBlk = (P_MemBlk)buf; /* Reset the first free item */
|
||||
OsSchedLock();
|
||||
memBlk->nextBlock = (P_MemBlk)memCtl->freeBlock;
|
||||
memCtl->freeBlock = buf;
|
||||
OsSchedUnlock();
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file mutex.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Mutex management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
#if CFG_MUTEX_EN > 0
|
||||
|
||||
OS_MutexID MutexFreeID = 0; /*!< Point to next vliad mutex ID. */
|
||||
MUTEX MutexTbl[CFG_MAX_MUTEX] = {{0}}; /*!< Mutex struct array */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a mutex
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create mutex fail.
|
||||
* @retval others Create mutex successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a mutex.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_MutexID CoCreateMutex(void)
|
||||
{
|
||||
OS_MutexID id;
|
||||
P_MUTEX pMutex;
|
||||
OsSchedLock();
|
||||
|
||||
/* Assign a free mutex control block */
|
||||
if(MutexFreeID < CFG_MAX_MUTEX )
|
||||
{
|
||||
id = MutexFreeID++;
|
||||
OsSchedUnlock();
|
||||
pMutex = &MutexTbl[id];
|
||||
pMutex->hipriTaskID = INVALID_ID;
|
||||
pMutex->originalPrio = 0xff;
|
||||
pMutex->mutexFlag = MUTEX_FREE; /* Mutex is free,not was occupied */
|
||||
pMutex->taskID = INVALID_ID;
|
||||
pMutex->waittingList = Co_NULL;
|
||||
return id; /* Return mutex ID */
|
||||
}
|
||||
|
||||
OsSchedUnlock();
|
||||
return E_CREATE_FAIL; /* No free mutex control block */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Enter a critical area
|
||||
* @param[in] mutexID Specify mutex.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid mutex id.
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_OK Enter critical area successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called when entering a critical area.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoEnterMutexSection(OS_MutexID mutexID)
|
||||
{
|
||||
P_OSTCB ptcb,pCurTcb;
|
||||
P_MUTEX pMutex;
|
||||
|
||||
#if CFG_EVENT_EN >0
|
||||
P_ECB pecb;
|
||||
#endif
|
||||
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
if(OSSchedLock != 0) /* Is OS lock? */
|
||||
{
|
||||
return E_OS_IN_LOCK; /* Yes,error return */
|
||||
}
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(mutexID >= MutexFreeID) /* Invalid 'mutexID' */
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
OsSchedLock();
|
||||
pCurTcb = TCBRunning;
|
||||
pMutex = &MutexTbl[mutexID];
|
||||
|
||||
pCurTcb->mutexID = mutexID;
|
||||
if(pMutex->mutexFlag == MUTEX_FREE) /* If mutex is available */
|
||||
{
|
||||
pMutex->originalPrio = pCurTcb->prio; /* Save priority of owning task */
|
||||
pMutex->taskID = pCurTcb->taskID; /* Acquire the resource */
|
||||
pMutex->hipriTaskID = pCurTcb->taskID;
|
||||
pMutex->mutexFlag = MUTEX_OCCUPY; /* Occupy the mutex resource*/
|
||||
}
|
||||
/* If the mutex resource had been occupied */
|
||||
else if(pMutex->mutexFlag == MUTEX_OCCUPY)
|
||||
{
|
||||
ptcb = &TCBTbl[pMutex->taskID];
|
||||
if(ptcb->prio > pCurTcb->prio) /* Need to promote priority of owner? */
|
||||
{
|
||||
#if CFG_ORDER_LIST_SCHEDULE_EN ==0
|
||||
DeleteTaskPri(ptcb->prio);
|
||||
ActiveTaskPri(pCurTcb->prio);
|
||||
#endif
|
||||
ptcb->prio = pCurTcb->prio; /* Promote prio of owner */
|
||||
|
||||
/* Upgarde the highest priority about the mutex */
|
||||
pMutex->hipriTaskID = pCurTcb->taskID;
|
||||
if(ptcb->state == TASK_READY) /* If the task is ready to run */
|
||||
{
|
||||
RemoveFromTCBRdyList(ptcb); /* Remove the task from READY list*/
|
||||
InsertToTCBRdyList(ptcb); /* Insert the task into READY list*/
|
||||
}
|
||||
#if CFG_EVENT_EN >0
|
||||
/* If the task is waiting on a event */
|
||||
else if(ptcb->eventID != INVALID_ID)
|
||||
{
|
||||
pecb = &EventTbl[ptcb->eventID];
|
||||
|
||||
/* If the event waiting type is preemptive Priority */
|
||||
if(pecb->eventSortType == EVENT_SORT_TYPE_PRIO)
|
||||
{
|
||||
/* Remove the task from event waiting list */
|
||||
RemoveEventWaittingList(ptcb);
|
||||
|
||||
/* Insert the task into event waiting list */
|
||||
EventTaskToWait(pecb,ptcb);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
pCurTcb->state = TASK_WAITING; /* Block current task */
|
||||
TaskSchedReq = Co_TRUE;
|
||||
pCurTcb->TCBnext = Co_NULL;
|
||||
pCurTcb->TCBprev = Co_NULL;
|
||||
|
||||
ptcb = pMutex->waittingList;
|
||||
if(ptcb == Co_NULL) /* If the event waiting list is empty */
|
||||
{
|
||||
pMutex->waittingList = pCurTcb; /* Insert the task to head */
|
||||
}
|
||||
else /* If the event waiting list is not empty */
|
||||
{
|
||||
while(ptcb->TCBnext != Co_NULL) /* Insert the task to tail */
|
||||
{
|
||||
ptcb = ptcb->TCBnext;
|
||||
}
|
||||
ptcb->TCBnext = pCurTcb;
|
||||
pCurTcb->TCBprev = ptcb;
|
||||
pCurTcb->TCBnext = Co_NULL;
|
||||
}
|
||||
}
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Leave from a critical area
|
||||
* @param[in] mutexID Specify mutex id.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid mutex id.
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_OK Exit a critical area successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function must be called when exiting from a critical area.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoLeaveMutexSection(OS_MutexID mutexID)
|
||||
{
|
||||
P_OSTCB ptcb;
|
||||
P_MUTEX pMutex;
|
||||
U8 prio;
|
||||
U8 taskID;
|
||||
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(mutexID >= MutexFreeID)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid mutex id, return error */
|
||||
}
|
||||
#endif
|
||||
OsSchedLock();
|
||||
pMutex = &MutexTbl[mutexID]; /* Obtain point of mutex control block*/
|
||||
ptcb = &TCBTbl[pMutex->taskID];
|
||||
ptcb->mutexID = INVALID_ID;
|
||||
if(pMutex->waittingList == Co_NULL) /* If the mutex waiting list is empty */
|
||||
{
|
||||
pMutex->mutexFlag = MUTEX_FREE; /* The mutex resource is available */
|
||||
pMutex->taskID = INVALID_ID;
|
||||
OsSchedUnlock();
|
||||
}
|
||||
else /* If there is at least one task waitting for the mutex */
|
||||
{
|
||||
taskID = pMutex->taskID; /* Get task ID of mutex owner */
|
||||
|
||||
/* we havn't promoted current task's priority */
|
||||
if(pMutex->hipriTaskID == taskID)
|
||||
{
|
||||
ptcb = pMutex->waittingList;/* Point to mutex first waiting task */
|
||||
prio = ptcb->prio;
|
||||
while(ptcb != Co_NULL) /* Find the highest priority task */
|
||||
{
|
||||
if(ptcb->prio < prio)
|
||||
{
|
||||
prio = ptcb->prio;
|
||||
pMutex->hipriTaskID = ptcb->taskID;
|
||||
}
|
||||
ptcb = ptcb->TCBnext;
|
||||
}
|
||||
}
|
||||
else /* we have promoted current task's priority */
|
||||
{
|
||||
prio = TCBTbl[taskID].prio;
|
||||
}
|
||||
|
||||
/* Reset the task priority */
|
||||
pMutex->taskID = INVALID_ID;
|
||||
CoSetPriority(taskID,pMutex->originalPrio);
|
||||
|
||||
/* Find first task in waiting list ready to run */
|
||||
ptcb = pMutex->waittingList;
|
||||
pMutex->waittingList = ptcb->TCBnext;
|
||||
pMutex->originalPrio = ptcb->prio;
|
||||
pMutex->taskID = ptcb->taskID;
|
||||
|
||||
#if CFG_ORDER_LIST_SCHEDULE_EN ==0
|
||||
if(prio != ptcb->prio)
|
||||
{
|
||||
DeleteTaskPri(ptcb->prio);
|
||||
ActiveTaskPri(prio);
|
||||
}
|
||||
#endif
|
||||
|
||||
ptcb->prio = prio; /* Raise the task's priority */
|
||||
|
||||
/* Insert the task which acquire the mutex into ready list. */
|
||||
ptcb->TCBnext = Co_NULL;
|
||||
ptcb->TCBprev = Co_NULL;
|
||||
|
||||
InsertToTCBRdyList(ptcb); /* Insert the task into the READY list */
|
||||
OsSchedUnlock();
|
||||
}
|
||||
return E_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Remove a task from mutex waiting list
|
||||
* @param[in] ptcb TCB which will remove out.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function be called when delete a task.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void RemoveMutexList(P_OSTCB ptcb)
|
||||
{
|
||||
U8 prio;
|
||||
OS_TID taskID;
|
||||
P_MUTEX pMutex;
|
||||
pMutex = &MutexTbl[ptcb->mutexID];
|
||||
|
||||
/* If only one task waiting on mutex */
|
||||
if((ptcb->TCBnext ==Co_NULL) && (ptcb->TCBprev == Co_NULL))
|
||||
{
|
||||
pMutex->waittingList = Co_NULL; /* Waiting list is empty */
|
||||
}
|
||||
else if(ptcb->TCBnext == Co_NULL) /* If the task is the last of waiting list*/
|
||||
{
|
||||
/* Remove task from mutex waiting list */
|
||||
ptcb->TCBprev->TCBnext = Co_NULL;
|
||||
ptcb->TCBprev = Co_NULL;
|
||||
}
|
||||
else if(ptcb->TCBprev == Co_NULL)/* If the task is the first of waiting list*/
|
||||
{
|
||||
/* Remove task from waiting list */
|
||||
ptcb->TCBnext->TCBprev = Co_NULL;
|
||||
ptcb->TCBnext = Co_NULL;
|
||||
}
|
||||
else /* If the task is in the middle of waiting list */
|
||||
{
|
||||
/* Remove task from wait list */
|
||||
ptcb->TCBnext->TCBprev = ptcb->TCBprev;
|
||||
ptcb->TCBprev->TCBnext = ptcb->TCBnext;
|
||||
ptcb->TCBprev = Co_NULL;
|
||||
ptcb->TCBnext = Co_NULL;
|
||||
}
|
||||
|
||||
ptcb->mutexID = INVALID_ID;
|
||||
|
||||
/* If the task have highest priority in mutex waiting list */
|
||||
if(pMutex->hipriTaskID == ptcb->taskID)
|
||||
{
|
||||
ptcb = pMutex->waittingList;
|
||||
prio = pMutex->originalPrio;
|
||||
pMutex->hipriTaskID = pMutex->taskID;
|
||||
while(ptcb != Co_NULL) /* Find task ID of highest priority task*/
|
||||
{
|
||||
if(ptcb->prio < prio)
|
||||
{
|
||||
prio = ptcb->prio;
|
||||
pMutex->hipriTaskID = ptcb->taskID;
|
||||
}
|
||||
ptcb = ptcb->TCBnext;
|
||||
}
|
||||
taskID = pMutex->taskID;
|
||||
pMutex->taskID = INVALID_ID;
|
||||
CoSetPriority(taskID,prio); /* Reset the mutex ower priority */
|
||||
pMutex->taskID = taskID;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,393 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file queue.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Queue management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
|
||||
#if CFG_QUEUE_EN > 0
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
QCB QueueTbl[CFG_MAX_QUEUE] = {{0}}; /*!< Queue control block table */
|
||||
U32 QueueIDVessel = 0; /*!< Queue list mask */
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a queue
|
||||
* @param[in] qStart Pointer to mail pointer buffer.
|
||||
* @param[in] size The length of queue.
|
||||
* @param[in] sortType Mail queue waiting list sort type.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create queue fail.
|
||||
* @retval others Create queue successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_EventID CoCreateQueue(void **qStart, U16 size ,U8 sortType)
|
||||
{
|
||||
U8 i;
|
||||
P_ECB pecb;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if((qStart == Co_NULL) || (size == 0))
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
#endif
|
||||
|
||||
OsSchedLock();
|
||||
for(i = 0; i < CFG_MAX_QUEUE; i++)
|
||||
{
|
||||
/* Assign a free QUEUE control block */
|
||||
if((QueueIDVessel & (1 << i)) == 0)
|
||||
{
|
||||
QueueIDVessel |= (1<<i);
|
||||
OsSchedUnlock();
|
||||
|
||||
QueueTbl[i].qStart = qStart; /* Initialize the queue */
|
||||
QueueTbl[i].id = i;
|
||||
QueueTbl[i].head = 0;
|
||||
QueueTbl[i].tail = 0;
|
||||
QueueTbl[i].qMaxSize = size;
|
||||
QueueTbl[i].qSize = 0;
|
||||
|
||||
/* Get a event control block and initial the event content */
|
||||
pecb = CreatEvent(EVENT_TYPE_QUEUE,sortType,&QueueTbl[i]);
|
||||
|
||||
if(pecb == Co_NULL ) /* If there is no free EVENT control block*/
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
return (pecb->id);
|
||||
}
|
||||
}
|
||||
|
||||
OsSchedUnlock();
|
||||
return E_CREATE_FAIL; /* There is no free QUEUE control block */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a queue
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] opt Delete option.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_INVALID_PARAMETER Invalid parameter.
|
||||
* @retval E_TASK_WAITTING Tasks waitting for the event,delete fail.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelQueue(OS_EventID id,U8 opt)
|
||||
{
|
||||
P_ECB pecb;
|
||||
P_QCB pqcb;
|
||||
StatusType err;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID; /* Invalid id,return error */
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if( pecb->eventType != EVENT_TYPE_QUEUE)
|
||||
{
|
||||
return E_INVALID_ID; /* The event is not queue,return error*/
|
||||
}
|
||||
#endif
|
||||
pqcb = (P_QCB)pecb->eventPtr; /* Point at queue control block */
|
||||
err = DeleteEvent(pecb,opt); /* Delete the event control block */
|
||||
if(err == E_OK) /* If the event block have been deleted */
|
||||
{
|
||||
QueueIDVessel &= ~((U32)(1<<(pqcb->id))); /* Update free queue list */
|
||||
pqcb->qStart = Co_NULL;
|
||||
pqcb->id = 0;
|
||||
pqcb->head = 0;
|
||||
pqcb->tail = 0;
|
||||
pqcb->qMaxSize = 0;
|
||||
pqcb->qSize = 0;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Accept a mail from queue
|
||||
* @param[in] id Event ID.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval Co_NULL
|
||||
* @retval A pointer to mail accepted.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to accept a mail from queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoAcceptQueueMail(OS_EventID id,StatusType* perr)
|
||||
{
|
||||
P_ECB pecb;
|
||||
P_QCB pqcb;
|
||||
void* pmail;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid id,return error */
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_QUEUE)/* Invalid event control block type*/
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
pqcb = (P_QCB)pecb->eventPtr; /* Point at queue control block */
|
||||
OsSchedLock();
|
||||
if(pqcb->qSize != 0) /* If there are any messages in the queue */
|
||||
{
|
||||
/* Extract oldest message from the queue */
|
||||
pmail = *(pqcb->qStart + pqcb->head);
|
||||
pqcb->head++; /* Update the queue head */
|
||||
pqcb->qSize--; /* Update the number of messages in the queue */
|
||||
if(pqcb->head == pqcb->qMaxSize)
|
||||
{
|
||||
pqcb->head = 0;
|
||||
}
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return pmail; /* Return message received */
|
||||
}
|
||||
else /* If there is no message in the queue*/
|
||||
{
|
||||
OsSchedUnlock();
|
||||
*perr = E_QUEUE_EMPTY;
|
||||
return Co_NULL; /* Return Co_NULL */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Pend for a mail
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] timeout The longest time for writting mail.
|
||||
* @param[out] perr A pointer to error code.
|
||||
* @retval Co_NULL
|
||||
* @retval A pointer to mail accept.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to wait for a mail.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void* CoPendQueueMail(OS_EventID id,U32 timeout,StatusType* perr)
|
||||
{
|
||||
P_ECB pecb;
|
||||
P_QCB pqcb;
|
||||
P_OSTCB curTCB;
|
||||
void* pmail;
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
*perr = E_CALL;
|
||||
return Co_NULL;
|
||||
}
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
*perr = E_INVALID_ID; /* Invalid event id,return error */
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_QUEUE) /* The event type is not queue */
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return Co_NULL;
|
||||
}
|
||||
#endif
|
||||
if(OSSchedLock != 0) /* Judge schedule is locked or not? */
|
||||
{
|
||||
*perr = E_OS_IN_LOCK; /* Schedule is locked,return error */
|
||||
return Co_NULL;
|
||||
}
|
||||
pqcb = (P_QCB)pecb->eventPtr; /* Point at queue control block */
|
||||
OsSchedLock();
|
||||
if(pqcb->qSize != 0) /* If there are any messages in the queue */
|
||||
{
|
||||
/* Extract oldest message from the queue */
|
||||
pmail = *(pqcb->qStart + pqcb->head);
|
||||
pqcb->head++; /* Update the queue head */
|
||||
pqcb->qSize--; /* Update the number of messages in the queue */
|
||||
if(pqcb->head == pqcb->qMaxSize)/* Check queue head */
|
||||
{
|
||||
pqcb->head = 0;
|
||||
}
|
||||
OsSchedUnlock();
|
||||
*perr = E_OK;
|
||||
return pmail; /* Return message received */
|
||||
}
|
||||
else /* If there is no message in the queue*/
|
||||
{
|
||||
OsSchedUnlock();
|
||||
curTCB = TCBRunning;
|
||||
if(timeout == 0) /* If time-out is not configured */
|
||||
{
|
||||
/* Block current task until the event occur */
|
||||
EventTaskToWait(pecb,curTCB);
|
||||
|
||||
/* Have recived message or the queue have been deleted */
|
||||
pmail = curTCB->pmail;
|
||||
curTCB->pmail = Co_NULL;
|
||||
*perr = E_OK;
|
||||
return pmail; /* Return message received or Co_NULL */
|
||||
}
|
||||
else /* If time-out is configured */
|
||||
{
|
||||
OsSchedLock();
|
||||
|
||||
/* Block current task until event or timeout occurs */
|
||||
EventTaskToWait(pecb,curTCB);
|
||||
InsertDelayList(curTCB,timeout);
|
||||
OsSchedUnlock();
|
||||
if(curTCB->pmail == Co_NULL) /* If time-out occurred */
|
||||
{
|
||||
*perr = E_TIMEOUT;
|
||||
return Co_NULL;
|
||||
}
|
||||
else /* If event occured */
|
||||
{
|
||||
pmail = curTCB->pmail;
|
||||
curTCB->pmail = Co_NULL;
|
||||
*perr = E_OK;
|
||||
return pmail; /* Return message received or Co_NULL */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a mail to queue
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] pmail Pointer to mail that want to send.
|
||||
* @param[out] None
|
||||
* @retval E_OK
|
||||
* @retval E_INVALID_ID
|
||||
* @retval E_QUEUE_FULL
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to post a mail to queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoPostQueueMail(OS_EventID id,void* pmail)
|
||||
{
|
||||
P_ECB pecb;
|
||||
P_QCB pqcb;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_QUEUE)
|
||||
{
|
||||
return E_INVALID_ID; /* The event type isn't queue,return */
|
||||
}
|
||||
#endif
|
||||
pqcb = (P_QCB)pecb->eventPtr;
|
||||
if(pqcb->qSize == pqcb->qMaxSize) /* If queue is full */
|
||||
{
|
||||
return E_QUEUE_FULL;
|
||||
}
|
||||
else /* If queue is not full */
|
||||
{
|
||||
OsSchedLock();
|
||||
*(pqcb->qStart + pqcb->tail) = pmail; /* Insert message into queue */
|
||||
pqcb->tail++; /* Update queue tail */
|
||||
pqcb->qSize++; /* Update the number of messages in the queue */
|
||||
if(pqcb->tail == pqcb->qMaxSize) /* Check queue tail */
|
||||
{
|
||||
pqcb->tail = 0;
|
||||
}
|
||||
EventTaskToRdy(pecb); /* Check the event waiting list */
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a mail to queue in ISR
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] pmail Pointer to mail that want to send.
|
||||
* @param[out] None
|
||||
* @retval E_OK
|
||||
* @retval E_INVALID_ID
|
||||
* @retval E_QUEUE_FULL
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in ISR to post a mail to queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
StatusType isr_PostQueueMail(OS_EventID id,void* pmail)
|
||||
{
|
||||
if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */
|
||||
{
|
||||
/* Insert the request into service request queue */
|
||||
if(InsertInSRQ(QUEUE_REQ,id,pmail) == Co_FALSE)
|
||||
{
|
||||
return E_SEV_REQ_FULL; /* If service request queue is full */
|
||||
}
|
||||
else /* If the request have been inserted into service request queue */
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
else /* The scheduler is unlocked */
|
||||
{
|
||||
return(CoPostQueueMail(id,pmail)); /* Send the message to the queue*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,322 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file sem.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Semaphore management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
#if CFG_SEM_EN >0
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a semaphore
|
||||
* @param[in] initCnt Semaphore valid counter.
|
||||
* @param[in] maxCnt Semaphore max initialize counter.
|
||||
* @param[in] sortType Semaphore sort type.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create semaphore fail.
|
||||
* @retval others Create semaphore successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a semaphore.
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_EventID CoCreateSem(U16 initCnt,U16 maxCnt,U8 sortType)
|
||||
{
|
||||
P_ECB pecb;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(initCnt > maxCnt)
|
||||
{
|
||||
return E_CREATE_FAIL; /* Invalid 'initCnt' or 'maxCnt' */
|
||||
}
|
||||
|
||||
if ((sortType != EVENT_SORT_TYPE_FIFO) && (sortType != EVENT_SORT_TYPE_PRIO))
|
||||
{
|
||||
return E_CREATE_FAIL; /* Illegal sort type,return error */
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Create a semaphore type event control block */
|
||||
pecb = CreatEvent(EVENT_TYPE_SEM,sortType,Co_NULL);
|
||||
if(pecb == Co_NULL) /* If failed to create event block */
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
pecb->eventCounter = initCnt;/* Initialize event block */
|
||||
pecb->initialEventCounter = maxCnt;
|
||||
return (pecb->id); /* Return event id */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a semaphore
|
||||
* @param[in] id Event ID which to be deleted.
|
||||
* @param[in] opt Delete option.
|
||||
* @arg == OPT_DEL_ANYWAY Delete semaphore always
|
||||
* @arg == OPT_DEL_NO_PEND Delete semaphore only when no task pending on.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_INVALID_PARAMETER Invalid parameter.
|
||||
* @retval E_TASK_WAITTING Tasks waitting for the event,delete fail.
|
||||
* @retval E_OK Event deleted successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a semaphore.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelSem(OS_EventID id,U8 opt)
|
||||
{
|
||||
P_ECB pecb;
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_SEM)
|
||||
{
|
||||
return E_INVALID_ID; /* The event type is not semaphore */
|
||||
}
|
||||
#endif
|
||||
|
||||
return (DeleteEvent(pecb,opt));/* Delete the semaphore event control block*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Accept a semaphore without waitting
|
||||
* @param[in] id Event ID
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_SEM_EMPTY No semaphore exist.
|
||||
* @retval E_OK Get semaphore successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called accept a semaphore without waitting.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoAcceptSem(OS_EventID id)
|
||||
{
|
||||
P_ECB pecb;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if( pecb->eventType != EVENT_TYPE_SEM)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock();
|
||||
if(pecb->eventCounter > 0) /* If semaphore is positive,resource available */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
pecb->eventCounter--; /* Decrement semaphore only if positive */
|
||||
return E_OK;
|
||||
}
|
||||
else /* Resource is not available */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
return E_SEM_EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief wait for a semaphore
|
||||
* @param[in] id Event ID.
|
||||
* @param[in] timeout The longest time for writting semaphore.
|
||||
* @para 0
|
||||
* @para 0x1~0xff
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_INVALID_ID Invalid event ID.
|
||||
* @retval E_TIMEOUT Semaphore was not received within the specified
|
||||
* 'timeout' time.
|
||||
* @retval E_OK The call was successful and your task owns the
|
||||
* resource,or the event you are waiting for occurred.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to waits for a semaphore.
|
||||
* @note IF this function is called in ISR,nothing to do and return immediately.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoPendSem(OS_EventID id,U32 timeout)
|
||||
{
|
||||
P_ECB pecb;
|
||||
P_OSTCB curTCB;
|
||||
if(OSIntNesting > 0) /* If the caller is ISR */
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_SEM)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
if(OSSchedLock != 0) /* Schdule is locked? */
|
||||
{
|
||||
return E_OS_IN_LOCK; /* Yes,error return */
|
||||
}
|
||||
OsSchedLock();
|
||||
if(pecb->eventCounter > 0) /* If semaphore is positive,resource available */
|
||||
{
|
||||
pecb->eventCounter--; /* Decrement semaphore only if positive */
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
}
|
||||
else /* Resource is not available */
|
||||
{
|
||||
OsSchedUnlock();
|
||||
curTCB = TCBRunning;
|
||||
if(timeout == 0) /* If time-out is not configured */
|
||||
{
|
||||
EventTaskToWait(pecb,curTCB); /* Block task until event occurs */
|
||||
curTCB->pmail = Co_NULL;
|
||||
return E_OK;
|
||||
}
|
||||
else /* If time-out is configured */
|
||||
{
|
||||
OsSchedLock();
|
||||
|
||||
/* Block task until event or timeout occurs */
|
||||
EventTaskToWait(pecb,curTCB);
|
||||
InsertDelayList(curTCB,timeout);
|
||||
|
||||
OsSchedUnlock();
|
||||
if (curTCB->pmail == Co_NULL) /* If pmail is Co_NULL, time-out occurred*/
|
||||
{
|
||||
return E_TIMEOUT;
|
||||
}
|
||||
else /* Event occurred or event have been deleted*/
|
||||
{
|
||||
curTCB->pmail = Co_NULL;
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a semaphore
|
||||
* @param[in] id id of event control block associated with the desired semaphore.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Parameter id passed was invalid event ID.
|
||||
* @retval E_SEM_FULL Semaphore full.
|
||||
* @retval E_OK Semaphore had post successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to post a semaphore to corresponding event.
|
||||
*
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoPostSem(OS_EventID id)
|
||||
{
|
||||
P_ECB pecb;
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(id >= CFG_MAX_EVENT)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
pecb = &EventTbl[id];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(pecb->eventType != EVENT_TYPE_SEM) /* Invalid event control block type */
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Make sure semaphore will not overflow */
|
||||
if(pecb->eventCounter == pecb->initialEventCounter)
|
||||
{
|
||||
return E_SEM_FULL; /* The counter of Semaphore reach the max number*/
|
||||
}
|
||||
OsSchedLock();
|
||||
pecb->eventCounter++; /* Increment semaphore count to register event */
|
||||
EventTaskToRdy(pecb); /* Check semaphore event waiting list */
|
||||
OsSchedUnlock();
|
||||
return E_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Post a semaphore in ISR
|
||||
* @param[in] id identifier of event control block associated with the
|
||||
* desired semaphore.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Parameter id passed was invalid event ID.
|
||||
* @retval E_NO_TASK_WAITTING There are one more tasks waitting for the event.
|
||||
* @retval E_OK Semaphore had signaled successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in ISR to post a semaphore to corresponding
|
||||
* event.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
StatusType isr_PostSem(OS_EventID id)
|
||||
{
|
||||
if(OSSchedLock > 0) /* If scheduler is locked,(the caller is ISR) */
|
||||
{
|
||||
/* Initiate a post service handling request */
|
||||
if(InsertInSRQ(SEM_REQ,id,Co_NULL) == Co_FALSE)
|
||||
{
|
||||
return E_SEV_REQ_FULL; /* If service request queue is full */
|
||||
}
|
||||
else /* Operate successfully */
|
||||
{
|
||||
return E_OK;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return(CoPostSem(id)); /* Post semaphore */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,165 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file serviceReq.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief servive request management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
#if (CFG_TASK_WAITTING_EN > 0) || (CFG_TMR_EN >0)
|
||||
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
SRQ ServiceReq = {0,0}; /*!< ISR server request queue */
|
||||
#endif
|
||||
BOOL IsrReq = Co_FALSE;
|
||||
#if (CFG_TASK_WAITTING_EN > 0)
|
||||
BOOL TimeReq = Co_FALSE; /*!< Time delay dispose request */
|
||||
#endif
|
||||
|
||||
#if CFG_TMR_EN > 0
|
||||
BOOL TimerReq = Co_FALSE; /*!< Timer dispose request */
|
||||
#endif
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Insert into service requst queue
|
||||
* @param[in] type Service request type.
|
||||
* @param[in] id Service request event id,event id/flag id.
|
||||
* @param[in] arg Service request argument.
|
||||
* @param[out] None
|
||||
*
|
||||
* @retval Co_FALSE Successfully insert into service request queue.
|
||||
* @retval Co_TRUE Failure to insert into service request queue.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function be called to insert a requst into service request
|
||||
* queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if (CFG_MAX_SERVICE_REQUEST > 0)
|
||||
BOOL InsertInSRQ(U8 type,U8 id,void* arg)
|
||||
{
|
||||
P_SQC pcell;
|
||||
U8 cnt;
|
||||
U8 heed;
|
||||
IRQ_DISABLE_SAVE();
|
||||
if (ServiceReq.cnt >= CFG_MAX_SERVICE_REQUEST)
|
||||
{
|
||||
IRQ_ENABLE_RESTORE ();
|
||||
|
||||
return Co_FALSE; /* Error return */
|
||||
}
|
||||
cnt = Inc8(&ServiceReq.cnt);
|
||||
heed = ServiceReq.head;
|
||||
IsrReq = Co_TRUE;
|
||||
pcell = &ServiceReq.cell[((cnt+heed)%CFG_MAX_SERVICE_REQUEST)];/*the tail */
|
||||
pcell->type = type; /* Save service request type, */
|
||||
pcell->id = id; /* event id */
|
||||
pcell->arg = arg; /* and parameter */
|
||||
IRQ_ENABLE_RESTORE ();
|
||||
|
||||
return Co_TRUE; /* Return OK */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Respond the request in the service request queue.
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function be called to respond the request in the service
|
||||
* request queue.
|
||||
* @note
|
||||
*******************************************************************************
|
||||
*/
|
||||
void RespondSRQ(void)
|
||||
{
|
||||
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
SQC cell;
|
||||
|
||||
#endif
|
||||
|
||||
#if (CFG_TASK_WAITTING_EN > 0)
|
||||
if(TimeReq == Co_TRUE) /* Time delay request? */
|
||||
{
|
||||
TimeDispose(); /* Yes,call handler */
|
||||
TimeReq = Co_FALSE; /* Reset time delay request Co_FALSE */
|
||||
}
|
||||
#endif
|
||||
#if CFG_TMR_EN > 0
|
||||
if(TimerReq == Co_TRUE) /* Timer request? */
|
||||
{
|
||||
TmrDispose(); /* Yes,call handler */
|
||||
TimerReq = Co_FALSE; /* Reset timer request Co_FALSE */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_MAX_SERVICE_REQUEST > 0
|
||||
|
||||
while (ServiceReq.cnt != 0)
|
||||
{
|
||||
IRQ_DISABLE_SAVE (); /* need to protect the following */
|
||||
cell = ServiceReq.cell[ServiceReq.head]; /* extract one cell */
|
||||
ServiceReq.head = (ServiceReq.head + 1) % /* move head (pop) */
|
||||
CFG_MAX_SERVICE_REQUEST;
|
||||
ServiceReq.cnt--;
|
||||
IRQ_ENABLE_RESTORE (); /* now use the cell copy */
|
||||
|
||||
switch(cell.type) /* Judge service request type */
|
||||
{
|
||||
#if CFG_SEM_EN > 0
|
||||
case SEM_REQ: /* Semaphore post request,call handler*/
|
||||
CoPostSem(cell.id);
|
||||
break;
|
||||
#endif
|
||||
#if CFG_MAILBOX_EN > 0
|
||||
case MBOX_REQ: /* Mailbox post request,call handler */
|
||||
CoPostMail(cell.id, cell.arg);
|
||||
break;
|
||||
#endif
|
||||
#if CFG_FLAG_EN > 0
|
||||
case FLAG_REQ: /* Flag set request,call handler */
|
||||
CoSetFlag(cell.id);
|
||||
break;
|
||||
#endif
|
||||
#if CFG_QUEUE_EN > 0
|
||||
case QUEUE_REQ: /* Queue post request,call handler */
|
||||
CoPostQueueMail(cell.id, cell.arg);
|
||||
break;
|
||||
#endif
|
||||
default: /* Others,break */
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
IRQ_DISABLE_SAVE (); /* need to protect the following */
|
||||
|
||||
if (ServiceReq.cnt == 0) /* another item in the queue already? */
|
||||
{
|
||||
IsrReq = Co_FALSE; /* queue still empty here */
|
||||
}
|
||||
IRQ_ENABLE_RESTORE (); /* now it is done and return */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,376 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file time.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief time management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
#if CFG_TASK_WAITTING_EN > 0
|
||||
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
P_OSTCB DlyList = Co_NULL; /*!< Header pointer to the DELAY list.*/
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Insert into DELAY list
|
||||
*
|
||||
* @param[in] ptcb Task that want to insert into DELAY list.
|
||||
* @param[in] ticks Delay system ticks.
|
||||
* @param[out] None
|
||||
* @retval None.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to insert task into DELAY list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void InsertDelayList(P_OSTCB ptcb,U32 ticks)
|
||||
{
|
||||
S32 deltaTicks;
|
||||
P_OSTCB dlyNext;
|
||||
|
||||
if(ticks == 0) /* Is delay tick == 0? */
|
||||
return; /* Yes,do nothing,return */
|
||||
if(DlyList == Co_NULL) /* Is no item in DELAY list? */
|
||||
{
|
||||
ptcb->delayTick = ticks; /* Yes,set this as first item */
|
||||
DlyList = ptcb;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No,find correct place ,and insert the task */
|
||||
dlyNext = DlyList;
|
||||
deltaTicks = ticks; /* Get task delay ticks */
|
||||
|
||||
/* Find correct place */
|
||||
while(dlyNext != Co_NULL)
|
||||
{
|
||||
/* Get delta ticks with previous item */
|
||||
deltaTicks -= dlyNext->delayTick;
|
||||
if(deltaTicks < 0) /* Is delta ticks<0? */
|
||||
{
|
||||
/* Yes,get correct place */
|
||||
if(dlyNext->TCBprev != Co_NULL) /* Is head item of DELAY list? */
|
||||
{
|
||||
dlyNext->TCBprev->TCBnext = ptcb; /* No,insert into */
|
||||
ptcb->TCBprev = dlyNext->TCBprev;
|
||||
ptcb->TCBnext = dlyNext;
|
||||
dlyNext->TCBprev = ptcb;
|
||||
}
|
||||
else /* Yes,set task as first item */
|
||||
{
|
||||
ptcb->TCBnext = DlyList;
|
||||
DlyList->TCBprev = ptcb;
|
||||
DlyList = ptcb;
|
||||
}
|
||||
ptcb->delayTick = ptcb->TCBnext->delayTick+deltaTicks;
|
||||
ptcb->TCBnext->delayTick -= ptcb->delayTick;
|
||||
break;
|
||||
}
|
||||
/* Is last item in DELAY list? */
|
||||
else if((deltaTicks >= 0) && (dlyNext->TCBnext == Co_NULL) )
|
||||
{
|
||||
ptcb->TCBprev = dlyNext; /* Yes,insert into */
|
||||
dlyNext->TCBnext = ptcb;
|
||||
ptcb->delayTick = deltaTicks;
|
||||
break;
|
||||
}
|
||||
dlyNext = dlyNext->TCBnext; /* Get the next item in DELAY list */
|
||||
}
|
||||
}
|
||||
|
||||
ptcb->state = TASK_WAITING; /* Set task status as TASK_WAITING */
|
||||
TaskSchedReq = Co_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Remove from the DELAY list
|
||||
* @param[in] ptcb Task that want to remove from the DELAY list.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove task from the DELAY list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void RemoveDelayList(P_OSTCB ptcb)
|
||||
{
|
||||
|
||||
/* Is there only one item in the DELAY list? */
|
||||
if((ptcb->TCBprev == Co_NULL) && ( ptcb->TCBnext == Co_NULL))
|
||||
{
|
||||
DlyList = Co_NULL; /* Yes,set DELAY list as Co_NULL */
|
||||
}
|
||||
else if(ptcb->TCBprev == Co_NULL) /* Is the first item in DELAY list? */
|
||||
{
|
||||
/* Yes,remove task from the DELAY list,and reset the list */
|
||||
DlyList = ptcb->TCBnext;
|
||||
ptcb->TCBnext->delayTick += ptcb->delayTick;
|
||||
ptcb->TCBnext->TCBprev = Co_NULL;
|
||||
ptcb->TCBnext = Co_NULL;
|
||||
|
||||
}
|
||||
else if(ptcb->TCBnext == Co_NULL) /* Is the last item in DELAY list? */
|
||||
{
|
||||
ptcb->TCBprev->TCBnext = Co_NULL; /* Yes,remove task form DELAY list */
|
||||
ptcb->TCBprev = Co_NULL;
|
||||
}
|
||||
else /* No, remove task from DELAY list */
|
||||
{
|
||||
ptcb->TCBprev->TCBnext = ptcb->TCBnext;
|
||||
ptcb->TCBnext->TCBprev = ptcb->TCBprev;
|
||||
ptcb->TCBnext->delayTick += ptcb->delayTick;
|
||||
ptcb->TCBnext = Co_NULL;
|
||||
ptcb->TCBprev = Co_NULL;
|
||||
}
|
||||
ptcb->delayTick = INVALID_VALUE; /* Set task delay tick value as invalid */
|
||||
}
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get current ticks
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval Return current system tick counter.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to obtain current system tick counter.
|
||||
*******************************************************************************
|
||||
*/
|
||||
U64 CoGetOSTime(void)
|
||||
{
|
||||
return OSTickCnt; /* Get system time(tick) */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delay current task for specify ticks number
|
||||
* @param[in] ticks Specify system tick number which will delay.
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_OK The current task was insert to DELAY list successful,it
|
||||
* will delay specify time.
|
||||
* @par Description
|
||||
* @details This function delay specify ticks for current task.
|
||||
*
|
||||
* @note This function be called in ISR,do nothing and return immediately.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoTickDelay(U32 ticks)
|
||||
{
|
||||
if(OSIntNesting >0) /* Is call in ISR? */
|
||||
{
|
||||
return E_CALL; /* Yes,error return */
|
||||
}
|
||||
|
||||
if(ticks == INVALID_VALUE) /* Is tick==INVALID_VALUE? */
|
||||
{
|
||||
return E_INVALID_PARAMETER; /* Yes,error return */
|
||||
}
|
||||
if(ticks == 0) /* Is tick==0? */
|
||||
{
|
||||
return E_OK; /* Yes,do nothing ,return OK */
|
||||
}
|
||||
if(OSSchedLock != 0) /* Is OS lock? */
|
||||
{
|
||||
return E_OS_IN_LOCK; /* Yes,error return */
|
||||
}
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
InsertDelayList(TCBRunning,ticks); /* Insert task in DELAY list */
|
||||
OsSchedUnlock(); /* Unlock schedule,and call task schedule */
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Reset task delay ticks
|
||||
* @param[in] ptcb Task that want to insert into DELAY list.
|
||||
* @param[in] ticks Specify system tick number which will delay .
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_INVALID_ID Invalid task id.
|
||||
* @retval E_NOT_IN_DELAY_LIST Task not in delay list.
|
||||
* @retval E_OK The current task was inserted to DELAY list
|
||||
* successful,it will delay for specify time.
|
||||
* @par Description
|
||||
* @details This function delay specify ticks for current task.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoResetTaskDelayTick(OS_TID taskID,U32 ticks)
|
||||
{
|
||||
P_OSTCB ptcb;
|
||||
|
||||
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(taskID >= CFG_MAX_USER_TASKS + SYS_TASK_NUM)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
ptcb = &TCBTbl[taskID];
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
if(ptcb->stkPtr == Co_NULL)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(ptcb->delayTick == INVALID_VALUE) /* Is tick==INVALID_VALUE? */
|
||||
{
|
||||
return E_NOT_IN_DELAY_LIST; /* Yes,error return */
|
||||
}
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
RemoveDelayList(ptcb); /* Remove task from the DELAY list */
|
||||
|
||||
if(ticks == 0) /* Is delay tick==0? */
|
||||
{
|
||||
InsertToTCBRdyList(ptcb); /* Insert task into the DELAY list */
|
||||
}
|
||||
else
|
||||
{
|
||||
InsertDelayList(ptcb,ticks); /* No,insert task into DELAY list */
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule,and call task schedule */
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delay current task for detail time
|
||||
* @param[in] hour Specify the number of hours.
|
||||
* @param[in] minute Specify the number of minutes.
|
||||
* @param[in] sec Specify the number of seconds.
|
||||
* @param[in] millsec Specify the number of millseconds.
|
||||
* @param[out] None
|
||||
* @retval E_CALL Error call in ISR.
|
||||
* @retval E_INVALID_PARAMETER Parameter passed was invalid,delay fail.
|
||||
* @retval E_OK The current task was inserted to DELAY list
|
||||
* successful,it will delay for specify time.
|
||||
* @par Description
|
||||
* @details This function delay specify time for current task.
|
||||
*
|
||||
* @note If this function called in ISR,do nothing and return immediately.
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_TIME_DELAY_EN >0
|
||||
StatusType CoTimeDelay(U8 hour,U8 minute,U8 sec,U16 millsec)
|
||||
{
|
||||
U32 ticks;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(OSIntNesting > 0)
|
||||
{
|
||||
return E_CALL;
|
||||
}
|
||||
if((minute > 59)||(sec > 59)||(millsec > 999))
|
||||
return E_INVALID_PARAMETER;
|
||||
#endif
|
||||
if(OSSchedLock != 0) /* Is OS lock? */
|
||||
{
|
||||
return E_OS_IN_LOCK; /* Yes,error return */
|
||||
}
|
||||
|
||||
/* Get tick counter from time */
|
||||
ticks = ((hour*3600) + (minute*60) + (sec)) * (CFG_SYSTICK_FREQ)\
|
||||
+ (millsec*CFG_SYSTICK_FREQ + 500)/1000;
|
||||
|
||||
CoTickDelay(ticks); /* Call tick delay */
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Dispose time delay
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to dispose time delay of all task.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void TimeDispose(void)
|
||||
{
|
||||
P_OSTCB dlyList;
|
||||
|
||||
dlyList = DlyList; /* Get first item of DELAY list */
|
||||
while((dlyList != Co_NULL) && (dlyList->delayTick == 0) )
|
||||
{
|
||||
|
||||
#if CFG_EVENT_EN > 0
|
||||
if(dlyList->eventID != INVALID_ID) /* Is task in event waiting list? */
|
||||
{
|
||||
RemoveEventWaittingList(dlyList); /* Yes,remove task from list */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_FLAG_EN > 0
|
||||
if(dlyList->pnode != Co_NULL) /* Is task in flag waiting list? */
|
||||
{
|
||||
RemoveLinkNode(dlyList->pnode); /* Yes,remove task from list */
|
||||
}
|
||||
#endif
|
||||
dlyList->delayTick = INVALID_VALUE; /* Set delay tick value as invalid*/
|
||||
DlyList = dlyList->TCBnext; /* Get next item as the head of DELAY list*/
|
||||
dlyList->TCBnext = Co_NULL;
|
||||
|
||||
InsertToTCBRdyList(dlyList); /* Insert task into READY list */
|
||||
|
||||
dlyList = DlyList; /* Get the first item of DELAY list */
|
||||
if(dlyList != Co_NULL) /* Is DELAY list as Co_NULL? */
|
||||
{
|
||||
dlyList->TCBprev = Co_NULL; /* No,initialize the first item */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Dispose time delay in ISR
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called in systick interrupt to dispose time delay
|
||||
* of all task.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void isr_TimeDispose(void)
|
||||
{
|
||||
if(OSSchedLock > 1) /* Is schedule lock? */
|
||||
{
|
||||
IsrReq = Co_TRUE;
|
||||
TimeReq = Co_TRUE; /* Yes,set time request Co_TRUE */
|
||||
}
|
||||
else
|
||||
{
|
||||
TimeDispose(); /* No,call handler */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,447 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file timer.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief timer management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
/*---------------------------- Variable Define -------------------------------*/
|
||||
#if CFG_TMR_EN > 0
|
||||
|
||||
TmrCtrl TmrTbl[CFG_MAX_TMR]= {{0}};/*!< Table which save timer control block.*/
|
||||
P_TmrCtrl TmrList = Co_NULL; /*!< The header of the TmrCtrl list. */
|
||||
U32 TmrIDVessel = 0; /*!< Timer ID container. */
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Insert a timer into the timer list
|
||||
* @param[in] tmrID Specify timer ID which insertted.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID Timer ID passed was invalid,insert fail.
|
||||
* @retval E_OK Insert successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to insert a timer into the timer list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
static void InsertTmrList(OS_TCID tmrID)
|
||||
{
|
||||
P_TmrCtrl pTmr;
|
||||
S32 deltaTicks;
|
||||
U32 tmrCnt;
|
||||
tmrCnt = TmrTbl[tmrID].tmrCnt; /* Get timer time */
|
||||
|
||||
if(tmrCnt == 0) /* Is timer time==0? */
|
||||
{
|
||||
return; /* Do nothing,return */
|
||||
}
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
if(TmrList == Co_NULL) /* Is no item in timer list? */
|
||||
{
|
||||
TmrList = &TmrTbl[tmrID]; /* Yes,set this as first item */
|
||||
}
|
||||
else /* No,find correct place ,and insert inserted timer */
|
||||
{
|
||||
pTmr = TmrList;
|
||||
deltaTicks = tmrCnt; /* Get timer tick */
|
||||
|
||||
/* find correct place */
|
||||
while(pTmr != Co_NULL)
|
||||
{
|
||||
deltaTicks -= pTmr->tmrCnt; /* Get ticks with previous item */
|
||||
if(deltaTicks < 0) /* Is delta ticks<0? */
|
||||
{
|
||||
/* Yes,get correct place */
|
||||
if(pTmr->tmrPrev!= Co_NULL)/* Is head item of timer list? */
|
||||
{
|
||||
/* No,insert into */
|
||||
pTmr->tmrPrev->tmrNext = &TmrTbl[tmrID];
|
||||
TmrTbl[tmrID].tmrPrev = pTmr->tmrPrev;
|
||||
TmrTbl[tmrID].tmrNext = pTmr;
|
||||
pTmr->tmrPrev = &TmrTbl[tmrID];
|
||||
}
|
||||
else /* Yes,set task as first item */
|
||||
{
|
||||
TmrTbl[tmrID].tmrNext = TmrList;
|
||||
TmrList->tmrPrev = &TmrTbl[tmrID];
|
||||
TmrList = &TmrTbl[tmrID];
|
||||
}
|
||||
TmrTbl[tmrID].tmrCnt = TmrTbl[tmrID].tmrNext->tmrCnt+deltaTicks;
|
||||
TmrTbl[tmrID].tmrNext->tmrCnt -= TmrTbl[tmrID].tmrCnt;
|
||||
break;
|
||||
}
|
||||
/* Is last item in list? */
|
||||
else if((deltaTicks >= 0) && (pTmr->tmrNext == Co_NULL))
|
||||
{
|
||||
/* Yes,insert into */
|
||||
TmrTbl[tmrID].tmrPrev = pTmr;
|
||||
pTmr->tmrNext = &TmrTbl[tmrID];
|
||||
TmrTbl[tmrID].tmrCnt = deltaTicks;
|
||||
break;
|
||||
}
|
||||
pTmr = pTmr->tmrNext; /* Get the next item in timer list */
|
||||
}
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Remove a timer from the timer list
|
||||
* @param[in] tmrID Specify ID for a timer which removed form timer list.
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to remove a timer from the timer list.
|
||||
*******************************************************************************
|
||||
*/
|
||||
static void RemoveTmrList(OS_TCID tmrID)
|
||||
{
|
||||
P_TmrCtrl pTmr;
|
||||
|
||||
pTmr = &TmrTbl[tmrID];
|
||||
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
|
||||
/* Is there only one item in timer list? */
|
||||
if((pTmr->tmrPrev == Co_NULL) && (pTmr->tmrNext == Co_NULL))
|
||||
{
|
||||
TmrList = Co_NULL; /* Yes,set timer list as Co_NULL */
|
||||
}
|
||||
else if(pTmr->tmrPrev == Co_NULL) /* Is the first item in timer list? */
|
||||
{ /* Yes,remove timer from list,and reset timer list */
|
||||
TmrList = pTmr->tmrNext;
|
||||
TmrList->tmrPrev = Co_NULL;
|
||||
pTmr->tmrNext->tmrCnt += pTmr->tmrCnt;
|
||||
pTmr->tmrNext = Co_NULL;
|
||||
}
|
||||
else if(pTmr->tmrNext == Co_NULL) /* Is the last item in timer list? */
|
||||
{
|
||||
/* Yes,remove timer form list */
|
||||
pTmr->tmrPrev->tmrNext = Co_NULL;
|
||||
pTmr->tmrPrev = Co_NULL;
|
||||
}
|
||||
else /* No, remove timer from list */
|
||||
{
|
||||
pTmr->tmrPrev->tmrNext = pTmr->tmrNext;
|
||||
pTmr->tmrNext->tmrPrev = pTmr->tmrPrev;
|
||||
pTmr->tmrNext->tmrCnt += pTmr->tmrCnt;
|
||||
pTmr->tmrNext = Co_NULL;
|
||||
pTmr->tmrPrev = Co_NULL;
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Create a timer
|
||||
* @param[in] tmrType Specify timer's type.
|
||||
* @param[in] tmrCnt Specify timer initial counter value.
|
||||
* @param[in] tmrReload Specify timer reload value.
|
||||
* @param[in] func Specify timer callback function entry.
|
||||
* @param[out] None
|
||||
* @retval E_CREATE_FAIL Create timer fail.
|
||||
* @retval others Create timer successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to create a timer.
|
||||
*******************************************************************************
|
||||
*/
|
||||
OS_TCID CoCreateTmr(U8 tmrType, U32 tmrCnt, U32 tmrReload, vFUNCPtr func)
|
||||
{
|
||||
U8 i;
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if((tmrType != TMR_TYPE_ONE_SHOT) && (tmrType != TMR_TYPE_PERIODIC))
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
if(func == Co_NULL)
|
||||
{
|
||||
return E_CREATE_FAIL;
|
||||
}
|
||||
#endif
|
||||
OsSchedLock(); /* Lock schedule */
|
||||
for(i = 0; i < CFG_MAX_TMR; i++)
|
||||
{
|
||||
if((TmrIDVessel & (1 << i)) == 0) /* Is free timer ID? */
|
||||
{
|
||||
TmrIDVessel |= (1<<i); /* Yes,assign ID to this timer */
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
TmrTbl[i].tmrID = i; /* Initialize timer as user set */
|
||||
TmrTbl[i].tmrType = tmrType;
|
||||
TmrTbl[i].tmrState = TMR_STATE_STOPPED;
|
||||
TmrTbl[i].tmrCnt = tmrCnt;
|
||||
TmrTbl[i].tmrReload = tmrReload;
|
||||
TmrTbl[i].tmrCallBack = func;
|
||||
TmrTbl[i].tmrPrev = Co_NULL;
|
||||
TmrTbl[i].tmrNext = Co_NULL;
|
||||
return i; /* Return timer ID */
|
||||
}
|
||||
}
|
||||
OsSchedUnlock(); /* Unlock schedule */
|
||||
return E_CREATE_FAIL; /* Error return */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Start counter
|
||||
* @param[in] tmrID Specify a timer which startted.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The timer id passed was invalid,can't start timer
|
||||
* @retval E_OK Insert a timer to timer list and start it successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to make a timer start countering.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoStartTmr(OS_TCID tmrID)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(tmrID >= CFG_MAX_TMR)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if( (TmrIDVessel & (1<<tmrID)) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(TmrTbl[tmrID].tmrState == TMR_STATE_RUNNING) /* Is timer running? */
|
||||
{
|
||||
return E_OK; /* Yes,do nothing,return OK */
|
||||
}
|
||||
|
||||
/* No,set timer status as TMR_STATE_RUNNING */
|
||||
TmrTbl[tmrID].tmrState = TMR_STATE_RUNNING;
|
||||
InsertTmrList(tmrID); /* Insert this timer into timer list */
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Stop countering for a spcify timer
|
||||
* @param[in] tmrID Specify a timer which stopped.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The timer id passed was invalid, stop failure.
|
||||
* @retval E_OK Stop a timer countering successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to stop a timer from counting.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoStopTmr(OS_TCID tmrID)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(tmrID >= CFG_MAX_TMR)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if((TmrIDVessel & (1<<tmrID)) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if(TmrTbl[tmrID].tmrState == TMR_STATE_STOPPED)/* Does timer stop running?*/
|
||||
{
|
||||
return E_OK; /* Yes,do nothing,return OK */
|
||||
}
|
||||
RemoveTmrList(tmrID); /* No,remove this timer from timer list */
|
||||
|
||||
/* Set timer status as TMR_STATE_STOPPED */
|
||||
TmrTbl[tmrID].tmrState = TMR_STATE_STOPPED;
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Delete a timer
|
||||
* @param[in] tmrID Specify a timer which deleted.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The timer id passed was invalid,deleted failure.
|
||||
* @retval E_OK Delete a timer successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to delete a timer which created before.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoDelTmr(OS_TCID tmrID)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(tmrID >= CFG_MAX_TMR)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if( (TmrIDVessel & (1<<tmrID)) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(TmrTbl[tmrID].tmrState == TMR_STATE_RUNNING) /* Is timer running? */
|
||||
{
|
||||
RemoveTmrList(tmrID); /* Yes,remove this timer from timer list*/
|
||||
}
|
||||
TmrIDVessel &=~(1<<tmrID); /* Release resource that this timer hold*/
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Get current counter of specify timer
|
||||
* @param[in] tmrID Specify timer by ID.
|
||||
* @param[out] E_INVALID_ID Invalid ID was passed and get counter failure.
|
||||
* @param[out] E_OK Get current counter successful.
|
||||
* @retval Current counter of a timer which specify by id.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to obtain current counter of specify timer.
|
||||
*******************************************************************************
|
||||
*/
|
||||
U32 CoGetCurTmrCnt(OS_TCID tmrID,StatusType* perr)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(tmrID >= CFG_MAX_TMR)
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return 0;
|
||||
}
|
||||
if((TmrIDVessel & (1<<tmrID)) == 0)
|
||||
{
|
||||
*perr = E_INVALID_ID;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
*perr = E_OK;
|
||||
return TmrTbl[tmrID].tmrCnt; /* Return timer counter */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Setting for a specify timer
|
||||
* @param[in] tmrID Specify timer by ID.
|
||||
* @param[in] tmrCnt Specify timer counter which need to be set.
|
||||
* @param[in] tmrReload Specify timer reload value which need to be set.
|
||||
* @param[out] None
|
||||
* @retval E_INVALID_ID The ID passed was invalid,set fail.
|
||||
* @retval E_OK Set timer counter successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to set timer counter and reload value.
|
||||
*******************************************************************************
|
||||
*/
|
||||
StatusType CoSetTmrCnt(OS_TCID tmrID,U32 tmrCnt,U32 tmrReload)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0 /* Check validity of parameter */
|
||||
if(tmrID >= CFG_MAX_TMR)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
if( (TmrIDVessel & (1<<tmrID)) == 0)
|
||||
{
|
||||
return E_INVALID_ID;
|
||||
}
|
||||
#endif
|
||||
TmrTbl[tmrID].tmrCnt = tmrCnt; /* Reset timer counter and reload value */
|
||||
TmrTbl[tmrID].tmrReload = tmrReload;
|
||||
|
||||
if(TmrTbl[tmrID].tmrState == TMR_STATE_RUNNING) /* Is timer running? */
|
||||
{
|
||||
RemoveTmrList(tmrID); /* Yes,reorder timer in timer list */
|
||||
InsertTmrList(tmrID);
|
||||
}
|
||||
return E_OK; /* Return OK */
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Timer counter dispose
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to dispose timer counter.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void TmrDispose(void)
|
||||
{
|
||||
P_TmrCtrl pTmr;
|
||||
|
||||
pTmr = TmrList; /* Get first item of timer list */
|
||||
while((pTmr != Co_NULL) && (pTmr->tmrCnt == 0) )
|
||||
{
|
||||
if(pTmr->tmrType == TMR_TYPE_ONE_SHOT) /* Is a One-shot timer? */
|
||||
{
|
||||
/* Yes,remove this timer from timer list */
|
||||
RemoveTmrList(pTmr->tmrID);
|
||||
|
||||
/* Set timer status as TMR_STATE_STOPPED */
|
||||
pTmr->tmrState = TMR_STATE_STOPPED;
|
||||
(pTmr->tmrCallBack)(); /* Call timer callback function */
|
||||
}
|
||||
else if(pTmr->tmrType == TMR_TYPE_PERIODIC) /* Is a periodic timer? */
|
||||
{
|
||||
/* Yes,remove this timer from timer list */
|
||||
RemoveTmrList(pTmr->tmrID);
|
||||
pTmr->tmrCnt = pTmr->tmrReload; /* Reset timer tick */
|
||||
InsertTmrList(pTmr->tmrID); /* Insert timer into timer list */
|
||||
(pTmr->tmrCallBack)(); /* Call timer callback function */
|
||||
}
|
||||
pTmr = TmrList; /* Get first item of timer list */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Timer counter dispose in ISR
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to dispose timer counter.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void isr_TmrDispose(void)
|
||||
{
|
||||
if(OSSchedLock > 1) /* Is schedule lock? */
|
||||
{
|
||||
IsrReq = Co_TRUE;
|
||||
TimerReq = Co_TRUE; /* Yes,set timer request true */
|
||||
}
|
||||
else
|
||||
{
|
||||
TmrDispose(); /* No,call handler */
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,86 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file utility.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Utility management implementation code of CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
|
||||
#if CFG_UTILITY_EN > 0
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Convert tick number to time
|
||||
* @param[in] ticks Specifies the systerm tick numbers that will be converted.
|
||||
* @param[out] hour Hours which converted.
|
||||
* @param[out] minute minutes which converted.
|
||||
* @param[out] sec seconds which converted.
|
||||
* @param[out] millsec millseconds which converted.
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to convert specify ticks to time format.
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_TICK_TO_TIME_EN > 0
|
||||
void CoTickToTime(U32 ticks,U8* hour,U8* minute,U8* sec,U16* millsec)
|
||||
{
|
||||
U32 totalTime;
|
||||
|
||||
/* Convert ticks to time*/
|
||||
totalTime = ticks * (1000/CFG_SYSTICK_FREQ);
|
||||
*millsec = totalTime%1000;
|
||||
totalTime = totalTime/1000;
|
||||
*sec = totalTime%60;
|
||||
totalTime = totalTime/60;
|
||||
*minute = totalTime%60;
|
||||
totalTime = totalTime/60;
|
||||
*hour = totalTime;
|
||||
}
|
||||
#endif /* CFG_TICK_TO_TIME_EN */
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief Convert time to tick
|
||||
* @param[in] hour Specifies the number of hours.
|
||||
* @param[in] minute Specifies the number of minutes.
|
||||
* @param[in] sec Specifies the number of seconds.
|
||||
* @param[in] millsec Specifies the number of millseconds.
|
||||
* @param[out] ticks Tick numbers that converted.
|
||||
* @retval E_INVALID_PARAMETER Invalid parameter be passed and convert fail.
|
||||
* @retval E_OK Convert successful.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to convert specify time to tick number.
|
||||
*******************************************************************************
|
||||
*/
|
||||
#if CFG_TIME_TO_TICK_EN > 0
|
||||
StatusType CoTimeToTick(U8 hour,U8 minute,U8 sec,U16 millsec,U32* ticks)
|
||||
{
|
||||
#if CFG_PAR_CHECKOUT_EN >0
|
||||
/* Validate arguments to be within range */
|
||||
if((minute > 59)||(sec > 59)||(millsec > 999))
|
||||
return E_INVALID_PARAMETER;
|
||||
#endif
|
||||
|
||||
/* Convert time to ticks */
|
||||
*ticks = ((hour*3600) + (minute*60) + (sec)) * (CFG_SYSTICK_FREQ)\
|
||||
+ (millsec*CFG_SYSTICK_FREQ + 500)/1000;
|
||||
return E_OK;
|
||||
}
|
||||
#endif /* CFG_TIME_TO_TICK_EN */
|
||||
|
||||
#endif /* CFG_UTILITY_EN */
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file utility.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Utility function header file
|
||||
* @details This file including some defines and declares related to utility
|
||||
* function.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _UTILITY_H
|
||||
#define _UTILITY_H
|
||||
|
||||
|
||||
/**
|
||||
* @struct Time struct utility.h
|
||||
* @brief Time struct
|
||||
* @details This struct use to manage time
|
||||
*/
|
||||
typedef struct SysTime
|
||||
{
|
||||
U8 sec; /*!< Second */
|
||||
U8 min; /*!< Minute */
|
||||
U8 hour; /*!< Hour */
|
||||
U8 date; /*!< Date */
|
||||
U8 month; /*!< Month */
|
||||
U16 year; /*!< Year */
|
||||
}TIME;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file prot.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Compiler adapter for CooCox CoOS kernel.
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2010 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include "coocox.h"
|
||||
|
||||
|
||||
//******************************************************************************
|
||||
// EQUATES
|
||||
//******************************************************************************
|
||||
U32 NVIC_INT_CTRL = 0xE000ED04; // Interrupt control state register
|
||||
U32 NVIC_PENDSVSET = 0x10000000; // Value to trigger PendSV exception
|
||||
U32 INT_EXIT = 0xFFFFFFFC;
|
||||
|
||||
//******************************************************************************
|
||||
// PUBLIC FUNCTIONS
|
||||
//******************************************************************************
|
||||
extern U8 Inc8(volatile U8 *data) ;
|
||||
extern U8 Dec8(volatile U8 *data) ;
|
||||
extern void IRQ_ENABLE_RESTORE(void);
|
||||
extern void IRQ_DISABLE_SAVE(void);
|
||||
extern void SetEnvironment(OS_STK *pstk) __attribute__ ((naked));
|
||||
extern void SwitchContext(void) __attribute__ ((naked));
|
||||
extern void PendSV_Handler(void) __attribute__ ((naked));
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Plus a byte integers and Saved into memory cell
|
||||
* @param[in] data byte integers.
|
||||
* @param[out] None
|
||||
* @retval Returns Original value.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Plus a byte integers
|
||||
* and Saved into memory cell.
|
||||
******************************************************************************
|
||||
*/
|
||||
U8 Inc8 (volatile U8 *data)
|
||||
{
|
||||
register U8 result = 0;
|
||||
|
||||
__asm volatile
|
||||
(
|
||||
" PUSH {R1} \n"
|
||||
" CPSID I \n"
|
||||
" LDRB R1,[%1] \n"
|
||||
" ADD R1,#1 \n"
|
||||
" STRB R1,[%1] \n"
|
||||
" CPSIE I \n"
|
||||
" SUB R1,#0x1 \n"
|
||||
" MOVS %0,R1 \n"
|
||||
" POP {R1} \n"
|
||||
:"=r"(result)
|
||||
:"r"(data)
|
||||
);
|
||||
return (result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Decrease a byte integers and Saved into memory cell
|
||||
* @param[in] data byte integers.
|
||||
* @param[out] None
|
||||
* @retval Returns Original value.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Decrease a byte integers
|
||||
* and Saved into memory cell.
|
||||
******************************************************************************
|
||||
*/
|
||||
U8 Dec8 (volatile U8 *data)
|
||||
{
|
||||
register U8 result = 0;
|
||||
__asm volatile
|
||||
(
|
||||
" PUSH {R1} \n"
|
||||
" CPSID I \n"
|
||||
" LDRB R1,[%1] \n"
|
||||
" SUB R1,#1 \n"
|
||||
" STRB R1,[%1] \n"
|
||||
" CPSIE I \n"
|
||||
" MOVS %0,R1 \n"
|
||||
" POP {R1} \n"
|
||||
:"=r"(result)
|
||||
:"r"(data)
|
||||
);
|
||||
return (result);
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief ENABLE Interrupt
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to ENABLE Interrupt.
|
||||
******************************************************************************
|
||||
*/
|
||||
void IRQ_ENABLE_RESTORE(void)
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" CPSIE I \n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Close Interrupt
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to close Interrupt.
|
||||
******************************************************************************
|
||||
*/
|
||||
void IRQ_DISABLE_SAVE(void)
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" CPSID I \n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Set environment for Coocox OS running
|
||||
* @param[in] pstk stack pointer
|
||||
* @param[out] None
|
||||
* @retval None.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Set environment
|
||||
* for Coocox OS running.
|
||||
******************************************************************************
|
||||
*/
|
||||
void SetEnvironment (OS_STK *pstk)
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" SUB R0,#28 \n"
|
||||
" MSR PSP,R0 \n"
|
||||
" BX LR \n"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Do ready work to Switch Context for task change
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Do ready work to
|
||||
* Switch Context for task change
|
||||
******************************************************************************
|
||||
*/
|
||||
void SwitchContext(void)
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" LDR R3,=NVIC_INT_CTRL \n"
|
||||
" LDR R3,[R3] \n"
|
||||
" LDR R2,=NVIC_PENDSVSET \n"
|
||||
" LDR R1,[R2] \n"
|
||||
" STR R1, [R3] \n"
|
||||
" BX LR \n"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Switch Context for task change
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to Switch Context for task change.
|
||||
******************************************************************************
|
||||
*/
|
||||
#if CFG_CHIP_TYPE == 2
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
__asm volatile
|
||||
(
|
||||
" LDR R3,=TCBRunning \n"
|
||||
" LDR R1,[R3] \n" // R1 == running tcb
|
||||
" LDR R2,=TCBNext \n"
|
||||
" LDR R2,[R2] \n" // R2 == next tcb
|
||||
|
||||
" CMP R1,R2 \n"
|
||||
" BEQ exitPendSV \n"
|
||||
" MRS R0, PSP \n" // Get PSP point (can not use PUSH,in ISR,SP is MSP )
|
||||
|
||||
" SUB R0,R0,#32 \n"
|
||||
" STR R0,[R1] \n" // Save orig PSP
|
||||
// Store r4-r11,r0 -= regCnt * 4,r0 is new stack
|
||||
// top point (addr h->l r11,r10,...,r5,r4)
|
||||
" STMIA R0!,{R4-R7} \n" // Save old context (R4-R7)
|
||||
" MOV R4,R8 \n"
|
||||
" MOV R5,R9 \n"
|
||||
" MOV R6,R10 \n"
|
||||
" MOV R7,R11 \n"
|
||||
" STMIA R0!,{R4-R7} \n" // Save old context (R8-R11)
|
||||
|
||||
" popStk: \n"
|
||||
" STR R2, [R3] \n" // TCBRunning = TCBNext;
|
||||
" LDR R0, [R2] \n" // Get SP of task that be switch into.
|
||||
|
||||
" ADD R0,R0,#16 \n"
|
||||
" LDMIA R0!,{R4-R7} \n" // Restore new Context (R8-R11)
|
||||
" MOV R8,R4 \n"
|
||||
" MOV R9,R5 \n"
|
||||
" MOV R10,R6 \n"
|
||||
" MOV R11,R7 \n"
|
||||
" SUB R0,R0,#32 \n"
|
||||
" LDMIA R0!,{R4-R7} \n" // Restore new Context (R4-R7)
|
||||
" ADD R0,R0,#16 \n"
|
||||
" MSR PSP, R0 \n" // Mov new stack point to PSP
|
||||
|
||||
" exitPendSV: \n"
|
||||
" LDR R3,=OSSchedLock \n"
|
||||
" MOV R0, #0x0 \n"
|
||||
" STRB R0, [R3] \n"
|
||||
|
||||
" LDR R3,=INT_EXIT \n"
|
||||
" LDR R0, [R3] \n"
|
||||
" BX R0 \n" // Exit interrupt
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_CHIP_TYPE == 1
|
||||
void PendSV_Handler(void)
|
||||
{
|
||||
////////debug block /////////////////////////
|
||||
__asm volatile
|
||||
(
|
||||
" LDR R3,=TCBRunning \n"
|
||||
" LDR R1,[R3] \n" // R1 == running tcb
|
||||
" LDR R2,=TCBNext \n"
|
||||
" LDR R2,[R2] \n" // R2 == next tcb
|
||||
|
||||
" CMP R1,R2 \n"
|
||||
" BEQ exitPendSV \n"
|
||||
|
||||
" MRS R0, PSP \n" // Get PSP point (can not use PUSH,in ISR,SP is MSP )
|
||||
" STMDB R0!,{R4-R11} \n" // Store r4-r11,r0 -= regCnt * 4,r0 is new stack
|
||||
// top point (addr h->l r11,r10,...,r5,r4)
|
||||
" STR R0,[R1] \n" // Save orig PSP
|
||||
|
||||
" STR R2, [R3] \n" // TCBRunning = TCBNext;
|
||||
" LDR R0, [R2] \n" // Get SP of task that be switch into.
|
||||
" LDMIA R0!,{R4-R11} \n" // POP {R4-R11},R0 += regCnt * 4
|
||||
" MSR PSP, R0 \n" // Mov new stack point to PSP
|
||||
|
||||
|
||||
" exitPendSV: \n"
|
||||
" LDR R3,=OSSchedLock\n"
|
||||
" MOVS R0, #0x0 \n"
|
||||
" STRB R0, [R3] \n"
|
||||
" ORR LR,LR,#0x04 \n" // Ensure exception return uses process stack
|
||||
" BX LR \n" // Exit interrupt
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file OsArch.h
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief Implement function declare related to Cortex-M3(ARM-v7)
|
||||
* @details This header file including functions or defines related to
|
||||
* Cortex-M3(ARM-v7).
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
*
|
||||
* INTERNAL FILE,DON'T PUBLIC.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _CPU_H
|
||||
#define _CPU_H
|
||||
|
||||
|
||||
#define NVIC_ST_CTRL (*((volatile U32 *)0xE000E010))
|
||||
#define NVIC_ST_RELOAD (*((volatile U32 *)0xE000E014))
|
||||
#define RELOAD_VAL ((U32)(( (U32)CFG_CPU_FREQ) / (U32)CFG_SYSTICK_FREQ) -1)
|
||||
|
||||
/*!< Initial System tick. */
|
||||
#define InitSysTick() NVIC_ST_RELOAD = RELOAD_VAL; \
|
||||
NVIC_ST_CTRL = 0x0007
|
||||
|
||||
#define NVIC_SYS_PRI2 (*((volatile U32 *)0xE000ED1C))
|
||||
#define NVIC_SYS_PRI3 (*((volatile U32 *)0xE000ED20))
|
||||
|
||||
/*!< Initialize PendSV,SVC and SysTick interrupt priority to lowest. */
|
||||
#define InitInt() NVIC_SYS_PRI2 |= 0xFF000000;\
|
||||
NVIC_SYS_PRI3 |= 0xFFFF0000
|
||||
|
||||
|
||||
/*---------------------------- Variable declare ------------------------------*/
|
||||
extern U64 OSTickCnt; /*!< Counter for current system ticks. */
|
||||
|
||||
/*!< Initial context of task being created */
|
||||
extern OS_STK *InitTaskContext(FUNCPtr task,void *param,OS_STK *pstk);
|
||||
extern void SwitchContext(void); /*!< Switch context */
|
||||
extern void SetEnvironment(OS_STK *pstk);/*!< Set environment for run */
|
||||
extern U8 Inc8 (volatile U8 *data);
|
||||
extern U8 Dec8 (volatile U8 *data);
|
||||
extern void IRQ_ENABLE_RESTORE(void);
|
||||
extern void IRQ_DISABLE_SAVE(void);
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file arch.c
|
||||
* @version V1.1.4
|
||||
* @date 2011.04.20
|
||||
* @brief This file provides InitTaskContext() and SysTick_Handler().
|
||||
*******************************************************************************
|
||||
* @copy
|
||||
* WRITE COPY INFORMATION USE CAPITAL LETTER
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2009 CooCox </center></h2>
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
/*---------------------------- Include ---------------------------------------*/
|
||||
#include <coocox.h>
|
||||
U64 OSTickCnt = 0; /*!< Current system tick counter */
|
||||
|
||||
/**
|
||||
******************************************************************************
|
||||
* @brief Initial task context
|
||||
* @param[in] task Entry point of task.
|
||||
* @param[in] param The parameter pass to task.
|
||||
* @param[in] pstk The pointer to stack top.
|
||||
* @param[out] None
|
||||
* @retval Returns location of new stack top.
|
||||
*
|
||||
* @par Description
|
||||
* @details This function is called to initialize the stack frame of the
|
||||
* task being created.
|
||||
******************************************************************************
|
||||
*/
|
||||
OS_STK *InitTaskContext(FUNCPtr task,void *param,OS_STK *pstk)
|
||||
{
|
||||
OS_STK *context;
|
||||
context = pstk;
|
||||
*(context--) = (U32)0x01000000L; /* xPSR */
|
||||
*(context--) = (U32)task; /* Entry point of task. */
|
||||
*(context) = (U32)0xFFFFFFFEL;
|
||||
context = context - 5;
|
||||
*(context) = (U32)param; /* R0: argument */
|
||||
context = context - 8;
|
||||
|
||||
return (context); /* Returns location of new stack top. */
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @brief System tick interrupt handler.
|
||||
* @param[in] None
|
||||
* @param[out] None
|
||||
* @retval None
|
||||
*
|
||||
* @par Description
|
||||
* @details This is system tick interrupt headler.
|
||||
* @note CoOS may schedule when exiting this ISR.
|
||||
*******************************************************************************
|
||||
*/
|
||||
void SysTick_Handler(void)
|
||||
{
|
||||
OSSchedLock++; /* Lock scheduler. */
|
||||
OSTickCnt++; /* Increment systerm time. */
|
||||
#if CFG_TASK_WAITTING_EN >0
|
||||
if(DlyList != Co_NULL) /* Have task in delay list? */
|
||||
{
|
||||
if(DlyList->delayTick > 1) /* Delay time > 1? */
|
||||
{
|
||||
DlyList->delayTick--; /* Decrease delay time of the list head. */
|
||||
}
|
||||
else
|
||||
{
|
||||
DlyList->delayTick = 0;
|
||||
isr_TimeDispose(); /* Call hander for delay time list */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if CFG_TMR_EN > 0
|
||||
if(TmrList != Co_NULL) /* Have timer in working? */
|
||||
{
|
||||
if(TmrList->tmrCnt > 1) /* Timer time > 1? */
|
||||
{
|
||||
TmrList->tmrCnt--; /* Decrease timer time of the list head. */
|
||||
}
|
||||
else
|
||||
{
|
||||
TmrList->tmrCnt = 0;
|
||||
isr_TmrDispose(); /* Call hander for timer list */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
TaskSchedReq = Co_TRUE;
|
||||
OsSchedUnlock();
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
FatFs Module Source Files R0.09 (C)ChaN, 2011
|
||||
|
||||
|
||||
FILES
|
||||
|
||||
ffconf.h Configuration file for FatFs module.
|
||||
ff.h Common include file for FatFs and application module.
|
||||
ff.c FatFs module.
|
||||
diskio.h Common include file for FatFs and disk I/O module.
|
||||
integer.h Alternative type definitions for integer variables.
|
||||
option Optional external functions.
|
||||
|
||||
Low level disk I/O module is not included in this archive because the FatFs
|
||||
module is only a generic file system layer and not depend on any specific
|
||||
storage device. You have to provide a low level disk I/O module that written
|
||||
to control your storage device.
|
||||
|
||||
|
||||
|
||||
AGREEMENTS
|
||||
|
||||
FatFs module is an open source software to implement FAT file system to
|
||||
small embedded systems. This is a free software and is opened for education,
|
||||
research and commercial developments under license policy of following trems.
|
||||
|
||||
Copyright (C) 2011, ChaN, all right reserved.
|
||||
|
||||
* The FatFs module is a free software and there is NO WARRANTY.
|
||||
* No restriction on use. You can use, modify and redistribute it for
|
||||
personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
|
||||
* Redistributions of source code must retain the above copyright notice.
|
||||
|
||||
|
||||
|
||||
REVISION HISTORY
|
||||
|
||||
Feb 26, 2006 R0.00 Prototype
|
||||
|
||||
Apr 29, 2006 R0.01 First release.
|
||||
|
||||
Jun 01, 2006 R0.02 Added FAT12.
|
||||
Removed unbuffered mode.
|
||||
Fixed a problem on small (<32M) patition.
|
||||
|
||||
Jun 10, 2006 R0.02a Added a configuration option _FS_MINIMUM.
|
||||
|
||||
Sep 22, 2006 R0.03 Added f_rename.
|
||||
Changed option _FS_MINIMUM to _FS_MINIMIZE.
|
||||
|
||||
Dec 11, 2006 R0.03a Improved cluster scan algolithm to write files fast.
|
||||
Fixed f_mkdir creates incorrect directory on FAT32.
|
||||
|
||||
Feb 04, 2007 R0.04 Supported multiple drive system. (FatFs)
|
||||
Changed some APIs for multiple drive system.
|
||||
Added f_mkfs. (FatFs)
|
||||
Added _USE_FAT32 option. (Tiny-FatFs)
|
||||
|
||||
Apr 01, 2007 R0.04a Supported multiple partitions on a plysical drive. (FatFs)
|
||||
Fixed an endian sensitive code in f_mkfs. (FatFs)
|
||||
Added a capability of extending the file size to f_lseek.
|
||||
Added minimization level 3.
|
||||
Fixed a problem that can collapse a sector when recreate an
|
||||
existing file in any sub-directory at non FAT32 cfg. (Tiny-FatFs)
|
||||
|
||||
May 05, 2007 R0.04b Added _USE_NTFLAG option.
|
||||
Added FSInfo support.
|
||||
Fixed some problems corresponds to FAT32. (Tiny-FatFs)
|
||||
Fixed DBCS name can result FR_INVALID_NAME.
|
||||
Fixed short seek (0 < ofs <= csize) collapses the file object.
|
||||
|
||||
Aug 25, 2007 R0.05 Changed arguments of f_read, f_write.
|
||||
Changed arguments of f_mkfs. (FatFs)
|
||||
Fixed f_mkfs on FAT32 creates incorrect FSInfo. (FatFs)
|
||||
Fixed f_mkdir on FAT32 creates incorrect directory. (FatFs)
|
||||
|
||||
Feb 03, 2008 R0.05a Added f_truncate().
|
||||
Added f_utime().
|
||||
Fixed off by one error at FAT sub-type determination.
|
||||
Fixed btr in f_read() can be mistruncated.
|
||||
Fixed cached sector is not flushed when create and close without write.
|
||||
|
||||
Apr 01, 2008 R0.06 Added f_forward(). (Tiny-FatFs)
|
||||
Added string functions: fputc(), fputs(), fprintf() and fgets().
|
||||
Improved performance of f_lseek() on move to the same or following cluster.
|
||||
|
||||
Apr 01, 2009, R0.07 Merged Tiny-FatFs as a buffer configuration option.
|
||||
Added long file name support.
|
||||
Added multiple code page support.
|
||||
Added re-entrancy for multitask operation.
|
||||
Added auto cluster size selection to f_mkfs().
|
||||
Added rewind option to f_readdir().
|
||||
Changed result code of critical errors.
|
||||
Renamed string functions to avoid name collision.
|
||||
|
||||
Apr 14, 2009, R0.07a Separated out OS dependent code on reentrant cfg.
|
||||
Added multiple sector size support.
|
||||
|
||||
Jun 21, 2009, R0.07c Fixed f_unlink() may return FR_OK on error.
|
||||
Fixed wrong cache control in f_lseek().
|
||||
Added relative path feature.
|
||||
Added f_chdir().
|
||||
Added f_chdrive().
|
||||
Added proper case conversion for extended characters.
|
||||
|
||||
Nov 03, 2009 R0.07e Separated out configuration options from ff.h to ffconf.h.
|
||||
Added a configuration option, _LFN_UNICODE.
|
||||
Fixed f_unlink() fails to remove a sub-dir on _FS_RPATH.
|
||||
Fixed name matching error on the 13 char boundary.
|
||||
Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
|
||||
|
||||
May 15, 2010, R0.08 Added a memory configuration option. (_USE_LFN)
|
||||
Added file lock feature. (_FS_SHARE)
|
||||
Added fast seek feature. (_USE_FASTSEEK)
|
||||
Changed some types on the API, XCHAR->TCHAR.
|
||||
Changed fname member in the FILINFO structure on Unicode cfg.
|
||||
String functions support UTF-8 encoding files on Unicode cfg.
|
||||
|
||||
Aug 16,'10 R0.08a Added f_getcwd(). (_FS_RPATH = 2)
|
||||
Added sector erase feature. (_USE_ERASE)
|
||||
Moved file lock semaphore table from fs object to the bss.
|
||||
Fixed a wrong directory entry is created on non-LFN cfg when the given name contains ';'.
|
||||
Fixed f_mkfs() creates wrong FAT32 volume.
|
||||
|
||||
Jan 15,'11 R0.08b Fast seek feature is also applied to f_read() and f_write().
|
||||
f_lseek() reports required table size on creating CLMP.
|
||||
Extended format syntax of f_printf function.
|
||||
Ignores duplicated directory separators in given path names.
|
||||
|
||||
Sep 06,'11 R0.09 f_mkfs() supports multiple partition to finish the multiple partition feature.
|
||||
Added f_fdisk(). (_MULTI_PARTITION = 2)
|
||||
@@ -1,53 +1,14 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny <shadow@privy.de>
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* open9x is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/*-----------------------------------------------------------------------
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2010
|
||||
/ Low level disk interface modlue include file
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DEF_DISKIO
|
||||
#define DEF_DISKIO
|
||||
#ifndef _DISKIO
|
||||
|
||||
#define _READONLY 0 /* 1: Remove write functions */
|
||||
#define _USE_IOCTL 1 /* 1: Use disk_ioctl fucntion */
|
||||
|
||||
#include "integer.h"
|
||||
|
||||
#define DN_MCI 0 /* Physical drive number for MCI */
|
||||
#define DN_NAND 1 /* Physical drive number for NAND flash */
|
||||
|
||||
|
||||
/* These functions are defined in asmfunc.S */
|
||||
void Copy_al2un (BYTE *dst, const DWORD *src, int count); /* Copy aligned to unaligned. */
|
||||
void Copy_un2al (DWORD *dst, const BYTE *src, int count); /* Copy unaligned to aligned. */
|
||||
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
@@ -65,12 +26,22 @@ typedef enum {
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int assign_drives (int, int);
|
||||
DSTATUS disk_initialize (BYTE);
|
||||
DSTATUS disk_status (BYTE);
|
||||
DRESULT disk_read (BYTE, BYTE*, DWORD, BYTE);
|
||||
#if _READONLY == 0
|
||||
DRESULT disk_write (BYTE, const BYTE*, DWORD, BYTE);
|
||||
DRESULT disk_ioctl (BYTE, BYTE, BYTE*);
|
||||
void disk_timerproc (void);
|
||||
#endif
|
||||
DRESULT disk_ioctl (BYTE, BYTE, void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
@@ -82,14 +53,14 @@ void disk_timerproc (void);
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic ioctl command (defined for FatFs) */
|
||||
/* Generic command (defined for FatFs) */
|
||||
#define CTRL_SYNC 0 /* Flush disk cache (for write functions) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (for only f_mkfs()) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (for multiple sector size (_MAX_SS >= 1024)) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (for only f_mkfs()) */
|
||||
#define CTRL_ERASE_SECTOR 4 /* Force erased a block of sectors (for only _USE_ERASE) */
|
||||
|
||||
/* Generic ioctl command */
|
||||
/* Generic command */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
@@ -110,6 +81,5 @@ void disk_timerproc (void);
|
||||
#define NAND_FORMAT 30 /* Create physical format */
|
||||
|
||||
|
||||
volatile extern BYTE Timer1, Timer2; /* 100Hz decrement timer */
|
||||
|
||||
#define _DISKIO
|
||||
#endif
|
||||
@@ -1,42 +1,53 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny <shadow@privy.de>
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* open9x is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
void init_SDcard()
|
||||
{
|
||||
#ifndef SIMU
|
||||
configure_pins( 0xFC000000, PIN_PERIPHERAL | PIN_INPUT | PIN_PER_C | PIN_PORTA | PIN_NO_PULLUP ) ;
|
||||
configure_pins( PIO_PB7, PIN_INPUT | PIN_PORTB | PIN_NO_PULLUP | PIN_NO_PULLDOWN ) ;
|
||||
SD_Init() ;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "integer.h"
|
||||
#include "../rtc.h"
|
||||
|
||||
DWORD get_fattime(void)
|
||||
{
|
||||
struct gtm t;
|
||||
|
||||
gettime(&t);
|
||||
|
||||
/* Pack date and time into a DWORD variable */
|
||||
return ((DWORD)(t.tm_year - 80) << 25)
|
||||
| ((uint32_t)(t.tm_mon+1) << 21)
|
||||
| ((uint32_t)t.tm_mday << 16)
|
||||
| ((uint32_t)t.tm_hour << 11)
|
||||
| ((uint32_t)t.tm_min << 5)
|
||||
| ((uint32_t)t.tm_sec >> 1);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+337
@@ -0,0 +1,337 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module include file R0.09 (C)ChaN, 2011
|
||||
/----------------------------------------------------------------------------/
|
||||
/ FatFs module is a generic FAT file system module for small embedded systems.
|
||||
/ This is a free software that opened for education, research and commercial
|
||||
/ developments under license policy of following trems.
|
||||
/
|
||||
/ Copyright (C) 2011, ChaN, all right reserved.
|
||||
/
|
||||
/ * The FatFs module is a free software and there is NO WARRANTY.
|
||||
/ * No restriction on use. You can use, modify and redistribute it for
|
||||
/ personal, non-profit or commercial product UNDER YOUR RESPONSIBILITY.
|
||||
/ * Redistributions of source code must retain the above copyright notice.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _FATFS
|
||||
#define _FATFS 6502 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "integer.h" /* Basic integer types */
|
||||
#include "ffconf.h" /* FatFs configuration options */
|
||||
|
||||
#if _FATFS != _FFCONF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Definitions of volume management */
|
||||
|
||||
#if _MULTI_PARTITION /* Multiple partition configuration */
|
||||
typedef struct {
|
||||
BYTE pd; /* Physical drive number */
|
||||
BYTE pt; /* Partition: 0:Auto detect, 1-4:Forced partition) */
|
||||
} PARTITION;
|
||||
extern PARTITION VolToPart[]; /* Volume - Partition resolution table */
|
||||
#define LD2PD(vol) (VolToPart[vol].pd) /* Get physical drive number */
|
||||
#define LD2PT(vol) (VolToPart[vol].pt) /* Get partition index */
|
||||
|
||||
#else /* Single partition configuration */
|
||||
#define LD2PD(vol) (vol) /* Each logical drive is bound to the same physical drive number */
|
||||
#define LD2PT(vol) 0 /* Always mounts the 1st partition or in SFD */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of path name strings on FatFs API */
|
||||
|
||||
#if _LFN_UNICODE /* Unicode string */
|
||||
#if !_USE_LFN
|
||||
#error _LFN_UNICODE must be 0 in non-LFN cfg.
|
||||
#endif
|
||||
#ifndef _INC_TCHAR
|
||||
typedef WCHAR TCHAR;
|
||||
#define _T(x) L ## x
|
||||
#define _TEXT(x) L ## x
|
||||
#endif
|
||||
|
||||
#else /* ANSI/OEM string */
|
||||
#ifndef _INC_TCHAR
|
||||
typedef char TCHAR;
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* File system object structure (FATFS) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fs_type; /* FAT sub-type (0:Not mounted) */
|
||||
BYTE drv; /* Physical drive number */
|
||||
BYTE csize; /* Sectors per cluster (1,2,4...128) */
|
||||
BYTE n_fats; /* Number of FAT copies (1,2) */
|
||||
BYTE wflag; /* win[] dirty flag (1:must be written back) */
|
||||
BYTE fsi_flag; /* fsinfo dirty flag (1:must be written back) */
|
||||
WORD id; /* File system mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
#if _MAX_SS != 512
|
||||
WORD ssize; /* Bytes per sector (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if _FS_REENTRANT
|
||||
_SYNC_t sobj; /* Identifier of sync object */
|
||||
#endif
|
||||
#if !_FS_READONLY
|
||||
DWORD last_clust; /* Last allocated cluster */
|
||||
DWORD free_clust; /* Number of free clusters */
|
||||
DWORD fsi_sector; /* fsinfo sector (FAT32) */
|
||||
#endif
|
||||
#if _FS_RPATH
|
||||
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||
#endif
|
||||
DWORD n_fatent; /* Number of FAT entries (= number of clusters + 2) */
|
||||
DWORD fsize; /* Sectors per FAT */
|
||||
DWORD fatbase; /* FAT start sector */
|
||||
DWORD dirbase; /* Root directory start sector (FAT32:Cluster#) */
|
||||
DWORD database; /* Data start sector */
|
||||
DWORD winsect; /* Current sector appearing in the win[] */
|
||||
BYTE win[_MAX_SS]; /* Disk access window for Directory, FAT (and Data on tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* File object structure (FIL) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
WORD id; /* Owner file system mount ID */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE pad1;
|
||||
DWORD fptr; /* File read/write pointer (0 on file open) */
|
||||
DWORD fsize; /* File size */
|
||||
DWORD sclust; /* File start cluster (0 when fsize==0) */
|
||||
DWORD clust; /* Current cluster */
|
||||
DWORD dsect; /* Current data sector */
|
||||
#if !_FS_READONLY
|
||||
DWORD dir_sect; /* Sector containing the directory entry */
|
||||
BYTE* dir_ptr; /* Ponter to the directory entry in the window */
|
||||
#endif
|
||||
#if _USE_FASTSEEK
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (null on file open) */
|
||||
#endif
|
||||
#if _FS_SHARE
|
||||
UINT lockid; /* File lock ID (index of file semaphore table) */
|
||||
#endif
|
||||
#if !_FS_TINY
|
||||
BYTE buf[_MAX_SS]; /* File data read/write buffer */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
|
||||
|
||||
/* Directory object structure (DIR) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the owner file system object */
|
||||
WORD id; /* Owner file system mount ID */
|
||||
WORD index; /* Current read/write index number */
|
||||
DWORD sclust; /* Table start cluster (0:Root dir) */
|
||||
DWORD clust; /* Current cluster */
|
||||
DWORD sect; /* Current sector */
|
||||
BYTE* dir; /* Pointer to the current SFN entry in the win[] */
|
||||
BYTE* fn; /* Pointer to the SFN (in/out) {file[8],ext[3],status[1]} */
|
||||
#if _USE_LFN
|
||||
WCHAR* lfn; /* Pointer to the LFN working buffer */
|
||||
WORD lfn_idx; /* Last matched LFN index number (0xFFFF:No LFN) */
|
||||
#endif
|
||||
} DIR;
|
||||
|
||||
|
||||
|
||||
/* File status structure (FILINFO) */
|
||||
|
||||
typedef struct {
|
||||
DWORD fsize; /* File size */
|
||||
WORD fdate; /* Last modified date */
|
||||
WORD ftime; /* Last modified time */
|
||||
BYTE fattrib; /* Attribute */
|
||||
TCHAR fname[13]; /* Short file name (8.3 format) */
|
||||
#if _USE_LFN
|
||||
TCHAR* lfname; /* Pointer to the LFN buffer */
|
||||
UINT lfsize; /* Size of LFN buffer in TCHAR */
|
||||
#endif
|
||||
} FILINFO;
|
||||
|
||||
|
||||
|
||||
/* File function return code (FRESULT) */
|
||||
|
||||
typedef enum {
|
||||
FR_OK = 0, /* (0) Succeeded */
|
||||
FR_DISK_ERR, /* (1) A hard error occured in the low level disk I/O layer */
|
||||
FR_INT_ERR, /* (2) Assertion failed */
|
||||
FR_NOT_READY, /* (3) The physical drive cannot work */
|
||||
FR_NO_FILE, /* (4) Could not find the file */
|
||||
FR_NO_PATH, /* (5) Could not find the path */
|
||||
FR_INVALID_NAME, /* (6) The path name format is invalid */
|
||||
FR_DENIED, /* (7) Acces denied due to prohibited access or directory full */
|
||||
FR_EXIST, /* (8) Acces denied due to prohibited access */
|
||||
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
|
||||
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
|
||||
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* (13) There is no valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* (14) The f_mkfs() aborted due to any parameter error */
|
||||
FR_TIMEOUT, /* (15) Could not get a grant to access the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file shareing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > _FS_SHARE */
|
||||
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs module application interface */
|
||||
|
||||
FRESULT f_mount (BYTE, FATFS*); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_open (FIL*, const TCHAR*, BYTE); /* Open or create a file */
|
||||
FRESULT f_read (FIL*, void*, UINT, UINT*); /* Read data from a file */
|
||||
FRESULT f_lseek (FIL*, DWORD); /* Move file pointer of a file object */
|
||||
FRESULT f_close (FIL*); /* Close an open file object */
|
||||
FRESULT f_opendir (DIR*, const TCHAR*); /* Open an existing directory */
|
||||
FRESULT f_readdir (DIR*, FILINFO*); /* Read a directory item */
|
||||
FRESULT f_stat (const TCHAR*, FILINFO*); /* Get file status */
|
||||
FRESULT f_write (FIL*, const void*, UINT, UINT*); /* Write data to a file */
|
||||
FRESULT f_getfree (const TCHAR*, DWORD*, FATFS**); /* Get number of free clusters on the drive */
|
||||
FRESULT f_truncate (FIL*); /* Truncate file */
|
||||
FRESULT f_sync (FIL*); /* Flush cached data of a writing file */
|
||||
FRESULT f_unlink (const TCHAR*); /* Delete an existing file or directory */
|
||||
FRESULT f_mkdir (const TCHAR*); /* Create a new directory */
|
||||
FRESULT f_chmod (const TCHAR*, BYTE, BYTE); /* Change attriburte of the file/dir */
|
||||
FRESULT f_utime (const TCHAR*, const FILINFO*); /* Change timestamp of the file/dir */
|
||||
FRESULT f_rename (const TCHAR*, const TCHAR*); /* Rename/Move a file or directory */
|
||||
FRESULT f_chdrive (BYTE); /* Change current drive */
|
||||
FRESULT f_chdir (const TCHAR*); /* Change current directory */
|
||||
FRESULT f_getcwd (TCHAR*, UINT); /* Get current directory */
|
||||
FRESULT f_forward (FIL*, UINT(*)(const BYTE*,UINT), UINT, UINT*); /* Forward data to the stream */
|
||||
FRESULT f_mkfs (BYTE, BYTE, UINT); /* Create a file system on the drive */
|
||||
FRESULT f_fdisk (BYTE, const DWORD[], void*); /* Divide a physical drive into some partitions */
|
||||
int f_putc (TCHAR, FIL*); /* Put a character to the file */
|
||||
int f_puts (const TCHAR*, FIL*); /* Put a string to the file */
|
||||
int f_printf (FIL*, const TCHAR*, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR*, int, FIL*); /* Get a string from the file */
|
||||
|
||||
#define f_eof(fp) (((fp)->fptr == (fp)->fsize) ? 1 : 0)
|
||||
#define f_error(fp) (((fp)->flag & FA__ERROR) ? 1 : 0)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->fsize)
|
||||
|
||||
#ifndef EOF
|
||||
#define EOF (-1)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Additional user defined functions */
|
||||
|
||||
/* RTC function */
|
||||
#if !_FS_READONLY
|
||||
DWORD get_fattime (void);
|
||||
#endif
|
||||
|
||||
/* Unicode support functions */
|
||||
#if _USE_LFN /* Unicode - OEM code conversion */
|
||||
WCHAR ff_convert (WCHAR, UINT); /* OEM-Unicode bidirectional conversion */
|
||||
WCHAR ff_wtoupper (WCHAR); /* Unicode upper-case conversion */
|
||||
#if _USE_LFN == 3 /* Memory functions */
|
||||
void* ff_memalloc (UINT); /* Allocate memory block */
|
||||
void ff_memfree (void*); /* Free memory block */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Sync functions */
|
||||
#if _FS_REENTRANT
|
||||
int ff_cre_syncobj (BYTE, _SYNC_t*);/* Create a sync object */
|
||||
int ff_req_grant (_SYNC_t); /* Lock sync object */
|
||||
void ff_rel_grant (_SYNC_t); /* Unlock sync object */
|
||||
int ff_del_syncobj (_SYNC_t); /* Delete a sync object */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Flags and offset address */
|
||||
|
||||
|
||||
/* File access control and file status flags (FIL.flag) */
|
||||
|
||||
#define FA_READ 0x01
|
||||
#define FA_OPEN_EXISTING 0x00
|
||||
#define FA__ERROR 0x80
|
||||
|
||||
#if !_FS_READONLY
|
||||
#define FA_WRITE 0x02
|
||||
#define FA_CREATE_NEW 0x04
|
||||
#define FA_CREATE_ALWAYS 0x08
|
||||
#define FA_OPEN_ALWAYS 0x10
|
||||
#define FA__WRITTEN 0x20
|
||||
#define FA__DIRTY 0x40
|
||||
#endif
|
||||
|
||||
|
||||
/* FAT sub type (FATFS.fs_type) */
|
||||
|
||||
#define FS_FAT12 1
|
||||
#define FS_FAT16 2
|
||||
#define FS_FAT32 3
|
||||
|
||||
|
||||
/* File attribute bits for directory entry */
|
||||
|
||||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_VOL 0x08 /* Volume label */
|
||||
#define AM_LFN 0x0F /* LFN entry */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
#define AM_MASK 0x3F /* Mask of defined bits */
|
||||
|
||||
|
||||
/* Fast seek feature */
|
||||
#define CREATE_LINKMAP 0xFFFFFFFF
|
||||
|
||||
|
||||
|
||||
/*--------------------------------*/
|
||||
/* Multi-byte word access macros */
|
||||
|
||||
#if _WORD_ACCESS == 1 /* Enable word access to the FAT structure */
|
||||
#define LD_WORD(ptr) (WORD)(*(WORD*)(BYTE*)(ptr))
|
||||
#define LD_DWORD(ptr) (DWORD)(*(DWORD*)(BYTE*)(ptr))
|
||||
#define ST_WORD(ptr,val) *(WORD*)(BYTE*)(ptr)=(WORD)(val)
|
||||
#define ST_DWORD(ptr,val) *(DWORD*)(BYTE*)(ptr)=(DWORD)(val)
|
||||
#else /* Use byte-by-byte access to the FAT structure */
|
||||
#define LD_WORD(ptr) (WORD)(((WORD)*((BYTE*)(ptr)+1)<<8)|(WORD)*(BYTE*)(ptr))
|
||||
#define LD_DWORD(ptr) (DWORD)(((DWORD)*((BYTE*)(ptr)+3)<<24)|((DWORD)*((BYTE*)(ptr)+2)<<16)|((WORD)*((BYTE*)(ptr)+1)<<8)|*(BYTE*)(ptr))
|
||||
#define ST_WORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8)
|
||||
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FATFS */
|
||||
@@ -1,38 +1,5 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny <shadow@privy.de>
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* open9x is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ FatFs - FAT file system module configuration file R0.08a (C)ChaN, 2010
|
||||
/ FatFs - FAT file system module configuration file R0.09 (C)ChaN, 2011
|
||||
/----------------------------------------------------------------------------/
|
||||
/
|
||||
/ CAUTION! Do not forget to make clean the project after any changes to
|
||||
@@ -40,14 +7,23 @@
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
#ifndef _FFCONF
|
||||
#define _FFCONF 8255 /* Revision ID */
|
||||
#define _FFCONF 6502 /* Revision ID */
|
||||
|
||||
#if defined(CPUARM) && !defined(SIMU)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "../CoOS/kernel/CoOS.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Function and Buffer Configurations
|
||||
/ Functions and Buffer Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _FS_TINY 1 /* 0:Normal or 1:Tiny */
|
||||
#define _FS_TINY 0 /* 0:Normal or 1:Tiny */
|
||||
/* When _FS_TINY is set to 1, FatFs uses the sector buffer in the file system
|
||||
/ object instead of the sector buffer in the individual file object for file
|
||||
/ data transfer. This reduces memory consumption 512 bytes each file object. */
|
||||
@@ -69,11 +45,11 @@
|
||||
/ 3: f_lseek is removed in addition to 2. */
|
||||
|
||||
|
||||
#define _USE_STRFUNC 1 /* 0:Disable or 1/2:Enable */
|
||||
#define _USE_STRFUNC 1 /* 0:Disable or 1-2:Enable */
|
||||
/* To enable string functions, set _USE_STRFUNC to 1 or 2. */
|
||||
|
||||
|
||||
#define _USE_MKFS 1 /* 0:Disable or 1:Enable */
|
||||
#define _USE_MKFS 1 /* 0:Disable or 1:Enable */
|
||||
/* To enable f_mkfs function, set _USE_MKFS to 1 and set _FS_READONLY to 0 */
|
||||
|
||||
|
||||
@@ -90,7 +66,7 @@
|
||||
/ Locale and Namespace Configurations
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
#define _CODE_PAGE 932
|
||||
#define _CODE_PAGE 1252
|
||||
/* The _CODE_PAGE specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect setting of the code page can cause a file open failure.
|
||||
/
|
||||
@@ -122,9 +98,14 @@
|
||||
/ 1 - ASCII only (Valid for non LFN cfg.)
|
||||
*/
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define _USE_LFN 2 /* 0 to 3 */
|
||||
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
|
||||
#else
|
||||
#define _USE_LFN 1 /* 0 to 3 */
|
||||
#define _MAX_LFN 32 /* Maximum LFN length to handle (12 to 255) */
|
||||
#endif
|
||||
|
||||
#define _USE_LFN 0 /* 0 to 3 */
|
||||
#define _MAX_LFN 255 /* Maximum LFN length to handle (12 to 255) */
|
||||
/* The _USE_LFN option switches the LFN support.
|
||||
/
|
||||
/ 0: Disable LFN feature. _MAX_LFN and _LFN_UNICODE have no effect.
|
||||
@@ -143,7 +124,7 @@
|
||||
/ enable LFN feature and set _LFN_UNICODE to 1. */
|
||||
|
||||
|
||||
#define _FS_RPATH 2 /* 0 to 2 */
|
||||
#define _FS_RPATH 2 /* 0 to 2 */
|
||||
/* The _FS_RPATH option configures relative path feature.
|
||||
/
|
||||
/ 0: Disable relative path feature and remove related functions.
|
||||
@@ -165,19 +146,20 @@
|
||||
#define _MAX_SS 512 /* 512, 1024, 2048 or 4096 */
|
||||
/* Maximum sector size to be handled.
|
||||
/ Always set 512 for memory card and hard disk but a larger value may be
|
||||
/ required for floppy disk (512/1024) and optical disk (512/2048).
|
||||
/ When _MAX_SS is larger than 512, GET_SECTOR_SIZE command must be implememted
|
||||
/ to the disk_ioctl function. */
|
||||
/ required for on-board flash memory, floppy disk and optical disk.
|
||||
/ When _MAX_SS is larger than 512, it configures FatFs to variable sector size
|
||||
/ and GET_SECTOR_SIZE command must be implememted to the disk_ioctl function. */
|
||||
|
||||
|
||||
#define _MULTI_PARTITION 0 /* 0:Single partition or 1:Multiple partition */
|
||||
#define _MULTI_PARTITION 0 /* 0:Single partition, 1/2:Enable multiple partition */
|
||||
/* When set to 0, each volume is bound to the same physical drive number and
|
||||
/ it can mount only first primaly partition. When it is set to 1, each volume
|
||||
/ is tied to the partitions listed in VolToPart[]. */
|
||||
|
||||
|
||||
#define _USE_ERASE 0 /* 0:Disable or 1:Enable */
|
||||
/* To enable sector erase feature, set _USE_ERASE to 1. */
|
||||
/* To enable sector erase feature, set _USE_ERASE to 1. CTRL_ERASE_SECTOR command
|
||||
/ should be added to the disk_ioctl functio. */
|
||||
|
||||
|
||||
|
||||
@@ -195,25 +177,30 @@
|
||||
/ When the byte order on the memory is big-endian or address miss-aligned word
|
||||
/ access results incorrect behavior, the _WORD_ACCESS must be set to 0.
|
||||
/ If it is not the case, the value can also be set to 1 to improve the
|
||||
/ performance and code size. */
|
||||
/ performance and code size.
|
||||
*/
|
||||
|
||||
|
||||
/* Include a header file here to define sync object types on the O/S */
|
||||
/* #include <windows.h>, <ucos_ii.h.h>, <semphr.h> or ohters. */
|
||||
/* A header file that defines sync object types on the O/S, such as
|
||||
/ windows.h, ucos_ii.h and semphr.h, must be included prior to ff.h. */
|
||||
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t HANDLE /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||
#if defined(CPUARM)
|
||||
#define _FS_REENTRANT 1 /* 0:Disable or 1:Enable */
|
||||
#else
|
||||
#define _FS_REENTRANT 0 /* 0:Disable or 1:Enable */
|
||||
#endif
|
||||
#define _FS_TIMEOUT 1000 /* Timeout period in unit of time ticks */
|
||||
#define _SYNC_t OS_MutexID /* O/S dependent type of sync object. e.g. HANDLE, OS_EVENT*, ID and etc.. */
|
||||
|
||||
/* The _FS_REENTRANT option switches the reentrancy of the FatFs module.
|
||||
/* The _FS_REENTRANT option switches the reentrancy (thread safe) of the FatFs module.
|
||||
/
|
||||
/ 0: Disable reentrancy. _SYNC_t and _FS_TIMEOUT have no effect.
|
||||
/ 1: Enable reentrancy. Also user provided synchronization handlers,
|
||||
/ ff_req_grant, ff_rel_grant, ff_del_syncobj and ff_cre_syncobj
|
||||
/ function must be added to the project. */
|
||||
|
||||
|
||||
#define _FS_SHARE 0 /* 0:Disable or >=1:Enable */
|
||||
|
||||
/* To enable file shareing feature, set _FS_SHARE to 1 or greater. The value
|
||||
defines how many files can be opened simultaneously. */
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*-------------------------------------------*/
|
||||
/* Integer type definitions for FatFs module */
|
||||
/*-------------------------------------------*/
|
||||
|
||||
#ifndef _INTEGER
|
||||
#define _INTEGER
|
||||
|
||||
#ifdef _WIN32 /* FatFs development platform */
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#else /* Embedded platform */
|
||||
|
||||
/* These types must be 16-bit, 32-bit or larger integer */
|
||||
typedef int INT;
|
||||
typedef unsigned int UINT;
|
||||
|
||||
/* These types must be 8-bit integer */
|
||||
typedef char CHAR;
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned char BYTE;
|
||||
|
||||
/* These types must be 16-bit integer */
|
||||
typedef short SHORT;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned short WORD;
|
||||
typedef unsigned short WCHAR;
|
||||
|
||||
/* These types must be 32-bit integer */
|
||||
typedef long LONG;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned long DWORD;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,540 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Unicode - Local code bidirectional converter (C)ChaN, 2009 */
|
||||
/* (SBCS code pages) */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* 437 U.S. (OEM)
|
||||
/ 720 Arabic (OEM)
|
||||
/ 1256 Arabic (Windows)
|
||||
/ 737 Greek (OEM)
|
||||
/ 1253 Greek (Windows)
|
||||
/ 1250 Central Europe (Windows)
|
||||
/ 775 Baltic (OEM)
|
||||
/ 1257 Baltic (Windows)
|
||||
/ 850 Multilingual Latin 1 (OEM)
|
||||
/ 852 Latin 2 (OEM)
|
||||
/ 1252 Latin 1 (Windows)
|
||||
/ 855 Cyrillic (OEM)
|
||||
/ 1251 Cyrillic (Windows)
|
||||
/ 866 Russian (OEM)
|
||||
/ 857 Turkish (OEM)
|
||||
/ 1254 Turkish (Windows)
|
||||
/ 858 Multilingual Latin 1 + Euro (OEM)
|
||||
/ 862 Hebrew (OEM)
|
||||
/ 1255 Hebrew (Windows)
|
||||
/ 874 Thai (OEM, Windows)
|
||||
/ 1258 Vietnam (OEM, Windows)
|
||||
*/
|
||||
|
||||
#include "../ff.h"
|
||||
|
||||
|
||||
#if _CODE_PAGE == 437
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
|
||||
0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 720
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
|
||||
0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9,
|
||||
0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642,
|
||||
0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A,
|
||||
0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0xO650, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 737
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
|
||||
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398,
|
||||
0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
|
||||
0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9,
|
||||
0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
|
||||
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0,
|
||||
0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD,
|
||||
0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E,
|
||||
0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 775
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
|
||||
0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107,
|
||||
0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A,
|
||||
0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4,
|
||||
0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6,
|
||||
0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118,
|
||||
0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D,
|
||||
0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B,
|
||||
0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144,
|
||||
0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019,
|
||||
0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E,
|
||||
0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 850
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
|
||||
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 852
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7,
|
||||
0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106,
|
||||
0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A,
|
||||
0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E,
|
||||
0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A,
|
||||
0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE,
|
||||
0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161,
|
||||
0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4,
|
||||
0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 855
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
|
||||
0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404,
|
||||
0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408,
|
||||
0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C,
|
||||
0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A,
|
||||
0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414,
|
||||
0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438,
|
||||
0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E,
|
||||
0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580,
|
||||
0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443,
|
||||
0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116,
|
||||
0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D,
|
||||
0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 857
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, 0x0000, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000,
|
||||
0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 858
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP858(0x80-0xFF) to Unicode conversion table */
|
||||
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7,
|
||||
0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
|
||||
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9,
|
||||
0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0,
|
||||
0x00A9, 0x2563, 0x2551, 0x2557, 0x2550, 0x00A2, 0x00A5, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
|
||||
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x20AC, 0x00CD, 0x00CE,
|
||||
0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00C6, 0x00CC, 0x2580,
|
||||
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE,
|
||||
0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
|
||||
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8,
|
||||
0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 862
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
|
||||
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
||||
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
||||
0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
|
||||
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA,
|
||||
0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4,
|
||||
0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
|
||||
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 866
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556,
|
||||
0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
|
||||
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F,
|
||||
0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
|
||||
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B,
|
||||
0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
|
||||
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E,
|
||||
0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 874
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP874(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x2026, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x0E01, 0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07,
|
||||
0x0E08, 0x0E09, 0x0E0A, 0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F,
|
||||
0x0E10, 0x0E11, 0x0E12, 0x0E13, 0x0E14, 0x0E15, 0x0E16, 0x0E17,
|
||||
0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C, 0x0E1D, 0x0E1E, 0x0E1F,
|
||||
0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25, 0x0E26, 0x0E27,
|
||||
0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E, 0x0E2F,
|
||||
0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
|
||||
0x0E38, 0x0E39, 0x0E3A, 0x0000, 0x0000, 0x0000, 0x0000, 0x0E3F,
|
||||
0x0E40, 0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47,
|
||||
0x0E48, 0x0E49, 0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F,
|
||||
0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57,
|
||||
0x0E58, 0x0E59, 0x0E5A, 0x0E5B, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1250
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1250(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0160, 0x2039, 0x015A, 0x0164, 0x017D, 0x0179,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0161, 0x203A, 0x015B, 0x0165, 0x017E, 0x017A,
|
||||
0x00A0, 0x02C7, 0x02D8, 0x0141, 0x00A4, 0x0104, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x015E, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x017B,
|
||||
0x00B0, 0x00B1, 0x02DB, 0x0142, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x0105, 0x015F, 0x00BB, 0x013D, 0x02DD, 0x013E, 0x017C,
|
||||
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7,
|
||||
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E,
|
||||
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7,
|
||||
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF,
|
||||
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7,
|
||||
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F,
|
||||
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7,
|
||||
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1251
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1251(0x80-0xFF) to Unicode conversion table */
|
||||
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F,
|
||||
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2111, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F,
|
||||
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7,
|
||||
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407,
|
||||
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457,
|
||||
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
|
||||
0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
|
||||
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427,
|
||||
0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
|
||||
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437,
|
||||
0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
|
||||
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447,
|
||||
0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1252
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1252(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x017D, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x017E, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x00D0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1253
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1253(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x000C, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x0385, 0x0386, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x0000, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x0388, 0x0389, 0x038A, 0x00BB, 0x038C, 0x00BD, 0x038E, 0x038F,
|
||||
0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397,
|
||||
0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F,
|
||||
0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7,
|
||||
0x03A8, 0x03A9, 0x03AA, 0x03AD, 0x03AC, 0x03AD, 0x03AE, 0x03AF,
|
||||
0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7,
|
||||
0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF,
|
||||
0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7,
|
||||
0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1254
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1254(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x210A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0160, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0161, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x011E, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00BD, 0x00DC, 0x0130, 0x015E, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x011F, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x0131, 0x015F, 0x00FF
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1255
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1255(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0000, 0x2039, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0000, 0x203A, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00D7, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00F7, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7,
|
||||
0x05B8, 0x05B9, 0x0000, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF,
|
||||
0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05F0, 0x05F1, 0x05F2, 0x05F3,
|
||||
0x05F4, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7,
|
||||
0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
|
||||
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7,
|
||||
0x05E8, 0x05E9, 0x05EA, 0x0000, 0x0000, 0x200E, 0x200F, 0x0000
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1256
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1256(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x067E, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688,
|
||||
0x06AF, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x06A9, 0x2122, 0x0691, 0x203A, 0x0153, 0x200C, 0x200D, 0x06BA,
|
||||
0x00A0, 0x060C, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x06BE, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x061B, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x061F,
|
||||
0x06C1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627,
|
||||
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F,
|
||||
0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00D7,
|
||||
0x0637, 0x0638, 0x0639, 0x063A, 0x0640, 0x0640, 0x0642, 0x0643,
|
||||
0x00E0, 0x0644, 0x00E2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0649, 0x064A, 0x00EE, 0x00EF,
|
||||
0x064B, 0x064C, 0x064D, 0x064E, 0x00F4, 0x064F, 0x0650, 0x00F7,
|
||||
0x0651, 0x00F9, 0x0652, 0x00FB, 0x00FC, 0x200E, 0x200F, 0x06D2
|
||||
}
|
||||
|
||||
#elif _CODE_PAGE == 1257
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1257(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0000, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x0000, 0x2030, 0x0000, 0x2039, 0x0000, 0x00A8, 0x02C7, 0x00B8,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x0000, 0x2122, 0x0000, 0x203A, 0x0000, 0x00AF, 0x02DB, 0x0000,
|
||||
0x00A0, 0x0000, 0x00A2, 0x00A3, 0x00A4, 0x0000, 0x00A6, 0x00A7,
|
||||
0x00D8, 0x00A9, 0x0156, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x0157, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00E6,
|
||||
0x0104, 0x012E, 0x0100, 0x0106, 0x00C4, 0x00C5, 0x0118, 0x0112,
|
||||
0x010C, 0x00C9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012A, 0x013B,
|
||||
0x0160, 0x0143, 0x0145, 0x00D3, 0x014C, 0x00D5, 0x00D6, 0x00D7,
|
||||
0x0172, 0x0141, 0x015A, 0x016A, 0x00DC, 0x017B, 0x017D, 0x00DF,
|
||||
0x0105, 0x012F, 0x0101, 0x0107, 0x00E4, 0x00E5, 0x0119, 0x0113,
|
||||
0x010D, 0x00E9, 0x017A, 0x0117, 0x0123, 0x0137, 0x012B, 0x013C,
|
||||
0x0161, 0x0144, 0x0146, 0x00F3, 0x014D, 0x00F5, 0x00F6, 0x00F7,
|
||||
0x0173, 0x014E, 0x015B, 0x016B, 0x00FC, 0x017C, 0x017E, 0x02D9
|
||||
};
|
||||
|
||||
#elif _CODE_PAGE == 1258
|
||||
#define _TBLDEF 1
|
||||
static
|
||||
const WCHAR Tbl[] = { /* CP1258(0x80-0xFF) to Unicode conversion table */
|
||||
0x20AC, 0x0000, 0x201A, 0x0192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||
0x02C6, 0x2030, 0x0000, 0x2039, 0x0152, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||
0x02DC, 0x2122, 0x0000, 0x203A, 0x0153, 0x0000, 0x0000, 0x0178,
|
||||
0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7,
|
||||
0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF,
|
||||
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7,
|
||||
0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF,
|
||||
0x00C0, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x00C5, 0x00C6, 0x00C7,
|
||||
0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x0300, 0x00CD, 0x00CE, 0x00CF,
|
||||
0x0110, 0x00D1, 0x0309, 0x00D3, 0x00D4, 0x01A0, 0x00D6, 0x00D7,
|
||||
0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x01AF, 0x0303, 0x00DF,
|
||||
0x00E0, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x00E5, 0x00E6, 0x00E7,
|
||||
0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x0301, 0x00ED, 0x00EE, 0x00EF,
|
||||
0x0111, 0x00F1, 0x0323, 0x00F3, 0x00F4, 0x01A1, 0x00F6, 0x00F7,
|
||||
0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x01B0, 0x20AB, 0x00FF
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !_TBLDEF || !_USE_LFN
|
||||
#error This file is not needed in current configuration. Remove from the project.
|
||||
#endif
|
||||
|
||||
|
||||
WCHAR ff_convert ( /* Converted character, Returns zero on error */
|
||||
WCHAR src, /* Character code to be converted */
|
||||
UINT dir /* 0: Unicode to OEMCP, 1: OEMCP to Unicode */
|
||||
)
|
||||
{
|
||||
WCHAR c;
|
||||
|
||||
|
||||
if (src < 0x80) { /* ASCII */
|
||||
c = src;
|
||||
|
||||
} else {
|
||||
if (dir) { /* OEMCP to Unicode */
|
||||
c = (src >= 0x100) ? 0 : Tbl[src - 0x80];
|
||||
|
||||
} else { /* Unicode to OEMCP */
|
||||
for (c = 0; c < 0x80; c++) {
|
||||
if (src == Tbl[c]) break;
|
||||
}
|
||||
c = (c + 0x80) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
WCHAR ff_wtoupper ( /* Upper converted character */
|
||||
WCHAR chr /* Input character */
|
||||
)
|
||||
{
|
||||
static const WCHAR tbl_lower[] = { 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0xA1, 0x00A2, 0x00A3, 0x00A5, 0x00AC, 0x00AF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x0FF, 0x101, 0x103, 0x105, 0x107, 0x109, 0x10B, 0x10D, 0x10F, 0x111, 0x113, 0x115, 0x117, 0x119, 0x11B, 0x11D, 0x11F, 0x121, 0x123, 0x125, 0x127, 0x129, 0x12B, 0x12D, 0x12F, 0x131, 0x133, 0x135, 0x137, 0x13A, 0x13C, 0x13E, 0x140, 0x142, 0x144, 0x146, 0x148, 0x14B, 0x14D, 0x14F, 0x151, 0x153, 0x155, 0x157, 0x159, 0x15B, 0x15D, 0x15F, 0x161, 0x163, 0x165, 0x167, 0x169, 0x16B, 0x16D, 0x16F, 0x171, 0x173, 0x175, 0x177, 0x17A, 0x17C, 0x17E, 0x192, 0x3B1, 0x3B2, 0x3B3, 0x3B4, 0x3B5, 0x3B6, 0x3B7, 0x3B8, 0x3B9, 0x3BA, 0x3BB, 0x3BC, 0x3BD, 0x3BE, 0x3BF, 0x3C0, 0x3C1, 0x3C3, 0x3C4, 0x3C5, 0x3C6, 0x3C7, 0x3C8, 0x3C9, 0x3CA, 0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439, 0x43A, 0x43B, 0x43C, 0x43D, 0x43E, 0x43F, 0x440, 0x441, 0x442, 0x443, 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44A, 0x44B, 0x44C, 0x44D, 0x44E, 0x44F, 0x451, 0x452, 0x453, 0x454, 0x455, 0x456, 0x457, 0x458, 0x459, 0x45A, 0x45B, 0x45C, 0x45E, 0x45F, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A, 0x217B, 0x217C, 0x217D, 0x217E, 0x217F, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 0xFF58, 0xFF59, 0xFF5A, 0 };
|
||||
static const WCHAR tbl_upper[] = { 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x21, 0xFFE0, 0xFFE1, 0xFFE5, 0xFFE2, 0xFFE3, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0x178, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10A, 0x10C, 0x10E, 0x110, 0x112, 0x114, 0x116, 0x118, 0x11A, 0x11C, 0x11E, 0x120, 0x122, 0x124, 0x126, 0x128, 0x12A, 0x12C, 0x12E, 0x130, 0x132, 0x134, 0x136, 0x139, 0x13B, 0x13D, 0x13F, 0x141, 0x143, 0x145, 0x147, 0x14A, 0x14C, 0x14E, 0x150, 0x152, 0x154, 0x156, 0x158, 0x15A, 0x15C, 0x15E, 0x160, 0x162, 0x164, 0x166, 0x168, 0x16A, 0x16C, 0x16E, 0x170, 0x172, 0x174, 0x176, 0x179, 0x17B, 0x17D, 0x191, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39A, 0x39B, 0x39C, 0x39D, 0x39E, 0x39F, 0x3A0, 0x3A1, 0x3A3, 0x3A4, 0x3A5, 0x3A6, 0x3A7, 0x3A8, 0x3A9, 0x3AA, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x416, 0x417, 0x418, 0x419, 0x41A, 0x41B, 0x41C, 0x41D, 0x41E, 0x41F, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427, 0x428, 0x429, 0x42A, 0x42B, 0x42C, 0x42D, 0x42E, 0x42F, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, 0x408, 0x409, 0x40A, 0x40B, 0x40C, 0x40E, 0x40F, 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, 0x2169, 0x216A, 0x216B, 0x216C, 0x216D, 0x216E, 0x216F, 0xFF21, 0xFF22, 0xFF23, 0xFF24, 0xFF25, 0xFF26, 0xFF27, 0xFF28, 0xFF29, 0xFF2A, 0xFF2B, 0xFF2C, 0xFF2D, 0xFF2E, 0xFF2F, 0xFF30, 0xFF31, 0xFF32, 0xFF33, 0xFF34, 0xFF35, 0xFF36, 0xFF37, 0xFF38, 0xFF39, 0xFF3A, 0 };
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; tbl_lower[i] && chr != tbl_lower[i]; i++) ;
|
||||
|
||||
return tbl_lower[i] ? tbl_upper[i] : chr;
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Sample code of OS dependent controls for FatFs R0.08b */
|
||||
/* (C)ChaN, 2011 */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdlib.h> /* ANSI memory controls */
|
||||
#include <malloc.h> /* ANSI memory controls */
|
||||
|
||||
#include "../ff.h"
|
||||
|
||||
|
||||
#if _FS_REENTRANT
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Create a Synchronization Object
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to create a new
|
||||
/ synchronization object, such as semaphore and mutex. When a zero is
|
||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to any error */
|
||||
BYTE vol, /* Corresponding logical drive being processed */
|
||||
_SYNC_t *sobj /* Pointer to return the created sync object */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
|
||||
*sobj = CreateMutex(NULL, FALSE, NULL); /* Win32 */
|
||||
ret = (*sobj != INVALID_HANDLE_VALUE);
|
||||
|
||||
// *sobj = SyncObjects[vol]; /* uITRON (give a static sync object) */
|
||||
// ret = 1; /* The initial value of the semaphore must be 1. */
|
||||
|
||||
// *sobj = OSMutexCreate(0, &err); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
|
||||
// *sobj = xSemaphoreCreateMutex(); /* FreeRTOS */
|
||||
// ret = (*sobj != NULL);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Delete a Synchronization Object */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to delete a synchronization
|
||||
/ object that created with ff_cre_syncobj function. When a zero is
|
||||
/ returned, the f_mount function fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to any error */
|
||||
_SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
|
||||
)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
ret = CloseHandle(sobj); /* Win32 */
|
||||
|
||||
// ret = 1; /* uITRON (nothing to do) */
|
||||
|
||||
// OSMutexDel(sobj, OS_DEL_ALWAYS, &err); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
|
||||
// ret = 1; /* FreeRTOS (nothing to do) */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Request Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on entering file functions to lock the volume.
|
||||
/ When a zero is returned, the file function fails with FR_TIMEOUT.
|
||||
*/
|
||||
|
||||
int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */
|
||||
_SYNC_t sobj /* Sync object to wait */
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = (WaitForSingleObject(sobj, _FS_TIMEOUT) == WAIT_OBJECT_0); /* Win32 */
|
||||
|
||||
// ret = (wai_sem(sobj) == E_OK); /* uITRON */
|
||||
|
||||
// OSMutexPend(sobj, _FS_TIMEOUT, &err)); /* uC/OS-II */
|
||||
// ret = (err == OS_NO_ERR);
|
||||
|
||||
// ret = (xSemaphoreTake(sobj, _FS_TIMEOUT) == pdTRUE); /* FreeRTOS */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Release Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on leaving file functions to unlock the volume.
|
||||
*/
|
||||
|
||||
void ff_rel_grant (
|
||||
_SYNC_t sobj /* Sync object to be signaled */
|
||||
)
|
||||
{
|
||||
ReleaseMutex(sobj); /* Win32 */
|
||||
|
||||
// sig_sem(sobj); /* uITRON */
|
||||
|
||||
// OSMutexPost(sobj); /* uC/OS-II */
|
||||
|
||||
// xSemaphoreGive(sobj); /* FreeRTOS */
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if _USE_LFN == 3 /* LFN with a working buffer on the heap */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Allocate a memory block */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE.
|
||||
*/
|
||||
|
||||
void* ff_memalloc ( /* Returns pointer to the allocated memory block */
|
||||
UINT size /* Number of bytes to allocate */
|
||||
)
|
||||
{
|
||||
return malloc(size);
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Free a memory block */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void ff_memfree(
|
||||
void* mblock /* Pointer to the memory block to free */
|
||||
)
|
||||
{
|
||||
free(mblock);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,27 +0,0 @@
|
||||
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
|
||||
|
||||
/// @file GCS_MAVLink.cpp
|
||||
/// @brief Supporting bits for MAVLink.
|
||||
|
||||
#include "GCS_MAVLink.h"
|
||||
|
||||
BetterStream *mavlink_comm_0_port;
|
||||
BetterStream *mavlink_comm_1_port;
|
||||
|
||||
// this might need to move to the flight software
|
||||
mavlink_system_t mavlink_system = {7,1,0,0};
|
||||
|
||||
#ifdef MAVLINK10
|
||||
# include "include_v1.0/mavlink_helpers.h"
|
||||
#else
|
||||
# include "include/mavlink_helpers.h"
|
||||
#endif
|
||||
|
||||
uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid)
|
||||
{
|
||||
if (sysid != mavlink_system.sysid)
|
||||
return 1;
|
||||
// Currently we are not checking for correct compid since APM is not passing mavlink info to any subsystem
|
||||
// If it is addressed to our system ID we assume it is for us
|
||||
return 0; // no error
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*-
|
||||
|
||||
/// @file GCS_MAVLink.h
|
||||
/// @brief One size fits all header for MAVLink integration.
|
||||
|
||||
#ifndef GCS_MAVLink_h
|
||||
#define GCS_MAVLink_h
|
||||
|
||||
#include <BetterStream.h>
|
||||
|
||||
#define MAVLINK_SEPARATE_HELPERS
|
||||
|
||||
#ifdef MAVLINK10
|
||||
# include "include_v1.0/ardupilotmega/version.h"
|
||||
#else
|
||||
# include "include/ardupilotmega/version.h"
|
||||
#endif
|
||||
|
||||
// this allows us to make mavlink_message_t much smaller
|
||||
#define MAVLINK_MAX_PAYLOAD_LEN MAVLINK_MAX_DIALECT_PAYLOAD_SIZE
|
||||
|
||||
#define MAVLINK_COMM_NUM_BUFFERS 2
|
||||
#ifdef MAVLINK10
|
||||
# include "include_v1.0/mavlink_types.h"
|
||||
#else
|
||||
# include "include/mavlink_types.h"
|
||||
#endif
|
||||
|
||||
/// MAVLink stream used for HIL interaction
|
||||
extern BetterStream *mavlink_comm_0_port;
|
||||
|
||||
/// MAVLink stream used for ground control communication
|
||||
extern BetterStream *mavlink_comm_1_port;
|
||||
|
||||
/// MAVLink system definition
|
||||
extern mavlink_system_t mavlink_system;
|
||||
|
||||
/// Send a byte to the nominated MAVLink channel
|
||||
///
|
||||
/// @param chan Channel to send to
|
||||
/// @param ch Byte to send
|
||||
///
|
||||
static inline void comm_send_ch(mavlink_channel_t chan, uint8_t ch)
|
||||
{
|
||||
switch(chan) {
|
||||
case MAVLINK_COMM_0:
|
||||
mavlink_comm_0_port->write(ch);
|
||||
break;
|
||||
case MAVLINK_COMM_1:
|
||||
mavlink_comm_1_port->write(ch);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Read a byte from the nominated MAVLink channel
|
||||
///
|
||||
/// @param chan Channel to receive on
|
||||
/// @returns Byte read
|
||||
///
|
||||
static inline uint8_t comm_receive_ch(mavlink_channel_t chan)
|
||||
{
|
||||
uint8_t data = 0;
|
||||
|
||||
switch(chan) {
|
||||
case MAVLINK_COMM_0:
|
||||
data = mavlink_comm_0_port->read();
|
||||
break;
|
||||
case MAVLINK_COMM_1:
|
||||
data = mavlink_comm_1_port->read();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/// Check for available data on the nominated MAVLink channel
|
||||
///
|
||||
/// @param chan Channel to check
|
||||
/// @returns Number of bytes available
|
||||
static inline uint16_t comm_get_available(mavlink_channel_t chan)
|
||||
{
|
||||
uint16_t bytes = 0;
|
||||
switch(chan) {
|
||||
case MAVLINK_COMM_0:
|
||||
bytes = mavlink_comm_0_port->available();
|
||||
break;
|
||||
case MAVLINK_COMM_1:
|
||||
bytes = mavlink_comm_1_port->available();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
|
||||
/// Check for available transmit space on the nominated MAVLink channel
|
||||
///
|
||||
/// @param chan Channel to check
|
||||
/// @returns Number of bytes available, -1 for error
|
||||
static inline int comm_get_txspace(mavlink_channel_t chan)
|
||||
{
|
||||
switch(chan) {
|
||||
case MAVLINK_COMM_0:
|
||||
return mavlink_comm_0_port->txspace();
|
||||
break;
|
||||
case MAVLINK_COMM_1:
|
||||
return mavlink_comm_1_port->txspace();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
#ifdef MAVLINK10
|
||||
# include "include_v1.0/ardupilotmega/mavlink.h"
|
||||
#else
|
||||
# include "include/ardupilotmega/mavlink.h"
|
||||
#endif
|
||||
|
||||
uint8_t mavlink_check_target(uint8_t sysid, uint8_t compid);
|
||||
|
||||
#endif // GCS_MAVLink_h
|
||||
@@ -1,172 +0,0 @@
|
||||
/*
|
||||
compatibility header during transition to MAVLink 1.0
|
||||
*/
|
||||
|
||||
#ifdef MAVLINK10
|
||||
// in MAVLink 1.0 'waypoint' becomes 'mission'. We can remove these
|
||||
// mappings once we are not trying to support both protocols
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_CURRENT MAVLINK_MSG_ID_MISSION_CURRENT
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_CURRENT_LEN MAVLINK_MSG_ID_MISSION_CURRENT_LEN
|
||||
#define mavlink_msg_waypoint_current_send mavlink_msg_mission_current_send
|
||||
#define mavlink_msg_waypoint_current_decode mavlink_msg_mission_current_decode
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_COUNT MAVLINK_MSG_ID_MISSION_COUNT
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_COUNT_LEN MAVLINK_MSG_ID_MISSION_COUNT_LEN
|
||||
#define mavlink_msg_waypoint_count_send mavlink_msg_mission_count_send
|
||||
#define mavlink_msg_waypoint_count_decode mavlink_msg_mission_count_decode
|
||||
#define mavlink_waypoint_count_t mavlink_mission_count_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_REQUEST MAVLINK_MSG_ID_MISSION_REQUEST
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_REQUEST_LEN MAVLINK_MSG_ID_MISSION_REQUEST_LEN
|
||||
#define mavlink_msg_waypoint_request_send mavlink_msg_mission_request_send
|
||||
#define mavlink_msg_waypoint_request_decode mavlink_msg_mission_request_decode
|
||||
#define mavlink_waypoint_request_t mavlink_mission_request_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST MAVLINK_MSG_ID_MISSION_REQUEST_LIST
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_REQUEST_LIST_LEN MAVLINK_MSG_ID_MISSION_REQUEST_LIST_LEN
|
||||
#define mavlink_msg_waypoint_request_list_send mavlink_msg_mission_request_list_send
|
||||
#define mavlink_msg_waypoint_request_list_decode mavlink_msg_mission_request_list_decode
|
||||
#define mavlink_waypoint_request_list_t mavlink_mission_request_list_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT MAVLINK_MSG_ID_MISSION_ITEM
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_LEN MAVLINK_MSG_ID_MISSION_ITEM_LEN
|
||||
#define mavlink_msg_waypoint_send mavlink_msg_mission_item_send
|
||||
#define mavlink_msg_waypoint_decode mavlink_msg_mission_item_decode
|
||||
#define mavlink_waypoint_t mavlink_mission_item_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_ACK MAVLINK_MSG_ID_MISSION_ACK
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_ACK_LEN MAVLINK_MSG_ID_MISSION_ACK_LEN
|
||||
#define mavlink_msg_waypoint_ack_send mavlink_msg_mission_ack_send
|
||||
#define mavlink_msg_waypoint_ack_decode mavlink_msg_mission_ack_decode
|
||||
#define mavlink_waypoint_ack_t mavlink_mission_ack_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_CLEAR_ALL MAVLINK_MSG_ID_MISSION_CLEAR_ALL
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_CLEAR_ALL_LEN MAVLINK_MSG_ID_MISSION_CLEAR_ALL_LEN
|
||||
#define mavlink_msg_waypoint_clear_all_send mavlink_msg_mission_clear_all_send
|
||||
#define mavlink_msg_waypoint_clear_all_decode mavlink_msg_mission_clear_all_decode
|
||||
#define mavlink_waypoint_clear_all_t mavlink_mission_clear_all_t
|
||||
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT MAVLINK_MSG_ID_MISSION_SET_CURRENT
|
||||
#define MAVLINK_MSG_ID_WAYPOINT_SET_CURRENT_LEN MAVLINK_MSG_ID_MISSION_SET_CURRENT_LEN
|
||||
#define mavlink_msg_waypoint_set_current_send mavlink_msg_mission_set_current_send
|
||||
#define mavlink_msg_waypoint_set_current_decode mavlink_msg_mission_set_current_decode
|
||||
#define mavlink_waypoint_set_current_t mavlink_mission_set_current_t
|
||||
|
||||
static uint8_t mav_var_type(enum ap_var_type t)
|
||||
{
|
||||
if (t == AP_PARAM_INT8) {
|
||||
return MAV_VAR_INT8;
|
||||
}
|
||||
if (t == AP_PARAM_INT16) {
|
||||
return MAV_VAR_INT16;
|
||||
}
|
||||
if (t == AP_PARAM_INT32) {
|
||||
return MAV_VAR_INT32;
|
||||
}
|
||||
// treat any others as float
|
||||
return MAV_VAR_FLOAT;
|
||||
}
|
||||
|
||||
#define MAV_FIXED_WING MAV_TYPE_FIXED_WING
|
||||
|
||||
#else // MAVLINK10
|
||||
|
||||
static uint8_t mav_var_type(enum ap_var_type t)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define MAV_MISSION_ACCEPTED 0
|
||||
#define MAV_MISSION_UNSUPPORTED 1
|
||||
#define MAV_MISSION_UNSUPPORTED_FRAME 1
|
||||
#define MAV_MISSION_ERROR 1
|
||||
#define MAV_MISSION_INVALID_SEQUENCE 1
|
||||
|
||||
/*
|
||||
some functions have some extra params in MAVLink 1.0
|
||||
*/
|
||||
|
||||
static void mavlink_msg_global_position_int_send(mavlink_channel_t chan, uint32_t time_boot_ms, int32_t lat, int32_t lon,
|
||||
int32_t alt, int32_t relative_alt, int16_t vx, int16_t vy,
|
||||
int16_t vz, uint16_t hdg)
|
||||
{
|
||||
mavlink_msg_global_position_int_send(
|
||||
chan,
|
||||
lat,
|
||||
lon,
|
||||
alt,
|
||||
vx, vy, vz);
|
||||
}
|
||||
|
||||
static void mavlink_msg_rc_channels_scaled_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port,
|
||||
int16_t chan1_scaled, int16_t chan2_scaled, int16_t chan3_scaled,
|
||||
int16_t chan4_scaled, int16_t chan5_scaled, int16_t chan6_scaled,
|
||||
int16_t chan7_scaled, int16_t chan8_scaled, uint8_t rssi)
|
||||
{
|
||||
mavlink_msg_rc_channels_scaled_send(
|
||||
chan,
|
||||
chan1_scaled,
|
||||
chan2_scaled,
|
||||
chan3_scaled,
|
||||
chan4_scaled,
|
||||
chan5_scaled,
|
||||
chan6_scaled,
|
||||
chan7_scaled,
|
||||
chan8_scaled,
|
||||
rssi);
|
||||
}
|
||||
|
||||
static void mavlink_msg_rc_channels_raw_send(mavlink_channel_t chan, uint32_t time_boot_ms, uint8_t port,
|
||||
uint16_t chan1_raw, uint16_t chan2_raw, uint16_t chan3_raw,
|
||||
uint16_t chan4_raw, uint16_t chan5_raw, uint16_t chan6_raw,
|
||||
uint16_t chan7_raw, uint16_t chan8_raw, uint8_t rssi)
|
||||
{
|
||||
mavlink_msg_rc_channels_raw_send(
|
||||
chan,
|
||||
chan1_raw,
|
||||
chan2_raw,
|
||||
chan3_raw,
|
||||
chan4_raw,
|
||||
chan5_raw,
|
||||
chan6_raw,
|
||||
chan7_raw,
|
||||
chan8_raw,
|
||||
rssi);
|
||||
}
|
||||
|
||||
|
||||
static void mavlink_msg_servo_output_raw_send(mavlink_channel_t chan, uint32_t time_usec, uint8_t port,
|
||||
uint16_t servo1_raw, uint16_t servo2_raw, uint16_t servo3_raw,
|
||||
uint16_t servo4_raw, uint16_t servo5_raw, uint16_t servo6_raw,
|
||||
uint16_t servo7_raw, uint16_t servo8_raw)
|
||||
{
|
||||
mavlink_msg_servo_output_raw_send(
|
||||
chan,
|
||||
servo1_raw,
|
||||
servo2_raw,
|
||||
servo3_raw,
|
||||
servo4_raw,
|
||||
servo5_raw,
|
||||
servo6_raw,
|
||||
servo7_raw,
|
||||
servo8_raw);
|
||||
}
|
||||
|
||||
static void mavlink_msg_statustext_send(mavlink_channel_t chan, uint8_t severity, const char *text)
|
||||
{
|
||||
mavlink_msg_statustext_send(chan, severity, (const int8_t*) text);
|
||||
}
|
||||
|
||||
static void mavlink_msg_param_value_send(mavlink_channel_t chan, const char *param_id,
|
||||
float param_value, uint8_t param_type,
|
||||
uint16_t param_count, uint16_t param_index)
|
||||
{
|
||||
mavlink_msg_param_value_send(
|
||||
chan,
|
||||
(int8_t *)param_id,
|
||||
param_value,
|
||||
param_count,
|
||||
param_index);
|
||||
}
|
||||
#endif // MAVLINK10
|
||||
@@ -1,150 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol generated from ardupilotmega.xml
|
||||
* @see http://qgroundcontrol.org/mavlink/
|
||||
*/
|
||||
#ifndef ARDUPILOTMEGA_H
|
||||
#define ARDUPILOTMEGA_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// MESSAGE LENGTHS AND CRCS
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_LENGTHS
|
||||
#define MAVLINK_MESSAGE_LENGTHS {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 8, 4, 12, 15, 13, 6, 15, 14, 0, 12, 3, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5}
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_CRCS
|
||||
#define MAVLINK_MESSAGE_CRCS {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 29, 208, 188, 118, 242, 19, 97, 233, 0, 18, 68, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7}
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_INFO
|
||||
#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_BOOT, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_SYSTEM_TIME_UTC, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {NULL}, MAVLINK_MESSAGE_INFO_ACTION_ACK, MAVLINK_MESSAGE_INFO_ACTION, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_SET_NAV_MODE, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, {NULL}, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_LOCAL_POSITION, MAVLINK_MESSAGE_INFO_GPS_RAW, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_WAYPOINT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST, MAVLINK_MESSAGE_INFO_WAYPOINT_SET_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_WAYPOINT_COUNT, MAVLINK_MESSAGE_INFO_WAYPOINT_CLEAR_ALL, MAVLINK_MESSAGE_INFO_WAYPOINT_REACHED, MAVLINK_MESSAGE_INFO_WAYPOINT_ACK, MAVLINK_MESSAGE_INFO_GPS_SET_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_LOCAL_ORIGIN_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_CONTROL_STATUS, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_POSITION_TARGET, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, MAVLINK_MESSAGE_INFO_SET_ALTITUDE, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_OBJECT_DETECTION_EVENT, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS, MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS, MAVLINK_MESSAGE_INFO_MEMINFO, MAVLINK_MESSAGE_INFO_AP_ADC, MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE, MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE, MAVLINK_MESSAGE_INFO_MOUNT_CONTROL, MAVLINK_MESSAGE_INFO_MOUNT_STATUS, {NULL}, MAVLINK_MESSAGE_INFO_FENCE_POINT, MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT, MAVLINK_MESSAGE_INFO_FENCE_STATUS, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG}
|
||||
#endif
|
||||
|
||||
#include "../protocol.h"
|
||||
|
||||
#define MAVLINK_ENABLED_ARDUPILOTMEGA
|
||||
|
||||
#include "../common/common.h"
|
||||
|
||||
// MAVLINK VERSION
|
||||
|
||||
#ifndef MAVLINK_VERSION
|
||||
#define MAVLINK_VERSION 2
|
||||
#endif
|
||||
|
||||
#if (MAVLINK_VERSION == 0)
|
||||
#undef MAVLINK_VERSION
|
||||
#define MAVLINK_VERSION 2
|
||||
#endif
|
||||
|
||||
// ENUM DEFINITIONS
|
||||
|
||||
|
||||
/** @brief Enumeration of possible mount operation modes */
|
||||
#ifndef HAVE_ENUM_MAV_MOUNT_MODE
|
||||
#define HAVE_ENUM_MAV_MOUNT_MODE
|
||||
enum MAV_MOUNT_MODE
|
||||
{
|
||||
MAV_MOUNT_MODE_RETRACT=0, /* Load and keep safe position (Roll,Pitch,Yaw) from EEPROM and stop stabilization | */
|
||||
MAV_MOUNT_MODE_NEUTRAL=1, /* Load and keep neutral position (Roll,Pitch,Yaw) from EEPROM. | */
|
||||
MAV_MOUNT_MODE_MAVLINK_TARGETING=2, /* Load neutral position and start MAVLink Roll,Pitch,Yaw control with stabilization | */
|
||||
MAV_MOUNT_MODE_RC_TARGETING=3, /* Load neutral position and start RC Roll,Pitch,Yaw control with stabilization | */
|
||||
MAV_MOUNT_MODE_GPS_POINT=4, /* Load neutral position and start to point to Lat,Lon,Alt | */
|
||||
MAV_MOUNT_MODE_ENUM_END=5, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @brief */
|
||||
#ifndef HAVE_ENUM_MAV_CMD
|
||||
#define HAVE_ENUM_MAV_CMD
|
||||
enum MAV_CMD
|
||||
{
|
||||
MAV_CMD_NAV_WAYPOINT=16, /* Navigate to waypoint. |Hold time in decimal seconds. (ignored by fixed wing, time to stay at waypoint for rotary wing)| Acceptance radius in meters (if the sphere with this radius is hit, the waypoint counts as reached)| 0 to pass through the WP, if > 0 radius in meters to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.| Desired yaw angle at waypoint (rotary wing)| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_LOITER_UNLIM=17, /* Loiter around this waypoint an unlimited amount of time |Empty| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_LOITER_TURNS=18, /* Loiter around this waypoint for X turns |Turns| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_LOITER_TIME=19, /* Loiter around this waypoint for X seconds |Seconds (decimal)| Empty| Radius around waypoint, in meters. If positive loiter clockwise, else counter-clockwise| Desired yaw angle.| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_RETURN_TO_LAUNCH=20, /* Return to launch location |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_NAV_LAND=21, /* Land at location |Empty| Empty| Empty| Desired yaw angle.| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_TAKEOFF=22, /* Takeoff from ground / hand |Minimum pitch (if airspeed sensor present), desired pitch without sensor| Empty| Empty| Yaw angle (if magnetometer present), ignored without magnetometer| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_NAV_ROI=80, /* Sets the region of interest (ROI) for a sensor set or the
|
||||
vehicle itself. This can then be used by the vehicles control
|
||||
system to control the vehicle attitude and the attitude of various
|
||||
sensors such as cameras. |Region of intereset mode. (see MAV_ROI enum)| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple ROI's)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */
|
||||
MAV_CMD_NAV_PATHPLANNING=81, /* Control autonomous path planning on the MAV. |0: Disable local obstacle avoidance / local path planning (without resetting map), 1: Enable local path planning, 2: Enable and reset local path planning| 0: Disable full path planning (without resetting map), 1: Enable, 2: Enable and reset map/occupancy grid, 3: Enable and reset planned route, but not occupancy grid| Empty| Yaw angle at goal, in compass degrees, [0..360]| Latitude/X of goal| Longitude/Y of goal| Altitude/Z of goal| */
|
||||
MAV_CMD_NAV_LAST=95, /* NOP - This command is only used to mark the upper limit of the NAV/ACTION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_CONDITION_DELAY=112, /* Delay mission state machine. |Delay in seconds (decimal)| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_CONDITION_CHANGE_ALT=113, /* Ascend/descend at rate. Delay mission state machine until desired altitude reached. |Descent / Ascend rate (m/s)| Empty| Empty| Empty| Empty| Empty| Finish Altitude| */
|
||||
MAV_CMD_CONDITION_DISTANCE=114, /* Delay mission state machine until within desired distance of next NAV point. |Distance (meters)| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_CONDITION_YAW=115, /* Reach a certain target angle. |target angle: [0-360], 0 is north| speed during yaw change:[deg per second]| direction: negative: counter clockwise, positive: clockwise [-1,1]| relative offset or absolute angle: [ 1,0]| Empty| Empty| Empty| */
|
||||
MAV_CMD_CONDITION_LAST=159, /* NOP - This command is only used to mark the upper limit of the CONDITION commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_SET_MODE=176, /* Set system mode. |Mode, as defined by ENUM MAV_MODE| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_JUMP=177, /* Jump to the desired command in the mission list. Repeat this action only the specified number of times |Sequence number| Repeat count| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_CHANGE_SPEED=178, /* Change speed and/or throttle set points. |Speed type (0=Airspeed, 1=Ground Speed)| Speed (m/s, -1 indicates no change)| Throttle ( Percent, -1 indicates no change)| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_SET_HOME=179, /* Changes the home location either to the current location or a specified location. |Use current (1=use current location, 0=use specified location)| Empty| Empty| Empty| Latitude| Longitude| Altitude| */
|
||||
MAV_CMD_DO_SET_PARAMETER=180, /* Set a system parameter. Caution! Use of this command requires knowledge of the numeric enumeration value of the parameter. |Parameter number| Parameter value| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_SET_RELAY=181, /* Set a relay to a condition. |Relay number| Setting (1=on, 0=off, others possible depending on system hardware)| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_REPEAT_RELAY=182, /* Cycle a relay on and off for a desired number of cyles with a desired period. |Relay number| Cycle count| Cycle time (seconds, decimal)| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_SET_SERVO=183, /* Set a servo to a desired PWM value. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_REPEAT_SERVO=184, /* Cycle a between its nominal setting and a desired PWM for a desired number of cycles with a desired period. |Servo number| PWM (microseconds, 1000 to 2000 typical)| Cycle count| Cycle time (seconds)| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_CONTROL_VIDEO=200, /* Control onboard camera capturing. |Camera ID (-1 for all)| Transmission: 0: disabled, 1: enabled compressed, 2: enabled raw| Transmission mode: 0: video stream, >0: single images every n seconds (decimal)| Recording: 0: disabled, 1: enabled compressed, 2: enabled raw| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_SET_ROI=201, /* Sets the region of interest (ROI) for a sensor set or the
|
||||
vehicle itself. This can then be used by the vehicles control
|
||||
system to control the vehicle attitude and the attitude of various
|
||||
devices such as cameras.
|
||||
|Region of interest mode. (see MAV_ROI enum)| Waypoint index/ target ID. (see MAV_ROI enum)| ROI index (allows a vehicle to manage multiple cameras etc.)| Empty| x the location of the fixed ROI (see MAV_FRAME)| y| z| */
|
||||
MAV_CMD_DO_DIGICAM_CONFIGURE=202, /* Mission command to configure an on-board camera controller system. |Modes: P, TV, AV, M, Etc| Shutter speed: Divisor number for one second| Aperture: F stop number| ISO number e.g. 80, 100, 200, Etc| Exposure type enumerator| Command Identity| Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)| */
|
||||
MAV_CMD_DO_DIGICAM_CONTROL=203, /* Mission command to control an on-board camera controller system. |Session control e.g. show/hide lens| Zoom's absolute position| Zooming step value to offset zoom from the current position| Focus Locking, Unlocking or Re-locking| Shooting Command| Command Identity| Empty| */
|
||||
MAV_CMD_DO_MOUNT_CONFIGURE=204, /* Mission command to configure a camera or antenna mount |Mount operation mode (see MAV_MOUNT_MODE enum)| stabilize roll? (1 = yes, 0 = no)| stabilize pitch? (1 = yes, 0 = no)| stabilize yaw? (1 = yes, 0 = no)| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_MOUNT_CONTROL=205, /* Mission command to control a camera or antenna mount |pitch(deg*100) or lat, depending on mount mode.| roll(deg*100) or lon depending on mount mode| yaw(deg*100) or alt (in cm) depending on mount mode| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_DO_LAST=240, /* NOP - This command is only used to mark the upper limit of the DO commands in the enumeration |Empty| Empty| Empty| Empty| Empty| Empty| Empty| */
|
||||
MAV_CMD_PREFLIGHT_CALIBRATION=241, /* Trigger calibration. This command will be only accepted if in pre-flight mode. |Gyro calibration: 0: no, 1: yes| Magnetometer calibration: 0: no, 1: yes| Ground pressure: 0: no, 1: yes| Radio calibration: 0: no, 1: yes| Empty| Empty| Empty| */
|
||||
MAV_CMD_PREFLIGHT_STORAGE=245, /* Request storage of different parameter values and logs. This command will be only accepted if in pre-flight mode. |Parameter storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Mission storage: 0: READ FROM FLASH/EEPROM, 1: WRITE CURRENT TO FLASH/EEPROM| Reserved| Reserved| Empty| Empty| Empty| */
|
||||
MAV_CMD_ENUM_END=246, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @brief */
|
||||
#ifndef HAVE_ENUM_FENCE_ACTION
|
||||
#define HAVE_ENUM_FENCE_ACTION
|
||||
enum FENCE_ACTION
|
||||
{
|
||||
FENCE_ACTION_NONE=0, /* Disable fenced mode | */
|
||||
FENCE_ACTION_GUIDED=1, /* Switched to guided mode to return point (fence point 0) | */
|
||||
FENCE_ACTION_ENUM_END=2, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @brief */
|
||||
#ifndef HAVE_ENUM_FENCE_BREACH
|
||||
#define HAVE_ENUM_FENCE_BREACH
|
||||
enum FENCE_BREACH
|
||||
{
|
||||
FENCE_BREACH_NONE=0, /* No last fence breach | */
|
||||
FENCE_BREACH_MINALT=1, /* Breached minimum altitude | */
|
||||
FENCE_BREACH_MAXALT=2, /* Breached minimum altitude | */
|
||||
FENCE_BREACH_BOUNDARY=3, /* Breached fence boundary | */
|
||||
FENCE_BREACH_ENUM_END=4, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
// MESSAGE DEFINITIONS
|
||||
#include "./mavlink_msg_sensor_offsets.h"
|
||||
#include "./mavlink_msg_set_mag_offsets.h"
|
||||
#include "./mavlink_msg_meminfo.h"
|
||||
#include "./mavlink_msg_ap_adc.h"
|
||||
#include "./mavlink_msg_digicam_configure.h"
|
||||
#include "./mavlink_msg_digicam_control.h"
|
||||
#include "./mavlink_msg_mount_configure.h"
|
||||
#include "./mavlink_msg_mount_control.h"
|
||||
#include "./mavlink_msg_mount_status.h"
|
||||
#include "./mavlink_msg_fence_point.h"
|
||||
#include "./mavlink_msg_fence_fetch_point.h"
|
||||
#include "./mavlink_msg_fence_status.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // ARDUPILOTMEGA_H
|
||||
@@ -1,27 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol built from ardupilotmega.xml
|
||||
* @see http://pixhawk.ethz.ch/software/mavlink
|
||||
*/
|
||||
#ifndef MAVLINK_H
|
||||
#define MAVLINK_H
|
||||
|
||||
#ifndef MAVLINK_STX
|
||||
#define MAVLINK_STX 85
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_ENDIAN
|
||||
#define MAVLINK_ENDIAN MAVLINK_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_ALIGNED_FIELDS
|
||||
#define MAVLINK_ALIGNED_FIELDS 0
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_CRC_EXTRA
|
||||
#define MAVLINK_CRC_EXTRA 0
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
#include "ardupilotmega.h"
|
||||
|
||||
#endif // MAVLINK_H
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE AP_ADC PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_AP_ADC 153
|
||||
|
||||
typedef struct __mavlink_ap_adc_t
|
||||
{
|
||||
uint16_t adc1; ///< ADC output 1
|
||||
uint16_t adc2; ///< ADC output 2
|
||||
uint16_t adc3; ///< ADC output 3
|
||||
uint16_t adc4; ///< ADC output 4
|
||||
uint16_t adc5; ///< ADC output 5
|
||||
uint16_t adc6; ///< ADC output 6
|
||||
} mavlink_ap_adc_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_AP_ADC_LEN 12
|
||||
#define MAVLINK_MSG_ID_153_LEN 12
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_AP_ADC { \
|
||||
"AP_ADC", \
|
||||
6, \
|
||||
{ { "adc1", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_ap_adc_t, adc1) }, \
|
||||
{ "adc2", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_ap_adc_t, adc2) }, \
|
||||
{ "adc3", NULL, MAVLINK_TYPE_UINT16_T, 0, 4, offsetof(mavlink_ap_adc_t, adc3) }, \
|
||||
{ "adc4", NULL, MAVLINK_TYPE_UINT16_T, 0, 6, offsetof(mavlink_ap_adc_t, adc4) }, \
|
||||
{ "adc5", NULL, MAVLINK_TYPE_UINT16_T, 0, 8, offsetof(mavlink_ap_adc_t, adc5) }, \
|
||||
{ "adc6", NULL, MAVLINK_TYPE_UINT16_T, 0, 10, offsetof(mavlink_ap_adc_t, adc6) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a ap_adc message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param adc1 ADC output 1
|
||||
* @param adc2 ADC output 2
|
||||
* @param adc3 ADC output 3
|
||||
* @param adc4 ADC output 4
|
||||
* @param adc5 ADC output 5
|
||||
* @param adc6 ADC output 6
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint16_t(buf, 0, adc1);
|
||||
_mav_put_uint16_t(buf, 2, adc2);
|
||||
_mav_put_uint16_t(buf, 4, adc3);
|
||||
_mav_put_uint16_t(buf, 6, adc4);
|
||||
_mav_put_uint16_t(buf, 8, adc5);
|
||||
_mav_put_uint16_t(buf, 10, adc6);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_ap_adc_t packet;
|
||||
packet.adc1 = adc1;
|
||||
packet.adc2 = adc2;
|
||||
packet.adc3 = adc3;
|
||||
packet.adc4 = adc4;
|
||||
packet.adc5 = adc5;
|
||||
packet.adc6 = adc6;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_AP_ADC;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a ap_adc message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param adc1 ADC output 1
|
||||
* @param adc2 ADC output 2
|
||||
* @param adc3 ADC output 3
|
||||
* @param adc4 ADC output 4
|
||||
* @param adc5 ADC output 5
|
||||
* @param adc6 ADC output 6
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint16_t adc1,uint16_t adc2,uint16_t adc3,uint16_t adc4,uint16_t adc5,uint16_t adc6)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint16_t(buf, 0, adc1);
|
||||
_mav_put_uint16_t(buf, 2, adc2);
|
||||
_mav_put_uint16_t(buf, 4, adc3);
|
||||
_mav_put_uint16_t(buf, 6, adc4);
|
||||
_mav_put_uint16_t(buf, 8, adc5);
|
||||
_mav_put_uint16_t(buf, 10, adc6);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_ap_adc_t packet;
|
||||
packet.adc1 = adc1;
|
||||
packet.adc2 = adc2;
|
||||
packet.adc3 = adc3;
|
||||
packet.adc4 = adc4;
|
||||
packet.adc5 = adc5;
|
||||
packet.adc6 = adc6;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_AP_ADC;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a ap_adc struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param ap_adc C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_ap_adc_t* ap_adc)
|
||||
{
|
||||
return mavlink_msg_ap_adc_pack(system_id, component_id, msg, ap_adc->adc1, ap_adc->adc2, ap_adc->adc3, ap_adc->adc4, ap_adc->adc5, ap_adc->adc6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a ap_adc message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param adc1 ADC output 1
|
||||
* @param adc2 ADC output 2
|
||||
* @param adc3 ADC output 3
|
||||
* @param adc4 ADC output 4
|
||||
* @param adc5 ADC output 5
|
||||
* @param adc6 ADC output 6
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_ap_adc_send(mavlink_channel_t chan, uint16_t adc1, uint16_t adc2, uint16_t adc3, uint16_t adc4, uint16_t adc5, uint16_t adc6)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint16_t(buf, 0, adc1);
|
||||
_mav_put_uint16_t(buf, 2, adc2);
|
||||
_mav_put_uint16_t(buf, 4, adc3);
|
||||
_mav_put_uint16_t(buf, 6, adc4);
|
||||
_mav_put_uint16_t(buf, 8, adc5);
|
||||
_mav_put_uint16_t(buf, 10, adc6);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, buf, 12);
|
||||
#else
|
||||
mavlink_ap_adc_t packet;
|
||||
packet.adc1 = adc1;
|
||||
packet.adc2 = adc2;
|
||||
packet.adc3 = adc3;
|
||||
packet.adc4 = adc4;
|
||||
packet.adc5 = adc5;
|
||||
packet.adc6 = adc6;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AP_ADC, (const char *)&packet, 12);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE AP_ADC UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field adc1 from ap_adc message
|
||||
*
|
||||
* @return ADC output 1
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc1(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field adc2 from ap_adc message
|
||||
*
|
||||
* @return ADC output 2
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc2(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field adc3 from ap_adc message
|
||||
*
|
||||
* @return ADC output 3
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc3(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field adc4 from ap_adc message
|
||||
*
|
||||
* @return ADC output 4
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc4(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field adc5 from ap_adc message
|
||||
*
|
||||
* @return ADC output 5
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc5(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field adc6 from ap_adc message
|
||||
*
|
||||
* @return ADC output 6
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_ap_adc_get_adc6(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a ap_adc message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param ap_adc C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_ap_adc_decode(const mavlink_message_t* msg, mavlink_ap_adc_t* ap_adc)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
ap_adc->adc1 = mavlink_msg_ap_adc_get_adc1(msg);
|
||||
ap_adc->adc2 = mavlink_msg_ap_adc_get_adc2(msg);
|
||||
ap_adc->adc3 = mavlink_msg_ap_adc_get_adc3(msg);
|
||||
ap_adc->adc4 = mavlink_msg_ap_adc_get_adc4(msg);
|
||||
ap_adc->adc5 = mavlink_msg_ap_adc_get_adc5(msg);
|
||||
ap_adc->adc6 = mavlink_msg_ap_adc_get_adc6(msg);
|
||||
#else
|
||||
memcpy(ap_adc, _MAV_PAYLOAD(msg), 12);
|
||||
#endif
|
||||
}
|
||||
@@ -1,364 +0,0 @@
|
||||
// MESSAGE DIGICAM_CONFIGURE PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE 154
|
||||
|
||||
typedef struct __mavlink_digicam_configure_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
uint8_t mode; ///< Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore)
|
||||
uint16_t shutter_speed; ///< Divisor number //e.g. 1000 means 1/1000 (0 means ignore)
|
||||
uint8_t aperture; ///< F stop number x 10 //e.g. 28 means 2.8 (0 means ignore)
|
||||
uint8_t iso; ///< ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore)
|
||||
uint8_t exposure_type; ///< Exposure type enumeration from 1 to N (0 means ignore)
|
||||
uint8_t command_id; ///< Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
uint8_t engine_cut_off; ///< Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)
|
||||
uint8_t extra_param; ///< Extra parameters enumeration (0 means ignore)
|
||||
float extra_value; ///< Correspondent value to given extra_param
|
||||
} mavlink_digicam_configure_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_DIGICAM_CONFIGURE_LEN 15
|
||||
#define MAVLINK_MSG_ID_154_LEN 15
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_DIGICAM_CONFIGURE { \
|
||||
"DIGICAM_CONFIGURE", \
|
||||
11, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_digicam_configure_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_digicam_configure_t, target_component) }, \
|
||||
{ "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_digicam_configure_t, mode) }, \
|
||||
{ "shutter_speed", NULL, MAVLINK_TYPE_UINT16_T, 0, 3, offsetof(mavlink_digicam_configure_t, shutter_speed) }, \
|
||||
{ "aperture", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_digicam_configure_t, aperture) }, \
|
||||
{ "iso", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_configure_t, iso) }, \
|
||||
{ "exposure_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_configure_t, exposure_type) }, \
|
||||
{ "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_digicam_configure_t, command_id) }, \
|
||||
{ "engine_cut_off", NULL, MAVLINK_TYPE_UINT8_T, 0, 9, offsetof(mavlink_digicam_configure_t, engine_cut_off) }, \
|
||||
{ "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 10, offsetof(mavlink_digicam_configure_t, extra_param) }, \
|
||||
{ "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 11, offsetof(mavlink_digicam_configure_t, extra_value) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a digicam_configure message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mode Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore)
|
||||
* @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore)
|
||||
* @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore)
|
||||
* @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore)
|
||||
* @param exposure_type Exposure type enumeration from 1 to N (0 means ignore)
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param engine_cut_off Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_configure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t mode, uint16_t shutter_speed, uint8_t aperture, uint8_t iso, uint8_t exposure_type, uint8_t command_id, uint8_t engine_cut_off, uint8_t extra_param, float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mode);
|
||||
_mav_put_uint16_t(buf, 3, shutter_speed);
|
||||
_mav_put_uint8_t(buf, 5, aperture);
|
||||
_mav_put_uint8_t(buf, 6, iso);
|
||||
_mav_put_uint8_t(buf, 7, exposure_type);
|
||||
_mav_put_uint8_t(buf, 8, command_id);
|
||||
_mav_put_uint8_t(buf, 9, engine_cut_off);
|
||||
_mav_put_uint8_t(buf, 10, extra_param);
|
||||
_mav_put_float(buf, 11, extra_value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 15);
|
||||
#else
|
||||
mavlink_digicam_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mode = mode;
|
||||
packet.shutter_speed = shutter_speed;
|
||||
packet.aperture = aperture;
|
||||
packet.iso = iso;
|
||||
packet.exposure_type = exposure_type;
|
||||
packet.command_id = command_id;
|
||||
packet.engine_cut_off = engine_cut_off;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 15);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a digicam_configure message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mode Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore)
|
||||
* @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore)
|
||||
* @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore)
|
||||
* @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore)
|
||||
* @param exposure_type Exposure type enumeration from 1 to N (0 means ignore)
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param engine_cut_off Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_configure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t mode,uint16_t shutter_speed,uint8_t aperture,uint8_t iso,uint8_t exposure_type,uint8_t command_id,uint8_t engine_cut_off,uint8_t extra_param,float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mode);
|
||||
_mav_put_uint16_t(buf, 3, shutter_speed);
|
||||
_mav_put_uint8_t(buf, 5, aperture);
|
||||
_mav_put_uint8_t(buf, 6, iso);
|
||||
_mav_put_uint8_t(buf, 7, exposure_type);
|
||||
_mav_put_uint8_t(buf, 8, command_id);
|
||||
_mav_put_uint8_t(buf, 9, engine_cut_off);
|
||||
_mav_put_uint8_t(buf, 10, extra_param);
|
||||
_mav_put_float(buf, 11, extra_value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 15);
|
||||
#else
|
||||
mavlink_digicam_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mode = mode;
|
||||
packet.shutter_speed = shutter_speed;
|
||||
packet.aperture = aperture;
|
||||
packet.iso = iso;
|
||||
packet.exposure_type = exposure_type;
|
||||
packet.command_id = command_id;
|
||||
packet.engine_cut_off = engine_cut_off;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 15);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONFIGURE;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a digicam_configure struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param digicam_configure C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_configure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_digicam_configure_t* digicam_configure)
|
||||
{
|
||||
return mavlink_msg_digicam_configure_pack(system_id, component_id, msg, digicam_configure->target_system, digicam_configure->target_component, digicam_configure->mode, digicam_configure->shutter_speed, digicam_configure->aperture, digicam_configure->iso, digicam_configure->exposure_type, digicam_configure->command_id, digicam_configure->engine_cut_off, digicam_configure->extra_param, digicam_configure->extra_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a digicam_configure message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mode Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore)
|
||||
* @param shutter_speed Divisor number //e.g. 1000 means 1/1000 (0 means ignore)
|
||||
* @param aperture F stop number x 10 //e.g. 28 means 2.8 (0 means ignore)
|
||||
* @param iso ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore)
|
||||
* @param exposure_type Exposure type enumeration from 1 to N (0 means ignore)
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param engine_cut_off Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_digicam_configure_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mode, uint16_t shutter_speed, uint8_t aperture, uint8_t iso, uint8_t exposure_type, uint8_t command_id, uint8_t engine_cut_off, uint8_t extra_param, float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mode);
|
||||
_mav_put_uint16_t(buf, 3, shutter_speed);
|
||||
_mav_put_uint8_t(buf, 5, aperture);
|
||||
_mav_put_uint8_t(buf, 6, iso);
|
||||
_mav_put_uint8_t(buf, 7, exposure_type);
|
||||
_mav_put_uint8_t(buf, 8, command_id);
|
||||
_mav_put_uint8_t(buf, 9, engine_cut_off);
|
||||
_mav_put_uint8_t(buf, 10, extra_param);
|
||||
_mav_put_float(buf, 11, extra_value);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, buf, 15);
|
||||
#else
|
||||
mavlink_digicam_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mode = mode;
|
||||
packet.shutter_speed = shutter_speed;
|
||||
packet.aperture = aperture;
|
||||
packet.iso = iso;
|
||||
packet.exposure_type = exposure_type;
|
||||
packet.command_id = command_id;
|
||||
packet.engine_cut_off = engine_cut_off;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONFIGURE, (const char *)&packet, 15);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE DIGICAM_CONFIGURE UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from digicam_configure message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from digicam_configure message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mode from digicam_configure message
|
||||
*
|
||||
* @return Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_mode(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field shutter_speed from digicam_configure message
|
||||
*
|
||||
* @return Divisor number //e.g. 1000 means 1/1000 (0 means ignore)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_configure_get_shutter_speed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field aperture from digicam_configure message
|
||||
*
|
||||
* @return F stop number x 10 //e.g. 28 means 2.8 (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_aperture(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field iso from digicam_configure message
|
||||
*
|
||||
* @return ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_iso(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field exposure_type from digicam_configure message
|
||||
*
|
||||
* @return Exposure type enumeration from 1 to N (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_exposure_type(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field command_id from digicam_configure message
|
||||
*
|
||||
* @return Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_command_id(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field engine_cut_off from digicam_configure message
|
||||
*
|
||||
* @return Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_engine_cut_off(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 9);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field extra_param from digicam_configure message
|
||||
*
|
||||
* @return Extra parameters enumeration (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_configure_get_extra_param(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field extra_value from digicam_configure message
|
||||
*
|
||||
* @return Correspondent value to given extra_param
|
||||
*/
|
||||
static inline float mavlink_msg_digicam_configure_get_extra_value(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 11);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a digicam_configure message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param digicam_configure C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_digicam_configure_decode(const mavlink_message_t* msg, mavlink_digicam_configure_t* digicam_configure)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
digicam_configure->target_system = mavlink_msg_digicam_configure_get_target_system(msg);
|
||||
digicam_configure->target_component = mavlink_msg_digicam_configure_get_target_component(msg);
|
||||
digicam_configure->mode = mavlink_msg_digicam_configure_get_mode(msg);
|
||||
digicam_configure->shutter_speed = mavlink_msg_digicam_configure_get_shutter_speed(msg);
|
||||
digicam_configure->aperture = mavlink_msg_digicam_configure_get_aperture(msg);
|
||||
digicam_configure->iso = mavlink_msg_digicam_configure_get_iso(msg);
|
||||
digicam_configure->exposure_type = mavlink_msg_digicam_configure_get_exposure_type(msg);
|
||||
digicam_configure->command_id = mavlink_msg_digicam_configure_get_command_id(msg);
|
||||
digicam_configure->engine_cut_off = mavlink_msg_digicam_configure_get_engine_cut_off(msg);
|
||||
digicam_configure->extra_param = mavlink_msg_digicam_configure_get_extra_param(msg);
|
||||
digicam_configure->extra_value = mavlink_msg_digicam_configure_get_extra_value(msg);
|
||||
#else
|
||||
memcpy(digicam_configure, _MAV_PAYLOAD(msg), 15);
|
||||
#endif
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
// MESSAGE DIGICAM_CONTROL PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_DIGICAM_CONTROL 155
|
||||
|
||||
typedef struct __mavlink_digicam_control_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
uint8_t session; ///< 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
|
||||
uint8_t zoom_pos; ///< 1 to N //Zoom's absolute position (0 means ignore)
|
||||
int8_t zoom_step; ///< -100 to 100 //Zooming step value to offset zoom from the current position
|
||||
uint8_t focus_lock; ///< 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
|
||||
uint8_t shot; ///< 0: ignore, 1: shot or start filming
|
||||
uint8_t command_id; ///< Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
uint8_t extra_param; ///< Extra parameters enumeration (0 means ignore)
|
||||
float extra_value; ///< Correspondent value to given extra_param
|
||||
} mavlink_digicam_control_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_DIGICAM_CONTROL_LEN 13
|
||||
#define MAVLINK_MSG_ID_155_LEN 13
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_DIGICAM_CONTROL { \
|
||||
"DIGICAM_CONTROL", \
|
||||
10, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_digicam_control_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_digicam_control_t, target_component) }, \
|
||||
{ "session", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_digicam_control_t, session) }, \
|
||||
{ "zoom_pos", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_digicam_control_t, zoom_pos) }, \
|
||||
{ "zoom_step", NULL, MAVLINK_TYPE_INT8_T, 0, 4, offsetof(mavlink_digicam_control_t, zoom_step) }, \
|
||||
{ "focus_lock", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_digicam_control_t, focus_lock) }, \
|
||||
{ "shot", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_digicam_control_t, shot) }, \
|
||||
{ "command_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_digicam_control_t, command_id) }, \
|
||||
{ "extra_param", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_digicam_control_t, extra_param) }, \
|
||||
{ "extra_value", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_digicam_control_t, extra_value) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a digicam_control message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
|
||||
* @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
|
||||
* @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
|
||||
* @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
|
||||
* @param shot 0: ignore, 1: shot or start filming
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[13];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, session);
|
||||
_mav_put_uint8_t(buf, 3, zoom_pos);
|
||||
_mav_put_int8_t(buf, 4, zoom_step);
|
||||
_mav_put_uint8_t(buf, 5, focus_lock);
|
||||
_mav_put_uint8_t(buf, 6, shot);
|
||||
_mav_put_uint8_t(buf, 7, command_id);
|
||||
_mav_put_uint8_t(buf, 8, extra_param);
|
||||
_mav_put_float(buf, 9, extra_value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 13);
|
||||
#else
|
||||
mavlink_digicam_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.session = session;
|
||||
packet.zoom_pos = zoom_pos;
|
||||
packet.zoom_step = zoom_step;
|
||||
packet.focus_lock = focus_lock;
|
||||
packet.shot = shot;
|
||||
packet.command_id = command_id;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 13);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a digicam_control message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
|
||||
* @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
|
||||
* @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
|
||||
* @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
|
||||
* @param shot 0: ignore, 1: shot or start filming
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t session,uint8_t zoom_pos,int8_t zoom_step,uint8_t focus_lock,uint8_t shot,uint8_t command_id,uint8_t extra_param,float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[13];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, session);
|
||||
_mav_put_uint8_t(buf, 3, zoom_pos);
|
||||
_mav_put_int8_t(buf, 4, zoom_step);
|
||||
_mav_put_uint8_t(buf, 5, focus_lock);
|
||||
_mav_put_uint8_t(buf, 6, shot);
|
||||
_mav_put_uint8_t(buf, 7, command_id);
|
||||
_mav_put_uint8_t(buf, 8, extra_param);
|
||||
_mav_put_float(buf, 9, extra_value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 13);
|
||||
#else
|
||||
mavlink_digicam_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.session = session;
|
||||
packet.zoom_pos = zoom_pos;
|
||||
packet.zoom_step = zoom_step;
|
||||
packet.focus_lock = focus_lock;
|
||||
packet.shot = shot;
|
||||
packet.command_id = command_id;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 13);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DIGICAM_CONTROL;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a digicam_control struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param digicam_control C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_digicam_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_digicam_control_t* digicam_control)
|
||||
{
|
||||
return mavlink_msg_digicam_control_pack(system_id, component_id, msg, digicam_control->target_system, digicam_control->target_component, digicam_control->session, digicam_control->zoom_pos, digicam_control->zoom_step, digicam_control->focus_lock, digicam_control->shot, digicam_control->command_id, digicam_control->extra_param, digicam_control->extra_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a digicam_control message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param session 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
|
||||
* @param zoom_pos 1 to N //Zoom's absolute position (0 means ignore)
|
||||
* @param zoom_step -100 to 100 //Zooming step value to offset zoom from the current position
|
||||
* @param focus_lock 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
|
||||
* @param shot 0: ignore, 1: shot or start filming
|
||||
* @param command_id Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
* @param extra_param Extra parameters enumeration (0 means ignore)
|
||||
* @param extra_value Correspondent value to given extra_param
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_digicam_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t session, uint8_t zoom_pos, int8_t zoom_step, uint8_t focus_lock, uint8_t shot, uint8_t command_id, uint8_t extra_param, float extra_value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[13];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, session);
|
||||
_mav_put_uint8_t(buf, 3, zoom_pos);
|
||||
_mav_put_int8_t(buf, 4, zoom_step);
|
||||
_mav_put_uint8_t(buf, 5, focus_lock);
|
||||
_mav_put_uint8_t(buf, 6, shot);
|
||||
_mav_put_uint8_t(buf, 7, command_id);
|
||||
_mav_put_uint8_t(buf, 8, extra_param);
|
||||
_mav_put_float(buf, 9, extra_value);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, buf, 13);
|
||||
#else
|
||||
mavlink_digicam_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.session = session;
|
||||
packet.zoom_pos = zoom_pos;
|
||||
packet.zoom_step = zoom_step;
|
||||
packet.focus_lock = focus_lock;
|
||||
packet.shot = shot;
|
||||
packet.command_id = command_id;
|
||||
packet.extra_param = extra_param;
|
||||
packet.extra_value = extra_value;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DIGICAM_CONTROL, (const char *)&packet, 13);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE DIGICAM_CONTROL UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from digicam_control message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from digicam_control message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field session from digicam_control message
|
||||
*
|
||||
* @return 0: stop, 1: start or keep it up //Session control e.g. show/hide lens
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_session(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field zoom_pos from digicam_control message
|
||||
*
|
||||
* @return 1 to N //Zoom's absolute position (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_zoom_pos(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field zoom_step from digicam_control message
|
||||
*
|
||||
* @return -100 to 100 //Zooming step value to offset zoom from the current position
|
||||
*/
|
||||
static inline int8_t mavlink_msg_digicam_control_get_zoom_step(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int8_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field focus_lock from digicam_control message
|
||||
*
|
||||
* @return 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_focus_lock(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field shot from digicam_control message
|
||||
*
|
||||
* @return 0: ignore, 1: shot or start filming
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_shot(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field command_id from digicam_control message
|
||||
*
|
||||
* @return Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_command_id(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field extra_param from digicam_control message
|
||||
*
|
||||
* @return Extra parameters enumeration (0 means ignore)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_digicam_control_get_extra_param(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field extra_value from digicam_control message
|
||||
*
|
||||
* @return Correspondent value to given extra_param
|
||||
*/
|
||||
static inline float mavlink_msg_digicam_control_get_extra_value(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 9);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a digicam_control message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param digicam_control C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_digicam_control_decode(const mavlink_message_t* msg, mavlink_digicam_control_t* digicam_control)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
digicam_control->target_system = mavlink_msg_digicam_control_get_target_system(msg);
|
||||
digicam_control->target_component = mavlink_msg_digicam_control_get_target_component(msg);
|
||||
digicam_control->session = mavlink_msg_digicam_control_get_session(msg);
|
||||
digicam_control->zoom_pos = mavlink_msg_digicam_control_get_zoom_pos(msg);
|
||||
digicam_control->zoom_step = mavlink_msg_digicam_control_get_zoom_step(msg);
|
||||
digicam_control->focus_lock = mavlink_msg_digicam_control_get_focus_lock(msg);
|
||||
digicam_control->shot = mavlink_msg_digicam_control_get_shot(msg);
|
||||
digicam_control->command_id = mavlink_msg_digicam_control_get_command_id(msg);
|
||||
digicam_control->extra_param = mavlink_msg_digicam_control_get_extra_param(msg);
|
||||
digicam_control->extra_value = mavlink_msg_digicam_control_get_extra_value(msg);
|
||||
#else
|
||||
memcpy(digicam_control, _MAV_PAYLOAD(msg), 13);
|
||||
#endif
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
// MESSAGE FENCE_FETCH_POINT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_FETCH_POINT 161
|
||||
|
||||
typedef struct __mavlink_fence_fetch_point_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
uint8_t idx; ///< point index (first point is 1, 0 is for return point)
|
||||
} mavlink_fence_fetch_point_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_FETCH_POINT_LEN 3
|
||||
#define MAVLINK_MSG_ID_161_LEN 3
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_FENCE_FETCH_POINT { \
|
||||
"FENCE_FETCH_POINT", \
|
||||
3, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fence_fetch_point_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_fence_fetch_point_t, target_component) }, \
|
||||
{ "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_fence_fetch_point_t, idx) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_fetch_point message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_fetch_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_fence_fetch_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_fetch_point message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_fetch_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_fence_fetch_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_FETCH_POINT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a fence_fetch_point struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param fence_fetch_point C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_fetch_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_fetch_point_t* fence_fetch_point)
|
||||
{
|
||||
return mavlink_msg_fence_fetch_point_pack(system_id, component_id, msg, fence_fetch_point->target_system, fence_fetch_point->target_component, fence_fetch_point->idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a fence_fetch_point message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_fence_fetch_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, buf, 3);
|
||||
#else
|
||||
mavlink_fence_fetch_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_FETCH_POINT, (const char *)&packet, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE FENCE_FETCH_POINT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from fence_fetch_point message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_fetch_point_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from fence_fetch_point message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_fetch_point_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field idx from fence_fetch_point message
|
||||
*
|
||||
* @return point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_fetch_point_get_idx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a fence_fetch_point message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param fence_fetch_point C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_fence_fetch_point_decode(const mavlink_message_t* msg, mavlink_fence_fetch_point_t* fence_fetch_point)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
fence_fetch_point->target_system = mavlink_msg_fence_fetch_point_get_target_system(msg);
|
||||
fence_fetch_point->target_component = mavlink_msg_fence_fetch_point_get_target_component(msg);
|
||||
fence_fetch_point->idx = mavlink_msg_fence_fetch_point_get_idx(msg);
|
||||
#else
|
||||
memcpy(fence_fetch_point, _MAV_PAYLOAD(msg), 3);
|
||||
#endif
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE FENCE_POINT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_POINT 160
|
||||
|
||||
typedef struct __mavlink_fence_point_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
uint8_t idx; ///< point index (first point is 1, 0 is for return point)
|
||||
uint8_t count; ///< total number of points (for sanity checking)
|
||||
float lat; ///< Latitude of point
|
||||
float lng; ///< Longitude of point
|
||||
} mavlink_fence_point_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_POINT_LEN 12
|
||||
#define MAVLINK_MSG_ID_160_LEN 12
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_FENCE_POINT { \
|
||||
"FENCE_POINT", \
|
||||
6, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fence_point_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_fence_point_t, target_component) }, \
|
||||
{ "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_fence_point_t, idx) }, \
|
||||
{ "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_fence_point_t, count) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_fence_point_t, lat) }, \
|
||||
{ "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_fence_point_t, lng) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_point message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
_mav_put_uint8_t(buf, 3, count);
|
||||
_mav_put_float(buf, 4, lat);
|
||||
_mav_put_float(buf, 8, lng);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_fence_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_POINT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_point message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t idx,uint8_t count,float lat,float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
_mav_put_uint8_t(buf, 3, count);
|
||||
_mav_put_float(buf, 4, lat);
|
||||
_mav_put_float(buf, 8, lng);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_fence_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_POINT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a fence_point struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param fence_point C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_point_t* fence_point)
|
||||
{
|
||||
return mavlink_msg_fence_point_pack(system_id, component_id, msg, fence_point->target_system, fence_point->target_component, fence_point->idx, fence_point->count, fence_point->lat, fence_point->lng);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a fence_point message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_fence_point_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t idx, uint8_t count, float lat, float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, idx);
|
||||
_mav_put_uint8_t(buf, 3, count);
|
||||
_mav_put_float(buf, 4, lat);
|
||||
_mav_put_float(buf, 8, lng);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, buf, 12);
|
||||
#else
|
||||
mavlink_fence_point_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_POINT, (const char *)&packet, 12);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE FENCE_POINT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from fence_point message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_point_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from fence_point message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_point_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field idx from fence_point message
|
||||
*
|
||||
* @return point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_point_get_idx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field count from fence_point message
|
||||
*
|
||||
* @return total number of points (for sanity checking)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_point_get_count(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from fence_point message
|
||||
*
|
||||
* @return Latitude of point
|
||||
*/
|
||||
static inline float mavlink_msg_fence_point_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lng from fence_point message
|
||||
*
|
||||
* @return Longitude of point
|
||||
*/
|
||||
static inline float mavlink_msg_fence_point_get_lng(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a fence_point message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param fence_point C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_fence_point_decode(const mavlink_message_t* msg, mavlink_fence_point_t* fence_point)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
fence_point->target_system = mavlink_msg_fence_point_get_target_system(msg);
|
||||
fence_point->target_component = mavlink_msg_fence_point_get_target_component(msg);
|
||||
fence_point->idx = mavlink_msg_fence_point_get_idx(msg);
|
||||
fence_point->count = mavlink_msg_fence_point_get_count(msg);
|
||||
fence_point->lat = mavlink_msg_fence_point_get_lat(msg);
|
||||
fence_point->lng = mavlink_msg_fence_point_get_lng(msg);
|
||||
#else
|
||||
memcpy(fence_point, _MAV_PAYLOAD(msg), 12);
|
||||
#endif
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
// MESSAGE FENCE_STATUS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_STATUS 162
|
||||
|
||||
typedef struct __mavlink_fence_status_t
|
||||
{
|
||||
uint8_t breach_status; ///< 0 if currently inside fence, 1 if outside
|
||||
uint16_t breach_count; ///< number of fence breaches
|
||||
uint8_t breach_type; ///< last breach type (see FENCE_BREACH_* enum)
|
||||
uint32_t breach_time; ///< time of last breach in milliseconds since boot
|
||||
} mavlink_fence_status_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCE_STATUS_LEN 8
|
||||
#define MAVLINK_MSG_ID_162_LEN 8
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_FENCE_STATUS { \
|
||||
"FENCE_STATUS", \
|
||||
4, \
|
||||
{ { "breach_status", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fence_status_t, breach_status) }, \
|
||||
{ "breach_count", NULL, MAVLINK_TYPE_UINT16_T, 0, 1, offsetof(mavlink_fence_status_t, breach_count) }, \
|
||||
{ "breach_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_fence_status_t, breach_type) }, \
|
||||
{ "breach_time", NULL, MAVLINK_TYPE_UINT32_T, 0, 4, offsetof(mavlink_fence_status_t, breach_time) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_status message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param breach_status 0 if currently inside fence, 1 if outside
|
||||
* @param breach_count number of fence breaches
|
||||
* @param breach_type last breach type (see FENCE_BREACH_* enum)
|
||||
* @param breach_time time of last breach in milliseconds since boot
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, breach_status);
|
||||
_mav_put_uint16_t(buf, 1, breach_count);
|
||||
_mav_put_uint8_t(buf, 3, breach_type);
|
||||
_mav_put_uint32_t(buf, 4, breach_time);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_fence_status_t packet;
|
||||
packet.breach_status = breach_status;
|
||||
packet.breach_count = breach_count;
|
||||
packet.breach_type = breach_type;
|
||||
packet.breach_time = breach_time;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_STATUS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a fence_status message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param breach_status 0 if currently inside fence, 1 if outside
|
||||
* @param breach_count number of fence breaches
|
||||
* @param breach_type last breach type (see FENCE_BREACH_* enum)
|
||||
* @param breach_time time of last breach in milliseconds since boot
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t breach_status,uint16_t breach_count,uint8_t breach_type,uint32_t breach_time)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, breach_status);
|
||||
_mav_put_uint16_t(buf, 1, breach_count);
|
||||
_mav_put_uint8_t(buf, 3, breach_type);
|
||||
_mav_put_uint32_t(buf, 4, breach_time);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_fence_status_t packet;
|
||||
packet.breach_status = breach_status;
|
||||
packet.breach_count = breach_count;
|
||||
packet.breach_type = breach_type;
|
||||
packet.breach_time = breach_time;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCE_STATUS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a fence_status struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param fence_status C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fence_status_t* fence_status)
|
||||
{
|
||||
return mavlink_msg_fence_status_pack(system_id, component_id, msg, fence_status->breach_status, fence_status->breach_count, fence_status->breach_type, fence_status->breach_time);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a fence_status message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param breach_status 0 if currently inside fence, 1 if outside
|
||||
* @param breach_count number of fence breaches
|
||||
* @param breach_type last breach type (see FENCE_BREACH_* enum)
|
||||
* @param breach_time time of last breach in milliseconds since boot
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_fence_status_send(mavlink_channel_t chan, uint8_t breach_status, uint16_t breach_count, uint8_t breach_type, uint32_t breach_time)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, breach_status);
|
||||
_mav_put_uint16_t(buf, 1, breach_count);
|
||||
_mav_put_uint8_t(buf, 3, breach_type);
|
||||
_mav_put_uint32_t(buf, 4, breach_time);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, buf, 8);
|
||||
#else
|
||||
mavlink_fence_status_t packet;
|
||||
packet.breach_status = breach_status;
|
||||
packet.breach_count = breach_count;
|
||||
packet.breach_type = breach_type;
|
||||
packet.breach_time = breach_time;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCE_STATUS, (const char *)&packet, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE FENCE_STATUS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field breach_status from fence_status message
|
||||
*
|
||||
* @return 0 if currently inside fence, 1 if outside
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_status_get_breach_status(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field breach_count from fence_status message
|
||||
*
|
||||
* @return number of fence breaches
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fence_status_get_breach_count(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field breach_type from fence_status message
|
||||
*
|
||||
* @return last breach type (see FENCE_BREACH_* enum)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fence_status_get_breach_type(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field breach_time from fence_status message
|
||||
*
|
||||
* @return time of last breach in milliseconds since boot
|
||||
*/
|
||||
static inline uint32_t mavlink_msg_fence_status_get_breach_time(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint32_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a fence_status message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param fence_status C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_fence_status_decode(const mavlink_message_t* msg, mavlink_fence_status_t* fence_status)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
fence_status->breach_status = mavlink_msg_fence_status_get_breach_status(msg);
|
||||
fence_status->breach_count = mavlink_msg_fence_status_get_breach_count(msg);
|
||||
fence_status->breach_type = mavlink_msg_fence_status_get_breach_type(msg);
|
||||
fence_status->breach_time = mavlink_msg_fence_status_get_breach_time(msg);
|
||||
#else
|
||||
memcpy(fence_status, _MAV_PAYLOAD(msg), 8);
|
||||
#endif
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
// MESSAGE FENCED_FETCH_POINT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCED_FETCH_POINT 161
|
||||
|
||||
typedef struct __mavlink_fenced_fetch_point_t
|
||||
{
|
||||
uint8_t idx; ///< point index (first point is 1, 0 is for return point)
|
||||
} mavlink_fenced_fetch_point_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCED_FETCH_POINT_LEN 1
|
||||
#define MAVLINK_MSG_ID_161_LEN 1
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_FENCED_FETCH_POINT { \
|
||||
"FENCED_FETCH_POINT", \
|
||||
1, \
|
||||
{ { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fenced_fetch_point_t, idx) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a fenced_fetch_point message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_fetch_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[1];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 1);
|
||||
#else
|
||||
mavlink_fenced_fetch_point_t packet;
|
||||
packet.idx = idx;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 1);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCED_FETCH_POINT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a fenced_fetch_point message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_fetch_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[1];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 1);
|
||||
#else
|
||||
mavlink_fenced_fetch_point_t packet;
|
||||
packet.idx = idx;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 1);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCED_FETCH_POINT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a fenced_fetch_point struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param fenced_fetch_point C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_fetch_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fenced_fetch_point_t* fenced_fetch_point)
|
||||
{
|
||||
return mavlink_msg_fenced_fetch_point_pack(system_id, component_id, msg, fenced_fetch_point->idx);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a fenced_fetch_point message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_fenced_fetch_point_send(mavlink_channel_t chan, uint8_t idx)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[1];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCED_FETCH_POINT, buf, 1);
|
||||
#else
|
||||
mavlink_fenced_fetch_point_t packet;
|
||||
packet.idx = idx;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCED_FETCH_POINT, (const char *)&packet, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE FENCED_FETCH_POINT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field idx from fenced_fetch_point message
|
||||
*
|
||||
* @return point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fenced_fetch_point_get_idx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a fenced_fetch_point message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param fenced_fetch_point C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_fenced_fetch_point_decode(const mavlink_message_t* msg, mavlink_fenced_fetch_point_t* fenced_fetch_point)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
fenced_fetch_point->idx = mavlink_msg_fenced_fetch_point_get_idx(msg);
|
||||
#else
|
||||
memcpy(fenced_fetch_point, _MAV_PAYLOAD(msg), 1);
|
||||
#endif
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
// MESSAGE FENCED_POINT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCED_POINT 160
|
||||
|
||||
typedef struct __mavlink_fenced_point_t
|
||||
{
|
||||
uint8_t idx; ///< point index (first point is 1, 0 is for return point)
|
||||
uint8_t count; ///< total number of points (for sanity checking)
|
||||
float lat; ///< Latitude of point
|
||||
float lng; ///< Longitude of point
|
||||
} mavlink_fenced_point_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_FENCED_POINT_LEN 10
|
||||
#define MAVLINK_MSG_ID_160_LEN 10
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_FENCED_POINT { \
|
||||
"FENCED_POINT", \
|
||||
4, \
|
||||
{ { "idx", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_fenced_point_t, idx) }, \
|
||||
{ "count", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_fenced_point_t, count) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 2, offsetof(mavlink_fenced_point_t, lat) }, \
|
||||
{ "lng", NULL, MAVLINK_TYPE_FLOAT, 0, 6, offsetof(mavlink_fenced_point_t, lng) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a fenced_point message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_point_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t idx, uint8_t count, float lat, float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[10];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
_mav_put_uint8_t(buf, 1, count);
|
||||
_mav_put_float(buf, 2, lat);
|
||||
_mav_put_float(buf, 6, lng);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 10);
|
||||
#else
|
||||
mavlink_fenced_point_t packet;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 10);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCED_POINT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a fenced_point message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_point_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t idx,uint8_t count,float lat,float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[10];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
_mav_put_uint8_t(buf, 1, count);
|
||||
_mav_put_float(buf, 2, lat);
|
||||
_mav_put_float(buf, 6, lng);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 10);
|
||||
#else
|
||||
mavlink_fenced_point_t packet;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 10);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_FENCED_POINT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a fenced_point struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param fenced_point C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_fenced_point_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_fenced_point_t* fenced_point)
|
||||
{
|
||||
return mavlink_msg_fenced_point_pack(system_id, component_id, msg, fenced_point->idx, fenced_point->count, fenced_point->lat, fenced_point->lng);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a fenced_point message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param idx point index (first point is 1, 0 is for return point)
|
||||
* @param count total number of points (for sanity checking)
|
||||
* @param lat Latitude of point
|
||||
* @param lng Longitude of point
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_fenced_point_send(mavlink_channel_t chan, uint8_t idx, uint8_t count, float lat, float lng)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[10];
|
||||
_mav_put_uint8_t(buf, 0, idx);
|
||||
_mav_put_uint8_t(buf, 1, count);
|
||||
_mav_put_float(buf, 2, lat);
|
||||
_mav_put_float(buf, 6, lng);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCED_POINT, buf, 10);
|
||||
#else
|
||||
mavlink_fenced_point_t packet;
|
||||
packet.idx = idx;
|
||||
packet.count = count;
|
||||
packet.lat = lat;
|
||||
packet.lng = lng;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_FENCED_POINT, (const char *)&packet, 10);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE FENCED_POINT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field idx from fenced_point message
|
||||
*
|
||||
* @return point index (first point is 1, 0 is for return point)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fenced_point_get_idx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field count from fenced_point message
|
||||
*
|
||||
* @return total number of points (for sanity checking)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_fenced_point_get_count(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from fenced_point message
|
||||
*
|
||||
* @return Latitude of point
|
||||
*/
|
||||
static inline float mavlink_msg_fenced_point_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lng from fenced_point message
|
||||
*
|
||||
* @return Longitude of point
|
||||
*/
|
||||
static inline float mavlink_msg_fenced_point_get_lng(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a fenced_point message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param fenced_point C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_fenced_point_decode(const mavlink_message_t* msg, mavlink_fenced_point_t* fenced_point)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
fenced_point->idx = mavlink_msg_fenced_point_get_idx(msg);
|
||||
fenced_point->count = mavlink_msg_fenced_point_get_count(msg);
|
||||
fenced_point->lat = mavlink_msg_fenced_point_get_lat(msg);
|
||||
fenced_point->lng = mavlink_msg_fenced_point_get_lng(msg);
|
||||
#else
|
||||
memcpy(fenced_point, _MAV_PAYLOAD(msg), 10);
|
||||
#endif
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// MESSAGE MEMINFO PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_MEMINFO 152
|
||||
|
||||
typedef struct __mavlink_meminfo_t
|
||||
{
|
||||
uint16_t brkval; ///< heap top
|
||||
uint16_t freemem; ///< free memory
|
||||
} mavlink_meminfo_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_MEMINFO_LEN 4
|
||||
#define MAVLINK_MSG_ID_152_LEN 4
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_MEMINFO { \
|
||||
"MEMINFO", \
|
||||
2, \
|
||||
{ { "brkval", NULL, MAVLINK_TYPE_UINT16_T, 0, 0, offsetof(mavlink_meminfo_t, brkval) }, \
|
||||
{ "freemem", NULL, MAVLINK_TYPE_UINT16_T, 0, 2, offsetof(mavlink_meminfo_t, freemem) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a meminfo message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param brkval heap top
|
||||
* @param freemem free memory
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_meminfo_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint16_t brkval, uint16_t freemem)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint16_t(buf, 0, brkval);
|
||||
_mav_put_uint16_t(buf, 2, freemem);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 4);
|
||||
#else
|
||||
mavlink_meminfo_t packet;
|
||||
packet.brkval = brkval;
|
||||
packet.freemem = freemem;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 4);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MEMINFO;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a meminfo message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param brkval heap top
|
||||
* @param freemem free memory
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_meminfo_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint16_t brkval,uint16_t freemem)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint16_t(buf, 0, brkval);
|
||||
_mav_put_uint16_t(buf, 2, freemem);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 4);
|
||||
#else
|
||||
mavlink_meminfo_t packet;
|
||||
packet.brkval = brkval;
|
||||
packet.freemem = freemem;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 4);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MEMINFO;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a meminfo struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param meminfo C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_meminfo_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_meminfo_t* meminfo)
|
||||
{
|
||||
return mavlink_msg_meminfo_pack(system_id, component_id, msg, meminfo->brkval, meminfo->freemem);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a meminfo message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param brkval heap top
|
||||
* @param freemem free memory
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_meminfo_send(mavlink_channel_t chan, uint16_t brkval, uint16_t freemem)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint16_t(buf, 0, brkval);
|
||||
_mav_put_uint16_t(buf, 2, freemem);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, buf, 4);
|
||||
#else
|
||||
mavlink_meminfo_t packet;
|
||||
packet.brkval = brkval;
|
||||
packet.freemem = freemem;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MEMINFO, (const char *)&packet, 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE MEMINFO UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field brkval from meminfo message
|
||||
*
|
||||
* @return heap top
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_meminfo_get_brkval(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field freemem from meminfo message
|
||||
*
|
||||
* @return free memory
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_meminfo_get_freemem(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint16_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a meminfo message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param meminfo C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_meminfo_decode(const mavlink_message_t* msg, mavlink_meminfo_t* meminfo)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
meminfo->brkval = mavlink_msg_meminfo_get_brkval(msg);
|
||||
meminfo->freemem = mavlink_msg_meminfo_get_freemem(msg);
|
||||
#else
|
||||
memcpy(meminfo, _MAV_PAYLOAD(msg), 4);
|
||||
#endif
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE MOUNT_CONFIGURE PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_CONFIGURE 156
|
||||
|
||||
typedef struct __mavlink_mount_configure_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
uint8_t mount_mode; ///< mount operating mode (see MAV_MOUNT_MODE enum)
|
||||
uint8_t stab_roll; ///< (1 = yes, 0 = no)
|
||||
uint8_t stab_pitch; ///< (1 = yes, 0 = no)
|
||||
uint8_t stab_yaw; ///< (1 = yes, 0 = no)
|
||||
} mavlink_mount_configure_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_CONFIGURE_LEN 6
|
||||
#define MAVLINK_MSG_ID_156_LEN 6
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_MOUNT_CONFIGURE { \
|
||||
"MOUNT_CONFIGURE", \
|
||||
6, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_configure_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_configure_t, target_component) }, \
|
||||
{ "mount_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_mount_configure_t, mount_mode) }, \
|
||||
{ "stab_roll", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_mount_configure_t, stab_roll) }, \
|
||||
{ "stab_pitch", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_mount_configure_t, stab_pitch) }, \
|
||||
{ "stab_yaw", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_mount_configure_t, stab_yaw) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_configure message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mount_mode mount operating mode (see MAV_MOUNT_MODE enum)
|
||||
* @param stab_roll (1 = yes, 0 = no)
|
||||
* @param stab_pitch (1 = yes, 0 = no)
|
||||
* @param stab_yaw (1 = yes, 0 = no)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_configure_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t mount_mode, uint8_t stab_roll, uint8_t stab_pitch, uint8_t stab_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[6];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mount_mode);
|
||||
_mav_put_uint8_t(buf, 3, stab_roll);
|
||||
_mav_put_uint8_t(buf, 4, stab_pitch);
|
||||
_mav_put_uint8_t(buf, 5, stab_yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 6);
|
||||
#else
|
||||
mavlink_mount_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mount_mode = mount_mode;
|
||||
packet.stab_roll = stab_roll;
|
||||
packet.stab_pitch = stab_pitch;
|
||||
packet.stab_yaw = stab_yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 6);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_configure message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mount_mode mount operating mode (see MAV_MOUNT_MODE enum)
|
||||
* @param stab_roll (1 = yes, 0 = no)
|
||||
* @param stab_pitch (1 = yes, 0 = no)
|
||||
* @param stab_yaw (1 = yes, 0 = no)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_configure_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t mount_mode,uint8_t stab_roll,uint8_t stab_pitch,uint8_t stab_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[6];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mount_mode);
|
||||
_mav_put_uint8_t(buf, 3, stab_roll);
|
||||
_mav_put_uint8_t(buf, 4, stab_pitch);
|
||||
_mav_put_uint8_t(buf, 5, stab_yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 6);
|
||||
#else
|
||||
mavlink_mount_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mount_mode = mount_mode;
|
||||
packet.stab_roll = stab_roll;
|
||||
packet.stab_pitch = stab_pitch;
|
||||
packet.stab_yaw = stab_yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 6);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_CONFIGURE;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a mount_configure struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param mount_configure C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_configure_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_configure_t* mount_configure)
|
||||
{
|
||||
return mavlink_msg_mount_configure_pack(system_id, component_id, msg, mount_configure->target_system, mount_configure->target_component, mount_configure->mount_mode, mount_configure->stab_roll, mount_configure->stab_pitch, mount_configure->stab_yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a mount_configure message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mount_mode mount operating mode (see MAV_MOUNT_MODE enum)
|
||||
* @param stab_roll (1 = yes, 0 = no)
|
||||
* @param stab_pitch (1 = yes, 0 = no)
|
||||
* @param stab_yaw (1 = yes, 0 = no)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_mount_configure_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t mount_mode, uint8_t stab_roll, uint8_t stab_pitch, uint8_t stab_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[6];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, mount_mode);
|
||||
_mav_put_uint8_t(buf, 3, stab_roll);
|
||||
_mav_put_uint8_t(buf, 4, stab_pitch);
|
||||
_mav_put_uint8_t(buf, 5, stab_yaw);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, buf, 6);
|
||||
#else
|
||||
mavlink_mount_configure_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mount_mode = mount_mode;
|
||||
packet.stab_roll = stab_roll;
|
||||
packet.stab_pitch = stab_pitch;
|
||||
packet.stab_yaw = stab_yaw;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONFIGURE, (const char *)&packet, 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE MOUNT_CONFIGURE UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from mount_configure message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from mount_configure message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mount_mode from mount_configure message
|
||||
*
|
||||
* @return mount operating mode (see MAV_MOUNT_MODE enum)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_mount_mode(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field stab_roll from mount_configure message
|
||||
*
|
||||
* @return (1 = yes, 0 = no)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_stab_roll(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field stab_pitch from mount_configure message
|
||||
*
|
||||
* @return (1 = yes, 0 = no)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_stab_pitch(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field stab_yaw from mount_configure message
|
||||
*
|
||||
* @return (1 = yes, 0 = no)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_configure_get_stab_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a mount_configure message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param mount_configure C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_mount_configure_decode(const mavlink_message_t* msg, mavlink_mount_configure_t* mount_configure)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
mount_configure->target_system = mavlink_msg_mount_configure_get_target_system(msg);
|
||||
mount_configure->target_component = mavlink_msg_mount_configure_get_target_component(msg);
|
||||
mount_configure->mount_mode = mavlink_msg_mount_configure_get_mount_mode(msg);
|
||||
mount_configure->stab_roll = mavlink_msg_mount_configure_get_stab_roll(msg);
|
||||
mount_configure->stab_pitch = mavlink_msg_mount_configure_get_stab_pitch(msg);
|
||||
mount_configure->stab_yaw = mavlink_msg_mount_configure_get_stab_yaw(msg);
|
||||
#else
|
||||
memcpy(mount_configure, _MAV_PAYLOAD(msg), 6);
|
||||
#endif
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE MOUNT_CONTROL PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_CONTROL 157
|
||||
|
||||
typedef struct __mavlink_mount_control_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
int32_t input_a; ///< pitch(deg*100) or lat, depending on mount mode
|
||||
int32_t input_b; ///< roll(deg*100) or lon depending on mount mode
|
||||
int32_t input_c; ///< yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
uint8_t save_position; ///< if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)
|
||||
} mavlink_mount_control_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_CONTROL_LEN 15
|
||||
#define MAVLINK_MSG_ID_157_LEN 15
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_MOUNT_CONTROL { \
|
||||
"MOUNT_CONTROL", \
|
||||
6, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_control_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_control_t, target_component) }, \
|
||||
{ "input_a", NULL, MAVLINK_TYPE_INT32_T, 0, 2, offsetof(mavlink_mount_control_t, input_a) }, \
|
||||
{ "input_b", NULL, MAVLINK_TYPE_INT32_T, 0, 6, offsetof(mavlink_mount_control_t, input_b) }, \
|
||||
{ "input_c", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_mount_control_t, input_c) }, \
|
||||
{ "save_position", NULL, MAVLINK_TYPE_UINT8_T, 0, 14, offsetof(mavlink_mount_control_t, save_position) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_control message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param input_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param input_b roll(deg*100) or lon depending on mount mode
|
||||
* @param input_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
* @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, input_a);
|
||||
_mav_put_int32_t(buf, 6, input_b);
|
||||
_mav_put_int32_t(buf, 10, input_c);
|
||||
_mav_put_uint8_t(buf, 14, save_position);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 15);
|
||||
#else
|
||||
mavlink_mount_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.input_a = input_a;
|
||||
packet.input_b = input_b;
|
||||
packet.input_c = input_c;
|
||||
packet.save_position = save_position;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 15);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_control message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param input_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param input_b roll(deg*100) or lon depending on mount mode
|
||||
* @param input_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
* @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,int32_t input_a,int32_t input_b,int32_t input_c,uint8_t save_position)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, input_a);
|
||||
_mav_put_int32_t(buf, 6, input_b);
|
||||
_mav_put_int32_t(buf, 10, input_c);
|
||||
_mav_put_uint8_t(buf, 14, save_position);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 15);
|
||||
#else
|
||||
mavlink_mount_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.input_a = input_a;
|
||||
packet.input_b = input_b;
|
||||
packet.input_c = input_c;
|
||||
packet.save_position = save_position;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 15);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_CONTROL;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a mount_control struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param mount_control C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_control_t* mount_control)
|
||||
{
|
||||
return mavlink_msg_mount_control_pack(system_id, component_id, msg, mount_control->target_system, mount_control->target_component, mount_control->input_a, mount_control->input_b, mount_control->input_c, mount_control->save_position);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a mount_control message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param input_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param input_b roll(deg*100) or lon depending on mount mode
|
||||
* @param input_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
* @param save_position if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_mount_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t input_a, int32_t input_b, int32_t input_c, uint8_t save_position)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[15];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, input_a);
|
||||
_mav_put_int32_t(buf, 6, input_b);
|
||||
_mav_put_int32_t(buf, 10, input_c);
|
||||
_mav_put_uint8_t(buf, 14, save_position);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, buf, 15);
|
||||
#else
|
||||
mavlink_mount_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.input_a = input_a;
|
||||
packet.input_b = input_b;
|
||||
packet.input_c = input_c;
|
||||
packet.save_position = save_position;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_CONTROL, (const char *)&packet, 15);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE MOUNT_CONTROL UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from mount_control message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_control_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from mount_control message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_control_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field input_a from mount_control message
|
||||
*
|
||||
* @return pitch(deg*100) or lat, depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_control_get_input_a(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field input_b from mount_control message
|
||||
*
|
||||
* @return roll(deg*100) or lon depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_control_get_input_b(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field input_c from mount_control message
|
||||
*
|
||||
* @return yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_control_get_input_c(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field save_position from mount_control message
|
||||
*
|
||||
* @return if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_control_get_save_position(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a mount_control message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param mount_control C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_mount_control_decode(const mavlink_message_t* msg, mavlink_mount_control_t* mount_control)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
mount_control->target_system = mavlink_msg_mount_control_get_target_system(msg);
|
||||
mount_control->target_component = mavlink_msg_mount_control_get_target_component(msg);
|
||||
mount_control->input_a = mavlink_msg_mount_control_get_input_a(msg);
|
||||
mount_control->input_b = mavlink_msg_mount_control_get_input_b(msg);
|
||||
mount_control->input_c = mavlink_msg_mount_control_get_input_c(msg);
|
||||
mount_control->save_position = mavlink_msg_mount_control_get_save_position(msg);
|
||||
#else
|
||||
memcpy(mount_control, _MAV_PAYLOAD(msg), 15);
|
||||
#endif
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
// MESSAGE MOUNT_STATUS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_STATUS 158
|
||||
|
||||
typedef struct __mavlink_mount_status_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
int32_t pointing_a; ///< pitch(deg*100) or lat, depending on mount mode
|
||||
int32_t pointing_b; ///< roll(deg*100) or lon depending on mount mode
|
||||
int32_t pointing_c; ///< yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
} mavlink_mount_status_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_MOUNT_STATUS_LEN 14
|
||||
#define MAVLINK_MSG_ID_158_LEN 14
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_MOUNT_STATUS { \
|
||||
"MOUNT_STATUS", \
|
||||
5, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_mount_status_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_mount_status_t, target_component) }, \
|
||||
{ "pointing_a", NULL, MAVLINK_TYPE_INT32_T, 0, 2, offsetof(mavlink_mount_status_t, pointing_a) }, \
|
||||
{ "pointing_b", NULL, MAVLINK_TYPE_INT32_T, 0, 6, offsetof(mavlink_mount_status_t, pointing_b) }, \
|
||||
{ "pointing_c", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_mount_status_t, pointing_c) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_status message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param pointing_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param pointing_b roll(deg*100) or lon depending on mount mode
|
||||
* @param pointing_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, pointing_a);
|
||||
_mav_put_int32_t(buf, 6, pointing_b);
|
||||
_mav_put_int32_t(buf, 10, pointing_c);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 14);
|
||||
#else
|
||||
mavlink_mount_status_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.pointing_a = pointing_a;
|
||||
packet.pointing_b = pointing_b;
|
||||
packet.pointing_c = pointing_c;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 14);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a mount_status message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param pointing_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param pointing_b roll(deg*100) or lon depending on mount mode
|
||||
* @param pointing_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,int32_t pointing_a,int32_t pointing_b,int32_t pointing_c)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, pointing_a);
|
||||
_mav_put_int32_t(buf, 6, pointing_b);
|
||||
_mav_put_int32_t(buf, 10, pointing_c);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 14);
|
||||
#else
|
||||
mavlink_mount_status_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.pointing_a = pointing_a;
|
||||
packet.pointing_b = pointing_b;
|
||||
packet.pointing_c = pointing_c;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 14);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_MOUNT_STATUS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a mount_status struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param mount_status C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_mount_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mount_status_t* mount_status)
|
||||
{
|
||||
return mavlink_msg_mount_status_pack(system_id, component_id, msg, mount_status->target_system, mount_status->target_component, mount_status->pointing_a, mount_status->pointing_b, mount_status->pointing_c);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a mount_status message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param pointing_a pitch(deg*100) or lat, depending on mount mode
|
||||
* @param pointing_b roll(deg*100) or lon depending on mount mode
|
||||
* @param pointing_c yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_mount_status_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t pointing_a, int32_t pointing_b, int32_t pointing_c)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, pointing_a);
|
||||
_mav_put_int32_t(buf, 6, pointing_b);
|
||||
_mav_put_int32_t(buf, 10, pointing_c);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, buf, 14);
|
||||
#else
|
||||
mavlink_mount_status_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.pointing_a = pointing_a;
|
||||
packet.pointing_b = pointing_b;
|
||||
packet.pointing_c = pointing_c;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MOUNT_STATUS, (const char *)&packet, 14);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE MOUNT_STATUS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from mount_status message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_status_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from mount_status message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_mount_status_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pointing_a from mount_status message
|
||||
*
|
||||
* @return pitch(deg*100) or lat, depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_status_get_pointing_a(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pointing_b from mount_status message
|
||||
*
|
||||
* @return roll(deg*100) or lon depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_status_get_pointing_b(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pointing_c from mount_status message
|
||||
*
|
||||
* @return yaw(deg*100) or alt (in cm) depending on mount mode
|
||||
*/
|
||||
static inline int32_t mavlink_msg_mount_status_get_pointing_c(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a mount_status message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param mount_status C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_mount_status_decode(const mavlink_message_t* msg, mavlink_mount_status_t* mount_status)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
mount_status->target_system = mavlink_msg_mount_status_get_target_system(msg);
|
||||
mount_status->target_component = mavlink_msg_mount_status_get_target_component(msg);
|
||||
mount_status->pointing_a = mavlink_msg_mount_status_get_pointing_a(msg);
|
||||
mount_status->pointing_b = mavlink_msg_mount_status_get_pointing_b(msg);
|
||||
mount_status->pointing_c = mavlink_msg_mount_status_get_pointing_c(msg);
|
||||
#else
|
||||
memcpy(mount_status, _MAV_PAYLOAD(msg), 14);
|
||||
#endif
|
||||
}
|
||||
@@ -1,386 +0,0 @@
|
||||
// MESSAGE SENSOR_OFFSETS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_SENSOR_OFFSETS 150
|
||||
|
||||
typedef struct __mavlink_sensor_offsets_t
|
||||
{
|
||||
int16_t mag_ofs_x; ///< magnetometer X offset
|
||||
int16_t mag_ofs_y; ///< magnetometer Y offset
|
||||
int16_t mag_ofs_z; ///< magnetometer Z offset
|
||||
float mag_declination; ///< magnetic declination (radians)
|
||||
int32_t raw_press; ///< raw pressure from barometer
|
||||
int32_t raw_temp; ///< raw temperature from barometer
|
||||
float gyro_cal_x; ///< gyro X calibration
|
||||
float gyro_cal_y; ///< gyro Y calibration
|
||||
float gyro_cal_z; ///< gyro Z calibration
|
||||
float accel_cal_x; ///< accel X calibration
|
||||
float accel_cal_y; ///< accel Y calibration
|
||||
float accel_cal_z; ///< accel Z calibration
|
||||
} mavlink_sensor_offsets_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_SENSOR_OFFSETS_LEN 42
|
||||
#define MAVLINK_MSG_ID_150_LEN 42
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_SENSOR_OFFSETS { \
|
||||
"SENSOR_OFFSETS", \
|
||||
12, \
|
||||
{ { "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 0, offsetof(mavlink_sensor_offsets_t, mag_ofs_x) }, \
|
||||
{ "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_sensor_offsets_t, mag_ofs_y) }, \
|
||||
{ "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_sensor_offsets_t, mag_ofs_z) }, \
|
||||
{ "mag_declination", NULL, MAVLINK_TYPE_FLOAT, 0, 6, offsetof(mavlink_sensor_offsets_t, mag_declination) }, \
|
||||
{ "raw_press", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_sensor_offsets_t, raw_press) }, \
|
||||
{ "raw_temp", NULL, MAVLINK_TYPE_INT32_T, 0, 14, offsetof(mavlink_sensor_offsets_t, raw_temp) }, \
|
||||
{ "gyro_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 18, offsetof(mavlink_sensor_offsets_t, gyro_cal_x) }, \
|
||||
{ "gyro_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_sensor_offsets_t, gyro_cal_y) }, \
|
||||
{ "gyro_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 26, offsetof(mavlink_sensor_offsets_t, gyro_cal_z) }, \
|
||||
{ "accel_cal_x", NULL, MAVLINK_TYPE_FLOAT, 0, 30, offsetof(mavlink_sensor_offsets_t, accel_cal_x) }, \
|
||||
{ "accel_cal_y", NULL, MAVLINK_TYPE_FLOAT, 0, 34, offsetof(mavlink_sensor_offsets_t, accel_cal_y) }, \
|
||||
{ "accel_cal_z", NULL, MAVLINK_TYPE_FLOAT, 0, 38, offsetof(mavlink_sensor_offsets_t, accel_cal_z) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a sensor_offsets message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
* @param mag_declination magnetic declination (radians)
|
||||
* @param raw_press raw pressure from barometer
|
||||
* @param raw_temp raw temperature from barometer
|
||||
* @param gyro_cal_x gyro X calibration
|
||||
* @param gyro_cal_y gyro Y calibration
|
||||
* @param gyro_cal_z gyro Z calibration
|
||||
* @param accel_cal_x accel X calibration
|
||||
* @param accel_cal_y accel Y calibration
|
||||
* @param accel_cal_z accel Z calibration
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_sensor_offsets_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[42];
|
||||
_mav_put_int16_t(buf, 0, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_z);
|
||||
_mav_put_float(buf, 6, mag_declination);
|
||||
_mav_put_int32_t(buf, 10, raw_press);
|
||||
_mav_put_int32_t(buf, 14, raw_temp);
|
||||
_mav_put_float(buf, 18, gyro_cal_x);
|
||||
_mav_put_float(buf, 22, gyro_cal_y);
|
||||
_mav_put_float(buf, 26, gyro_cal_z);
|
||||
_mav_put_float(buf, 30, accel_cal_x);
|
||||
_mav_put_float(buf, 34, accel_cal_y);
|
||||
_mav_put_float(buf, 38, accel_cal_z);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 42);
|
||||
#else
|
||||
mavlink_sensor_offsets_t packet;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
packet.mag_declination = mag_declination;
|
||||
packet.raw_press = raw_press;
|
||||
packet.raw_temp = raw_temp;
|
||||
packet.gyro_cal_x = gyro_cal_x;
|
||||
packet.gyro_cal_y = gyro_cal_y;
|
||||
packet.gyro_cal_z = gyro_cal_z;
|
||||
packet.accel_cal_x = accel_cal_x;
|
||||
packet.accel_cal_y = accel_cal_y;
|
||||
packet.accel_cal_z = accel_cal_z;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 42);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 42);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a sensor_offsets message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
* @param mag_declination magnetic declination (radians)
|
||||
* @param raw_press raw pressure from barometer
|
||||
* @param raw_temp raw temperature from barometer
|
||||
* @param gyro_cal_x gyro X calibration
|
||||
* @param gyro_cal_y gyro Y calibration
|
||||
* @param gyro_cal_z gyro Z calibration
|
||||
* @param accel_cal_x accel X calibration
|
||||
* @param accel_cal_y accel Y calibration
|
||||
* @param accel_cal_z accel Z calibration
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_sensor_offsets_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z,float mag_declination,int32_t raw_press,int32_t raw_temp,float gyro_cal_x,float gyro_cal_y,float gyro_cal_z,float accel_cal_x,float accel_cal_y,float accel_cal_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[42];
|
||||
_mav_put_int16_t(buf, 0, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_z);
|
||||
_mav_put_float(buf, 6, mag_declination);
|
||||
_mav_put_int32_t(buf, 10, raw_press);
|
||||
_mav_put_int32_t(buf, 14, raw_temp);
|
||||
_mav_put_float(buf, 18, gyro_cal_x);
|
||||
_mav_put_float(buf, 22, gyro_cal_y);
|
||||
_mav_put_float(buf, 26, gyro_cal_z);
|
||||
_mav_put_float(buf, 30, accel_cal_x);
|
||||
_mav_put_float(buf, 34, accel_cal_y);
|
||||
_mav_put_float(buf, 38, accel_cal_z);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 42);
|
||||
#else
|
||||
mavlink_sensor_offsets_t packet;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
packet.mag_declination = mag_declination;
|
||||
packet.raw_press = raw_press;
|
||||
packet.raw_temp = raw_temp;
|
||||
packet.gyro_cal_x = gyro_cal_x;
|
||||
packet.gyro_cal_y = gyro_cal_y;
|
||||
packet.gyro_cal_z = gyro_cal_z;
|
||||
packet.accel_cal_x = accel_cal_x;
|
||||
packet.accel_cal_y = accel_cal_y;
|
||||
packet.accel_cal_z = accel_cal_z;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 42);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_SENSOR_OFFSETS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 42);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a sensor_offsets struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param sensor_offsets C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_sensor_offsets_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_sensor_offsets_t* sensor_offsets)
|
||||
{
|
||||
return mavlink_msg_sensor_offsets_pack(system_id, component_id, msg, sensor_offsets->mag_ofs_x, sensor_offsets->mag_ofs_y, sensor_offsets->mag_ofs_z, sensor_offsets->mag_declination, sensor_offsets->raw_press, sensor_offsets->raw_temp, sensor_offsets->gyro_cal_x, sensor_offsets->gyro_cal_y, sensor_offsets->gyro_cal_z, sensor_offsets->accel_cal_x, sensor_offsets->accel_cal_y, sensor_offsets->accel_cal_z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a sensor_offsets message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
* @param mag_declination magnetic declination (radians)
|
||||
* @param raw_press raw pressure from barometer
|
||||
* @param raw_temp raw temperature from barometer
|
||||
* @param gyro_cal_x gyro X calibration
|
||||
* @param gyro_cal_y gyro Y calibration
|
||||
* @param gyro_cal_z gyro Z calibration
|
||||
* @param accel_cal_x accel X calibration
|
||||
* @param accel_cal_y accel Y calibration
|
||||
* @param accel_cal_z accel Z calibration
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_sensor_offsets_send(mavlink_channel_t chan, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z, float mag_declination, int32_t raw_press, int32_t raw_temp, float gyro_cal_x, float gyro_cal_y, float gyro_cal_z, float accel_cal_x, float accel_cal_y, float accel_cal_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[42];
|
||||
_mav_put_int16_t(buf, 0, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_z);
|
||||
_mav_put_float(buf, 6, mag_declination);
|
||||
_mav_put_int32_t(buf, 10, raw_press);
|
||||
_mav_put_int32_t(buf, 14, raw_temp);
|
||||
_mav_put_float(buf, 18, gyro_cal_x);
|
||||
_mav_put_float(buf, 22, gyro_cal_y);
|
||||
_mav_put_float(buf, 26, gyro_cal_z);
|
||||
_mav_put_float(buf, 30, accel_cal_x);
|
||||
_mav_put_float(buf, 34, accel_cal_y);
|
||||
_mav_put_float(buf, 38, accel_cal_z);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, buf, 42);
|
||||
#else
|
||||
mavlink_sensor_offsets_t packet;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
packet.mag_declination = mag_declination;
|
||||
packet.raw_press = raw_press;
|
||||
packet.raw_temp = raw_temp;
|
||||
packet.gyro_cal_x = gyro_cal_x;
|
||||
packet.gyro_cal_y = gyro_cal_y;
|
||||
packet.gyro_cal_z = gyro_cal_z;
|
||||
packet.accel_cal_x = accel_cal_x;
|
||||
packet.accel_cal_y = accel_cal_y;
|
||||
packet.accel_cal_z = accel_cal_z;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SENSOR_OFFSETS, (const char *)&packet, 42);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE SENSOR_OFFSETS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_x from sensor_offsets message
|
||||
*
|
||||
* @return magnetometer X offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_y from sensor_offsets message
|
||||
*
|
||||
* @return magnetometer Y offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_z from sensor_offsets message
|
||||
*
|
||||
* @return magnetometer Z offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_sensor_offsets_get_mag_ofs_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_declination from sensor_offsets message
|
||||
*
|
||||
* @return magnetic declination (radians)
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_mag_declination(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field raw_press from sensor_offsets message
|
||||
*
|
||||
* @return raw pressure from barometer
|
||||
*/
|
||||
static inline int32_t mavlink_msg_sensor_offsets_get_raw_press(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field raw_temp from sensor_offsets message
|
||||
*
|
||||
* @return raw temperature from barometer
|
||||
*/
|
||||
static inline int32_t mavlink_msg_sensor_offsets_get_raw_temp(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field gyro_cal_x from sensor_offsets message
|
||||
*
|
||||
* @return gyro X calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_gyro_cal_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field gyro_cal_y from sensor_offsets message
|
||||
*
|
||||
* @return gyro Y calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_gyro_cal_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 22);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field gyro_cal_z from sensor_offsets message
|
||||
*
|
||||
* @return gyro Z calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_gyro_cal_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 26);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field accel_cal_x from sensor_offsets message
|
||||
*
|
||||
* @return accel X calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_accel_cal_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field accel_cal_y from sensor_offsets message
|
||||
*
|
||||
* @return accel Y calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_accel_cal_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 34);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field accel_cal_z from sensor_offsets message
|
||||
*
|
||||
* @return accel Z calibration
|
||||
*/
|
||||
static inline float mavlink_msg_sensor_offsets_get_accel_cal_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 38);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a sensor_offsets message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param sensor_offsets C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_sensor_offsets_decode(const mavlink_message_t* msg, mavlink_sensor_offsets_t* sensor_offsets)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
sensor_offsets->mag_ofs_x = mavlink_msg_sensor_offsets_get_mag_ofs_x(msg);
|
||||
sensor_offsets->mag_ofs_y = mavlink_msg_sensor_offsets_get_mag_ofs_y(msg);
|
||||
sensor_offsets->mag_ofs_z = mavlink_msg_sensor_offsets_get_mag_ofs_z(msg);
|
||||
sensor_offsets->mag_declination = mavlink_msg_sensor_offsets_get_mag_declination(msg);
|
||||
sensor_offsets->raw_press = mavlink_msg_sensor_offsets_get_raw_press(msg);
|
||||
sensor_offsets->raw_temp = mavlink_msg_sensor_offsets_get_raw_temp(msg);
|
||||
sensor_offsets->gyro_cal_x = mavlink_msg_sensor_offsets_get_gyro_cal_x(msg);
|
||||
sensor_offsets->gyro_cal_y = mavlink_msg_sensor_offsets_get_gyro_cal_y(msg);
|
||||
sensor_offsets->gyro_cal_z = mavlink_msg_sensor_offsets_get_gyro_cal_z(msg);
|
||||
sensor_offsets->accel_cal_x = mavlink_msg_sensor_offsets_get_accel_cal_x(msg);
|
||||
sensor_offsets->accel_cal_y = mavlink_msg_sensor_offsets_get_accel_cal_y(msg);
|
||||
sensor_offsets->accel_cal_z = mavlink_msg_sensor_offsets_get_accel_cal_z(msg);
|
||||
#else
|
||||
memcpy(sensor_offsets, _MAV_PAYLOAD(msg), 42);
|
||||
#endif
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
// MESSAGE SET_MAG_OFFSETS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_SET_MAG_OFFSETS 151
|
||||
|
||||
typedef struct __mavlink_set_mag_offsets_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
int16_t mag_ofs_x; ///< magnetometer X offset
|
||||
int16_t mag_ofs_y; ///< magnetometer Y offset
|
||||
int16_t mag_ofs_z; ///< magnetometer Z offset
|
||||
} mavlink_set_mag_offsets_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_SET_MAG_OFFSETS_LEN 8
|
||||
#define MAVLINK_MSG_ID_151_LEN 8
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_SET_MAG_OFFSETS { \
|
||||
"SET_MAG_OFFSETS", \
|
||||
5, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_set_mag_offsets_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_set_mag_offsets_t, target_component) }, \
|
||||
{ "mag_ofs_x", NULL, MAVLINK_TYPE_INT16_T, 0, 2, offsetof(mavlink_set_mag_offsets_t, mag_ofs_x) }, \
|
||||
{ "mag_ofs_y", NULL, MAVLINK_TYPE_INT16_T, 0, 4, offsetof(mavlink_set_mag_offsets_t, mag_ofs_y) }, \
|
||||
{ "mag_ofs_z", NULL, MAVLINK_TYPE_INT16_T, 0, 6, offsetof(mavlink_set_mag_offsets_t, mag_ofs_z) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a set_mag_offsets message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_set_mag_offsets_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 6, mag_ofs_z);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_set_mag_offsets_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a set_mag_offsets message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_set_mag_offsets_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,int16_t mag_ofs_x,int16_t mag_ofs_y,int16_t mag_ofs_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 6, mag_ofs_z);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_set_mag_offsets_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_SET_MAG_OFFSETS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a set_mag_offsets struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param set_mag_offsets C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_set_mag_offsets_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_set_mag_offsets_t* set_mag_offsets)
|
||||
{
|
||||
return mavlink_msg_set_mag_offsets_pack(system_id, component_id, msg, set_mag_offsets->target_system, set_mag_offsets->target_component, set_mag_offsets->mag_ofs_x, set_mag_offsets->mag_ofs_y, set_mag_offsets->mag_ofs_z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a set_mag_offsets message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param mag_ofs_x magnetometer X offset
|
||||
* @param mag_ofs_y magnetometer Y offset
|
||||
* @param mag_ofs_z magnetometer Z offset
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_set_mag_offsets_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int16_t mag_ofs_x, int16_t mag_ofs_y, int16_t mag_ofs_z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int16_t(buf, 2, mag_ofs_x);
|
||||
_mav_put_int16_t(buf, 4, mag_ofs_y);
|
||||
_mav_put_int16_t(buf, 6, mag_ofs_z);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, buf, 8);
|
||||
#else
|
||||
mavlink_set_mag_offsets_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.mag_ofs_x = mag_ofs_x;
|
||||
packet.mag_ofs_y = mag_ofs_y;
|
||||
packet.mag_ofs_z = mag_ofs_z;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_SET_MAG_OFFSETS, (const char *)&packet, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE SET_MAG_OFFSETS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from set_mag_offsets message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_set_mag_offsets_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from set_mag_offsets message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_set_mag_offsets_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_x from set_mag_offsets message
|
||||
*
|
||||
* @return magnetometer X offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_y from set_mag_offsets message
|
||||
*
|
||||
* @return magnetometer Y offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mag_ofs_z from set_mag_offsets message
|
||||
*
|
||||
* @return magnetometer Z offset
|
||||
*/
|
||||
static inline int16_t mavlink_msg_set_mag_offsets_get_mag_ofs_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a set_mag_offsets message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param set_mag_offsets C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_set_mag_offsets_decode(const mavlink_message_t* msg, mavlink_set_mag_offsets_t* set_mag_offsets)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
set_mag_offsets->target_system = mavlink_msg_set_mag_offsets_get_target_system(msg);
|
||||
set_mag_offsets->target_component = mavlink_msg_set_mag_offsets_get_target_component(msg);
|
||||
set_mag_offsets->mag_ofs_x = mavlink_msg_set_mag_offsets_get_mag_ofs_x(msg);
|
||||
set_mag_offsets->mag_ofs_y = mavlink_msg_set_mag_offsets_get_mag_ofs_y(msg);
|
||||
set_mag_offsets->mag_ofs_z = mavlink_msg_set_mag_offsets_get_mag_ofs_z(msg);
|
||||
#else
|
||||
memcpy(set_mag_offsets, _MAV_PAYLOAD(msg), 8);
|
||||
#endif
|
||||
}
|
||||
@@ -1,690 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol testsuite generated from ardupilotmega.xml
|
||||
* @see http://qgroundcontrol.org/mavlink/
|
||||
*/
|
||||
#ifndef ARDUPILOTMEGA_TESTSUITE_H
|
||||
#define ARDUPILOTMEGA_TESTSUITE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_TEST_ALL
|
||||
#define MAVLINK_TEST_ALL
|
||||
static void mavlink_test_common(uint8_t, uint8_t, mavlink_message_t *last_msg);
|
||||
static void mavlink_test_ardupilotmega(uint8_t, uint8_t, mavlink_message_t *last_msg);
|
||||
|
||||
static void mavlink_test_all(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_test_common(system_id, component_id, last_msg);
|
||||
mavlink_test_ardupilotmega(system_id, component_id, last_msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "../common/testsuite.h"
|
||||
|
||||
|
||||
static void mavlink_test_sensor_offsets(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_sensor_offsets_t packet_in = {
|
||||
17235,
|
||||
17339,
|
||||
17443,
|
||||
59.0,
|
||||
963497984,
|
||||
963498192,
|
||||
143.0,
|
||||
171.0,
|
||||
199.0,
|
||||
227.0,
|
||||
255.0,
|
||||
283.0,
|
||||
};
|
||||
mavlink_sensor_offsets_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.mag_ofs_x = packet_in.mag_ofs_x;
|
||||
packet1.mag_ofs_y = packet_in.mag_ofs_y;
|
||||
packet1.mag_ofs_z = packet_in.mag_ofs_z;
|
||||
packet1.mag_declination = packet_in.mag_declination;
|
||||
packet1.raw_press = packet_in.raw_press;
|
||||
packet1.raw_temp = packet_in.raw_temp;
|
||||
packet1.gyro_cal_x = packet_in.gyro_cal_x;
|
||||
packet1.gyro_cal_y = packet_in.gyro_cal_y;
|
||||
packet1.gyro_cal_z = packet_in.gyro_cal_z;
|
||||
packet1.accel_cal_x = packet_in.accel_cal_x;
|
||||
packet1.accel_cal_y = packet_in.accel_cal_y;
|
||||
packet1.accel_cal_z = packet_in.accel_cal_z;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_sensor_offsets_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_sensor_offsets_pack(system_id, component_id, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
||||
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_sensor_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
||||
mavlink_msg_sensor_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_sensor_offsets_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_sensor_offsets_send(MAVLINK_COMM_1 , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z , packet1.mag_declination , packet1.raw_press , packet1.raw_temp , packet1.gyro_cal_x , packet1.gyro_cal_y , packet1.gyro_cal_z , packet1.accel_cal_x , packet1.accel_cal_y , packet1.accel_cal_z );
|
||||
mavlink_msg_sensor_offsets_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_set_mag_offsets(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_set_mag_offsets_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
17339,
|
||||
17443,
|
||||
17547,
|
||||
};
|
||||
mavlink_set_mag_offsets_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.mag_ofs_x = packet_in.mag_ofs_x;
|
||||
packet1.mag_ofs_y = packet_in.mag_ofs_y;
|
||||
packet1.mag_ofs_z = packet_in.mag_ofs_z;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_set_mag_offsets_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_set_mag_offsets_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
||||
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_set_mag_offsets_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
||||
mavlink_msg_set_mag_offsets_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_set_mag_offsets_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_set_mag_offsets_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mag_ofs_x , packet1.mag_ofs_y , packet1.mag_ofs_z );
|
||||
mavlink_msg_set_mag_offsets_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_meminfo(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_meminfo_t packet_in = {
|
||||
17235,
|
||||
17339,
|
||||
};
|
||||
mavlink_meminfo_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.brkval = packet_in.brkval;
|
||||
packet1.freemem = packet_in.freemem;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_meminfo_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_meminfo_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_meminfo_pack(system_id, component_id, &msg , packet1.brkval , packet1.freemem );
|
||||
mavlink_msg_meminfo_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_meminfo_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.brkval , packet1.freemem );
|
||||
mavlink_msg_meminfo_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_meminfo_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_meminfo_send(MAVLINK_COMM_1 , packet1.brkval , packet1.freemem );
|
||||
mavlink_msg_meminfo_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_ap_adc(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_ap_adc_t packet_in = {
|
||||
17235,
|
||||
17339,
|
||||
17443,
|
||||
17547,
|
||||
17651,
|
||||
17755,
|
||||
};
|
||||
mavlink_ap_adc_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.adc1 = packet_in.adc1;
|
||||
packet1.adc2 = packet_in.adc2;
|
||||
packet1.adc3 = packet_in.adc3;
|
||||
packet1.adc4 = packet_in.adc4;
|
||||
packet1.adc5 = packet_in.adc5;
|
||||
packet1.adc6 = packet_in.adc6;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_ap_adc_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_ap_adc_pack(system_id, component_id, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
||||
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_ap_adc_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
||||
mavlink_msg_ap_adc_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_ap_adc_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_ap_adc_send(MAVLINK_COMM_1 , packet1.adc1 , packet1.adc2 , packet1.adc3 , packet1.adc4 , packet1.adc5 , packet1.adc6 );
|
||||
mavlink_msg_ap_adc_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_digicam_configure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_digicam_configure_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
139,
|
||||
17391,
|
||||
84,
|
||||
151,
|
||||
218,
|
||||
29,
|
||||
96,
|
||||
163,
|
||||
94.0,
|
||||
};
|
||||
mavlink_digicam_configure_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.mode = packet_in.mode;
|
||||
packet1.shutter_speed = packet_in.shutter_speed;
|
||||
packet1.aperture = packet_in.aperture;
|
||||
packet1.iso = packet_in.iso;
|
||||
packet1.exposure_type = packet_in.exposure_type;
|
||||
packet1.command_id = packet_in.command_id;
|
||||
packet1.engine_cut_off = packet_in.engine_cut_off;
|
||||
packet1.extra_param = packet_in.extra_param;
|
||||
packet1.extra_value = packet_in.extra_value;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_configure_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_digicam_configure_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_configure_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mode , packet1.shutter_speed , packet1.aperture , packet1.iso , packet1.exposure_type , packet1.command_id , packet1.engine_cut_off , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_configure_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_digicam_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_digicam_control_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
139,
|
||||
206,
|
||||
17,
|
||||
84,
|
||||
151,
|
||||
218,
|
||||
29,
|
||||
80.0,
|
||||
};
|
||||
mavlink_digicam_control_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.session = packet_in.session;
|
||||
packet1.zoom_pos = packet_in.zoom_pos;
|
||||
packet1.zoom_step = packet_in.zoom_step;
|
||||
packet1.focus_lock = packet_in.focus_lock;
|
||||
packet1.shot = packet_in.shot;
|
||||
packet1.command_id = packet_in.command_id;
|
||||
packet1.extra_param = packet_in.extra_param;
|
||||
packet1.extra_value = packet_in.extra_value;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_control_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_digicam_control_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_digicam_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.session , packet1.zoom_pos , packet1.zoom_step , packet1.focus_lock , packet1.shot , packet1.command_id , packet1.extra_param , packet1.extra_value );
|
||||
mavlink_msg_digicam_control_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_mount_configure(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_mount_configure_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
139,
|
||||
206,
|
||||
17,
|
||||
84,
|
||||
};
|
||||
mavlink_mount_configure_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.mount_mode = packet_in.mount_mode;
|
||||
packet1.stab_roll = packet_in.stab_roll;
|
||||
packet1.stab_pitch = packet_in.stab_pitch;
|
||||
packet1.stab_yaw = packet_in.stab_yaw;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_configure_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_configure_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
||||
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_configure_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
||||
mavlink_msg_mount_configure_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_mount_configure_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_configure_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.mount_mode , packet1.stab_roll , packet1.stab_pitch , packet1.stab_yaw );
|
||||
mavlink_msg_mount_configure_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_mount_control(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_mount_control_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
963497568,
|
||||
963497776,
|
||||
963497984,
|
||||
175,
|
||||
};
|
||||
mavlink_mount_control_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.input_a = packet_in.input_a;
|
||||
packet1.input_b = packet_in.input_b;
|
||||
packet1.input_c = packet_in.input_c;
|
||||
packet1.save_position = packet_in.save_position;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_control_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_mount_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_control_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
||||
mavlink_msg_mount_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_control_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
||||
mavlink_msg_mount_control_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_mount_control_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_control_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.input_a , packet1.input_b , packet1.input_c , packet1.save_position );
|
||||
mavlink_msg_mount_control_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_mount_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_mount_status_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
963497568,
|
||||
963497776,
|
||||
963497984,
|
||||
};
|
||||
mavlink_mount_status_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.pointing_a = packet_in.pointing_a;
|
||||
packet1.pointing_b = packet_in.pointing_b;
|
||||
packet1.pointing_c = packet_in.pointing_c;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_status_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_mount_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_status_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
||||
mavlink_msg_mount_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
||||
mavlink_msg_mount_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_mount_status_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_mount_status_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.pointing_a , packet1.pointing_b , packet1.pointing_c );
|
||||
mavlink_msg_mount_status_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_fence_point(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_fence_point_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
139,
|
||||
206,
|
||||
45.0,
|
||||
73.0,
|
||||
};
|
||||
mavlink_fence_point_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.idx = packet_in.idx;
|
||||
packet1.count = packet_in.count;
|
||||
packet1.lat = packet_in.lat;
|
||||
packet1.lng = packet_in.lng;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_point_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_fence_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
||||
mavlink_msg_fence_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
||||
mavlink_msg_fence_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_fence_point_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_point_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.idx , packet1.count , packet1.lat , packet1.lng );
|
||||
mavlink_msg_fence_point_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_fence_fetch_point(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_fence_fetch_point_t packet_in = {
|
||||
5,
|
||||
72,
|
||||
139,
|
||||
};
|
||||
mavlink_fence_fetch_point_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.target_system = packet_in.target_system;
|
||||
packet1.target_component = packet_in.target_component;
|
||||
packet1.idx = packet_in.idx;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_fetch_point_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_fetch_point_pack(system_id, component_id, &msg , packet1.target_system , packet1.target_component , packet1.idx );
|
||||
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_fetch_point_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.target_system , packet1.target_component , packet1.idx );
|
||||
mavlink_msg_fence_fetch_point_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_fence_fetch_point_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_fetch_point_send(MAVLINK_COMM_1 , packet1.target_system , packet1.target_component , packet1.idx );
|
||||
mavlink_msg_fence_fetch_point_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_fence_status(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_message_t msg;
|
||||
uint8_t buffer[MAVLINK_MAX_PACKET_LEN];
|
||||
uint16_t i;
|
||||
mavlink_fence_status_t packet_in = {
|
||||
5,
|
||||
17287,
|
||||
206,
|
||||
963497672,
|
||||
};
|
||||
mavlink_fence_status_t packet1, packet2;
|
||||
memset(&packet1, 0, sizeof(packet1));
|
||||
packet1.breach_status = packet_in.breach_status;
|
||||
packet1.breach_count = packet_in.breach_count;
|
||||
packet1.breach_type = packet_in.breach_type;
|
||||
packet1.breach_time = packet_in.breach_time;
|
||||
|
||||
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_status_encode(system_id, component_id, &msg, &packet1);
|
||||
mavlink_msg_fence_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_status_pack(system_id, component_id, &msg , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time );
|
||||
mavlink_msg_fence_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_status_pack_chan(system_id, component_id, MAVLINK_COMM_0, &msg , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time );
|
||||
mavlink_msg_fence_status_decode(&msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_to_send_buffer(buffer, &msg);
|
||||
for (i=0; i<mavlink_msg_get_send_buffer_length(&msg); i++) {
|
||||
comm_send_ch(MAVLINK_COMM_0, buffer[i]);
|
||||
}
|
||||
mavlink_msg_fence_status_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
|
||||
memset(&packet2, 0, sizeof(packet2));
|
||||
mavlink_msg_fence_status_send(MAVLINK_COMM_1 , packet1.breach_status , packet1.breach_count , packet1.breach_type , packet1.breach_time );
|
||||
mavlink_msg_fence_status_decode(last_msg, &packet2);
|
||||
MAVLINK_ASSERT(memcmp(&packet1, &packet2, sizeof(packet1)) == 0);
|
||||
}
|
||||
|
||||
static void mavlink_test_ardupilotmega(uint8_t system_id, uint8_t component_id, mavlink_message_t *last_msg)
|
||||
{
|
||||
mavlink_test_sensor_offsets(system_id, component_id, last_msg);
|
||||
mavlink_test_set_mag_offsets(system_id, component_id, last_msg);
|
||||
mavlink_test_meminfo(system_id, component_id, last_msg);
|
||||
mavlink_test_ap_adc(system_id, component_id, last_msg);
|
||||
mavlink_test_digicam_configure(system_id, component_id, last_msg);
|
||||
mavlink_test_digicam_control(system_id, component_id, last_msg);
|
||||
mavlink_test_mount_configure(system_id, component_id, last_msg);
|
||||
mavlink_test_mount_control(system_id, component_id, last_msg);
|
||||
mavlink_test_mount_status(system_id, component_id, last_msg);
|
||||
mavlink_test_fence_point(system_id, component_id, last_msg);
|
||||
mavlink_test_fence_fetch_point(system_id, component_id, last_msg);
|
||||
mavlink_test_fence_status(system_id, component_id, last_msg);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // ARDUPILOTMEGA_TESTSUITE_H
|
||||
@@ -1,12 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol built from ardupilotmega.xml
|
||||
* @see http://pixhawk.ethz.ch/software/mavlink
|
||||
*/
|
||||
#ifndef MAVLINK_VERSION_H
|
||||
#define MAVLINK_VERSION_H
|
||||
|
||||
#define MAVLINK_BUILD_DATE "Fri Dec 16 12:39:09 2011"
|
||||
#define MAVLINK_WIRE_PROTOCOL_VERSION "0.9"
|
||||
#define MAVLINK_MAX_DIALECT_PAYLOAD_SIZE 101
|
||||
|
||||
#endif // MAVLINK_VERSION_H
|
||||
@@ -1,89 +0,0 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _CHECKSUM_H_
|
||||
#define _CHECKSUM_H_
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* CALCULATE THE CHECKSUM
|
||||
*
|
||||
*/
|
||||
|
||||
#define X25_INIT_CRC 0xffff
|
||||
#define X25_VALIDATE_CRC 0xf0b8
|
||||
|
||||
/**
|
||||
* @brief Accumulate the X.25 CRC by adding one char at a time.
|
||||
*
|
||||
* The checksum function adds the hash of one char at a time to the
|
||||
* 16 bit checksum (uint16_t).
|
||||
*
|
||||
* @param data new char to hash
|
||||
* @param crcAccum the already accumulated checksum
|
||||
**/
|
||||
static inline void crc_accumulate(uint8_t data, uint16_t *crcAccum)
|
||||
{
|
||||
/*Accumulate one byte of data into the CRC*/
|
||||
uint8_t tmp;
|
||||
|
||||
tmp = data ^ (uint8_t)(*crcAccum &0xff);
|
||||
tmp ^= (tmp<<4);
|
||||
*crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initiliaze the buffer for the X.25 CRC
|
||||
*
|
||||
* @param crcAccum the 16 bit X.25 CRC
|
||||
*/
|
||||
static inline void crc_init(uint16_t* crcAccum)
|
||||
{
|
||||
*crcAccum = X25_INIT_CRC;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Calculates the X.25 checksum on a byte buffer
|
||||
*
|
||||
* @param pBuffer buffer containing the byte array to hash
|
||||
* @param length length of the byte array
|
||||
* @return the checksum over the buffer bytes
|
||||
**/
|
||||
static inline uint16_t crc_calculate(uint8_t* pBuffer, uint16_t length)
|
||||
{
|
||||
uint16_t crcTmp;
|
||||
crc_init(&crcTmp);
|
||||
while (length--) {
|
||||
crc_accumulate(*pBuffer++, &crcTmp);
|
||||
}
|
||||
return crcTmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Accumulate the X.25 CRC by adding an array of bytes
|
||||
*
|
||||
* The checksum function adds the hash of one char at a time to the
|
||||
* 16 bit checksum (uint16_t).
|
||||
*
|
||||
* @param data new bytes to hash
|
||||
* @param crcAccum the already accumulated checksum
|
||||
**/
|
||||
static inline void crc_accumulate_buffer(uint16_t *crcAccum, const char *pBuffer, uint8_t length)
|
||||
{
|
||||
const uint8_t *p = (const uint8_t *)pBuffer;
|
||||
while (length--) {
|
||||
crc_accumulate(*p++, crcAccum);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _CHECKSUM_H_ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,159 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol generated from common.xml
|
||||
* @see http://qgroundcontrol.org/mavlink/
|
||||
*/
|
||||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// MESSAGE LENGTHS AND CRCS
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_LENGTHS
|
||||
#define MAVLINK_MESSAGE_LENGTHS {3, 4, 8, 14, 8, 28, 3, 32, 0, 2, 3, 2, 2, 0, 0, 0, 0, 0, 0, 0, 19, 2, 23, 21, 0, 37, 26, 101, 26, 16, 32, 32, 37, 32, 11, 17, 17, 16, 18, 36, 4, 4, 2, 2, 4, 2, 2, 3, 14, 12, 18, 16, 8, 27, 25, 18, 18, 24, 24, 0, 0, 0, 26, 16, 36, 5, 6, 56, 26, 21, 18, 0, 0, 18, 20, 20, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 14, 14, 51, 5}
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_CRCS
|
||||
#define MAVLINK_MESSAGE_CRCS {72, 39, 190, 92, 191, 217, 104, 119, 0, 219, 60, 186, 10, 0, 0, 0, 0, 0, 0, 0, 89, 159, 162, 121, 0, 149, 222, 110, 179, 136, 66, 126, 185, 147, 112, 252, 162, 215, 229, 128, 9, 106, 101, 213, 4, 229, 21, 214, 215, 14, 206, 50, 157, 126, 108, 213, 95, 5, 127, 0, 0, 0, 57, 126, 130, 119, 193, 191, 236, 158, 143, 0, 0, 104, 123, 131, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 178, 224, 60, 106, 7}
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_MESSAGE_INFO
|
||||
#define MAVLINK_MESSAGE_INFO {MAVLINK_MESSAGE_INFO_HEARTBEAT, MAVLINK_MESSAGE_INFO_BOOT, MAVLINK_MESSAGE_INFO_SYSTEM_TIME, MAVLINK_MESSAGE_INFO_PING, MAVLINK_MESSAGE_INFO_SYSTEM_TIME_UTC, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL, MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK, MAVLINK_MESSAGE_INFO_AUTH_KEY, {NULL}, MAVLINK_MESSAGE_INFO_ACTION_ACK, MAVLINK_MESSAGE_INFO_ACTION, MAVLINK_MESSAGE_INFO_SET_MODE, MAVLINK_MESSAGE_INFO_SET_NAV_MODE, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_READ, MAVLINK_MESSAGE_INFO_PARAM_REQUEST_LIST, MAVLINK_MESSAGE_INFO_PARAM_VALUE, MAVLINK_MESSAGE_INFO_PARAM_SET, {NULL}, MAVLINK_MESSAGE_INFO_GPS_RAW_INT, MAVLINK_MESSAGE_INFO_SCALED_IMU, MAVLINK_MESSAGE_INFO_GPS_STATUS, MAVLINK_MESSAGE_INFO_RAW_IMU, MAVLINK_MESSAGE_INFO_RAW_PRESSURE, MAVLINK_MESSAGE_INFO_ATTITUDE, MAVLINK_MESSAGE_INFO_LOCAL_POSITION, MAVLINK_MESSAGE_INFO_GPS_RAW, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION, MAVLINK_MESSAGE_INFO_SYS_STATUS, MAVLINK_MESSAGE_INFO_RC_CHANNELS_RAW, MAVLINK_MESSAGE_INFO_RC_CHANNELS_SCALED, MAVLINK_MESSAGE_INFO_SERVO_OUTPUT_RAW, MAVLINK_MESSAGE_INFO_SCALED_PRESSURE, MAVLINK_MESSAGE_INFO_WAYPOINT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST, MAVLINK_MESSAGE_INFO_WAYPOINT_SET_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_CURRENT, MAVLINK_MESSAGE_INFO_WAYPOINT_REQUEST_LIST, MAVLINK_MESSAGE_INFO_WAYPOINT_COUNT, MAVLINK_MESSAGE_INFO_WAYPOINT_CLEAR_ALL, MAVLINK_MESSAGE_INFO_WAYPOINT_REACHED, MAVLINK_MESSAGE_INFO_WAYPOINT_ACK, MAVLINK_MESSAGE_INFO_GPS_SET_GLOBAL_ORIGIN, MAVLINK_MESSAGE_INFO_GPS_LOCAL_ORIGIN_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT_SET, MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT, MAVLINK_MESSAGE_INFO_CONTROL_STATUS, MAVLINK_MESSAGE_INFO_SAFETY_SET_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SAFETY_ALLOWED_AREA, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_THRUST, MAVLINK_MESSAGE_INFO_SET_ROLL_PITCH_YAW_SPEED_THRUST, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_THRUST_SETPOINT, MAVLINK_MESSAGE_INFO_ROLL_PITCH_YAW_SPEED_THRUST_SETPOINT, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_NAV_CONTROLLER_OUTPUT, MAVLINK_MESSAGE_INFO_POSITION_TARGET, MAVLINK_MESSAGE_INFO_STATE_CORRECTION, MAVLINK_MESSAGE_INFO_SET_ALTITUDE, MAVLINK_MESSAGE_INFO_REQUEST_DATA_STREAM, MAVLINK_MESSAGE_INFO_HIL_STATE, MAVLINK_MESSAGE_INFO_HIL_CONTROLS, MAVLINK_MESSAGE_INFO_MANUAL_CONTROL, MAVLINK_MESSAGE_INFO_RC_CHANNELS_OVERRIDE, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT, MAVLINK_MESSAGE_INFO_VFR_HUD, MAVLINK_MESSAGE_INFO_COMMAND, MAVLINK_MESSAGE_INFO_COMMAND_ACK, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_OPTICAL_FLOW, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_OBJECT_DETECTION_EVENT, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, {NULL}, MAVLINK_MESSAGE_INFO_DEBUG_VECT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_FLOAT, MAVLINK_MESSAGE_INFO_NAMED_VALUE_INT, MAVLINK_MESSAGE_INFO_STATUSTEXT, MAVLINK_MESSAGE_INFO_DEBUG}
|
||||
#endif
|
||||
|
||||
#include "../protocol.h"
|
||||
|
||||
#define MAVLINK_ENABLED_COMMON
|
||||
|
||||
|
||||
|
||||
// MAVLINK VERSION
|
||||
|
||||
#ifndef MAVLINK_VERSION
|
||||
#define MAVLINK_VERSION 2
|
||||
#endif
|
||||
|
||||
#if (MAVLINK_VERSION == 0)
|
||||
#undef MAVLINK_VERSION
|
||||
#define MAVLINK_VERSION 2
|
||||
#endif
|
||||
|
||||
// ENUM DEFINITIONS
|
||||
|
||||
|
||||
/** @brief Data stream IDs. A data stream is not a fixed set of messages, but rather a
|
||||
recommendation to the autopilot software. Individual autopilots may or may not obey
|
||||
the recommended messages.
|
||||
*/
|
||||
#ifndef HAVE_ENUM_MAV_DATA_STREAM
|
||||
#define HAVE_ENUM_MAV_DATA_STREAM
|
||||
enum MAV_DATA_STREAM
|
||||
{
|
||||
MAV_DATA_STREAM_ALL=0, /* Enable all data streams | */
|
||||
MAV_DATA_STREAM_RAW_SENSORS=1, /* Enable IMU_RAW, GPS_RAW, GPS_STATUS packets. | */
|
||||
MAV_DATA_STREAM_EXTENDED_STATUS=2, /* Enable GPS_STATUS, CONTROL_STATUS, AUX_STATUS | */
|
||||
MAV_DATA_STREAM_RC_CHANNELS=3, /* Enable RC_CHANNELS_SCALED, RC_CHANNELS_RAW, SERVO_OUTPUT_RAW | */
|
||||
MAV_DATA_STREAM_RAW_CONTROLLER=4, /* Enable ATTITUDE_CONTROLLER_OUTPUT, POSITION_CONTROLLER_OUTPUT, NAV_CONTROLLER_OUTPUT. | */
|
||||
MAV_DATA_STREAM_POSITION=6, /* Enable LOCAL_POSITION, GLOBAL_POSITION/GLOBAL_POSITION_INT messages. | */
|
||||
MAV_DATA_STREAM_EXTRA1=10, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_EXTRA2=11, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_EXTRA3=12, /* Dependent on the autopilot | */
|
||||
MAV_DATA_STREAM_ENUM_END=13, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
/** @brief The ROI (region of interest) for the vehicle. This can be
|
||||
be used by the vehicle for camera/vehicle attitude alignment (see
|
||||
MAV_CMD_NAV_ROI).
|
||||
*/
|
||||
#ifndef HAVE_ENUM_MAV_ROI
|
||||
#define HAVE_ENUM_MAV_ROI
|
||||
enum MAV_ROI
|
||||
{
|
||||
MAV_ROI_NONE=0, /* No region of interest. | */
|
||||
MAV_ROI_WPNEXT=1, /* Point toward next waypoint. | */
|
||||
MAV_ROI_WPINDEX=2, /* Point toward given waypoint. | */
|
||||
MAV_ROI_LOCATION=3, /* Point toward fixed location. | */
|
||||
MAV_ROI_TARGET=4, /* Point toward of given id. | */
|
||||
MAV_ROI_ENUM_END=5, /* | */
|
||||
};
|
||||
#endif
|
||||
|
||||
// MESSAGE DEFINITIONS
|
||||
#include "./mavlink_msg_heartbeat.h"
|
||||
#include "./mavlink_msg_boot.h"
|
||||
#include "./mavlink_msg_system_time.h"
|
||||
#include "./mavlink_msg_ping.h"
|
||||
#include "./mavlink_msg_system_time_utc.h"
|
||||
#include "./mavlink_msg_change_operator_control.h"
|
||||
#include "./mavlink_msg_change_operator_control_ack.h"
|
||||
#include "./mavlink_msg_auth_key.h"
|
||||
#include "./mavlink_msg_action_ack.h"
|
||||
#include "./mavlink_msg_action.h"
|
||||
#include "./mavlink_msg_set_mode.h"
|
||||
#include "./mavlink_msg_set_nav_mode.h"
|
||||
#include "./mavlink_msg_param_request_read.h"
|
||||
#include "./mavlink_msg_param_request_list.h"
|
||||
#include "./mavlink_msg_param_value.h"
|
||||
#include "./mavlink_msg_param_set.h"
|
||||
#include "./mavlink_msg_gps_raw_int.h"
|
||||
#include "./mavlink_msg_scaled_imu.h"
|
||||
#include "./mavlink_msg_gps_status.h"
|
||||
#include "./mavlink_msg_raw_imu.h"
|
||||
#include "./mavlink_msg_raw_pressure.h"
|
||||
#include "./mavlink_msg_scaled_pressure.h"
|
||||
#include "./mavlink_msg_attitude.h"
|
||||
#include "./mavlink_msg_local_position.h"
|
||||
#include "./mavlink_msg_global_position.h"
|
||||
#include "./mavlink_msg_gps_raw.h"
|
||||
#include "./mavlink_msg_sys_status.h"
|
||||
#include "./mavlink_msg_rc_channels_raw.h"
|
||||
#include "./mavlink_msg_rc_channels_scaled.h"
|
||||
#include "./mavlink_msg_servo_output_raw.h"
|
||||
#include "./mavlink_msg_waypoint.h"
|
||||
#include "./mavlink_msg_waypoint_request.h"
|
||||
#include "./mavlink_msg_waypoint_set_current.h"
|
||||
#include "./mavlink_msg_waypoint_current.h"
|
||||
#include "./mavlink_msg_waypoint_request_list.h"
|
||||
#include "./mavlink_msg_waypoint_count.h"
|
||||
#include "./mavlink_msg_waypoint_clear_all.h"
|
||||
#include "./mavlink_msg_waypoint_reached.h"
|
||||
#include "./mavlink_msg_waypoint_ack.h"
|
||||
#include "./mavlink_msg_gps_set_global_origin.h"
|
||||
#include "./mavlink_msg_gps_local_origin_set.h"
|
||||
#include "./mavlink_msg_local_position_setpoint_set.h"
|
||||
#include "./mavlink_msg_local_position_setpoint.h"
|
||||
#include "./mavlink_msg_control_status.h"
|
||||
#include "./mavlink_msg_safety_set_allowed_area.h"
|
||||
#include "./mavlink_msg_safety_allowed_area.h"
|
||||
#include "./mavlink_msg_set_roll_pitch_yaw_thrust.h"
|
||||
#include "./mavlink_msg_set_roll_pitch_yaw_speed_thrust.h"
|
||||
#include "./mavlink_msg_roll_pitch_yaw_thrust_setpoint.h"
|
||||
#include "./mavlink_msg_roll_pitch_yaw_speed_thrust_setpoint.h"
|
||||
#include "./mavlink_msg_nav_controller_output.h"
|
||||
#include "./mavlink_msg_position_target.h"
|
||||
#include "./mavlink_msg_state_correction.h"
|
||||
#include "./mavlink_msg_set_altitude.h"
|
||||
#include "./mavlink_msg_request_data_stream.h"
|
||||
#include "./mavlink_msg_hil_state.h"
|
||||
#include "./mavlink_msg_hil_controls.h"
|
||||
#include "./mavlink_msg_manual_control.h"
|
||||
#include "./mavlink_msg_rc_channels_override.h"
|
||||
#include "./mavlink_msg_global_position_int.h"
|
||||
#include "./mavlink_msg_vfr_hud.h"
|
||||
#include "./mavlink_msg_command.h"
|
||||
#include "./mavlink_msg_command_ack.h"
|
||||
#include "./mavlink_msg_optical_flow.h"
|
||||
#include "./mavlink_msg_object_detection_event.h"
|
||||
#include "./mavlink_msg_debug_vect.h"
|
||||
#include "./mavlink_msg_named_value_float.h"
|
||||
#include "./mavlink_msg_named_value_int.h"
|
||||
#include "./mavlink_msg_statustext.h"
|
||||
#include "./mavlink_msg_debug.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
#endif // COMMON_H
|
||||
@@ -1,27 +0,0 @@
|
||||
/** @file
|
||||
* @brief MAVLink comm protocol built from common.xml
|
||||
* @see http://pixhawk.ethz.ch/software/mavlink
|
||||
*/
|
||||
#ifndef MAVLINK_H
|
||||
#define MAVLINK_H
|
||||
|
||||
#ifndef MAVLINK_STX
|
||||
#define MAVLINK_STX 85
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_ENDIAN
|
||||
#define MAVLINK_ENDIAN MAVLINK_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_ALIGNED_FIELDS
|
||||
#define MAVLINK_ALIGNED_FIELDS 0
|
||||
#endif
|
||||
|
||||
#ifndef MAVLINK_CRC_EXTRA
|
||||
#define MAVLINK_CRC_EXTRA 0
|
||||
#endif
|
||||
|
||||
#include "version.h"
|
||||
#include "common.h"
|
||||
|
||||
#endif // MAVLINK_H
|
||||
@@ -1,188 +0,0 @@
|
||||
// MESSAGE ACTION PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_ACTION 10
|
||||
|
||||
typedef struct __mavlink_action_t
|
||||
{
|
||||
uint8_t target; ///< The system executing the action
|
||||
uint8_t target_component; ///< The component executing the action
|
||||
uint8_t action; ///< The action id
|
||||
} mavlink_action_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_ACTION_LEN 3
|
||||
#define MAVLINK_MSG_ID_10_LEN 3
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_ACTION { \
|
||||
"ACTION", \
|
||||
3, \
|
||||
{ { "target", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_action_t, target) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_action_t, target_component) }, \
|
||||
{ "action", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_action_t, action) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a action message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target The system executing the action
|
||||
* @param target_component The component executing the action
|
||||
* @param action The action id
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target, uint8_t target_component, uint8_t action)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, action);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_action_t packet;
|
||||
packet.target = target;
|
||||
packet.target_component = target_component;
|
||||
packet.action = action;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ACTION;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a action message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target The system executing the action
|
||||
* @param target_component The component executing the action
|
||||
* @param action The action id
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target,uint8_t target_component,uint8_t action)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, action);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_action_t packet;
|
||||
packet.target = target;
|
||||
packet.target_component = target_component;
|
||||
packet.action = action;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ACTION;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a action struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param action C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_action_t* action)
|
||||
{
|
||||
return mavlink_msg_action_pack(system_id, component_id, msg, action->target, action->target_component, action->action);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a action message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target The system executing the action
|
||||
* @param target_component The component executing the action
|
||||
* @param action The action id
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_action_send(mavlink_channel_t chan, uint8_t target, uint8_t target_component, uint8_t action)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, target);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, action);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTION, buf, 3);
|
||||
#else
|
||||
mavlink_action_t packet;
|
||||
packet.target = target;
|
||||
packet.target_component = target_component;
|
||||
packet.action = action;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTION, (const char *)&packet, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE ACTION UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target from action message
|
||||
*
|
||||
* @return The system executing the action
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_action_get_target(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from action message
|
||||
*
|
||||
* @return The component executing the action
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_action_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field action from action message
|
||||
*
|
||||
* @return The action id
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_action_get_action(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a action message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param action C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_action_decode(const mavlink_message_t* msg, mavlink_action_t* action)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
action->target = mavlink_msg_action_get_target(msg);
|
||||
action->target_component = mavlink_msg_action_get_target_component(msg);
|
||||
action->action = mavlink_msg_action_get_action(msg);
|
||||
#else
|
||||
memcpy(action, _MAV_PAYLOAD(msg), 3);
|
||||
#endif
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// MESSAGE ACTION_ACK PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_ACTION_ACK 9
|
||||
|
||||
typedef struct __mavlink_action_ack_t
|
||||
{
|
||||
uint8_t action; ///< The action id
|
||||
uint8_t result; ///< 0: Action DENIED, 1: Action executed
|
||||
} mavlink_action_ack_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_ACTION_ACK_LEN 2
|
||||
#define MAVLINK_MSG_ID_9_LEN 2
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_ACTION_ACK { \
|
||||
"ACTION_ACK", \
|
||||
2, \
|
||||
{ { "action", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_action_ack_t, action) }, \
|
||||
{ "result", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_action_ack_t, result) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a action_ack message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param action The action id
|
||||
* @param result 0: Action DENIED, 1: Action executed
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t action, uint8_t result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[2];
|
||||
_mav_put_uint8_t(buf, 0, action);
|
||||
_mav_put_uint8_t(buf, 1, result);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 2);
|
||||
#else
|
||||
mavlink_action_ack_t packet;
|
||||
packet.action = action;
|
||||
packet.result = result;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 2);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ACTION_ACK;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a action_ack message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param action The action id
|
||||
* @param result 0: Action DENIED, 1: Action executed
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t action,uint8_t result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[2];
|
||||
_mav_put_uint8_t(buf, 0, action);
|
||||
_mav_put_uint8_t(buf, 1, result);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 2);
|
||||
#else
|
||||
mavlink_action_ack_t packet;
|
||||
packet.action = action;
|
||||
packet.result = result;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 2);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ACTION_ACK;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a action_ack struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param action_ack C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_action_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_action_ack_t* action_ack)
|
||||
{
|
||||
return mavlink_msg_action_ack_pack(system_id, component_id, msg, action_ack->action, action_ack->result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a action_ack message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param action The action id
|
||||
* @param result 0: Action DENIED, 1: Action executed
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_action_ack_send(mavlink_channel_t chan, uint8_t action, uint8_t result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[2];
|
||||
_mav_put_uint8_t(buf, 0, action);
|
||||
_mav_put_uint8_t(buf, 1, result);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTION_ACK, buf, 2);
|
||||
#else
|
||||
mavlink_action_ack_t packet;
|
||||
packet.action = action;
|
||||
packet.result = result;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ACTION_ACK, (const char *)&packet, 2);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE ACTION_ACK UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field action from action_ack message
|
||||
*
|
||||
* @return The action id
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_action_ack_get_action(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field result from action_ack message
|
||||
*
|
||||
* @return 0: Action DENIED, 1: Action executed
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_action_ack_get_result(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a action_ack message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param action_ack C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_action_ack_decode(const mavlink_message_t* msg, mavlink_action_ack_t* action_ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
action_ack->action = mavlink_msg_action_ack_get_action(msg);
|
||||
action_ack->result = mavlink_msg_action_ack_get_result(msg);
|
||||
#else
|
||||
memcpy(action_ack, _MAV_PAYLOAD(msg), 2);
|
||||
#endif
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
// MESSAGE ATTITUDE PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_ATTITUDE 30
|
||||
|
||||
typedef struct __mavlink_attitude_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
float roll; ///< Roll angle (rad)
|
||||
float pitch; ///< Pitch angle (rad)
|
||||
float yaw; ///< Yaw angle (rad)
|
||||
float rollspeed; ///< Roll angular speed (rad/s)
|
||||
float pitchspeed; ///< Pitch angular speed (rad/s)
|
||||
float yawspeed; ///< Yaw angular speed (rad/s)
|
||||
} mavlink_attitude_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_ATTITUDE_LEN 32
|
||||
#define MAVLINK_MSG_ID_30_LEN 32
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_ATTITUDE { \
|
||||
"ATTITUDE", \
|
||||
7, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_attitude_t, usec) }, \
|
||||
{ "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_attitude_t, roll) }, \
|
||||
{ "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_attitude_t, pitch) }, \
|
||||
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_attitude_t, yaw) }, \
|
||||
{ "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_attitude_t, rollspeed) }, \
|
||||
{ "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_attitude_t, pitchspeed) }, \
|
||||
{ "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_attitude_t, yawspeed) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a attitude message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_attitude_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_attitude_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a attitude message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_attitude_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,float roll,float pitch,float yaw,float rollspeed,float pitchspeed,float yawspeed)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_attitude_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_ATTITUDE;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a attitude struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param attitude C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_attitude_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_attitude_t* attitude)
|
||||
{
|
||||
return mavlink_msg_attitude_pack(system_id, component_id, msg, attitude->usec, attitude->roll, attitude->pitch, attitude->yaw, attitude->rollspeed, attitude->pitchspeed, attitude->yawspeed);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a attitude message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_attitude_send(mavlink_channel_t chan, uint64_t usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, buf, 32);
|
||||
#else
|
||||
mavlink_attitude_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_ATTITUDE, (const char *)&packet, 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE ATTITUDE UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from attitude message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_attitude_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field roll from attitude message
|
||||
*
|
||||
* @return Roll angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_roll(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pitch from attitude message
|
||||
*
|
||||
* @return Pitch angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_pitch(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yaw from attitude message
|
||||
*
|
||||
* @return Yaw angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field rollspeed from attitude message
|
||||
*
|
||||
* @return Roll angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_rollspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pitchspeed from attitude message
|
||||
*
|
||||
* @return Pitch angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_pitchspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yawspeed from attitude message
|
||||
*
|
||||
* @return Yaw angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_attitude_get_yawspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a attitude message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param attitude C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_attitude_decode(const mavlink_message_t* msg, mavlink_attitude_t* attitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
attitude->usec = mavlink_msg_attitude_get_usec(msg);
|
||||
attitude->roll = mavlink_msg_attitude_get_roll(msg);
|
||||
attitude->pitch = mavlink_msg_attitude_get_pitch(msg);
|
||||
attitude->yaw = mavlink_msg_attitude_get_yaw(msg);
|
||||
attitude->rollspeed = mavlink_msg_attitude_get_rollspeed(msg);
|
||||
attitude->pitchspeed = mavlink_msg_attitude_get_pitchspeed(msg);
|
||||
attitude->yawspeed = mavlink_msg_attitude_get_yawspeed(msg);
|
||||
#else
|
||||
memcpy(attitude, _MAV_PAYLOAD(msg), 32);
|
||||
#endif
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
// MESSAGE AUTH_KEY PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_AUTH_KEY 7
|
||||
|
||||
typedef struct __mavlink_auth_key_t
|
||||
{
|
||||
char key[32]; ///< key
|
||||
} mavlink_auth_key_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_AUTH_KEY_LEN 32
|
||||
#define MAVLINK_MSG_ID_7_LEN 32
|
||||
|
||||
#define MAVLINK_MSG_AUTH_KEY_FIELD_KEY_LEN 32
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_AUTH_KEY { \
|
||||
"AUTH_KEY", \
|
||||
1, \
|
||||
{ { "key", NULL, MAVLINK_TYPE_CHAR, 32, 0, offsetof(mavlink_auth_key_t, key) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a auth_key message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param key key
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_auth_key_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
const char *key)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
|
||||
_mav_put_char_array(buf, 0, key, 32);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_auth_key_t packet;
|
||||
|
||||
mav_array_memcpy(packet.key, key, sizeof(char)*32);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a auth_key message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param key key
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_auth_key_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
const char *key)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
|
||||
_mav_put_char_array(buf, 0, key, 32);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_auth_key_t packet;
|
||||
|
||||
mav_array_memcpy(packet.key, key, sizeof(char)*32);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_AUTH_KEY;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a auth_key struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param auth_key C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_auth_key_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_auth_key_t* auth_key)
|
||||
{
|
||||
return mavlink_msg_auth_key_pack(system_id, component_id, msg, auth_key->key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a auth_key message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param key key
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_auth_key_send(mavlink_channel_t chan, const char *key)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
|
||||
_mav_put_char_array(buf, 0, key, 32);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, buf, 32);
|
||||
#else
|
||||
mavlink_auth_key_t packet;
|
||||
|
||||
mav_array_memcpy(packet.key, key, sizeof(char)*32);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_AUTH_KEY, (const char *)&packet, 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE AUTH_KEY UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field key from auth_key message
|
||||
*
|
||||
* @return key
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_auth_key_get_key(const mavlink_message_t* msg, char *key)
|
||||
{
|
||||
return _MAV_RETURN_char_array(msg, key, 32, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a auth_key message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param auth_key C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_auth_key_decode(const mavlink_message_t* msg, mavlink_auth_key_t* auth_key)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
mavlink_msg_auth_key_get_key(msg, auth_key->key);
|
||||
#else
|
||||
memcpy(auth_key, _MAV_PAYLOAD(msg), 32);
|
||||
#endif
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
// MESSAGE BOOT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_BOOT 1
|
||||
|
||||
typedef struct __mavlink_boot_t
|
||||
{
|
||||
uint32_t version; ///< The onboard software version
|
||||
} mavlink_boot_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_BOOT_LEN 4
|
||||
#define MAVLINK_MSG_ID_1_LEN 4
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_BOOT { \
|
||||
"BOOT", \
|
||||
1, \
|
||||
{ { "version", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_boot_t, version) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a boot message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param version The onboard software version
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_boot_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint32_t version)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint32_t(buf, 0, version);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 4);
|
||||
#else
|
||||
mavlink_boot_t packet;
|
||||
packet.version = version;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 4);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_BOOT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a boot message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param version The onboard software version
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_boot_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint32_t version)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint32_t(buf, 0, version);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 4);
|
||||
#else
|
||||
mavlink_boot_t packet;
|
||||
packet.version = version;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 4);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_BOOT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a boot struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param boot C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_boot_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_boot_t* boot)
|
||||
{
|
||||
return mavlink_msg_boot_pack(system_id, component_id, msg, boot->version);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a boot message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param version The onboard software version
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_boot_send(mavlink_channel_t chan, uint32_t version)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[4];
|
||||
_mav_put_uint32_t(buf, 0, version);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, buf, 4);
|
||||
#else
|
||||
mavlink_boot_t packet;
|
||||
packet.version = version;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_BOOT, (const char *)&packet, 4);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE BOOT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field version from boot message
|
||||
*
|
||||
* @return The onboard software version
|
||||
*/
|
||||
static inline uint32_t mavlink_msg_boot_get_version(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint32_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a boot message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param boot C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_boot_decode(const mavlink_message_t* msg, mavlink_boot_t* boot)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
boot->version = mavlink_msg_boot_get_version(msg);
|
||||
#else
|
||||
memcpy(boot, _MAV_PAYLOAD(msg), 4);
|
||||
#endif
|
||||
}
|
||||
@@ -1,204 +0,0 @@
|
||||
// MESSAGE CHANGE_OPERATOR_CONTROL PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL 5
|
||||
|
||||
typedef struct __mavlink_change_operator_control_t
|
||||
{
|
||||
uint8_t target_system; ///< System the GCS requests control for
|
||||
uint8_t control_request; ///< 0: request control of this MAV, 1: Release control of this MAV
|
||||
uint8_t version; ///< 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
|
||||
char passkey[25]; ///< Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
|
||||
} mavlink_change_operator_control_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_LEN 28
|
||||
#define MAVLINK_MSG_ID_5_LEN 28
|
||||
|
||||
#define MAVLINK_MSG_CHANGE_OPERATOR_CONTROL_FIELD_PASSKEY_LEN 25
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL { \
|
||||
"CHANGE_OPERATOR_CONTROL", \
|
||||
4, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_t, target_system) }, \
|
||||
{ "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_t, control_request) }, \
|
||||
{ "version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_t, version) }, \
|
||||
{ "passkey", NULL, MAVLINK_TYPE_CHAR, 25, 3, offsetof(mavlink_change_operator_control_t, passkey) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a change_operator_control message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System the GCS requests control for
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
|
||||
* @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[28];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, version);
|
||||
_mav_put_char_array(buf, 3, passkey, 25);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 28);
|
||||
#else
|
||||
mavlink_change_operator_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.control_request = control_request;
|
||||
packet.version = version;
|
||||
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 28);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a change_operator_control message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System the GCS requests control for
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
|
||||
* @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t control_request,uint8_t version,const char *passkey)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[28];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, version);
|
||||
_mav_put_char_array(buf, 3, passkey, 25);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 28);
|
||||
#else
|
||||
mavlink_change_operator_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.control_request = control_request;
|
||||
packet.version = version;
|
||||
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 28);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a change_operator_control struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param change_operator_control C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_t* change_operator_control)
|
||||
{
|
||||
return mavlink_msg_change_operator_control_pack(system_id, component_id, msg, change_operator_control->target_system, change_operator_control->control_request, change_operator_control->version, change_operator_control->passkey);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a change_operator_control message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System the GCS requests control for
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param version 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
|
||||
* @param passkey Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_change_operator_control_send(mavlink_channel_t chan, uint8_t target_system, uint8_t control_request, uint8_t version, const char *passkey)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[28];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, version);
|
||||
_mav_put_char_array(buf, 3, passkey, 25);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, buf, 28);
|
||||
#else
|
||||
mavlink_change_operator_control_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.control_request = control_request;
|
||||
packet.version = version;
|
||||
mav_array_memcpy(packet.passkey, passkey, sizeof(char)*25);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL, (const char *)&packet, 28);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE CHANGE_OPERATOR_CONTROL UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from change_operator_control message
|
||||
*
|
||||
* @return System the GCS requests control for
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_request from change_operator_control message
|
||||
*
|
||||
* @return 0: request control of this MAV, 1: Release control of this MAV
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_get_control_request(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field version from change_operator_control message
|
||||
*
|
||||
* @return 0: key as plaintext, 1-255: future, different hashing/encryption variants. The GCS should in general use the safest mode possible initially and then gradually move down the encryption level if it gets a NACK message indicating an encryption mismatch.
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_get_version(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field passkey from change_operator_control message
|
||||
*
|
||||
* @return Password / Key, depending on version plaintext or encrypted. 25 or less characters, NULL terminated. The characters may involve A-Z, a-z, 0-9, and "!?,.-"
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_get_passkey(const mavlink_message_t* msg, char *passkey)
|
||||
{
|
||||
return _MAV_RETURN_char_array(msg, passkey, 25, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a change_operator_control message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param change_operator_control C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_change_operator_control_decode(const mavlink_message_t* msg, mavlink_change_operator_control_t* change_operator_control)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
change_operator_control->target_system = mavlink_msg_change_operator_control_get_target_system(msg);
|
||||
change_operator_control->control_request = mavlink_msg_change_operator_control_get_control_request(msg);
|
||||
change_operator_control->version = mavlink_msg_change_operator_control_get_version(msg);
|
||||
mavlink_msg_change_operator_control_get_passkey(msg, change_operator_control->passkey);
|
||||
#else
|
||||
memcpy(change_operator_control, _MAV_PAYLOAD(msg), 28);
|
||||
#endif
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
// MESSAGE CHANGE_OPERATOR_CONTROL_ACK PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK 6
|
||||
|
||||
typedef struct __mavlink_change_operator_control_ack_t
|
||||
{
|
||||
uint8_t gcs_system_id; ///< ID of the GCS this message
|
||||
uint8_t control_request; ///< 0: request control of this MAV, 1: Release control of this MAV
|
||||
uint8_t ack; ///< 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
|
||||
} mavlink_change_operator_control_ack_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK_LEN 3
|
||||
#define MAVLINK_MSG_ID_6_LEN 3
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_CHANGE_OPERATOR_CONTROL_ACK { \
|
||||
"CHANGE_OPERATOR_CONTROL_ACK", \
|
||||
3, \
|
||||
{ { "gcs_system_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_change_operator_control_ack_t, gcs_system_id) }, \
|
||||
{ "control_request", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_change_operator_control_ack_t, control_request) }, \
|
||||
{ "ack", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_change_operator_control_ack_t, ack) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a change_operator_control_ack message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param gcs_system_id ID of the GCS this message
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, gcs_system_id);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, ack);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_change_operator_control_ack_t packet;
|
||||
packet.gcs_system_id = gcs_system_id;
|
||||
packet.control_request = control_request;
|
||||
packet.ack = ack;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a change_operator_control_ack message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gcs_system_id ID of the GCS this message
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t gcs_system_id,uint8_t control_request,uint8_t ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, gcs_system_id);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, ack);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_change_operator_control_ack_t packet;
|
||||
packet.gcs_system_id = gcs_system_id;
|
||||
packet.control_request = control_request;
|
||||
packet.ack = ack;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a change_operator_control_ack struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param change_operator_control_ack C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_change_operator_control_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_change_operator_control_ack_t* change_operator_control_ack)
|
||||
{
|
||||
return mavlink_msg_change_operator_control_ack_pack(system_id, component_id, msg, change_operator_control_ack->gcs_system_id, change_operator_control_ack->control_request, change_operator_control_ack->ack);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a change_operator_control_ack message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param gcs_system_id ID of the GCS this message
|
||||
* @param control_request 0: request control of this MAV, 1: Release control of this MAV
|
||||
* @param ack 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_change_operator_control_ack_send(mavlink_channel_t chan, uint8_t gcs_system_id, uint8_t control_request, uint8_t ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, gcs_system_id);
|
||||
_mav_put_uint8_t(buf, 1, control_request);
|
||||
_mav_put_uint8_t(buf, 2, ack);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, buf, 3);
|
||||
#else
|
||||
mavlink_change_operator_control_ack_t packet;
|
||||
packet.gcs_system_id = gcs_system_id;
|
||||
packet.control_request = control_request;
|
||||
packet.ack = ack;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CHANGE_OPERATOR_CONTROL_ACK, (const char *)&packet, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE CHANGE_OPERATOR_CONTROL_ACK UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field gcs_system_id from change_operator_control_ack message
|
||||
*
|
||||
* @return ID of the GCS this message
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_ack_get_gcs_system_id(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_request from change_operator_control_ack message
|
||||
*
|
||||
* @return 0: request control of this MAV, 1: Release control of this MAV
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_ack_get_control_request(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field ack from change_operator_control_ack message
|
||||
*
|
||||
* @return 0: ACK, 1: NACK: Wrong passkey, 2: NACK: Unsupported passkey encryption method, 3: NACK: Already under control
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_change_operator_control_ack_get_ack(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a change_operator_control_ack message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param change_operator_control_ack C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_change_operator_control_ack_decode(const mavlink_message_t* msg, mavlink_change_operator_control_ack_t* change_operator_control_ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
change_operator_control_ack->gcs_system_id = mavlink_msg_change_operator_control_ack_get_gcs_system_id(msg);
|
||||
change_operator_control_ack->control_request = mavlink_msg_change_operator_control_ack_get_control_request(msg);
|
||||
change_operator_control_ack->ack = mavlink_msg_change_operator_control_ack_get_ack(msg);
|
||||
#else
|
||||
memcpy(change_operator_control_ack, _MAV_PAYLOAD(msg), 3);
|
||||
#endif
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
// MESSAGE COMMAND PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_COMMAND 75
|
||||
|
||||
typedef struct __mavlink_command_t
|
||||
{
|
||||
uint8_t target_system; ///< System which should execute the command
|
||||
uint8_t target_component; ///< Component which should execute the command, 0 for all components
|
||||
uint8_t command; ///< Command ID, as defined by MAV_CMD enum.
|
||||
uint8_t confirmation; ///< 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
|
||||
float param1; ///< Parameter 1, as defined by MAV_CMD enum.
|
||||
float param2; ///< Parameter 2, as defined by MAV_CMD enum.
|
||||
float param3; ///< Parameter 3, as defined by MAV_CMD enum.
|
||||
float param4; ///< Parameter 4, as defined by MAV_CMD enum.
|
||||
} mavlink_command_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_COMMAND_LEN 20
|
||||
#define MAVLINK_MSG_ID_75_LEN 20
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_COMMAND { \
|
||||
"COMMAND", \
|
||||
8, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_command_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_command_t, target_component) }, \
|
||||
{ "command", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_command_t, command) }, \
|
||||
{ "confirmation", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_command_t, confirmation) }, \
|
||||
{ "param1", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_t, param1) }, \
|
||||
{ "param2", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_command_t, param2) }, \
|
||||
{ "param3", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_command_t, param3) }, \
|
||||
{ "param4", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_command_t, param4) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a command message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System which should execute the command
|
||||
* @param target_component Component which should execute the command, 0 for all components
|
||||
* @param command Command ID, as defined by MAV_CMD enum.
|
||||
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
|
||||
* @param param1 Parameter 1, as defined by MAV_CMD enum.
|
||||
* @param param2 Parameter 2, as defined by MAV_CMD enum.
|
||||
* @param param3 Parameter 3, as defined by MAV_CMD enum.
|
||||
* @param param4 Parameter 4, as defined by MAV_CMD enum.
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, uint8_t command, uint8_t confirmation, float param1, float param2, float param3, float param4)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[20];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, command);
|
||||
_mav_put_uint8_t(buf, 3, confirmation);
|
||||
_mav_put_float(buf, 4, param1);
|
||||
_mav_put_float(buf, 8, param2);
|
||||
_mav_put_float(buf, 12, param3);
|
||||
_mav_put_float(buf, 16, param4);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 20);
|
||||
#else
|
||||
mavlink_command_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.command = command;
|
||||
packet.confirmation = confirmation;
|
||||
packet.param1 = param1;
|
||||
packet.param2 = param2;
|
||||
packet.param3 = param3;
|
||||
packet.param4 = param4;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 20);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_COMMAND;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a command message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System which should execute the command
|
||||
* @param target_component Component which should execute the command, 0 for all components
|
||||
* @param command Command ID, as defined by MAV_CMD enum.
|
||||
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
|
||||
* @param param1 Parameter 1, as defined by MAV_CMD enum.
|
||||
* @param param2 Parameter 2, as defined by MAV_CMD enum.
|
||||
* @param param3 Parameter 3, as defined by MAV_CMD enum.
|
||||
* @param param4 Parameter 4, as defined by MAV_CMD enum.
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,uint8_t command,uint8_t confirmation,float param1,float param2,float param3,float param4)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[20];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, command);
|
||||
_mav_put_uint8_t(buf, 3, confirmation);
|
||||
_mav_put_float(buf, 4, param1);
|
||||
_mav_put_float(buf, 8, param2);
|
||||
_mav_put_float(buf, 12, param3);
|
||||
_mav_put_float(buf, 16, param4);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 20);
|
||||
#else
|
||||
mavlink_command_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.command = command;
|
||||
packet.confirmation = confirmation;
|
||||
packet.param1 = param1;
|
||||
packet.param2 = param2;
|
||||
packet.param3 = param3;
|
||||
packet.param4 = param4;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 20);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_COMMAND;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a command struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param command C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_t* command)
|
||||
{
|
||||
return mavlink_msg_command_pack(system_id, component_id, msg, command->target_system, command->target_component, command->command, command->confirmation, command->param1, command->param2, command->param3, command->param4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a command message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System which should execute the command
|
||||
* @param target_component Component which should execute the command, 0 for all components
|
||||
* @param command Command ID, as defined by MAV_CMD enum.
|
||||
* @param confirmation 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
|
||||
* @param param1 Parameter 1, as defined by MAV_CMD enum.
|
||||
* @param param2 Parameter 2, as defined by MAV_CMD enum.
|
||||
* @param param3 Parameter 3, as defined by MAV_CMD enum.
|
||||
* @param param4 Parameter 4, as defined by MAV_CMD enum.
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_command_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, uint8_t command, uint8_t confirmation, float param1, float param2, float param3, float param4)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[20];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_uint8_t(buf, 2, command);
|
||||
_mav_put_uint8_t(buf, 3, confirmation);
|
||||
_mav_put_float(buf, 4, param1);
|
||||
_mav_put_float(buf, 8, param2);
|
||||
_mav_put_float(buf, 12, param3);
|
||||
_mav_put_float(buf, 16, param4);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND, buf, 20);
|
||||
#else
|
||||
mavlink_command_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.command = command;
|
||||
packet.confirmation = confirmation;
|
||||
packet.param1 = param1;
|
||||
packet.param2 = param2;
|
||||
packet.param3 = param3;
|
||||
packet.param4 = param4;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND, (const char *)&packet, 20);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE COMMAND UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from command message
|
||||
*
|
||||
* @return System which should execute the command
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_command_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from command message
|
||||
*
|
||||
* @return Component which should execute the command, 0 for all components
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_command_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field command from command message
|
||||
*
|
||||
* @return Command ID, as defined by MAV_CMD enum.
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_command_get_command(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field confirmation from command message
|
||||
*
|
||||
* @return 0: First transmission of this command. 1-255: Confirmation transmissions (e.g. for kill command)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_command_get_confirmation(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field param1 from command message
|
||||
*
|
||||
* @return Parameter 1, as defined by MAV_CMD enum.
|
||||
*/
|
||||
static inline float mavlink_msg_command_get_param1(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field param2 from command message
|
||||
*
|
||||
* @return Parameter 2, as defined by MAV_CMD enum.
|
||||
*/
|
||||
static inline float mavlink_msg_command_get_param2(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field param3 from command message
|
||||
*
|
||||
* @return Parameter 3, as defined by MAV_CMD enum.
|
||||
*/
|
||||
static inline float mavlink_msg_command_get_param3(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field param4 from command message
|
||||
*
|
||||
* @return Parameter 4, as defined by MAV_CMD enum.
|
||||
*/
|
||||
static inline float mavlink_msg_command_get_param4(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a command message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param command C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_command_decode(const mavlink_message_t* msg, mavlink_command_t* command)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
command->target_system = mavlink_msg_command_get_target_system(msg);
|
||||
command->target_component = mavlink_msg_command_get_target_component(msg);
|
||||
command->command = mavlink_msg_command_get_command(msg);
|
||||
command->confirmation = mavlink_msg_command_get_confirmation(msg);
|
||||
command->param1 = mavlink_msg_command_get_param1(msg);
|
||||
command->param2 = mavlink_msg_command_get_param2(msg);
|
||||
command->param3 = mavlink_msg_command_get_param3(msg);
|
||||
command->param4 = mavlink_msg_command_get_param4(msg);
|
||||
#else
|
||||
memcpy(command, _MAV_PAYLOAD(msg), 20);
|
||||
#endif
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// MESSAGE COMMAND_ACK PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_COMMAND_ACK 76
|
||||
|
||||
typedef struct __mavlink_command_ack_t
|
||||
{
|
||||
float command; ///< Current airspeed in m/s
|
||||
float result; ///< 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
|
||||
} mavlink_command_ack_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_COMMAND_ACK_LEN 8
|
||||
#define MAVLINK_MSG_ID_76_LEN 8
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_COMMAND_ACK { \
|
||||
"COMMAND_ACK", \
|
||||
2, \
|
||||
{ { "command", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_command_ack_t, command) }, \
|
||||
{ "result", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_command_ack_t, result) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a command_ack message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param command Current airspeed in m/s
|
||||
* @param result 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_ack_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
float command, float result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_float(buf, 0, command);
|
||||
_mav_put_float(buf, 4, result);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_command_ack_t packet;
|
||||
packet.command = command;
|
||||
packet.result = result;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a command_ack message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param command Current airspeed in m/s
|
||||
* @param result 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_ack_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
float command,float result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_float(buf, 0, command);
|
||||
_mav_put_float(buf, 4, result);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_command_ack_t packet;
|
||||
packet.command = command;
|
||||
packet.result = result;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_COMMAND_ACK;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a command_ack struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param command_ack C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_command_ack_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_command_ack_t* command_ack)
|
||||
{
|
||||
return mavlink_msg_command_ack_pack(system_id, component_id, msg, command_ack->command, command_ack->result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a command_ack message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param command Current airspeed in m/s
|
||||
* @param result 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_command_ack_send(mavlink_channel_t chan, float command, float result)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_float(buf, 0, command);
|
||||
_mav_put_float(buf, 4, result);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, buf, 8);
|
||||
#else
|
||||
mavlink_command_ack_t packet;
|
||||
packet.command = command;
|
||||
packet.result = result;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_COMMAND_ACK, (const char *)&packet, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE COMMAND_ACK UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field command from command_ack message
|
||||
*
|
||||
* @return Current airspeed in m/s
|
||||
*/
|
||||
static inline float mavlink_msg_command_ack_get_command(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field result from command_ack message
|
||||
*
|
||||
* @return 1: Action ACCEPTED and EXECUTED, 1: Action TEMPORARY REJECTED/DENIED, 2: Action PERMANENTLY DENIED, 3: Action UNKNOWN/UNSUPPORTED, 4: Requesting CONFIRMATION
|
||||
*/
|
||||
static inline float mavlink_msg_command_ack_get_result(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a command_ack message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param command_ack C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_command_ack_decode(const mavlink_message_t* msg, mavlink_command_ack_t* command_ack)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
command_ack->command = mavlink_msg_command_ack_get_command(msg);
|
||||
command_ack->result = mavlink_msg_command_ack_get_result(msg);
|
||||
#else
|
||||
memcpy(command_ack, _MAV_PAYLOAD(msg), 8);
|
||||
#endif
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
// MESSAGE CONTROL_STATUS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_CONTROL_STATUS 52
|
||||
|
||||
typedef struct __mavlink_control_status_t
|
||||
{
|
||||
uint8_t position_fix; ///< Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix
|
||||
uint8_t vision_fix; ///< Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix
|
||||
uint8_t gps_fix; ///< GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix
|
||||
uint8_t ahrs_health; ///< Attitude estimation health: 0: poor, 255: excellent
|
||||
uint8_t control_att; ///< 0: Attitude control disabled, 1: enabled
|
||||
uint8_t control_pos_xy; ///< 0: X, Y position control disabled, 1: enabled
|
||||
uint8_t control_pos_z; ///< 0: Z position control disabled, 1: enabled
|
||||
uint8_t control_pos_yaw; ///< 0: Yaw angle control disabled, 1: enabled
|
||||
} mavlink_control_status_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_CONTROL_STATUS_LEN 8
|
||||
#define MAVLINK_MSG_ID_52_LEN 8
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_CONTROL_STATUS { \
|
||||
"CONTROL_STATUS", \
|
||||
8, \
|
||||
{ { "position_fix", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_control_status_t, position_fix) }, \
|
||||
{ "vision_fix", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_control_status_t, vision_fix) }, \
|
||||
{ "gps_fix", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_control_status_t, gps_fix) }, \
|
||||
{ "ahrs_health", NULL, MAVLINK_TYPE_UINT8_T, 0, 3, offsetof(mavlink_control_status_t, ahrs_health) }, \
|
||||
{ "control_att", NULL, MAVLINK_TYPE_UINT8_T, 0, 4, offsetof(mavlink_control_status_t, control_att) }, \
|
||||
{ "control_pos_xy", NULL, MAVLINK_TYPE_UINT8_T, 0, 5, offsetof(mavlink_control_status_t, control_pos_xy) }, \
|
||||
{ "control_pos_z", NULL, MAVLINK_TYPE_UINT8_T, 0, 6, offsetof(mavlink_control_status_t, control_pos_z) }, \
|
||||
{ "control_pos_yaw", NULL, MAVLINK_TYPE_UINT8_T, 0, 7, offsetof(mavlink_control_status_t, control_pos_yaw) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a control_status message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param position_fix Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix
|
||||
* @param vision_fix Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix
|
||||
* @param gps_fix GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix
|
||||
* @param ahrs_health Attitude estimation health: 0: poor, 255: excellent
|
||||
* @param control_att 0: Attitude control disabled, 1: enabled
|
||||
* @param control_pos_xy 0: X, Y position control disabled, 1: enabled
|
||||
* @param control_pos_z 0: Z position control disabled, 1: enabled
|
||||
* @param control_pos_yaw 0: Yaw angle control disabled, 1: enabled
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_control_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t position_fix, uint8_t vision_fix, uint8_t gps_fix, uint8_t ahrs_health, uint8_t control_att, uint8_t control_pos_xy, uint8_t control_pos_z, uint8_t control_pos_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, position_fix);
|
||||
_mav_put_uint8_t(buf, 1, vision_fix);
|
||||
_mav_put_uint8_t(buf, 2, gps_fix);
|
||||
_mav_put_uint8_t(buf, 3, ahrs_health);
|
||||
_mav_put_uint8_t(buf, 4, control_att);
|
||||
_mav_put_uint8_t(buf, 5, control_pos_xy);
|
||||
_mav_put_uint8_t(buf, 6, control_pos_z);
|
||||
_mav_put_uint8_t(buf, 7, control_pos_yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_control_status_t packet;
|
||||
packet.position_fix = position_fix;
|
||||
packet.vision_fix = vision_fix;
|
||||
packet.gps_fix = gps_fix;
|
||||
packet.ahrs_health = ahrs_health;
|
||||
packet.control_att = control_att;
|
||||
packet.control_pos_xy = control_pos_xy;
|
||||
packet.control_pos_z = control_pos_z;
|
||||
packet.control_pos_yaw = control_pos_yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a control_status message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param position_fix Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix
|
||||
* @param vision_fix Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix
|
||||
* @param gps_fix GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix
|
||||
* @param ahrs_health Attitude estimation health: 0: poor, 255: excellent
|
||||
* @param control_att 0: Attitude control disabled, 1: enabled
|
||||
* @param control_pos_xy 0: X, Y position control disabled, 1: enabled
|
||||
* @param control_pos_z 0: Z position control disabled, 1: enabled
|
||||
* @param control_pos_yaw 0: Yaw angle control disabled, 1: enabled
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_control_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t position_fix,uint8_t vision_fix,uint8_t gps_fix,uint8_t ahrs_health,uint8_t control_att,uint8_t control_pos_xy,uint8_t control_pos_z,uint8_t control_pos_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, position_fix);
|
||||
_mav_put_uint8_t(buf, 1, vision_fix);
|
||||
_mav_put_uint8_t(buf, 2, gps_fix);
|
||||
_mav_put_uint8_t(buf, 3, ahrs_health);
|
||||
_mav_put_uint8_t(buf, 4, control_att);
|
||||
_mav_put_uint8_t(buf, 5, control_pos_xy);
|
||||
_mav_put_uint8_t(buf, 6, control_pos_z);
|
||||
_mav_put_uint8_t(buf, 7, control_pos_yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 8);
|
||||
#else
|
||||
mavlink_control_status_t packet;
|
||||
packet.position_fix = position_fix;
|
||||
packet.vision_fix = vision_fix;
|
||||
packet.gps_fix = gps_fix;
|
||||
packet.ahrs_health = ahrs_health;
|
||||
packet.control_att = control_att;
|
||||
packet.control_pos_xy = control_pos_xy;
|
||||
packet.control_pos_z = control_pos_z;
|
||||
packet.control_pos_yaw = control_pos_yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 8);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_CONTROL_STATUS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a control_status struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param control_status C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_control_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_control_status_t* control_status)
|
||||
{
|
||||
return mavlink_msg_control_status_pack(system_id, component_id, msg, control_status->position_fix, control_status->vision_fix, control_status->gps_fix, control_status->ahrs_health, control_status->control_att, control_status->control_pos_xy, control_status->control_pos_z, control_status->control_pos_yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a control_status message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param position_fix Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix
|
||||
* @param vision_fix Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix
|
||||
* @param gps_fix GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix
|
||||
* @param ahrs_health Attitude estimation health: 0: poor, 255: excellent
|
||||
* @param control_att 0: Attitude control disabled, 1: enabled
|
||||
* @param control_pos_xy 0: X, Y position control disabled, 1: enabled
|
||||
* @param control_pos_z 0: Z position control disabled, 1: enabled
|
||||
* @param control_pos_yaw 0: Yaw angle control disabled, 1: enabled
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_control_status_send(mavlink_channel_t chan, uint8_t position_fix, uint8_t vision_fix, uint8_t gps_fix, uint8_t ahrs_health, uint8_t control_att, uint8_t control_pos_xy, uint8_t control_pos_z, uint8_t control_pos_yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[8];
|
||||
_mav_put_uint8_t(buf, 0, position_fix);
|
||||
_mav_put_uint8_t(buf, 1, vision_fix);
|
||||
_mav_put_uint8_t(buf, 2, gps_fix);
|
||||
_mav_put_uint8_t(buf, 3, ahrs_health);
|
||||
_mav_put_uint8_t(buf, 4, control_att);
|
||||
_mav_put_uint8_t(buf, 5, control_pos_xy);
|
||||
_mav_put_uint8_t(buf, 6, control_pos_z);
|
||||
_mav_put_uint8_t(buf, 7, control_pos_yaw);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, buf, 8);
|
||||
#else
|
||||
mavlink_control_status_t packet;
|
||||
packet.position_fix = position_fix;
|
||||
packet.vision_fix = vision_fix;
|
||||
packet.gps_fix = gps_fix;
|
||||
packet.ahrs_health = ahrs_health;
|
||||
packet.control_att = control_att;
|
||||
packet.control_pos_xy = control_pos_xy;
|
||||
packet.control_pos_z = control_pos_z;
|
||||
packet.control_pos_yaw = control_pos_yaw;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_CONTROL_STATUS, (const char *)&packet, 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE CONTROL_STATUS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field position_fix from control_status message
|
||||
*
|
||||
* @return Position fix: 0: lost, 2: 2D position fix, 3: 3D position fix
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_position_fix(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vision_fix from control_status message
|
||||
*
|
||||
* @return Vision position fix: 0: lost, 1: 2D local position hold, 2: 2D global position fix, 3: 3D global position fix
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_vision_fix(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field gps_fix from control_status message
|
||||
*
|
||||
* @return GPS position fix: 0: no reception, 1: Minimum 1 satellite, but no position fix, 2: 2D position fix, 3: 3D position fix
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_gps_fix(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field ahrs_health from control_status message
|
||||
*
|
||||
* @return Attitude estimation health: 0: poor, 255: excellent
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_ahrs_health(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_att from control_status message
|
||||
*
|
||||
* @return 0: Attitude control disabled, 1: enabled
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_control_att(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_pos_xy from control_status message
|
||||
*
|
||||
* @return 0: X, Y position control disabled, 1: enabled
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_control_pos_xy(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_pos_z from control_status message
|
||||
*
|
||||
* @return 0: Z position control disabled, 1: enabled
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_control_pos_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field control_pos_yaw from control_status message
|
||||
*
|
||||
* @return 0: Yaw angle control disabled, 1: enabled
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_control_status_get_control_pos_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 7);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a control_status message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param control_status C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_control_status_decode(const mavlink_message_t* msg, mavlink_control_status_t* control_status)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
control_status->position_fix = mavlink_msg_control_status_get_position_fix(msg);
|
||||
control_status->vision_fix = mavlink_msg_control_status_get_vision_fix(msg);
|
||||
control_status->gps_fix = mavlink_msg_control_status_get_gps_fix(msg);
|
||||
control_status->ahrs_health = mavlink_msg_control_status_get_ahrs_health(msg);
|
||||
control_status->control_att = mavlink_msg_control_status_get_control_att(msg);
|
||||
control_status->control_pos_xy = mavlink_msg_control_status_get_control_pos_xy(msg);
|
||||
control_status->control_pos_z = mavlink_msg_control_status_get_control_pos_z(msg);
|
||||
control_status->control_pos_yaw = mavlink_msg_control_status_get_control_pos_yaw(msg);
|
||||
#else
|
||||
memcpy(control_status, _MAV_PAYLOAD(msg), 8);
|
||||
#endif
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
// MESSAGE DEBUG PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_DEBUG 255
|
||||
|
||||
typedef struct __mavlink_debug_t
|
||||
{
|
||||
uint8_t ind; ///< index of debug variable
|
||||
float value; ///< DEBUG value
|
||||
} mavlink_debug_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_DEBUG_LEN 5
|
||||
#define MAVLINK_MSG_ID_255_LEN 5
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_DEBUG { \
|
||||
"DEBUG", \
|
||||
2, \
|
||||
{ { "ind", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_debug_t, ind) }, \
|
||||
{ "value", NULL, MAVLINK_TYPE_FLOAT, 0, 1, offsetof(mavlink_debug_t, value) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a debug message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param ind index of debug variable
|
||||
* @param value DEBUG value
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t ind, float value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[5];
|
||||
_mav_put_uint8_t(buf, 0, ind);
|
||||
_mav_put_float(buf, 1, value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 5);
|
||||
#else
|
||||
mavlink_debug_t packet;
|
||||
packet.ind = ind;
|
||||
packet.value = value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 5);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DEBUG;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a debug message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param ind index of debug variable
|
||||
* @param value DEBUG value
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t ind,float value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[5];
|
||||
_mav_put_uint8_t(buf, 0, ind);
|
||||
_mav_put_float(buf, 1, value);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 5);
|
||||
#else
|
||||
mavlink_debug_t packet;
|
||||
packet.ind = ind;
|
||||
packet.value = value;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 5);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DEBUG;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a debug struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param debug C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_debug_t* debug)
|
||||
{
|
||||
return mavlink_msg_debug_pack(system_id, component_id, msg, debug->ind, debug->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a debug message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param ind index of debug variable
|
||||
* @param value DEBUG value
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_debug_send(mavlink_channel_t chan, uint8_t ind, float value)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[5];
|
||||
_mav_put_uint8_t(buf, 0, ind);
|
||||
_mav_put_float(buf, 1, value);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, buf, 5);
|
||||
#else
|
||||
mavlink_debug_t packet;
|
||||
packet.ind = ind;
|
||||
packet.value = value;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG, (const char *)&packet, 5);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE DEBUG UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field ind from debug message
|
||||
*
|
||||
* @return index of debug variable
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_debug_get_ind(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field value from debug message
|
||||
*
|
||||
* @return DEBUG value
|
||||
*/
|
||||
static inline float mavlink_msg_debug_get_value(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a debug message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param debug C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_debug_decode(const mavlink_message_t* msg, mavlink_debug_t* debug)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
debug->ind = mavlink_msg_debug_get_ind(msg);
|
||||
debug->value = mavlink_msg_debug_get_value(msg);
|
||||
#else
|
||||
memcpy(debug, _MAV_PAYLOAD(msg), 5);
|
||||
#endif
|
||||
}
|
||||
@@ -1,226 +0,0 @@
|
||||
// MESSAGE DEBUG_VECT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_DEBUG_VECT 251
|
||||
|
||||
typedef struct __mavlink_debug_vect_t
|
||||
{
|
||||
char name[10]; ///< Name
|
||||
uint64_t usec; ///< Timestamp
|
||||
float x; ///< x
|
||||
float y; ///< y
|
||||
float z; ///< z
|
||||
} mavlink_debug_vect_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_DEBUG_VECT_LEN 30
|
||||
#define MAVLINK_MSG_ID_251_LEN 30
|
||||
|
||||
#define MAVLINK_MSG_DEBUG_VECT_FIELD_NAME_LEN 10
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_DEBUG_VECT { \
|
||||
"DEBUG_VECT", \
|
||||
5, \
|
||||
{ { "name", NULL, MAVLINK_TYPE_CHAR, 10, 0, offsetof(mavlink_debug_vect_t, name) }, \
|
||||
{ "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 10, offsetof(mavlink_debug_vect_t, usec) }, \
|
||||
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 18, offsetof(mavlink_debug_vect_t, x) }, \
|
||||
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 22, offsetof(mavlink_debug_vect_t, y) }, \
|
||||
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 26, offsetof(mavlink_debug_vect_t, z) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a debug_vect message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param name Name
|
||||
* @param usec Timestamp
|
||||
* @param x x
|
||||
* @param y y
|
||||
* @param z z
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_vect_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
const char *name, uint64_t usec, float x, float y, float z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[30];
|
||||
_mav_put_uint64_t(buf, 10, usec);
|
||||
_mav_put_float(buf, 18, x);
|
||||
_mav_put_float(buf, 22, y);
|
||||
_mav_put_float(buf, 26, z);
|
||||
_mav_put_char_array(buf, 0, name, 10);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 30);
|
||||
#else
|
||||
mavlink_debug_vect_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
mav_array_memcpy(packet.name, name, sizeof(char)*10);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 30);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a debug_vect message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param name Name
|
||||
* @param usec Timestamp
|
||||
* @param x x
|
||||
* @param y y
|
||||
* @param z z
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_vect_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
const char *name,uint64_t usec,float x,float y,float z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[30];
|
||||
_mav_put_uint64_t(buf, 10, usec);
|
||||
_mav_put_float(buf, 18, x);
|
||||
_mav_put_float(buf, 22, y);
|
||||
_mav_put_float(buf, 26, z);
|
||||
_mav_put_char_array(buf, 0, name, 10);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 30);
|
||||
#else
|
||||
mavlink_debug_vect_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
mav_array_memcpy(packet.name, name, sizeof(char)*10);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 30);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_DEBUG_VECT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a debug_vect struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param debug_vect C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_vect_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_debug_vect_t* debug_vect)
|
||||
{
|
||||
return mavlink_msg_debug_vect_pack(system_id, component_id, msg, debug_vect->name, debug_vect->usec, debug_vect->x, debug_vect->y, debug_vect->z);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a debug_vect message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param name Name
|
||||
* @param usec Timestamp
|
||||
* @param x x
|
||||
* @param y y
|
||||
* @param z z
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_debug_vect_send(mavlink_channel_t chan, const char *name, uint64_t usec, float x, float y, float z)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[30];
|
||||
_mav_put_uint64_t(buf, 10, usec);
|
||||
_mav_put_float(buf, 18, x);
|
||||
_mav_put_float(buf, 22, y);
|
||||
_mav_put_float(buf, 26, z);
|
||||
_mav_put_char_array(buf, 0, name, 10);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, buf, 30);
|
||||
#else
|
||||
mavlink_debug_vect_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
mav_array_memcpy(packet.name, name, sizeof(char)*10);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_DEBUG_VECT, (const char *)&packet, 30);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE DEBUG_VECT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field name from debug_vect message
|
||||
*
|
||||
* @return Name
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_debug_vect_get_name(const mavlink_message_t* msg, char *name)
|
||||
{
|
||||
return _MAV_RETURN_char_array(msg, name, 10, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field usec from debug_vect message
|
||||
*
|
||||
* @return Timestamp
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_debug_vect_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field x from debug_vect message
|
||||
*
|
||||
* @return x
|
||||
*/
|
||||
static inline float mavlink_msg_debug_vect_get_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field y from debug_vect message
|
||||
*
|
||||
* @return y
|
||||
*/
|
||||
static inline float mavlink_msg_debug_vect_get_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 22);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field z from debug_vect message
|
||||
*
|
||||
* @return z
|
||||
*/
|
||||
static inline float mavlink_msg_debug_vect_get_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 26);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a debug_vect message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param debug_vect C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_debug_vect_decode(const mavlink_message_t* msg, mavlink_debug_vect_t* debug_vect)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
mavlink_msg_debug_vect_get_name(msg, debug_vect->name);
|
||||
debug_vect->usec = mavlink_msg_debug_vect_get_usec(msg);
|
||||
debug_vect->x = mavlink_msg_debug_vect_get_x(msg);
|
||||
debug_vect->y = mavlink_msg_debug_vect_get_y(msg);
|
||||
debug_vect->z = mavlink_msg_debug_vect_get_z(msg);
|
||||
#else
|
||||
memcpy(debug_vect, _MAV_PAYLOAD(msg), 30);
|
||||
#endif
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
// MESSAGE GLOBAL_POSITION PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GLOBAL_POSITION 33
|
||||
|
||||
typedef struct __mavlink_global_position_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since unix epoch)
|
||||
float lat; ///< Latitude, in degrees
|
||||
float lon; ///< Longitude, in degrees
|
||||
float alt; ///< Absolute altitude, in meters
|
||||
float vx; ///< X Speed (in Latitude direction, positive: going north)
|
||||
float vy; ///< Y Speed (in Longitude direction, positive: going east)
|
||||
float vz; ///< Z Speed (in Altitude direction, positive: going up)
|
||||
} mavlink_global_position_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GLOBAL_POSITION_LEN 32
|
||||
#define MAVLINK_MSG_ID_33_LEN 32
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION { \
|
||||
"GLOBAL_POSITION", \
|
||||
7, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_global_position_t, usec) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_global_position_t, lat) }, \
|
||||
{ "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_global_position_t, lon) }, \
|
||||
{ "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_global_position_t, alt) }, \
|
||||
{ "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_global_position_t, vx) }, \
|
||||
{ "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_global_position_t, vy) }, \
|
||||
{ "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_global_position_t, vz) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a global_position message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since unix epoch)
|
||||
* @param lat Latitude, in degrees
|
||||
* @param lon Longitude, in degrees
|
||||
* @param alt Absolute altitude, in meters
|
||||
* @param vx X Speed (in Latitude direction, positive: going north)
|
||||
* @param vy Y Speed (in Longitude direction, positive: going east)
|
||||
* @param vz Z Speed (in Altitude direction, positive: going up)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, float lat, float lon, float alt, float vx, float vy, float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, lat);
|
||||
_mav_put_float(buf, 12, lon);
|
||||
_mav_put_float(buf, 16, alt);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_global_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a global_position message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since unix epoch)
|
||||
* @param lat Latitude, in degrees
|
||||
* @param lon Longitude, in degrees
|
||||
* @param alt Absolute altitude, in meters
|
||||
* @param vx X Speed (in Latitude direction, positive: going north)
|
||||
* @param vy Y Speed (in Longitude direction, positive: going east)
|
||||
* @param vz Z Speed (in Altitude direction, positive: going up)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,float lat,float lon,float alt,float vx,float vy,float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, lat);
|
||||
_mav_put_float(buf, 12, lon);
|
||||
_mav_put_float(buf, 16, alt);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_global_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a global_position struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param global_position C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_t* global_position)
|
||||
{
|
||||
return mavlink_msg_global_position_pack(system_id, component_id, msg, global_position->usec, global_position->lat, global_position->lon, global_position->alt, global_position->vx, global_position->vy, global_position->vz);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a global_position message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since unix epoch)
|
||||
* @param lat Latitude, in degrees
|
||||
* @param lon Longitude, in degrees
|
||||
* @param alt Absolute altitude, in meters
|
||||
* @param vx X Speed (in Latitude direction, positive: going north)
|
||||
* @param vy Y Speed (in Longitude direction, positive: going east)
|
||||
* @param vz Z Speed (in Altitude direction, positive: going up)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_global_position_send(mavlink_channel_t chan, uint64_t usec, float lat, float lon, float alt, float vx, float vy, float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, lat);
|
||||
_mav_put_float(buf, 12, lon);
|
||||
_mav_put_float(buf, 16, alt);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, buf, 32);
|
||||
#else
|
||||
mavlink_global_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION, (const char *)&packet, 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GLOBAL_POSITION UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from global_position message
|
||||
*
|
||||
* @return Timestamp (microseconds since unix epoch)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_global_position_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from global_position message
|
||||
*
|
||||
* @return Latitude, in degrees
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lon from global_position message
|
||||
*
|
||||
* @return Longitude, in degrees
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_lon(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alt from global_position message
|
||||
*
|
||||
* @return Absolute altitude, in meters
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_alt(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vx from global_position message
|
||||
*
|
||||
* @return X Speed (in Latitude direction, positive: going north)
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_vx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vy from global_position message
|
||||
*
|
||||
* @return Y Speed (in Longitude direction, positive: going east)
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_vy(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vz from global_position message
|
||||
*
|
||||
* @return Z Speed (in Altitude direction, positive: going up)
|
||||
*/
|
||||
static inline float mavlink_msg_global_position_get_vz(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a global_position message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param global_position C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_global_position_decode(const mavlink_message_t* msg, mavlink_global_position_t* global_position)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
global_position->usec = mavlink_msg_global_position_get_usec(msg);
|
||||
global_position->lat = mavlink_msg_global_position_get_lat(msg);
|
||||
global_position->lon = mavlink_msg_global_position_get_lon(msg);
|
||||
global_position->alt = mavlink_msg_global_position_get_alt(msg);
|
||||
global_position->vx = mavlink_msg_global_position_get_vx(msg);
|
||||
global_position->vy = mavlink_msg_global_position_get_vy(msg);
|
||||
global_position->vz = mavlink_msg_global_position_get_vz(msg);
|
||||
#else
|
||||
memcpy(global_position, _MAV_PAYLOAD(msg), 32);
|
||||
#endif
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE GLOBAL_POSITION_INT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT 73
|
||||
|
||||
typedef struct __mavlink_global_position_int_t
|
||||
{
|
||||
int32_t lat; ///< Latitude, expressed as * 1E7
|
||||
int32_t lon; ///< Longitude, expressed as * 1E7
|
||||
int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters)
|
||||
int16_t vx; ///< Ground X Speed (Latitude), expressed as m/s * 100
|
||||
int16_t vy; ///< Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
int16_t vz; ///< Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
} mavlink_global_position_int_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GLOBAL_POSITION_INT_LEN 18
|
||||
#define MAVLINK_MSG_ID_73_LEN 18
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GLOBAL_POSITION_INT { \
|
||||
"GLOBAL_POSITION_INT", \
|
||||
6, \
|
||||
{ { "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_global_position_int_t, lat) }, \
|
||||
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_global_position_int_t, lon) }, \
|
||||
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_global_position_int_t, alt) }, \
|
||||
{ "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 12, offsetof(mavlink_global_position_int_t, vx) }, \
|
||||
{ "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_global_position_int_t, vy) }, \
|
||||
{ "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_global_position_int_t, vz) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a global_position_int message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_int32_t(buf, 0, lat);
|
||||
_mav_put_int32_t(buf, 4, lon);
|
||||
_mav_put_int32_t(buf, 8, alt);
|
||||
_mav_put_int16_t(buf, 12, vx);
|
||||
_mav_put_int16_t(buf, 14, vy);
|
||||
_mav_put_int16_t(buf, 16, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 18);
|
||||
#else
|
||||
mavlink_global_position_int_t packet;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 18);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a global_position_int message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
int32_t lat,int32_t lon,int32_t alt,int16_t vx,int16_t vy,int16_t vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_int32_t(buf, 0, lat);
|
||||
_mav_put_int32_t(buf, 4, lon);
|
||||
_mav_put_int32_t(buf, 8, alt);
|
||||
_mav_put_int16_t(buf, 12, vx);
|
||||
_mav_put_int16_t(buf, 14, vy);
|
||||
_mav_put_int16_t(buf, 16, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 18);
|
||||
#else
|
||||
mavlink_global_position_int_t packet;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 18);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GLOBAL_POSITION_INT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a global_position_int struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param global_position_int C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_global_position_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_global_position_int_t* global_position_int)
|
||||
{
|
||||
return mavlink_msg_global_position_int_pack(system_id, component_id, msg, global_position_int->lat, global_position_int->lon, global_position_int->alt, global_position_int->vx, global_position_int->vy, global_position_int->vz);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a global_position_int message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_global_position_int_send(mavlink_channel_t chan, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_int32_t(buf, 0, lat);
|
||||
_mav_put_int32_t(buf, 4, lon);
|
||||
_mav_put_int32_t(buf, 8, alt);
|
||||
_mav_put_int16_t(buf, 12, vx);
|
||||
_mav_put_int16_t(buf, 14, vy);
|
||||
_mav_put_int16_t(buf, 16, vz);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, buf, 18);
|
||||
#else
|
||||
mavlink_global_position_int_t packet;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, (const char *)&packet, 18);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GLOBAL_POSITION_INT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field lat from global_position_int message
|
||||
*
|
||||
* @return Latitude, expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_global_position_int_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lon from global_position_int message
|
||||
*
|
||||
* @return Longitude, expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_global_position_int_get_lon(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alt from global_position_int message
|
||||
*
|
||||
* @return Altitude in meters, expressed as * 1000 (millimeters)
|
||||
*/
|
||||
static inline int32_t mavlink_msg_global_position_int_get_alt(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vx from global_position_int message
|
||||
*
|
||||
* @return Ground X Speed (Latitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_global_position_int_get_vx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vy from global_position_int message
|
||||
*
|
||||
* @return Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_global_position_int_get_vy(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vz from global_position_int message
|
||||
*
|
||||
* @return Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_global_position_int_get_vz(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a global_position_int message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param global_position_int C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_global_position_int_decode(const mavlink_message_t* msg, mavlink_global_position_int_t* global_position_int)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
global_position_int->lat = mavlink_msg_global_position_int_get_lat(msg);
|
||||
global_position_int->lon = mavlink_msg_global_position_int_get_lon(msg);
|
||||
global_position_int->alt = mavlink_msg_global_position_int_get_alt(msg);
|
||||
global_position_int->vx = mavlink_msg_global_position_int_get_vx(msg);
|
||||
global_position_int->vy = mavlink_msg_global_position_int_get_vy(msg);
|
||||
global_position_int->vz = mavlink_msg_global_position_int_get_vz(msg);
|
||||
#else
|
||||
memcpy(global_position_int, _MAV_PAYLOAD(msg), 18);
|
||||
#endif
|
||||
}
|
||||
@@ -1,188 +0,0 @@
|
||||
// MESSAGE GPS_LOCAL_ORIGIN_SET PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET 49
|
||||
|
||||
typedef struct __mavlink_gps_local_origin_set_t
|
||||
{
|
||||
int32_t latitude; ///< Latitude (WGS84), expressed as * 1E7
|
||||
int32_t longitude; ///< Longitude (WGS84), expressed as * 1E7
|
||||
int32_t altitude; ///< Altitude(WGS84), expressed as * 1000
|
||||
} mavlink_gps_local_origin_set_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET_LEN 12
|
||||
#define MAVLINK_MSG_ID_49_LEN 12
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GPS_LOCAL_ORIGIN_SET { \
|
||||
"GPS_LOCAL_ORIGIN_SET", \
|
||||
3, \
|
||||
{ { "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_gps_local_origin_set_t, latitude) }, \
|
||||
{ "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_gps_local_origin_set_t, longitude) }, \
|
||||
{ "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_gps_local_origin_set_t, altitude) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_local_origin_set message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param latitude Latitude (WGS84), expressed as * 1E7
|
||||
* @param longitude Longitude (WGS84), expressed as * 1E7
|
||||
* @param altitude Altitude(WGS84), expressed as * 1000
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_local_origin_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
int32_t latitude, int32_t longitude, int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_int32_t(buf, 0, latitude);
|
||||
_mav_put_int32_t(buf, 4, longitude);
|
||||
_mav_put_int32_t(buf, 8, altitude);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_gps_local_origin_set_t packet;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_local_origin_set message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param latitude Latitude (WGS84), expressed as * 1E7
|
||||
* @param longitude Longitude (WGS84), expressed as * 1E7
|
||||
* @param altitude Altitude(WGS84), expressed as * 1000
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_local_origin_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
int32_t latitude,int32_t longitude,int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_int32_t(buf, 0, latitude);
|
||||
_mav_put_int32_t(buf, 4, longitude);
|
||||
_mav_put_int32_t(buf, 8, altitude);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 12);
|
||||
#else
|
||||
mavlink_gps_local_origin_set_t packet;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 12);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a gps_local_origin_set struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gps_local_origin_set C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_local_origin_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_local_origin_set_t* gps_local_origin_set)
|
||||
{
|
||||
return mavlink_msg_gps_local_origin_set_pack(system_id, component_id, msg, gps_local_origin_set->latitude, gps_local_origin_set->longitude, gps_local_origin_set->altitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a gps_local_origin_set message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param latitude Latitude (WGS84), expressed as * 1E7
|
||||
* @param longitude Longitude (WGS84), expressed as * 1E7
|
||||
* @param altitude Altitude(WGS84), expressed as * 1000
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_gps_local_origin_set_send(mavlink_channel_t chan, int32_t latitude, int32_t longitude, int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[12];
|
||||
_mav_put_int32_t(buf, 0, latitude);
|
||||
_mav_put_int32_t(buf, 4, longitude);
|
||||
_mav_put_int32_t(buf, 8, altitude);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET, buf, 12);
|
||||
#else
|
||||
mavlink_gps_local_origin_set_t packet;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_LOCAL_ORIGIN_SET, (const char *)&packet, 12);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GPS_LOCAL_ORIGIN_SET UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field latitude from gps_local_origin_set message
|
||||
*
|
||||
* @return Latitude (WGS84), expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_local_origin_set_get_latitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field longitude from gps_local_origin_set message
|
||||
*
|
||||
* @return Longitude (WGS84), expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_local_origin_set_get_longitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field altitude from gps_local_origin_set message
|
||||
*
|
||||
* @return Altitude(WGS84), expressed as * 1000
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_local_origin_set_get_altitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a gps_local_origin_set message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param gps_local_origin_set C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_gps_local_origin_set_decode(const mavlink_message_t* msg, mavlink_gps_local_origin_set_t* gps_local_origin_set)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
gps_local_origin_set->latitude = mavlink_msg_gps_local_origin_set_get_latitude(msg);
|
||||
gps_local_origin_set->longitude = mavlink_msg_gps_local_origin_set_get_longitude(msg);
|
||||
gps_local_origin_set->altitude = mavlink_msg_gps_local_origin_set_get_altitude(msg);
|
||||
#else
|
||||
memcpy(gps_local_origin_set, _MAV_PAYLOAD(msg), 12);
|
||||
#endif
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
// MESSAGE GPS_RAW PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_RAW 32
|
||||
|
||||
typedef struct __mavlink_gps_raw_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
uint8_t fix_type; ///< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
float lat; ///< Latitude in degrees
|
||||
float lon; ///< Longitude in degrees
|
||||
float alt; ///< Altitude in meters
|
||||
float eph; ///< GPS HDOP
|
||||
float epv; ///< GPS VDOP
|
||||
float v; ///< GPS ground speed
|
||||
float hdg; ///< Compass heading in degrees, 0..360 degrees
|
||||
} mavlink_gps_raw_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_RAW_LEN 37
|
||||
#define MAVLINK_MSG_ID_32_LEN 37
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GPS_RAW { \
|
||||
"GPS_RAW", \
|
||||
9, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_t, usec) }, \
|
||||
{ "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gps_raw_t, fix_type) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_FLOAT, 0, 9, offsetof(mavlink_gps_raw_t, lat) }, \
|
||||
{ "lon", NULL, MAVLINK_TYPE_FLOAT, 0, 13, offsetof(mavlink_gps_raw_t, lon) }, \
|
||||
{ "alt", NULL, MAVLINK_TYPE_FLOAT, 0, 17, offsetof(mavlink_gps_raw_t, alt) }, \
|
||||
{ "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 21, offsetof(mavlink_gps_raw_t, eph) }, \
|
||||
{ "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 25, offsetof(mavlink_gps_raw_t, epv) }, \
|
||||
{ "v", NULL, MAVLINK_TYPE_FLOAT, 0, 29, offsetof(mavlink_gps_raw_t, v) }, \
|
||||
{ "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 33, offsetof(mavlink_gps_raw_t, hdg) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_raw message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in degrees
|
||||
* @param lon Longitude in degrees
|
||||
* @param alt Altitude in meters
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, uint8_t fix_type, float lat, float lon, float alt, float eph, float epv, float v, float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_float(buf, 9, lat);
|
||||
_mav_put_float(buf, 13, lon);
|
||||
_mav_put_float(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 37);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_RAW;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 37);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_raw message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in degrees
|
||||
* @param lon Longitude in degrees
|
||||
* @param alt Altitude in meters
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,uint8_t fix_type,float lat,float lon,float alt,float eph,float epv,float v,float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_float(buf, 9, lat);
|
||||
_mav_put_float(buf, 13, lon);
|
||||
_mav_put_float(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 37);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_RAW;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 37);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a gps_raw struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gps_raw C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_t* gps_raw)
|
||||
{
|
||||
return mavlink_msg_gps_raw_pack(system_id, component_id, msg, gps_raw->usec, gps_raw->fix_type, gps_raw->lat, gps_raw->lon, gps_raw->alt, gps_raw->eph, gps_raw->epv, gps_raw->v, gps_raw->hdg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a gps_raw message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in degrees
|
||||
* @param lon Longitude in degrees
|
||||
* @param alt Altitude in meters
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_gps_raw_send(mavlink_channel_t chan, uint64_t usec, uint8_t fix_type, float lat, float lon, float alt, float eph, float epv, float v, float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_float(buf, 9, lat);
|
||||
_mav_put_float(buf, 13, lon);
|
||||
_mav_put_float(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW, buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW, (const char *)&packet, 37);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GPS_RAW UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from gps_raw message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_gps_raw_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field fix_type from gps_raw message
|
||||
*
|
||||
* @return 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_gps_raw_get_fix_type(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from gps_raw message
|
||||
*
|
||||
* @return Latitude in degrees
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 9);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lon from gps_raw message
|
||||
*
|
||||
* @return Longitude in degrees
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_lon(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alt from gps_raw message
|
||||
*
|
||||
* @return Altitude in meters
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_alt(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 17);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field eph from gps_raw message
|
||||
*
|
||||
* @return GPS HDOP
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_eph(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 21);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field epv from gps_raw message
|
||||
*
|
||||
* @return GPS VDOP
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_epv(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 25);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field v from gps_raw message
|
||||
*
|
||||
* @return GPS ground speed
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_v(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 29);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field hdg from gps_raw message
|
||||
*
|
||||
* @return Compass heading in degrees, 0..360 degrees
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_get_hdg(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 33);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a gps_raw message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param gps_raw C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_gps_raw_decode(const mavlink_message_t* msg, mavlink_gps_raw_t* gps_raw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
gps_raw->usec = mavlink_msg_gps_raw_get_usec(msg);
|
||||
gps_raw->fix_type = mavlink_msg_gps_raw_get_fix_type(msg);
|
||||
gps_raw->lat = mavlink_msg_gps_raw_get_lat(msg);
|
||||
gps_raw->lon = mavlink_msg_gps_raw_get_lon(msg);
|
||||
gps_raw->alt = mavlink_msg_gps_raw_get_alt(msg);
|
||||
gps_raw->eph = mavlink_msg_gps_raw_get_eph(msg);
|
||||
gps_raw->epv = mavlink_msg_gps_raw_get_epv(msg);
|
||||
gps_raw->v = mavlink_msg_gps_raw_get_v(msg);
|
||||
gps_raw->hdg = mavlink_msg_gps_raw_get_hdg(msg);
|
||||
#else
|
||||
memcpy(gps_raw, _MAV_PAYLOAD(msg), 37);
|
||||
#endif
|
||||
}
|
||||
@@ -1,320 +0,0 @@
|
||||
// MESSAGE GPS_RAW_INT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_RAW_INT 25
|
||||
|
||||
typedef struct __mavlink_gps_raw_int_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
uint8_t fix_type; ///< 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
int32_t lat; ///< Latitude in 1E7 degrees
|
||||
int32_t lon; ///< Longitude in 1E7 degrees
|
||||
int32_t alt; ///< Altitude in 1E3 meters (millimeters)
|
||||
float eph; ///< GPS HDOP
|
||||
float epv; ///< GPS VDOP
|
||||
float v; ///< GPS ground speed (m/s)
|
||||
float hdg; ///< Compass heading in degrees, 0..360 degrees
|
||||
} mavlink_gps_raw_int_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_RAW_INT_LEN 37
|
||||
#define MAVLINK_MSG_ID_25_LEN 37
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GPS_RAW_INT { \
|
||||
"GPS_RAW_INT", \
|
||||
9, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_gps_raw_int_t, usec) }, \
|
||||
{ "fix_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 8, offsetof(mavlink_gps_raw_int_t, fix_type) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 9, offsetof(mavlink_gps_raw_int_t, lat) }, \
|
||||
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 13, offsetof(mavlink_gps_raw_int_t, lon) }, \
|
||||
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 17, offsetof(mavlink_gps_raw_int_t, alt) }, \
|
||||
{ "eph", NULL, MAVLINK_TYPE_FLOAT, 0, 21, offsetof(mavlink_gps_raw_int_t, eph) }, \
|
||||
{ "epv", NULL, MAVLINK_TYPE_FLOAT, 0, 25, offsetof(mavlink_gps_raw_int_t, epv) }, \
|
||||
{ "v", NULL, MAVLINK_TYPE_FLOAT, 0, 29, offsetof(mavlink_gps_raw_int_t, v) }, \
|
||||
{ "hdg", NULL, MAVLINK_TYPE_FLOAT, 0, 33, offsetof(mavlink_gps_raw_int_t, hdg) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_raw_int message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in 1E7 degrees
|
||||
* @param lon Longitude in 1E7 degrees
|
||||
* @param alt Altitude in 1E3 meters (millimeters)
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed (m/s)
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_int_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, float eph, float epv, float v, float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_int32_t(buf, 9, lat);
|
||||
_mav_put_int32_t(buf, 13, lon);
|
||||
_mav_put_int32_t(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_int_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 37);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 37);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_raw_int message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in 1E7 degrees
|
||||
* @param lon Longitude in 1E7 degrees
|
||||
* @param alt Altitude in 1E3 meters (millimeters)
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed (m/s)
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_int_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,uint8_t fix_type,int32_t lat,int32_t lon,int32_t alt,float eph,float epv,float v,float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_int32_t(buf, 9, lat);
|
||||
_mav_put_int32_t(buf, 13, lon);
|
||||
_mav_put_int32_t(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_int_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 37);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_RAW_INT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 37);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a gps_raw_int struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gps_raw_int C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_raw_int_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_raw_int_t* gps_raw_int)
|
||||
{
|
||||
return mavlink_msg_gps_raw_int_pack(system_id, component_id, msg, gps_raw_int->usec, gps_raw_int->fix_type, gps_raw_int->lat, gps_raw_int->lon, gps_raw_int->alt, gps_raw_int->eph, gps_raw_int->epv, gps_raw_int->v, gps_raw_int->hdg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a gps_raw_int message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param fix_type 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
* @param lat Latitude in 1E7 degrees
|
||||
* @param lon Longitude in 1E7 degrees
|
||||
* @param alt Altitude in 1E3 meters (millimeters)
|
||||
* @param eph GPS HDOP
|
||||
* @param epv GPS VDOP
|
||||
* @param v GPS ground speed (m/s)
|
||||
* @param hdg Compass heading in degrees, 0..360 degrees
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_gps_raw_int_send(mavlink_channel_t chan, uint64_t usec, uint8_t fix_type, int32_t lat, int32_t lon, int32_t alt, float eph, float epv, float v, float hdg)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[37];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_uint8_t(buf, 8, fix_type);
|
||||
_mav_put_int32_t(buf, 9, lat);
|
||||
_mav_put_int32_t(buf, 13, lon);
|
||||
_mav_put_int32_t(buf, 17, alt);
|
||||
_mav_put_float(buf, 21, eph);
|
||||
_mav_put_float(buf, 25, epv);
|
||||
_mav_put_float(buf, 29, v);
|
||||
_mav_put_float(buf, 33, hdg);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, buf, 37);
|
||||
#else
|
||||
mavlink_gps_raw_int_t packet;
|
||||
packet.usec = usec;
|
||||
packet.fix_type = fix_type;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.eph = eph;
|
||||
packet.epv = epv;
|
||||
packet.v = v;
|
||||
packet.hdg = hdg;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_RAW_INT, (const char *)&packet, 37);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GPS_RAW_INT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from gps_raw_int message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_gps_raw_int_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field fix_type from gps_raw_int message
|
||||
*
|
||||
* @return 0-1: no fix, 2: 2D fix, 3: 3D fix. Some applications will not use the value of this field unless it is at least two, so always correctly fill in the fix.
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_gps_raw_int_get_fix_type(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from gps_raw_int message
|
||||
*
|
||||
* @return Latitude in 1E7 degrees
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_raw_int_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 9);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lon from gps_raw_int message
|
||||
*
|
||||
* @return Longitude in 1E7 degrees
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_raw_int_get_lon(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alt from gps_raw_int message
|
||||
*
|
||||
* @return Altitude in 1E3 meters (millimeters)
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_raw_int_get_alt(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 17);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field eph from gps_raw_int message
|
||||
*
|
||||
* @return GPS HDOP
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_int_get_eph(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 21);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field epv from gps_raw_int message
|
||||
*
|
||||
* @return GPS VDOP
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_int_get_epv(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 25);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field v from gps_raw_int message
|
||||
*
|
||||
* @return GPS ground speed (m/s)
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_int_get_v(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 29);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field hdg from gps_raw_int message
|
||||
*
|
||||
* @return Compass heading in degrees, 0..360 degrees
|
||||
*/
|
||||
static inline float mavlink_msg_gps_raw_int_get_hdg(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 33);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a gps_raw_int message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param gps_raw_int C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_gps_raw_int_decode(const mavlink_message_t* msg, mavlink_gps_raw_int_t* gps_raw_int)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
gps_raw_int->usec = mavlink_msg_gps_raw_int_get_usec(msg);
|
||||
gps_raw_int->fix_type = mavlink_msg_gps_raw_int_get_fix_type(msg);
|
||||
gps_raw_int->lat = mavlink_msg_gps_raw_int_get_lat(msg);
|
||||
gps_raw_int->lon = mavlink_msg_gps_raw_int_get_lon(msg);
|
||||
gps_raw_int->alt = mavlink_msg_gps_raw_int_get_alt(msg);
|
||||
gps_raw_int->eph = mavlink_msg_gps_raw_int_get_eph(msg);
|
||||
gps_raw_int->epv = mavlink_msg_gps_raw_int_get_epv(msg);
|
||||
gps_raw_int->v = mavlink_msg_gps_raw_int_get_v(msg);
|
||||
gps_raw_int->hdg = mavlink_msg_gps_raw_int_get_hdg(msg);
|
||||
#else
|
||||
memcpy(gps_raw_int, _MAV_PAYLOAD(msg), 37);
|
||||
#endif
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
// MESSAGE GPS_SET_GLOBAL_ORIGIN PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN 48
|
||||
|
||||
typedef struct __mavlink_gps_set_global_origin_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
int32_t latitude; ///< global position * 1E7
|
||||
int32_t longitude; ///< global position * 1E7
|
||||
int32_t altitude; ///< global position * 1000
|
||||
} mavlink_gps_set_global_origin_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN_LEN 14
|
||||
#define MAVLINK_MSG_ID_48_LEN 14
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GPS_SET_GLOBAL_ORIGIN { \
|
||||
"GPS_SET_GLOBAL_ORIGIN", \
|
||||
5, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_set_global_origin_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_gps_set_global_origin_t, target_component) }, \
|
||||
{ "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 2, offsetof(mavlink_gps_set_global_origin_t, latitude) }, \
|
||||
{ "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 6, offsetof(mavlink_gps_set_global_origin_t, longitude) }, \
|
||||
{ "altitude", NULL, MAVLINK_TYPE_INT32_T, 0, 10, offsetof(mavlink_gps_set_global_origin_t, altitude) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_set_global_origin message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param latitude global position * 1E7
|
||||
* @param longitude global position * 1E7
|
||||
* @param altitude global position * 1000
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_set_global_origin_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, latitude);
|
||||
_mav_put_int32_t(buf, 6, longitude);
|
||||
_mav_put_int32_t(buf, 10, altitude);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 14);
|
||||
#else
|
||||
mavlink_gps_set_global_origin_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 14);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_set_global_origin message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param latitude global position * 1E7
|
||||
* @param longitude global position * 1E7
|
||||
* @param altitude global position * 1000
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_set_global_origin_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,int32_t latitude,int32_t longitude,int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, latitude);
|
||||
_mav_put_int32_t(buf, 6, longitude);
|
||||
_mav_put_int32_t(buf, 10, altitude);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 14);
|
||||
#else
|
||||
mavlink_gps_set_global_origin_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 14);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a gps_set_global_origin struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gps_set_global_origin C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_set_global_origin_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_set_global_origin_t* gps_set_global_origin)
|
||||
{
|
||||
return mavlink_msg_gps_set_global_origin_pack(system_id, component_id, msg, gps_set_global_origin->target_system, gps_set_global_origin->target_component, gps_set_global_origin->latitude, gps_set_global_origin->longitude, gps_set_global_origin->altitude);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a gps_set_global_origin message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param latitude global position * 1E7
|
||||
* @param longitude global position * 1E7
|
||||
* @param altitude global position * 1000
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_gps_set_global_origin_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, int32_t latitude, int32_t longitude, int32_t altitude)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[14];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_int32_t(buf, 2, latitude);
|
||||
_mav_put_int32_t(buf, 6, longitude);
|
||||
_mav_put_int32_t(buf, 10, altitude);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN, buf, 14);
|
||||
#else
|
||||
mavlink_gps_set_global_origin_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.latitude = latitude;
|
||||
packet.longitude = longitude;
|
||||
packet.altitude = altitude;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_SET_GLOBAL_ORIGIN, (const char *)&packet, 14);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GPS_SET_GLOBAL_ORIGIN UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from gps_set_global_origin message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from gps_set_global_origin message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_gps_set_global_origin_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field latitude from gps_set_global_origin message
|
||||
*
|
||||
* @return global position * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_set_global_origin_get_latitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field longitude from gps_set_global_origin message
|
||||
*
|
||||
* @return global position * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_set_global_origin_get_longitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field altitude from gps_set_global_origin message
|
||||
*
|
||||
* @return global position * 1000
|
||||
*/
|
||||
static inline int32_t mavlink_msg_gps_set_global_origin_get_altitude(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a gps_set_global_origin message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param gps_set_global_origin C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_gps_set_global_origin_decode(const mavlink_message_t* msg, mavlink_gps_set_global_origin_t* gps_set_global_origin)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
gps_set_global_origin->target_system = mavlink_msg_gps_set_global_origin_get_target_system(msg);
|
||||
gps_set_global_origin->target_component = mavlink_msg_gps_set_global_origin_get_target_component(msg);
|
||||
gps_set_global_origin->latitude = mavlink_msg_gps_set_global_origin_get_latitude(msg);
|
||||
gps_set_global_origin->longitude = mavlink_msg_gps_set_global_origin_get_longitude(msg);
|
||||
gps_set_global_origin->altitude = mavlink_msg_gps_set_global_origin_get_altitude(msg);
|
||||
#else
|
||||
memcpy(gps_set_global_origin, _MAV_PAYLOAD(msg), 14);
|
||||
#endif
|
||||
}
|
||||
@@ -1,252 +0,0 @@
|
||||
// MESSAGE GPS_STATUS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_STATUS 27
|
||||
|
||||
typedef struct __mavlink_gps_status_t
|
||||
{
|
||||
uint8_t satellites_visible; ///< Number of satellites visible
|
||||
int8_t satellite_prn[20]; ///< Global satellite ID
|
||||
int8_t satellite_used[20]; ///< 0: Satellite not used, 1: used for localization
|
||||
int8_t satellite_elevation[20]; ///< Elevation (0: right on top of receiver, 90: on the horizon) of satellite
|
||||
int8_t satellite_azimuth[20]; ///< Direction of satellite, 0: 0 deg, 255: 360 deg.
|
||||
int8_t satellite_snr[20]; ///< Signal to noise ratio of satellite
|
||||
} mavlink_gps_status_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_GPS_STATUS_LEN 101
|
||||
#define MAVLINK_MSG_ID_27_LEN 101
|
||||
|
||||
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_PRN_LEN 20
|
||||
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_USED_LEN 20
|
||||
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_ELEVATION_LEN 20
|
||||
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_AZIMUTH_LEN 20
|
||||
#define MAVLINK_MSG_GPS_STATUS_FIELD_SATELLITE_SNR_LEN 20
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_GPS_STATUS { \
|
||||
"GPS_STATUS", \
|
||||
6, \
|
||||
{ { "satellites_visible", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_gps_status_t, satellites_visible) }, \
|
||||
{ "satellite_prn", NULL, MAVLINK_TYPE_INT8_T, 20, 1, offsetof(mavlink_gps_status_t, satellite_prn) }, \
|
||||
{ "satellite_used", NULL, MAVLINK_TYPE_INT8_T, 20, 21, offsetof(mavlink_gps_status_t, satellite_used) }, \
|
||||
{ "satellite_elevation", NULL, MAVLINK_TYPE_INT8_T, 20, 41, offsetof(mavlink_gps_status_t, satellite_elevation) }, \
|
||||
{ "satellite_azimuth", NULL, MAVLINK_TYPE_INT8_T, 20, 61, offsetof(mavlink_gps_status_t, satellite_azimuth) }, \
|
||||
{ "satellite_snr", NULL, MAVLINK_TYPE_INT8_T, 20, 81, offsetof(mavlink_gps_status_t, satellite_snr) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_status message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param satellites_visible Number of satellites visible
|
||||
* @param satellite_prn Global satellite ID
|
||||
* @param satellite_used 0: Satellite not used, 1: used for localization
|
||||
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
|
||||
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
|
||||
* @param satellite_snr Signal to noise ratio of satellite
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t satellites_visible, const int8_t *satellite_prn, const int8_t *satellite_used, const int8_t *satellite_elevation, const int8_t *satellite_azimuth, const int8_t *satellite_snr)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[101];
|
||||
_mav_put_uint8_t(buf, 0, satellites_visible);
|
||||
_mav_put_int8_t_array(buf, 1, satellite_prn, 20);
|
||||
_mav_put_int8_t_array(buf, 21, satellite_used, 20);
|
||||
_mav_put_int8_t_array(buf, 41, satellite_elevation, 20);
|
||||
_mav_put_int8_t_array(buf, 61, satellite_azimuth, 20);
|
||||
_mav_put_int8_t_array(buf, 81, satellite_snr, 20);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 101);
|
||||
#else
|
||||
mavlink_gps_status_t packet;
|
||||
packet.satellites_visible = satellites_visible;
|
||||
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 101);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 101);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a gps_status message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param satellites_visible Number of satellites visible
|
||||
* @param satellite_prn Global satellite ID
|
||||
* @param satellite_used 0: Satellite not used, 1: used for localization
|
||||
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
|
||||
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
|
||||
* @param satellite_snr Signal to noise ratio of satellite
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t satellites_visible,const int8_t *satellite_prn,const int8_t *satellite_used,const int8_t *satellite_elevation,const int8_t *satellite_azimuth,const int8_t *satellite_snr)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[101];
|
||||
_mav_put_uint8_t(buf, 0, satellites_visible);
|
||||
_mav_put_int8_t_array(buf, 1, satellite_prn, 20);
|
||||
_mav_put_int8_t_array(buf, 21, satellite_used, 20);
|
||||
_mav_put_int8_t_array(buf, 41, satellite_elevation, 20);
|
||||
_mav_put_int8_t_array(buf, 61, satellite_azimuth, 20);
|
||||
_mav_put_int8_t_array(buf, 81, satellite_snr, 20);
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 101);
|
||||
#else
|
||||
mavlink_gps_status_t packet;
|
||||
packet.satellites_visible = satellites_visible;
|
||||
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20);
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 101);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_GPS_STATUS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 101);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a gps_status struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param gps_status C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_gps_status_t* gps_status)
|
||||
{
|
||||
return mavlink_msg_gps_status_pack(system_id, component_id, msg, gps_status->satellites_visible, gps_status->satellite_prn, gps_status->satellite_used, gps_status->satellite_elevation, gps_status->satellite_azimuth, gps_status->satellite_snr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a gps_status message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param satellites_visible Number of satellites visible
|
||||
* @param satellite_prn Global satellite ID
|
||||
* @param satellite_used 0: Satellite not used, 1: used for localization
|
||||
* @param satellite_elevation Elevation (0: right on top of receiver, 90: on the horizon) of satellite
|
||||
* @param satellite_azimuth Direction of satellite, 0: 0 deg, 255: 360 deg.
|
||||
* @param satellite_snr Signal to noise ratio of satellite
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_gps_status_send(mavlink_channel_t chan, uint8_t satellites_visible, const int8_t *satellite_prn, const int8_t *satellite_used, const int8_t *satellite_elevation, const int8_t *satellite_azimuth, const int8_t *satellite_snr)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[101];
|
||||
_mav_put_uint8_t(buf, 0, satellites_visible);
|
||||
_mav_put_int8_t_array(buf, 1, satellite_prn, 20);
|
||||
_mav_put_int8_t_array(buf, 21, satellite_used, 20);
|
||||
_mav_put_int8_t_array(buf, 41, satellite_elevation, 20);
|
||||
_mav_put_int8_t_array(buf, 61, satellite_azimuth, 20);
|
||||
_mav_put_int8_t_array(buf, 81, satellite_snr, 20);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, buf, 101);
|
||||
#else
|
||||
mavlink_gps_status_t packet;
|
||||
packet.satellites_visible = satellites_visible;
|
||||
mav_array_memcpy(packet.satellite_prn, satellite_prn, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_used, satellite_used, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_elevation, satellite_elevation, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_azimuth, satellite_azimuth, sizeof(int8_t)*20);
|
||||
mav_array_memcpy(packet.satellite_snr, satellite_snr, sizeof(int8_t)*20);
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GPS_STATUS, (const char *)&packet, 101);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE GPS_STATUS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field satellites_visible from gps_status message
|
||||
*
|
||||
* @return Number of satellites visible
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_gps_status_get_satellites_visible(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field satellite_prn from gps_status message
|
||||
*
|
||||
* @return Global satellite ID
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_get_satellite_prn(const mavlink_message_t* msg, int8_t *satellite_prn)
|
||||
{
|
||||
return _MAV_RETURN_int8_t_array(msg, satellite_prn, 20, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field satellite_used from gps_status message
|
||||
*
|
||||
* @return 0: Satellite not used, 1: used for localization
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_get_satellite_used(const mavlink_message_t* msg, int8_t *satellite_used)
|
||||
{
|
||||
return _MAV_RETURN_int8_t_array(msg, satellite_used, 20, 21);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field satellite_elevation from gps_status message
|
||||
*
|
||||
* @return Elevation (0: right on top of receiver, 90: on the horizon) of satellite
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_get_satellite_elevation(const mavlink_message_t* msg, int8_t *satellite_elevation)
|
||||
{
|
||||
return _MAV_RETURN_int8_t_array(msg, satellite_elevation, 20, 41);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field satellite_azimuth from gps_status message
|
||||
*
|
||||
* @return Direction of satellite, 0: 0 deg, 255: 360 deg.
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_get_satellite_azimuth(const mavlink_message_t* msg, int8_t *satellite_azimuth)
|
||||
{
|
||||
return _MAV_RETURN_int8_t_array(msg, satellite_azimuth, 20, 61);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field satellite_snr from gps_status message
|
||||
*
|
||||
* @return Signal to noise ratio of satellite
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_gps_status_get_satellite_snr(const mavlink_message_t* msg, int8_t *satellite_snr)
|
||||
{
|
||||
return _MAV_RETURN_int8_t_array(msg, satellite_snr, 20, 81);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a gps_status message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param gps_status C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_gps_status_decode(const mavlink_message_t* msg, mavlink_gps_status_t* gps_status)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
gps_status->satellites_visible = mavlink_msg_gps_status_get_satellites_visible(msg);
|
||||
mavlink_msg_gps_status_get_satellite_prn(msg, gps_status->satellite_prn);
|
||||
mavlink_msg_gps_status_get_satellite_used(msg, gps_status->satellite_used);
|
||||
mavlink_msg_gps_status_get_satellite_elevation(msg, gps_status->satellite_elevation);
|
||||
mavlink_msg_gps_status_get_satellite_azimuth(msg, gps_status->satellite_azimuth);
|
||||
mavlink_msg_gps_status_get_satellite_snr(msg, gps_status->satellite_snr);
|
||||
#else
|
||||
memcpy(gps_status, _MAV_PAYLOAD(msg), 101);
|
||||
#endif
|
||||
}
|
||||
@@ -1,185 +0,0 @@
|
||||
// MESSAGE HEARTBEAT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_HEARTBEAT 0
|
||||
|
||||
typedef struct __mavlink_heartbeat_t
|
||||
{
|
||||
uint8_t type; ///< Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
|
||||
uint8_t autopilot; ///< Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
|
||||
uint8_t mavlink_version; ///< MAVLink version
|
||||
} mavlink_heartbeat_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_HEARTBEAT_LEN 3
|
||||
#define MAVLINK_MSG_ID_0_LEN 3
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_HEARTBEAT { \
|
||||
"HEARTBEAT", \
|
||||
3, \
|
||||
{ { "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_heartbeat_t, type) }, \
|
||||
{ "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_heartbeat_t, autopilot) }, \
|
||||
{ "mavlink_version", NULL, MAVLINK_TYPE_UINT8_T, 0, 2, offsetof(mavlink_heartbeat_t, mavlink_version) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a heartbeat message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
|
||||
* @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_heartbeat_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t type, uint8_t autopilot)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, type);
|
||||
_mav_put_uint8_t(buf, 1, autopilot);
|
||||
_mav_put_uint8_t(buf, 2, 2);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_heartbeat_t packet;
|
||||
packet.type = type;
|
||||
packet.autopilot = autopilot;
|
||||
packet.mavlink_version = 2;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a heartbeat message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
|
||||
* @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_heartbeat_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t type,uint8_t autopilot)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, type);
|
||||
_mav_put_uint8_t(buf, 1, autopilot);
|
||||
_mav_put_uint8_t(buf, 2, 2);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 3);
|
||||
#else
|
||||
mavlink_heartbeat_t packet;
|
||||
packet.type = type;
|
||||
packet.autopilot = autopilot;
|
||||
packet.mavlink_version = 2;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 3);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HEARTBEAT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a heartbeat struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param heartbeat C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_heartbeat_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_heartbeat_t* heartbeat)
|
||||
{
|
||||
return mavlink_msg_heartbeat_pack(system_id, component_id, msg, heartbeat->type, heartbeat->autopilot);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a heartbeat message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param type Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
|
||||
* @param autopilot Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_heartbeat_send(mavlink_channel_t chan, uint8_t type, uint8_t autopilot)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[3];
|
||||
_mav_put_uint8_t(buf, 0, type);
|
||||
_mav_put_uint8_t(buf, 1, autopilot);
|
||||
_mav_put_uint8_t(buf, 2, 2);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, buf, 3);
|
||||
#else
|
||||
mavlink_heartbeat_t packet;
|
||||
packet.type = type;
|
||||
packet.autopilot = autopilot;
|
||||
packet.mavlink_version = 2;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HEARTBEAT, (const char *)&packet, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE HEARTBEAT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field type from heartbeat message
|
||||
*
|
||||
* @return Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_heartbeat_get_type(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field autopilot from heartbeat message
|
||||
*
|
||||
* @return Type of the Autopilot: 0: Generic, 1: PIXHAWK, 2: SLUGS, 3: Ardupilot (up to 15 types), defined in MAV_AUTOPILOT_TYPE ENUM
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_heartbeat_get_autopilot(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mavlink_version from heartbeat message
|
||||
*
|
||||
* @return MAVLink version
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_heartbeat_get_mavlink_version(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a heartbeat message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param heartbeat C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_heartbeat_decode(const mavlink_message_t* msg, mavlink_heartbeat_t* heartbeat)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
heartbeat->type = mavlink_msg_heartbeat_get_type(msg);
|
||||
heartbeat->autopilot = mavlink_msg_heartbeat_get_autopilot(msg);
|
||||
heartbeat->mavlink_version = mavlink_msg_heartbeat_get_mavlink_version(msg);
|
||||
#else
|
||||
memcpy(heartbeat, _MAV_PAYLOAD(msg), 3);
|
||||
#endif
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
// MESSAGE HIL_CONTROLS PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_HIL_CONTROLS 68
|
||||
|
||||
typedef struct __mavlink_hil_controls_t
|
||||
{
|
||||
uint64_t time_us; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
float roll_ailerons; ///< Control output -3 .. 1
|
||||
float pitch_elevator; ///< Control output -1 .. 1
|
||||
float yaw_rudder; ///< Control output -1 .. 1
|
||||
float throttle; ///< Throttle 0 .. 1
|
||||
uint8_t mode; ///< System mode (MAV_MODE)
|
||||
uint8_t nav_mode; ///< Navigation mode (MAV_NAV_MODE)
|
||||
} mavlink_hil_controls_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_HIL_CONTROLS_LEN 26
|
||||
#define MAVLINK_MSG_ID_68_LEN 26
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_HIL_CONTROLS { \
|
||||
"HIL_CONTROLS", \
|
||||
7, \
|
||||
{ { "time_us", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_controls_t, time_us) }, \
|
||||
{ "roll_ailerons", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_controls_t, roll_ailerons) }, \
|
||||
{ "pitch_elevator", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_controls_t, pitch_elevator) }, \
|
||||
{ "yaw_rudder", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_controls_t, yaw_rudder) }, \
|
||||
{ "throttle", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_controls_t, throttle) }, \
|
||||
{ "mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_hil_controls_t, mode) }, \
|
||||
{ "nav_mode", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_hil_controls_t, nav_mode) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a hil_controls message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll_ailerons Control output -3 .. 1
|
||||
* @param pitch_elevator Control output -1 .. 1
|
||||
* @param yaw_rudder Control output -1 .. 1
|
||||
* @param throttle Throttle 0 .. 1
|
||||
* @param mode System mode (MAV_MODE)
|
||||
* @param nav_mode Navigation mode (MAV_NAV_MODE)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_controls_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t time_us, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, uint8_t mode, uint8_t nav_mode)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[26];
|
||||
_mav_put_uint64_t(buf, 0, time_us);
|
||||
_mav_put_float(buf, 8, roll_ailerons);
|
||||
_mav_put_float(buf, 12, pitch_elevator);
|
||||
_mav_put_float(buf, 16, yaw_rudder);
|
||||
_mav_put_float(buf, 20, throttle);
|
||||
_mav_put_uint8_t(buf, 24, mode);
|
||||
_mav_put_uint8_t(buf, 25, nav_mode);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 26);
|
||||
#else
|
||||
mavlink_hil_controls_t packet;
|
||||
packet.time_us = time_us;
|
||||
packet.roll_ailerons = roll_ailerons;
|
||||
packet.pitch_elevator = pitch_elevator;
|
||||
packet.yaw_rudder = yaw_rudder;
|
||||
packet.throttle = throttle;
|
||||
packet.mode = mode;
|
||||
packet.nav_mode = nav_mode;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 26);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 26);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a hil_controls message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll_ailerons Control output -3 .. 1
|
||||
* @param pitch_elevator Control output -1 .. 1
|
||||
* @param yaw_rudder Control output -1 .. 1
|
||||
* @param throttle Throttle 0 .. 1
|
||||
* @param mode System mode (MAV_MODE)
|
||||
* @param nav_mode Navigation mode (MAV_NAV_MODE)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_controls_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t time_us,float roll_ailerons,float pitch_elevator,float yaw_rudder,float throttle,uint8_t mode,uint8_t nav_mode)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[26];
|
||||
_mav_put_uint64_t(buf, 0, time_us);
|
||||
_mav_put_float(buf, 8, roll_ailerons);
|
||||
_mav_put_float(buf, 12, pitch_elevator);
|
||||
_mav_put_float(buf, 16, yaw_rudder);
|
||||
_mav_put_float(buf, 20, throttle);
|
||||
_mav_put_uint8_t(buf, 24, mode);
|
||||
_mav_put_uint8_t(buf, 25, nav_mode);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 26);
|
||||
#else
|
||||
mavlink_hil_controls_t packet;
|
||||
packet.time_us = time_us;
|
||||
packet.roll_ailerons = roll_ailerons;
|
||||
packet.pitch_elevator = pitch_elevator;
|
||||
packet.yaw_rudder = yaw_rudder;
|
||||
packet.throttle = throttle;
|
||||
packet.mode = mode;
|
||||
packet.nav_mode = nav_mode;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 26);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HIL_CONTROLS;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 26);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a hil_controls struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param hil_controls C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_controls_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_controls_t* hil_controls)
|
||||
{
|
||||
return mavlink_msg_hil_controls_pack(system_id, component_id, msg, hil_controls->time_us, hil_controls->roll_ailerons, hil_controls->pitch_elevator, hil_controls->yaw_rudder, hil_controls->throttle, hil_controls->mode, hil_controls->nav_mode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a hil_controls message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll_ailerons Control output -3 .. 1
|
||||
* @param pitch_elevator Control output -1 .. 1
|
||||
* @param yaw_rudder Control output -1 .. 1
|
||||
* @param throttle Throttle 0 .. 1
|
||||
* @param mode System mode (MAV_MODE)
|
||||
* @param nav_mode Navigation mode (MAV_NAV_MODE)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_hil_controls_send(mavlink_channel_t chan, uint64_t time_us, float roll_ailerons, float pitch_elevator, float yaw_rudder, float throttle, uint8_t mode, uint8_t nav_mode)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[26];
|
||||
_mav_put_uint64_t(buf, 0, time_us);
|
||||
_mav_put_float(buf, 8, roll_ailerons);
|
||||
_mav_put_float(buf, 12, pitch_elevator);
|
||||
_mav_put_float(buf, 16, yaw_rudder);
|
||||
_mav_put_float(buf, 20, throttle);
|
||||
_mav_put_uint8_t(buf, 24, mode);
|
||||
_mav_put_uint8_t(buf, 25, nav_mode);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, buf, 26);
|
||||
#else
|
||||
mavlink_hil_controls_t packet;
|
||||
packet.time_us = time_us;
|
||||
packet.roll_ailerons = roll_ailerons;
|
||||
packet.pitch_elevator = pitch_elevator;
|
||||
packet.yaw_rudder = yaw_rudder;
|
||||
packet.throttle = throttle;
|
||||
packet.mode = mode;
|
||||
packet.nav_mode = nav_mode;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_CONTROLS, (const char *)&packet, 26);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE HIL_CONTROLS UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field time_us from hil_controls message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_hil_controls_get_time_us(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field roll_ailerons from hil_controls message
|
||||
*
|
||||
* @return Control output -3 .. 1
|
||||
*/
|
||||
static inline float mavlink_msg_hil_controls_get_roll_ailerons(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pitch_elevator from hil_controls message
|
||||
*
|
||||
* @return Control output -1 .. 1
|
||||
*/
|
||||
static inline float mavlink_msg_hil_controls_get_pitch_elevator(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yaw_rudder from hil_controls message
|
||||
*
|
||||
* @return Control output -1 .. 1
|
||||
*/
|
||||
static inline float mavlink_msg_hil_controls_get_yaw_rudder(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field throttle from hil_controls message
|
||||
*
|
||||
* @return Throttle 0 .. 1
|
||||
*/
|
||||
static inline float mavlink_msg_hil_controls_get_throttle(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field mode from hil_controls message
|
||||
*
|
||||
* @return System mode (MAV_MODE)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_hil_controls_get_mode(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field nav_mode from hil_controls message
|
||||
*
|
||||
* @return Navigation mode (MAV_NAV_MODE)
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_hil_controls_get_nav_mode(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 25);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a hil_controls message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param hil_controls C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_hil_controls_decode(const mavlink_message_t* msg, mavlink_hil_controls_t* hil_controls)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
hil_controls->time_us = mavlink_msg_hil_controls_get_time_us(msg);
|
||||
hil_controls->roll_ailerons = mavlink_msg_hil_controls_get_roll_ailerons(msg);
|
||||
hil_controls->pitch_elevator = mavlink_msg_hil_controls_get_pitch_elevator(msg);
|
||||
hil_controls->yaw_rudder = mavlink_msg_hil_controls_get_yaw_rudder(msg);
|
||||
hil_controls->throttle = mavlink_msg_hil_controls_get_throttle(msg);
|
||||
hil_controls->mode = mavlink_msg_hil_controls_get_mode(msg);
|
||||
hil_controls->nav_mode = mavlink_msg_hil_controls_get_nav_mode(msg);
|
||||
#else
|
||||
memcpy(hil_controls, _MAV_PAYLOAD(msg), 26);
|
||||
#endif
|
||||
}
|
||||
@@ -1,474 +0,0 @@
|
||||
// MESSAGE HIL_STATE PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_HIL_STATE 67
|
||||
|
||||
typedef struct __mavlink_hil_state_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
float roll; ///< Roll angle (rad)
|
||||
float pitch; ///< Pitch angle (rad)
|
||||
float yaw; ///< Yaw angle (rad)
|
||||
float rollspeed; ///< Roll angular speed (rad/s)
|
||||
float pitchspeed; ///< Pitch angular speed (rad/s)
|
||||
float yawspeed; ///< Yaw angular speed (rad/s)
|
||||
int32_t lat; ///< Latitude, expressed as * 1E7
|
||||
int32_t lon; ///< Longitude, expressed as * 1E7
|
||||
int32_t alt; ///< Altitude in meters, expressed as * 1000 (millimeters)
|
||||
int16_t vx; ///< Ground X Speed (Latitude), expressed as m/s * 100
|
||||
int16_t vy; ///< Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
int16_t vz; ///< Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
int16_t xacc; ///< X acceleration (mg)
|
||||
int16_t yacc; ///< Y acceleration (mg)
|
||||
int16_t zacc; ///< Z acceleration (mg)
|
||||
} mavlink_hil_state_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_HIL_STATE_LEN 56
|
||||
#define MAVLINK_MSG_ID_67_LEN 56
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_HIL_STATE { \
|
||||
"HIL_STATE", \
|
||||
16, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_hil_state_t, usec) }, \
|
||||
{ "roll", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_hil_state_t, roll) }, \
|
||||
{ "pitch", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_hil_state_t, pitch) }, \
|
||||
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_hil_state_t, yaw) }, \
|
||||
{ "rollspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_hil_state_t, rollspeed) }, \
|
||||
{ "pitchspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_hil_state_t, pitchspeed) }, \
|
||||
{ "yawspeed", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_hil_state_t, yawspeed) }, \
|
||||
{ "lat", NULL, MAVLINK_TYPE_INT32_T, 0, 32, offsetof(mavlink_hil_state_t, lat) }, \
|
||||
{ "lon", NULL, MAVLINK_TYPE_INT32_T, 0, 36, offsetof(mavlink_hil_state_t, lon) }, \
|
||||
{ "alt", NULL, MAVLINK_TYPE_INT32_T, 0, 40, offsetof(mavlink_hil_state_t, alt) }, \
|
||||
{ "vx", NULL, MAVLINK_TYPE_INT16_T, 0, 44, offsetof(mavlink_hil_state_t, vx) }, \
|
||||
{ "vy", NULL, MAVLINK_TYPE_INT16_T, 0, 46, offsetof(mavlink_hil_state_t, vy) }, \
|
||||
{ "vz", NULL, MAVLINK_TYPE_INT16_T, 0, 48, offsetof(mavlink_hil_state_t, vz) }, \
|
||||
{ "xacc", NULL, MAVLINK_TYPE_INT16_T, 0, 50, offsetof(mavlink_hil_state_t, xacc) }, \
|
||||
{ "yacc", NULL, MAVLINK_TYPE_INT16_T, 0, 52, offsetof(mavlink_hil_state_t, yacc) }, \
|
||||
{ "zacc", NULL, MAVLINK_TYPE_INT16_T, 0, 54, offsetof(mavlink_hil_state_t, zacc) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a hil_state message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
* @param xacc X acceleration (mg)
|
||||
* @param yacc Y acceleration (mg)
|
||||
* @param zacc Z acceleration (mg)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_state_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[56];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
_mav_put_int32_t(buf, 32, lat);
|
||||
_mav_put_int32_t(buf, 36, lon);
|
||||
_mav_put_int32_t(buf, 40, alt);
|
||||
_mav_put_int16_t(buf, 44, vx);
|
||||
_mav_put_int16_t(buf, 46, vy);
|
||||
_mav_put_int16_t(buf, 48, vz);
|
||||
_mav_put_int16_t(buf, 50, xacc);
|
||||
_mav_put_int16_t(buf, 52, yacc);
|
||||
_mav_put_int16_t(buf, 54, zacc);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 56);
|
||||
#else
|
||||
mavlink_hil_state_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
packet.xacc = xacc;
|
||||
packet.yacc = yacc;
|
||||
packet.zacc = zacc;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 56);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HIL_STATE;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 56);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a hil_state message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
* @param xacc X acceleration (mg)
|
||||
* @param yacc Y acceleration (mg)
|
||||
* @param zacc Z acceleration (mg)
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_state_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,float roll,float pitch,float yaw,float rollspeed,float pitchspeed,float yawspeed,int32_t lat,int32_t lon,int32_t alt,int16_t vx,int16_t vy,int16_t vz,int16_t xacc,int16_t yacc,int16_t zacc)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[56];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
_mav_put_int32_t(buf, 32, lat);
|
||||
_mav_put_int32_t(buf, 36, lon);
|
||||
_mav_put_int32_t(buf, 40, alt);
|
||||
_mav_put_int16_t(buf, 44, vx);
|
||||
_mav_put_int16_t(buf, 46, vy);
|
||||
_mav_put_int16_t(buf, 48, vz);
|
||||
_mav_put_int16_t(buf, 50, xacc);
|
||||
_mav_put_int16_t(buf, 52, yacc);
|
||||
_mav_put_int16_t(buf, 54, zacc);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 56);
|
||||
#else
|
||||
mavlink_hil_state_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
packet.xacc = xacc;
|
||||
packet.yacc = yacc;
|
||||
packet.zacc = zacc;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 56);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_HIL_STATE;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 56);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a hil_state struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param hil_state C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_hil_state_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_hil_state_t* hil_state)
|
||||
{
|
||||
return mavlink_msg_hil_state_pack(system_id, component_id, msg, hil_state->usec, hil_state->roll, hil_state->pitch, hil_state->yaw, hil_state->rollspeed, hil_state->pitchspeed, hil_state->yawspeed, hil_state->lat, hil_state->lon, hil_state->alt, hil_state->vx, hil_state->vy, hil_state->vz, hil_state->xacc, hil_state->yacc, hil_state->zacc);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a hil_state message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param roll Roll angle (rad)
|
||||
* @param pitch Pitch angle (rad)
|
||||
* @param yaw Yaw angle (rad)
|
||||
* @param rollspeed Roll angular speed (rad/s)
|
||||
* @param pitchspeed Pitch angular speed (rad/s)
|
||||
* @param yawspeed Yaw angular speed (rad/s)
|
||||
* @param lat Latitude, expressed as * 1E7
|
||||
* @param lon Longitude, expressed as * 1E7
|
||||
* @param alt Altitude in meters, expressed as * 1000 (millimeters)
|
||||
* @param vx Ground X Speed (Latitude), expressed as m/s * 100
|
||||
* @param vy Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
* @param vz Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
* @param xacc X acceleration (mg)
|
||||
* @param yacc Y acceleration (mg)
|
||||
* @param zacc Z acceleration (mg)
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_hil_state_send(mavlink_channel_t chan, uint64_t usec, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, int32_t lat, int32_t lon, int32_t alt, int16_t vx, int16_t vy, int16_t vz, int16_t xacc, int16_t yacc, int16_t zacc)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[56];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, roll);
|
||||
_mav_put_float(buf, 12, pitch);
|
||||
_mav_put_float(buf, 16, yaw);
|
||||
_mav_put_float(buf, 20, rollspeed);
|
||||
_mav_put_float(buf, 24, pitchspeed);
|
||||
_mav_put_float(buf, 28, yawspeed);
|
||||
_mav_put_int32_t(buf, 32, lat);
|
||||
_mav_put_int32_t(buf, 36, lon);
|
||||
_mav_put_int32_t(buf, 40, alt);
|
||||
_mav_put_int16_t(buf, 44, vx);
|
||||
_mav_put_int16_t(buf, 46, vy);
|
||||
_mav_put_int16_t(buf, 48, vz);
|
||||
_mav_put_int16_t(buf, 50, xacc);
|
||||
_mav_put_int16_t(buf, 52, yacc);
|
||||
_mav_put_int16_t(buf, 54, zacc);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, buf, 56);
|
||||
#else
|
||||
mavlink_hil_state_t packet;
|
||||
packet.usec = usec;
|
||||
packet.roll = roll;
|
||||
packet.pitch = pitch;
|
||||
packet.yaw = yaw;
|
||||
packet.rollspeed = rollspeed;
|
||||
packet.pitchspeed = pitchspeed;
|
||||
packet.yawspeed = yawspeed;
|
||||
packet.lat = lat;
|
||||
packet.lon = lon;
|
||||
packet.alt = alt;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
packet.xacc = xacc;
|
||||
packet.yacc = yacc;
|
||||
packet.zacc = zacc;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIL_STATE, (const char *)&packet, 56);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE HIL_STATE UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from hil_state message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_hil_state_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field roll from hil_state message
|
||||
*
|
||||
* @return Roll angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_roll(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pitch from hil_state message
|
||||
*
|
||||
* @return Pitch angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_pitch(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yaw from hil_state message
|
||||
*
|
||||
* @return Yaw angle (rad)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field rollspeed from hil_state message
|
||||
*
|
||||
* @return Roll angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_rollspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field pitchspeed from hil_state message
|
||||
*
|
||||
* @return Pitch angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_pitchspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yawspeed from hil_state message
|
||||
*
|
||||
* @return Yaw angular speed (rad/s)
|
||||
*/
|
||||
static inline float mavlink_msg_hil_state_get_yawspeed(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lat from hil_state message
|
||||
*
|
||||
* @return Latitude, expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_hil_state_get_lat(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field lon from hil_state message
|
||||
*
|
||||
* @return Longitude, expressed as * 1E7
|
||||
*/
|
||||
static inline int32_t mavlink_msg_hil_state_get_lon(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 36);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field alt from hil_state message
|
||||
*
|
||||
* @return Altitude in meters, expressed as * 1000 (millimeters)
|
||||
*/
|
||||
static inline int32_t mavlink_msg_hil_state_get_alt(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int32_t(msg, 40);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vx from hil_state message
|
||||
*
|
||||
* @return Ground X Speed (Latitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_vx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 44);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vy from hil_state message
|
||||
*
|
||||
* @return Ground Y Speed (Longitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_vy(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 46);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vz from hil_state message
|
||||
*
|
||||
* @return Ground Z Speed (Altitude), expressed as m/s * 100
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_vz(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 48);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field xacc from hil_state message
|
||||
*
|
||||
* @return X acceleration (mg)
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_xacc(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yacc from hil_state message
|
||||
*
|
||||
* @return Y acceleration (mg)
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_yacc(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 52);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field zacc from hil_state message
|
||||
*
|
||||
* @return Z acceleration (mg)
|
||||
*/
|
||||
static inline int16_t mavlink_msg_hil_state_get_zacc(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_int16_t(msg, 54);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a hil_state message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param hil_state C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_hil_state_decode(const mavlink_message_t* msg, mavlink_hil_state_t* hil_state)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
hil_state->usec = mavlink_msg_hil_state_get_usec(msg);
|
||||
hil_state->roll = mavlink_msg_hil_state_get_roll(msg);
|
||||
hil_state->pitch = mavlink_msg_hil_state_get_pitch(msg);
|
||||
hil_state->yaw = mavlink_msg_hil_state_get_yaw(msg);
|
||||
hil_state->rollspeed = mavlink_msg_hil_state_get_rollspeed(msg);
|
||||
hil_state->pitchspeed = mavlink_msg_hil_state_get_pitchspeed(msg);
|
||||
hil_state->yawspeed = mavlink_msg_hil_state_get_yawspeed(msg);
|
||||
hil_state->lat = mavlink_msg_hil_state_get_lat(msg);
|
||||
hil_state->lon = mavlink_msg_hil_state_get_lon(msg);
|
||||
hil_state->alt = mavlink_msg_hil_state_get_alt(msg);
|
||||
hil_state->vx = mavlink_msg_hil_state_get_vx(msg);
|
||||
hil_state->vy = mavlink_msg_hil_state_get_vy(msg);
|
||||
hil_state->vz = mavlink_msg_hil_state_get_vz(msg);
|
||||
hil_state->xacc = mavlink_msg_hil_state_get_xacc(msg);
|
||||
hil_state->yacc = mavlink_msg_hil_state_get_yacc(msg);
|
||||
hil_state->zacc = mavlink_msg_hil_state_get_zacc(msg);
|
||||
#else
|
||||
memcpy(hil_state, _MAV_PAYLOAD(msg), 56);
|
||||
#endif
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
// MESSAGE LOCAL_POSITION PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION 31
|
||||
|
||||
typedef struct __mavlink_local_position_t
|
||||
{
|
||||
uint64_t usec; ///< Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
float x; ///< X Position
|
||||
float y; ///< Y Position
|
||||
float z; ///< Z Position
|
||||
float vx; ///< X Speed
|
||||
float vy; ///< Y Speed
|
||||
float vz; ///< Z Speed
|
||||
} mavlink_local_position_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION_LEN 32
|
||||
#define MAVLINK_MSG_ID_31_LEN 32
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_LOCAL_POSITION { \
|
||||
"LOCAL_POSITION", \
|
||||
7, \
|
||||
{ { "usec", NULL, MAVLINK_TYPE_UINT64_T, 0, 0, offsetof(mavlink_local_position_t, usec) }, \
|
||||
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_local_position_t, x) }, \
|
||||
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_local_position_t, y) }, \
|
||||
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_local_position_t, z) }, \
|
||||
{ "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_local_position_t, vx) }, \
|
||||
{ "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_local_position_t, vy) }, \
|
||||
{ "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 28, offsetof(mavlink_local_position_t, vz) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param x X Position
|
||||
* @param y Y Position
|
||||
* @param z Z Position
|
||||
* @param vx X Speed
|
||||
* @param vy Y Speed
|
||||
* @param vz Z Speed
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint64_t usec, float x, float y, float z, float vx, float vy, float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, x);
|
||||
_mav_put_float(buf, 12, y);
|
||||
_mav_put_float(buf, 16, z);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_local_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param x X Position
|
||||
* @param y Y Position
|
||||
* @param z Z Position
|
||||
* @param vx X Speed
|
||||
* @param vy Y Speed
|
||||
* @param vz Z Speed
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint64_t usec,float x,float y,float z,float vx,float vy,float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, x);
|
||||
_mav_put_float(buf, 12, y);
|
||||
_mav_put_float(buf, 16, z);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 32);
|
||||
#else
|
||||
mavlink_local_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 32);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 32);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a local_position struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param local_position C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_t* local_position)
|
||||
{
|
||||
return mavlink_msg_local_position_pack(system_id, component_id, msg, local_position->usec, local_position->x, local_position->y, local_position->z, local_position->vx, local_position->vy, local_position->vz);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a local_position message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param usec Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
* @param x X Position
|
||||
* @param y Y Position
|
||||
* @param z Z Position
|
||||
* @param vx X Speed
|
||||
* @param vy Y Speed
|
||||
* @param vz Z Speed
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_local_position_send(mavlink_channel_t chan, uint64_t usec, float x, float y, float z, float vx, float vy, float vz)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[32];
|
||||
_mav_put_uint64_t(buf, 0, usec);
|
||||
_mav_put_float(buf, 8, x);
|
||||
_mav_put_float(buf, 12, y);
|
||||
_mav_put_float(buf, 16, z);
|
||||
_mav_put_float(buf, 20, vx);
|
||||
_mav_put_float(buf, 24, vy);
|
||||
_mav_put_float(buf, 28, vz);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION, buf, 32);
|
||||
#else
|
||||
mavlink_local_position_t packet;
|
||||
packet.usec = usec;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.vx = vx;
|
||||
packet.vy = vy;
|
||||
packet.vz = vz;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION, (const char *)&packet, 32);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE LOCAL_POSITION UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field usec from local_position message
|
||||
*
|
||||
* @return Timestamp (microseconds since UNIX epoch or microseconds since system boot)
|
||||
*/
|
||||
static inline uint64_t mavlink_msg_local_position_get_usec(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint64_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field x from local_position message
|
||||
*
|
||||
* @return X Position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field y from local_position message
|
||||
*
|
||||
* @return Y Position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field z from local_position message
|
||||
*
|
||||
* @return Z Position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vx from local_position message
|
||||
*
|
||||
* @return X Speed
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_vx(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vy from local_position message
|
||||
*
|
||||
* @return Y Speed
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_vy(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 24);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field vz from local_position message
|
||||
*
|
||||
* @return Z Speed
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_get_vz(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 28);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a local_position message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param local_position C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_local_position_decode(const mavlink_message_t* msg, mavlink_local_position_t* local_position)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
local_position->usec = mavlink_msg_local_position_get_usec(msg);
|
||||
local_position->x = mavlink_msg_local_position_get_x(msg);
|
||||
local_position->y = mavlink_msg_local_position_get_y(msg);
|
||||
local_position->z = mavlink_msg_local_position_get_z(msg);
|
||||
local_position->vx = mavlink_msg_local_position_get_vx(msg);
|
||||
local_position->vy = mavlink_msg_local_position_get_vy(msg);
|
||||
local_position->vz = mavlink_msg_local_position_get_vz(msg);
|
||||
#else
|
||||
memcpy(local_position, _MAV_PAYLOAD(msg), 32);
|
||||
#endif
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
// MESSAGE LOCAL_POSITION_SETPOINT PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT 51
|
||||
|
||||
typedef struct __mavlink_local_position_setpoint_t
|
||||
{
|
||||
float x; ///< x position
|
||||
float y; ///< y position
|
||||
float z; ///< z position
|
||||
float yaw; ///< Desired yaw angle
|
||||
} mavlink_local_position_setpoint_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_LEN 16
|
||||
#define MAVLINK_MSG_ID_51_LEN 16
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT { \
|
||||
"LOCAL_POSITION_SETPOINT", \
|
||||
4, \
|
||||
{ { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 0, offsetof(mavlink_local_position_setpoint_t, x) }, \
|
||||
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_local_position_setpoint_t, y) }, \
|
||||
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_local_position_setpoint_t, z) }, \
|
||||
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_local_position_setpoint_t, yaw) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position_setpoint message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
float x, float y, float z, float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[16];
|
||||
_mav_put_float(buf, 0, x);
|
||||
_mav_put_float(buf, 4, y);
|
||||
_mav_put_float(buf, 8, z);
|
||||
_mav_put_float(buf, 12, yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 16);
|
||||
#else
|
||||
mavlink_local_position_setpoint_t packet;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 16);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position_setpoint message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
float x,float y,float z,float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[16];
|
||||
_mav_put_float(buf, 0, x);
|
||||
_mav_put_float(buf, 4, y);
|
||||
_mav_put_float(buf, 8, z);
|
||||
_mav_put_float(buf, 12, yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 16);
|
||||
#else
|
||||
mavlink_local_position_setpoint_t packet;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 16);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 16);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a local_position_setpoint struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param local_position_setpoint C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_setpoint_t* local_position_setpoint)
|
||||
{
|
||||
return mavlink_msg_local_position_setpoint_pack(system_id, component_id, msg, local_position_setpoint->x, local_position_setpoint->y, local_position_setpoint->z, local_position_setpoint->yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a local_position_setpoint message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_local_position_setpoint_send(mavlink_channel_t chan, float x, float y, float z, float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[16];
|
||||
_mav_put_float(buf, 0, x);
|
||||
_mav_put_float(buf, 4, y);
|
||||
_mav_put_float(buf, 8, z);
|
||||
_mav_put_float(buf, 12, yaw);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT, buf, 16);
|
||||
#else
|
||||
mavlink_local_position_setpoint_t packet;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT, (const char *)&packet, 16);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE LOCAL_POSITION_SETPOINT UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field x from local_position_setpoint message
|
||||
*
|
||||
* @return x position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_get_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field y from local_position_setpoint message
|
||||
*
|
||||
* @return y position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_get_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field z from local_position_setpoint message
|
||||
*
|
||||
* @return z position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_get_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yaw from local_position_setpoint message
|
||||
*
|
||||
* @return Desired yaw angle
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_get_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 12);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a local_position_setpoint message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param local_position_setpoint C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_local_position_setpoint_decode(const mavlink_message_t* msg, mavlink_local_position_setpoint_t* local_position_setpoint)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
local_position_setpoint->x = mavlink_msg_local_position_setpoint_get_x(msg);
|
||||
local_position_setpoint->y = mavlink_msg_local_position_setpoint_get_y(msg);
|
||||
local_position_setpoint->z = mavlink_msg_local_position_setpoint_get_z(msg);
|
||||
local_position_setpoint->yaw = mavlink_msg_local_position_setpoint_get_yaw(msg);
|
||||
#else
|
||||
memcpy(local_position_setpoint, _MAV_PAYLOAD(msg), 16);
|
||||
#endif
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
// MESSAGE LOCAL_POSITION_SETPOINT_SET PACKING
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET 50
|
||||
|
||||
typedef struct __mavlink_local_position_setpoint_set_t
|
||||
{
|
||||
uint8_t target_system; ///< System ID
|
||||
uint8_t target_component; ///< Component ID
|
||||
float x; ///< x position
|
||||
float y; ///< y position
|
||||
float z; ///< z position
|
||||
float yaw; ///< Desired yaw angle
|
||||
} mavlink_local_position_setpoint_set_t;
|
||||
|
||||
#define MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET_LEN 18
|
||||
#define MAVLINK_MSG_ID_50_LEN 18
|
||||
|
||||
|
||||
|
||||
#define MAVLINK_MESSAGE_INFO_LOCAL_POSITION_SETPOINT_SET { \
|
||||
"LOCAL_POSITION_SETPOINT_SET", \
|
||||
6, \
|
||||
{ { "target_system", NULL, MAVLINK_TYPE_UINT8_T, 0, 0, offsetof(mavlink_local_position_setpoint_set_t, target_system) }, \
|
||||
{ "target_component", NULL, MAVLINK_TYPE_UINT8_T, 0, 1, offsetof(mavlink_local_position_setpoint_set_t, target_component) }, \
|
||||
{ "x", NULL, MAVLINK_TYPE_FLOAT, 0, 2, offsetof(mavlink_local_position_setpoint_set_t, x) }, \
|
||||
{ "y", NULL, MAVLINK_TYPE_FLOAT, 0, 6, offsetof(mavlink_local_position_setpoint_set_t, y) }, \
|
||||
{ "z", NULL, MAVLINK_TYPE_FLOAT, 0, 10, offsetof(mavlink_local_position_setpoint_set_t, z) }, \
|
||||
{ "yaw", NULL, MAVLINK_TYPE_FLOAT, 0, 14, offsetof(mavlink_local_position_setpoint_set_t, yaw) }, \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position_setpoint_set message
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_set_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
|
||||
uint8_t target_system, uint8_t target_component, float x, float y, float z, float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_float(buf, 2, x);
|
||||
_mav_put_float(buf, 6, y);
|
||||
_mav_put_float(buf, 10, z);
|
||||
_mav_put_float(buf, 14, yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 18);
|
||||
#else
|
||||
mavlink_local_position_setpoint_set_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 18);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET;
|
||||
return mavlink_finalize_message(msg, system_id, component_id, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pack a local_position_setpoint_set message on a channel
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param chan The MAVLink channel this message was sent over
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
* @return length of the message in bytes (excluding serial stream start sign)
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_set_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
|
||||
mavlink_message_t* msg,
|
||||
uint8_t target_system,uint8_t target_component,float x,float y,float z,float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_float(buf, 2, x);
|
||||
_mav_put_float(buf, 6, y);
|
||||
_mav_put_float(buf, 10, z);
|
||||
_mav_put_float(buf, 14, yaw);
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), buf, 18);
|
||||
#else
|
||||
mavlink_local_position_setpoint_set_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
memcpy(_MAV_PAYLOAD(msg), &packet, 18);
|
||||
#endif
|
||||
|
||||
msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET;
|
||||
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, 18);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Encode a local_position_setpoint_set struct into a message
|
||||
*
|
||||
* @param system_id ID of this system
|
||||
* @param component_id ID of this component (e.g. 200 for IMU)
|
||||
* @param msg The MAVLink message to compress the data into
|
||||
* @param local_position_setpoint_set C-struct to read the message contents from
|
||||
*/
|
||||
static inline uint16_t mavlink_msg_local_position_setpoint_set_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_setpoint_set_t* local_position_setpoint_set)
|
||||
{
|
||||
return mavlink_msg_local_position_setpoint_set_pack(system_id, component_id, msg, local_position_setpoint_set->target_system, local_position_setpoint_set->target_component, local_position_setpoint_set->x, local_position_setpoint_set->y, local_position_setpoint_set->z, local_position_setpoint_set->yaw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Send a local_position_setpoint_set message
|
||||
* @param chan MAVLink channel to send the message
|
||||
*
|
||||
* @param target_system System ID
|
||||
* @param target_component Component ID
|
||||
* @param x x position
|
||||
* @param y y position
|
||||
* @param z z position
|
||||
* @param yaw Desired yaw angle
|
||||
*/
|
||||
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
|
||||
|
||||
static inline void mavlink_msg_local_position_setpoint_set_send(mavlink_channel_t chan, uint8_t target_system, uint8_t target_component, float x, float y, float z, float yaw)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
|
||||
char buf[18];
|
||||
_mav_put_uint8_t(buf, 0, target_system);
|
||||
_mav_put_uint8_t(buf, 1, target_component);
|
||||
_mav_put_float(buf, 2, x);
|
||||
_mav_put_float(buf, 6, y);
|
||||
_mav_put_float(buf, 10, z);
|
||||
_mav_put_float(buf, 14, yaw);
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET, buf, 18);
|
||||
#else
|
||||
mavlink_local_position_setpoint_set_t packet;
|
||||
packet.target_system = target_system;
|
||||
packet.target_component = target_component;
|
||||
packet.x = x;
|
||||
packet.y = y;
|
||||
packet.z = z;
|
||||
packet.yaw = yaw;
|
||||
|
||||
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_SETPOINT_SET, (const char *)&packet, 18);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// MESSAGE LOCAL_POSITION_SETPOINT_SET UNPACKING
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get field target_system from local_position_setpoint_set message
|
||||
*
|
||||
* @return System ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_local_position_setpoint_set_get_target_system(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field target_component from local_position_setpoint_set message
|
||||
*
|
||||
* @return Component ID
|
||||
*/
|
||||
static inline uint8_t mavlink_msg_local_position_setpoint_set_get_target_component(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_uint8_t(msg, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field x from local_position_setpoint_set message
|
||||
*
|
||||
* @return x position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_set_get_x(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field y from local_position_setpoint_set message
|
||||
*
|
||||
* @return y position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_set_get_y(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field z from local_position_setpoint_set message
|
||||
*
|
||||
* @return z position
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_set_get_z(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get field yaw from local_position_setpoint_set message
|
||||
*
|
||||
* @return Desired yaw angle
|
||||
*/
|
||||
static inline float mavlink_msg_local_position_setpoint_set_get_yaw(const mavlink_message_t* msg)
|
||||
{
|
||||
return _MAV_RETURN_float(msg, 14);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decode a local_position_setpoint_set message into a struct
|
||||
*
|
||||
* @param msg The message to decode
|
||||
* @param local_position_setpoint_set C-struct to decode the message contents into
|
||||
*/
|
||||
static inline void mavlink_msg_local_position_setpoint_set_decode(const mavlink_message_t* msg, mavlink_local_position_setpoint_set_t* local_position_setpoint_set)
|
||||
{
|
||||
#if MAVLINK_NEED_BYTE_SWAP
|
||||
local_position_setpoint_set->target_system = mavlink_msg_local_position_setpoint_set_get_target_system(msg);
|
||||
local_position_setpoint_set->target_component = mavlink_msg_local_position_setpoint_set_get_target_component(msg);
|
||||
local_position_setpoint_set->x = mavlink_msg_local_position_setpoint_set_get_x(msg);
|
||||
local_position_setpoint_set->y = mavlink_msg_local_position_setpoint_set_get_y(msg);
|
||||
local_position_setpoint_set->z = mavlink_msg_local_position_setpoint_set_get_z(msg);
|
||||
local_position_setpoint_set->yaw = mavlink_msg_local_position_setpoint_set_get_yaw(msg);
|
||||
#else
|
||||
memcpy(local_position_setpoint_set, _MAV_PAYLOAD(msg), 18);
|
||||
#endif
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user